[gnome-todo] workspace: Make activate and deactivate optional



commit 28073977386ddb448a0df3d795680ed2e8c1650c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat May 2 23:40:12 2020 -0300

    workspace: Make activate and deactivate optional

 src/interfaces/gtd-workspace.c                       | 20 ++++++++++++--------
 .../task-lists-workspace/gtd-task-lists-workspace.c  |  6 ------
 2 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/src/interfaces/gtd-workspace.c b/src/interfaces/gtd-workspace.c
index 13652ea..bb02171 100644
--- a/src/interfaces/gtd-workspace.c
+++ b/src/interfaces/gtd-workspace.c
@@ -54,7 +54,8 @@ gtd_workspace_default_init (GtdWorkspaceInterface *iface)
  * gtd_workspace_get_id:
  * @self: a #GtdWorkspace
  *
- * Retrieves the id of @self.
+ * Retrieves the id of @self. It is mandatory to implement
+ * this.
  *
  * Returns: the id of @self
  */
@@ -71,7 +72,8 @@ gtd_workspace_get_id (GtdWorkspace *self)
  * gtd_workspace_get_title:
  * @self: a #GtdWorkspace
  *
- * Retrieves the title of @self.
+ * Retrieves the title of @self. It is mandatory to implement
+ * this.
  *
  * Returns: the title of @self
  */
@@ -88,7 +90,8 @@ gtd_workspace_get_title (GtdWorkspace *self)
  * gtd_workspace_get_priority:
  * @self: a #GtdWorkspace
  *
- * Retrieves the priority of @self.
+ * Retrieves the priority of @self. It is mandatory to implement
+ * this.
  *
  * Returns: the priority of @self
  */
@@ -105,7 +108,8 @@ gtd_workspace_get_priority (GtdWorkspace *self)
  * gtd_workspace_get_priority:
  * @self: a #GtdWorkspace
  *
- * Retrieves the icon of @self.
+ * Retrieves the icon of @self. It is mandatory to implement
+ * this.
  *
  * Returns: (transfer full): a #GIcon
  */
@@ -129,9 +133,9 @@ void
 gtd_workspace_activate (GtdWorkspace *self)
 {
   g_return_if_fail (GTD_IS_WORKSPACE (self));
-  g_return_if_fail (GTD_WORKSPACE_GET_IFACE (self)->activate);
 
-  GTD_WORKSPACE_GET_IFACE (self)->activate (self);
+  if (GTD_WORKSPACE_GET_IFACE (self)->activate)
+    GTD_WORKSPACE_GET_IFACE (self)->activate (self);
 }
 
 /**
@@ -145,8 +149,8 @@ void
 gtd_workspace_deactivate (GtdWorkspace *self)
 {
   g_return_if_fail (GTD_IS_WORKSPACE (self));
-  g_return_if_fail (GTD_WORKSPACE_GET_IFACE (self)->deactivate);
 
-  GTD_WORKSPACE_GET_IFACE (self)->deactivate (self);
+  if (GTD_WORKSPACE_GET_IFACE (self)->deactivate)
+    GTD_WORKSPACE_GET_IFACE (self)->deactivate (self);
 }
 
diff --git a/src/plugins/task-lists-workspace/gtd-task-lists-workspace.c 
b/src/plugins/task-lists-workspace/gtd-task-lists-workspace.c
index 7093479..1ff168b 100644
--- a/src/plugins/task-lists-workspace/gtd-task-lists-workspace.c
+++ b/src/plugins/task-lists-workspace/gtd-task-lists-workspace.c
@@ -322,11 +322,6 @@ gtd_task_lists_workspace_activate (GtdWorkspace *workspace)
   gtd_sidebar_activate (self->sidebar);
 }
 
-static void
-gtd_task_lists_workspace_deactivate (GtdWorkspace *workspace)
-{
-}
-
 static void
 gtd_workspace_iface_init (GtdWorkspaceInterface  *iface)
 {
@@ -335,7 +330,6 @@ gtd_workspace_iface_init (GtdWorkspaceInterface  *iface)
   iface->get_priority = gtd_task_lists_workspace_get_priority;
   iface->get_icon = gtd_task_lists_workspace_get_icon;
   iface->activate = gtd_task_lists_workspace_activate;
-  iface->deactivate = gtd_task_lists_workspace_deactivate;
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]