[evolution/kill-bonobo] Exit if no command-line URIs are handled.



commit 2b8c7c62aa3d172e3530c0570be29dfaac501432
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Aug 24 23:08:13 2009 -0400

    Exit if no command-line URIs are handled.

 modules/calendar/e-memo-shell-backend.c |   18 ++++++++++--------
 modules/calendar/e-task-shell-backend.c |   18 ++++++++++--------
 modules/mail/e-mail-shell-backend.c     |    2 +-
 shell/e-shell.c                         |    4 +++-
 shell/main.c                            |    7 ++++---
 5 files changed, 28 insertions(+), 21 deletions(-)
---
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 9642528..6c6a364 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -62,7 +62,7 @@ static gpointer parent_class;
 static GType memo_shell_backend_type;
 
 static void
-memo_module_ensure_sources (EShellBackend *shell_backend)
+memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
 {
 	/* XXX This is basically the same algorithm across all modules.
 	 *     Maybe we could somehow integrate this into EShellBackend? */
@@ -361,8 +361,8 @@ static GtkActionEntry source_entries[] = {
 };
 
 static gboolean
-memo_module_handle_uri_cb (EShellBackend *shell_backend,
-                           const gchar *uri)
+memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
+                                  const gchar *uri)
 {
 	EShell *shell;
 	CompEditor *editor;
@@ -500,8 +500,8 @@ exit:
 }
 
 static void
-memo_module_window_created_cb (EShellBackend *shell_backend,
-                               GtkWindow *window)
+memo_shell_backend_window_created_cb (EShellBackend *shell_backend,
+                                      GtkWindow *window)
 {
 	const gchar *module_name;
 
@@ -562,15 +562,17 @@ memo_shell_backend_constructed (GObject *object)
 	shell_backend = E_SHELL_BACKEND (object);
 	shell = e_shell_backend_get_shell (shell_backend);
 
-	memo_module_ensure_sources (shell_backend);
+	memo_shell_backend_ensure_sources (shell_backend);
 
 	g_signal_connect_swapped (
 		shell, "handle-uri",
-		G_CALLBACK (memo_module_handle_uri_cb), shell_backend);
+		G_CALLBACK (memo_shell_backend_handle_uri_cb),
+		shell_backend);
 
 	g_signal_connect_swapped (
 		shell, "window-created",
-		G_CALLBACK (memo_module_window_created_cb), shell_backend);
+		G_CALLBACK (memo_shell_backend_window_created_cb),
+		shell_backend);
 }
 
 static void
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 500dd30..59a87e6 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -64,7 +64,7 @@ static gpointer parent_class;
 static GType task_shell_backend_type;
 
 static void
-task_module_ensure_sources (EShellBackend *shell_backend)
+task_shell_backend_ensure_sources (EShellBackend *shell_backend)
 {
 	/* XXX This is basically the same algorithm across all modules.
 	 *     Maybe we could somehow integrate this into EShellBackend? */
@@ -363,8 +363,8 @@ static GtkActionEntry source_entries[] = {
 };
 
 static gboolean
-task_module_handle_uri_cb (EShellBackend *shell_backend,
-                           const gchar *uri)
+task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
+                                  const gchar *uri)
 {
 	EShell *shell;
 	CompEditor *editor;
@@ -508,8 +508,8 @@ exit:
 }
 
 static void
-task_module_window_created_cb (EShellBackend *shell_backend,
-                               GtkWindow *window)
+task_shell_backend_window_created_cb (EShellBackend *shell_backend,
+                                      GtkWindow *window)
 {
 	const gchar *module_name;
 
@@ -570,15 +570,17 @@ task_shell_backend_constructed (GObject *object)
 	shell_backend = E_SHELL_BACKEND (object);
 	shell = e_shell_backend_get_shell (shell_backend);
 
-	task_module_ensure_sources (shell_backend);
+	task_shell_backend_ensure_sources (shell_backend);
 
 	g_signal_connect_swapped (
 		shell, "handle-uri",
-		G_CALLBACK (task_module_handle_uri_cb), shell_backend);
+		G_CALLBACK (task_shell_backend_handle_uri_cb),
+		shell_backend);
 
 	g_signal_connect_swapped (
 		shell, "window-created",
-		G_CALLBACK (task_module_window_created_cb), shell_backend);
+		G_CALLBACK (task_shell_backend_window_created_cb),
+		shell_backend);
 }
 
 static void
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 80922ce..2d6e1a9 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -395,7 +395,7 @@ mail_shell_backend_handle_uri_cb (EShell *shell,
 	} else
 		handled = FALSE;
 
-	return TRUE;
+	return handled;
 }
 
 /* Helper for mail_shell_backend_prepare_for_[off|on]line_cb() */
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 8e05980..4dd72e3 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1294,7 +1294,9 @@ unique:  /* Send a message to the other Evolution process. */
 	unique_app_send_message (app, UNIQUE_OPEN, data);
 	unique_message_data_free (data);
 
-	return 0;
+	/* As far as we're concerned, all URIs have been handled. */
+
+	return g_strv_length (uris);
 }
 
 /**
diff --git a/shell/main.c b/shell/main.c
index 43edb73..5adae2e 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -247,9 +247,10 @@ idle_cb (gchar **uris)
 
 	/* These calls do the right thing when another Evolution
 	 * process is running. */
-	if (uris != NULL && *uris != NULL)
-		e_shell_handle_uris (shell, uris);
-	else
+	if (uris != NULL && *uris != NULL) {
+		if (e_shell_handle_uris (shell, uris) == 0)
+			gtk_main_quit ();
+	} else
 		e_shell_create_shell_window (shell, requested_view);
 
 	/* If another Evolution process is running, we're done. */



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