[gnome-todo/wip/gbsneto/plugins] task-list: fix ::is-removable property
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/plugins] task-list: fix ::is-removable property
- Date: Mon, 4 Jan 2016 13:55:24 +0000 (UTC)
commit 6af5724f9219669780de8e927f477ad9d87b7c75
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jan 4 03:58:57 2016 -0200
task-list: fix ::is-removable property
It was unfinished and useless up to now.
plugins/eds/gtd-task-list-eds.c | 23 +++++++++++++++++++++++
src/gtd-task-list.c | 26 ++++++++++++++++++++++++--
src/gtd-task-list.h | 3 +++
3 files changed, 50 insertions(+), 2 deletions(-)
---
diff --git a/plugins/eds/gtd-task-list-eds.c b/plugins/eds/gtd-task-list-eds.c
index d10a1c0..daa3d10 100644
--- a/plugins/eds/gtd-task-list-eds.c
+++ b/plugins/eds/gtd-task-list-eds.c
@@ -38,6 +38,14 @@ enum {
};
static void
+source_removable_changed (GtdTaskListEds *list)
+{
+ gtd_task_list_set_is_removable (GTD_TASK_LIST (list),
+ e_source_get_removable (list->source) ||
+ e_source_get_remote_deletable (list->source));
+}
+
+static void
save_task_list_finished_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
@@ -253,6 +261,21 @@ gtd_task_list_eds_set_source (GtdTaskListEds *list,
G_CALLBACK (save_task_list),
list);
+ /* Update ::is-removable property */
+ gtd_task_list_set_is_removable (GTD_TASK_LIST (list),
+ e_source_get_removable (source) ||
+ e_source_get_remote_deletable (source));
+
+ g_signal_connect_swapped (source,
+ "notify::removable",
+ G_CALLBACK (source_removable_changed),
+ list);
+
+ g_signal_connect_swapped (source,
+ "notify::remote-deletable",
+ G_CALLBACK (source_removable_changed),
+ list);
+
g_object_notify (G_OBJECT (list), "source");
}
}
diff --git a/src/gtd-task-list.c b/src/gtd-task-list.c
index f79bfcf..660ad23 100644
--- a/src/gtd-task-list.c
+++ b/src/gtd-task-list.c
@@ -115,6 +115,10 @@ gtd_task_list_set_property (GObject *object,
gtd_task_list_set_color (self, g_value_get_boxed (value));
break;
+ case PROP_IS_REMOVABLE:
+ gtd_task_list_set_is_removable (self, g_value_get_boolean (value));
+ break;
+
case PROP_NAME:
gtd_task_list_set_name (self, g_value_get_string (value));
break;
@@ -163,8 +167,8 @@ gtd_task_list_class_init (GtdTaskListClass *klass)
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));
+ FALSE,
+ G_PARAM_READWRITE));
/**
* GtdTaskList::name:
@@ -515,3 +519,21 @@ gtd_task_list_is_removable (GtdTaskList *list)
return priv->removable;
}
+
+void
+gtd_task_list_set_is_removable (GtdTaskList *list,
+ gboolean is_removable)
+{
+ GtdTaskListPrivate *priv;
+
+ g_return_if_fail (GTD_IS_TASK_LIST (list));
+
+ priv = gtd_task_list_get_instance_private (list);
+
+ if (priv->removable != is_removable)
+ {
+ priv->removable = is_removable;
+
+ g_object_notify (G_OBJECT (list), "is-removable");
+ }
+}
diff --git a/src/gtd-task-list.h b/src/gtd-task-list.h
index 4064747..f62659e 100644
--- a/src/gtd-task-list.h
+++ b/src/gtd-task-list.h
@@ -56,6 +56,9 @@ void gtd_task_list_set_color (GtdTaskList
gboolean gtd_task_list_is_removable (GtdTaskList *list);
+void gtd_task_list_set_is_removable (GtdTaskList *list,
+ gboolean is_removable);
+
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]