aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-08-03 20:51:40 +0800
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-08-15 20:37:34 +0800
commit92ab370c49411dede5d52f402220cc4bb0bd2e68 (patch)
treefb5f164fc0e35e66f4bbcefdfe1dedb659748794 /src
parent1a3c57d235bd751c4e120266cd3f24ad6afd7a8a (diff)
downloadgsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.tar
gsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.tar.gz
gsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.tar.bz2
gsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.tar.lz
gsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.tar.xz
gsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.tar.zst
gsoc2013-empathy-92ab370c49411dede5d52f402220cc4bb0bd2e68.zip
accounts-dialog: invoke the UOA panel if needed
https://bugzilla.gnome.org/show_bug.cgi?id=680778
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 1023bac15..77d299a34 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -2595,6 +2595,92 @@ empathy_accounts_dialog_show (GtkWindow *parent,
return GTK_WIDGET (dialog);
}
+#ifdef HAVE_UOA
+typedef struct
+{
+ TpAccount *account;
+ gboolean if_needed;
+} LaunchUOACtx;
+
+static LaunchUOACtx *
+launch_uoa_ctx_new (TpAccount *account,
+ gboolean if_needed)
+{
+ LaunchUOACtx *ctx;
+
+ ctx = g_slice_new0 (LaunchUOACtx);
+ if (account != NULL)
+ ctx->account = g_object_ref (account);
+ ctx->if_needed = if_needed;
+
+ return ctx;
+}
+
+static void
+launch_uoa_ctx_free (LaunchUOACtx *ctx)
+{
+ g_clear_object (&ctx->account);
+ g_slice_free (LaunchUOACtx, ctx);
+}
+
+static void
+am_prepare_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ TpAccountManager *manager = TP_ACCOUNT_MANAGER (source);
+ GError *error = NULL;
+ LaunchUOACtx *ctx = user_data;
+ gchar *args = NULL;
+
+ if (!tp_proxy_prepare_finish (manager, result, &error))
+ {
+ DEBUG ("Failed to prepare account manager: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ if (ctx->if_needed && empathy_accounts_has_non_salut_accounts (manager))
+ goto out;
+
+ if (ctx->account != NULL)
+ {
+ const GValue *value;
+
+ value = tp_account_get_storage_identifier (ctx->account);
+
+ if (G_VALUE_HOLDS_UINT (value))
+ args = g_strdup_printf ("account-details=%u", g_value_get_uint (value));
+ }
+
+ empathy_launch_external_app ("gnome-credentials-panel.desktop", args, NULL);
+
+ g_free (args);
+out:
+ launch_uoa_ctx_free (ctx);
+}
+
+static void
+launch_uoa_panel (TpAccount *selected_account,
+ gboolean if_needed,
+ gboolean hidden)
+{
+ TpAccountManager *manager;
+
+ if (hidden)
+ /* Nothing to do */
+ return;
+
+ manager = tp_account_manager_dup ();
+
+ tp_proxy_prepare_async (manager, NULL, am_prepare_cb,
+ launch_uoa_ctx_new (selected_account, if_needed));
+
+ g_object_unref (manager);
+}
+
+#else /* HAVE_UOA */
+
static void
launch_empathy_accounts (TpAccount *selected_account,
gboolean if_needed,
@@ -2625,6 +2711,7 @@ launch_empathy_accounts (TpAccount *selected_account,
g_string_free (args, TRUE);
}
+#endif /* HAVE_UOA */
void
empathy_accounts_dialog_show_application (GdkScreen *screen,
@@ -2632,7 +2719,11 @@ empathy_accounts_dialog_show_application (GdkScreen *screen,
gboolean if_needed,
gboolean hidden)
{
+#ifdef HAVE_UOA
+ launch_uoa_panel (selected_account, if_needed, hidden);
+#else
launch_empathy_accounts (selected_account, if_needed, hidden);
+#endif
}
gboolean