From e39dd931bcff0dfd6964a75c5b23c8e89f75d297 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 25 Nov 2010 18:10:14 +0100 Subject: Bug #207580 - Allow new mail check on individual accounts --- shell/e-shell.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index b983b18403..7ffe91b40d 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -96,7 +96,6 @@ enum { PREPARE_FOR_ONLINE, PREPARE_FOR_QUIT, QUIT_REQUESTED, - SEND_RECEIVE, WINDOW_CREATED, WINDOW_DESTROYED, LAST_SIGNAL @@ -1108,24 +1107,6 @@ e_shell_class_init (EShellClass *class) G_TYPE_NONE, 1, E_TYPE_SHELL_QUIT_REASON); - /** - * EShell::send-receive - * @shell: the #EShell which emitted the signal - * @parent: a parent #GtkWindow - * - * Emitted when the user chooses the "Send / Receive" action. - * The parent window can be used for showing transient windows. - **/ - signals[SEND_RECEIVE] = g_signal_new ( - "send-receive", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (EShellClass, send_receive), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_WINDOW); - /** * EShell::window-created * @shell: the #EShell which emitted the signal @@ -1688,23 +1669,6 @@ e_shell_get_active_window (EShell *shell) return GTK_WINDOW (watched_windows->data); } -/** - * e_shell_send_receive: - * @shell: an #EShell - * @parent: the parent #GtkWindow - * - * Emits the #EShell::send-receive signal. - **/ -void -e_shell_send_receive (EShell *shell, - GtkWindow *parent) -{ - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (GTK_IS_WINDOW (parent)); - - g_signal_emit (shell, signals[SEND_RECEIVE], 0, parent); -} - /** * e_shell_get_express_mode: * @shell: an #EShell -- cgit v1.2.3 From 22b2d26d048476d4909bfcf348ce6567e0d006a0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 6 Dec 2010 14:23:20 +0100 Subject: Free/busy meeting view doesn't work due to non-working extension --- shell/e-shell.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 7ffe91b40d..b52d77186b 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -690,6 +690,9 @@ shell_constructed (GObject *object) if (!unique_app_is_running (UNIQUE_APP (object))) e_file_lock_create (); + + if (G_OBJECT_CLASS (e_shell_parent_class)->constructed) + G_OBJECT_CLASS (e_shell_parent_class)->constructed (object); } static UniqueResponse -- cgit v1.2.3 From 59928e69ed7b769585282ae2b11bca1a9e9a1ca9 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 19 Dec 2010 13:30:45 -0500 Subject: Add e_shell_submit_alert(). An easy way to broadcast application-wide alerts to shell windows. These alerts will persist in all current and future shell windows until responded to (either programmatically or by the user). --- shell/e-shell.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index b52d77186b..b1891ce3b8 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -47,6 +47,7 @@ ((obj), E_TYPE_SHELL, EShellPrivate)) struct _EShellPrivate { + GQueue alerts; GList *watched_windows; EShellSettings *settings; GConfClient *gconf_client; @@ -132,6 +133,19 @@ shell_parse_debug_string (EShell *shell) e_shell_settings_enable_debug (shell->priv->settings); } +static void +shell_alert_response_cb (EShell *shell, + gint response_id, + EAlert *alert) +{ + g_signal_handlers_disconnect_by_func ( + alert, shell_alert_response_cb, shell); + + g_queue_remove (&shell->priv->alerts, alert); + + g_object_unref (alert); +} + static void shell_notify_online_cb (EShell *shell) { @@ -623,9 +637,16 @@ static void shell_dispose (GObject *object) { EShellPrivate *priv; + EAlert *alert; priv = E_SHELL_GET_PRIVATE (object); + while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) { + g_signal_handlers_disconnect_by_func ( + alert, shell_alert_response_cb, object); + g_object_unref (alert); + } + if (priv->startup_view != NULL) { g_free (priv->startup_view); priv->startup_view = NULL; @@ -1156,6 +1177,8 @@ e_shell_init (EShell *shell) backends_by_name = g_hash_table_new (g_str_hash, g_str_equal); backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal); + g_queue_init (&shell->priv->alerts); + shell->priv->settings = g_object_new (E_TYPE_SHELL_SETTINGS, NULL); shell->priv->gconf_client = gconf_client_get_default (); shell->priv->preferences_window = e_preferences_window_new (shell); @@ -1432,6 +1455,7 @@ e_shell_create_shell_window (EShell *shell, GtkWidget *shell_window; UniqueMessageData *data; UniqueApp *app; + GList *link; g_return_val_if_fail (E_IS_SHELL (shell), NULL); @@ -1464,6 +1488,15 @@ e_shell_create_shell_window (EShell *shell, shell->priv->safe_mode, shell->priv->geometry); + /* Submit any outstanding alerts. */ + link = g_queue_peek_head_link (&shell->priv->alerts); + while (link != NULL) { + e_alert_sink_submit_alert ( + E_ALERT_SINK (shell_window), + E_ALERT (link->data)); + link = g_list_next (link); + } + /* Clear the first-time-only options. */ shell->priv->safe_mode = FALSE; g_free (shell->priv->geometry); @@ -1564,6 +1597,39 @@ unique: /* Send a message to the other Evolution process. */ return g_strv_length (uris); } +/** + * e_shell_submit_alert: + * @shell: an #EShell + * @alert: an #EAlert + * + * Broadcasts @alert to all #EShellWindows. This should only + * be used for application-wide alerts such as a network outage. Submit + * view-specific alerts to the appropriate #EShellContent instance. + **/ +void +e_shell_submit_alert (EShell *shell, + EAlert *alert) +{ + GList *list, *iter; + + g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (E_IS_ALERT (alert)); + + g_queue_push_tail (&shell->priv->alerts, g_object_ref (alert)); + + g_signal_connect_swapped ( + alert, "response", + G_CALLBACK (shell_alert_response_cb), shell); + + list = e_shell_get_watched_windows (shell); + + /* Submit the alert to all available EShellWindows. */ + for (iter = list; iter != NULL; iter = g_list_next (iter)) + if (E_IS_SHELL_WINDOW (iter->data)) + e_alert_sink_submit_alert ( + E_ALERT_SINK (iter->data), alert); +} + /** * e_shell_watch_window: * @shell: an #EShell -- cgit v1.2.3 From 28c3b67bb1f007c5ad06a9695d2d750531d2139d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 11 Jan 2011 10:33:03 +0100 Subject: Bug #638808 - camel_shutdown() called too early --- shell/e-shell.c | 1 + 1 file changed, 1 insertion(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index b1891ce3b8..123a9751e7 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -691,6 +691,7 @@ shell_finalize (GObject *object) if (!unique_app_is_running (UNIQUE_APP (object))) e_file_lock_destroy (); + g_list_foreach (priv->loaded_backends, (GFunc) g_object_unref, NULL); g_list_free (priv->loaded_backends); g_free (priv->geometry); -- cgit v1.2.3 From 7a1677520d439aee68c5ab0268a951d0b411e3a0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 12 Feb 2011 11:37:05 -0500 Subject: Remove NULL checks for GObject methods. As of GLib 2.28 all GObject virtual methods, including constructed(), are safe to chain up to unconditionally. Remove unnecessary checks. --- shell/e-shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 123a9751e7..82ccf6df9e 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -713,8 +713,8 @@ shell_constructed (GObject *object) if (!unique_app_is_running (UNIQUE_APP (object))) e_file_lock_create (); - if (G_OBJECT_CLASS (e_shell_parent_class)->constructed) - G_OBJECT_CLASS (e_shell_parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (e_shell_parent_class)->constructed (object); } static UniqueResponse -- cgit v1.2.3 From 1afbba4a8b49c9911337f42d040608a8e35e6577 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 12 Feb 2011 13:40:33 -0500 Subject: Bug 642171 - Implicit libgnome dependency for lockdown GConf keys Lockdown keys have moved to gsettings-desktop-schemas, so disable lockdown integration until we're ready for GSettings. --- shell/e-shell.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 82ccf6df9e..6e37e7e533 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1213,6 +1213,9 @@ e_shell_init (EShell *shell) "start-offline", "/apps/evolution/shell/start_offline"); +#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas, + * so disable lockdown integration until we're ready for + * GSettings. */ #ifndef G_OS_WIN32 e_shell_settings_install_property_for_key ( "disable-application-handlers", @@ -1234,6 +1237,7 @@ e_shell_init (EShell *shell) "disable-save-to-disk", "/desktop/gnome/lockdown/disable_save_to_disk"); #endif /* G_OS_WIN32 */ +#endif /*** Session Management ***/ -- cgit v1.2.3 From 1301cf02efdacd20fb5ce3e2554ae15b8f146e8a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 25 Feb 2011 16:20:41 +0100 Subject: Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly --- shell/e-shell.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 6e37e7e533..79ca26cb1c 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -42,10 +42,6 @@ #include "e-shell-window.h" #include "e-shell-utils.h" -#define E_SHELL_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_SHELL, EShellPrivate)) - struct _EShellPrivate { GQueue alerts; GList *watched_windows; @@ -639,7 +635,7 @@ shell_dispose (GObject *object) EShellPrivate *priv; EAlert *alert; - priv = E_SHELL_GET_PRIVATE (object); + priv = E_SHELL (object)->priv; while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) { g_signal_handlers_disconnect_by_func ( @@ -682,7 +678,7 @@ shell_finalize (GObject *object) { EShellPrivate *priv; - priv = E_SHELL_GET_PRIVATE (object); + priv = E_SHELL (object)->priv; g_hash_table_destroy (priv->backends_by_name); g_hash_table_destroy (priv->backends_by_scheme); @@ -1173,7 +1169,7 @@ e_shell_init (EShell *shell) GtkIconTheme *icon_theme; EggSMClient *sm_client; - shell->priv = E_SHELL_GET_PRIVATE (shell); + shell->priv = G_TYPE_INSTANCE_GET_PRIVATE (shell, E_TYPE_SHELL, EShellPrivate); backends_by_name = g_hash_table_new (g_str_hash, g_str_equal); backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal); -- cgit v1.2.3 From c6fd77460f5baf88528f5da2ffb99e86a2885ff0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 5 Mar 2011 12:33:49 -0500 Subject: Coding style and whitespace cleanup. --- shell/e-shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 79ca26cb1c..f3402dd101 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1169,7 +1169,8 @@ e_shell_init (EShell *shell) GtkIconTheme *icon_theme; EggSMClient *sm_client; - shell->priv = G_TYPE_INSTANCE_GET_PRIVATE (shell, E_TYPE_SHELL, EShellPrivate); + shell->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + shell, E_TYPE_SHELL, EShellPrivate); backends_by_name = g_hash_table_new (g_str_hash, g_str_equal); backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal); -- cgit v1.2.3 From 5399f35bbce8f4e5775fa96b795c527002c48969 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 30 Jan 2011 23:11:14 -0500 Subject: Port EShell to GtkApplication. --- shell/e-shell.c | 306 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 156 insertions(+), 150 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index f3402dd101..d9dcb5de9a 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -47,6 +47,7 @@ struct _EShellPrivate { GList *watched_windows; EShellSettings *settings; GConfClient *gconf_client; + GActionGroup *action_group; GtkWidget *preferences_window; /* Shell Backends */ @@ -109,10 +110,15 @@ static GDebugKey debug_keys[] = { static gpointer default_shell; static guint signals[LAST_SIGNAL]; +/* Forward Declarations */ +static void e_shell_initable_init (GInitableIface *interface); + G_DEFINE_TYPE_WITH_CODE ( EShell, e_shell, - UNIQUE_TYPE_APP, + GTK_TYPE_APPLICATION, + G_IMPLEMENT_INTERFACE ( + G_TYPE_INITABLE, e_shell_initable_init) G_IMPLEMENT_INTERFACE ( E_TYPE_EXTENSIBLE, NULL)) @@ -218,6 +224,57 @@ shell_window_weak_notify_cb (EShell *shell, g_object_ref (shell)); } +static void +shell_action_new_window_cb (GSimpleAction *action, + GVariant *parameter, + EShell *shell) +{ + const gchar *view_name; + + view_name = g_variant_get_string (parameter, NULL); + e_shell_create_shell_window (shell, view_name); +} + +static void +shell_action_quit_cb (GSimpleAction *action, + GVariant *parameter, + EShell *shell) +{ + e_shell_quit (shell, E_SHELL_QUIT_REMOTE_REQUEST); +} + +static void +shell_add_actions (GApplication *application) +{ + EShell *shell; + GSimpleActionGroup *action_group; + GSimpleAction *action; + + /* Add actions that remote instances can invoke. */ + + action_group = g_simple_action_group_new (); + + action = g_simple_action_new ("new-window", G_VARIANT_TYPE_STRING); + g_signal_connect ( + action, "activate", + G_CALLBACK (shell_action_new_window_cb), application); + g_simple_action_group_insert (action_group, G_ACTION (action)); + g_object_unref (action); + + action = g_simple_action_new ("quit", NULL); + g_signal_connect ( + action, "activate", + G_CALLBACK (shell_action_quit_cb), application); + g_simple_action_group_insert (action_group, G_ACTION (action)); + g_object_unref (action); + + shell = E_SHELL (application); + shell->priv->action_group = G_ACTION_GROUP (action_group); + + g_application_set_action_group ( + application, shell->priv->action_group); +} + static void shell_ready_for_offline (EShell *shell, EActivity *activity, @@ -658,6 +715,11 @@ shell_dispose (GObject *object) priv->gconf_client = NULL; } + if (priv->action_group != NULL) { + g_object_unref (priv->action_group); + priv->action_group = NULL; + } + if (priv->preferences_window != NULL) { g_object_unref (priv->preferences_window); priv->preferences_window = NULL; @@ -683,10 +745,6 @@ shell_finalize (GObject *object) g_hash_table_destroy (priv->backends_by_name); g_hash_table_destroy (priv->backends_by_scheme); - /* Indicates a clean shut down to the next session. */ - if (!unique_app_is_running (UNIQUE_APP (object))) - e_file_lock_destroy (); - g_list_foreach (priv->loaded_backends, (GFunc) g_object_unref, NULL); g_list_free (priv->loaded_backends); @@ -706,21 +764,34 @@ shell_constructed (GObject *object) g_object_add_weak_pointer (object, &default_shell); } - if (!unique_app_is_running (UNIQUE_APP (object))) - e_file_lock_create (); - /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_shell_parent_class)->constructed (object); } -static UniqueResponse -shell_message_handle_activate (EShell *shell, - UniqueMessageData *data) +static void +shell_startup (GApplication *application) +{ + e_file_lock_create (); + + /* Destroy the lock file when the EShell is finalized + * to indicate a clean shut down to the next session. */ + g_object_weak_ref ( + G_OBJECT (application), + (GWeakNotify) e_file_lock_destroy, NULL); + + /* Chain up to parent's startup() method. */ + G_APPLICATION_CLASS (e_shell_parent_class)->startup (application); +} + +static void +shell_activate (GApplication *application) { + EShell *shell; GList *watched_windows; - GdkScreen *screen; - screen = unique_message_data_get_screen (data); + /* Do not chain up. Default method just emits a warning. */ + + shell = E_SHELL (application); watched_windows = e_shell_get_watched_windows (shell); /* Present the first EShellWindow, if found. */ @@ -728,9 +799,8 @@ shell_message_handle_activate (EShell *shell, GtkWindow *window = GTK_WINDOW (watched_windows->data); if (E_IS_SHELL_WINDOW (window)) { - gtk_window_set_screen (window, screen); gtk_window_present (window); - return UNIQUE_RESPONSE_OK; + return; } watched_windows = g_list_next (watched_windows); @@ -738,108 +808,55 @@ shell_message_handle_activate (EShell *shell, /* No EShellWindow found, so create one. */ e_shell_create_shell_window (shell, NULL); - - return UNIQUE_RESPONSE_OK; } -static UniqueResponse -shell_message_handle_new (EShell *shell, - UniqueMessageData *data) -{ - gchar *view_name; - - view_name = unique_message_data_get_text (data); - e_shell_create_shell_window (shell, view_name); - g_free (view_name); - - return UNIQUE_RESPONSE_OK; -} - -static UniqueResponse -shell_message_handle_open (EShell *shell, - UniqueMessageData *data) +static void +shell_open (GApplication *application, + GFile **files, + gint n_files, + const gchar *hint) { + EShell *shell; gchar **uris; + gint ii; - uris = unique_message_data_get_uris (data); - if (uris && uris[0] && g_str_equal (uris[0], "--import")) { - gint ii; - GPtrArray *arr = g_ptr_array_new (); + /* Do not chain up. Default method just emits a warning. */ - /* skip the first argument */ - for (ii = 1; uris[ii] != NULL; ii++) { - g_ptr_array_add (arr, uris[ii]); - } + shell = E_SHELL (application); + uris = g_new0 (gchar *, n_files + 1); - g_ptr_array_add (arr, NULL); + for (ii = 0; ii < n_files; ii++) + uris[ii] = g_file_get_uri (files[ii]); - e_shell_handle_uris (shell, (gchar **)arr->pdata, TRUE); + e_shell_handle_uris (shell, uris, FALSE); - g_ptr_array_free (arr, TRUE); - } else { - e_shell_handle_uris (shell, uris, FALSE); - } g_strfreev (uris); - - return UNIQUE_RESPONSE_OK; } -static UniqueResponse -shell_message_handle_close (EShell *shell, - UniqueMessageData *data) +static void +shell_window_destroyed (EShell *shell) { - UniqueResponse response; - - if (e_shell_quit (shell, E_SHELL_QUIT_REMOTE_REQUEST)) - response = UNIQUE_RESPONSE_OK; - else - response = UNIQUE_RESPONSE_CANCEL; - - return response; + if (e_shell_get_watched_windows (shell) == NULL) + gtk_main_quit (); } -static UniqueResponse -shell_message_received (UniqueApp *app, - gint command, - UniqueMessageData *data, - guint time_) +static gboolean +shell_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) { - EShell *shell = E_SHELL (app); - - switch (command) { - case UNIQUE_ACTIVATE: - return shell_message_handle_activate (shell, data); - - case UNIQUE_NEW: - return shell_message_handle_new (shell, data); + GApplication *application = G_APPLICATION (initable); - case UNIQUE_OPEN: - return shell_message_handle_open (shell, data); - - case UNIQUE_CLOSE: - return shell_message_handle_close (shell, data); - - default: - break; - } + shell_add_actions (application); - /* Chain up to parent's message_received() method. */ - return UNIQUE_APP_CLASS (e_shell_parent_class)-> - message_received (app, command, data, time_); -} - -static void -shell_window_destroyed (EShell *shell) -{ - if (e_shell_get_watched_windows (shell) == NULL) - gtk_main_quit (); + return g_application_register (application, cancellable, error); } static void e_shell_class_init (EShellClass *class) { GObjectClass *object_class; - UniqueAppClass *unique_app_class; + GApplicationClass *application_class; g_type_class_add_private (class, sizeof (EShellPrivate)); @@ -850,8 +867,10 @@ e_shell_class_init (EShellClass *class) object_class->finalize = shell_finalize; object_class->constructed = shell_constructed; - unique_app_class = UNIQUE_APP_CLASS (class); - unique_app_class->message_received = shell_message_received; + application_class = G_APPLICATION_CLASS (class); + application_class->startup = shell_startup; + application_class->activate = shell_activate; + application_class->open = shell_open; class->window_destroyed = shell_window_destroyed; @@ -1161,6 +1180,12 @@ e_shell_class_init (EShellClass *class) G_TYPE_NONE, 0); } +static void +e_shell_initable_init (GInitableIface *interface) +{ + interface->init = shell_initable_init; +} + static void e_shell_init (EShell *shell) { @@ -1347,8 +1372,8 @@ e_shell_get_canonical_name (EShell *shell, g_return_val_if_fail (E_IS_SHELL (shell), NULL); - /* Handle NULL name arguments silently. */ - if (name == NULL) + /* Handle NULL or empty name arguments silently. */ + if (name == NULL || *name == '\0') return NULL; shell_backend = e_shell_get_backend_by_name (shell, name); @@ -1455,16 +1480,12 @@ e_shell_create_shell_window (EShell *shell, const gchar *view_name) { GtkWidget *shell_window; - UniqueMessageData *data; - UniqueApp *app; GList *link; g_return_val_if_fail (E_IS_SHELL (shell), NULL); - app = UNIQUE_APP (shell); - - if (unique_app_is_running (app)) - goto unique; + if (g_application_get_is_remote (G_APPLICATION (shell))) + goto remote; view_name = e_shell_get_canonical_name (shell, view_name); @@ -1508,17 +1529,14 @@ e_shell_create_shell_window (EShell *shell, return shell_window; -unique: /* Send a message to the other Evolution process. */ - - /* XXX Do something with UniqueResponse? */ +remote: /* Send a message to the other Evolution process. */ if (view_name != NULL) { - data = unique_message_data_new (); - unique_message_data_set_text (data, view_name, -1); - unique_app_send_message (app, UNIQUE_NEW, data); - unique_message_data_free (data); + g_action_group_activate_action ( + shell->priv->action_group, "new-window", + g_variant_new_string (view_name)); } else - unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); + g_application_activate (G_APPLICATION (shell)); return NULL; } @@ -1538,18 +1556,15 @@ e_shell_handle_uris (EShell *shell, gchar **uris, gboolean do_import) { - UniqueApp *app; - UniqueMessageData *data; + GFile **files; guint n_handled = 0; - gint ii; + guint length, ii; g_return_val_if_fail (E_IS_SHELL (shell), FALSE); g_return_val_if_fail (uris != NULL, FALSE); - app = UNIQUE_APP (shell); - - if (unique_app_is_running (app)) - goto unique; + if (g_application_get_is_remote (G_APPLICATION (shell))) + goto remote; if (do_import) { n_handled = e_shell_utils_import_uris (shell, uris); @@ -1569,34 +1584,23 @@ e_shell_handle_uris (EShell *shell, return n_handled; -unique: /* Send a message to the other Evolution process. */ +remote: /* Send a message to the other Evolution process. */ - /* XXX Do something with UniqueResponse? */ + length = g_strv_length (uris); - data = unique_message_data_new (); - if (do_import) { - GPtrArray *arr = g_ptr_array_new (); + files = g_new0 (GFile *, length + 1); + for (ii = 0; ii < length; ii++) + files[ii] = g_file_new_for_uri (uris[ii]); - g_ptr_array_add (arr, (gpointer)"--import"); + g_application_open (G_APPLICATION (shell), files, length, ""); - for (ii = 0; uris[ii] != NULL; ii++) { - g_ptr_array_add (arr, uris[ii]); - } - - g_ptr_array_add (arr, NULL); - - unique_message_data_set_uris (data, (gchar **)arr->pdata); - - g_ptr_array_free (arr, TRUE); - } else { - unique_message_data_set_uris (data, uris); - } - unique_app_send_message (app, UNIQUE_OPEN, data); - unique_message_data_free (data); + for (ii = 0; ii < length; ii++) + g_object_unref (files[ii]); + g_free (files); /* As far as we're concerned, all URIs have been handled. */ - return g_strv_length (uris); + return length; } /** @@ -1655,6 +1659,12 @@ e_shell_watch_window (EShell *shell, list = shell->priv->watched_windows; + /* XXX If my suggestion in [1] is accepted for GtkApplication + * then we can get rid of our own watched_windows list. + * + * [1] https://bugzilla.gnome.org/show_bug.cgi?id=624539 + */ + /* Ignore duplicates. */ if (g_list_find (list, window) != NULL) return; @@ -1662,7 +1672,7 @@ e_shell_watch_window (EShell *shell, list = g_list_prepend (list, window); shell->priv->watched_windows = list; - unique_app_watch_window (UNIQUE_APP (shell), window); + gtk_application_add_window (GTK_APPLICATION (shell), window); /* We use the window's own type name and memory * address to form a unique window role for X11. */ @@ -1987,15 +1997,10 @@ gboolean e_shell_quit (EShell *shell, EShellQuitReason reason) { - UniqueApp *app; - UniqueResponse response; - g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - app = UNIQUE_APP (shell); - - if (unique_app_is_running (app)) - goto unique; + if (g_application_get_is_remote (G_APPLICATION (shell))) + goto remote; if (!shell_request_quit (shell, reason)) return FALSE; @@ -2004,11 +2009,12 @@ e_shell_quit (EShell *shell, return TRUE; -unique: /* Send a message to the other Evolution process. */ +remote: /* Send a message to the other Evolution process. */ - response = unique_app_send_message (app, UNIQUE_CLOSE, NULL); + g_action_group_activate_action ( + shell->priv->action_group, "quit", NULL); - return (response == UNIQUE_RESPONSE_OK); + return TRUE; } /** -- cgit v1.2.3 From c8be2c5fe1a1dc943bc293bb269da116a7f237ad Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 25 Mar 2011 10:53:54 -0400 Subject: Fix an EShell reference leak. GApplication calls g_main_loop_quit() immediately when the last window is destroyed, whereas we do it from an idle callback with an extra ref on EShell to keep it alive until the idle callback runs. But because GApplication beats us to the punch, our idle callback never runs and the EShell reference leaks. For now, we'll just disable the quit_mainloop() method of GApplication. If GtkApplication grows a signal equivalent to EShell::window-destroyed, EShell could drop its window_destroyed() method and let G[tk]Application handle things normally. --- shell/e-shell.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index d9dcb5de9a..d7ecf69d8c 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -833,6 +833,14 @@ shell_open (GApplication *application, g_strfreev (uris); } +static void +shell_quit_mainloop (GApplication *application) +{ + /* XXX Don't allow GApplication to quit the main loop. + * We'll do that ourselves until GtkApplication gets + * a signal equivalent to EShell::window-destroyed. */ +} + static void shell_window_destroyed (EShell *shell) { @@ -871,6 +879,7 @@ e_shell_class_init (EShellClass *class) application_class->startup = shell_startup; application_class->activate = shell_activate; application_class->open = shell_open; + application_class->quit_mainloop = shell_quit_mainloop; class->window_destroyed = shell_window_destroyed; -- cgit v1.2.3 From ba6a2343869f6be82f44261f183cd6925659d5ee Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 27 Mar 2011 15:16:39 -0400 Subject: Restore lockdown integration. With lockdown settings available through GSettings, widgets can handle lockdown integration themselves without having to use EShellSettings. Also fixed a few places where printing or save-to-disk actions were either not properly wired up or not responding to lockdown settings, but much more work needs done. Attachments, for example, are not honoring the disable-save-to-disk setting at all. This too requires the recently-added gsettings-desktop-schemas dependency. --- shell/e-shell.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index d7ecf69d8c..d9c3508161 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1244,32 +1244,6 @@ e_shell_init (EShell *shell) "start-offline", "/apps/evolution/shell/start_offline"); -#if 0 /* XXX Lockdown keys have moved to gsettings-desktop-schemas, - * so disable lockdown integration until we're ready for - * GSettings. */ -#ifndef G_OS_WIN32 - e_shell_settings_install_property_for_key ( - "disable-application-handlers", - "/desktop/gnome/lockdown/disable_application_handlers"); - - e_shell_settings_install_property_for_key ( - "disable-command-line", - "/desktop/gnome/lockdown/disable_command_line"); - - e_shell_settings_install_property_for_key ( - "disable-printing", - "/desktop/gnome/lockdown/disable_printing"); - - e_shell_settings_install_property_for_key ( - "disable-print-setup", - "/desktop/gnome/lockdown/disable_print_setup"); - - e_shell_settings_install_property_for_key ( - "disable-save-to-disk", - "/desktop/gnome/lockdown/disable_save_to_disk"); -#endif /* G_OS_WIN32 */ -#endif - /*** Session Management ***/ sm_client = egg_sm_client_get (); -- cgit v1.2.3 From cec324e80ae88463e97e79ce16806127b512f931 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 22 May 2011 11:04:27 -0400 Subject: Bug 650491 - Shell handles forwarding uris to existing process wrong This adds a "handle-uris" GAction which takes a string array argument, so the URIs can be passed to the primary process verbatim. --- shell/e-shell.c | 70 ++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 41 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index d9c3508161..eb3cb8e407 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -235,6 +235,19 @@ shell_action_new_window_cb (GSimpleAction *action, e_shell_create_shell_window (shell, view_name); } +static void +shell_action_handle_uris_cb (GSimpleAction *action, + GVariant *parameter, + EShell *shell) +{ + const gchar **uris; + + /* Do not use g_strfreev() here. */ + uris = g_variant_get_strv (parameter, NULL); + e_shell_handle_uris (shell, uris, FALSE); + g_free (uris); +} + static void shell_action_quit_cb (GSimpleAction *action, GVariant *parameter, @@ -261,6 +274,14 @@ shell_add_actions (GApplication *application) g_simple_action_group_insert (action_group, G_ACTION (action)); g_object_unref (action); + action = g_simple_action_new ( + "handle-uris", G_VARIANT_TYPE_STRING_ARRAY); + g_signal_connect ( + action, "activate", + G_CALLBACK (shell_action_handle_uris_cb), application); + g_simple_action_group_insert (action_group, G_ACTION (action)); + g_object_unref (action); + action = g_simple_action_new ("quit", NULL); g_signal_connect ( action, "activate", @@ -810,29 +831,6 @@ shell_activate (GApplication *application) e_shell_create_shell_window (shell, NULL); } -static void -shell_open (GApplication *application, - GFile **files, - gint n_files, - const gchar *hint) -{ - EShell *shell; - gchar **uris; - gint ii; - - /* Do not chain up. Default method just emits a warning. */ - - shell = E_SHELL (application); - uris = g_new0 (gchar *, n_files + 1); - - for (ii = 0; ii < n_files; ii++) - uris[ii] = g_file_get_uri (files[ii]); - - e_shell_handle_uris (shell, uris, FALSE); - - g_strfreev (uris); -} - static void shell_quit_mainloop (GApplication *application) { @@ -878,7 +876,6 @@ e_shell_class_init (EShellClass *class) application_class = G_APPLICATION_CLASS (class); application_class->startup = shell_startup; application_class->activate = shell_activate; - application_class->open = shell_open; application_class->quit_mainloop = shell_quit_mainloop; class->window_destroyed = shell_window_destroyed; @@ -1516,7 +1513,7 @@ remote: /* Send a message to the other Evolution process. */ if (view_name != NULL) { g_action_group_activate_action ( - shell->priv->action_group, "new-window", + G_ACTION_GROUP (shell), "new-window", g_variant_new_string (view_name)); } else g_application_activate (G_APPLICATION (shell)); @@ -1536,12 +1533,11 @@ remote: /* Send a message to the other Evolution process. */ **/ guint e_shell_handle_uris (EShell *shell, - gchar **uris, + const gchar * const *uris, gboolean do_import) { - GFile **files; guint n_handled = 0; - guint length, ii; + guint ii; g_return_val_if_fail (E_IS_SHELL (shell), FALSE); g_return_val_if_fail (uris != NULL, FALSE); @@ -1569,21 +1565,13 @@ e_shell_handle_uris (EShell *shell, remote: /* Send a message to the other Evolution process. */ - length = g_strv_length (uris); - - files = g_new0 (GFile *, length + 1); - for (ii = 0; ii < length; ii++) - files[ii] = g_file_new_for_uri (uris[ii]); - - g_application_open (G_APPLICATION (shell), files, length, ""); - - for (ii = 0; ii < length; ii++) - g_object_unref (files[ii]); - g_free (files); + g_action_group_activate_action ( + G_ACTION_GROUP (shell), "handle-uris", + g_variant_new_strv (uris, -1)); /* As far as we're concerned, all URIs have been handled. */ - return length; + return g_strv_length ((gchar **) uris); } /** @@ -1995,7 +1983,7 @@ e_shell_quit (EShell *shell, remote: /* Send a message to the other Evolution process. */ g_action_group_activate_action ( - shell->priv->action_group, "quit", NULL); + G_ACTION_GROUP (shell), "quit", NULL); return TRUE; } -- cgit v1.2.3 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 From 756c8abcb840b8da588031f4a0d7e1fc979fab70 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 27 May 2011 15:23:07 +0200 Subject: Bug #646109 - Fix use of include to make sure translations work --- shell/e-shell.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 60f145e7d0..dbcb55b36a 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -25,6 +25,10 @@ * @include: shell/e-shell.h **/ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-shell.h" #include -- cgit v1.2.3 From 53bc6ffc531d7a7188e15be245a31f301090ee15 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 10 Sep 2011 11:47:15 -0400 Subject: The EExtension framework is now in libebackend. The EModule, EExtensible and EExtension classes as well as the e_type_traverse() function have been moved to Evolution-Data-Server's libebackend library to replace e-data-server-module.c. Now Evolution-Data-Server modules use the same framework as Evolution. --- shell/e-shell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index dbcb55b36a..2954765d15 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -32,12 +32,12 @@ #include "e-shell.h" #include +#include +#include #include -#include "e-util/e-module.h" -#include "e-util/e-extensible.h" -#include "e-util/e-util-private.h" #include "e-util/e-util.h" +#include "e-util/e-util-private.h" #include "smclient/eggsmclient.h" #include "widgets/misc/e-preferences-window.h" -- cgit v1.2.3 From e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 27 Sep 2011 01:13:42 -0400 Subject: Miscellaneous cleanups from the account-mgmt branch. Reducing diff noise so I can see important changes easier when comparing branches. A few API changes, but nothing that affects functionality. --- shell/e-shell.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 2954765d15..dce7b21070 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -46,6 +46,10 @@ #include "e-shell-window.h" #include "e-shell-utils.h" +#define E_SHELL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SHELL, EShellPrivate)) + struct _EShellPrivate { GQueue alerts; GList *watched_windows; @@ -739,7 +743,7 @@ shell_dispose (GObject *object) EShellPrivate *priv; EAlert *alert; - priv = E_SHELL (object)->priv; + priv = E_SHELL_GET_PRIVATE (object); while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) { g_signal_handlers_disconnect_by_func ( @@ -787,7 +791,7 @@ shell_finalize (GObject *object) { EShellPrivate *priv; - priv = E_SHELL (object)->priv; + priv = E_SHELL_GET_PRIVATE (object); g_hash_table_destroy (priv->backends_by_name); g_hash_table_destroy (priv->backends_by_scheme); @@ -1226,8 +1230,7 @@ e_shell_init (EShell *shell) GtkIconTheme *icon_theme; EggSMClient *sm_client; - shell->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - shell, E_TYPE_SHELL, EShellPrivate); + shell->priv = E_SHELL_GET_PRIVATE (shell); backends_by_name = g_hash_table_new (g_str_hash, g_str_equal); backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal); -- cgit v1.2.3