diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-07-02 02:28:05 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-07-02 02:28:05 +0800 |
commit | c621f76b4e81a30f6d6db5eb16bf2c75d0980468 (patch) | |
tree | d2b3d20a5b3482fc27b0faa3fdfcf2624d9ab93a /lib/egg/eggtoolitem.c | |
parent | 0ab1c928c782530b2d5ab0ad81cb46e5aaed539d (diff) | |
download | gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.tar gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.tar.gz gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.tar.bz2 gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.tar.lz gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.tar.xz gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.tar.zst gsoc2013-epiphany-c621f76b4e81a30f6d6db5eb16bf2c75d0980468.zip |
Make the location entry an EggToolItem, and provide a custom tooptip
2003-07-01 Christian Persch <chpe@cvs.gnome.org>
* lib/widgets/ephy-location-entry.h:
* lib/widgets/ephy-location-entry.c: (ephy_location_entry_set_tooltip),
(ephy_location_entry_construct_contents),
(ephy_location_entry_class_init), (ephy_location_entry_init),
(ephy_location_entry_finalize):
Make the location entry an EggToolItem, and provide a custom
tooptip setter. Fix mem leak.
* src/ephy-location-action.c: (create_tool_item),
(ephy_location_action_class_init), (connect_proxy):
Use the location entry EggToolItem instead of constructing it
explicitly.
* src/toolbar.c: (toolbar_setup_action):
Set tooltip for location entry.
* lib/egg/egg-action.c: (connect_proxy), (disconnect_proxy):
Connect the tooltip sync'er on any EggToolItem, not just EggTollButton:s.
Disconnect the tooltip sync func on disconnect, too.
Diffstat (limited to 'lib/egg/eggtoolitem.c')
-rw-r--r-- | lib/egg/eggtoolitem.c | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/lib/egg/eggtoolitem.c b/lib/egg/eggtoolitem.c index 0e7ea5b72..b66376d36 100644 --- a/lib/egg/eggtoolitem.c +++ b/lib/egg/eggtoolitem.c @@ -362,8 +362,15 @@ egg_tool_item_size_request (GtkWidget *widget, gint xthickness = widget->style->xthickness; gint ythickness = widget->style->ythickness; - if (child) - gtk_widget_size_request (child, requisition); + if (child && GTK_WIDGET_VISIBLE (child)) + { + gtk_widget_size_request (child, requisition); + } + else + { + requisition->height = 0; + requisition->width = 0; + } requisition->width += (xthickness + GTK_CONTAINER (widget)->border_width) * 2; requisition->height += (ythickness + GTK_CONTAINER (widget)->border_width) * 2; @@ -405,14 +412,18 @@ egg_tool_item_size_allocate (GtkWidget *widget, static gboolean egg_tool_item_create_menu_proxy (EggToolItem *item) { - GtkWidget *menu_item = NULL; - if (!GTK_BIN (item)->child) - menu_item = gtk_separator_menu_item_new(); + { + GtkWidget *menu_item = NULL; + + menu_item = gtk_separator_menu_item_new(); + + egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item); - egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item); + return TRUE; + } - return TRUE; + return FALSE; } EggToolItem * @@ -543,9 +554,12 @@ egg_tool_item_real_set_tooltip (EggToolItem *tool_item, const gchar *tip_text, const gchar *tip_private) { - GtkBin *bin = GTK_BIN (tool_item); + GtkWidget *child = GTK_BIN (tool_item)->child; - gtk_tooltips_set_tip (tooltips, bin->child, tip_text, tip_private); + if (!child) + return FALSE; + + gtk_tooltips_set_tip (tooltips, child, tip_text, tip_private); return TRUE; } @@ -678,19 +692,22 @@ egg_tool_item_set_proxy_menu_item (EggToolItem *tool_item, g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (menu_item_id != NULL); - if (tool_item->menu_item) - g_object_unref (G_OBJECT (tool_item->menu_item)); - if (tool_item->menu_item_id) g_free (tool_item->menu_item_id); + + tool_item->menu_item_id = g_strdup (menu_item_id); - if (menu_item) + if (tool_item->menu_item != menu_item) { - g_object_ref (menu_item); - gtk_object_sink (GTK_OBJECT (menu_item)); + if (tool_item->menu_item) + g_object_unref (G_OBJECT (tool_item->menu_item)); + + if (menu_item) + { + g_object_ref (menu_item); + gtk_object_sink (GTK_OBJECT (menu_item)); + } + + tool_item->menu_item = menu_item; } - - tool_item->menu_item = menu_item; - - tool_item->menu_item_id = g_strdup (menu_item_id); } |