1
0
Fork 0

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.
This commit is contained in:
Havoc Pennington 2002-10-17 16:04:53 +00:00 committed by Havoc Pennington
parent 337812d51d
commit aa62466091
3 changed files with 60 additions and 15 deletions

View file

@ -1,3 +1,8 @@
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.
2002-10-16 Havoc Pennington <hp@redhat.com>
* src/workspace.c: workspaces are all per-screen now, fix

View file

@ -2,6 +2,7 @@
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2002 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as

View file

@ -216,27 +216,66 @@ 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,