online-accounts: Restore the "add" command
This reverts parts of commit 5a04e40fef
that don't use goa_provider_set_preseed_data.
https://bugzilla.gnome.org/show_bug.cgi?id=794012
This commit is contained in:
parent
5663a8189c
commit
3aa89a836a
1 changed files with 46 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue