gtk-demo: Cosmetic changes

Clean up the code of many examples in minor ways, fix some memory
leaks, and avoid the use of dialogs where a regular toplevel works
just as well.
This commit is contained in:
Matthias Clasen
2015-06-28 09:23:28 -04:00
parent be4a25231d
commit 609e04ddcf
52 changed files with 380 additions and 721 deletions

View File

@ -8,14 +8,6 @@
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static void
search_entry_destroyed (GtkWidget *widget)
{
window = NULL;
}
static void
search_changed_cb (GtkSearchEntry *entry,
GtkLabel *result_label)
@ -73,6 +65,7 @@ stop_search (GtkSearchEntry *entry,
GtkWidget *
do_search_entry2 (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *label;
@ -90,7 +83,7 @@ do_search_entry2 (GtkWidget *do_widget)
gtk_widget_set_size_request (window, 200, -1);
g_signal_connect (window, "destroy",
G_CALLBACK (search_entry_destroyed), &window);
G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@ -164,10 +157,7 @@ do_search_entry2 (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show_all (window);
else
{
gtk_widget_destroy (window);
window = NULL;
}
gtk_widget_destroy (window);
return window;
}