aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy.c
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2008-08-02 00:03:38 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-08-02 00:03:38 +0800
commit87000e7fc6b04af2a3f0fba45aed446726129cbb (patch)
tree444fb2f405422c9bdebe0395536ed8222f151249 /src/empathy.c
parent05818c7c8a1cd622082597e3531590780c421c75 (diff)
downloadgsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.tar
gsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.tar.gz
gsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.tar.bz2
gsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.tar.lz
gsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.tar.xz
gsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.tar.zst
gsoc2013-empathy-87000e7fc6b04af2a3f0fba45aed446726129cbb.zip
Implemented showing a single accounts dialog from the command line.
If one loads empathy normally then calls "empathy -a", the accounts dialog will load under the original empathy. If one loads "empathy -a", the accounts dialog will show by itself. If one then runs "empathy -a" again, the already-shown accounts dialog will present itself. Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=1280
Diffstat (limited to 'src/empathy.c')
-rw-r--r--src/empathy.c68
1 files changed, 51 insertions, 17 deletions
diff --git a/src/empathy.c b/src/empathy.c
index 89b22b884..90ffeedff 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <errno.h>
+#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
@@ -44,6 +45,7 @@
#include <libempathy-gtk/empathy-conf.h>
+#include "empathy-accounts-dialog.h"
#include "empathy-main-window.h"
#include "empathy-status-icon.h"
#include "empathy-call-window.h"
@@ -290,25 +292,31 @@ on_bacon_message_received (const char *message,
DEBUG ("Other instance launched, presenting the main window. message='%s'",
message);
- startup_timestamp = atoi (message);
+ if (strcmp(message, "accounts") == 0) {
+ /* accounts dialog requested */
+ empathy_accounts_dialog_show (GTK_WINDOW (window), NULL);
- /* Set the proper interaction time on the window.
- * Fall back to roundtripping to the X server when we
- * don't have the timestamp, e.g. when launched from
- * terminal. We also need to make sure that the window
- * has been realized otherwise it will not work. lame. */
- if (startup_timestamp == 0) {
- /* Work if launched from the terminal */
- DEBUG ("Using X server timestamp as a fallback");
+ } else {
+ startup_timestamp = atoi (message);
+
+ /* Set the proper interaction time on the window.
+ * Fall back to roundtripping to the X server when we
+ * don't have the timestamp, e.g. when launched from
+ * terminal. We also need to make sure that the window
+ * has been realized otherwise it will not work. lame. */
+ if (startup_timestamp == 0) {
+ /* Work if launched from the terminal */
+ DEBUG ("Using X server timestamp as a fallback");
+
+ if (!GTK_WIDGET_REALIZED (window)) {
+ gtk_widget_realize (GTK_WIDGET (window));
+ }
- if (!GTK_WIDGET_REALIZED (window)) {
- gtk_widget_realize (GTK_WIDGET (window));
+ startup_timestamp = gdk_x11_get_server_time (window->window);
}
- startup_timestamp = gdk_x11_get_server_time (window->window);
+ gtk_window_present_with_time (GTK_WINDOW (window), startup_timestamp);
}
-
- gtk_window_present_with_time (GTK_WINDOW (window), startup_timestamp);
}
static guint32
@@ -361,6 +369,7 @@ main (int argc, char *argv[])
gboolean autoconnect = TRUE;
gboolean no_connect = FALSE;
gboolean hide_contact_list = FALSE;
+ gboolean accounts_dialog = FALSE;
GError *error = NULL;
GOptionEntry options[] = {
{ "no-connect", 'n',
@@ -371,6 +380,10 @@ main (int argc, char *argv[])
0, G_OPTION_ARG_NONE, &hide_contact_list,
N_("Don't show the contact list on startup"),
NULL },
+ { "accounts", 'a',
+ 0, G_OPTION_ARG_NONE, &accounts_dialog,
+ N_("Show the accounts dialog"),
+ NULL },
{ NULL }
};
@@ -405,10 +418,19 @@ main (int argc, char *argv[])
if (!bacon_message_connection_get_is_server (connection)) {
gchar *message;
- DEBUG ("Activating existing instance");
+ if (accounts_dialog) {
+ DEBUG ("Showing accounts dialog from existing Empathy instance");
+
+ message = g_strdup ("accounts");
+
+ } else {
+
+ DEBUG ("Activating existing instance");
+
+ message = g_strdup_printf ("%" G_GUINT32_FORMAT,
+ startup_timestamp);
+ }
- message = g_strdup_printf ("%" G_GUINT32_FORMAT,
- startup_timestamp);
bacon_message_connection_send (connection, message);
/* We never popup a window, so tell startup-notification
@@ -433,6 +455,18 @@ main (int argc, char *argv[])
G_CALLBACK (operation_error_cb),
NULL);
+ if (accounts_dialog) {
+ GtkWidget *dialog;
+
+ dialog = empathy_accounts_dialog_show (NULL, NULL);
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (gtk_main_quit),
+ NULL);
+
+ gtk_main ();
+ return 0;
+ }
+
/* Setting up Idle */
idle = empathy_idle_new ();
empathy_idle_set_auto_away (idle, TRUE);