aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@gnome.org>2007-04-03 04:32:06 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2007-04-03 04:32:06 +0800
commit32e229860e6d4dc22516f954ed1daea8a06eb894 (patch)
tree890f5462e0a68121cb7916edb957495d09f9bde8 /src/bookmarks
parentef9323ca156d736e1b1794350c8473b34bc39e56 (diff)
downloadgsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.tar
gsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.tar.gz
gsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.tar.bz2
gsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.tar.lz
gsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.tar.xz
gsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.tar.zst
gsoc2013-epiphany-32e229860e6d4dc22516f954ed1daea8a06eb894.zip
Allow the user to select a different bookmark topic on the toolbar by just
2007-04-02 Diego Escalante Urrelo <diegoe@gnome.org> * src/bookmarks/ephy-topic-action.c: Allow the user to select a different bookmark topic on the toolbar by just moving the mouse. Old behaviour forced the user to click each topic button to activate the menu, now only the first click is required. Bug #363848. Patch by John Millikin. svn path=/trunk/; revision=6981
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-topic-action.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c
index 921e6fb8d..315d42d34 100644
--- a/src/bookmarks/ephy-topic-action.c
+++ b/src/bookmarks/ephy-topic-action.c
@@ -139,6 +139,7 @@ create_tool_item (GtkAction *action)
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (item), button);
g_object_set_data (G_OBJECT (item), "button", button);
+ g_object_set_data (G_OBJECT (button), "gtk-action", action);
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
gtk_widget_show (arrow);
@@ -294,9 +295,14 @@ static void
button_deactivate_cb (GtkMenuShell *ms,
GtkWidget *button)
{
+ GtkWidget *window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
gtk_button_released (GTK_BUTTON (button));
+ g_object_set_data (G_OBJECT (window),
+ "active-topic-action-button", NULL);
+
/*
Currently, GObject leaks connection IDs created with
g_signal_connect_object ()
@@ -312,6 +318,13 @@ button_toggled_cb (GtkWidget *button,
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
GtkWidget *popup;
+ GtkWidget *window;
+
+ window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
+
+ g_object_set_data (G_OBJECT (window),
+ "active-topic-action-button",
+ button);
popup = get_popup (action);
@@ -357,6 +370,35 @@ button_press_cb (GtkWidget *button,
return FALSE;
}
+static gboolean
+button_enter_cb (GtkWidget *button,
+ GdkEventCrossing *event,
+ EphyTopicAction *action)
+{
+ GtkWidget *window;
+ GtkWidget *active_button;
+
+ window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
+ active_button = g_object_get_data (G_OBJECT (window),
+ "active-topic-action-button");
+
+ if (active_button &&
+ active_button != button &&
+ GTK_IS_TOGGLE_BUTTON (active_button) &&
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (active_button)))
+ {
+ EphyTopicAction *active_action;
+ active_action = g_object_get_data (G_OBJECT (active_button),
+ "gtk-action");
+
+ erase_popup (active_action);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ }
+
+ return FALSE;
+}
+
static void
connect_proxy (GtkAction *action,
GtkWidget *proxy)
@@ -379,6 +421,8 @@ connect_proxy (GtkAction *action,
G_CALLBACK (button_press_cb), action);
g_signal_connect (button, "button-release-event",
G_CALLBACK (button_release_cb), action);
+ g_signal_connect (button, "enter-notify-event",
+ G_CALLBACK (button_enter_cb), action);
/* FIXME: what about keyboard (toggled by Space) ? */
g_signal_connect (button, "drag-data-received",