diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-05-25 13:12:56 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-05-25 13:12:56 -0400 |
commit | 47b2248eb396b07662cfebe1b939071aa6563351 (patch) | |
tree | 274d6b2f16f01534805aa6dd2900aabdcd080be1 /tests/testwindowsize.c | |
parent | 526958cd53a147dc410d1ee8d24c7db519c1298e (diff) | |
download | gtk+-47b2248eb396b07662cfebe1b939071aa6563351.tar.gz |
testwindowsize: show the actual window size
Diffstat (limited to 'tests/testwindowsize.c')
-rw-r--r-- | tests/testwindowsize.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c index f205e30833..d11feb1499 100644 --- a/tests/testwindowsize.c +++ b/tests/testwindowsize.c @@ -7,6 +7,20 @@ static GtkWidget *default_width_spin; static GtkWidget *default_height_spin; static GtkWidget *resizable_check; +static gboolean +configure_event_cb (GtkWidget *window, GdkEventConfigure *event, GtkLabel *label) +{ + gchar *str; + gint width, height; + + gtk_window_get_size (GTK_WINDOW (window), &width, &height); + str = g_strdup_printf ("%d x %d", width, height); + gtk_label_set_label (label, str); + g_free (str); + + return FALSE; +} + static void show_dialog (void) { @@ -44,9 +58,15 @@ show_dialog (void) gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label, 0, TRUE, TRUE); + gtk_widget_show (label); + label = gtk_label_new ("? x ?"); gtk_widget_show (label); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP); + g_signal_connect (dialog, "configure-event", + G_CALLBACK (configure_event_cb), label); + gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); |