aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-06-18 21:34:33 +0800
committerMilan Crha <mcrha@redhat.com>2012-06-18 21:35:44 +0800
commit6c05b09be16ac8eceb17653c3c26c0c6f963ef10 (patch)
tree5bb22771cf05419f851373ee43b1ad39a0dcfeaa /shell
parente045e6f12324e1063a87488ac298fd23affea581 (diff)
downloadgsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.tar
gsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.tar.gz
gsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.tar.bz2
gsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.tar.lz
gsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.tar.xz
gsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.tar.zst
gsoc2013-evolution-6c05b09be16ac8eceb17653c3c26c0c6f963ef10.zip
Do not call g_object_notify() when property didn't change
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-searchbar.c27
-rw-r--r--shell/e-shell-settings.c60
-rw-r--r--shell/e-shell-sidebar.c9
-rw-r--r--shell/e-shell-switcher.c3
-rw-r--r--shell/e-shell-view.c6
-rw-r--r--shell/e-shell-window-private.c3
-rw-r--r--shell/e-shell-window.c15
-rw-r--r--shell/e-shell.c2
8 files changed, 124 insertions, 1 deletions
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 644293b2a2..9d9ad5a0cb 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -1102,6 +1102,9 @@ e_shell_searchbar_set_express_mode (EShellSearchbar *searchbar,
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ if ((searchbar->priv->express_mode ? 1 : 0) == (express_mode ? 1 : 0))
+ return;
+
searchbar->priv->express_mode = express_mode;
/* Emit "notify" on all the properties we override. */
@@ -1139,6 +1142,9 @@ e_shell_searchbar_set_labels_visible (EShellSearchbar *searchbar,
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ if ((searchbar->priv->labels_visible ? 1 : 0) == (labels_visible ? 1 : 0))
+ return;
+
searchbar->priv->labels_visible = labels_visible;
g_object_notify (G_OBJECT (searchbar), "labels-visible");
@@ -1162,6 +1168,9 @@ e_shell_searchbar_set_filter_visible (EShellSearchbar *searchbar,
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ if ((searchbar->priv->filter_visible ? 1 : 0) == (filter_visible ? 1 : 0))
+ return;
+
searchbar->priv->filter_visible = filter_visible;
g_object_notify (G_OBJECT (searchbar), "filter-visible");
@@ -1189,6 +1198,9 @@ e_shell_searchbar_set_search_hint (EShellSearchbar *searchbar,
entry = GTK_ENTRY (searchbar->priv->search_entry);
+ if (g_strcmp0 (gtk_entry_get_placeholder_text (entry), search_hint) == 0)
+ return;
+
gtk_entry_set_placeholder_text (entry, search_hint);
g_object_notify (G_OBJECT (searchbar), "search-hint");
@@ -1208,6 +1220,9 @@ e_shell_searchbar_set_search_option (EShellSearchbar *searchbar,
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ if (searchbar->priv->search_option == search_option)
+ return;
+
if (search_option != NULL) {
g_return_if_fail (GTK_IS_RADIO_ACTION (search_option));
g_object_ref (search_option);
@@ -1259,6 +1274,9 @@ e_shell_searchbar_set_search_text (EShellSearchbar *searchbar,
if (search_text == NULL)
search_text = "";
+ if (g_strcmp0 (gtk_entry_get_text (entry), search_text) == 0)
+ return;
+
gtk_entry_set_text (entry, search_text);
shell_searchbar_update_search_widgets (searchbar);
@@ -1280,6 +1298,9 @@ e_shell_searchbar_set_search_visible (EShellSearchbar *searchbar,
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ if ((searchbar->priv->search_visible ? 1 : 0) == (search_visible ? 1 : 0))
+ return;
+
searchbar->priv->search_visible = search_visible;
g_object_notify (G_OBJECT (searchbar), "search-visible");
@@ -1321,6 +1342,9 @@ e_shell_searchbar_set_scope_visible (EShellSearchbar *searchbar,
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ if ((searchbar->priv->scope_visible ? 1 : 0) == (scope_visible ? 1 : 0))
+ return;
+
searchbar->priv->scope_visible = scope_visible;
g_object_notify (G_OBJECT (searchbar), "scope-visible");
@@ -1351,6 +1375,9 @@ e_shell_searchbar_set_state_group (EShellSearchbar *searchbar,
if (state_group == NULL)
state_group = STATE_GROUP_DEFAULT;
+ if (g_strcmp0 (searchbar->priv->state_group, state_group) == 0)
+ return;
+
g_free (searchbar->priv->state_group);
searchbar->priv->state_group = g_strdup (state_group);
diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c
index bae19f1309..6338e9886d 100644
--- a/shell/e-shell-settings.c
+++ b/shell/e-shell-settings.c
@@ -48,6 +48,60 @@ static GList *instances;
static guint property_count;
static gpointer parent_class;
+static gboolean
+shell_settings_value_equal (const GValue *v1,
+ const GValue *v2,
+ gboolean is_debug)
+{
+ if (!v1 || !v2)
+ return v1 == v2;
+
+ if (G_VALUE_HOLDS_STRING (v1) &&
+ G_VALUE_HOLDS_STRING (v2)) {
+ return g_strcmp0 (g_value_get_string (v1),
+ g_value_get_string (v2)) == 0;
+ } else if (G_VALUE_HOLDS_UCHAR (v1) &&
+ G_VALUE_HOLDS_UCHAR (v2)) {
+ return g_value_get_uchar (v1) == g_value_get_uchar (v2);
+ } else if (G_VALUE_HOLDS_CHAR (v1) &&
+ G_VALUE_HOLDS_CHAR (v2)) {
+ return g_value_get_schar (v1) == g_value_get_schar (v2);
+ } else if (G_VALUE_HOLDS_INT (v1) &&
+ G_VALUE_HOLDS_INT (v2)) {
+ return g_value_get_int (v1) == g_value_get_int (v2);
+ } else if (G_VALUE_HOLDS_UINT (v1) &&
+ G_VALUE_HOLDS_UINT (v2)) {
+ return g_value_get_uint (v1) == g_value_get_uint (v2);
+ } else if (G_VALUE_HOLDS_LONG (v1) &&
+ G_VALUE_HOLDS_LONG (v2)) {
+ return g_value_get_long (v1) == g_value_get_long (v2);
+ } else if (G_VALUE_HOLDS_ULONG (v1) &&
+ G_VALUE_HOLDS_ULONG (v2)) {
+ return g_value_get_ulong (v1) == g_value_get_ulong (v2);
+ } else if (G_VALUE_HOLDS_INT64 (v1) &&
+ G_VALUE_HOLDS_INT64 (v2)) {
+ return g_value_get_int64 (v1) == g_value_get_int64 (v2);
+ } else if (G_VALUE_HOLDS_UINT64 (v1) &&
+ G_VALUE_HOLDS_UINT64 (v2)) {
+ return g_value_get_uint64 (v1) == g_value_get_uint64 (v2);
+ } else if (G_VALUE_HOLDS_DOUBLE (v1) &&
+ G_VALUE_HOLDS_DOUBLE (v2)) {
+ return g_value_get_double (v1) == g_value_get_double (v2);
+ } else if (G_VALUE_HOLDS_BOOLEAN (v1) &&
+ G_VALUE_HOLDS_BOOLEAN (v2)) {
+ return (g_value_get_boolean (v1) ? 1 : 0) == (g_value_get_boolean (v2) ? 1 : 0);
+ } else if (G_VALUE_HOLDS_POINTER (v1) &&
+ G_VALUE_HOLDS_POINTER (v2)) {
+ return g_value_get_pointer (v1) == g_value_get_pointer (v2);
+ }
+
+ if (is_debug)
+ g_debug ("%s: Cannot compare '%s' with '%s'",
+ G_STRFUNC, G_VALUE_TYPE_NAME (v1), G_VALUE_TYPE_NAME (v2));
+
+ return FALSE;
+}
+
static GParamSpec *
shell_settings_pspec_for_key (const gchar *property_name,
const gchar *schema,
@@ -151,6 +205,12 @@ shell_settings_set_property (GObject *object,
dest_value = &g_array_index (
priv->value_array, GValue, property_id - 1);
+ if (shell_settings_value_equal (value, dest_value, priv->debug)) {
+ if (priv->debug)
+ g_debug ("Setting '%s' set, but it didn't change", pspec->name);
+ return;
+ }
+
g_value_copy (value, dest_value);
g_object_notify (object, pspec->name);
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index d869a2a63a..362321069a 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -594,6 +594,9 @@ e_shell_sidebar_set_icon_name (EShellSidebar *shell_sidebar,
{
g_return_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar));
+ if (g_strcmp0 (shell_sidebar->priv->icon_name, icon_name) == 0)
+ return;
+
g_free (shell_sidebar->priv->icon_name);
shell_sidebar->priv->icon_name = g_strdup (icon_name);
@@ -637,6 +640,9 @@ e_shell_sidebar_set_primary_text (EShellSidebar *shell_sidebar,
{
g_return_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar));
+ if (g_strcmp0 (shell_sidebar->priv->primary_text, primary_text) == 0)
+ return;
+
g_free (shell_sidebar->priv->primary_text);
shell_sidebar->priv->primary_text = e_utf8_ensure_valid (primary_text);
@@ -683,6 +689,9 @@ e_shell_sidebar_set_secondary_text (EShellSidebar *shell_sidebar,
{
g_return_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar));
+ if (g_strcmp0 (shell_sidebar->priv->secondary_text, secondary_text) == 0)
+ return;
+
g_free (shell_sidebar->priv->secondary_text);
shell_sidebar->priv->secondary_text = e_utf8_ensure_valid (secondary_text);
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index efbc311945..b2830cac02 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -773,6 +773,9 @@ e_shell_switcher_set_visible (EShellSwitcher *switcher,
g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
+ if ((switcher->priv->toolbar_visible ? 1 : 0) == (visible ? 1 : 0))
+ return;
+
switcher->priv->toolbar_visible = visible;
for (iter = switcher->priv->proxies; iter != NULL; iter = iter->next)
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index fdad1cbd19..06e99a8270 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1367,6 +1367,9 @@ e_shell_view_set_page_num (EShellView *shell_view,
{
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ if (shell_view->priv->page_num == page_num)
+ return;
+
shell_view->priv->page_num = page_num;
g_object_notify (G_OBJECT (shell_view), "page-num");
@@ -1440,6 +1443,9 @@ e_shell_view_set_search_rule (EShellView *shell_view,
{
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ if (shell_view->priv->search_rule == search_rule)
+ return;
+
if (search_rule != NULL) {
g_return_if_fail (E_IS_FILTER_RULE (search_rule));
g_object_ref (search_rule);
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 572fbaf4f3..a0404f9915 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -537,6 +537,9 @@ e_shell_window_switch_to_view (EShellWindow *shell_window,
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
g_return_if_fail (view_name != NULL);
+ if (shell_window->priv->active_view == view_name)
+ return;
+
shell_view = e_shell_window_get_shell_view (shell_window, view_name);
shell_window->priv->active_view = view_name;
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index abc3d085fd..ede1400fcb 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -1386,6 +1386,9 @@ e_shell_window_set_safe_mode (EShellWindow *shell_window,
{
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ if ((shell_window->priv->safe_mode ? 1 : 0) == (safe_mode ? 1 : 0))
+ return;
+
shell_window->priv->safe_mode = safe_mode;
g_object_notify (G_OBJECT (shell_window), "safe-mode");
@@ -1449,6 +1452,9 @@ e_shell_window_set_sidebar_visible (EShellWindow *shell_window,
{
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ if ((shell_window->priv->sidebar_visible ? 1 : 0) == (sidebar_visible ? 1 : 0))
+ return;
+
shell_window->priv->sidebar_visible = sidebar_visible;
g_object_notify (G_OBJECT (shell_window), "sidebar-visible");
@@ -1483,6 +1489,9 @@ e_shell_window_set_switcher_visible (EShellWindow *shell_window,
{
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ if ((shell_window->priv->switcher_visible ? 1 : 0) == (switcher_visible ? 1 : 0))
+ return;
+
shell_window->priv->switcher_visible = switcher_visible;
g_object_notify (G_OBJECT (shell_window), "switcher-visible");
@@ -1517,6 +1526,9 @@ e_shell_window_set_taskbar_visible (EShellWindow *shell_window,
{
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ if ((shell_window->priv->taskbar_visible ? 1 : 0) == (taskbar_visible ? 1 : 0))
+ return;
+
shell_window->priv->taskbar_visible = taskbar_visible;
g_object_notify (G_OBJECT (shell_window), "taskbar-visible");
@@ -1551,6 +1563,9 @@ e_shell_window_set_toolbar_visible (EShellWindow *shell_window,
{
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ if ((shell_window->priv->toolbar_visible ? 1 : 0) == (toolbar_visible ? 1 : 0))
+ return;
+
shell_window->priv->toolbar_visible = toolbar_visible;
g_object_notify (G_OBJECT (shell_window), "toolbar-visible");
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 7ab685ab27..0f11c16903 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1744,7 +1744,7 @@ e_shell_set_network_available (EShell *shell,
if (shell->priv->network_available_locked)
return;
- if (network_available == shell->priv->network_available)
+ if ((network_available ? 1 : 0) == (shell->priv->network_available ? 1 : 0))
return;
shell->priv->network_available = network_available;