From 0a0fe0a2f5d1c32e15717c80c7a09763d86fde23 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 23 May 2011 21:59:58 -0400 Subject: 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. --- shell/e-shell.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'shell/e-shell.c') 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); } -- cgit v1.2.3