[gnome-todo/wip/selection-mode] task-list: add ::is-removable property



commit 5088d66543e8fb057aa978efc36aab0146f91d24
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Aug 22 06:49:49 2015 -0300

    task-list: add ::is-removable property
    
    In selection mode, we'll have to deal with system
    task lists that cannot be removed. As such, to detect
    which are removable or not, add ::is-removable property
    which acts as a proxy to e_source_get_removable.

 src/gtd-task-list.c |   35 +++++++++++++++++++++++++++++++++++
 src/gtd-task-list.h |    2 ++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/gtd-task-list.c b/src/gtd-task-list.c
index caea621..21fc528 100644
--- a/src/gtd-task-list.c
+++ b/src/gtd-task-list.c
@@ -53,6 +53,7 @@ enum
 {
   PROP_0,
   PROP_COLOR,
+  PROP_IS_REMOVABLE,
   PROP_NAME,
   PROP_ORIGIN,
   PROP_SOURCE,
@@ -83,6 +84,10 @@ gtd_task_list_get_property (GObject    *object,
       g_value_set_boxed (value, gtd_task_list_get_color (self));
       break;
 
+    case PROP_IS_REMOVABLE:
+      g_value_set_boolean (value, e_source_get_removable (self->priv->source));
+      break;
+
     case PROP_NAME:
       g_value_set_string (value, e_source_get_display_name (self->priv->source));
       break;
@@ -155,6 +160,20 @@ gtd_task_list_class_init (GtdTaskListClass *klass)
                             G_PARAM_READWRITE));
 
   /**
+   * GtdTaskList::is-removable:
+   *
+   * Whether the task list can be removed from the system.
+   */
+  g_object_class_install_property (
+        object_class,
+        PROP_IS_REMOVABLE,
+        g_param_spec_boolean ("is-removable",
+                              _("Whether the task list is removable"),
+                              _("Whether the task list can be removed from the system"),
+                              TRUE,
+                              G_PARAM_READABLE));
+
+  /**
    * GtdTaskList::name:
    *
    * The display name of the list.
@@ -497,3 +516,19 @@ gtd_task_list_get_origin (GtdTaskList *list)
 
   return list->priv->origin;
 }
+
+/**
+ * gtd_task_list_get_is_removable:
+ * @list: a #GtdTaskList
+ *
+ * Retrieves whether @list can be removed or not.
+ *
+ * Returns: %TRUE if the @list can be removed, %FALSE otherwise
+ */
+gboolean
+gtd_task_list_is_removable (GtdTaskList *list)
+{
+  g_return_val_if_fail (GTD_IS_TASK_LIST (list), FALSE);
+
+  return e_source_get_removable (list->priv->source);
+}
diff --git a/src/gtd-task-list.h b/src/gtd-task-list.h
index ae7446c..9ca671c 100644
--- a/src/gtd-task-list.h
+++ b/src/gtd-task-list.h
@@ -40,6 +40,8 @@ GdkRGBA*                gtd_task_list_get_color                 (GtdTaskList
 void                    gtd_task_list_set_color                 (GtdTaskList            *list,
                                                                  const GdkRGBA          *color);
 
+gboolean                gtd_task_list_is_removable              (GtdTaskList            *list);
+
 const gchar*            gtd_task_list_get_name                  (GtdTaskList            *list);
 
 void                    gtd_task_list_set_name                  (GtdTaskList            *list,


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