aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-accounts-dialog.c
diff options
context:
space:
mode:
authorTravis Reitter <treitter@gmail.com>2010-02-12 07:09:32 +0800
committerTravis Reitter <treitter@gmail.com>2010-02-12 07:19:54 +0800
commit2aa506e8a17ef67ddf43ee716b21afc780a9d0d2 (patch)
tree53d9c41aa9ab11296b5a0a3f739ced1b21b7b87d /src/empathy-accounts-dialog.c
parent1abde726f2920d166728b79cc6e2cdc5e72ea1df (diff)
downloadgsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.tar
gsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.tar.gz
gsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.tar.bz2
gsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.tar.lz
gsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.tar.xz
gsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.tar.zst
gsoc2013-empathy-2aa506e8a17ef67ddf43ee716b21afc780a9d0d2.zip
Separate the accounts dialog into its own program which works with the Gnome preferences and control center.
Where available, this also supports embedding the preferences dialog in the "extensible-shell" control center (currently in development, but likely to be mainlined soon).
Diffstat (limited to 'src/empathy-accounts-dialog.c')
-rw-r--r--src/empathy-accounts-dialog.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 39e20d860..57456bae4 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -33,6 +33,7 @@
#include <dbus/dbus-glib.h>
#include <telepathy-glib/account-manager.h>
+#include <telepathy-glib/defs.h>
#include <telepathy-glib/util.h>
#include <libempathy/empathy-utils.h>
@@ -1890,6 +1891,8 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
NULL);
g_free (filename);
+ gtk_widget_set_no_show_all (priv->frame_no_protocol, TRUE);
+
empathy_builder_connect (gui, dialog,
"button_add", "clicked", accounts_dialog_button_add_clicked_cb,
"button_remove", "clicked", accounts_dialog_button_remove_clicked_cb,
@@ -2207,3 +2210,56 @@ empathy_accounts_dialog_show (GtkWindow *parent,
return GTK_WIDGET (dialog);
}
+
+void
+empathy_accounts_dialog_show_application (GdkScreen *screen,
+ GChildWatchFunc application_exit_cb,
+ gpointer user_data,
+ TpAccount *selected_account,
+ gboolean try_import,
+ gboolean hidden)
+{
+ gint command_pid;
+ GError *error = NULL;
+ gchar *argv[4] = { NULL, };
+ gint i = 0;
+ gchar *account_option = NULL;
+
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (!selected_account || TP_IS_ACCOUNT (selected_account));
+
+ argv[i++] = "empathy-accounts";
+
+ if (selected_account)
+ {
+ const gchar *account_path;
+
+ account_path = tp_proxy_get_object_path (TP_PROXY (selected_account));
+ account_option = g_strdup_printf ("--select-account=%s",
+ &account_path[strlen (TP_ACCOUNT_OBJECT_PATH_BASE)]);
+
+ argv[i++] = account_option;
+ }
+
+ if (try_import)
+ argv[i++] = "--import";
+
+ if (hidden)
+ argv[i++] = "--hidden";
+
+ gdk_spawn_on_screen (screen, NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL,
+ &command_pid, &error);
+ if (error)
+ {
+ g_warning ("Failed to open accounts dialog: %s", error->message);
+ g_error_free (error);
+ }
+
+ /* XXX: unportable cast to GPid; then again, gdk_spawn_on_screen() seems
+ * unportable since it always takes a gint* for the PID */
+ if (application_exit_cb)
+ g_child_watch_add ((GPid) command_pid, application_exit_cb, NULL);
+
+ g_free (account_option);
+}