diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-07-06 23:32:13 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-07-06 23:32:13 +0800 |
commit | 26ab891231913b58db5be0527c9a6c47e7c09d4b (patch) | |
tree | 246db795a3ebefb186f3837299c448df0bcac7d3 | |
parent | af976b33780d7a2d055d5c1075a6f4697897b70b (diff) | |
download | gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.tar gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.tar.gz gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.tar.bz2 gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.tar.lz gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.tar.xz gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.tar.zst gsoc2013-epiphany-26ab891231913b58db5be0527c9a6c47e7c09d4b.zip |
Implement toolbar overflow menu item for the go button.
2003-07-06 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-go-action.c: (button_clicked), (activate_cb),
(create_menu_item), (create_menu_proxy_cb), (connect_proxy),
(ephy_go_action_class_init):
Implement toolbar overflow menu item for the go button.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/ephy-go-action.c | 49 |
2 files changed, 55 insertions, 2 deletions
@@ -1,5 +1,13 @@ 2003-07-06 Christian Persch <chpe@cvs.gnome.org> + * src/ephy-go-action.c: (button_clicked), (activate_cb), + (create_menu_item), (create_menu_proxy_cb), (connect_proxy), + (ephy_go_action_class_init): + + Implement toolbar overflow menu item for the go button. + +2003-07-06 Christian Persch <chpe@cvs.gnome.org> + * lib/ephy-node.c: (ephy_node_finalize): Fix mem leak. diff --git a/src/ephy-go-action.c b/src/ephy-go-action.c index ab291cfa4..2c7949ae5 100644 --- a/src/ephy-go-action.c +++ b/src/ephy-go-action.c @@ -28,6 +28,8 @@ #include "eggtoolitem.h" #include "ephy-debug.h" +#define MENU_ID "ephy-go-action-menu-id" + static void ephy_go_action_init (EphyGoAction *action); static void ephy_go_action_class_init (EphyGoActionClass *class); static void ephy_go_action_finalize (GObject *object); @@ -62,7 +64,7 @@ ephy_go_action_get_type (void) } static void -button_clicked (GtkWidget *widget, EggAction *action) +activate_cb (GtkWidget *widget, EggAction *action) { g_signal_emit_by_name (action, "activate"); } @@ -79,7 +81,7 @@ create_tool_item (EggAction *action) gtk_button_set_relief(GTK_BUTTON (button), GTK_RELIEF_NONE); g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (button_clicked), action); + G_CALLBACK (activate_cb), action); gtk_container_add (GTK_CONTAINER (item), button); gtk_widget_show (button); @@ -87,6 +89,46 @@ create_tool_item (EggAction *action) return item; } +static GtkWidget * +create_menu_item (EggAction *action) +{ + GtkWidget *menu_item; + + menu_item = gtk_menu_item_new_with_label (_("Go")); + g_signal_connect (G_OBJECT (menu_item), "activate", + G_CALLBACK (activate_cb), action); + + return menu_item; +} + +static gboolean +create_menu_proxy_cb (EggToolItem *item, EggAction *action) +{ + GtkWidget *menu_item; + + menu_item = EGG_ACTION_GET_CLASS (action)->create_menu_item (action); + + EGG_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item); + + egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item); + + return TRUE; +} + +static void +connect_proxy (EggAction *action, GtkWidget *proxy) +{ + (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy); + + g_return_if_fail (EPHY_IS_GO_ACTION (action)); + + if (EGG_IS_TOOL_ITEM (proxy)) + { + g_signal_connect (proxy, "create_menu_proxy", + G_CALLBACK (create_menu_proxy_cb), action); + } +} + static void ephy_go_action_class_init (EphyGoActionClass *class) { @@ -99,6 +141,9 @@ ephy_go_action_class_init (EphyGoActionClass *class) action_class = EGG_ACTION_CLASS (class); action_class->create_tool_item = create_tool_item; + action_class->menu_item_type = GTK_TYPE_MENU_ITEM; + action_class->create_menu_item = create_menu_item; + action_class->connect_proxy = connect_proxy; } static void |