[gnome-todo/wip/gbsneto/plugins] project: various fixes



commit 5c472baa3637553721ba77a2eb4277b390b6391e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Jan 4 16:08:06 2016 -0200

    project: various fixes
    
    Fixes small coding errors here and there.

 data/ui/list-selector-panel.ui  |    2 +-
 plugins/eds/gtd-provider-eds.c  |   38 +++++++++++++++++++++++++-------------
 plugins/eds/gtd-task-list-eds.c |   17 ++++++++++-------
 3 files changed, 36 insertions(+), 21 deletions(-)
---
diff --git a/data/ui/list-selector-panel.ui b/data/ui/list-selector-panel.ui
index b2c0f3b..40198ad 100644
--- a/data/ui/list-selector-panel.ui
+++ b/data/ui/list-selector-panel.ui
@@ -91,7 +91,7 @@
                 <property name="sensitive">False</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <signal name="clicked" handler="gtd_list_selector_panel_delete_button_clicked" 
object="GtdListSelectorPanel" swapped="no" />
+                <signal name="clicked" handler="gtd_list_selector_panel_delete_button_clicked" 
object="GtdListSelectorPanel" swapped="yes" />
                 <style>
                   <class name="destructive-action"/>
                 </style>
diff --git a/plugins/eds/gtd-provider-eds.c b/plugins/eds/gtd-provider-eds.c
index 33aec2c..f008350 100644
--- a/plugins/eds/gtd-provider-eds.c
+++ b/plugins/eds/gtd-provider-eds.c
@@ -626,11 +626,11 @@ gtd_provider_eds_remote_create_source_finished (GObject      *source,
 }
 
 static void
-task_list_removal_finished (GtdManager  *manager,
+task_list_removal_finished (GtdProvider *provider,
                             ESource     *source,
                             GError     **error)
 {
-  gtd_object_set_ready (GTD_OBJECT (manager), TRUE);
+  gtd_object_set_ready (GTD_OBJECT (provider), TRUE);
 
   if (*error)
     {
@@ -658,7 +658,7 @@ gtd_provider_eds_remote_delete_finished (GObject      *source,
                                  result,
                                  &error);
 
-  task_list_removal_finished (GTD_MANAGER (user_data),
+  task_list_removal_finished (GTD_PROVIDER (user_data),
                               E_SOURCE (source),
                               &error);
 }
@@ -674,7 +674,7 @@ gtd_provider_eds_remove_source_finished (GObject      *source,
                           result,
                           &error);
 
-  task_list_removal_finished (GTD_MANAGER (user_data),
+  task_list_removal_finished (GTD_PROVIDER (user_data),
                               E_SOURCE (source),
                               &error);
 }
@@ -686,7 +686,7 @@ gtd_provider_eds_commit_source_finished (GObject      *registry,
 {
   GError *error = NULL;
 
-  g_return_if_fail (GTD_IS_MANAGER (user_data));
+  g_return_if_fail (GTD_IS_PROVIDER_EDS (user_data));
 
   gtd_object_set_ready (GTD_OBJECT (user_data), TRUE);
   e_source_registry_commit_source_finish (E_SOURCE_REGISTRY (registry),
@@ -893,22 +893,34 @@ gtd_provider_eds_create_task_list (GtdProviderEds *provider,
 {
   GtdProviderEdsPrivate *priv;
   ESource *source;
-  ESource *parent;
 
   g_return_if_fail (GTD_IS_TASK_LIST_EDS (list));
   g_return_if_fail (gtd_task_list_eds_get_source (GTD_TASK_LIST_EDS (list)));
 
   priv = gtd_provider_eds_get_instance_private (provider);
   source = gtd_task_list_eds_get_source (GTD_TASK_LIST_EDS (list));
-  parent = e_source_registry_ref_source (priv->source_registry, e_source_get_parent (source));
 
-  e_source_remote_create (parent,
-                          source,
-                          NULL,
-                          (GAsyncReadyCallback) gtd_provider_eds_remote_create_source_finished,
-                          provider);
+  gtd_object_set_ready (GTD_OBJECT (provider), FALSE);
+  e_source_registry_commit_source (priv->source_registry,
+                                   source,
+                                   NULL,
+                                   (GAsyncReadyCallback) gtd_provider_eds_commit_source_finished,
+                                   provider);
 
-  g_object_unref (parent);
+  if (e_source_get_remote_creatable (source))
+    {
+      ESource *parent;
+
+      parent = e_source_registry_ref_source (priv->source_registry, e_source_get_parent (source));
+
+      e_source_remote_create (parent,
+                              source,
+                              NULL,
+                              (GAsyncReadyCallback) gtd_provider_eds_remote_create_source_finished,
+                              provider);
+
+      g_object_unref (parent);
+    }
 }
 
 void
diff --git a/plugins/eds/gtd-task-list-eds.c b/plugins/eds/gtd-task-list-eds.c
index daa3d10..677c6a0 100644
--- a/plugins/eds/gtd-task-list-eds.c
+++ b/plugins/eds/gtd-task-list-eds.c
@@ -75,15 +75,18 @@ save_task_list_finished_cb (GObject      *source,
 static void
 save_task_list (GtdTaskListEds *list)
 {
-  if (!list->cancellable)
-    list->cancellable = g_cancellable_new ();
+  if (e_source_get_writable (list->source))
+    {
+      if (!list->cancellable)
+        list->cancellable = g_cancellable_new ();
 
-  gtd_object_set_ready (GTD_OBJECT (list), FALSE);
+      gtd_object_set_ready (GTD_OBJECT (list), FALSE);
 
-  e_source_write (list->source,
-                  list->cancellable,
-                  save_task_list_finished_cb,
-                  list);
+      e_source_write (list->source,
+                      list->cancellable,
+                      save_task_list_finished_cb,
+                      list);
+    }
 }
 static gboolean
 color_to_string (GBinding     *binding,


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