aboutsummaryrefslogtreecommitdiffstats
path: root/shell
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 /shell
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
Diffstat (limited to 'shell')
-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
6 files changed, 75 insertions, 4 deletions
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[],