diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-04-15 02:51:06 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-04-15 02:51:06 +0800 |
commit | 1b233621840ce78f89ab5b91e67f8c9c8f6a09df (patch) | |
tree | 22c47a84716711a8510adec2e61cfbf908bf11b2 /src/bookmarks/ephy-topic-action.c | |
parent | 33021c190b07950973747e1891f0a58af675fe2b (diff) | |
download | gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.tar gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.tar.gz gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.tar.bz2 gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.tar.lz gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.tar.xz gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.tar.zst gsoc2013-epiphany-1b233621840ce78f89ab5b91e67f8c9c8f6a09df.zip |
s/galeon/epiphany ;)
2003-04-14 Marco Pesenti Gritti <marco@it.gnome.org>
* configure.in:
s/galeon/epiphany ;)
* src/bookmarks/ephy-bookmarks-editor.c: (reset_search_entry),
(keyword_node_selected_cb), (search_entry_changed_cb):
* src/bookmarks/ephy-topic-action.c: (build_bookmarks_menu),
(build_topics_menu), (build_menu), (button_press_cb):
Evil bookmarks menu is back in toolbars eeeeek.
And no you cant have more than one level ... too bad.
Fix search/node selection interaction.
Diffstat (limited to 'src/bookmarks/ephy-topic-action.c')
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 79 |
1 files changed, 71 insertions, 8 deletions
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 94e7c5e30..ccbc48df5 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -139,21 +139,16 @@ ephy_topic_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *p } static GtkWidget * -build_topics_menu (EphyTopicAction *action, GtkWidget *button) +build_bookmarks_menu (EphyTopicAction *action, EphyNode *node) { GtkWidget *menu, *item; GPtrArray *children; int i; - EphyNode *node; EphyFaviconCache *cache; - node = ephy_node_get_from_id (action->priv->topic_id); - menu = gtk_menu_new (); - g_signal_connect (menu, "deactivate", - G_CALLBACK (menu_deactivate_cb), button); - cache = ephy_embed_shell_get_favicon_cache + cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); children = ephy_node_get_children (node); @@ -169,6 +164,8 @@ build_topics_menu (EphyTopicAction *action, GtkWidget *button) (kid, EPHY_NODE_BMK_PROP_ICON); title = ephy_node_get_property_string (kid, EPHY_NODE_BMK_PROP_TITLE); + if (title == NULL) continue; + LOG ("Create menu for bookmark %s", title) item = gtk_image_menu_item_new_with_label (title); if (icon_location) @@ -198,6 +195,70 @@ build_topics_menu (EphyTopicAction *action, GtkWidget *button) return menu; } +static GtkWidget * +build_topics_menu (EphyTopicAction *action, EphyNode *node) +{ + GtkWidget *menu, *item; + GPtrArray *children; + int i; + EphyBookmarks *bookmarks; + EphyNode *all; + + bookmarks = ephy_shell_get_bookmarks (ephy_shell); + all = ephy_bookmarks_get_bookmarks (bookmarks); + + menu = gtk_menu_new (); + + children = ephy_node_get_children (node); + for (i = 0; i < children->len; i++) + { + EphyNode *kid; + const char *title; + GtkWidget *bmk_menu; + + kid = g_ptr_array_index (children, i); + if (kid == all) continue; + + title = ephy_node_get_property_string + (kid, EPHY_NODE_KEYWORD_PROP_NAME); + LOG ("Create menu for topic %s", title); + + item = gtk_image_menu_item_new_with_label (title); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + bmk_menu = build_bookmarks_menu (action, kid); + gtk_widget_show (bmk_menu); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), bmk_menu); + } + ephy_node_thaw (node); + + return menu; +} + +static GtkWidget * +build_menu (EphyTopicAction *action) +{ + EphyNode *node; + + + if (action->priv->topic_id == BOOKMARKS_NODE_ID) + { + EphyBookmarks *bookmarks; + + LOG ("Build all bookmarks crap menu") + + bookmarks = ephy_shell_get_bookmarks (ephy_shell); + node = ephy_bookmarks_get_keywords (bookmarks); + return build_topics_menu (action, node); + } + else + { + node = ephy_node_get_from_id (action->priv->topic_id); + return build_bookmarks_menu (action, node); + } +} + static gboolean button_press_cb (GtkWidget *button, GdkEventButton *event, @@ -209,7 +270,9 @@ button_press_cb (GtkWidget *button, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - menu = build_topics_menu (action, button); + menu = build_menu (action); + g_signal_connect (menu, "deactivate", + G_CALLBACK (menu_deactivate_cb), button); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, ephy_gui_menu_position_under_widget, button, 1, gtk_get_current_event_time ()); |