2
* The contents of this file are subject to the Mozilla Public
3
* License Version 1.1 (the "License"); you may not use this file
4
* except in compliance with the License. You may obtain a copy of
5
* the License at http://www.mozilla.org/MPL/
7
* Software distributed under the License is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the License for the specific language governing
10
* rights and limitations under the License.
12
* The Original Code is MPEG4IP.
14
* The Initial Developer of the Original Code is Cisco Systems Inc.
15
* Portions created by Cisco Systems Inc. are
16
* Copyright (C) Cisco Systems Inc. 2000, 2001. All Rights Reserved.
19
* Bill May wmay@cisco.com
22
* Showmessage.c from Developing Linux Applications
26
#include "gui_utils.h"
31
* Routine to close the about dialog window.
33
static void CloseShowMessage (GtkWidget *widget, gpointer data)
35
GtkWidget *dialog_widget = (GtkWidget *) data;
37
gtk_grab_remove (dialog_widget);
39
/* --- Close the widget --- */
40
gtk_widget_destroy (dialog_widget);
48
* Release the window "grab"
49
* Clear out the global dialog_window since that
50
* is checked when the dialog is brought up.
52
static void ClearShowMessage (GtkWidget *widget, gpointer data)
54
gtk_grab_remove (widget);
61
* Show a popup message to the user.
63
void ShowMessage (const char *szTitle, const char *szMessage)
67
GtkWidget *dialog_window;
69
/* --- Create a dialog window --- */
70
dialog_window = gtk_dialog_new ();
72
gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy",
73
GTK_SIGNAL_FUNC (ClearShowMessage),
76
/* --- Set the title and add a border --- */
77
gtk_window_set_title (GTK_WINDOW (dialog_window), szTitle);
78
gtk_container_border_width (GTK_CONTAINER (dialog_window), 0);
80
/* --- Create an "Ok" button with the focus --- */
81
button = gtk_button_new_with_label ("OK");
83
gtk_signal_connect (GTK_OBJECT (button), "clicked",
84
GTK_SIGNAL_FUNC (CloseShowMessage),
87
/* --- Default the "Ok" button --- */
88
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
89
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),
90
button, TRUE, TRUE, 0);
91
gtk_widget_grab_default (button);
92
gtk_widget_show (button);
94
/* --- Create a descriptive label --- */
95
label = gtk_label_new (szMessage);
97
/* --- Put some room around the label text --- */
98
gtk_misc_set_padding (GTK_MISC (label), 10, 10);
100
/* --- Add label to designated area on dialog --- */
101
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox),
102
label, TRUE, TRUE, 0);
104
/* --- Show the label --- */
105
gtk_widget_show (label);
108
/* --- Show the dialog --- */
109
gtk_widget_show (dialog_window);
111
/* --- Only this window can have actions done. --- */
112
gtk_grab_add (dialog_window);