[gtk+] testwindowsize: show the actual window size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] testwindowsize: show the actual window size
- Date: Sat, 25 May 2013 17:13:12 +0000 (UTC)
commit 47b2248eb396b07662cfebe1b939071aa6563351
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 25 13:12:56 2013 -0400
testwindowsize: show the actual window size
tests/testwindowsize.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c
index f205e30..d11feb1 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]