diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-10-02 15:52:01 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-10-02 15:52:01 +0800 |
commit | 2bab5bd0185108944726495800bcfabce424b641 (patch) | |
tree | 927b140a3b72cd84beee047b8c7768b128f24014 | |
parent | 2bdb5923bb79afe05aa0f56364cd7cb1fa16fd4d (diff) | |
download | gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.tar gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.tar.gz gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.tar.bz2 gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.tar.lz gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.tar.xz gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.tar.zst gsoc2013-epiphany-2bab5bd0185108944726495800bcfabce424b641.zip |
Use new gtk api for empty submenus
2003-10-02 Marco Pesenti Gritti <marco@gnome.org>
* src/bookmarks/ephy-bookmarks-menu.c: (add_bookmarks_menu),
(ephy_bookmarks_menu_rebuild):
Use new gtk api for empty submenus
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 36 |
2 files changed, 15 insertions, 28 deletions
@@ -1,3 +1,10 @@ +2003-10-02 Marco Pesenti Gritti <marco@gnome.org> + + * src/bookmarks/ephy-bookmarks-menu.c: (add_bookmarks_menu), + (ephy_bookmarks_menu_rebuild): + + Use new gtk api for empty submenus + 2003-09-30 Marco Pesenti Gritti <marco@gnome.org> * data/epiphany.schemas.in: diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c index 58d6c529a..f5d170155 100644 --- a/src/bookmarks/ephy-bookmarks-menu.c +++ b/src/bookmarks/ephy-bookmarks-menu.c @@ -32,7 +32,6 @@ #include <bonobo/bonobo-i18n.h> #include <gtk/gtkuimanager.h> -#define EMPTY_ACTION_NAME "GoBookmarkEmpty" #define BOOKMARKS_MENU_PATH "/menubar/BookmarksMenu" /** @@ -189,28 +188,19 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, const char *path) { GPtrArray *children; EphyBookmarksMenuPrivate *p = menu->priv; + GList *node_list = NULL, *l; + int i; children = ephy_node_get_children (node); - - if (children->len < 1) + for (i = 0; i < children->len; ++i) { - gtk_ui_manager_add_ui (p->merge, p->ui_id, path, - EMPTY_ACTION_NAME"Menu", EMPTY_ACTION_NAME, - GTK_UI_MANAGER_MENUITEM, FALSE); + node_list = g_list_prepend (node_list, + g_ptr_array_index (children, i)); } - else - { - GList *node_list = NULL, *l; - int i; - - for (i = 0; i < children->len; ++i) - { - node_list = g_list_prepend (node_list, - g_ptr_array_index (children, i)); - } + if (node_list != NULL) + { node_list = g_list_sort (node_list, (GCompareFunc)sort_bookmarks); - for (l = node_list; l != NULL; l = l->next) { GtkAction *action; @@ -233,7 +223,6 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, const char *path) name, verb, GTK_UI_MANAGER_MENUITEM, FALSE); } - g_list_free (node_list); } @@ -249,7 +238,6 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu) EphyNode *not_categorized; GPtrArray *children; GList *node_list = NULL, *l; - GtkAction *empty; LOG ("Rebuilding bookmarks menu") @@ -266,15 +254,6 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu) p->action_group = gtk_action_group_new ("BookmarksActions"); gtk_ui_manager_insert_action_group (p->merge, p->action_group, 0); - empty = g_object_new (GTK_TYPE_ACTION, - "name", EMPTY_ACTION_NAME, - /* This is the adjective, not the verb */ - "label", _("Empty"), - "sensitive", FALSE, - NULL); - gtk_action_group_add_action (p->action_group, empty); - g_object_unref (empty); - for (i = 0; i < children->len; ++i) { EphyNode *kid; @@ -314,6 +293,7 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu) action = g_object_new (GTK_TYPE_ACTION, "name", verb, "label", title, + "hide_if_empty", FALSE, NULL); gtk_action_group_add_action (p->action_group, action); g_object_unref (action); |