[glade] GladeGtkContainer: improve add-verify



commit 74760ea31ed3947baa713a45cc3484ef2d4515eb
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Sep 16 19:30:53 2020 -0300

    GladeGtkContainer: improve add-verify
    
    Inform the user it has to increase the size of the container if there is
    no more placeholders in it.
    
    Special case GtkBin since Windows can hace a placeholder in the titlebar.

 plugins/gtk+/glade-gtk-container.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-container.c b/plugins/gtk+/glade-gtk-container.c
index fc36b3a2..ee005cc4 100644
--- a/plugins/gtk+/glade-gtk-container.c
+++ b/plugins/gtk+/glade-gtk-container.c
@@ -50,6 +50,7 @@ glade_gtk_container_add_verify (GladeWidgetAdaptor *adaptor,
                                 gboolean            user_feedback)
 {
   GladeWidget *gwidget = glade_widget_get_from_gobject (container);
+  GtkWidget *bin_child;
 
   if (GTK_IS_WINDOW (child))
     {
@@ -82,12 +83,17 @@ glade_gtk_container_add_verify (GladeWidgetAdaptor *adaptor,
       return FALSE;
     }
   else if (GLADE_WIDGET_ADAPTOR_USE_PLACEHOLDERS (adaptor) &&
-           glade_util_count_placeholders (gwidget) == 0)
+           /* Special case GtkBin since Windows can hace a placeholder in the titlebar */
+           ((GTK_IS_BIN (container) &&
+             (bin_child = gtk_bin_get_child (GTK_BIN (container))) &&
+              !GLADE_IS_PLACEHOLDER(bin_child)) ||
+            glade_util_count_placeholders (gwidget) == 0))
     {
       if (user_feedback)
         glade_util_ui_message (glade_app_get_window (),
                                GLADE_UI_INFO, NULL,
-                               _("Widgets of type %s need placeholders to add children."),
+                               _("Widgets of type %s need placeholders to add children.\n"
+                                 "Increase its size or add a container if it only supports one child."),
                                glade_widget_adaptor_get_title (adaptor));
 
       return FALSE;


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