diff options
author | Havoc Pennington <hp@redhat.com> | 2002-10-17 16:04:53 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-10-17 16:04:53 +0000 |
commit | aa62466091c92514e596f87cae8a34373caea67c (patch) | |
tree | 5c0f8aa1874d30c3448ba3a48b701f2953a3afbf /src/tools | |
parent | 337812d51dd50ce7bae0cf5fd7abbab07eb856ec (diff) | |
download | metacity-aa62466091c92514e596f87cae8a34373caea67c.tar.gz |
add code to create big stacks of dialogs transient for each other, for
2002-10-17 Havoc Pennington <hp@redhat.com>
* src/tools/metacity-window-demo.c (dialog_cb): add code to create
big stacks of dialogs transient for each other, for testing.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/metacity-window-demo.c | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/src/tools/metacity-window-demo.c b/src/tools/metacity-window-demo.c index 695b0f55..f4bd7ffc 100644 --- a/src/tools/metacity-window-demo.c +++ b/src/tools/metacity-window-demo.c @@ -216,28 +216,67 @@ main (int argc, char **argv) } static void -dialog_cb (gpointer callback_data, - guint callback_action, - GtkWidget *widget) +response_cb (GtkDialog *dialog, + int response_id, + void *data); + +static void +make_dialog (GtkWidget *parent, + int depth) { GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data), + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, - "Here is a dialog"); + "Here is a dialog %d", + depth); + gtk_dialog_add_button (GTK_DIALOG (dialog), + "Open child dialog", + GTK_RESPONSE_ACCEPT); + /* Close dialog on user response */ g_signal_connect (G_OBJECT (dialog), "response", - G_CALLBACK (gtk_widget_destroy), + G_CALLBACK (response_cb), NULL); + + g_object_set_data (G_OBJECT (dialog), "depth", + GINT_TO_POINTER (depth)); gtk_widget_show (dialog); } static void +response_cb (GtkDialog *dialog, + int response_id, + void *data) +{ + switch (response_id) + { + case GTK_RESPONSE_ACCEPT: + make_dialog (GTK_WIDGET (dialog), + GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), + "depth")) + 1); + break; + + default: + gtk_widget_destroy (GTK_WIDGET (dialog)); + break; + } +} + +static void +dialog_cb (gpointer callback_data, + guint callback_action, + GtkWidget *widget) +{ + make_dialog (GTK_WIDGET (callback_data), 1); +} + +static void modal_dialog_cb (gpointer callback_data, guint callback_action, GtkWidget *widget) |