aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-folder-selector-button.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-04-08 04:20:00 +0800
committerDan Winship <danw@src.gnome.org>2003-04-08 04:20:00 +0800
commit320484b37fb316e369b66d3bf11484854d8911ca (patch)
tree95e0ffbfea497e8ef9ef24c54160445850dcaa37 /shell/evolution-folder-selector-button.c
parent42d845bd31c3cfb824d417baccb37ba0db0118b3 (diff)
downloadgsoc2013-evolution-320484b37fb316e369b66d3bf11484854d8911ca.tar.gz
gsoc2013-evolution-320484b37fb316e369b66d3bf11484854d8911ca.tar.zst
gsoc2013-evolution-320484b37fb316e369b66d3bf11484854d8911ca.zip
Desensitize the window's top-level container rather than desensitizing the
* evolution-folder-selector-button.c (clicked): Desensitize the window's top-level container rather than desensitizing the window itself, which causes strange problems [#40854]. Also fix up the code that tries to watch for the parent window being destroyed. * e-shell.c (impl_Shell_selectUserFolder): Use e_dialog_set_transient_for_xid. * e-shell-folder-selection-dialog.c (impl_response): Treat GTK_RESPONSE_DELETE_EVENT the same as GTK_RESPONSE_CANCEL. (e_shell_folder_selection_dialog_construct): No need to catch "delete_event" signal. svn path=/trunk/; revision=20729
Diffstat (limited to 'shell/evolution-folder-selector-button.c')
-rw-r--r--shell/evolution-folder-selector-button.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/shell/evolution-folder-selector-button.c b/shell/evolution-folder-selector-button.c
index 0a01874c06..f3b9ab6179 100644
--- a/shell/evolution-folder-selector-button.c
+++ b/shell/evolution-folder-selector-button.c
@@ -142,15 +142,26 @@ clicked (GtkButton *button)
EvolutionFolderSelectorButton *folder_selector_button;
EvolutionFolderSelectorButtonPrivate *priv;
GNOME_Evolution_Folder *return_folder;
+ GtkWidget *toplevel_container;
GtkWindow *parent_window;
char *initial_uri;
- parent_window = (GtkWindow *)
- gtk_widget_get_ancestor (GTK_WIDGET (button),
- GTK_TYPE_WINDOW);
+ /* We want to disable the window the button is in, since the
+ * folder selection dialog may be in another process and the WM
+ * won't enforce modality cross-process. In Evo 1.2, this code
+ * called gtk_widget_set_sensitive on the button's parent
+ * window, but in GNOME 2 that seems to cause bad things to
+ * happen (the window doesn't resensitize properly at the end).
+ * So we desensitize the top-level container inside the window
+ * instead.
+ */
+ toplevel_container = GTK_WIDGET (button);
+ while (toplevel_container->parent &&
+ !GTK_IS_WINDOW (toplevel_container->parent))
+ toplevel_container = toplevel_container->parent;
+ parent_window = (GtkWindow *)toplevel_container->parent;
- gtk_widget_set_sensitive (GTK_WIDGET (parent_window), FALSE);
- g_object_ref (parent_window);
+ gtk_widget_set_sensitive (GTK_WIDGET (toplevel_container), FALSE);
folder_selector_button = EVOLUTION_FOLDER_SELECTOR_BUTTON (button);
priv = folder_selector_button->priv;
@@ -162,7 +173,7 @@ clicked (GtkButton *button)
g_signal_emit (folder_selector_button, signals[POPPED_UP], 0);
- g_object_add_weak_pointer (G_OBJECT (parent_window), (void **) &parent_window);
+ g_object_add_weak_pointer (G_OBJECT (button), (void **) &button);
evolution_shell_client_user_select_folder (priv->shell_client,
parent_window,
@@ -171,18 +182,12 @@ clicked (GtkButton *button)
(const char **)priv->possible_types,
&return_folder);
- g_object_remove_weak_pointer (G_OBJECT (parent_window), (void **) &parent_window);
-
- /* If the parent gets destroyed despite our best efforts (eg,
- * because its own parent got destroyed), then the folder
- * selector button will have been destroyed too and we need
- * to just bail out here.
- */
- if (parent_window == NULL)
+ /* Bail out if the parent window was destroyed */
+ if (button == NULL)
return;
+ g_object_remove_weak_pointer (G_OBJECT (button), (void **) &button);
- gtk_widget_set_sensitive (GTK_WIDGET (parent_window), TRUE);
- g_object_unref (parent_window);
+ gtk_widget_set_sensitive (GTK_WIDGET (toplevel_container), TRUE);
if (!return_folder) {
g_signal_emit (folder_selector_button, signals[CANCELED], 0);