aboutsummaryrefslogtreecommitdiffstats
path: root/lib/egg
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
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')
-rw-r--r--lib/egg/eggradiotoolbutton.c3
-rw-r--r--lib/egg/eggseparatortoolitem.c15
-rw-r--r--lib/egg/eggtoggletoolbutton.c38
-rw-r--r--lib/egg/eggtoolbar.c107
-rw-r--r--lib/egg/eggtoolbar.h1
-rw-r--r--lib/egg/eggtoolbutton.c133
-rw-r--r--lib/egg/eggtoolbutton.h3
-rw-r--r--lib/egg/eggtoolitem.c35
8 files changed, 207 insertions, 128 deletions
diff --git a/lib/egg/eggradiotoolbutton.c b/lib/egg/eggradiotoolbutton.c
index ec14990b8..885654abf 100644
--- a/lib/egg/eggradiotoolbutton.c
+++ b/lib/egg/eggradiotoolbutton.c
@@ -90,10 +90,11 @@ egg_radio_tool_button_new_from_stock (GSList *group,
const gchar *stock_id)
{
EggRadioToolButton *button;
+
+ g_return_val_if_fail (stock_id != NULL, NULL);
button = g_object_new (EGG_TYPE_RADIO_TOOL_BUTTON,
"stock_id", stock_id,
- "use_underline", TRUE,
NULL);
diff --git a/lib/egg/eggseparatortoolitem.c b/lib/egg/eggseparatortoolitem.c
index 0f4f9871f..90b8e5204 100644
--- a/lib/egg/eggseparatortoolitem.c
+++ b/lib/egg/eggseparatortoolitem.c
@@ -5,11 +5,10 @@
# define _(s) (s)
#endif
-static void egg_separator_tool_item_init (EggSeparatorToolItem *self);
static void egg_separator_tool_item_class_init (EggSeparatorToolItemClass*class);
-static void egg_separator_tool_item_add (GtkContainer *container,
- GtkWidget *child);
+static void egg_separator_tool_item_add (GtkContainer *container,
+ GtkWidget *child);
static GObjectClass *parent_class = NULL;
@@ -31,7 +30,7 @@ egg_separator_tool_item_get_type (void)
NULL,
sizeof (EggSeparatorToolItem),
0, /* n_preallocs */
- (GInstanceInitFunc) egg_separator_tool_item_init
+ (GInstanceInitFunc) NULL,
};
type = g_type_register_static (EGG_TYPE_TOOL_ITEM,
@@ -55,12 +54,8 @@ egg_separator_tool_item_class_init (EggSeparatorToolItemClass *class)
}
static void
-egg_separator_tool_item_init (EggSeparatorToolItem *self)
-{
-}
-
-static void
-egg_separator_tool_item_add (GtkContainer *container, GtkWidget *child)
+egg_separator_tool_item_add (GtkContainer *container,
+ GtkWidget *child)
{
g_warning("attempt to add a child to an EggSeparatorToolItem");
}
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);
diff --git a/lib/egg/eggtoolbar.c b/lib/egg/eggtoolbar.c
index eb84db275..79344f7d9 100644
--- a/lib/egg/eggtoolbar.c
+++ b/lib/egg/eggtoolbar.c
@@ -865,7 +865,8 @@ egg_toolbar_size_request (GtkWidget *widget,
}
static void
-fixup_allocation_for_rtl (gint total_size, GtkAllocation *allocation)
+fixup_allocation_for_rtl (gint total_size,
+ GtkAllocation *allocation)
{
allocation->x += (total_size - (2 * allocation->x + allocation->width));
}
@@ -885,7 +886,8 @@ fixup_allocation_for_vertical (GtkAllocation *allocation)
}
static gint
-get_item_size (EggToolbar *toolbar, GtkWidget *child)
+get_item_size (EggToolbar *toolbar,
+ GtkWidget *child)
{
GtkRequisition requisition;
EggToolItem *item = EGG_TOOL_ITEM (child);
@@ -912,7 +914,8 @@ get_item_size (EggToolbar *toolbar, GtkWidget *child)
}
static void
-egg_toolbar_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+egg_toolbar_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
{
EggToolbar *toolbar = EGG_TOOLBAR (widget);
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
@@ -1429,8 +1432,11 @@ egg_toolbar_screen_changed (GtkWidget *widget,
}
static void
-find_drop_pos(EggToolbar *toolbar, gint x, gint y,
- gint *drop_index, gint *drop_pos)
+find_drop_pos (EggToolbar *toolbar,
+ gint x,
+ gint y,
+ gint *drop_index,
+ gint *drop_pos)
{
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
GtkOrientation orientation;
@@ -1561,6 +1567,8 @@ egg_toolbar_drag_motion (GtkWidget *widget,
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
+ attributes.width = 1;
+ attributes.height = 1;
attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
priv->drag_highlight = gdk_window_new (widget->window,
&attributes, attributes_mask);
@@ -1577,13 +1585,15 @@ egg_toolbar_drag_motion (GtkWidget *widget,
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
gdk_window_move_resize (priv->drag_highlight,
- new_pos - 1, widget->allocation.y + border_width,
+ widget->allocation.x + new_pos - 1,
+ widget->allocation.y + border_width,
2, widget->allocation.height-border_width*2);
}
else
{
gdk_window_move_resize (priv->drag_highlight,
- border_width, new_pos - 1,
+ widget->allocation.x + border_width,
+ widget->allocation.y + new_pos - 1,
widget->allocation.width-border_width*2, 2);
}
}
@@ -1596,11 +1606,11 @@ egg_toolbar_drag_motion (GtkWidget *widget,
}
static void
-egg_toolbar_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+egg_toolbar_get_child_property (GtkContainer *container,
+ GtkWidget *child,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EggToolItem *item = EGG_TOOL_ITEM (child);
@@ -1625,11 +1635,11 @@ egg_toolbar_get_child_property (GtkContainer *container,
}
static void
-egg_toolbar_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+egg_toolbar_set_child_property (GtkContainer *container,
+ GtkWidget *child,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
switch (property_id)
{
@@ -1827,7 +1837,8 @@ menu_position_func (GtkMenu *menu,
}
static void
-menu_deactivated (GtkWidget *menu, EggToolbar *toolbar)
+menu_deactivated (GtkWidget *menu,
+ EggToolbar *toolbar)
{
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
@@ -1835,13 +1846,15 @@ menu_deactivated (GtkWidget *menu, EggToolbar *toolbar)
}
static void
-remove_item (GtkWidget *menu_item, gpointer data)
+remove_item (GtkWidget *menu_item,
+ gpointer data)
{
gtk_container_remove (GTK_CONTAINER (menu_item->parent), menu_item);
}
static void
-show_menu (EggToolbar *toolbar, GdkEventButton *event)
+show_menu (EggToolbar *toolbar,
+ GdkEventButton *event)
{
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
GList *list;
@@ -1879,7 +1892,8 @@ show_menu (EggToolbar *toolbar, GdkEventButton *event)
}
static void
-egg_toolbar_arrow_button_clicked (GtkWidget *button, EggToolbar *toolbar)
+egg_toolbar_arrow_button_clicked (GtkWidget *button,
+ EggToolbar *toolbar)
{
EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
@@ -1912,7 +1926,6 @@ egg_toolbar_button_press (GtkWidget *button,
{
if (event->button == 3)
{
- g_print ("CONTEXT");
g_signal_emit (toolbar, toolbar_signals[POPUP_CONTEXT_MENU], 0, NULL);
return FALSE;
}
@@ -2034,14 +2047,6 @@ egg_toolbar_remove_tool_item (EggToolbar *toolbar,
}
void
-toolbar_add_child (EggToolbar *toolbar,
- GtkWidget *child,
- gint pos)
-{
-
-}
-
-void
egg_toolbar_insert (EggToolbar *toolbar,
EggToolItem *item,
gint pos)
@@ -2155,12 +2160,14 @@ egg_toolbar_get_tooltips (EggToolbar *toolbar)
}
gint
-egg_toolbar_get_n_items (EggToolbar *toolbar)
+egg_toolbar_get_n_items (EggToolbar *toolbar)
{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
+ EggToolbarPrivate *priv;
g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), -1);
+ priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
+
return g_list_length (priv->items);
}
@@ -2168,13 +2175,15 @@ egg_toolbar_get_n_items (EggToolbar *toolbar)
* returns NULL if n is out of range
*/
EggToolItem *
-egg_toolbar_get_nth_item (EggToolbar *toolbar,
- gint n)
+egg_toolbar_get_nth_item (EggToolbar *toolbar,
+ gint n)
{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
+ EggToolbarPrivate *priv;
g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), NULL);
+ priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
+
return g_list_nth_data (priv->items, n);
}
@@ -2205,7 +2214,7 @@ egg_toolbar_get_icon_size (EggToolbar *toolbar)
}
GtkReliefStyle
-egg_toolbar_get_relief_style (EggToolbar *toolbar)
+egg_toolbar_get_relief_style (EggToolbar *toolbar)
{
g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), GTK_RELIEF_NONE);
@@ -2385,6 +2394,31 @@ egg_toolbar_insert_space (EggToolbar *toolbar,
}
void
+egg_toolbar_remove_space (EggToolbar *toolbar,
+ gint position)
+{
+ EggToolItem *item;
+
+ g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
+
+ item = g_list_nth_data (toolbar->children, position);
+
+ if (!item)
+ {
+ g_warning ("Toolbar position %d doesn't exist", position);
+ return;
+ }
+
+ if (GTK_BIN (item)->child)
+ {
+ g_warning ("Toolbar position %d is not a space", position);
+ }
+
+ egg_toolbar_remove_tool_item (toolbar, item);
+}
+
+
+void
egg_toolbar_append_widget (EggToolbar *toolbar,
GtkWidget *widget,
const gchar *tooltip_text,
@@ -2583,6 +2617,7 @@ egg_toolbar_internal_insert_element (EggToolbar *toolbar,
child->label = gtk_label_new (text);
}
egg_tool_button_set_label_widget (EGG_TOOL_BUTTON (item), child->label);
+ gtk_widget_show (child->label);
}
if (icon)
diff --git a/lib/egg/eggtoolbar.h b/lib/egg/eggtoolbar.h
index 2dbb3e9d2..44cc21fa4 100644
--- a/lib/egg/eggtoolbar.h
+++ b/lib/egg/eggtoolbar.h
@@ -194,7 +194,6 @@ void egg_toolbar_append_space (EggToolbar *toolbar);
void egg_toolbar_prepend_space (EggToolbar *toolbar);
void egg_toolbar_insert_space (EggToolbar *toolbar,
gint position);
-/* FIXME: Write this function */
void egg_toolbar_remove_space (EggToolbar *toolbar,
gint position);
/* Any element type */
diff --git a/lib/egg/eggtoolbutton.c b/lib/egg/eggtoolbutton.c
index 36408d3ad..4c348b36b 100644
--- a/lib/egg/eggtoolbutton.c
+++ b/lib/egg/eggtoolbutton.c
@@ -201,6 +201,32 @@ egg_tool_button_init (EggToolButton *button, EggToolButtonClass *klass)
gtk_widget_show (button->button);
}
+static gchar *
+elide_underscores (const gchar *original)
+{
+ gchar *q, *result;
+ const gchar *p;
+ gboolean last_underscore;
+
+ q = result = g_malloc (strlen (original) + 1);
+ last_underscore = FALSE;
+
+ for (p = original; *p; p++)
+ {
+ if (!last_underscore && *p == '_')
+ last_underscore = TRUE;
+ else
+ {
+ last_underscore = FALSE;
+ *q++ = *p;
+ }
+ }
+
+ *q = '\0';
+
+ return result;
+}
+
static void
egg_tool_button_construct_contents (EggToolItem *tool_item)
{
@@ -213,6 +239,14 @@ egg_tool_button_construct_contents (EggToolItem *tool_item)
GtkIconSize icon_size;
GtkWidget *box = NULL;
+ if (egg_tool_item_get_proxy_menu_item (tool_item, MENU_ID))
+ {
+ /* Remove item, so it will be recreated on the next
+ * create_proxy_menu_item()
+ */
+ egg_tool_item_set_proxy_menu_item (tool_item, MENU_ID, NULL);
+ }
+
if (button->icon_widget && button->icon_widget->parent)
{
gtk_container_remove (GTK_CONTAINER (button->icon_widget->parent),
@@ -247,10 +281,29 @@ egg_tool_button_construct_contents (EggToolItem *tool_item)
}
else
{
- gchar *text = _egg_tool_button_get_label_text (button);
- label = gtk_label_new (text);
- g_free (text);
+ GtkStockItem stock_item;
+ gboolean elide = TRUE;
+ gchar *label_text;
+ if (button->label_text)
+ {
+ label_text = button->label_text;
+ elide = button->use_underline;
+ }
+ else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
+ label_text = stock_item.label;
+ else
+ label_text = "";
+
+ if (elide)
+ label_text = elide_underscores (label_text);
+ else
+ label_text = g_strdup (label_text);
+
+ label = gtk_label_new (label_text);
+
+ g_free (label_text);
+
gtk_widget_show (label);
}
}
@@ -415,11 +468,24 @@ egg_tool_button_create_menu_proxy (EggToolItem *item)
EggToolButton *button = EGG_TOOL_BUTTON (item);
GtkWidget *menu_item;
GtkWidget *menu_image = NULL;
- gchar *label;
+ GtkStockItem stock_item;
+ gboolean use_mnemonic = TRUE;
+ const char *label = "";
- label = _egg_tool_button_get_label_text (button);
- menu_item = gtk_image_menu_item_new_with_label (label);
- g_free (label);
+ if (button->label_widget && GTK_IS_LABEL (button->label_widget))
+ label = gtk_label_get_label (GTK_LABEL (button->label_widget));
+ else if (button->label_text)
+ {
+ label = button->label_text;
+ use_mnemonic = button->use_underline;
+ }
+ else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
+ label = stock_item.label;
+
+ if (use_mnemonic)
+ menu_item = gtk_image_menu_item_new_with_mnemonic (label);
+ else
+ menu_item = gtk_image_menu_item_new_with_label (label);
g_object_ref (menu_item);
gtk_object_sink (GTK_OBJECT (menu_item));
@@ -454,10 +520,11 @@ egg_tool_button_create_menu_proxy (EggToolItem *item)
if (menu_image)
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), menu_image);
- g_signal_connect_object (menu_item, "activate",
- G_CALLBACK (gtk_button_clicked),
- EGG_TOOL_BUTTON (button)->button,
- G_CONNECT_SWAPPED);
+ g_signal_connect_closure_by_id (menu_item,
+ g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
+ g_cclosure_new_object_swap (G_CALLBACK (gtk_button_clicked),
+ G_OBJECT (EGG_TOOL_BUTTON (button)->button)),
+ FALSE);
egg_tool_item_set_proxy_menu_item (EGG_TOOL_ITEM (button), MENU_ID, menu_item);
@@ -688,47 +755,3 @@ egg_tool_button_get_icon_set (EggToolButton *button)
return button->icon_set;
}
-
-static gchar *
-elide_underscores (const gchar *original)
-{
- gchar *q, *result;
- const gchar *p;
- gboolean last_underscore;
-
- q = result = g_malloc (strlen (original) + 1);
- last_underscore = FALSE;
-
- for (p = original; *p; p++)
- {
- if (!last_underscore && *p == '_')
- last_underscore = TRUE;
- else
- {
- last_underscore = FALSE;
- *q++ = *p;
- }
- }
-
- *q = '\0';
-
- return result;
-}
-
-gchar *
-_egg_tool_button_get_label_text (EggToolButton *button)
-{
- GtkStockItem stock_item;
-
- if (button->label_text)
- {
- if (button->use_underline)
- return elide_underscores (button->label_text);
- else
- return g_strdup (button->label_text);
- }
- else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
- return elide_underscores (stock_item.label);
- else
- return g_strdup ("");
-}
diff --git a/lib/egg/eggtoolbutton.h b/lib/egg/eggtoolbutton.h
index 9fb143116..66de8f537 100644
--- a/lib/egg/eggtoolbutton.h
+++ b/lib/egg/eggtoolbutton.h
@@ -87,9 +87,6 @@ void egg_tool_button_set_label_widget (EggToolButton *button,
GtkWidget *label_widget);
GtkWidget * egg_tool_button_get_label_widget (EggToolButton *button);
-/* internal function */
-gchar * _egg_tool_button_get_label_text (EggToolButton *button);
-
G_END_DECLS
#endif /* __EGG_TOOL_BUTTON_H__ */
diff --git a/lib/egg/eggtoolitem.c b/lib/egg/eggtoolitem.c
index 49445d48f..0ffc5b298 100644
--- a/lib/egg/eggtoolitem.c
+++ b/lib/egg/eggtoolitem.c
@@ -46,6 +46,7 @@ enum {
static void egg_tool_item_init (EggToolItem *toolitem);
static void egg_tool_item_class_init (EggToolItemClass *class);
+static void egg_tool_item_finalize (GObject *object);
static void egg_tool_item_set_property (GObject *object,
guint prop_id,
@@ -118,6 +119,7 @@ egg_boolean_handled_accumulator (GSignalInvocationHint *ihint,
return continue_emission;
}
+
static void
egg_tool_item_class_init (EggToolItemClass *klass)
{
@@ -130,6 +132,7 @@ egg_tool_item_class_init (EggToolItemClass *klass)
object_class->set_property = egg_tool_item_set_property;
object_class->get_property = egg_tool_item_get_property;
+ object_class->finalize = egg_tool_item_finalize;
widget_class->realize = egg_tool_item_realize;
widget_class->unrealize = egg_tool_item_unrealize;
@@ -197,10 +200,22 @@ egg_tool_item_init (EggToolItem *toolitem)
}
static void
-egg_tool_item_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+egg_tool_item_finalize (GObject *object)
+{
+ EggToolItem *item = EGG_TOOL_ITEM (object);
+
+ if (item->menu_item)
+ g_object_unref (item->menu_item);
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+egg_tool_item_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
EggToolItem *toolitem = EGG_TOOL_ITEM (object);
@@ -218,10 +233,10 @@ egg_tool_item_set_property (GObject *object,
}
static void
-egg_tool_item_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+egg_tool_item_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EggToolItem *toolitem = EGG_TOOL_ITEM (object);
@@ -476,7 +491,7 @@ egg_tool_item_set_expand (EggToolItem *tool_item,
void
egg_tool_item_set_pack_end (EggToolItem *tool_item,
- gboolean pack_end)
+ gboolean pack_end)
{
g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
@@ -642,7 +657,7 @@ egg_tool_item_get_proxy_menu_item (EggToolItem *tool_item,
void
egg_tool_item_set_proxy_menu_item (EggToolItem *tool_item,
const gchar *menu_item_id,
- GtkWidget *menu_item)
+ GtkWidget *menu_item)
{
g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));