[gthumb] construct the button content if it's invalid or the is-important property changes
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] construct the button content if it's invalid or the is-important property changes
- Date: Tue, 25 Oct 2011 14:57:11 +0000 (UTC)
commit 8414499de1445cb5cda1628a8b98656f60a5810e
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Oct 25 16:09:36 2011 +0200
construct the button content if it's invalid or the is-important property changes
gthumb/gth-toggle-menu-tool-button.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gthumb/gth-toggle-menu-tool-button.c b/gthumb/gth-toggle-menu-tool-button.c
index 626e309..8cf1043 100644
--- a/gthumb/gth-toggle-menu-tool-button.c
+++ b/gthumb/gth-toggle-menu-tool-button.c
@@ -29,6 +29,7 @@
struct _GthToggleMenuToolButtonPrivate {
guint active : 1;
guint use_underline : 1;
+ guint contents_invalid : 1;
char *stock_id;
char *icon_name;
char *label_text;
@@ -120,6 +121,8 @@ gth_toggle_menu_tool_button_construct_contents (GtkToolItem *tool_item)
GtkOrientation text_orientation = GTK_ORIENTATION_HORIZONTAL;
GtkSizeGroup *size_group = NULL;
+ button->priv->contents_invalid = FALSE;
+
gtk_widget_style_get (GTK_WIDGET (tool_item),
"icon-spacing", &icon_spacing,
NULL);
@@ -436,6 +439,20 @@ gth_toggle_menu_tool_button_get_property (GObject *object,
}
+static void
+gth_toggle_menu_tool_button_property_notify (GObject *object,
+ GParamSpec *pspec)
+{
+ GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (object);
+
+ if (button->priv->contents_invalid || strcmp ("is-important", pspec->name) == 0)
+ gth_toggle_menu_tool_button_construct_contents (GTK_TOOL_ITEM (object));
+
+ if (G_OBJECT_CLASS (parent_class)->notify)
+ G_OBJECT_CLASS (parent_class)->notify (object, pspec);
+}
+
+
/* Callback for the "deactivate" signal on the pop-up menu.
* This is used so that we unset the state of the toggle button
* when the pop-up menu disappears.
@@ -672,6 +689,7 @@ gth_toggle_menu_tool_button_class_init (GthToggleMenuToolButtonClass *klass)
object_class->finalize = gth_toggle_menu_tool_button_finalize;
object_class->set_property = gth_toggle_menu_tool_button_set_property;
object_class->get_property = gth_toggle_menu_tool_button_get_property;
+ object_class->notify = gth_toggle_menu_tool_button_property_notify;
widget_class = (GtkWidgetClass *) klass;
widget_class->state_changed = gth_toggle_menu_tool_button_state_changed;
@@ -766,6 +784,7 @@ gth_toggle_menu_tool_button_init (GthToggleMenuToolButton *button)
{
button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button, GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, GthToggleMenuToolButtonPrivate);
button->priv->menu = NULL;
+ button->priv->contents_invalid = TRUE;
button->priv->toggle_button = gtk_toggle_button_new ();
gtk_button_set_focus_on_click (GTK_BUTTON (button->priv->toggle_button), FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]