2 * This file is a part of hildon
4 * Copyright (C) 2008 Nokia Corporation, all rights reserved.
6 * Contact: Karl Lattimer <karl.lattimer@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 * SECTION:hildon-dialog
27 * @short_description: Widget representing a popup window in the Hildon framework.
28 * @see_also: #HildonCodeDialog, #HildonColorChooserDialog, #HildonFontSelectionDialog, #HildonGetPasswordDialog, #HildonLoginDialog, #HildonSetPasswordDialog, #HildonSortDialog, #HildonWizardDialog
30 * The HildonDialog is a GTK widget which represent a popup window in the
31 * Hildon framework. It is derived from the GtkDialog and provides additional
32 * commodities specific to the Hildon framework.
35 * <title>Simple <structname>HildonDialog</structname> usage</title>
37 * void quick_message (gchar *message)
40 * GtkWidget *dialog, *label;
42 * dialog = hildon_dialog_new ();
43 * label = gtk_label_new (message);
45 * g_signal_connect_swapped (dialog,
47 * G_CALLBACK (gtk_widget_destroy),
50 * gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
52 * gtk_widget_show_all (dialog);
59 #include "hildon-dialog.h"
61 G_DEFINE_TYPE (HildonDialog, hildon_dialog, GTK_TYPE_DIALOG);
64 hildon_dialog_class_init (HildonDialogClass *dialog_class)
69 hildon_dialog_init (HildonDialog *self)
76 * Creates a new #HildonDialog widget
78 * Returns: the newly created #HildonDialog
81 hildon_dialog_new (void)
83 GtkWidget *self = g_object_new (HILDON_TYPE_DIALOG, NULL);
89 * hildon_dialog_new_with_buttons:
90 * @title: Title of the dialog, or %NULL
91 * @parent: Transient parent of the dialog, or %NULL
92 * @flags: from #GtkDialogFlags
93 * @first_button_text: stock ID or text to go in first button, or %NULL
94 * @Varargs: response ID for first button, then additional buttons, ending with %NULL
96 * Creates a new #HildonDialog. See gtk_dialog_new_with_buttons() for
99 * Return value: a new #HildonDialog
102 hildon_dialog_new_with_buttons (const gchar *title,
104 GtkDialogFlags flags,
105 const gchar *first_button_text,
110 dialog = g_object_new (HILDON_TYPE_DIALOG, NULL);
112 /* This code is copied from gtk_dialog_new_empty(), as it's a
113 * private function that we cannot use here */
115 gtk_window_set_title (GTK_WINDOW (dialog), title);
118 gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
120 if (flags & GTK_DIALOG_MODAL)
121 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
123 if (flags & GTK_DIALOG_DESTROY_WITH_PARENT)
124 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
126 if (flags & GTK_DIALOG_NO_SEPARATOR)
127 gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
129 /* This is almost copied from gtk_dialog_add_buttons_valist() */
130 if (first_button_text != NULL) {
135 va_start (args, first_button_text);
136 text = first_button_text;
137 response_id = va_arg (args, gint);
139 while (text != NULL) {
140 gtk_dialog_add_button (GTK_DIALOG (dialog), text, response_id);
142 text = va_arg (args, gchar*);
145 response_id = va_arg (args, int);