title: Show GtkApplicationWindow after close
body: <p>I am a complete newbie when it comes to C and Gtk+.</p>
  
  <p>I am trying to create an interface with a main application window. This main window has a menu, which opens a second window (of type GtkApplictionWindow).</p>
  
  <p>My problem is, that once I close this second window (with the x in the top) I cannot open this second window again.</p>
  
  <p>I get an error:</p>
  
  <pre><code>(api:2807): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed
  </code></pre>
  
  <p>I've tried attaching a function to both the <code>destroy</code> and the <code>hide</code> signals, and in my code I've tried both <code>gtk_widget_destroy(window_connections)</code> and <code>gtk_widget_hide(window_connections)</code>.</p>
  
  <p>My interface is created in Glade.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  #include &lt;stdio.h&gt;
  
  GtkWidget       *window_connections;
  
  int main(int argc, char *argv[]) {
      GtkBuilder  *builder;
      GtkWidget       *window;
      GtkWidget       *statusbar;
  
      gtk_init(&amp;argc, &amp;argv);
  
      builder = gtk_builder_new();
      gtk_builder_add_from_file(builder, "glade/window_main.glade", NULL);
  
      window = GTK_WIDGET(gtk_builder_get_object(builder, "window_main"));
      gtk_builder_connect_signals(builder, NULL);
  
      window_connections = GTK_WIDGET(gtk_builder_get_object(builder, "window_connections"));
  
      statusbar = GTK_WIDGET(gtk_builder_get_object(builder, "statusbar"));
  
      gtk_statusbar_push(GTK_STATUSBAR(statusbar), 1, "Hello, World!");
  
      g_object_unref(builder);
  
      gtk_widget_show(window);
      gtk_main();
  
      return 0;
  }
  
  // called when window is closed
  void on_window_main_destroy() {
      gtk_main_quit();
  }
  
  void window_open_connections() {
      gtk_widget_show(window_connections);
  }
  
  void window_close_connections() {
      gtk_widget_hide(window_connections);
  }
  
  void window_hide_test() {
      printf("hide\n");
  }
  </code></pre>
  
  <p>Help?</p>