[gnome-online-accounts] backend: Add goa_object_skeleton_attach_files helper



commit 256bf49c72e45f4d6ad0d66e937d876068b6e20b
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Sun May 3 11:45:22 2015 +0200

    backend: Add goa_object_skeleton_attach_files helper
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761510

 src/goabackend/goaobjectskeletonutils.c |   29 +++++++++++++++++++++++++++++
 src/goabackend/goaobjectskeletonutils.h |    5 +++++
 2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/src/goabackend/goaobjectskeletonutils.c b/src/goabackend/goaobjectskeletonutils.c
index f60e20c..48ae0c7 100644
--- a/src/goabackend/goaobjectskeletonutils.c
+++ b/src/goabackend/goaobjectskeletonutils.c
@@ -50,3 +50,32 @@ goa_object_skeleton_attach_calendar (GoaObjectSkeleton *object,
     }
   g_clear_object (&calendar);
 }
+
+void
+goa_object_skeleton_attach_files (GoaObjectSkeleton *object,
+                                  const gchar       *uri,
+                                  gboolean           files_enabled,
+                                  gboolean           accept_ssl_errors)
+{
+  GoaFiles *files;
+
+  files = goa_object_get_files (GOA_OBJECT (object));
+  if (files_enabled)
+    {
+      if (files == NULL)
+        {
+          files = goa_files_skeleton_new ();
+          g_object_set (G_OBJECT (files),
+                        "accept-ssl-errors", accept_ssl_errors,
+                        "uri", uri,
+                        NULL);
+          goa_object_skeleton_set_files (object, files);
+        }
+    }
+  else
+    {
+      if (files != NULL)
+        goa_object_skeleton_set_files (object, NULL);
+    }
+  g_clear_object (&files);
+}
diff --git a/src/goabackend/goaobjectskeletonutils.h b/src/goabackend/goaobjectskeletonutils.h
index bce621a..617c629 100644
--- a/src/goabackend/goaobjectskeletonutils.h
+++ b/src/goabackend/goaobjectskeletonutils.h
@@ -33,6 +33,11 @@ void             goa_object_skeleton_attach_calendar       (GoaObjectSkeleton *o
                                                             gboolean           calendar_enabled,
                                                             gboolean           accept_ssl_errors);
 
+void             goa_object_skeleton_attach_files          (GoaObjectSkeleton *object,
+                                                            const gchar       *uri,
+                                                            gboolean           files_enabled,
+                                                            gboolean           accept_ssl_errors);
+
 G_END_DECLS
 
 #endif /* __GOA_OBJECT_SKELETON_UTILS_H__ */


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