[gnome-todo] sidebar: Bind list and provider visibility
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] sidebar: Bind list and provider visibility
- Date: Fri, 1 Feb 2019 15:09:31 +0000 (UTC)
commit 4e038d22e6a21ca482c8d417b2936e44ec7ef136
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Feb 1 13:03:49 2019 -0200
sidebar: Bind list and provider visibility
We don't want to show the provider rows, nor its
task lists, when the provider isn't enabled.
Bind the provider and list rows' visibility to
the enabled property of the provider.
src/sidebar/gtd-sidebar-list-row.c | 6 ++++++
src/sidebar/gtd-sidebar-provider-row.c | 6 ++++++
2 files changed, 12 insertions(+)
---
diff --git a/src/sidebar/gtd-sidebar-list-row.c b/src/sidebar/gtd-sidebar-list-row.c
index 2da5e9d..3655fb7 100644
--- a/src/sidebar/gtd-sidebar-list-row.c
+++ b/src/sidebar/gtd-sidebar-list-row.c
@@ -111,6 +111,12 @@ set_list (GtdSidebarListRow *self,
"label",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+ g_object_bind_property (gtd_task_list_get_provider (list),
+ "enabled",
+ self,
+ "visible",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+
/* Always keep the counter label updated */
g_signal_connect_object (list, "task-added", G_CALLBACK (on_list_changed_cb), self, G_CONNECT_SWAPPED);
g_signal_connect_object (list, "task-updated", G_CALLBACK (on_list_changed_cb), self, G_CONNECT_SWAPPED);
diff --git a/src/sidebar/gtd-sidebar-provider-row.c b/src/sidebar/gtd-sidebar-provider-row.c
index 9ebfefd..c856786 100644
--- a/src/sidebar/gtd-sidebar-provider-row.c
+++ b/src/sidebar/gtd-sidebar-provider-row.c
@@ -128,6 +128,12 @@ set_provider (GtdSidebarProviderRow *self,
self->provider = g_object_ref (provider);
+ g_object_bind_property (provider,
+ "enabled",
+ self,
+ "visible",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+
/* Setup the title label */
manager = gtd_manager_get_default ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]