]> Dogcows Code - chaz/tint2/blobdiff - src/tint2conf/main.c
maybe fix for issue 298
[chaz/tint2] / src / tint2conf / main.c
index d419e4601f2bcf39d49443259070e48db3e34406..0fcfe4c223cf6c36fab58fca500508e2cd188a1c 100644 (file)
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **************************************************************************/
 
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <locale.h>
-#include <X11/Xlib.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <glib/gi18n.h>
-
-#ifdef BUILD_CMAKE
+#ifdef HAVE_VERSION_H
   #include "version.h"
-#else
-  #include "../version.h"
 #endif
+#include "main.h"
 #include "common.h"
 #include "theme_view.h"
+#include "properties.h"
 
 #define SNAPSHOT_TICK 190
 
@@ -107,8 +96,8 @@ static const char *global_ui =
        "    <toolitem action='ViewApply'/>"
        "  </toolbar>"
        "  <popup  name='ThemePopup'>"
-       "    <menuitem action='EditRefresh'/>"
        "    <menuitem action='ThemeProperties'/>"
+       "    <menuitem action='EditRefresh'/>"
        "    <menuitem action='ViewApply'/>"
        "    <separator/>"
        "    <menuitem action='ThemeDelete'/>"
@@ -118,19 +107,19 @@ static const char *global_ui =
 
 // define menubar and toolbar action
 static GtkActionEntry entries[] = {
-       {"ThemeMenu", NULL, "Theme", NULL, NULL, NULL},
-       {"ThemeAdd", GTK_STOCK_ADD, "_Add...", "<Control>N", "Add theme", G_CALLBACK (menuAdd)},
-       {"ThemeSaveAs", GTK_STOCK_SAVE_AS, "_Save as...", NULL, "Save theme as", G_CALLBACK (menuSaveAs)},
-       {"ThemeDelete", GTK_STOCK_DELETE, "_Delete", NULL, "Delete theme", G_CALLBACK (menuDelete)},
-       {"ThemeProperties", GTK_STOCK_PROPERTIES, "_Properties...", NULL, "Show properties", G_CALLBACK (menuProperties)},
-       {"ThemeQuit", GTK_STOCK_QUIT, "_Quit", "<control>Q", "Quit", G_CALLBACK (menuQuit)},
+       {"ThemeMenu", NULL, _("Theme"), NULL, NULL, NULL},
+       {"ThemeAdd", GTK_STOCK_ADD, _("_Add..."), "<Control>N", _("Add theme"), G_CALLBACK (menuAdd)},
+       {"ThemeSaveAs", GTK_STOCK_SAVE_AS, _("_Save as..."), NULL, _("Save theme as"), G_CALLBACK (menuSaveAs)},
+       {"ThemeDelete", GTK_STOCK_DELETE, _("_Delete"), NULL, _("Delete theme"), G_CALLBACK (menuDelete)},
+       {"ThemeProperties", GTK_STOCK_PROPERTIES, _("_Properties..."), NULL, _("Show properties"), G_CALLBACK (menuProperties)},
+       {"ThemeQuit", GTK_STOCK_QUIT, _("_Quit"), "<control>Q", _("Quit"), G_CALLBACK (menuQuit)},
        {"EditMenu", NULL, "Edit", NULL, NULL, NULL},
-       {"EditRefresh", GTK_STOCK_REFRESH, "Refresh", NULL, "Refresh", G_CALLBACK (menuRefresh)},
-       {"EditRefreshAll", GTK_STOCK_REFRESH, "Refresh all", NULL, "Refresh all", G_CALLBACK (menuRefreshAll)},
+       {"EditRefresh", GTK_STOCK_REFRESH, _("Refresh"), NULL, _("Refresh"), G_CALLBACK (menuRefresh)},
+       {"EditRefreshAll", GTK_STOCK_REFRESH, _("Refresh all"), NULL, _("Refresh all"), G_CALLBACK (menuRefreshAll)},
 //     {"EditPreferences", GTK_STOCK_PREFERENCES, "Preferences", NULL, "Preferences", G_CALLBACK (menuPreferences)},
-       {"ViewApply", GTK_STOCK_APPLY, "Apply", NULL, "Apply theme", G_CALLBACK (menuApply)},
-       {"HelpMenu", NULL, "Help", NULL, NULL, NULL},
-       {"HelpAbout", GTK_STOCK_ABOUT, "_About", "<Control>A", "About", G_CALLBACK (menuAbout)}
+       {"ViewApply", GTK_STOCK_APPLY, _("Apply"), NULL, _("Apply theme"), G_CALLBACK (menuApply)},
+       {"HelpMenu", NULL, _("Help"), NULL, NULL, NULL},
+       {"HelpAbout", GTK_STOCK_ABOUT, _("_About"), "<Control>A", _("About"), G_CALLBACK (menuAbout)}
 };
 
 
@@ -151,12 +140,12 @@ int main (int argc, char ** argv)
        g_signal_connect(G_OBJECT(g_window), "destroy", G_CALLBACK (menuQuit), NULL);
        g_signal_connect(g_window, "size-allocate", G_CALLBACK(windowSizeAllocated), NULL);
        vBox = gtk_vbox_new (FALSE, 0);
-   gtk_container_add (GTK_CONTAINER(g_window), vBox);
+       gtk_container_add (GTK_CONTAINER(g_window), vBox);
 
        actionGroup = gtk_action_group_new ("menuActionGroup");
-   gtk_action_group_add_actions (actionGroup, entries, G_N_ELEMENTS (entries), NULL);
+       gtk_action_group_add_actions (actionGroup, entries, G_N_ELEMENTS (entries), NULL);
        globalUIManager = gtk_ui_manager_new();
-   gtk_ui_manager_insert_action_group (globalUIManager, actionGroup, 0);
+       gtk_ui_manager_insert_action_group (globalUIManager, actionGroup, 0);
        gtk_ui_manager_add_ui_from_string (globalUIManager, global_ui, -1, NULL );
        g_signal_connect(globalUIManager, "add_widget", G_CALLBACK (menuAddWidget), vBox);
        gtk_ui_manager_ensure_update(globalUIManager);
@@ -167,14 +156,18 @@ int main (int argc, char ** argv)
        // define theme view
        g_theme_view = create_view();
        gtk_container_add(GTK_CONTAINER(scrollbar), g_theme_view);
-   gtk_widget_show(g_theme_view);
+       gtk_widget_show(g_theme_view);
        g_signal_connect(g_theme_view, "button-press-event", (GCallback)view_onButtonPressed, NULL);
        g_signal_connect(g_theme_view, "popup-menu", (GCallback)view_onPopupMenu, NULL);
        g_signal_connect(g_theme_view, "row-activated", G_CALLBACK(viewRowActivated), NULL);
 
-   // load themes
+       // load themes
        load_theme(g_theme_view);
 
+       /* temporaire !!!!!!!!!!!!!!
+       GtkWidget *prop = create_properties();
+       gtk_window_present(GTK_WINDOW(prop));
+       //*/
        gtk_widget_show_all(g_window);
        gtk_main ();
        return 0;
@@ -183,8 +176,8 @@ int main (int argc, char ** argv)
 
 static void menuAddWidget (GtkUIManager * p_uiManager, GtkWidget * p_widget, GtkContainer * p_box)
 {
-   gtk_box_pack_start(GTK_BOX(p_box), p_widget, FALSE, FALSE, 0);
-   gtk_widget_show(p_widget);
+       gtk_box_pack_start(GTK_BOX(p_box), p_widget, FALSE, FALSE, 0);
+       gtk_widget_show(p_widget);
 }
 
 
@@ -192,7 +185,7 @@ static void menuAbout()
 {
        const char *authors[] = { "Thierry Lorthiois <lorthiois@bbsoft.fr>", "Andreas Fink <andreas.fink85@googlemail.com>", "Christian Ruppert <Spooky85@gmail.com> (Build system)", "Euan Freeman <euan04@gmail.com> (tintwizard)\n  See http://code.google.com/p/tintwizard/", NULL };
 
-       gtk_show_about_dialog(g_window, "name", g_get_application_name( ),
+       gtk_show_about_dialog(GTK_WINDOW(g_window), "name", g_get_application_name( ),
                                                                "comments", _("Theming tool for tint2 panel"),
                                                                "version", VERSION_STRING,
                                                                "copyright", _("Copyright 2009 tint2 team\nTint2 License GNU GPL version 2\nTintwizard License GNU GPL version 3"),
@@ -211,7 +204,7 @@ static void menuAdd()
        GtkFileChooser *chooser;
        GtkFileFilter *filter;
 
-       dialog = gtk_file_chooser_dialog_new(_("Add a theme"), g_window, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
+       dialog = gtk_file_chooser_dialog_new(_("Add a theme"), GTK_WINDOW(g_window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
        chooser = GTK_FILE_CHOOSER(dialog);
 
        gtk_file_chooser_set_current_folder(chooser, g_get_home_dir());
@@ -246,7 +239,7 @@ static void menuAdd()
                        gchar *message;
                        message = g_strdup_printf(_("Couldn't add duplicate theme\n\'%s\'."), pt1);
 
-                       GtkWidget *w = gtk_message_dialog_new(g_window, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, message, NULL);
+                       GtkWidget *w = gtk_message_dialog_new(GTK_WINDOW(g_window), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, message, NULL);
                        g_signal_connect_swapped(w, "response", G_CALLBACK(gtk_widget_destroy), w);
                        gtk_widget_show(w);
                        g_free(message);
@@ -282,7 +275,7 @@ static void menuSaveAs ()
 
        sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(g_theme_view));
        if (!gtk_tree_selection_get_selected(GTK_TREE_SELECTION(sel), &model, &iter)) {
-               GtkWidget *w = gtk_message_dialog_new(g_window, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Select the theme to be saved."), NULL);
+               GtkWidget *w = gtk_message_dialog_new(GTK_WINDOW(g_window), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Select the theme to be saved."));
                g_signal_connect_swapped(w, "response", G_CALLBACK(gtk_widget_destroy), w);
                gtk_widget_show(w);
                return;
@@ -292,7 +285,7 @@ static void menuSaveAs ()
        pt1 = strrchr (file, '/');
        if (pt1) pt1++;
 
-       dialog = gtk_file_chooser_dialog_new(_("Save theme as"), g_window, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
+       dialog = gtk_file_chooser_dialog_new(_("Save theme as"), GTK_WINDOW(g_window), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
        chooser = GTK_FILE_CHOOSER(dialog);
 
        gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE);
@@ -341,13 +334,19 @@ static void menuProperties()
        sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(g_theme_view));
        if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(sel), &model, &iter)) {
                gtk_tree_model_get(model, &iter, COL_THEME_FILE, &file,  -1);
+/*
+               GtkWidget *prop;
+               prop = create_properties();
+               gtk_window_present(GTK_WINDOW(prop));
+               //printf("menuProperties : fin\n");
+//*/
 
                cmd = g_strdup_printf("%s \'%s\' &", g_cmd_property, file);
                printf("cmd %s\n", cmd);
                system(cmd);
-
                g_free(cmd);
                g_free(file);
+               
        }
 }
 
@@ -581,7 +580,7 @@ void read_config()
        }
        g_width = 500;
        g_height = 350;
-       g_cmd_property = g_strdup("python /usr/bin/tintwizard.py");
+       g_cmd_property = g_strconcat( "/usr/bin/env python ", INSTALL_PREFIX, "/bin/tintwizard.py", (void*)0 );
 
        // load config
        path = g_build_filename (g_get_user_config_dir(), "tint2", "tint2confrc", NULL);
This page took 0.032689 seconds and 4 git commands to generate.