[glade/glade-3-38] GladeGtkWidget: add viewport on add scrolled window action



commit 362e95362da647a1c54e5eeb2ecabc03048e8f53
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Sep 16 20:11:10 2020 -0300

    GladeGtkWidget: add viewport on add scrolled window action
    
    Add a viewport for non scrollable widget when adding a
    scrolled window parent.
    
    Fix issue #471 "XML not updated after adding element"

 plugins/gtk+/glade-gtk-widget.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/plugins/gtk+/glade-gtk-widget.c b/plugins/gtk+/glade-gtk-widget.c
index 6061d8b9..e5ab6de6 100644
--- a/plugins/gtk+/glade-gtk-widget.c
+++ b/plugins/gtk+/glade-gtk-widget.c
@@ -932,6 +932,18 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor *adaptor,
           if ((gnew_parent =
                glade_command_create (adaptor, gparent, NULL, project)) != NULL)
             {
+              /* We might need to add a viewport */
+              if (new_type == GTK_TYPE_SCROLLED_WINDOW &&
+                  !GTK_IS_SCROLLABLE (object))
+                {
+                  GladeWidgetAdaptor *viewport =
+                    glade_widget_adaptor_get_by_type (GTK_TYPE_VIEWPORT);
+                  gnew_parent = glade_command_create (viewport,
+                                                      gnew_parent,
+                                                      NULL,
+                                                      project);
+                }
+
               /* Now we created the new parent, if gwidget had a parentless widget reference...
                * set that reference to the new parent instead */
               if (property)


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