aboutsummaryrefslogtreecommitdiffstats
path: root/lib/egg/eggtoggletoolbutton.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-05-24 16:51:04 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-05-24 16:51:04 +0800
commitab25b91dc7b2d07a2762e799a7010d3f9438069c (patch)
tree56241585a3c0f06e1ed859c2bbce8e6919b83aed /lib/egg/eggtoggletoolbutton.c
parenta98d9364cb5395aca5adc9fa4db219df7545ab98 (diff)
downloadgsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.tar
gsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.tar.gz
gsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.tar.bz2
gsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.tar.lz
gsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.tar.xz
gsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.tar.zst
gsoc2013-epiphany-ab25b91dc7b2d07a2762e799a7010d3f9438069c.zip
Update
2003-05-24 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/eggradiotoolbutton.c: * lib/egg/eggseparatortoolitem.c: * lib/egg/eggtoggletoolbutton.c: * lib/egg/eggtoolbar.c: * lib/egg/eggtoolbar.h: * lib/egg/eggtoolbutton.c: * lib/egg/eggtoolbutton.h: * lib/egg/eggtoolitem.c: Update
Diffstat (limited to 'lib/egg/eggtoggletoolbutton.c')
-rw-r--r--lib/egg/eggtoggletoolbutton.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/egg/eggtoggletoolbutton.c b/lib/egg/eggtoggletoolbutton.c
index 67c76db55..63b9438de 100644
--- a/lib/egg/eggtoggletoolbutton.c
+++ b/lib/egg/eggtoggletoolbutton.c
@@ -23,6 +23,7 @@
#include <gtk/gtkcheckmenuitem.h>
#include <gtk/gtklabel.h>
#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkstock.h>
#ifndef _
# define _(s) (s)
@@ -125,25 +126,39 @@ egg_toggle_tool_button_finalize (GObject *object)
static gboolean
egg_toggle_tool_button_create_menu_proxy (EggToolItem *item)
{
+ EggToolButton *tool_button = EGG_TOOL_BUTTON (item);
+ EggToggleToolButton *toggle_tool_button = EGG_TOGGLE_TOOL_BUTTON (item);
GtkWidget *menu_item = NULL;
+ GtkStockItem stock_item;
+ gboolean use_mnemonic = TRUE;
+ const char *label = "";
- EggToggleToolButton *button = EGG_TOGGLE_TOOL_BUTTON (item);
- gchar *label;
-
- label = _egg_tool_button_get_label_text (EGG_TOOL_BUTTON (item));
+ if (tool_button->label_widget && GTK_IS_LABEL (tool_button->label_widget))
+ label = gtk_label_get_label (GTK_LABEL (tool_button->label_widget));
+ else if (tool_button->label_text)
+ {
+ label = tool_button->label_text;
+ use_mnemonic = tool_button->use_underline;
+ }
+ else if (tool_button->stock_id && gtk_stock_lookup (tool_button->stock_id, &stock_item))
+ label = stock_item.label;
- menu_item = gtk_check_menu_item_new_with_mnemonic (label);
- g_free (label);
+ if (use_mnemonic)
+ menu_item = gtk_check_menu_item_new_with_mnemonic (label);
+ else
+ menu_item = gtk_check_menu_item_new_with_label (label);
g_object_ref (menu_item);
gtk_object_sink (GTK_OBJECT (menu_item));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
- button->active);
+ toggle_tool_button->active);
- g_signal_connect_object (menu_item, "activate",
- G_CALLBACK (menu_item_activated),
- EGG_TOOL_BUTTON (button), 0);
+ g_signal_connect_closure_by_id (menu_item,
+ g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
+ g_cclosure_new_object (G_CALLBACK (menu_item_activated),
+ G_OBJECT (toggle_tool_button)),
+ FALSE);
egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
@@ -184,7 +199,7 @@ button_toggled (GtkWidget *widget,
if ((menu_item =
egg_tool_item_get_proxy_menu_item (EGG_TOOL_ITEM (toggle_tool_button), MENU_ID)))
- {
+ {
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
toggle_tool_button->active);
}
@@ -213,7 +228,6 @@ egg_toggle_tool_button_new_from_stock (const gchar *stock_id)
button = g_object_new (EGG_TYPE_TOGGLE_TOOL_BUTTON,
"stock_id", stock_id,
- "use_underline", TRUE,
NULL);
return EGG_TOOL_ITEM (button);