diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-02-05 06:39:28 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-02-05 06:39:28 +0800 |
commit | 0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce (patch) | |
tree | 65fd738b069f12f68f293d208c058be5ccf7a5b7 | |
parent | 74c61ab583069d84e242400b064ab0f1ca828e29 (diff) | |
download | gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.tar gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.tar.gz gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.tar.bz2 gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.tar.lz gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.tar.xz gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.tar.zst gsoc2013-epiphany-0c598aa8e3fd37f4cb2e7b16957b06ac78b710ce.zip |
gtk+ now connects the tool item's create_menu_proxy to the action's
2004-02-04 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-go-action.c: (ephy_go_action_get_type),
(create_tool_item), (ephy_go_action_class_init):
gtk+ now connects the tool item's create_menu_proxy to the
action's create_menu_item, so we don't need to do it ourselves.
Also unnecessary to do connect_proxy.
The go action is now almost empty, we should really see if
we can use a stock gtktoolbutton for it.
2004-02-04 Christian Persch <chpe@cvs.gnome.org>
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/ephy-go-action.c | 86 |
2 files changed, 18 insertions, 80 deletions
@@ -1,11 +1,21 @@ 2004-02-04 Christian Persch <chpe@cvs.gnome.org> + * src/ephy-go-action.c: (ephy_go_action_get_type), + (create_tool_item), (ephy_go_action_class_init): + + gtk+ now connects the tool item's create_menu_proxy to the + action's create_menu_item, so we don't need to do it ourselves. + Also unnecessary to do connect_proxy. + The go action is now almost empty, we should really see if + we can use a stock gtktoolbutton for it. + +2004-02-04 Christian Persch <chpe@cvs.gnome.org> + * lib/widgets/ephy-zoom-action.c: (ephy_zoom_action_get_type), (zoom_to_level_cb), (connect_proxy), (proxy_menu_activate_cb), (create_menu_item), (ephy_zoom_action_class_init): * lib/widgets/ephy-zoom-action.h: * lib/widgets/ephy-zoom-control.c: (ephy_zoom_control_class_init): - * src/ephy-history-window.c: (cmd_delete), Fix toolbar overflow menu creation. Don't connect zoom control signals to a menu item. diff --git a/src/ephy-go-action.c b/src/ephy-go-action.c index ffc5951b1..92c62c0f2 100644 --- a/src/ephy-go-action.c +++ b/src/ephy-go-action.c @@ -15,10 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #ifdef HAVE_CONFIG_H -#include <config.h> +#include "config.h" #endif #include "ephy-go-action.h" @@ -28,11 +30,7 @@ #include <gtk/gtktoolitem.h> #include <gtk/gtkbutton.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); static GObjectClass *parent_class = NULL; @@ -41,7 +39,7 @@ ephy_go_action_get_type (void) { static GType type = 0; - if (!type) + if (type == 0) { static const GTypeInfo type_info = { @@ -53,20 +51,15 @@ ephy_go_action_get_type (void) NULL, sizeof (EphyGoAction), 0, /* n_preallocs */ - (GInstanceInitFunc) ephy_go_action_init, + (GInstanceInitFunc) NULL, }; type = g_type_register_static (GTK_TYPE_ACTION, "EphyGoAction", &type_info, 0); } - return type; -} -static void -activate_cb (GtkWidget *widget, GtkAction *action) -{ - g_signal_emit_by_name (action, "activate"); + return type; } static GtkWidget * @@ -79,9 +72,6 @@ create_tool_item (GtkAction *action) button = gtk_button_new_with_label (_("Go")); gtk_button_set_relief(GTK_BUTTON (button), GTK_RELIEF_NONE); - - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (activate_cb), action); gtk_container_add (GTK_CONTAINER (item), button); gtk_widget_show (button); @@ -89,74 +79,12 @@ create_tool_item (GtkAction *action) return item; } -static GtkWidget * -create_menu_item (GtkAction *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 (GtkToolItem *item, GtkAction *action) -{ - GtkWidget *menu_item; - - menu_item = GTK_ACTION_GET_CLASS (action)->create_menu_item (action); - - GTK_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item); - - gtk_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item); - - return TRUE; -} - -static void -connect_proxy (GtkAction *action, GtkWidget *proxy) -{ - (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy); - - g_return_if_fail (EPHY_IS_GO_ACTION (action)); - - if (GTK_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) { - GtkActionClass *action_class; - GObjectClass *object_class = G_OBJECT_CLASS (class); - - object_class->finalize = ephy_go_action_finalize; + GtkActionClass *action_class = GTK_ACTION_CLASS (class); parent_class = g_type_class_peek_parent (class); - action_class = GTK_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 -ephy_go_action_init (EphyGoAction *action) -{ -} - -static void -ephy_go_action_finalize (GObject *object) -{ - g_return_if_fail (EPHY_IS_GO_ACTION (object)); - - LOG ("Go action finalized") - - G_OBJECT_CLASS (parent_class)->finalize (object); } |