[gnome-online-accounts] facebook: Add support for maps



commit bca919698f13aba3291afc4765a95211579fdb68
Author: Damián Nohales <damiannohales gmail com>
Date:   Mon May 19 14:31:44 2014 +0200

    facebook: Add support for maps
    
    A new org.gnome.OnlineAccounts.Maps was introduced to denote accounts
    that can be used with maps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729740

 data/dbus-interfaces.xml             |   22 ++++++++++++++++
 doc/goa-docs.xml                     |    2 +
 doc/goa-sections.txt                 |   46 +++++++++++++++++++++++++++++++++
 src/goabackend/goabackendenums.h     |    2 +
 src/goabackend/goafacebookprovider.c |   47 +++++++++++++++++++++++++++++++--
 5 files changed, 116 insertions(+), 3 deletions(-)
---
diff --git a/data/dbus-interfaces.xml b/data/dbus-interfaces.xml
index 750c5b7..01332a7 100644
--- a/data/dbus-interfaces.xml
+++ b/data/dbus-interfaces.xml
@@ -162,6 +162,18 @@
     -->
     <property name="DocumentsDisabled" type="b" access="readwrite"/>
 
+    <!-- MapsDisabled:
+         @since: 3.14.0
+
+         If %TRUE, the account will not expose any
+         #org.gnome.OnlineAccounts.Maps interface. If the account does not
+         provide maps-like capabilities, this property does nothing.
+
+         Note that the #org.gnomeOnlineAccounts.Maps interface is added or
+         removed from the account asynchronously.
+    -->
+    <property name="MapsDisabled" type="b" access="readwrite"/>
+
     <!-- PrintersDisabled:
          @since: 3.12.0
 
@@ -609,6 +621,16 @@
   </interface>
 
   <!--
+      org.gnome.OnlineAccounts.Maps:
+      @since: 3.14.0
+
+      An account object implements this interface if it provides
+      maps-like capabilities.
+  -->
+  <interface name="org.gnome.OnlineAccounts.Maps">
+  </interface>
+
+  <!--
       org.gnome.OnlineAccounts.Photos:
       @since: 3.8.0
 
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 6567b0e..cd2a854 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -121,6 +121,7 @@
       <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Contacts.xml"/>
       <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Chat.xml"/>
       <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Documents.xml"/>
+      <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Maps.xml"/>
       <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Photos.xml"/>
       <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Files.xml"/>
       <xi:include href="../src/goa/goa-generated-doc-org.gnome.OnlineAccounts.Exchange.xml"/>
@@ -147,6 +148,7 @@
       <xi:include href="xml/GoaContacts.xml"/>
       <xi:include href="xml/GoaChat.xml"/>
       <xi:include href="xml/GoaDocuments.xml"/>
+      <xi:include href="xml/GoaMaps.xml"/>
       <xi:include href="xml/GoaPhotos.xml"/>
       <xi:include href="xml/GoaFiles.xml"/>
       <xi:include href="xml/GoaExchange.xml"/>
diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
index 7f46754..11d679d 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -57,6 +57,7 @@ goa_object_get_calendar
 goa_object_get_contacts
 goa_object_get_chat
 goa_object_get_documents
+goa_object_get_maps
 goa_object_get_photos
 goa_object_get_files
 goa_object_get_exchange
@@ -69,6 +70,7 @@ goa_object_peek_calendar
 goa_object_peek_contacts
 goa_object_peek_chat
 goa_object_peek_documents
+goa_object_peek_maps
 goa_object_peek_photos
 goa_object_peek_files
 goa_object_peek_exchange
@@ -87,6 +89,7 @@ goa_object_skeleton_set_calendar
 goa_object_skeleton_set_contacts
 goa_object_skeleton_set_chat
 goa_object_skeleton_set_documents
+goa_object_skeleton_set_maps
 goa_object_skeleton_set_photos
 goa_object_skeleton_set_files
 goa_object_skeleton_set_exchange
@@ -150,6 +153,8 @@ goa_account_get_chat_disabled
 goa_account_set_chat_disabled
 goa_account_get_documents_disabled
 goa_account_set_documents_disabled
+goa_account_get_maps_disabled
+goa_account_set_maps_disabled
 goa_account_get_photos_disabled
 goa_account_set_photos_disabled
 goa_account_get_files_disabled
@@ -873,6 +878,47 @@ goa_documents_skeleton_get_type
 </SECTION>
 
 <SECTION>
+<FILE>GoaMaps</FILE>
+GoaMaps
+GoaMapsIface
+goa_maps_interface_info
+goa_maps_override_properties
+GoaMapsProxy
+GoaMapsProxyClass
+goa_maps_proxy_new
+goa_maps_proxy_new_finish
+goa_maps_proxy_new_sync
+goa_maps_proxy_new_for_bus
+goa_maps_proxy_new_for_bus_finish
+goa_maps_proxy_new_for_bus_sync
+GoaMapsSkeleton
+GoaMapsSkeletonClass
+goa_maps_skeleton_new
+<SUBSECTION Standard>
+GOA_TYPE_MAPS
+GOA_IS_MAPS
+GOA_MAPS
+GOA_MAPS_GET_IFACE
+GOA_TYPE_MAPS_PROXY
+GOA_IS_MAPS_PROXY
+GOA_IS_MAPS_PROXY_CLASS
+GOA_MAPS_PROXY
+GOA_MAPS_PROXY_CLASS
+GOA_MAPS_PROXY_GET_CLASS
+GOA_TYPE_MAPS_SKELETON
+GOA_IS_MAPS_SKELETON
+GOA_IS_MAPS_SKELETON_CLASS
+GOA_MAPS_SKELETON
+GOA_MAPS_SKELETON_CLASS
+GOA_MAPS_SKELETON_GET_CLASS
+GoaMapsProxyPrivate
+GoaMapsSkeletonPrivate
+goa_maps_get_type
+goa_maps_proxy_get_type
+goa_maps_skeleton_get_type
+</SECTION>
+
+<SECTION>
 <FILE>GoaPhotos</FILE>
 GoaPhotos
 GoaPhotosIface
diff --git a/src/goabackend/goabackendenums.h b/src/goabackend/goabackendenums.h
index 6ac3d26..b333d08 100644
--- a/src/goabackend/goabackendenums.h
+++ b/src/goabackend/goabackendenums.h
@@ -66,6 +66,7 @@ typedef enum
  * @GOA_PROVIDER_FEATURE_FILES: Files storage services (ie. WebDAV).
  * @GOA_PROVIDER_FEATURE_TICKETING: Ticketing services (ie. Kerberos).
  * @GOA_PROVIDER_FEATURE_PRINTERS: Network printing services (e.g. Google Cloud Print).
+ * @GOA_PROVIDER_FEATURE_MAPS: Maps related services (e.g. Foursquare, Facebook).
  * @GOA_PROVIDER_FEATURE_INVALID: Used for error handling. No provider
  *   should provide this feature.
  *
@@ -89,6 +90,7 @@ typedef enum /*< flags >*/
   GOA_PROVIDER_FEATURE_TICKETING = 1 << 9,
   GOA_PROVIDER_FEATURE_READ_LATER= 1 << 10,
   GOA_PROVIDER_FEATURE_PRINTERS  = 1 << 11,
+  GOA_PROVIDER_FEATURE_MAPS      = 1 << 12,
   GOA_PROVIDER_FEATURE_INVALID   = 0
 } GoaProviderFeatures;
 
diff --git a/src/goabackend/goafacebookprovider.c b/src/goabackend/goafacebookprovider.c
index 85f3a08..f39c2d6 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -85,7 +85,10 @@ get_provider_group (GoaProvider *_provider)
 static GoaProviderFeatures
 get_provider_features (GoaProvider *_provider)
 {
-  return GOA_PROVIDER_FEATURE_BRANDED | GOA_PROVIDER_FEATURE_CHAT | GOA_PROVIDER_FEATURE_PHOTOS;
+  return GOA_PROVIDER_FEATURE_BRANDED |
+         GOA_PROVIDER_FEATURE_CHAT |
+         GOA_PROVIDER_FEATURE_PHOTOS |
+         GOA_PROVIDER_FEATURE_MAPS;
 }
 
 /* facebook client flow sends a different auth query then the base
@@ -134,13 +137,15 @@ get_scope (GoaOAuth2Provider *provider)
     "read_mailbox,"
     "xmpp_login,"
     "email,"
-    "user_photos";
+    "user_photos,"
+    "user_status,"
+    "publish_actions";
 }
 
 static guint
 get_credentials_generation (GoaProvider *provider)
 {
-  return 1;
+  return 2;
 }
 
 static const gchar *
@@ -326,8 +331,10 @@ build_object (GoaProvider         *provider,
   GoaAccount *account;
   GoaChat *chat = NULL;
   GoaPhotos *photos = NULL;
+  GoaMaps *maps = NULL;
   gboolean chat_enabled;
   gboolean photos_enabled;
+  gboolean maps_enabled;
   gboolean ret = FALSE;
 
   account = NULL;
@@ -398,6 +405,33 @@ build_object (GoaProvider         *provider,
                         "PhotosEnabled");
     }
 
+  /* Maps */
+  maps = goa_object_get_maps (GOA_OBJECT (object));
+  maps_enabled = g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL);
+
+  if (maps_enabled)
+    {
+      if (maps == NULL)
+        {
+          maps = goa_maps_skeleton_new ();
+          goa_object_skeleton_set_maps (object, maps);
+        }
+    }
+  else
+    {
+      if (maps != NULL)
+        goa_object_skeleton_set_maps (object, NULL);
+    }
+
+  if (just_added)
+    {
+      goa_account_set_maps_disabled (account, !maps_enabled);
+      g_signal_connect (account,
+                        "notify::maps-disabled",
+                        G_CALLBACK (goa_util_account_notify_property_cb),
+                        "MapsEnabled");
+    }
+
   ret = TRUE;
 
  out:
@@ -406,6 +440,7 @@ build_object (GoaProvider         *provider,
   if (account != NULL)
     g_object_unref (account);
   g_clear_object (&photos);
+  g_clear_object (&maps);
   return ret;
 }
 
@@ -436,6 +471,11 @@ show_account (GoaProvider         *provider,
                                                    NULL,
                                                    "photos-disabled",
                                                    _("_Photos"));
+
+  goa_util_add_row_switch_from_keyfile_with_blurb (grid, row++, object,
+                                                   NULL,
+                                                   "maps-disabled",
+                                                   _("_Maps"));
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -446,6 +486,7 @@ add_account_key_values (GoaOAuth2Provider *provider,
 {
   g_variant_builder_add (builder, "{ss}", "ChatEnabled", "true");
   g_variant_builder_add (builder, "{ss}", "PhotosEnabled", "true");
+  g_variant_builder_add (builder, "{ss}", "MapsEnabled", "true");
 }
 
 /* ---------------------------------------------------------------------------------------------------- */


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