add modal dialog test

2002-02-08  Havoc Pennington  <hp@pobox.com>

	* src/tools/metacity-window-demo.c (menu_items): add modal dialog test
This commit is contained in:
Havoc Pennington 2002-02-08 06:22:24 +00:00 committed by Havoc Pennington
parent 51d9f9dce6
commit ced833fdfc
2 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2002-02-08 Havoc Pennington <hp@pobox.com>
* src/tools/metacity-window-demo.c (menu_items): add modal dialog test
2002-02-08 Havoc Pennington <hp@pobox.com> 2002-02-08 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_show): when mapping a window with * src/window.c (meta_window_show): when mapping a window with

View File

@ -184,6 +184,26 @@ dialog_cb (gpointer callback_data,
gtk_widget_show (dialog); gtk_widget_show (dialog);
} }
static void
modal_dialog_cb (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"Here is a MODAL dialog");
set_gtk_window_type (GTK_WINDOW (dialog), "_NET_WM_WINDOW_TYPE_MODAL_DIALOG");
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
static void static void
utility_cb (gpointer callback_data, utility_cb (gpointer callback_data,
guint callback_action, guint callback_action,
@ -420,6 +440,7 @@ static GtkItemFactoryEntry menu_items[] =
{ "/_Windows", NULL, NULL, 0, "<Branch>" }, { "/_Windows", NULL, NULL, 0, "<Branch>" },
{ "/Windows/tearoff", NULL, NULL, 0, "<Tearoff>" }, { "/Windows/tearoff", NULL, NULL, 0, "<Tearoff>" },
{ "/Windows/_Dialog", "<control>d", dialog_cb, 0, NULL }, { "/Windows/_Dialog", "<control>d", dialog_cb, 0, NULL },
{ "/Windows/_Modal dialog", NULL, modal_dialog_cb, 0, NULL },
{ "/Windows/_Utility", "<control>u", utility_cb, 0, NULL }, { "/Windows/_Utility", "<control>u", utility_cb, 0, NULL },
{ "/Windows/_Splashscreen", "<control>s", splashscreen_cb, 0, NULL }, { "/Windows/_Splashscreen", "<control>s", splashscreen_cb, 0, NULL },
{ "/Windows/_Top dock", NULL, dock_cb, DOCK_TOP, NULL }, { "/Windows/_Top dock", NULL, dock_cb, DOCK_TOP, NULL },