[evolution] Bug 649993 - Change behavior of --component option



commit 0a0fe0a2f5d1c32e15717c80c7a09763d86fde23
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon May 23 21:59:58 2011 -0400

    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 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/shell/e-shell.c b/shell/e-shell.c
index eb3cb8e..60f145e 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);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]