aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-24 09:59:58 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-24 09:59:58 +0800
commit0a0fe0a2f5d1c32e15717c80c7a09763d86fde23 (patch)
tree13f05f47654a93bc8289a44f15bca9e72be55878
parent9692758dc5c3a03597f0eb0b16edd10134153823 (diff)
downloadgsoc2013-evolution-0a0fe0a2f5d1c32e15717c80c7a09763d86fde23.tar.gz
gsoc2013-evolution-0a0fe0a2f5d1c32e15717c80c7a09763d86fde23.tar.zst
gsoc2013-evolution-0a0fe0a2f5d1c32e15717c80c7a09763d86fde23.zip
Bug 649993 - Change behavior of --component option
This is primarily for the GNOME Shell calendar. If, for example, "evolution --component calendar" is invoked and there is already an Evolution window opened to the calendar view, present that window. Otherwise open a new Evolution window to the requested view. Same behavior applies to all requested views.
-rw-r--r--shell/e-shell.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c
index eb3cb8e407..60f145e7d0 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -229,9 +229,31 @@ shell_action_new_window_cb (GSimpleAction *action,
GVariant *parameter,
EShell *shell)
{
+ GList *watched_windows;
const gchar *view_name;
view_name = g_variant_get_string (parameter, NULL);
+ watched_windows = e_shell_get_watched_windows (shell);
+
+ /* Present the first EShellWindow showing 'view_name'. */
+ while (watched_windows != NULL) {
+ GtkWindow *window = GTK_WINDOW (watched_windows->data);
+
+ if (E_IS_SHELL_WINDOW (window)) {
+ const gchar *active_view;
+
+ active_view = e_shell_window_get_active_view (
+ E_SHELL_WINDOW (window));
+ if (g_strcmp0 (active_view, view_name) == 0) {
+ gtk_window_present (window);
+ return;
+ }
+ }
+
+ watched_windows = g_list_next (watched_windows);
+ }
+
+ /* No suitable EShellWindow found, so create one. */
e_shell_create_shell_window (shell, view_name);
}