[glade: 5/5] glade-gtk-widget.c: Minor fix for 'add_parent' action



commit 8730f94991ec02a7afc3758ab52314485388b2e1
Author: Tristan Van Berkom <tristan upstairslabs com>
Date:   Sun Oct 26 23:06:52 2014 +0900

    glade-gtk-widget.c: Minor fix for 'add_parent' action
    
    Previous implementation assumes that the parent widget can
    be retrieved with gtk_widget_get_parent(), use glade_widget_get_parent()
    instead and trust the project datamodel instead, as the logical
    widget hierarchy may not be exactly the truth, as is the case for
    a searchbar child.

 plugins/gtk+/glade-gtk-widget.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-widget.c b/plugins/gtk+/glade-gtk-widget.c
index 14f3718..019f109 100644
--- a/plugins/gtk+/glade-gtk-widget.c
+++ b/plugins/gtk+/glade-gtk-widget.c
@@ -808,14 +808,9 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
 {
   GladeWidget *gwidget = glade_widget_get_from_gobject (object), *gparent;
   GList this_widget = { 0, }, that_widget = { 0,};
-  GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (object));
   GladeProject *project;
 
-  if (parent)
-    gparent = glade_widget_get_from_gobject (parent);
-  else
-    gparent = NULL;
-
+  gparent = glade_widget_get_parent (gwidget);
   project = glade_widget_get_project (gwidget);
 
   if (strcmp (action_path, "preview") == 0)
@@ -971,7 +966,7 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
     }
   else if (strcmp (action_path, "clear_properties") == 0)
     {
-      glade_editor_reset_dialog_run (gtk_widget_get_toplevel (parent), gwidget);
+      glade_editor_reset_dialog_run (gtk_widget_get_toplevel (GTK_WIDGET (object)), gwidget);
     }
   else if (strcmp (action_path, "read_documentation") == 0)
     {


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