aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-topic-action.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-07-04 02:09:52 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-07-04 02:09:52 +0800
commit0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86 (patch)
tree056e1cc2bfdfcb38fdc6229d5469c590ec13eb90 /src/bookmarks/ephy-topic-action.c
parent134f4c838708b6a80e9ff8ee4d7ac8bf0f03bf6e (diff)
downloadgsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.tar
gsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.tar.gz
gsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.tar.bz2
gsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.tar.lz
gsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.tar.xz
gsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.tar.zst
gsoc2013-epiphany-0ac23c8e7e5daa98a016308b7c4e0cc1fe510f86.zip
"Open in tabs" insensitive when there are not multiple bookmarks in the
2004-07-03 Marco Pesenti Gritti <marco@gnome.org> * src/bookmarks/ephy-topic-action.c: (can_open_in_tabs), (append_bookmarks_menu), (add_open_in_tabs_menu), (build_bookmarks_menu), (show_context_menu): "Open in tabs" insensitive when there are not multiple bookmarks in the topic.
Diffstat (limited to 'src/bookmarks/ephy-topic-action.c')
-rw-r--r--src/bookmarks/ephy-topic-action.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c
index 013f54c6d..bdbd1e50f 100644
--- a/src/bookmarks/ephy-topic-action.c
+++ b/src/bookmarks/ephy-topic-action.c
@@ -230,7 +230,17 @@ sort_bookmarks (gconstpointer a, gconstpointer b)
#define MAX_LENGTH 32
-static guint
+static gboolean
+can_open_in_tabs (EphyTopicAction *action)
+{
+ GPtrArray *children;
+
+ children = ephy_node_get_children (action->priv->topic_node);
+
+ return (children->len > 1);
+}
+
+static void
append_bookmarks_menu (EphyTopicAction *action, GtkWidget *menu, EphyNode *node, gboolean show_empty)
{
EphyFaviconCache *cache;
@@ -250,7 +260,7 @@ append_bookmarks_menu (EphyTopicAction *action, GtkWidget *menu, EphyNode *node,
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- return FALSE;
+ return;
}
else
{
@@ -310,8 +320,6 @@ append_bookmarks_menu (EphyTopicAction *action, GtkWidget *menu, EphyNode *node,
g_list_free (node_list);
}
-
- return children->len;
}
static void
@@ -361,7 +369,7 @@ remove_activate_cb (GtkWidget *menu, GtkWidget *proxy)
egg_toolbars_model_remove_item (model, 0, pos);
}
-static void
+static GtkWidget *
add_open_in_tabs_menu (EphyTopicAction *action, GtkWidget *menu)
{
GtkWidget *item;
@@ -372,19 +380,20 @@ add_open_in_tabs_menu (EphyTopicAction *action, GtkWidget *menu)
g_signal_connect (item, "activate",
G_CALLBACK (open_in_tabs_activate_cb), action);
+
+ return item;
}
static GtkWidget *
build_bookmarks_menu (EphyTopicAction *action, EphyNode *node)
{
GtkWidget *menu;
- guint n_bookmarks;
menu = gtk_menu_new ();
- n_bookmarks = append_bookmarks_menu (action, menu, node, TRUE);
+ append_bookmarks_menu (action, menu, node, TRUE);
- if (n_bookmarks > 1)
+ if (can_open_in_tabs (action))
{
GtkWidget *item;
@@ -569,7 +578,8 @@ show_context_menu (EphyTopicAction *action, GtkWidget *proxy,
menu = gtk_menu_new ();
- add_open_in_tabs_menu (action, menu);
+ item = add_open_in_tabs_menu (action, menu);
+ gtk_widget_set_sensitive (item, can_open_in_tabs (action));
item = gtk_separator_menu_item_new ();
gtk_widget_show (item);