[gnome-online-accounts] daemon: Allow account ID to be provided for new accounts



commit c937494a689d343f67d672e5a550d9bcfe9e7210
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Oct 1 10:05:09 2014 -0400

    daemon: Allow account ID to be provided for new accounts
    
    org.gnome.OnlineAccounts.Manager.AddAccount will now check for an 'Id'
    key in the 'details' argument, and use that as the account ID (aka the
    group name in the accounts.conf key file). If absent, an account ID is
    generated same as before.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737721

 src/daemon/goadaemon.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index 61d9ee6..73e8f70 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -822,7 +822,9 @@ get_all_providers_cb (GObject      *source,
         }
     }
 
-  id = generate_new_id (data->daemon);
+  if (!g_variant_lookup (data->details, "Id", "s", &id))
+    id = generate_new_id (data->daemon);
+
   group = g_strdup_printf ("Account %s", id);
   g_key_file_set_string (key_file, group, "Provider", data->provider_type);
   g_key_file_set_string (key_file, group, "Identity", data->identity);
@@ -846,6 +848,10 @@ get_all_providers_cb (GObject      *source,
             }
         }
 
+      /* Skip Id since we already handled it above. */
+      if (g_strcmp0 (key, "Id") == 0)
+        continue;
+
       g_key_file_set_string (key_file, group, key, value);
     }
 


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