aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2010-10-23 03:04:26 +0800
committerTravis Reitter <travis.reitter@collabora.co.uk>2010-10-30 00:35:09 +0800
commit0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618 (patch)
treeb10921137593a5d524fc403e14616ab88d623fb4 /src
parent4c8dc9d04de6f80c8e5406495e71d0dca9f73369 (diff)
downloadgsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.tar
gsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.tar.gz
gsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.tar.bz2
gsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.tar.lz
gsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.tar.xz
gsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.tar.zst
gsoc2013-empathy-0ff09c9c9bf89948a8e37b3c3606fc42f0d8e618.zip
Don't try to register for unique bus names in remote instances of Empathy.
This means, that remote (secondary) instances of Empathy won't try to hold the Chat or FT bus names (which will always fail. It also means that remote instances don't try to hold the GApplication (though they would release it upon exit anyhow).
Diffstat (limited to 'src')
-rw-r--r--src/empathy.c101
1 files changed, 56 insertions, 45 deletions
diff --git a/src/empathy.c b/src/empathy.c
index b2005f19c..8ef5c5d6f 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -104,6 +104,8 @@ struct _EmpathyApp
gboolean no_connect;
gboolean start_hidden;
+ gboolean activated;
+
GtkWidget *window;
EmpathyStatusIcon *icon;
EmpathyDispatcher *dispatcher;
@@ -198,16 +200,62 @@ empathy_app_set_property (GObject *object,
}
static void
+new_incoming_transfer_cb (EmpathyFTFactory *factory,
+ EmpathyFTHandler *handler,
+ GError *error,
+ gpointer user_data)
+{
+ if (error)
+ empathy_ft_manager_display_error (handler, error);
+ else
+ empathy_receive_file_with_file_chooser (handler);
+}
+
+static void
+new_ft_handler_cb (EmpathyFTFactory *factory,
+ EmpathyFTHandler *handler,
+ GError *error,
+ gpointer user_data)
+{
+ if (error)
+ empathy_ft_manager_display_error (handler, error);
+ else
+ empathy_ft_manager_add_handler (handler);
+
+ g_object_unref (handler);
+}
+
+static void
empathy_app_activate (GApplication *app)
{
EmpathyApp *self = (EmpathyApp *) app;
- /* We're requested to show stuff again, disable the start hidden global
- * in case the accounts wizard wants to pop up.
- */
- self->start_hidden = FALSE;
+ if (!self->activated)
+ {
+ GError *error = NULL;
+
+ /* Create the FT factory */
+ self->ft_factory = empathy_ft_factory_dup_singleton ();
+ g_signal_connect (self->ft_factory, "new-ft-handler",
+ G_CALLBACK (new_ft_handler_cb), NULL);
+ g_signal_connect (self->ft_factory, "new-incoming-transfer",
+ G_CALLBACK (new_incoming_transfer_cb), NULL);
+
+ if (!empathy_ft_factory_register (self->ft_factory, &error))
+ {
+ g_warning ("Failed to register FileTransfer handler: %s",
+ error->message);
+ g_error_free (error);
+ }
- g_application_hold (G_APPLICATION (app));
+ /* We're requested to show stuff again, disable the start hidden global in
+ * case the accounts wizard wants to pop up.
+ */
+ self->start_hidden = FALSE;
+
+ g_application_hold (G_APPLICATION (app));
+ self->activated = TRUE;
+ }
empathy_window_present (GTK_WINDOW (self->window));
@@ -350,32 +398,6 @@ show_version_cb (const char *option_name,
}
static void
-new_incoming_transfer_cb (EmpathyFTFactory *factory,
- EmpathyFTHandler *handler,
- GError *error,
- gpointer user_data)
-{
- if (error)
- empathy_ft_manager_display_error (handler, error);
- else
- empathy_receive_file_with_file_chooser (handler);
-}
-
-static void
-new_ft_handler_cb (EmpathyFTFactory *factory,
- EmpathyFTHandler *handler,
- GError *error,
- gpointer user_data)
-{
- if (error)
- empathy_ft_manager_display_error (handler, error);
- else
- empathy_ft_manager_add_handler (handler);
-
- g_object_unref (handler);
-}
-
-static void
account_manager_ready_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
@@ -522,7 +544,6 @@ static void
empathy_app_constructed (GObject *object)
{
EmpathyApp *self = (EmpathyApp *) object;
- GError *error = NULL;
gboolean chatroom_manager_ready;
gboolean autoaway;
@@ -593,23 +614,13 @@ empathy_app_constructed (GObject *object)
self->account_manager);
}
- /* Create the FT factory */
- self->ft_factory = empathy_ft_factory_dup_singleton ();
- g_signal_connect (self->ft_factory, "new-ft-handler",
- G_CALLBACK (new_ft_handler_cb), NULL);
- g_signal_connect (self->ft_factory, "new-incoming-transfer",
- G_CALLBACK (new_incoming_transfer_cb), NULL);
-
- if (!empathy_ft_factory_register (self->ft_factory, &error))
- {
- g_warning ("Failed to register FileTransfer handler: %s", error->message);
- g_error_free (error);
- }
-
/* Location mananger */
#ifdef HAVE_GEOCLUE
self->location_manager = empathy_location_manager_dup_singleton ();
#endif
+
+ self->activated = FALSE;
+ self->ft_factory = NULL;
}
int