aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-19 03:58:22 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-19 03:58:22 +0800
commitcb0ed210287eb3f4b81376a0cbe72661af0f7756 (patch)
tree8395f720e891b6aba6669a4f23e5aa4c8511eeb6
parent02f36a07f6fb2f6fe341d9f8817628c629871635 (diff)
downloadgsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.tar
gsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.tar.gz
gsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.tar.bz2
gsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.tar.lz
gsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.tar.xz
gsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.tar.zst
gsoc2013-evolution-cb0ed210287eb3f4b81376a0cbe72661af0f7756.zip
Fix the WM problems related to the folder selection dialog being
out-of-proc. Now it can be set to be a transient window correctly, and fakes its WindowGroup hint appropriately. svn path=/trunk/; revision=13765
-rw-r--r--e-util/ChangeLog4
-rw-r--r--e-util/e-dialog-utils.c18
-rw-r--r--e-util/e-dialog-utils.h8
-rw-r--r--filter/ChangeLog6
-rw-r--r--filter/filter-folder.c1
-rw-r--r--filter/vfolder-rule.c1
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/mail-account-gui.c4
-rw-r--r--mail/mail-callbacks.c4
-rw-r--r--shell/ChangeLog11
-rw-r--r--shell/Evolution-Shell.idl4
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shell.c47
-rw-r--r--shell/evolution-shell-client.c13
-rw-r--r--shell/evolution-shell-client.h2
15 files changed, 123 insertions, 8 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index fed6610258..6a41fd9f8e 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-17 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-dialog-utils.c (e_set_dialog_parent_from_xid): New.
+
2001-10-12 Chris Toshok <toshok@ximian.com>
* e-passwords.h: new parameter to e_passwords_init, and add
diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c
index 0a6bf13386..68f0abfde8 100644
--- a/e-util/e-dialog-utils.c
+++ b/e-util/e-dialog-utils.c
@@ -147,3 +147,21 @@ e_set_dialog_parent (GtkWindow *dialog,
gdk_window = gdk_window_foreign_new (xid);
set_transient_for_gdk (dialog, gdk_window);
}
+
+/**
+ * e_set_dialog_parent_from_xid:
+ * @dialog:
+ * @xid:
+ *
+ * Like %e_set_dialog_parent_from_xid, but use an XID to specify the parent
+ * window.
+ **/
+void
+e_set_dialog_parent_from_xid (GtkWindow *dialog,
+ Window xid)
+{
+ g_return_if_fail (dialog != NULL);
+ g_return_if_fail (GTK_IS_WINDOW (dialog));
+
+ set_transient_for_gdk (dialog, gdk_window_foreign_new (xid));
+}
diff --git a/e-util/e-dialog-utils.h b/e-util/e-dialog-utils.h
index 578ea0d585..b92808d386 100644
--- a/e-util/e-dialog-utils.h
+++ b/e-util/e-dialog-utils.h
@@ -27,7 +27,11 @@
#include <gtk/gtkwindow.h>
#include <gtk/gtkwidget.h>
-void e_set_dialog_parent (GtkWindow *dialog,
- GtkWidget *parent_widget);
+#include <X11/Xlib.h> /* Window */
+
+void e_set_dialog_parent (GtkWindow *dialog,
+ GtkWidget *parent_widget);
+void e_set_dialog_parent_from_xid (GtkWindow *dialog,
+ Window xid);
#endif
diff --git a/filter/ChangeLog b/filter/ChangeLog
index faf77c3f95..63685b71cb 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-17 Ettore Perazzoli <ettore@ximian.com>
+
+ * filter-folder.c (button_clicked): Pass the toplevel to
+ `evolution_shell_client_user_select_folder()'.
+ * vfolder-rule.c (source_add): Likewise.
+
2001-10-15 Jeffrey Stedfast <fejj@ximian.com>
* filter-folder.c (button_clicked): Kludge to raise the filter
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
index 1d231e7bdf..2bcf6e58cd 100644
--- a/filter/filter-folder.c
+++ b/filter/filter-folder.c
@@ -229,6 +229,7 @@ button_clicked (GtkButton *button, FilterFolder *ff)
def = ff->uri ? ff->uri : "";
evolution_shell_client_user_select_folder (global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
_("Select Folder"),
def, allowed_types,
&evolution_uri,
diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c
index b3b1f3f082..5108f83809 100644
--- a/filter/vfolder-rule.c
+++ b/filter/vfolder-rule.c
@@ -353,6 +353,7 @@ source_add(GtkWidget *widget, struct _source_data *data)
def = "";
evolution_shell_client_user_select_folder (global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (widget)),
_("Select Folder"),
def, allowed_types, NULL, &uri);
diff --git a/mail/ChangeLog b/mail/ChangeLog
index abbeb326df..53accab1ae 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-17 Ettore Perazzoli <ettore@ximian.com>
+
+ * mail-account-gui.c (folder_picker_clicked): Pass the toplevel to
+ `evolution_shell_client_user_select_folder()'.
+ * mail-callbacks.c (transfer_msg): Likewise.
+
2001-10-18 <NotZed@Ximian.com>
* mail-send-recv.c (build_dialogue): call setup_send_data *after*
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 30a7ec1ea5..78339bad69 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -819,7 +819,9 @@ folder_picker_clicked (GtkButton *button, gpointer user_data)
physical_uri = evolution_uri = NULL;
evolution_shell_client_user_select_folder (
- global_shell_client, _("Select Folder"), folder->uri,
+ global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
+ _("Select Folder"), folder->uri,
allowed_types, &evolution_uri, &physical_uri);
if (!physical_uri || !*physical_uri) {
g_free (physical_uri);
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 2a4c9d227c..ff14c1b16a 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1242,7 +1242,9 @@ transfer_msg (GtkWidget *widget, gpointer user_data, gboolean delete_from_source
else
desc = _("Copy message(s) to");
- evolution_shell_client_user_select_folder (global_shell_client, desc, last,
+ evolution_shell_client_user_select_folder (global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (widget)),
+ desc, last,
allowed_types, &uri, &physical);
if (!uri)
return;
diff --git a/shell/ChangeLog b/shell/ChangeLog
index ab0dc96a8c..af878b1b36 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,16 @@
2001-10-17 Ettore Perazzoli <ettore@ximian.com>
+ * e-shell.c (impl_Shell_selectUserFolder): Set the parent
+ according to the XID we get.
+
+ * Evolution-Shell.idl: New arg @parent_xid in `::selectUserFolder'.
+
+ * evolution-shell-client.c
+ (evolution_shell_client_user_select_folder): New arg @parent.
+ (user_select_folder): Likewise. Pass it to the CORBA method.
+
+2001-10-17 Ettore Perazzoli <ettore@ximian.com>
+
* main.c (idle_cb): Urgh. Remove stale line that caused
`display_default' to be set to TRUE for all the non-NULL shell
cases.
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
index a7700c38d2..aa8ef84296 100644
--- a/shell/Evolution-Shell.idl
+++ b/shell/Evolution-Shell.idl
@@ -64,6 +64,7 @@ module Evolution {
/**
* selectUserFolder:
+ * @parent_xid: XID for the parent window (or zero if no parent window).
* @listener: a listener interface to report the answer of the user.
* @title: title for the folder selector dialog
* @default_folder: physical or `evolution:' URI for the folder that must be
@@ -75,7 +76,8 @@ module Evolution {
* folder by using the "New..." button. The dialog only lets the user choose
* a folder whose type is listed in @possible_types.
*/
- void selectUserFolder (in FolderSelectionListener listener,
+ void selectUserFolder (in long long parent_xid,
+ in FolderSelectionListener listener,
in string title,
in string default_folder,
in FolderTypeNameList possible_types,
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 8829330db2..2a060e9067 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -117,6 +117,8 @@ evolution_SOURCES = \
e-local-storage.h \
e-setup.c \
e-setup.h \
+ e-shell-about-box.c \
+ e-shell-about-box.h \
e-shell-constants.h \
e-shell-folder-commands.c \
e-shell-folder-commands.h \
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 6e97a6ff01..510fbe14a3 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -26,8 +26,13 @@
#endif
#include <glib.h>
+
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
+#include <gdk/gdkx.h>
+
+#include <X11/Xatom.h>
+
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
@@ -44,6 +49,8 @@
#include "Evolution.h"
+#include "e-util/e-dialog-utils.h"
+
#include "e-activity-handler.h"
#include "e-component-registry.h"
#include "e-corba-shortcuts.h"
@@ -372,6 +379,7 @@ corba_listener_destroy_notify (void *data)
static void
impl_Shell_selectUserFolder (PortableServer_Servant servant,
+ const CORBA_long_long parent_xid,
const GNOME_Evolution_FolderSelectionListener listener,
const CORBA_char *title,
const CORBA_char *default_folder,
@@ -407,6 +415,7 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant,
allowed_type_names,
default_type);
+
listener_duplicate = CORBA_Object_duplicate (listener, ev);
gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener",
listener_duplicate, corba_listener_destroy_notify);
@@ -416,7 +425,43 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant,
gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled",
GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_cb), shell);
- gtk_widget_show (folder_selection_dialog);
+ if (parent_xid == 0) {
+ gtk_widget_show (folder_selection_dialog);
+ } else {
+ XClassHint class_hints;
+ XWMHints *parent_wm_hints;
+ int format;
+
+ /* Set the WM class and the WindowGroup hint to be the same as
+ the foreign parent window's. This way smartass window
+ managers like Sawfish don't get confused. */
+
+ e_set_dialog_parent_from_xid (GTK_WINDOW (folder_selection_dialog), parent_xid);
+
+ XGetClassHint (GDK_DISPLAY (), (Window) parent_xid, &class_hints);
+
+ gtk_window_set_wmclass (GTK_WINDOW (folder_selection_dialog),
+ class_hints.res_name, class_hints.res_class);
+
+ gtk_widget_show (folder_selection_dialog);
+
+ while (folder_selection_dialog->window == NULL)
+ gtk_main_iteration ();
+
+ parent_wm_hints = XGetWMHints (GDK_DISPLAY (), (Window) parent_xid);
+
+ if (parent_wm_hints->flags & WindowGroupHint) {
+ XWMHints *wm_hints;
+
+ wm_hints = XAllocWMHints ();
+ wm_hints->flags = WindowGroupHint;
+ wm_hints->window_group = parent_wm_hints->window_group;
+ XSetWMHints (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (folder_selection_dialog->window), wm_hints);
+ XFree (wm_hints);
+ }
+
+ XFree (parent_wm_hints);
+ }
}
static GNOME_Evolution_Storage
diff --git a/shell/evolution-shell-client.c b/shell/evolution-shell-client.c
index d71deff91f..3667d4bb4c 100644
--- a/shell/evolution-shell-client.c
+++ b/shell/evolution-shell-client.c
@@ -25,7 +25,9 @@
#include <config.h>
#endif
+#include <gdk/gdkx.h>
#include <gtk/gtkmain.h>
+
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
@@ -196,6 +198,7 @@ count_string_items (const char *list[])
static void
user_select_folder (EvolutionShellClient *shell_client,
+ GtkWindow *parent,
const char *title,
const char *default_folder,
const char *possible_types[],
@@ -206,6 +209,7 @@ user_select_folder (EvolutionShellClient *shell_client,
GNOME_Evolution_Shell corba_shell;
CORBA_Environment ev;
GNOME_Evolution_Shell_FolderTypeNameList corba_type_name_list;
+ CORBA_long_long parent_xid;
int num_possible_types;
char *result;
@@ -231,7 +235,9 @@ user_select_folder (EvolutionShellClient *shell_client,
corba_type_name_list._maximum = num_possible_types;
corba_type_name_list._buffer = (CORBA_char **) possible_types;
- GNOME_Evolution_Shell_selectUserFolder (corba_shell, listener_interface,
+ parent_xid = (CORBA_long_long) GDK_WINDOW_XWINDOW (GTK_WIDGET (parent)->window);
+
+ GNOME_Evolution_Shell_selectUserFolder (corba_shell, parent_xid, listener_interface,
title, default_folder, &corba_type_name_list,
"", &ev);
@@ -368,6 +374,7 @@ evolution_shell_client_new (GNOME_Evolution_Shell corba_shell)
/**
* evolution_shell_client_user_select_folder:
* @shell_client: A EvolutionShellClient object
+ * @parent: Parent window for the dialog (must be realized when invoking)
* @title: The title for the folder selection dialog
* @default_folder: URI (physical or evolution:) of the folder initially selected on the dialog
* @uri_return:
@@ -380,6 +387,7 @@ evolution_shell_client_new (GNOME_Evolution_Shell corba_shell)
**/
void
evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client,
+ GtkWindow *parent,
const char *title,
const char *default_folder,
const char *possible_types[],
@@ -390,8 +398,9 @@ evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client,
g_return_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client));
g_return_if_fail (title != NULL);
g_return_if_fail (default_folder != NULL);
+ g_return_if_fail (parent == NULL || GTK_WIDGET_REALIZED (parent));
- user_select_folder (shell_client, title, default_folder, possible_types,
+ user_select_folder (shell_client, parent, title, default_folder, possible_types,
uri_return, physical_uri_return);
}
diff --git a/shell/evolution-shell-client.h b/shell/evolution-shell-client.h
index f4fd194f58..e6a86af843 100644
--- a/shell/evolution-shell-client.h
+++ b/shell/evolution-shell-client.h
@@ -25,6 +25,7 @@
#define __EVOLUTION_SHELL_CLIENT_H__
#include <bonobo/bonobo-object-client.h>
+#include <gtk/gtkwindow.h>
#include "Evolution.h"
@@ -61,6 +62,7 @@ void evolution_shell_client_construct (EvolutionShe
EvolutionShellClient *evolution_shell_client_new (GNOME_Evolution_Shell shell);
void evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client,
+ GtkWindow *parent,
const char *title,
const char *default_folder,
const char *possible_types[],