[evolution/wip/webkit2] Bug 759536 - Provide a way to hide Switcher buttons
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 759536 - Provide a way to hide Switcher buttons
- Date: Thu, 3 Mar 2016 13:43:08 +0000 (UTC)
commit 86ffe3ecfa928764f050bba8d39cba0ab8f3c092
Author: Milan Crha <mcrha redhat com>
Date: Wed Jan 13 17:02:27 2016 +0100
Bug 759536 - Provide a way to hide Switcher buttons
data/org.gnome.evolution.shell.gschema.xml.in | 5 +++++
shell/e-shell-switcher.c | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.evolution.shell.gschema.xml.in b/data/org.gnome.evolution.shell.gschema.xml.in
index e509cfc..18ece74 100644
--- a/data/org.gnome.evolution.shell.gschema.xml.in
+++ b/data/org.gnome.evolution.shell.gschema.xml.in
@@ -30,6 +30,11 @@
<_summary>Enable express mode</_summary>
<_description>Flag that enables a much simplified user interface.</_description>
</key>
+ <key name="buttons-hide" type="as">
+ <default>[]</default>
+ <_summary>List of button names to hide in the window switcher</_summary>
+ <_description>Valid values are 'mail', 'addressbook', 'calendar', 'tasks' and 'memos'. Change of this
requires restart of the application.</_description>
+ </key>
<key name="buttons-visible" type="b">
<default>true</default>
<_summary>Window buttons are visible</_summary>
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index d3c2d2b..a4f0271 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -35,6 +35,8 @@
#include <e-util/e-util.h>
+#include "e-shell-window-private.h"
+
#define E_SHELL_SWITCHER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate))
@@ -683,11 +685,32 @@ e_shell_switcher_add_action (EShellSwitcher *switcher,
{
GtkWidget *widget;
GtkButton *button;
+ GSettings *settings;
+ gchar **strv;
+ gint ii;
+ gboolean skip = FALSE;
g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
g_return_if_fail (GTK_IS_ACTION (switch_action));
g_return_if_fail (GTK_IS_ACTION (new_window_action));
+ settings = e_util_ref_settings ("org.gnome.evolution.shell");
+ strv = g_settings_get_strv (settings, "buttons-hide");
+ g_clear_object (&settings);
+
+ for (ii = 0; strv && strv[ii] && !skip; ii++) {
+ gchar *name;
+
+ name = g_strdup_printf (E_SHELL_SWITCHER_FORMAT, strv[ii]);
+ skip = g_strcmp0 (name, gtk_action_get_name (switch_action)) == 0;
+ g_free (name);
+ }
+
+ g_strfreev (strv);
+
+ if (skip)
+ return;
+
g_object_ref (switch_action);
widget = gtk_action_create_tool_item (switch_action);
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]