[gthumb/gthumb-3-0] do not make modal dialogs block other windows as well
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb/gthumb-3-0] do not make modal dialogs block other windows as well
- Date: Tue, 14 Aug 2012 16:41:03 +0000 (UTC)
commit 87e7e525fcab4d80da5791c0516595f604b9f27f
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Aug 14 18:22:57 2012 +0200
do not make modal dialogs block other windows as well
gthumb/gth-window.c | 26 +++++++++++++++-----------
gthumb/gtk-utils.c | 15 +++++++++++++++
gthumb/gtk-utils.h | 1 +
3 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index 6ae91d7..2aa4854 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -36,17 +36,18 @@ enum {
struct _GthWindowPrivate {
- int n_pages;
- int current_page;
- GtkWidget *table;
- GtkWidget *notebook;
- GtkWidget *menubar;
- GtkWidget *toolbar;
- GtkWidget *infobar;
- GtkWidget *statusbar;
- GtkWidget **toolbars;
- GtkWidget **contents;
- GthWindowSize *window_size;
+ int n_pages;
+ int current_page;
+ GtkWidget *table;
+ GtkWidget *notebook;
+ GtkWidget *menubar;
+ GtkWidget *toolbar;
+ GtkWidget *infobar;
+ GtkWidget *statusbar;
+ GtkWidget **toolbars;
+ GtkWidget **contents;
+ GthWindowSize *window_size;
+ GtkWindowGroup *window_group;
};
@@ -159,6 +160,7 @@ gth_window_finalize (GObject *object)
g_free (window->priv->toolbars);
g_free (window->priv->contents);
g_free (window->priv->window_size);
+ g_object_unref (window->priv->window_group);
G_OBJECT_CLASS (gth_window_parent_class)->finalize (object);
}
@@ -254,6 +256,8 @@ gth_window_init (GthWindow *window)
window->priv->toolbar = NULL;
window->priv->infobar = NULL;
window->priv->statusbar = NULL;
+ window->priv->window_group = gtk_window_group_new ();
+ gtk_window_group_add_window (window->priv->window_group, GTK_WINDOW (window));
gtk_window_set_application (GTK_WINDOW (window), Main_Application);
}
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index e4c0381..58e14b7 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -137,6 +137,8 @@ _gtk_message_dialog_new (GtkWindow *parent,
d = gtk_dialog_new_with_buttons ("", parent, flags, NULL, NULL);
gtk_window_set_resizable (GTK_WINDOW (d), FALSE);
+ if (flags & GTK_DIALOG_MODAL)
+ _gtk_dialog_add_to_window_group (GTK_DIALOG (d));
gtk_container_set_border_width (GTK_CONTAINER (d), 6);
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (d))), 6);
@@ -502,6 +504,19 @@ _g_icon_get_pixbuf (GIcon *icon,
}
+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));
+}
+
+
GdkPixbuf *
get_mime_type_pixbuf (const char *mime_type,
int icon_size,
diff --git a/gthumb/gtk-utils.h b/gthumb/gtk-utils.h
index fa702cd..6d1c36b 100644
--- a/gthumb/gtk-utils.h
+++ b/gthumb/gtk-utils.h
@@ -79,6 +79,7 @@ void _gtk_error_dialog_show (GtkWindow *pa
void _gtk_info_dialog_run (GtkWindow *parent,
const gchar *format,
...) G_GNUC_PRINTF (2, 3);
+void _gtk_dialog_add_to_window_group (GtkDialog *dialog);
GdkPixbuf * _g_icon_get_pixbuf (GIcon *icon,
int size,
GtkIconTheme *icon_theme);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]