title: Trouble hiding and showing widgets in response to event
body: <h1>Problem</h1>
  <p>I have a problem where closing a widget with the delete event, via gtk_widget_hide_on_delete fails to show the menu widget again via a swapped gtk_widget_show_all with the corresponding widget passed to it as an argument.</p>
  <h1>Background</h1>
  <p>I'm creating a program consisting of a selection menu with a number of button widgets. Pressing one button will hide the menu, and show a window widget containing a label and a TextEntry, the delete event of this window widget will hide the widget, and show the menu again.</p>
  <h1>Example program</h1>
  <p>I've created a minimal example for this problem. The code simply loads the ui via <code>GtkBuilder</code> and then enters the main gtk loop.</p>
  <p>I rely on <code>gtk_widget_show_all</code>, <code>gtk_widget_hide</code> and <code>gtk_widget_hide_on_delete</code>, but when I close the <em>exercise widget</em> using the <code>delete-event</code>, the window disappears, but the menu widget isn't shown.</p>
  <pre><code>#include &lt;gtk/gtk.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(int argc, char **argv)
  {
      GtkBuilder * builder;
      GtkWidget * menu;
      GError *error = NULL;
  
      gtk_init(&amp;argc, &amp;argv);
      builder = gtk_builder_new();
      if (!gtk_builder_add_from_file(builder, &quot;example.glade&quot;, &amp;error)) {
          g_warning(&quot;%s&quot;, error-&gt;message);
          g_free(error);
          fprintf(stderr, &quot;Failed to load build file&quot;);
      }
  
      menu = (GtkWidget *) gtk_builder_get_object(builder, &quot;menu&quot;);
    
      gtk_builder_connect_signals(builder, NULL);
      gtk_widget_show(menu);
  
      gtk_main();
    
      return 0;
  }
  </code></pre>
  <p>The XML file example.glade has been created using Glade.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;!-- Generated with glade 3.16.1 --&gt;
  &lt;interface&gt;
    &lt;requires lib=&quot;gtk+&quot; version=&quot;3.10&quot;/&gt;
    &lt;object class=&quot;GtkWindow&quot; id=&quot;exercise&quot;&gt;
      &lt;property name=&quot;can_focus&quot;&gt;False&lt;/property&gt;
      &lt;property name=&quot;window_position&quot;&gt;center&lt;/property&gt;
      &lt;signal name=&quot;delete-event&quot; handler=&quot;gtk_widget_hide_on_delete&quot; swapped=&quot;no&quot;/&gt;
      &lt;signal name=&quot;delete-event&quot; handler=&quot;gtk_widget_show_all&quot; object=&quot;menu&quot; after=&quot;yes&quot; swapped=&quot;yes&quot;/&gt;
      &lt;child&gt;
        &lt;object class=&quot;GtkGrid&quot; id=&quot;grid2&quot;&gt;
          &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
          &lt;property name=&quot;can_focus&quot;&gt;False&lt;/property&gt;
          &lt;child&gt;
            &lt;object class=&quot;GtkEntry&quot; id=&quot;entry1&quot;&gt;
              &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;can_focus&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;hexpand&quot;&gt;True&lt;/property&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name=&quot;left_attach&quot;&gt;0&lt;/property&gt;
              &lt;property name=&quot;top_attach&quot;&gt;1&lt;/property&gt;
              &lt;property name=&quot;width&quot;&gt;1&lt;/property&gt;
              &lt;property name=&quot;height&quot;&gt;1&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
          &lt;child&gt;
            &lt;object class=&quot;GtkLabel&quot; id=&quot;label1&quot;&gt;
              &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;can_focus&quot;&gt;False&lt;/property&gt;
              &lt;property name=&quot;hexpand&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;vexpand&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;label&quot; translatable=&quot;yes&quot;&gt;A window where stuff will happen.&lt;/property&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name=&quot;left_attach&quot;&gt;0&lt;/property&gt;
              &lt;property name=&quot;top_attach&quot;&gt;0&lt;/property&gt;
              &lt;property name=&quot;width&quot;&gt;1&lt;/property&gt;
              &lt;property name=&quot;height&quot;&gt;1&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
        &lt;/object&gt;
      &lt;/child&gt;
    &lt;/object&gt;
    &lt;object class=&quot;GtkWindow&quot; id=&quot;menu&quot;&gt;
      &lt;property name=&quot;can_focus&quot;&gt;False&lt;/property&gt;
      &lt;property name=&quot;window_position&quot;&gt;center&lt;/property&gt;
      &lt;signal name=&quot;destroy&quot; handler=&quot;gtk_main_quit&quot; swapped=&quot;no&quot;/&gt;
      &lt;child&gt;
        &lt;object class=&quot;GtkGrid&quot; id=&quot;grid1&quot;&gt;
          &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
          &lt;property name=&quot;can_focus&quot;&gt;False&lt;/property&gt;
          &lt;child&gt;
            &lt;object class=&quot;GtkButton&quot; id=&quot;button1&quot;&gt;
              &lt;property name=&quot;label&quot; translatable=&quot;yes&quot;&gt;button1&lt;/property&gt;
              &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;can_focus&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;receives_default&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;hexpand&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;vexpand&quot;&gt;True&lt;/property&gt;
              &lt;signal name=&quot;clicked&quot; handler=&quot;gtk_widget_hide&quot; object=&quot;menu&quot; swapped=&quot;yes&quot;/&gt;
              &lt;signal name=&quot;clicked&quot; handler=&quot;gtk_widget_show_all&quot; object=&quot;exercise&quot; swapped=&quot;yes&quot;/&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name=&quot;left_attach&quot;&gt;0&lt;/property&gt;
              &lt;property name=&quot;top_attach&quot;&gt;0&lt;/property&gt;
              &lt;property name=&quot;width&quot;&gt;1&lt;/property&gt;
              &lt;property name=&quot;height&quot;&gt;1&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
          &lt;child&gt;
            &lt;object class=&quot;GtkButton&quot; id=&quot;button2&quot;&gt;
              &lt;property name=&quot;label&quot; translatable=&quot;yes&quot;&gt;button2&lt;/property&gt;
              &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;can_focus&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;receives_default&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;hexpand&quot;&gt;True&lt;/property&gt;
              &lt;property name=&quot;vexpand&quot;&gt;True&lt;/property&gt;
              &lt;signal name=&quot;clicked&quot; handler=&quot;gtk_widget_hide&quot; object=&quot;menu&quot; swapped=&quot;yes&quot;/&gt;
              &lt;signal name=&quot;clicked&quot; handler=&quot;gtk_widget_show_all&quot; object=&quot;exercise&quot; swapped=&quot;yes&quot;/&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name=&quot;left_attach&quot;&gt;0&lt;/property&gt;
              &lt;property name=&quot;top_attach&quot;&gt;1&lt;/property&gt;
              &lt;property name=&quot;width&quot;&gt;1&lt;/property&gt;
              &lt;property name=&quot;height&quot;&gt;1&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
        &lt;/object&gt;
      &lt;/child&gt;
    &lt;/object&gt;
  &lt;/interface&gt;
  </code></pre>