diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-09-16 19:30:53 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-09-16 19:40:30 -0300 |
commit | 74760ea31ed3947baa713a45cc3484ef2d4515eb (patch) | |
tree | 7b5acb197aa49dabb44cd4760f00b220c8e9deb4 /plugins/gtk+ | |
parent | 3b94aec9d8733ab991d22cf447850c2cf6339fdd (diff) | |
download | glade-74760ea31ed3947baa713a45cc3484ef2d4515eb.tar.gz |
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.
Diffstat (limited to 'plugins/gtk+')
-rw-r--r-- | plugins/gtk+/glade-gtk-container.c | 10 |
1 files 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; |