[file-roller: 79/123] add modal dialogs to the toplevel group to handle multi modal dialogs correctly
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller: 79/123] add modal dialogs to the toplevel group to handle multi modal dialogs correctly
- Date: Mon, 6 Aug 2012 13:47:30 +0000 (UTC)
commit d1d323ba9b9e8efd51049d3ef5701ef8988c4883
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Jul 30 09:43:44 2012 +0200
add modal dialogs to the toplevel group to handle multi modal dialogs correctly
src/gtk-utils.c | 22 ++++++++++++++++++++++
src/gtk-utils.h | 1 +
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index b7cf262..2d437e3 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -75,6 +75,9 @@ _gtk_message_dialog_new (GtkWindow *parent,
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), (flags & GTK_DIALOG_DESTROY_WITH_PARENT));
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
+ if (flags & GTK_DIALOG_MODAL)
+ _gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
+
/* set the icon */
gtk_image_set_from_stock (GTK_IMAGE (_gtk_builder_get_widget (builder, "icon_image")),
@@ -190,6 +193,9 @@ _gtk_request_dialog_run (GtkWindow *parent,
gtk_window_set_title (GTK_WINDOW (dialog), title);
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
+ if (flags & GTK_DIALOG_MODAL)
+ _gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
+
label = _gtk_builder_get_widget (builder, "message_label");
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), message);
@@ -244,6 +250,9 @@ _gtk_error_dialog_new (GtkWindow *parent,
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), (flags & GTK_DIALOG_DESTROY_WITH_PARENT));
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
+ if (flags & GTK_DIALOG_MODAL)
+ _gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
+
/* label */
escaped_message = g_markup_escape_text (primary_text, -1);
@@ -338,6 +347,19 @@ _gtk_error_dialog_run (GtkWindow *parent,
void
+_gtk_dialog_add_to_window_group (GtkDialog *dialog)
+{
+ GtkWidget *toplevel;
+
+ g_return_if_fail (dialog != NULL);
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (dialog));
+ if (gtk_widget_is_toplevel (toplevel) && gtk_window_has_group (GTK_WINDOW (toplevel)))
+ gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), GTK_WINDOW (dialog));
+}
+
+
+void
_gtk_entry_set_locale_text (GtkEntry *entry,
const char *text)
{
diff --git a/src/gtk-utils.h b/src/gtk-utils.h
index c815689..0448633 100644
--- a/src/gtk-utils.h
+++ b/src/gtk-utils.h
@@ -52,6 +52,7 @@ void _gtk_error_dialog_run (GtkWindow *parent,
const gchar *main_message,
const gchar *format,
...);
+void _gtk_dialog_add_to_window_group (GtkDialog *dialog);
void _gtk_entry_set_locale_text (GtkEntry *entry,
const char *text);
char * _gtk_entry_get_locale_text (GtkEntry *entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]