aboutsummaryrefslogtreecommitdiffstats
path: root/lib/egg/eggtoolbar.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-05-11 20:24:35 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-05-11 20:24:35 +0800
commit1ffbaefc6b9d99f76fb666215709b6ab4e83d547 (patch)
treebf6cbc16d0f0a87c19ebcbe507f490c222a90d90 /lib/egg/eggtoolbar.c
parent3ab85f2df9c5f3201d984d7e6fbe65767f340143 (diff)
downloadgsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.tar
gsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.tar.gz
gsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.tar.bz2
gsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.tar.lz
gsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.tar.xz
gsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.tar.zst
gsoc2013-epiphany-1ffbaefc6b9d99f76fb666215709b6ab4e83d547.zip
Update
2003-05-11 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/egg-action.c: * lib/egg/eggseparatortoolitem.c: * lib/egg/eggtoggletoolbutton.c: * lib/egg/eggtoolbar.c: * lib/egg/eggtoolbutton.c: * lib/egg/eggtoolitem.c: * lib/egg/eggtoolitem.h: Update * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmarks.c: * src/bookmarks/ephy-bookmarks-export.c: * src/bookmarks/ephy-bookmarks-export.h: Export bookmarks in an rdf format (RSS was perfect, so I just used it instead of inventing a new one). This is useful to ensure compatibility in case of database formats changes. It will be used also as import format for ephy. Also I think it can be easily displayed, need to talk with Edd about the css url though. Thanks to Edd Dumbill for the help with this.
Diffstat (limited to 'lib/egg/eggtoolbar.c')
-rw-r--r--lib/egg/eggtoolbar.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/lib/egg/eggtoolbar.c b/lib/egg/eggtoolbar.c
index f109a4988..eb84db275 100644
--- a/lib/egg/eggtoolbar.c
+++ b/lib/egg/eggtoolbar.c
@@ -490,7 +490,7 @@ egg_toolbar_init (EggToolbar *toolbar)
priv->arrow_button = gtk_toggle_button_new ();
g_signal_connect (priv->arrow_button, "button_press_event",
G_CALLBACK (egg_toolbar_arrow_button_press), toolbar);
- g_signal_connect_after (priv->arrow_button, "clicked",
+ g_signal_connect (priv->arrow_button, "clicked",
G_CALLBACK (egg_toolbar_arrow_button_clicked), toolbar);
gtk_button_set_relief (GTK_BUTTON (priv->arrow_button),
get_button_relief (toolbar));
@@ -1835,14 +1835,22 @@ menu_deactivated (GtkWidget *menu, EggToolbar *toolbar)
}
static void
+remove_item (GtkWidget *menu_item, gpointer data)
+{
+ gtk_container_remove (GTK_CONTAINER (menu_item->parent), menu_item);
+}
+
+static void
show_menu (EggToolbar *toolbar, GdkEventButton *event)
{
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
GList *list;
- GtkWidget *menu_item;
if (priv->menu)
- gtk_widget_destroy (GTK_WIDGET (priv->menu));
+ {
+ gtk_container_foreach (GTK_CONTAINER (priv->menu), remove_item, NULL);
+ gtk_widget_destroy (GTK_WIDGET (priv->menu));
+ }
priv->menu = GTK_MENU (gtk_menu_new ());
g_signal_connect (priv->menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar);
@@ -1853,11 +1861,13 @@ show_menu (EggToolbar *toolbar, GdkEventButton *event)
if (TOOLBAR_ITEM_VISIBLE (item) && item->overflow_item)
{
- menu_item = NULL;
- g_signal_emit_by_name (item, "create_menu_proxy", &menu_item);
-
+ GtkWidget *menu_item = egg_tool_item_retrieve_proxy_menu_item (item);
+
if (menu_item)
- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), menu_item);
+ {
+ g_assert (GTK_IS_MENU_ITEM (menu_item));
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), menu_item);
+ }
}
}
@@ -1873,12 +1883,12 @@ egg_toolbar_arrow_button_clicked (GtkWidget *button, EggToolbar *toolbar)
{
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- /* We only get here when the button is clicked with the keybaord,
- * because we block mouse button presses by returning TRUE from
- * egg_toolbar_arrow_button_press
- */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->arrow_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->arrow_button)) &&
+ (!priv->menu || !GTK_WIDGET_VISIBLE (GTK_WIDGET (priv->menu))))
{
+ /* We only get here when the button is clicked with the keybaord,
+ * because mouse button presses result in the menu being shown.
+ */
show_menu (toolbar, NULL);
gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE);
}
@@ -1889,10 +1899,9 @@ egg_toolbar_arrow_button_press (GtkWidget *button,
GdkEventButton *event,
EggToolbar *toolbar)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-
show_menu (toolbar, event);
-
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+
return TRUE;
}