[gnome-control-center] online-accounts: Restore the "add" command
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] online-accounts: Restore the "add" command
- Date: Mon, 5 Mar 2018 16:55:39 +0000 (UTC)
commit 3aa89a836a06bd037aafd5a868d9686053aa35c5
Author: Andrea Azzarone <andrea azzarone canonical com>
Date: Mon Mar 5 08:53:46 2018 +0100
online-accounts: Restore the "add" command
This reverts parts of commit 5a04e40fefb350c2f7df2e9f1eed6bce373f5cce
that don't use goa_provider_set_preseed_data.
https://bugzilla.gnome.org/show_bug.cgi?id=794012
panels/online-accounts/cc-online-accounts-panel.c | 47 ++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
---
diff --git a/panels/online-accounts/cc-online-accounts-panel.c
b/panels/online-accounts/cc-online-accounts-panel.c
index 6a7819ff8..835810003 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -303,6 +303,49 @@ sort_func (GtkListBoxRow *a,
return g_strcmp0 (goa_account_get_id (a_account), goa_account_get_id (b_account));
}
+static void
+command_add (CcGoaPanel *panel,
+ GVariant *parameters)
+{
+ GVariant *v = NULL;
+ GoaProvider *provider = NULL;
+ const gchar *provider_name = NULL;
+
+ g_assert (panel != NULL);
+ g_assert (parameters != NULL);
+
+ switch (g_variant_n_children (parameters))
+ {
+ case 2:
+ g_variant_get_child (parameters, 1, "v", &v);
+ if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
+ provider_name = g_variant_get_string (v, NULL);
+ else
+ g_warning ("Wrong type for the second argument (provider name) GVariant, expected 's' but got
'%s'",
+ (gchar *)g_variant_get_type (v));
+ g_variant_unref (v);
+ break;
+ default:
+ g_warning ("Unexpected parameters found, ignore request");
+ goto out;
+ }
+
+ if (provider_name != NULL)
+ {
+ provider = goa_provider_get_for_provider_type (provider_name);
+ if (provider == NULL)
+ {
+ g_warning ("Unable to get a provider for type '%s'", provider_name);
+ goto out;
+ }
+
+ add_account (panel, provider);
+ }
+
+out:
+ g_clear_object (&provider);
+}
+
static void
cc_goa_panel_set_property (GObject *object,
guint property_id,
@@ -331,7 +374,9 @@ cc_goa_panel_set_property (GObject *object,
g_variant_unref (v);
}
- if (first_arg != NULL)
+ if (g_strcmp0 (first_arg, "add") == 0)
+ command_add (CC_GOA_PANEL (object), parameters);
+ else if (first_arg != NULL)
select_account_by_id (CC_GOA_PANEL (object), first_arg);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]