[glade3/glade-3-8] * plugins/gtk+/glade-gtk.c: Fixed loaded state of use-action-appearance so that it always loads
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3/glade-3-8] * plugins/gtk+/glade-gtk.c: Fixed loaded state of use-action-appearance so that it always loads
- Date: Fri, 31 Dec 2010 04:42:10 +0000 (UTC)
commit 931d990a5735450c83512b9c97e32720c69c1be2
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri Dec 31 13:22:25 2010 +0900
* plugins/gtk+/glade-gtk.c: Fixed loaded state of use-action-appearance so that it always
loads as FALSE if there is no "related-action" at load time.
ChangeLog | 3 ++
plugins/gtk+/glade-gtk.c | 66 ++++++++++++++++++++++++++++++++--------------
2 files changed, 49 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e2ac537..88196af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,9 @@
* gladeui/glade-project.c: Further fixing project dispose cycle, still leaking a little
bit of memory for large projects but no crashes.
+ * plugins/gtk+/glade-gtk.c: Fixed loaded state of use-action-appearance so that it always
+ loads as FALSE if there is no "related-action" at load time.
+
2010-12-29 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-design-view.c: Made loading progress bar nicer looking and ellipsizing.
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 1aa65f9..153ba45 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -5941,27 +5941,18 @@ glade_gtk_color_button_set_property (GladeWidgetAdaptor *adaptor,
}
-/* ----------------------------- GtkButton ------------------------------ */
-
-static void
-sync_use_appearance (GladeWidget *gwidget)
+/* ----------------------------- GtkActivatable ------------------------------ */
+static void
+activatable_parse_finished (GladeProject *project,
+ GladeWidget *widget)
{
- GladeProperty *prop = glade_widget_get_property (gwidget, "use-action-appearance");
- gboolean use_appearance = FALSE;
-
- /* This is the kind of thing we avoid doing at project load time ;-) */
- if (glade_widget_superuser ())
- return;
+ GObject *related_action = NULL;
- glade_property_get (prop, &use_appearance);
- if (use_appearance)
- {
- glade_property_set (prop, FALSE);
- glade_property_set (prop, TRUE);
- }
+ glade_widget_property_get (widget, "related-action", &related_action);
+ if (related_action == NULL)
+ glade_widget_property_set (widget, "use-action-appearance", FALSE);
}
-/* shared between menuitems and toolitems too */
static void
evaluate_activatable_property_sensitivity (GObject *object,
const gchar *id,
@@ -6021,6 +6012,25 @@ evaluate_activatable_property_sensitivity (GObject *object,
}
}
+/* ----------------------------- GtkButton ------------------------------ */
+static void
+sync_use_appearance (GladeWidget *gwidget)
+{
+ GladeProperty *prop = glade_widget_get_property (gwidget, "use-action-appearance");
+ gboolean use_appearance = FALSE;
+
+ /* This is the kind of thing we avoid doing at project load time ;-) */
+ if (glade_widget_superuser ())
+ return;
+
+ glade_property_get (prop, &use_appearance);
+ if (use_appearance)
+ {
+ glade_property_set (prop, FALSE);
+ glade_property_set (prop, TRUE);
+ }
+}
+
GladeEditable *
glade_gtk_button_create_editable (GladeWidgetAdaptor *adaptor,
GladeEditorPageType type)
@@ -6061,6 +6071,11 @@ glade_gtk_button_post_create (GladeWidgetAdaptor *adaptor,
glade_widget_property_set_sensitive (gbutton, "response-id", FALSE,
RESPID_INSENSITIVE_MSG);
glade_widget_property_set_enabled (gbutton, "response-id", FALSE);
+
+ if (reason == GLADE_CREATE_LOAD)
+ g_signal_connect (G_OBJECT (gbutton->project), "parse-finished",
+ G_CALLBACK (activatable_parse_finished),
+ gbutton);
}
void
@@ -6881,8 +6896,8 @@ glade_gtk_menu_item_action_activate (GladeWidgetAdaptor *adaptor,
if (shell)
gtk_menu_shell_deactivate (GTK_MENU_SHELL (shell));
-}
+}
GObject *
glade_gtk_menu_item_constructor (GType type,
@@ -6920,6 +6935,11 @@ glade_gtk_menu_item_post_create (GladeWidgetAdaptor *adaptor,
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (object), label);
}
+
+ if (reason == GLADE_CREATE_LOAD)
+ g_signal_connect (G_OBJECT (gitem->project), "parse-finished",
+ G_CALLBACK (activatable_parse_finished),
+ gitem);
}
GList *
@@ -7865,7 +7885,7 @@ glade_gtk_tool_item_post_create (GladeWidgetAdaptor *adaptor,
GObject *object,
GladeCreateReason reason)
{
- g_return_if_fail (GTK_IS_TOOL_ITEM (object));
+ GladeWidget *gitem = glade_widget_get_from_gobject (object);
if (GTK_IS_SEPARATOR_TOOL_ITEM (object)) return;
@@ -7873,6 +7893,11 @@ glade_gtk_tool_item_post_create (GladeWidgetAdaptor *adaptor,
gtk_bin_get_child (GTK_BIN (object)) == NULL)
gtk_container_add (GTK_CONTAINER (object),
glade_placeholder_new ());
+
+ if (reason == GLADE_CREATE_LOAD)
+ g_signal_connect (G_OBJECT (gitem->project), "parse-finished",
+ G_CALLBACK (activatable_parse_finished),
+ gitem);
}
void
@@ -7884,7 +7909,8 @@ glade_gtk_tool_item_set_property (GladeWidgetAdaptor *adaptor,
GladeWidget *gwidget = glade_widget_get_from_gobject (object);
GladeProperty *property = glade_widget_get_property (gwidget, id);
- //evaluate_activatable_property_sensitivity (object, id, value);
+ evaluate_activatable_property_sensitivity (object, id, value);
+
if (GPC_VERSION_CHECK (property->klass, gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]