Author: peter
Date: 2006-11-22 14:49:08 +0000 (Wed, 22 Nov 2006)
New Revision: 23933

Modified:
   xarchiver/branches/xarchiver-psybsd/TODO
   xarchiver/branches/xarchiver-psybsd/src/archive_store.c
   xarchiver/branches/xarchiver-psybsd/src/main_window.c
   xarchiver/branches/xarchiver-psybsd/src/main_window.h
   xarchiver/branches/xarchiver-psybsd/src/notebook.c
   xarchiver/branches/xarchiver-psybsd/src/widget_factory.c
Log:
Toggle navigation bar using property
Remember trailing folders for path bar


Modified: xarchiver/branches/xarchiver-psybsd/TODO
===================================================================
--- xarchiver/branches/xarchiver-psybsd/TODO    2006-11-22 13:38:24 UTC (rev 
23932)
+++ xarchiver/branches/xarchiver-psybsd/TODO    2006-11-22 14:49:08 UTC (rev 
23933)
@@ -14,6 +14,10 @@
 
        Fix Command-line options - DONE
 
+       Toggle navigationbar at runtime - DONE
+       
+       Save trailing folders for path_bar - DONE
+
        Add Accelerators to Notebook
 
   Add Dialog
@@ -42,8 +46,6 @@
 
        In archive store, on delete in parent dir of current entry, check if 
map still exists, if not move to the ancestor that still exists
 
-       Save trailing folders for path_bar
-
        In treeview, when going to up dir, select the dir you came from
 
        When retrieving selected items from the treeview, forget the updir item
@@ -55,9 +57,7 @@
 
        Add progressbar to statusbar.
 
-       Toggle navigationbar at runtime
-       
-       Support CustomActionProperties (custom-actions which require additional 
arguments and configuration)
+       Support CustomActionProperties (custom-actions which require additional 
arguments and configuration) Make them class actions insteadof instance actions 
structs
 
        An Archive can only be opened once
 

Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c     2006-11-22 
13:38:24 UTC (rev 23932)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c     2006-11-22 
14:49:08 UTC (rev 23933)
@@ -1580,27 +1580,45 @@
 {
        GSList *piter = (GSList*)store->navigation.present->data;
        GSList *titer = store->navigation.trailing;
+       GSList *miter = NULL;
+       gboolean match = FALSE;
        GValue p, t;
        memset(&p, 0, sizeof(GValue));
        memset(&t, 0, sizeof(GValue));
 
-       while(titer && piter)
+       if(titer)
        {
-               lxa_archive_iter_get_prop_value(store->archive, 
(LXAArchiveIter*)piter->data, LXA_ARCHIVE_PROP_FILENAME, &p);
-               lxa_archive_iter_get_prop_value(store->archive, 
(LXAArchiveIter*)titer->data, LXA_ARCHIVE_PROP_FILENAME, &t);
-               if(strcmp(g_value_get_string(&p), g_value_get_string(&t)))
+               while(titer->next && piter->next)
                {
-                       g_slist_free(store->navigation.trailing);
-                       store->navigation.trailing = 
g_slist_copy((GSList*)store->navigation.present->data);
+                       lxa_archive_iter_get_prop_value(store->archive, 
(LXAArchiveIter*)piter->data, LXA_ARCHIVE_PROP_FILENAME, &p);
+                       lxa_archive_iter_get_prop_value(store->archive, 
(LXAArchiveIter*)titer->data, LXA_ARCHIVE_PROP_FILENAME, &t);
+                       if(strcmp(g_value_get_string(&p), 
g_value_get_string(&t)) == 0)
+                       {
+                               titer = titer->next;
+                               piter = piter->next;
+                               if(!match)
+                                       miter = piter;
+                               match = TRUE;
+                       }
+                       else if(match)
+                       {
+                               match = FALSE;
+                               piter = miter;
+                               titer = store->navigation.trailing;
+                       }
+                       else
+                       {
+                               titer = titer->next;
+                       }
                        g_value_unset(&p);
                        g_value_unset(&t);
-                       break;
                }
-               g_value_unset(&p);
-               g_value_unset(&t);
+       }
 
-               piter = piter->next;
-               titer = titer->next;
+       if(!match)
+       {
+               g_slist_free(store->navigation.trailing);
+               store->navigation.trailing = 
g_slist_copy((GSList*)store->navigation.present->data);
        }
 }
 

Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c       2006-11-22 
13:38:24 UTC (rev 23932)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c       2006-11-22 
14:49:08 UTC (rev 23933)
@@ -17,6 +17,17 @@
  */
 
 #include <config.h>
+
+#undef XA_MAIN_ANY_BAR
+
+#ifdef ENABLE_PATHBAR
+#define XA_MAIN_ANY_BAR 1
+#else
+#ifdef ENABLE_TOOLBAR
+#define XA_MAIN_ANY_BAR 1
+#endif
+#endif
+
 #include <string.h>
 #include <glib.h>
 #include <gtk/gtk.h>
@@ -49,15 +60,6 @@
 
 #include "main.h"
 
-typedef enum
-{
-       XA_MAIN_WINDOW_NAVIGATION_INTERNAL,
-       XA_MAIN_WINDOW_NAVIGATION_TOOL_BAR,
-       XA_MAIN_WINDOW_NAVIGATION_PATH_BAR
-} XAMainWindowNavigationStyle;
-
-#define XA_TYPE_MAIN_WINDOW_NAVIGATION_STYLE 
(xa_main_window_navigation_style_get_type())
-
 enum
 {
        XA_MAIN_WINDOW_NAVIGATION_STYLE = 1
@@ -93,11 +95,9 @@
 cb_xa_main_window_notebook_file_activated(XANotebook *, gchar *, gpointer);
 
 static void
-cb_xa_main_window_set_tool_bar(GtkWidget *widget, gpointer userdata);
-static void
-cb_xa_main_window_set_path_bar(GtkWidget *widget, gpointer userdata);
+xa_main_window_set_navigation(XAMainWindow *window);
 
-static GType
+GType
 xa_main_window_navigation_style_get_type()
 {
        static GType nav_style_type = 0;
@@ -106,8 +106,12 @@
        {
                static GEnumValue style_types[] = {
                        {XA_MAIN_WINDOW_NAVIGATION_INTERNAL, "internal", 
"Internal Style"},
+#ifdef ENABLE_TOOLBAR
                        {XA_MAIN_WINDOW_NAVIGATION_TOOL_BAR, "tool_bar", "Tool 
Bar Style"},
+#endif
+#ifdef ENABLE_PATHBAR
                        {XA_MAIN_WINDOW_NAVIGATION_PATH_BAR, "path_bar", "Path 
Bar Style"},
+#endif
                        {0, NULL, NULL}
                };
 
@@ -214,6 +218,7 @@
        GtkWidget     *menu_separator;
        GtkWidget     *tmp_image;
        const gchar   *nav_bar;
+       GSList        *list, *iter;
        gboolean up_dir = TRUE;
        gboolean show_icons = TRUE;
        gboolean sort_case = TRUE;
@@ -299,26 +304,16 @@
                window->menubar.menu_view = gtk_menu_new();
                
gtk_menu_item_set_submenu(GTK_MENU_ITEM(window->menubar.menu_item_view), 
window->menubar.menu_view);
 
-               window->menubar.menu_item_nav_bar = 
gtk_menu_item_new_with_mnemonic(_("_Location Selector"));
-               window->menubar.menu_nav_bar = gtk_menu_new();
-               
gtk_menu_item_set_submenu(GTK_MENU_ITEM(window->menubar.menu_item_nav_bar), 
window->menubar.menu_nav_bar);
-               gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), 
window->menubar.menu_item_nav_bar);
+#ifdef XA_MAIN_ANY_BAR
+               list = 
xa_widget_factory_create_property_menu(window->widget_factory, 
G_OBJECT(window), "navigation-style");
+               for(iter = list; iter; iter = iter->next)
+               {
+                       
gtk_container_add(GTK_CONTAINER(window->menubar.menu_view), iter->data);
+                       gtk_widget_show(iter->data);
+               }
+#endif
+               gtk_widget_show_all(window->menubar.menu_view);
 
-               window->menubar.menu_item_no_bar   = 
gtk_radio_menu_item_new_with_mnemonic(NULL, _("Internal style"));
-               gtk_container_add(GTK_CONTAINER(window->menubar.menu_nav_bar), 
window->menubar.menu_item_no_bar);
-               gtk_check_menu_item_set_active((GtkCheckMenuItem 
*)window->menubar.menu_item_no_bar, TRUE);
-#ifdef ENABLE_TOOLBAR
-               window->menubar.menu_item_tool_bar = 
gtk_radio_menu_item_new_with_mnemonic_from_widget(GTK_RADIO_MENU_ITEM(window->menubar.menu_item_no_bar),
 _("Toolbar style"));
-               gtk_container_add(GTK_CONTAINER(window->menubar.menu_nav_bar), 
window->menubar.menu_item_tool_bar);
-               g_signal_connect(G_OBJECT(window->menubar.menu_item_tool_bar), 
"toggled", G_CALLBACK(cb_xa_main_window_set_tool_bar), window);
-#endif /* ENABLE_TOOLBAR */
-#ifdef ENABLE_PATHBAR
-               window->menubar.menu_item_path_bar = 
gtk_radio_menu_item_new_with_mnemonic_from_widget(GTK_RADIO_MENU_ITEM(window->menubar.menu_item_no_bar),
 _("Pathbar style"));
-               gtk_container_add(GTK_CONTAINER(window->menubar.menu_nav_bar), 
window->menubar.menu_item_path_bar);
-               g_signal_connect(G_OBJECT(window->menubar.menu_item_path_bar), 
"toggled", G_CALLBACK(cb_xa_main_window_set_path_bar), window);
-#endif /* ENABLE_PATHBAR */
-
-
                gtk_menu_bar_append(GTK_MENU_BAR(window->menu_bar), 
window->menubar.menu_item_file);
                gtk_menu_bar_append(GTK_MENU_BAR(window->menu_bar), 
window->menubar.menu_item_action);
                gtk_menu_bar_append(GTK_MENU_BAR(window->menu_bar), 
window->menubar.menu_item_view);
@@ -371,11 +366,14 @@
        g_signal_connect(G_OBJECT(window->toolbar.tool_item_stop), "clicked", 
G_CALLBACK(cb_xa_main_stop_archive), window);
 
        nav_bar = xa_settings_read_entry(window->settings, "NavigationBar", 
"None");
+       window->nav_style = XA_MAIN_WINDOW_NAVIGATION_INTERNAL;
        window->navigationbar = NULL;
+       up_dir = TRUE;
 
 #ifdef ENABLE_TOOLBAR
        if(!strcmp(nav_bar, "ToolBar"))
        {
+               window->nav_style = XA_MAIN_WINDOW_NAVIGATION_TOOL_BAR;
                window->navigationbar = xa_tool_bar_new(NULL); 
                up_dir = FALSE;
        }
@@ -383,16 +381,14 @@
 #ifdef ENABLE_PATHBAR
        if(!strcmp(nav_bar, "PathBar"))
        {
+               window->nav_style = XA_MAIN_WINDOW_NAVIGATION_PATH_BAR;
                window->navigationbar = xa_path_bar_new(NULL);
                
gtk_container_set_border_width(GTK_CONTAINER(window->navigationbar), 3);
                up_dir = FALSE;
        }
 #endif
 
-       if(!window->navigationbar)
-               up_dir = TRUE;
-       else
-               up_dir = FALSE;
+       g_object_notify(G_OBJECT(window), "navigation-style");
 
        show_icons = xa_settings_read_bool_entry(window->settings, "ShowIcons", 
TRUE);
        sort_case = xa_settings_read_bool_entry(window->settings, 
"SortCaseSensitive", TRUE);
@@ -458,23 +454,26 @@
 static void
 xa_main_window_get_property(GObject *object, guint prop_id, GValue *value, 
GParamSpec *pspec)
 {
-/*
+       XAMainWindow *window = XA_MAIN_WINDOW(object);
        switch(prop_id)
        {
-
+               case XA_MAIN_WINDOW_NAVIGATION_STYLE:
+                       g_value_set_enum(value, window->nav_style);
+               break;
        }
-*/
 }
 
 static void
 xa_main_window_set_property(GObject *object, guint prop_id, const GValue 
*value, GParamSpec *pspec)
 {
-/*
+       XAMainWindow *window = XA_MAIN_WINDOW(object);
        switch(prop_id)
        {
-
+               case XA_MAIN_WINDOW_NAVIGATION_STYLE:
+                       window->nav_style = g_value_get_enum(value);
+                       xa_main_window_set_navigation(window);
+               break;
        }
-*/
 }
 
 GtkWidget *
@@ -849,47 +848,41 @@
 }
 
 static void
-cb_xa_main_window_set_tool_bar(GtkWidget *widget, gpointer userdata)
+xa_main_window_set_navigation(XAMainWindow *window)
 {
-       XAMainWindow *window = XA_MAIN_WINDOW(userdata);
-       XANavigationBar *tool_bar = NULL; 
+       XANavigationBar *nav_bar = NULL; 
+       gboolean up_dir = TRUE;
 
-       if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
+       switch(window->nav_style)
        {
-               tool_bar = xa_tool_bar_new(NULL);
-
-               xa_notebook_set_navigation_bar(XA_NOTEBOOK(window->notebook), 
tool_bar);
-
-               if(window->navigationbar)
-                       gtk_widget_destroy(GTK_WIDGET(window->navigationbar));
-
-               window->navigationbar = tool_bar;
-               gtk_box_pack_start(GTK_BOX(window->main_vbox), (GtkWidget 
*)tool_bar, FALSE, FALSE, 0);
-               gtk_box_reorder_child(GTK_BOX(window->main_vbox), (GtkWidget 
*)tool_bar, 2);
-               gtk_widget_show_all((GtkWidget *)tool_bar);
+               case XA_MAIN_WINDOW_NAVIGATION_INTERNAL:
+                       break;
+#ifdef ENABLE_TOOLBAR
+               case XA_MAIN_WINDOW_NAVIGATION_TOOL_BAR:
+                       nav_bar = xa_tool_bar_new(NULL);
+                       up_dir = FALSE;
+                       break;
+#endif
+#ifdef ENABLE_PATHBAR
+               case XA_MAIN_WINDOW_NAVIGATION_PATH_BAR:
+                       nav_bar = xa_path_bar_new(NULL);
+                       up_dir = FALSE;
+                       break;
+#endif
+               default:
+                       return;
        }
-}
 
-static void
-cb_xa_main_window_set_path_bar(GtkWidget *widget, gpointer userdata)
-{
-       XAMainWindow *window = XA_MAIN_WINDOW(userdata);
-       XANavigationBar *path_bar = NULL; 
+       xa_notebook_set_navigation_bar(XA_NOTEBOOK(window->notebook), nav_bar);
 
-       if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
-       {
-               path_bar = xa_path_bar_new(NULL);
+       if(window->navigationbar)
+               gtk_widget_destroy(GTK_WIDGET(window->navigationbar));
 
-               xa_notebook_set_navigation_bar(XA_NOTEBOOK(window->notebook), 
path_bar);
-
-               if(window->navigationbar)
-                       gtk_widget_destroy(GTK_WIDGET(window->navigationbar));
-
-               window->navigationbar = path_bar;
-
-               
gtk_container_set_border_width(GTK_CONTAINER(window->navigationbar), 3);
-               gtk_box_pack_start(GTK_BOX(window->main_vbox), (GtkWidget 
*)path_bar, FALSE, FALSE, 0);
-               gtk_box_reorder_child(GTK_BOX(window->main_vbox), (GtkWidget 
*)path_bar, 2);
-               gtk_widget_show_all((GtkWidget *)path_bar);
-       }
+       window->navigationbar = nav_bar;
+       if(nav_bar)
+       {
+               gtk_box_pack_start(GTK_BOX(window->main_vbox), (GtkWidget 
*)nav_bar, FALSE, FALSE, 0);
+               gtk_box_reorder_child(GTK_BOX(window->main_vbox), (GtkWidget 
*)nav_bar, 2);
+               gtk_widget_show_all((GtkWidget *)nav_bar);
+       }       
 }

Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.h       2006-11-22 
13:38:24 UTC (rev 23932)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.h       2006-11-22 
14:49:08 UTC (rev 23933)
@@ -26,6 +26,20 @@
        XA_MAIN_WINDOW_STATUS_BUSY
 }XAMainWindowStatus;
 
+typedef enum
+{
+       XA_MAIN_WINDOW_NAVIGATION_INTERNAL,
+#ifdef ENABLE_TOOLBAR
+       XA_MAIN_WINDOW_NAVIGATION_TOOL_BAR,
+#endif
+#ifdef ENABLE_PATHBAR
+       XA_MAIN_WINDOW_NAVIGATION_PATH_BAR
+#endif
+} XAMainWindowNavigationStyle;
+
+#define XA_TYPE_MAIN_WINDOW_NAVIGATION_STYLE 
(xa_main_window_navigation_style_get_type())
+
+
 #define XA_TYPE_MAIN_WINDOW xa_main_window_get_type()
 
 #define XA_MAIN_WINDOW(obj)         ( \
@@ -83,13 +97,6 @@
                GtkWidget *menu_item_view;
                GtkWidget *menu_view;
                /* contents of 'view' menu */
-                       GtkWidget *menu_item_nav_bar;
-                       GtkWidget *menu_nav_bar;
-                       /* contents of 'nav_bar' submenu */
-                               GtkWidget *menu_item_tool_bar;
-                               GtkWidget *menu_item_path_bar;
-                               GtkWidget *menu_item_no_bar;
-                       /*********************************/
                        GtkWidget *menu_item_settings;
                /***************************/
 
@@ -111,6 +118,7 @@
                GtkToolItem *tool_item_remove;
                GtkToolItem *tool_item_stop;
        } toolbar;
+       XAMainWindowNavigationStyle nav_style;
        XANavigationBar *navigationbar;
        GtkAccelGroup *accel_group;
        GtkWidget *notebook;
@@ -125,6 +133,8 @@
        GtkWindowClass parent;
 };
 
+GType      xa_main_window_navigation_style_get_type();
+
 GtkWidget *xa_main_window_new(XAApplication *, GtkIconTheme *icon_theme);
 GtkWidget *xa_main_window_find_image(gchar *, GtkIconSize);
 GType      xa_main_window_get_type ();

Modified: xarchiver/branches/xarchiver-psybsd/src/notebook.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/notebook.c  2006-11-22 13:38:24 UTC 
(rev 23932)
+++ xarchiver/branches/xarchiver-psybsd/src/notebook.c  2006-11-22 14:49:08 UTC 
(rev 23933)
@@ -169,19 +169,7 @@
 
        notebook = g_object_new(XA_TYPE_NOTEBOOK, NULL);
 
-       notebook->props._up_dir = TRUE;
-       if(bar)
-       {
-               xa_notebook_set_navigation_bar(notebook, bar);
-#ifdef ENABLE_TOOLBAR
-               if(XA_IS_TOOL_BAR(bar))
-                       notebook->props._up_dir = FALSE;
-#endif
-#ifdef ENABLE_PATHBAR
-               if(XA_IS_PATH_BAR(bar))
-                       notebook->props._up_dir = FALSE;
-#endif
-       }
+       xa_notebook_set_navigation_bar(notebook, bar);
 
        notebook->props._show_icons = TRUE;
        notebook->multi_tab = use_tabs;
@@ -227,6 +215,20 @@
        if(notebook->navigation_bar)
                xa_navigation_bar_set_store(notebook->navigation_bar, NULL);
 
+       notebook->props._up_dir = TRUE;
+
+       if(bar)
+       {
+#ifdef ENABLE_TOOLBAR
+               if(XA_IS_TOOL_BAR(bar))
+                       notebook->props._up_dir = FALSE;
+#endif
+#ifdef ENABLE_PATHBAR
+               if(XA_IS_PATH_BAR(bar))
+                       notebook->props._up_dir = FALSE;
+#endif
+       }
+
        if(gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)))
        {
                gint page_nr = 
gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
@@ -234,7 +236,10 @@
                GtkWidget *treeview = 
gtk_bin_get_child(GTK_BIN(scrolledwindow));
                GtkTreeModel *archive_store = 
gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
                notebook->navigation_bar = bar;
-               xa_navigation_bar_set_store(notebook->navigation_bar, 
XA_ARCHIVE_STORE(archive_store));
+               if(bar)
+                       xa_navigation_bar_set_store(notebook->navigation_bar, 
XA_ARCHIVE_STORE(archive_store));
+               if(archive_store)
+                       g_object_set(G_OBJECT(archive_store), "show_up_dir", 
notebook->props._up_dir, NULL);
        }
        else
                notebook->navigation_bar = bar;

Modified: xarchiver/branches/xarchiver-psybsd/src/widget_factory.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/widget_factory.c    2006-11-22 
13:38:24 UTC (rev 23932)
+++ xarchiver/branches/xarchiver-psybsd/src/widget_factory.c    2006-11-22 
14:49:08 UTC (rev 23933)
@@ -451,17 +451,21 @@
                case G_TYPE_DOUBLE:
                        widget = 
xa_widget_factory_create_numeric_widget(factory, obj, pspec, &value);
                break;
-               case G_TYPE_ENUM:
-                       widget = 
xa_widget_factory_create_enum_widget_group(factory, obj, pspec, &value);
-                       if(0)
-                               
xa_widget_factory_create_enum_widget_list(factory, obj, pspec, &value);
-               break;
-               case G_TYPE_FLAGS:
-                       widget = xa_widget_factory_create_flags_widget(factory, 
obj, pspec, &value);
-               break;
                case G_TYPE_STRING:
                        widget = 
xa_widget_factory_create_string_widget(factory, obj, pspec, &value);
                break;
+               default:
+                       if(G_IS_PARAM_SPEC_ENUM(pspec))
+                       {
+                               widget = 
xa_widget_factory_create_enum_widget_group(factory, obj, pspec, &value);
+                               if(0)
+                                       
xa_widget_factory_create_enum_widget_list(factory, obj, pspec, &value);
+                       }
+                       if(G_IS_PARAM_SPEC_FLAGS(pspec))
+                       {
+                               widget = 
xa_widget_factory_create_flags_widget(factory, obj, pspec, &value);
+                       }
+               break;
        }
 
        g_value_unset(&value);
@@ -483,6 +487,8 @@
 
        menu = g_slist_append(menu, check);
 
+       gtk_widget_show(check);
+
        return menu;
 }
 
@@ -507,6 +513,8 @@
                        
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(radio), TRUE);
 
                menu = g_slist_append(menu, radio);
+
+               gtk_widget_show(radio);
        }
 
        return menu;
@@ -524,7 +532,10 @@
 
        for(i = 0; i < n; ++i)
        {
-               radio = 
gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(radio), 
values[i].value_nick);
+               if(radio)
+                       radio = 
gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(radio), 
values[i].value_nick);
+               else
+                       radio = gtk_radio_menu_item_new_with_label(NULL, 
values[i].value_nick);
 
                g_object_set_data(G_OBJECT(radio), XA_PROPERTY_SPEC_DATA, 
pspec);
                g_object_set_data(G_OBJECT(radio), XA_PROPERTY_VALUE_DATA, 
GINT_TO_POINTER(values[i].value));
@@ -541,6 +552,9 @@
 
        menu = g_slist_append(menu, list);
 
+       gtk_widget_show_all(sub);
+       gtk_widget_show(list);
+
        return menu;
 }
 
@@ -564,6 +578,8 @@
                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(check), 
g_value_get_enum(value) & values[i].value);
 
                menu = g_slist_append(menu, check);
+
+               gtk_widget_show(check);
        }
 
        return menu;
@@ -597,6 +613,9 @@
 
        menu = g_slist_append(menu, list);
 
+       gtk_widget_show_all(sub);
+       gtk_widget_show(list);
+
        return menu;
 }
 
@@ -633,20 +652,23 @@
                case G_TYPE_UINT64:
                case G_TYPE_FLOAT:
                case G_TYPE_DOUBLE:
-               break;*/
-               case G_TYPE_ENUM:
-                       menu = xa_widget_factory_create_enum_menu_list(factory, 
obj, pspec, &value);
-                       if(0)
-                               
xa_widget_factory_create_enum_menu_group(factory, obj, pspec, &value);
                break;
-               case G_TYPE_FLAGS:
-                       menu = 
xa_widget_factory_create_flags_menu_list(factory, obj, pspec, &value);
-                       if(0)
-                               
xa_widget_factory_create_flags_menu_group(factory, obj, pspec, &value);
-               break;
-               /*
                case G_TYPE_STRING:
                break;*/
+               default:
+                       if(G_IS_PARAM_SPEC_ENUM(pspec))
+                       {
+                               menu = 
xa_widget_factory_create_enum_menu_list(factory, obj, pspec, &value);
+                               if(0)
+                                       
xa_widget_factory_create_enum_menu_group(factory, obj, pspec, &value);
+                       }
+                       if(G_IS_PARAM_SPEC_FLAGS(pspec))
+                       {
+                               menu = 
xa_widget_factory_create_flags_menu_list(factory, obj, pspec, &value);
+                               if(0)
+                                       
xa_widget_factory_create_flags_menu_group(factory, obj, pspec, &value);
+                       }
+               break;
        }
 
        g_value_unset(&value);
@@ -699,47 +721,51 @@
                                g_object_set_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
                        }
                break;
-               case G_TYPE_ENUM:
-                       if(GTK_IS_RADIO_BUTTON(widget))
+               case G_TYPE_STRING:
+                       if(GTK_IS_ENTRY(widget))
                        {
-                               
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+                               g_value_set_string(&value, 
gtk_entry_get_text(GTK_ENTRY(widget)));
+                               g_object_set_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
+                       }
+               break;
+               default:
+                       if(G_IS_PARAM_SPEC_ENUM(pspec))
+                       {
+                               if(GTK_IS_RADIO_BUTTON(widget))
                                {
-                                       g_value_set_enum(&value, 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), XA_PROPERTY_VALUE_DATA)));
-                                       
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
+                                       
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+                                       {
+                                               g_value_set_enum(&value, 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), XA_PROPERTY_VALUE_DATA)));
+                                               
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
+                                       }
                                }
+                               if(GTK_IS_RADIO_MENU_ITEM(widget))
+                               {
+                                       
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
+                                       {
+                                               g_value_set_enum(&value, 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), XA_PROPERTY_VALUE_DATA)));
+                                               
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
+                                       }
+                               }
                        }
-                       if(GTK_IS_RADIO_MENU_ITEM(widget))
+                       if(G_IS_PARAM_SPEC_FLAGS(pspec))
                        {
-                               
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
+                               if(GTK_IS_CHECK_BUTTON(widget))
                                {
-                                       g_value_set_enum(&value, 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), XA_PROPERTY_VALUE_DATA)));
+                                       
g_object_get_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
+                                       // TODO: sync?
+                                       g_value_set_flags(&value, 
g_value_get_flags(&value) ^ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), 
XA_PROPERTY_VALUE_DATA)));
                                        
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
                                }
+                               if(GTK_IS_CHECK_MENU_ITEM(widget))
+                               {
+                                       
g_object_get_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
+                                       // TODO: sync?
+                                       g_value_set_flags(&value, 
g_value_get_flags(&value) ^ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), 
XA_PROPERTY_VALUE_DATA)));
+                                       
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
+                               }
                        }
                break;
-               case G_TYPE_FLAGS:
-                       if(GTK_IS_CHECK_BUTTON(widget))
-                       {
-                               g_object_get_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
-                               // TODO: sync?
-                               g_value_set_flags(&value, 
g_value_get_flags(&value) ^ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), 
XA_PROPERTY_VALUE_DATA)));
-                               g_object_set_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
-                       }
-                       if(GTK_IS_CHECK_MENU_ITEM(widget))
-                       {
-                               g_object_get_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
-                               // TODO: sync?
-                               g_value_set_flags(&value, 
g_value_get_flags(&value) ^ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), 
XA_PROPERTY_VALUE_DATA)));
-                               g_object_set_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
-                       }
-               break;
-               case G_TYPE_STRING:
-                       if(GTK_IS_ENTRY(widget))
-                       {
-                               g_value_set_string(&value, 
gtk_entry_get_text(GTK_ENTRY(widget)));
-                               g_object_set_property(G_OBJECT(user_data), 
g_param_spec_get_name(pspec), &value);
-                       }
-               break;
        }
 
        g_value_unset(&value);
@@ -793,37 +819,41 @@
                                g_value_unset(&other_value);
                        }
                break;
-               case G_TYPE_ENUM:
-                       if(GTK_IS_RADIO_BUTTON(user_data))
+               case G_TYPE_STRING:
+                       if(GTK_IS_ENTRY(user_data))
                        {
                                g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
-                               
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), 
XA_PROPERTY_VALUE_DATA))==g_value_get_enum(&value));
+                               gtk_entry_set_text(GTK_ENTRY(user_data), 
g_value_get_string(&value));
                        }
-                       if(GTK_IS_RADIO_MENU_ITEM(user_data))
-                       {
-                               g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
-                               
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), 
XA_PROPERTY_VALUE_DATA))==g_value_get_enum(&value));
-                       }
                break;
-               case G_TYPE_FLAGS:
-                       if(GTK_IS_CHECK_BUTTON(user_data))
+               default:
+                       if(G_IS_PARAM_SPEC_ENUM(pspec))
                        {
-                               g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
-                               
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), XA_PROPERTY_VALUE_DATA)) 
& g_value_get_enum(&value));
+                               if(GTK_IS_RADIO_BUTTON(user_data))
+                               {
+                                       g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
+                                       
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), 
XA_PROPERTY_VALUE_DATA))==g_value_get_enum(&value));
+                               }
+                               if(GTK_IS_RADIO_MENU_ITEM(user_data))
+                               {
+                                       g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
+                                       
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), 
XA_PROPERTY_VALUE_DATA))==g_value_get_enum(&value));
+                               }
                        }
-                       if(GTK_IS_CHECK_MENU_ITEM(user_data))
+                       if(G_IS_PARAM_SPEC_FLAGS(pspec))
                        {
-                               g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
-                               
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), XA_PROPERTY_VALUE_DATA)) 
& g_value_get_enum(&value));
+                               if(GTK_IS_CHECK_BUTTON(user_data))
+                               {
+                                       g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
+                                       
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), XA_PROPERTY_VALUE_DATA)) 
& g_value_get_enum(&value));
+                               }
+                               if(GTK_IS_CHECK_MENU_ITEM(user_data))
+                               {
+                                       g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
+                                       
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(user_data), 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), XA_PROPERTY_VALUE_DATA)) 
& g_value_get_enum(&value));
+                               }
                        }
                break;
-               case G_TYPE_STRING:
-                       if(GTK_IS_ENTRY(user_data))
-                       {
-                               g_object_get_property(obj, 
g_param_spec_get_name(pspec), &value);
-                               gtk_entry_set_text(GTK_ENTRY(user_data), 
g_value_get_string(&value));
-                       }
-               break;
        }
 
        g_value_unset(&value);
@@ -862,7 +892,7 @@
 GtkWidget*
 xa_widget_factory_create_action_menu_item(XAWidgetFactory *factory, 
LXAArchiveSupport *support, LXAArchive *archive, const gchar *act)
 {
-       GtkWidget *menu = NULL;
+       GtkWidget *menu;
        LXACustomAction *action = lxa_archive_support_find_action(support, act);
 
        if(!action)
@@ -871,6 +901,7 @@
        menu = gtk_menu_item_new_with_label(lxa_custom_action_get_nick(action));
        g_object_set_data(G_OBJECT(menu), XA_ACTION_CUSTOM_DATA, action);
        g_signal_connect(G_OBJECT(menu), "activate", 
G_CALLBACK(cb_xa_widget_factory_action_triggered), archive);
+       gtk_widget_show(menu);
 
        return menu;
 }
@@ -878,7 +909,7 @@
 GtkToolItem*
 xa_widget_factory_create_action_bar(XAWidgetFactory *factory, 
LXAArchiveSupport *support, LXAArchive *archive, const gchar *act)
 {
-       GtkToolItem *widget = NULL;
+       GtkToolItem *widget;
        LXACustomAction *action = lxa_archive_support_find_action(support, act);
 
        if(!action)
@@ -921,6 +952,7 @@
                        g_object_set_data(G_OBJECT(item), 
XA_ACTION_CUSTOM_DATA, action[i]);
                        g_signal_connect(G_OBJECT(item), "activate", 
G_CALLBACK(cb_xa_widget_factory_action_triggered), archive);
                        menu = g_slist_append(menu, item);
+                       gtk_widget_show(item);
                }
        }
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to