Author: peter
Date: 2007-01-14 17:00:19 +0000 (Sun, 14 Jan 2007)
New Revision: 24448

Modified:
   squeeze/trunk/libsqueeze/archive-support.c
   squeeze/trunk/libsqueeze/archive-support.h
   squeeze/trunk/po/POTFILES.in
   squeeze/trunk/src/Makefile.am
   squeeze/trunk/src/application.c
   squeeze/trunk/src/main_window.c
   squeeze/trunk/src/notebook.c
   squeeze/trunk/src/notebook.h
   squeeze/trunk/src/settings.c
   squeeze/trunk/src/widget_factory.c
   squeeze/trunk/src/widget_factory.h
Log:
removed preferences dialog
renewed custom action notification
added more preferences to menu
saving more settings


Modified: squeeze/trunk/libsqueeze/archive-support.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support.c  2007-01-14 15:42:02 UTC (rev 
24447)
+++ squeeze/trunk/libsqueeze/archive-support.c  2007-01-14 17:00:19 UTC (rev 
24448)
@@ -342,27 +342,14 @@
 }
 
 void
-lsq_custom_action_execute(LSQCustomAction *action, LSQArchive *archive, 
LSQCustomActionPreFunc pre_func, LSQCustomActionPostFunc post_func)
+lsq_custom_action_execute(LSQCustomAction *action, LSQArchive *archive, 
LSQCustomActionCallback *callback)
 {
-       if(pre_func)
-       {
-               if(pre_func(action) == FALSE)
-                       return;
-       }
-       /* set post-condition-callback */
-       action->post_func = post_func;  
+       action->callback = callback;    
        action->func(action->support, archive, action, action->user_data);
 }
 
 void
 lsq_custom_action_notify(LSQCustomAction *action, const gchar *message)
 {
-       action->notify_func(action->support->id, message, action->user_data);
+       action->callback->notify_func(action, message);
 }
-
-void
-lsq_custom_action_set_notify_function(LSQCustomAction *action, 
LSQCustomActionNotifyFunc func, gpointer user_data)
-{
-       action->notify_func = func;
-       action->notify_user_data = user_data;
-}

Modified: squeeze/trunk/libsqueeze/archive-support.h
===================================================================
--- squeeze/trunk/libsqueeze/archive-support.h  2007-01-14 15:42:02 UTC (rev 
24447)
+++ squeeze/trunk/libsqueeze/archive-support.h  2007-01-14 17:00:19 UTC (rev 
24448)
@@ -42,13 +42,22 @@
                        LSQ_TYPE_ARCHIVE_SUPPORT))
 
 typedef struct _LSQCustomAction LSQCustomAction;
+typedef struct _LSQCustomActionCallback LSQCustomActionCallback;
 typedef struct _LSQArchiveSupport LSQArchiveSupport;
 
 typedef gboolean (*LSQCustomActionPreFunc) (LSQCustomAction *);
 typedef gboolean (*LSQCustomActionFunc) (LSQArchiveSupport *support, 
LSQArchive *, LSQCustomAction*, gpointer user_data);
 typedef gboolean (*LSQCustomActionPostFunc) (LSQCustomAction *, gboolean);
-typedef gboolean (*LSQCustomActionNotifyFunc) (const gchar*, const gchar*, 
gpointer);
+typedef gboolean (*LSQCustomActionNotifyFunc) (LSQCustomAction *, const 
gchar*);
 
+
+struct _LSQCustomActionCallback
+{
+       LSQCustomActionNotifyFunc notify_func;
+       LSQCustomActionPostFunc post_func;
+       LSQCustomActionPreFunc pre_func;
+};
+
 struct _LSQCustomAction
 {
        gchar *name;
@@ -56,9 +65,7 @@
        gchar *blurb;
        gchar *icon;
        LSQCustomActionFunc func;
-       LSQCustomActionPostFunc post_func;
-       LSQCustomActionNotifyFunc notify_func;
-       gpointer notify_user_data;
+       LSQCustomActionCallback *callback;
        LSQArchiveSupport *support;
        gpointer user_data;
 };
@@ -128,9 +135,8 @@
 const gchar*         lsq_custom_action_get_nick(LSQCustomAction*);
 const gchar*         lsq_custom_action_get_blurb(LSQCustomAction*);
 const gchar*         lsq_custom_action_get_icon_name(LSQCustomAction*);
-void                 lsq_custom_action_execute(LSQCustomAction*, LSQArchive *, 
LSQCustomActionPreFunc, LSQCustomActionPostFunc);
+void                 lsq_custom_action_execute(LSQCustomAction*, LSQArchive *, 
LSQCustomActionCallback *);
 void                 lsq_custom_action_notify(LSQCustomAction*, const gchar*);
-void                 lsq_custom_action_set_notify_function(LSQCustomAction*, 
LSQCustomActionNotifyFunc, gpointer);
 
 G_END_DECLS
 

Modified: squeeze/trunk/po/POTFILES.in
===================================================================
--- squeeze/trunk/po/POTFILES.in        2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/po/POTFILES.in        2007-01-14 17:00:19 UTC (rev 24448)
@@ -12,7 +12,6 @@
 src/new_dialog.c
 src/add_dialog.c
 src/extract_dialog.c
-src/preferences_dialog.c
 src/button_drag_box.c
 src/properties_dialog.c
 

Modified: squeeze/trunk/src/Makefile.am
===================================================================
--- squeeze/trunk/src/Makefile.am       2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/Makefile.am       2007-01-14 17:00:19 UTC (rev 24448)
@@ -23,7 +23,6 @@
        $(PATHBAR_FILES) \
        settings.c settings.h \
        archive_store.c archive_store.h \
-       preferences_dialog.c preferences_dialog.h \
        properties_dialog.c properties_dialog.h \
        new_dialog.c new_dialog.h \
        add_dialog.c add_dialog.h \

Modified: squeeze/trunk/src/application.c
===================================================================
--- squeeze/trunk/src/application.c     2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/application.c     2007-01-14 17:00:19 UTC (rev 24448)
@@ -122,6 +122,8 @@
        sq_settings_write_bool_entry(application->settings, "UseTabs", 
application->props._tabs);
 
        sq_settings_save(application->settings);
+
+       g_object_unref(G_OBJECT(application->settings));
 }
 
 SQApplication *

Modified: squeeze/trunk/src/main_window.c
===================================================================
--- squeeze/trunk/src/main_window.c     2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/main_window.c     2007-01-14 17:00:19 UTC (rev 24448)
@@ -94,7 +94,7 @@
 static void cb_sq_main_close_window(GtkWidget *widget, gpointer userdata);
 
 static void cb_sq_main_properties(GtkWidget *widget, gpointer userdata);
-static void cb_sq_main_preferences(GtkWidget *widget, gpointer userdata);
+/*static void cb_sq_main_preferences(GtkWidget *widget, gpointer userdata);*/
 
 static void cb_sq_main_about(GtkWidget *widget, gpointer userdata);
 
@@ -217,6 +217,8 @@
 
        sq_settings_save(window->settings);
 
+       g_object_unref(G_OBJECT(window->settings));
+
        //if(window->navigationbar)
        //      gtk_widget_destroy(GTK_WIDGET(window->navigationbar));
 
@@ -328,11 +330,13 @@
                }
 #endif
 
+/*
                window->menubar.menu_item_settings = 
gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, window->accel_group);
 
                g_signal_connect(G_OBJECT(window->menubar.menu_item_settings), 
"activate", G_CALLBACK(cb_sq_main_preferences), window);
 
                gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
window->menubar.menu_item_settings);
+*/
 
                gtk_widget_show_all(window->menubar.menu_view);
 
@@ -442,6 +446,18 @@
                gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
iter->data);
                gtk_widget_show(iter->data);
        }
+       list = sq_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window->notebook), "sort-folders-first");
+       for(iter = list; iter; iter = iter->next)
+       {
+               gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
iter->data);
+               gtk_widget_show(iter->data);
+       }
+       list = sq_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window->notebook), "sort-case-sensitive");
+       for(iter = list; iter; iter = iter->next)
+       {
+               gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
iter->data);
+               gtk_widget_show(iter->data);
+       }
        list = sq_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window->notebook), "rules-hint");
        for(iter = list; iter; iter = iter->next)
        {
@@ -798,7 +814,7 @@
 }
 
 
-
+/*
 static void
 cb_sq_main_preferences(GtkWidget *widget, gpointer userdata)
 {
@@ -846,6 +862,7 @@
 
        gtk_widget_destroy(dialog);
 }
+*/
 
 static void
 cb_sq_main_about(GtkWidget *widget, gpointer userdata)

Modified: squeeze/trunk/src/notebook.c
===================================================================
--- squeeze/trunk/src/notebook.c        2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/notebook.c        2007-01-14 17:00:19 UTC (rev 24448)
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 #include <thunar-vfs/thunar-vfs.h>
 #include <libsqueeze/libsqueeze.h>
+#include "settings.h"
 #include "archive_store.h"
 #include "navigation_bar.h"
 #include "tool_bar.h"
@@ -70,6 +71,8 @@
 enum {
        SQ_NOTEBOOK_MULTI_TAB = 1,
        SQ_NOTEBOOK_STORE_SHOW_ICONS,
+       SQ_NOTEBOOK_STORE_SORT_FOLDERS_FIRST,
+       SQ_NOTEBOOK_STORE_SORT_CASE_SENSITIVE,
        SQ_NOTEBOOK_TREE_RULES_HINT
 };
 
@@ -176,21 +179,21 @@
                FALSE,
                G_PARAM_READWRITE);
        g_object_class_install_property(object_class, 
SQ_NOTEBOOK_STORE_SHOW_ICONS, pspec);
-/*
+
        pspec = g_param_spec_boolean("sort_folders_first",
                _("Sort folders before files"),
                _("The folders will be put at the top of the list"),
                TRUE,
                G_PARAM_READWRITE);
-       g_object_class_install_property(object_class, 
SQ_ARCHIVE_STORE_SORT_FOLDERS_FIRST, pspec);
+       g_object_class_install_property(object_class, 
SQ_NOTEBOOK_STORE_SORT_FOLDERS_FIRST, pspec);
 
        pspec = g_param_spec_boolean("sort_case_sensitive",
                _("Sort text case sensitive"),
                _("Sort text case sensitive"),
                TRUE,
                G_PARAM_READWRITE);
-       g_object_class_install_property(object_class, 
SQ_ARCHIVE_STORE_SORT_CASE_SENSITIVE, pspec);
-*/
+       g_object_class_install_property(object_class, 
SQ_NOTEBOOK_STORE_SORT_CASE_SENSITIVE, pspec);
+
        pspec = g_param_spec_boolean("rules-hint",
                _("Rules hint"),
                _("Make the row background colors alternate"),
@@ -208,9 +211,13 @@
        g_signal_connect(G_OBJECT(notebook), "page-up", 
G_CALLBACK(gtk_notebook_next_page),  NULL);
        g_signal_connect(G_OBJECT(notebook), "page-down", 
G_CALLBACK(gtk_notebook_prev_page), NULL);
 
+       notebook->settings = sq_settings_new();
+
        notebook->current_page_fix = 0;
-       notebook->props._rules_hint = FALSE;
-       notebook->props._show_icons = TRUE;
+       notebook->props._rules_hint = 
sq_settings_read_bool_entry(notebook->settings, "RulesHint", FALSE);
+       notebook->props._show_icons = 
sq_settings_read_bool_entry(notebook->settings, "ShowIcons", TRUE);
+       notebook->props._sort_folders_first = 
sq_settings_read_bool_entry(notebook->settings, "SortFoldersFirst", TRUE);
+       notebook->props._sort_case_sensitive = 
sq_settings_read_bool_entry(notebook->settings, "SortCaseSensitive", TRUE);
        notebook->multi_tab = TRUE;
        notebook->accel_group = NULL;
 
@@ -226,6 +233,21 @@
 {
        /* TODO: unref archive_stores */
        GtkNotebook *notebook = GTK_NOTEBOOK(object);
+       SQNotebook *sq_notebook = SQ_NOTEBOOK(object);
+
+       if(sq_notebook->settings)
+       {
+               sq_settings_write_bool_entry(sq_notebook->settings, 
"RulesHint", sq_notebook->props._rules_hint);
+               sq_settings_write_bool_entry(sq_notebook->settings, 
"ShowIcons", sq_notebook->props._show_icons);
+               sq_settings_write_bool_entry(sq_notebook->settings, 
"SortFoldersFirst", sq_notebook->props._sort_folders_first);
+               sq_settings_write_bool_entry(sq_notebook->settings, 
"SortCaseSensitive", sq_notebook->props._sort_case_sensitive);
+
+               sq_settings_save(sq_notebook->settings);
+
+               g_object_unref(G_OBJECT(sq_notebook->settings));
+               sq_notebook->settings = NULL;
+       }
+
        gint n = gtk_notebook_get_n_pages(notebook);
        gint i = 0;
        for(i = 0; i < n; i++)
@@ -244,6 +266,7 @@
 
                lsq_close_archive(archive);
        }
+
        parent_class->dispose(object);
 }
 
@@ -278,17 +301,31 @@
                        SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
                        if(store)
                                sq_archive_store_set_show_icons(store, 
g_value_get_boolean(value));
-                       else
-                               SQ_NOTEBOOK(object)->props._show_icons = 
g_value_get_boolean(value);
+                       SQ_NOTEBOOK(object)->props._show_icons = 
g_value_get_boolean(value);
                        break;
                }
+               case SQ_NOTEBOOK_STORE_SORT_FOLDERS_FIRST:
+               {
+                       SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
+                       if(store)
+                               sq_archive_store_set_sort_folders_first(store, 
g_value_get_boolean(value));
+                       SQ_NOTEBOOK(object)->props._sort_folders_first = 
g_value_get_boolean(value);
+                       break;
+               }
+               case SQ_NOTEBOOK_STORE_SORT_CASE_SENSITIVE:
+               {
+                       SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
+                       if(store)
+                               sq_archive_store_set_sort_case_sensitive(store, 
g_value_get_boolean(value));
+                       SQ_NOTEBOOK(object)->props._sort_case_sensitive = 
g_value_get_boolean(value);
+                       break;
+               }
                case SQ_NOTEBOOK_TREE_RULES_HINT:
                {
                        GtkTreeView *tree = 
sq_notebook_get_tree_view(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
                        if(tree)
                                gtk_tree_view_set_rules_hint(tree, 
g_value_get_boolean(value));
-                       else
-                               SQ_NOTEBOOK(object)->props._rules_hint = 
g_value_get_boolean(value);
+                       SQ_NOTEBOOK(object)->props._rules_hint = 
g_value_get_boolean(value);
                        break;
                }
        }
@@ -311,6 +348,24 @@
                                g_value_set_boolean(value, 
SQ_NOTEBOOK(object)->props._show_icons);
                        break;
                }
+               case SQ_NOTEBOOK_STORE_SORT_FOLDERS_FIRST:
+               {
+                       SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
+                       if(store)
+                               g_value_set_boolean(value, 
sq_archive_store_get_sort_folders_first(store));
+                       else
+                               g_value_set_boolean(value, 
SQ_NOTEBOOK(object)->props._sort_folders_first);
+                       break;
+               }
+               case SQ_NOTEBOOK_STORE_SORT_CASE_SENSITIVE:
+               {
+                       SQArchiveStore *store = 
sq_notebook_get_store(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
+                       if(store)
+                               g_value_set_boolean(value, 
sq_archive_store_get_sort_case_sensitive(store));
+                       else
+                               g_value_set_boolean(value, 
SQ_NOTEBOOK(object)->props._sort_case_sensitive);
+                       break;
+               }
                case SQ_NOTEBOOK_TREE_RULES_HINT:
                {
                        GtkTreeView *tree = 
sq_notebook_get_tree_view(SQ_NOTEBOOK(object), 
SQ_NOTEBOOK(object)->current_page_fix);
@@ -427,6 +482,8 @@
        gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
 
        GtkTreeModel *tree_model = sq_archive_store_new(archive, 
notebook->props._show_icons, notebook->props._up_dir, notebook->icon_theme);
+       sq_archive_store_set_sort_folders_first(SQ_ARCHIVE_STORE(tree_model), 
notebook->props._sort_folders_first);
+       sq_archive_store_set_sort_case_sensitive(SQ_ARCHIVE_STORE(tree_model), 
notebook->props._sort_case_sensitive);
        g_signal_connect(G_OBJECT(tree_model), "notify", 
G_CALLBACK(cb_sq_notebook_notify_proxy), notebook);
 
        gtk_box_pack_start(GTK_BOX(lbl_hbox), archive_image, FALSE, FALSE, 3);
@@ -764,7 +821,7 @@
 static void
 cb_sq_notebook_notify_proxy(GObject *obj, GParamSpec *pspec, gpointer 
user_data)
 {
-       if(strcmp(g_param_spec_get_name(pspec), "show-icons") == 0)
+       if(strcmp(g_param_spec_get_name(pspec), "show-icons") == 0 || 
strcmp(g_param_spec_get_name(pspec), "rules-hint") == 0)
        {
                g_object_notify(user_data, g_param_spec_get_name(pspec));
 
@@ -773,14 +830,9 @@
 
                
sq_notebook_treeview_reset_columns(sq_archive_store_get_archive(store), 
treeview);
        }
-       if(strcmp(g_param_spec_get_name(pspec), "show-icons") == 0)
+       if(strcmp(g_param_spec_get_name(pspec), "sort-folders-first") == 0 || 
strcmp(g_param_spec_get_name(pspec), "sort-case-sensitive") == 0)
        {
                g_object_notify(user_data, g_param_spec_get_name(pspec));
-
-               GtkTreeView *treeview = 
sq_notebook_get_active_tree_view(SQ_NOTEBOOK(user_data));
-               SQArchiveStore *store = 
SQ_ARCHIVE_STORE(gtk_tree_view_get_model(treeview));
-
-               
sq_notebook_treeview_reset_columns(sq_archive_store_get_archive(store), 
treeview);
        }
 }
 

Modified: squeeze/trunk/src/notebook.h
===================================================================
--- squeeze/trunk/src/notebook.h        2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/notebook.h        2007-01-14 17:00:19 UTC (rev 24448)
@@ -47,10 +47,13 @@
        GtkNotebook parent;
        SQNavigationBar *navigation_bar;
        gboolean multi_tab;
+       SQSettings *settings;
        struct
        {
                gboolean _show_icons;
                gboolean _up_dir;
+               gboolean _sort_folders_first;
+               gboolean _sort_case_sensitive;
                gboolean _rules_hint;
        } props;
        GtkIconTheme *icon_theme;

Modified: squeeze/trunk/src/settings.c
===================================================================
--- squeeze/trunk/src/settings.c        2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/settings.c        2007-01-14 17:00:19 UTC (rev 24448)
@@ -26,11 +26,14 @@
 #include "settings.h"
 
 static SQSettings *sq_global_settings = NULL;
+static GObjectClass *parent_class = NULL;
 
 static void
 sq_settings_init(SQSettings *);
 static void
 sq_settings_class_init(SQSettingsClass *);
+static GObject *
+sq_settings_singleton_constuctor(GType, guint, GObjectConstructParam *);
 
 GType
 sq_settings_get_type ()
@@ -71,14 +74,14 @@
 static void
 sq_settings_class_init(SQSettingsClass *object_class)
 {
-
+       parent_class = g_type_class_peek_parent(object_class);
+       G_OBJECT_CLASS(object_class)->constructor = 
sq_settings_singleton_constuctor;
 }
 
 SQSettings *
 sq_settings_new()
 {
-       if(!sq_global_settings)
-               sq_global_settings = g_object_new(SQ_TYPE_SETTINGS, NULL);
+       sq_global_settings = g_object_new(SQ_TYPE_SETTINGS, NULL);
 
        return sq_global_settings;
 }
@@ -154,3 +157,17 @@
        return fallback;
 #endif /* HAVE_LIBXFCE4UTIL */
 }
+
+static GObject *
+sq_settings_singleton_constuctor(GType type, guint n_construct_params, 
GObjectConstructParam *construct_params)
+{
+       GObject *object;
+       if(!sq_global_settings)
+       {
+               object = parent_class->constructor(type, n_construct_params, 
construct_params);
+               sq_global_settings = SQ_SETTINGS(object);
+       }
+       else
+               object = g_object_ref(SQ_SETTINGS(sq_global_settings));
+       return object;
+}

Modified: squeeze/trunk/src/widget_factory.c
===================================================================
--- squeeze/trunk/src/widget_factory.c  2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/widget_factory.c  2007-01-14 17:00:19 UTC (rev 24448)
@@ -31,6 +31,7 @@
 #define SQ_PROPERTY_SPEC_DATA "sq-property-spec"
 #define SQ_PROPERTY_VALUE_DATA "sq-property-value"
 #define SQ_ACTION_CUSTOM_DATA "sq-action-custom"
+#define SQ_ACTION_CALLBACK_DATA "sq-action-callback"
 
 static void
 sq_widget_factory_class_init(SQWidgetFactoryClass *factory_class);
@@ -72,7 +73,7 @@
 cb_sq_widget_factory_action_triggered(GtkWidget *widget, gpointer user_data);
 
 static void
-sq_widget_factory_notify(const gchar *name, const gchar *message, gpointer 
user_data);
+sq_widget_factory_notify(LSQCustomAction *action, const gchar *message);
 
 GType
 sq_widget_factory_get_type()
@@ -110,6 +111,8 @@
 sq_widget_factory_init(SQWidgetFactory *factory)
 {
        factory->tips = gtk_tooltips_new();
+       factory->custom_callback = g_new(LSQCustomActionCallback, 1);
+       factory->custom_callback->notify_func = 
(LSQCustomActionNotifyFunc)sq_widget_factory_notify;
 }
 
 SQWidgetFactory*
@@ -886,6 +889,7 @@
 
        widget = gtk_button_new_with_label(lsq_custom_action_get_nick(action));
        g_object_set_data(G_OBJECT(widget), SQ_ACTION_CUSTOM_DATA, action);
+       g_object_set_data(G_OBJECT(widget), SQ_ACTION_CALLBACK_DATA, 
factory->custom_callback);
        g_signal_connect(G_OBJECT(widget), "clicked", 
G_CALLBACK(cb_sq_widget_factory_action_triggered), archive);
 
        const gchar *large_tip = lsq_custom_action_get_blurb(action);
@@ -916,6 +920,7 @@
 
        menu = gtk_menu_item_new_with_label(lsq_custom_action_get_nick(action));
        g_object_set_data(G_OBJECT(menu), SQ_ACTION_CUSTOM_DATA, action);
+       g_object_set_data(G_OBJECT(menu), SQ_ACTION_CALLBACK_DATA, 
factory->custom_callback);
        g_signal_connect(G_OBJECT(menu), "activate", 
G_CALLBACK(cb_sq_widget_factory_action_triggered), archive);
        gtk_widget_show(menu);
 
@@ -933,6 +938,7 @@
 
        widget = gtk_tool_button_new(NULL, lsq_custom_action_get_nick(action));
        g_object_set_data(G_OBJECT(widget), SQ_ACTION_CUSTOM_DATA, action);
+       g_object_set_data(G_OBJECT(widget), SQ_ACTION_CALLBACK_DATA, 
factory->custom_callback);
        g_signal_connect(G_OBJECT(widget), "clicked", 
G_CALLBACK(cb_sq_widget_factory_action_triggered), archive);
 
        const gchar *large_tip = lsq_custom_action_get_blurb(action);
@@ -964,9 +970,9 @@
        {
                if(strncmp("menu", lsq_custom_action_get_name(action[i]), 4) == 
0)
                {
-                       lsq_custom_action_set_notify_function(action[i], 
(LSQCustomActionNotifyFunc)sq_widget_factory_notify, NULL);
                        item = 
gtk_menu_item_new_with_label(lsq_custom_action_get_nick(action[i]));
                        g_object_set_data(G_OBJECT(item), 
SQ_ACTION_CUSTOM_DATA, action[i]);
+                       g_object_set_data(G_OBJECT(item), 
SQ_ACTION_CALLBACK_DATA, factory->custom_callback);
                        g_signal_connect(G_OBJECT(item), "activate", 
G_CALLBACK(cb_sq_widget_factory_action_triggered), archive);
                        menu = g_slist_append(menu, item);
                        gtk_widget_show(item);
@@ -983,7 +989,7 @@
 {
        LSQArchive *archive = LSQ_ARCHIVE(user_data);
 
-       lsq_custom_action_execute(g_object_get_data(G_OBJECT(widget), 
SQ_ACTION_CUSTOM_DATA), archive, NULL, NULL);
+       lsq_custom_action_execute(g_object_get_data(G_OBJECT(widget), 
SQ_ACTION_CUSTOM_DATA), archive, g_object_get_data(G_OBJECT(widget), 
SQ_ACTION_CALLBACK_DATA));
 }
 
 static void
@@ -993,9 +999,9 @@
 }
 
 static void
-sq_widget_factory_notify(const gchar *name, const gchar *message, gpointer 
user_data)
+sq_widget_factory_notify(LSQCustomAction *action, const gchar *message)
 {
-       GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(user_data), 
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s: %s", name, message);
+       GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, 
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s: %s", action->support->id, message);
        gtk_dialog_run(GTK_DIALOG(dialog));
        gtk_widget_destroy(dialog);
 }

Modified: squeeze/trunk/src/widget_factory.h
===================================================================
--- squeeze/trunk/src/widget_factory.h  2007-01-14 15:42:02 UTC (rev 24447)
+++ squeeze/trunk/src/widget_factory.h  2007-01-14 17:00:19 UTC (rev 24448)
@@ -42,6 +42,7 @@
 {
        GObject parent;
        GtkTooltips *tips;
+       LSQCustomActionCallback *custom_callback;
 } SQWidgetFactory;
 
 typedef struct

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to