aboutsummaryrefslogtreecommitdiffstats
path: root/lib/egg/eggtoggletoolbutton.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/eggtoggletoolbutton.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/eggtoggletoolbutton.c')
-rw-r--r--lib/egg/eggtoggletoolbutton.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/egg/eggtoggletoolbutton.c b/lib/egg/eggtoggletoolbutton.c
index 5f489bcec..67c76db55 100644
--- a/lib/egg/eggtoggletoolbutton.c
+++ b/lib/egg/eggtoggletoolbutton.c
@@ -28,6 +28,8 @@
# define _(s) (s)
#endif
+#define MENU_ID "egg-toggle-tool-button-menu-id"
+
enum {
TOGGLED,
LAST_SIGNAL
@@ -37,7 +39,7 @@ static void egg_toggle_tool_button_init (EggToggleToolButton *button)
static void egg_toggle_tool_button_class_init (EggToggleToolButtonClass *klass);
static void egg_toggle_tool_button_finalize (GObject *object);
-static GtkWidget *egg_toggle_tool_button_create_menu_proxy (EggToolItem *button);
+static gboolean egg_toggle_tool_button_create_menu_proxy (EggToolItem *button);
static void button_toggled (GtkWidget *widget,
EggToggleToolButton *button);
@@ -120,31 +122,34 @@ egg_toggle_tool_button_finalize (GObject *object)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
-static GtkWidget *
+static gboolean
egg_toggle_tool_button_create_menu_proxy (EggToolItem *item)
{
+ GtkWidget *menu_item = NULL;
+
EggToggleToolButton *button = EGG_TOGGLE_TOOL_BUTTON (item);
gchar *label;
label = _egg_tool_button_get_label_text (EGG_TOOL_BUTTON (item));
+
+ menu_item = gtk_check_menu_item_new_with_mnemonic (label);
+ g_free (label);
- if (button->menu_item)
- g_object_remove_weak_pointer (G_OBJECT (button->menu_item),
- (gpointer *)&(button->menu_item));
+ g_object_ref (menu_item);
+ gtk_object_sink (GTK_OBJECT (menu_item));
- button->menu_item = gtk_check_menu_item_new_with_mnemonic (label);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (button->menu_item),
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
button->active);
- g_signal_connect_object (button->menu_item, "activate",
+
+ g_signal_connect_object (menu_item, "activate",
G_CALLBACK (menu_item_activated),
EGG_TOOL_BUTTON (button), 0);
- g_object_add_weak_pointer (G_OBJECT (button->menu_item),
- (gpointer *)&(button->menu_item));
+ egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
- g_free (label);
+ g_object_unref (menu_item);
- return button->menu_item;
+ return TRUE;
}
static void
@@ -173,11 +178,14 @@ button_toggled (GtkWidget *widget,
if (toggle_tool_button->active != toggle_active)
{
+ GtkWidget *menu_item;
+
toggle_tool_button->active = toggle_active;
- if (toggle_tool_button->menu_item)
- {
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toggle_tool_button->menu_item),
+ 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);
}