Skip to content

Drop overzealous check using only the first child

Osamu Aoki requested to merge osamu.aoki/glade:master into master

This fixes issue #499 (closed) and #509 (closed)

  • Can't add GtkHeaderBar to window with existing widgets / containers
  • Cannot add GtkBox or other widgets inside a GtkPopoverMenu

Please note:

bin_child = gtk_bin_get_child (GTK_BIN (container))) was getting the first child only. Checking if the first child is placeholder causes false positives.

glade_util_count_placeholders (gwidget) recursively checks placeholder.

Signed-off-by: Osamu Aoki osamu@debian.org

I found out bin_child issue by printf :-)

            printf("container: %s\n", gtk_widget_get_name (GTK_WIDGET(container)));
            printf("child:     %s\n", gtk_widget_get_name (GTK_WIDGET(child)));
            printf("adapter:   %s\n", glade_widget_adaptor_get_title (adaptor));
            printf("bin_child: %s\n", gtk_widget_get_name (GTK_WIDGET(bin_child)));
            printf("count_placeholders (gwidget):    %i\n", glade_util_count_placeholders (gwidget));
            printf("GTK_IS_BIN (container):          %s\n", GTK_IS_BIN (container) ? "TRUE" : "FALSE");
            printf("GLADE_IS_PLACEHOLDER(bin_child): %s\n", GLADE_IS_PLACEHOLDER(bin_child) ? "TRUE" : "FALSE");
    I: NON-MATCH (BIN NORMAL) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    container: GtkWindow
    child:     GtkHeaderBar
    adapter:   Window
    bin_child: GladePlaceholder
    count_placeholders (gwidget):    2
    GTK_IS_BIN (container):          TRUE
    GLADE_IS_PLACEHOLDER(bin_child): TRUE
    I: NON-MATCH (BIN NORMAL) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    container: GtkWindow
    child:     GtkButton
    adapter:   Window
    bin_child: GladePlaceholder
    count_placeholders (gwidget):    2
    GTK_IS_BIN (container):          TRUE
    GLADE_IS_PLACEHOLDER(bin_child): TRUE
    I: MATCH (BIN NORMAL) ---------------------------------------------------
    container: GtkWindow
    child:     GtkHeaderBar
    adapter:   Window
    bin_child: GtkButton
    count_placeholders (gwidget):    1
    GTK_IS_BIN (container):          TRUE
    GLADE_IS_PLACEHOLDER(bin_child): FALSE

Merge request reports