[evolution/gnome-3-24] Bug 784776 - Don't change default view on middle-click of switcher button
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-24] Bug 784776 - Don't change default view on middle-click of switcher button
- Date: Tue, 11 Jul 2017 15:34:30 +0000 (UTC)
commit 470ee7736f8b195673e037f4969b672ce0c66fae
Author: Milan Crha <mcrha redhat com>
Date: Tue Jul 11 17:31:38 2017 +0200
Bug 784776 - Don't change default view on middle-click of switcher button
src/shell/e-shell-window-actions.c | 9 +++++++--
src/shell/e-shell.c | 25 ++++++++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/src/shell/e-shell-window-actions.c b/src/shell/e-shell-window-actions.c
index 64f735d..b7305f7 100644
--- a/src/shell/e-shell-window-actions.c
+++ b/src/shell/e-shell-window-actions.c
@@ -614,13 +614,18 @@ action_new_view_window_cb (GtkAction *action,
{
EShell *shell;
const gchar *view_name;
+ gchar *modified_view_name;
shell = e_shell_window_get_shell (shell_window);
view_name = g_object_get_data (G_OBJECT (action), "view-name");
- fprintf (stderr, "create new window: %s\n", view_name);
+ /* Just a feature to not change default component, when
+ the view name begins with a star */
+ modified_view_name = g_strconcat ("*", view_name, NULL);
- e_shell_create_shell_window (shell, view_name);
+ e_shell_create_shell_window (shell, modified_view_name);
+
+ g_free (modified_view_name);
}
/**
diff --git a/src/shell/e-shell.c b/src/shell/e-shell.c
index 30a91ca..87ac9c1 100644
--- a/src/shell/e-shell.c
+++ b/src/shell/e-shell.c
@@ -2332,17 +2332,19 @@ e_shell_create_shell_window (EShell *shell,
{
GtkWidget *shell_window;
GList *link;
+ gboolean can_change_default_view;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
if (g_application_get_is_remote (G_APPLICATION (shell)))
goto remote;
- view_name = e_shell_get_canonical_name (shell, view_name);
+ can_change_default_view = !view_name || *view_name != '*';
+ view_name = e_shell_get_canonical_name (shell, can_change_default_view ? view_name : (view_name + 1));
/* EShellWindow initializes its active view from a GSetting key,
- * so set the key ahead of time to control the intial view. */
- if (view_name != NULL) {
+ * so set the key ahead of time to control the initial view. */
+ if (view_name && can_change_default_view) {
GSettings *settings;
settings = e_util_ref_settings ("org.gnome.evolution.shell");
@@ -2356,6 +2358,23 @@ e_shell_create_shell_window (EShell *shell,
shell->priv->safe_mode,
shell->priv->geometry);
+ if (view_name && !can_change_default_view) {
+ GSettings *settings;
+ gchar *active_view;
+
+ settings = e_util_ref_settings ("org.gnome.evolution.shell");
+
+ /* This is ugly, but nothing better with GSettings bindings, I'm afraid. */
+ active_view = g_settings_get_string (settings, "default-component-id");
+
+ e_shell_window_set_active_view (E_SHELL_WINDOW (shell_window), view_name);
+
+ g_settings_set_string (settings, "default-component-id", active_view);
+
+ g_object_unref (settings);
+ g_free (active_view);
+ }
+
/* Submit any outstanding alerts. */
link = g_queue_peek_head_link (&shell->priv->alerts);
while (link != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]