[glade/glade-3-12] Revert "Removed unneeded function glade_gtk_activatable_parse_finished()"



commit eb427c6ea4a15a0c4c0e4d5d8eef5406063f59e0
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Thu Nov 1 21:36:41 2012 -0300

    Revert "Removed unneeded function glade_gtk_activatable_parse_finished()"
    
    This reverts commit a41a51ca2754580f6a958287e2407b864319ad1e.

 plugins/gtk+/glade-gtk-activatable.c |   14 ++++++++++++++
 plugins/gtk+/glade-gtk-activatable.h |    4 ++++
 plugins/gtk+/glade-gtk-switch.c      |   18 ++++++++++++++++++
 plugins/gtk+/glade-gtk.c             |   22 +++++++++++++++++++++-
 plugins/gtk+/gtk+.xml.in             |    1 +
 5 files changed, 58 insertions(+), 1 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-activatable.c b/plugins/gtk+/glade-gtk-activatable.c
index 31d538f..cb903e5 100644
--- a/plugins/gtk+/glade-gtk-activatable.c
+++ b/plugins/gtk+/glade-gtk-activatable.c
@@ -27,6 +27,20 @@
 
 /* ----------------------------- GtkActivatable ------------------------------ */
 void
+glade_gtk_activatable_parse_finished (GladeProject *project, 
+                                      GladeWidget  *widget)
+{
+  GObject *related_action = NULL;
+
+  glade_widget_property_get (widget, "related-action", &related_action);
+  if (related_action == NULL)
+    {
+      glade_widget_property_set_sensitive (widget, "use-action-appearance", FALSE, ACTION_APPEARANCE_MSG);
+      glade_widget_property_set (widget, "use-action-appearance", FALSE);
+    }
+}
+
+void
 glade_gtk_activatable_evaluate_property_sensitivity (GObject *object,
                                                      const gchar *id,
                                                      const GValue *value)
diff --git a/plugins/gtk+/glade-gtk-activatable.h b/plugins/gtk+/glade-gtk-activatable.h
index 1af54a2..9333328 100644
--- a/plugins/gtk+/glade-gtk-activatable.h
+++ b/plugins/gtk+/glade-gtk-activatable.h
@@ -31,6 +31,10 @@
 G_BEGIN_DECLS
 
 void
+glade_gtk_activatable_parse_finished (GladeProject *project, 
+                                      GladeWidget  *widget);
+
+void
 glade_gtk_activatable_evaluate_property_sensitivity (GObject *object,
                                                      const gchar *id,
                                                      const GValue *value);
diff --git a/plugins/gtk+/glade-gtk-switch.c b/plugins/gtk+/glade-gtk-switch.c
index 03b6c5a..5dba443 100644
--- a/plugins/gtk+/glade-gtk-switch.c
+++ b/plugins/gtk+/glade-gtk-switch.c
@@ -42,6 +42,24 @@ glade_gtk_switch_create_editable (GladeWidgetAdaptor *adaptor,
 }
 
 void
+glade_gtk_switch_post_create (GladeWidgetAdaptor *adaptor,
+                              GObject *widget,
+                              GladeCreateReason reason)
+{
+  GladeWidget *gwidget;
+  
+  if (reason != GLADE_CREATE_LOAD) return;
+
+  g_return_if_fail (GTK_IS_SWITCH (widget));
+  gwidget = glade_widget_get_from_gobject (widget);
+  g_return_if_fail (GLADE_IS_WIDGET (gwidget));
+
+  g_signal_connect (glade_widget_get_project (gwidget), "parse-finished",
+                    G_CALLBACK (glade_gtk_activatable_parse_finished),
+                    gwidget);
+}
+
+void
 glade_gtk_switch_set_property (GladeWidgetAdaptor *adaptor,
                                GObject *object,
                                const gchar *id,
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 478a4b4..49ac4a6 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -4350,7 +4350,11 @@ glade_gtk_button_post_create (GladeWidgetAdaptor * adaptor,
                                        RESPID_INSENSITIVE_MSG);
   glade_widget_property_set_enabled (gbutton, "response-id", FALSE);
 
-  if (reason == GLADE_CREATE_USER)
+  if (reason == GLADE_CREATE_LOAD)
+    g_signal_connect (glade_widget_get_project (gbutton), "parse-finished",
+		      G_CALLBACK (glade_gtk_activatable_parse_finished),
+		      gbutton);
+  else if (reason == GLADE_CREATE_USER)
     glade_gtk_button_update_stock (gbutton);
 }
 
@@ -5367,6 +5371,10 @@ void
 glade_gtk_menu_item_post_create (GladeWidgetAdaptor * adaptor,
                                  GObject * object, GladeCreateReason reason)
 {
+  GladeWidget *gitem;
+
+  gitem = glade_widget_get_from_gobject (object);
+
   if (GTK_IS_SEPARATOR_MENU_ITEM (object))
     return;
 
@@ -5376,6 +5384,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 (glade_widget_get_project (gitem)), "parse-finished",
+		      G_CALLBACK (glade_gtk_activatable_parse_finished),
+		      gitem);
 }
 
 GList *
@@ -6480,12 +6493,19 @@ glade_gtk_tool_item_post_create (GladeWidgetAdaptor *adaptor,
                                  GObject            *object, 
 				 GladeCreateReason   reason)
 {
+  GladeWidget *gitem = glade_widget_get_from_gobject (object);
+
   if (GTK_IS_SEPARATOR_TOOL_ITEM (object))
     return;
 
   if (reason == GLADE_CREATE_USER &&
       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 (glade_widget_get_project (gitem)), "parse-finished",
+		      G_CALLBACK (glade_gtk_activatable_parse_finished),
+		      gitem);
 }
 
 void
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 3f405d1..56cf742 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1112,6 +1112,7 @@ embedded in another object</_tooltip>
     </glade-widget-class>
 
     <glade-widget-class name="GtkSwitch" generic-name="switch" _title="Switch">
+      <post-create-function>glade_gtk_switch_post_create</post-create-function>
       <set-property-function>glade_gtk_switch_set_property</set-property-function>
       <create-editable-function>glade_gtk_switch_create_editable</create-editable-function>
       <properties>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]