From 8c0bd86d5fdd6d87c3170e2a01423e7c7018a981 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 14 Nov 2008 03:56:01 +0000 Subject: Rearranged some of the addressbook code to try and eliminate some circular dependencies in our libraries. The circular dependency between the composer and the mail module is still causing me headaches. And it doesn't help that the addressbook and calendar also want to link to the composer. svn path=/branches/kill-bonobo/; revision=36782 --- shell/e-shell-window-actions.c | 1 - shell/e-shell.c | 18 ++++++++++++------ shell/e-shell.h | 5 +++-- shell/main.c | 24 +++++++++++++++--------- 4 files changed, 30 insertions(+), 18 deletions(-) (limited to 'shell') diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 348daae89e..38f33d99e9 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -1781,7 +1781,6 @@ shell_window_extract_actions (EShellWindow *shell_window, { const gchar *current_view; GList *match_list = NULL; - GList *primary = NULL; GList *iter; /* Pick out the actions from the source list that are tagged diff --git a/shell/e-shell.c b/shell/e-shell.c index c875dcb5cf..d6884b0a69 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -62,6 +62,7 @@ enum { LAST_SIGNAL }; +EShell *default_shell = NULL; static gpointer parent_class; static guint signals[LAST_SIGNAL]; @@ -362,8 +363,9 @@ shell_class_init (EShellClass *class) G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED | G_SIGNAL_ACTION, 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); signals[HANDLE_URI] = g_signal_new ( "handle-uri", @@ -451,9 +453,12 @@ e_shell_get_type (void) } EShell * -e_shell_new (gboolean online_mode) +e_shell_get_default (void) { - return g_object_new (E_TYPE_SHELL, "online-mode", online_mode, NULL); + /* Emit a warning if we call this too early. */ + g_return_val_if_fail (default_shell != NULL, NULL); + + return default_shell; } GList * @@ -626,7 +631,8 @@ e_shell_get_preferences_window (void) void e_shell_event (EShell *shell, - const gchar *event_name) + const gchar *event_name, + gpointer event_data) { GQuark detail; @@ -634,7 +640,7 @@ e_shell_event (EShell *shell, g_return_if_fail (event_name != NULL); detail = g_quark_from_string (event_name); - g_signal_emit (shell, signals[EVENT], detail); + g_signal_emit (shell, signals[EVENT], detail, event_data); } gboolean diff --git a/shell/e-shell.h b/shell/e-shell.h index 7bee6b9fff..2c942097c5 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -81,7 +81,7 @@ enum _EShellLineStatus { }; GType e_shell_get_type (void); -EShell * e_shell_new (gboolean online); +EShell * e_shell_get_default (void); GList * e_shell_list_modules (EShell *shell); const gchar * e_shell_get_canonical_name (EShell *shell, const gchar *name); @@ -104,7 +104,8 @@ void e_shell_set_line_status (EShell *shell, EShellLineStatus status); GtkWidget * e_shell_get_preferences_window (void); void e_shell_event (EShell *shell, - const gchar *event_name); + const gchar *event_name, + gpointer event_data); gboolean e_shell_is_busy (EShell *shell); gboolean e_shell_do_quit (EShell *shell); gboolean e_shell_quit (EShell *shell); diff --git a/shell/main.c b/shell/main.c index 5d9405fcfe..47400798ab 100644 --- a/shell/main.c +++ b/shell/main.c @@ -96,11 +96,13 @@ static gboolean disable_eplugin = FALSE; static gboolean disable_preview = FALSE; static gboolean idle_cb (gchar **uris); -static EShell *global_shell; static char *requested_view = NULL; static char *evolution_debug_log = NULL; static gchar **remaining_args; +/* Defined in */ +extern EShell *default_shell; + #ifdef KILL_PROCESS_CMD static void @@ -265,12 +267,15 @@ destroy_config (GConfClient *client) static void open_uris (gchar **uris) { + EShell *shell; guint ii; g_return_if_fail (uris != NULL); + shell = e_shell_get_default (); + for (ii = 0; uris[ii] != NULL; ii++) - if (!e_shell_handle_uri (global_shell, uris[ii])) + if (!e_shell_handle_uri (shell, uris[ii])) g_warning ("Invalid URI: %s", uris[ii]); } @@ -279,6 +284,7 @@ open_uris (gchar **uris) static gboolean idle_cb (gchar **uris) { + EShell *shell; GtkWidget *shell_window; const gchar *initial_view; @@ -293,8 +299,8 @@ idle_cb (gchar **uris) return FALSE; } - initial_view = e_shell_get_canonical_name ( - global_shell, requested_view); + shell = e_shell_get_default (); + initial_view = e_shell_get_canonical_name (shell, requested_view); if (initial_view != NULL) { GConfClient *client; @@ -306,7 +312,7 @@ idle_cb (gchar **uris) g_object_unref (client); } - shell_window = e_shell_create_window (global_shell); + shell_window = e_shell_create_window (shell); #if 0 /* MBARNES */ if (shell == NULL) { @@ -481,7 +487,7 @@ master_client_die_cb (GnomeClient *client, } static void -create_shell (void) +create_default_shell (void) { EShell *shell; GConfClient *conf_client; @@ -510,7 +516,7 @@ create_shell (void) } } - shell = e_shell_new (online_mode); + shell = g_object_new (E_TYPE_SHELL, "online-mode", online_mode, NULL); g_signal_connect ( shell, "window-destroyed", @@ -526,7 +532,7 @@ create_shell (void) g_object_unref (conf_client); - global_shell = shell; + default_shell = shell; } int @@ -662,7 +668,7 @@ main (int argc, char **argv) g_object_unref (client); - create_shell (); + create_default_shell (); gtk_main (); -- cgit v1.2.3