aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-chat.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-23 17:40:21 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-23 17:40:21 +0800
commit141c0caa3b8e132466a0472caabce59549151f46 (patch)
tree2fec5c2b15d95faa8f05c46a98d9ccbd2760e29b /src/empathy-chat.c
parente218c8d18fffbba1f17dc44ba83825c7d8cdcc63 (diff)
downloadgsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.tar
gsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.tar.gz
gsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.tar.bz2
gsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.tar.lz
gsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.tar.xz
gsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.tar.zst
gsoc2013-empathy-141c0caa3b8e132466a0472caabce59549151f46.zip
empathy-chat: register the Handler when the app is activated
This avoid to raise warnings when the app is launched a second time.
Diffstat (limited to 'src/empathy-chat.c')
-rw-r--r--src/empathy-chat.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/empathy-chat.c b/src/empathy-chat.c
index 0c6406591..ebe0a9003 100644
--- a/src/empathy-chat.c
+++ b/src/empathy-chat.c
@@ -45,6 +45,8 @@ static GtkApplication *app = NULL;
static gboolean activated = FALSE;
static gboolean use_timer = TRUE;
+static EmpathyChatManager *chat_mgr = NULL;
+
static void
handled_chats_changed_cb (EmpathyChatManager *mgr,
guint nb_chats,
@@ -61,12 +63,22 @@ handled_chats_changed_cb (EmpathyChatManager *mgr,
static void
activate_cb (GApplication *application)
{
- if (!use_timer && !activated)
+ if (activated)
+ return;
+
+ activated = TRUE;
+
+ if (!use_timer)
{
/* keep a 'ref' to the application */
g_application_hold (G_APPLICATION (application));
- activated = TRUE;
}
+
+ g_assert (chat_mgr == NULL);
+ chat_mgr = empathy_chat_manager_dup_singleton ();
+
+ g_signal_connect (chat_mgr, "handled-chats-changed",
+ G_CALLBACK (handled_chats_changed_cb), GUINT_TO_POINTER (1));
}
int
@@ -81,7 +93,6 @@ main (int argc,
TpDebugSender *debug_sender;
#endif
GError *error = NULL;
- EmpathyChatManager *chat_mgr;
EmpathyIdle *idle;
gint retval;
@@ -120,11 +131,6 @@ main (int argc,
/* Setting up Idle */
idle = empathy_idle_dup_singleton ();
- chat_mgr = empathy_chat_manager_dup_singleton ();
-
- g_signal_connect (chat_mgr, "handled-chats-changed",
- G_CALLBACK (handled_chats_changed_cb), GUINT_TO_POINTER (1));
-
if (g_getenv ("EMPATHY_PERSIST") != NULL)
{
DEBUG ("Disable timer");
@@ -143,7 +149,7 @@ main (int argc,
g_object_unref (app);
g_object_unref (idle);
- g_object_unref (chat_mgr);
+ tp_clear_object (&chat_mgr);
#ifdef ENABLE_DEBUG
g_object_unref (debug_sender);