diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-09-30 20:06:01 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-09-30 20:06:01 -0300 |
commit | e5b891d5cf32342ba32bb7cafdfb14815e22b5f0 (patch) | |
tree | ca7f6af9890ca9e4ff0647fc29e4ece142188e07 | |
parent | 3f8275ad80e37eb5cb7ba43916a53e0311ac12af (diff) | |
download | glade-e5b891d5cf32342ba32bb7cafdfb14815e22b5f0.tar.gz |
GladeGtkWidget: special case GtkScrolledWindow remove parent action
Make sure you can not remove parent if the grand parent is a scrolled window
and the child is not scrollable.
Fix issue #471 "XML not updated after adding element"
-rw-r--r-- | plugins/gtk+/glade-gtk-widget.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/gtk+/glade-gtk-widget.c b/plugins/gtk+/glade-gtk-widget.c index ade2d22e..660a4144 100644 --- a/plugins/gtk+/glade-gtk-widget.c +++ b/plugins/gtk+/glade-gtk-widget.c @@ -705,7 +705,18 @@ widget_parent_changed (GtkWidget *widget, parent = glade_widget_get_parent (gwidget); if (parent && !glade_widget_get_internal (parent)) - glade_widget_set_action_sensitive (gwidget, "remove_parent", TRUE); + { + GladeWidget *grand_parent; + gboolean can_add = TRUE; + + /* We can not use glade_widget_adaptor_add_verify() here because it takes into account placeholders spaces */ + if ((grand_parent = glade_widget_get_parent (parent)) && + GTK_IS_SCROLLED_WINDOW (glade_widget_get_object (grand_parent)) && + !GTK_IS_SCROLLABLE (widget)) + can_add = FALSE; + + glade_widget_set_action_sensitive (gwidget, "remove_parent", can_add); + } else glade_widget_set_action_sensitive (gwidget, "remove_parent", FALSE); } |