[gnome-todo] task-list: Add helper function to check if its the inbox



commit 42ef925fdc0a5ff41e2def4909649b58f372672d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Apr 26 17:38:56 2020 -0300

    task-list: Add helper function to check if its the inbox

 src/gtd-task-list.c | 22 +++++++++++++++++++++-
 src/gtd-task-list.h |  4 +++-
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/gtd-task-list.c b/src/gtd-task-list.c
index d5dfb93..74b37b8 100644
--- a/src/gtd-task-list.c
+++ b/src/gtd-task-list.c
@@ -1,6 +1,6 @@
 /* gtd-task-list.c
  *
- * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ * Copyright (C) 2015-2020 Georges Basile Stavracas Neto <georges stavracas gmail com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1114,3 +1114,23 @@ gtd_task_list_set_archived (GtdTaskList *self,
 
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ARCHIVED]);
 }
+
+/**
+ * gtd_task_list_is_inbox:
+ * @self: a #GtdTaskList
+ *
+ * Retrieves whether @self is the inbox task list of its provider.
+ *
+ * Returns: %TRUE if @self is the inbox of it's provider, %FALSE otherwise.
+ */
+gboolean
+gtd_task_list_is_inbox (GtdTaskList *self)
+{
+  GtdTaskListPrivate *priv;
+
+  g_return_val_if_fail (GTD_IS_TASK_LIST (self), FALSE);
+
+  priv = gtd_task_list_get_instance_private (self);
+
+  return self == gtd_provider_get_inbox (priv->provider);
+}
diff --git a/src/gtd-task-list.h b/src/gtd-task-list.h
index ce9c51a..6fab1a9 100644
--- a/src/gtd-task-list.h
+++ b/src/gtd-task-list.h
@@ -1,6 +1,6 @@
 /* gtd-task-list.h
  *
- * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ * Copyright (C) 2015-2020 Georges Basile Stavracas Neto <georges stavracas gmail com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -100,6 +100,8 @@ gboolean                gtd_task_list_get_archived              (GtdTaskList
 void                    gtd_task_list_set_archived              (GtdTaskList            *self,
                                                                  gboolean                archived);
 
+gboolean                gtd_task_list_is_inbox                  (GtdTaskList            *self);
+
 G_END_DECLS
 
 #endif /* GTD_TASK_LIST_H */


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