]> git.0d.be Git - empathy.git/blob - src/empathy.c
acfdcb13ea31ab5316f90ae1fccef90db06694e2
[empathy.git] / src / empathy.c
1 /*
2  * Copyright (C) 2007-2009 Collabora Ltd.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA  02110-1301  USA
18  *
19  * Authors: Xavier Claessens <xclaesse@gmail.com>
20  */
21
22 #include <config.h>
23
24 #include <stdlib.h>
25 #include <errno.h>
26 #include <string.h>
27
28 #include <glib.h>
29 #include <glib/gi18n.h>
30 #include <gtk/gtk.h>
31 #include <gdk/gdkx.h>
32 #include <unique/unique.h>
33
34 #if HAVE_LIBCHAMPLAIN
35 #include <clutter-gtk/clutter-gtk.h>
36 #endif
37
38 #include <libebook/e-book.h>
39 #include <libnotify/notify.h>
40
41 #include <telepathy-glib/dbus.h>
42 #include <telepathy-glib/util.h>
43 #include <telepathy-glib/connection-manager.h>
44 #include <telepathy-glib/interfaces.h>
45
46 #include <libempathy/empathy-idle.h>
47 #include <libempathy/empathy-utils.h>
48 #include <libempathy/empathy-call-factory.h>
49 #include <libempathy/empathy-chatroom-manager.h>
50 #include <libempathy/empathy-account-settings.h>
51 #include <libempathy/empathy-connectivity.h>
52 #include <libempathy/empathy-account-manager.h>
53 #include <libempathy/empathy-connection-managers.h>
54 #include <libempathy/empathy-debugger.h>
55 #include <libempathy/empathy-dispatcher.h>
56 #include <libempathy/empathy-dispatch-operation.h>
57 #include <libempathy/empathy-log-manager.h>
58 #include <libempathy/empathy-ft-factory.h>
59 #include <libempathy/empathy-tp-chat.h>
60 #include <libempathy/empathy-tp-call.h>
61
62 #include <libempathy-gtk/empathy-conf.h>
63 #include <libempathy-gtk/empathy-ui-utils.h>
64 #include <libempathy-gtk/empathy-location-manager.h>
65
66 #include "empathy-account-assistant.h"
67 #include "empathy-accounts-dialog.h"
68 #include "empathy-main-window.h"
69 #include "empathy-status-icon.h"
70 #include "empathy-call-window.h"
71 #include "empathy-chat-window.h"
72 #include "empathy-ft-manager.h"
73
74 #include "extensions/extensions.h"
75
76 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
77 #include <libempathy/empathy-debug.h>
78
79 #include <gst/gst.h>
80
81 #define COMMAND_ACCOUNTS_DIALOG 1
82
83 static void
84 dispatch_cb (EmpathyDispatcher *dispatcher,
85     EmpathyDispatchOperation *operation,
86     gpointer user_data)
87 {
88   GQuark channel_type;
89
90   channel_type = empathy_dispatch_operation_get_channel_type_id (operation);
91
92   if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT)
93     {
94       EmpathyTpChat *tp_chat;
95       EmpathyChat   *chat = NULL;
96       const gchar   *id;
97
98       tp_chat = EMPATHY_TP_CHAT
99         (empathy_dispatch_operation_get_channel_wrapper (operation));
100
101       id = empathy_tp_chat_get_id (tp_chat);
102       if (!id)
103         {
104           EmpathyContact *contact;
105
106           contact = empathy_tp_chat_get_remote_contact (tp_chat);
107           if (contact)
108             id = empathy_contact_get_id (contact);
109         }
110
111       if (id)
112         {
113           EmpathyAccountManager *manager;
114           TpConnection *connection;
115           EmpathyAccount *account;
116
117           manager = empathy_account_manager_dup_singleton ();
118           connection = empathy_tp_chat_get_connection (tp_chat);
119           account = empathy_account_manager_get_account_for_connection (manager,
120               connection);
121           chat = empathy_chat_window_find_chat (account, id);
122           g_object_unref (manager);
123         }
124
125       if (chat)
126         empathy_chat_set_tp_chat (chat, tp_chat);
127       else
128         chat = empathy_chat_new (tp_chat);
129
130       empathy_chat_window_present_chat (chat);
131
132       empathy_dispatch_operation_claim (operation);
133     }
134   else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA)
135     {
136       EmpathyCallFactory *factory;
137
138       factory = empathy_call_factory_get ();
139       empathy_call_factory_claim_channel (factory, operation);
140     }
141   else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER)
142     {
143       EmpathyFTFactory *factory;
144
145       factory = empathy_ft_factory_dup_singleton ();
146
147       /* if the operation is not incoming, don't claim it,
148        * as it might have been triggered by another client, and
149        * we are observing it.
150        */
151       if (empathy_dispatch_operation_is_incoming (operation))
152         empathy_ft_factory_claim_channel (factory, operation);
153     }
154 }
155
156 /* Salut account creation */
157 static gboolean
158 should_create_salut_account (void)
159 {
160   EmpathyAccountManager *manager;
161   gboolean salut_created = FALSE;
162   GList *accounts, *l;
163
164   /* Check if we already created a salut account */
165   empathy_conf_get_bool (empathy_conf_get (),
166       EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
167       &salut_created);
168
169   if (salut_created)
170     {
171       DEBUG ("Gconf says we already created a salut account once");
172       return FALSE;
173     }
174
175   manager = empathy_account_manager_dup_singleton ();
176   accounts = empathy_account_manager_dup_accounts (manager);
177
178   for (l = accounts; l != NULL;  l = g_list_next (l))
179     {
180       EmpathyAccount *account = EMPATHY_ACCOUNT (l->data);
181
182       if (!tp_strdiff (empathy_account_get_protocol (account), "local-xmpp"))
183         salut_created = TRUE;
184
185       g_object_unref (account);
186     }
187
188   g_object_unref (manager);
189
190   if (salut_created)
191     {
192       DEBUG ("Existing salut account already exists, flagging so in gconf");
193       empathy_conf_set_bool (empathy_conf_get (),
194           EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
195           TRUE);
196     }
197
198   return !salut_created;
199 }
200
201 static void
202 salut_account_created (GObject *source,
203     GAsyncResult *result,
204     gpointer user_data)
205 {
206   EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source);
207   EmpathyAccount *account;
208   GError *error = NULL;
209
210   if (!empathy_account_settings_apply_finish (settings, result, &error))
211     {
212       DEBUG ("Failed to create salut account: %s", error->message);
213       g_error_free (error);
214       return;
215     }
216
217   account = empathy_account_settings_get_account (settings);
218
219   empathy_account_set_enabled (account, TRUE);
220   empathy_conf_set_bool (empathy_conf_get (),
221       EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
222       TRUE);
223 }
224
225 static void
226 use_conn_notify_cb (EmpathyConf *conf,
227     const gchar *key,
228     gpointer     user_data)
229 {
230   EmpathyConnectivity *connectivity = user_data;
231   gboolean     use_conn;
232
233   if (empathy_conf_get_bool (conf, key, &use_conn))
234     {
235       empathy_connectivity_set_use_conn (connectivity, use_conn);
236     }
237 }
238
239 static void
240 create_salut_account_if_needed (EmpathyConnectionManagers *managers)
241 {
242   EmpathyAccountSettings  *settings;
243   TpConnectionManager *manager;
244   const TpConnectionManagerProtocol *protocol;
245   EBook      *book;
246   EContact   *contact;
247   gchar      *nickname = NULL;
248   gchar      *first_name = NULL;
249   gchar      *last_name = NULL;
250   gchar      *email = NULL;
251   gchar      *jid = NULL;
252   GError     *error = NULL;
253
254
255   if (!should_create_salut_account ())
256     return;
257
258   manager = empathy_connection_managers_get_cm (managers, "salut");
259   if (manager == NULL)
260     {
261       DEBUG ("Salut not installed, not making a salut account");
262       return;
263     }
264
265   protocol = tp_connection_manager_get_protocol (manager, "local-xmpp");
266   if (protocol == NULL)
267     {
268       DEBUG ("Salut doesn't support local-xmpp!!");
269       return;
270     }
271
272   DEBUG ("Trying to add a salut account...");
273
274   /* Get self EContact from EDS */
275   if (!e_book_get_self (&contact, &book, &error))
276     {
277       DEBUG ("Failed to get self econtact: %s",
278           error ? error->message : "No error given");
279       g_clear_error (&error);
280       return;
281     }
282
283   settings = empathy_account_settings_new ("salut", "local-xmpp",
284       _("People nearby"));
285
286   nickname = e_contact_get (contact, E_CONTACT_NICKNAME);
287   first_name = e_contact_get (contact, E_CONTACT_GIVEN_NAME);
288   last_name = e_contact_get (contact, E_CONTACT_FAMILY_NAME);
289   email = e_contact_get (contact, E_CONTACT_EMAIL_1);
290   jid = e_contact_get (contact, E_CONTACT_IM_JABBER_HOME_1);
291
292   if (!tp_strdiff (nickname, "nickname"))
293     {
294       g_free (nickname);
295       nickname = NULL;
296     }
297
298   DEBUG ("Salut account created:\nnickname=%s\nfirst-name=%s\n"
299      "last-name=%s\nemail=%s\njid=%s\n",
300      nickname, first_name, last_name, email, jid);
301
302   empathy_account_settings_set_string (settings,
303       "nickname", nickname ? nickname : "");
304   empathy_account_settings_set_string (settings,
305       "first-name", first_name ? first_name : "");
306   empathy_account_settings_set_string (settings,
307       "last-name", last_name ? last_name : "");
308   empathy_account_settings_set_string (settings, "email", email ? email : "");
309   empathy_account_settings_set_string (settings, "jid", jid ? jid : "");
310
311   empathy_account_settings_apply_async (settings,
312       salut_account_created, NULL);
313
314   g_free (nickname);
315   g_free (first_name);
316   g_free (last_name);
317   g_free (email);
318   g_free (jid);
319   g_object_unref (settings);
320   g_object_unref (contact);
321   g_object_unref (book);
322 }
323
324 static void
325 connection_managers_ready_cb (EmpathyConnectionManagers *managers,
326     GParamSpec *spec,
327     gpointer user_data)
328 {
329   if (empathy_connection_managers_is_ready (managers))
330     {
331       create_salut_account_if_needed (managers);
332       g_object_unref (managers);
333       managers = NULL;
334     }
335 }
336
337 static void
338 create_salut_account (void)
339 {
340   EmpathyConnectionManagers *managers;
341
342   if (!should_create_salut_account ())
343     return;
344
345   managers = empathy_connection_managers_dup_singleton ();
346
347   if (empathy_connection_managers_is_ready (managers))
348     {
349       create_salut_account_if_needed (managers);
350       g_object_unref (managers);
351     }
352   else
353     {
354       g_signal_connect (managers, "notify::ready",
355                         G_CALLBACK (connection_managers_ready_cb), NULL);
356     }
357 }
358
359 static void
360 migrate_config_to_xdg_dir (void)
361 {
362   gchar *xdg_dir, *old_dir, *xdg_filename, *old_filename;
363   int i;
364   GFile *xdg_file, *old_file;
365   static const gchar* filenames[] = {
366     "geometry.ini",
367     "irc-networks.xml",
368     "chatrooms.xml",
369     "contact-groups.xml",
370     "status-presets.xml",
371     "accels.txt",
372     NULL
373   };
374
375   xdg_dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
376   if (g_file_test (xdg_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
377     {
378       /* xdg config dir already exists */
379       g_free (xdg_dir);
380       return;
381     }
382
383   old_dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
384   if (!g_file_test (old_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
385     {
386       /* old config dir didn't exist */
387       g_free (xdg_dir);
388       g_free (old_dir);
389       return;
390     }
391
392   if (g_mkdir_with_parents (xdg_dir, (S_IRUSR | S_IWUSR | S_IXUSR)) == -1)
393     {
394       DEBUG ("Failed to create configuration directory; aborting migration");
395       g_free (xdg_dir);
396       g_free (old_dir);
397       return;
398     }
399
400   for (i = 0; filenames[i]; i++)
401     {
402       old_filename = g_build_filename (old_dir, filenames[i], NULL);
403       if (!g_file_test (old_filename, G_FILE_TEST_EXISTS))
404         {
405           g_free (old_filename);
406           continue;
407         }
408       xdg_filename = g_build_filename (xdg_dir, filenames[i], NULL);
409       old_file = g_file_new_for_path (old_filename);
410       xdg_file = g_file_new_for_path (xdg_filename);
411
412       if (!g_file_move (old_file, xdg_file, G_FILE_COPY_NONE,
413           NULL, NULL, NULL, NULL))
414         DEBUG ("Failed to migrate %s", filenames[i]);
415
416       g_free (old_filename);
417       g_free (xdg_filename);
418       g_object_unref (old_file);
419       g_object_unref (xdg_file);
420     }
421
422   g_free (xdg_dir);
423   g_free (old_dir);
424 }
425
426 static UniqueResponse
427 unique_app_message_cb (UniqueApp *unique_app,
428     gint command,
429     UniqueMessageData *data,
430     guint timestamp,
431     gpointer user_data)
432 {
433   GtkWidget *window = user_data;
434
435   DEBUG ("Other instance launched, presenting the main window. "
436       "Command=%d, timestamp %u", command, timestamp);
437
438   if (command == COMMAND_ACCOUNTS_DIALOG)
439     {
440       empathy_accounts_dialog_show (GTK_WINDOW (window), NULL);
441     }
442   else
443     {
444       gtk_window_set_screen (GTK_WINDOW (window),
445           unique_message_data_get_screen (data));
446       gtk_window_set_startup_id (GTK_WINDOW (window),
447           unique_message_data_get_startup_id (data));
448       gtk_window_present_with_time (GTK_WINDOW (window), timestamp);
449     }
450
451   return UNIQUE_RESPONSE_OK;
452 }
453
454 static gboolean
455 show_version_cb (const char *option_name,
456     const char *value,
457     gpointer data,
458     GError **error)
459 {
460   g_print ("%s\n", PACKAGE_STRING);
461
462   exit (EXIT_SUCCESS);
463
464   return FALSE;
465 }
466
467 static void
468 new_incoming_transfer_cb (EmpathyFTFactory *factory,
469     EmpathyFTHandler *handler,
470     GError *error,
471     gpointer user_data)
472 {
473   if (error)
474     empathy_ft_manager_display_error (handler, error);
475   else
476     empathy_receive_file_with_file_chooser (handler);
477 }
478
479 static void
480 new_ft_handler_cb (EmpathyFTFactory *factory,
481     EmpathyFTHandler *handler,
482     GError *error,
483     gpointer user_data)
484 {
485   if (error)
486     empathy_ft_manager_display_error (handler, error);
487   else
488     empathy_ft_manager_add_handler (handler);
489
490   g_object_unref (handler);
491 }
492
493 static void
494 new_call_handler_cb (EmpathyCallFactory *factory,
495     EmpathyCallHandler *handler,
496     gboolean outgoing,
497     gpointer user_data)
498 {
499   EmpathyCallWindow *window;
500
501   window = empathy_call_window_new (handler);
502   gtk_widget_show (GTK_WIDGET (window));
503 }
504
505 #ifdef ENABLE_DEBUG
506 static void
507 default_log_handler (const gchar *log_domain,
508     GLogLevelFlags log_level,
509     const gchar *message,
510     gpointer user_data)
511 {
512   g_log_default_handler (log_domain, log_level, message, NULL);
513
514   /* G_LOG_DOMAIN = "empathy". No need to send empathy messages to the
515    * debugger as they already have in empathy_debug. */
516   if (log_level != G_LOG_LEVEL_DEBUG
517       || tp_strdiff (log_domain, G_LOG_DOMAIN))
518     {
519         EmpathyDebugger *dbg;
520         GTimeVal now;
521
522         dbg = empathy_debugger_get_singleton ();
523         g_get_current_time (&now);
524
525         empathy_debugger_add_message (dbg, &now, log_domain,
526                                       log_level, message);
527     }
528 }
529 #endif /* ENABLE_DEBUG */
530
531 static void
532 account_manager_ready_cb (EmpathyAccountManager *manager,
533     GParamSpec *spec,
534     gpointer user_data)
535 {
536   GtkWidget *assistant;
537
538   if (!empathy_account_manager_is_ready (manager))
539     return;
540
541   if (empathy_account_manager_get_count (manager) == 0)
542     {
543       assistant = empathy_account_assistant_new (
544           GTK_WINDOW (empathy_main_window_get ()));
545       gtk_window_present (GTK_WINDOW (assistant));
546     }
547
548   create_salut_account ();
549 }
550
551 int
552 main (int argc, char *argv[])
553 {
554 #if HAVE_GEOCLUE
555   EmpathyLocationManager *location_manager = NULL;
556 #endif
557   EmpathyStatusIcon *icon;
558   EmpathyDispatcher *dispatcher;
559   EmpathyAccountManager *account_manager;
560   EmpathyLogManager *log_manager;
561   EmpathyChatroomManager *chatroom_manager;
562   EmpathyCallFactory *call_factory;
563   EmpathyFTFactory  *ft_factory;
564   GtkWidget *window;
565   EmpathyIdle *idle;
566   EmpathyConnectivity *connectivity;
567   gboolean autoconnect = TRUE;
568   gboolean no_connect = FALSE;
569   gboolean hide_contact_list = FALSE;
570   gboolean accounts_dialog = FALSE;
571   GError *error = NULL;
572   TpDBusDaemon *dbus_daemon;
573   UniqueApp *unique_app;
574
575   GOptionEntry options[] = {
576       { "no-connect", 'n',
577         0, G_OPTION_ARG_NONE, &no_connect,
578         N_("Don't connect on startup"),
579         NULL },
580       { "hide-contact-list", 'h',
581         0, G_OPTION_ARG_NONE, &hide_contact_list,
582         N_("Don't show the contact list on startup"),
583         NULL },
584       { "accounts", 'a',
585         0, G_OPTION_ARG_NONE, &accounts_dialog,
586         N_("Show the accounts dialog"),
587         NULL },
588       { "version", 'v',
589         G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version_cb,
590         NULL, NULL },
591       { NULL }
592   };
593
594   /* Init */
595   g_thread_init (NULL);
596   empathy_init ();
597
598   if (!gtk_init_with_args (&argc, &argv, N_("- Empathy IM Client"),
599       options, GETTEXT_PACKAGE, &error))
600     {
601       g_warning ("Error in empathy init: %s", error->message);
602       return EXIT_FAILURE;
603     }
604
605   empathy_gtk_init ();
606   g_set_application_name (_(PACKAGE_NAME));
607   g_setenv ("PULSE_PROP_media.role", "phone", TRUE);
608
609   gst_init (&argc, &argv);
610
611 #if HAVE_LIBCHAMPLAIN
612   gtk_clutter_init (&argc, &argv);
613 #endif
614
615   gtk_window_set_default_icon_name ("empathy");
616   textdomain (GETTEXT_PACKAGE);
617
618 #ifdef ENABLE_DEBUG
619   /* Set up debugger */
620   g_log_set_default_handler (default_log_handler, NULL);
621 #endif
622
623   unique_app = unique_app_new_with_commands ("org.gnome.Empathy",
624       NULL, "accounts_dialog", COMMAND_ACCOUNTS_DIALOG, NULL);
625
626   if (unique_app_is_running (unique_app))
627     {
628       unique_app_send_message (unique_app, accounts_dialog ?
629           COMMAND_ACCOUNTS_DIALOG : UNIQUE_ACTIVATE, NULL);
630
631       g_object_unref (unique_app);
632       return EXIT_SUCCESS;
633     }
634
635   /* Take well-known name */
636   dbus_daemon = tp_dbus_daemon_dup (&error);
637   if (error == NULL)
638     {
639       if (!tp_dbus_daemon_request_name (dbus_daemon,
640           "org.gnome.Empathy", TRUE, &error))
641         {
642           DEBUG ("Failed to request well-known name: %s",
643                  error ? error->message : "no message");
644           g_clear_error (&error);
645         }
646       g_object_unref (dbus_daemon);
647     }
648   else
649     {
650       DEBUG ("Failed to dup dbus daemon: %s",
651              error ? error->message : "no message");
652       g_clear_error (&error);
653     }
654
655   if (accounts_dialog)
656     {
657       GtkWidget *dialog;
658
659       dialog = empathy_accounts_dialog_show (NULL, NULL);
660       g_signal_connect (dialog, "destroy",
661                         G_CALLBACK (gtk_main_quit), NULL);
662
663       gtk_main ();
664       return 0;
665     }
666
667   /* Setting up Idle */
668   idle = empathy_idle_dup_singleton ();
669   empathy_idle_set_auto_away (idle, TRUE);
670
671   /* Setting up Connectivity */
672   connectivity = empathy_connectivity_dup_singleton ();
673   use_conn_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
674       connectivity);
675   empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
676       use_conn_notify_cb, connectivity);
677
678   /* Autoconnect */
679   empathy_conf_get_bool (empathy_conf_get (),
680       EMPATHY_PREFS_AUTOCONNECT, &autoconnect);
681   if (autoconnect && !no_connect &&
682       tp_connection_presence_type_cmp_availability
683           (empathy_idle_get_state (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
684             <= 0)
685       empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE);
686
687   /* account management */
688   account_manager = empathy_account_manager_dup_singleton ();
689   g_signal_connect (account_manager, "notify::ready",
690       G_CALLBACK (account_manager_ready_cb), NULL);
691
692   migrate_config_to_xdg_dir ();
693
694   /* Setting up UI */
695   window = empathy_main_window_show ();
696   icon = empathy_status_icon_new (GTK_WINDOW (window), hide_contact_list);
697
698   g_signal_connect (unique_app, "message-received",
699       G_CALLBACK (unique_app_message_cb), window);
700
701   /* Handle channels */
702   dispatcher = empathy_dispatcher_dup_singleton ();
703   g_signal_connect (dispatcher, "dispatch", G_CALLBACK (dispatch_cb), NULL);
704
705   /* Logging */
706   log_manager = empathy_log_manager_dup_singleton ();
707   empathy_log_manager_observe (log_manager, dispatcher);
708
709   chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
710   empathy_chatroom_manager_observe (chatroom_manager, dispatcher);
711
712   notify_init (_(PACKAGE_NAME));
713   /* Create the call factory */
714   call_factory = empathy_call_factory_initialise ();
715   g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
716       G_CALLBACK (new_call_handler_cb), NULL);
717   /* Create the FT factory */
718   ft_factory = empathy_ft_factory_dup_singleton ();
719   g_signal_connect (ft_factory, "new-ft-handler",
720       G_CALLBACK (new_ft_handler_cb), NULL);
721   g_signal_connect (ft_factory, "new-incoming-transfer",
722       G_CALLBACK (new_incoming_transfer_cb), NULL);
723
724   /* Location mananger */
725 #if HAVE_GEOCLUE
726   location_manager = empathy_location_manager_dup_singleton ();
727 #endif
728
729   gtk_main ();
730
731   empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
732
733   g_object_unref (idle);
734   g_object_unref (connectivity);
735   g_object_unref (icon);
736   g_object_unref (account_manager);
737   g_object_unref (log_manager);
738   g_object_unref (dispatcher);
739   g_object_unref (chatroom_manager);
740 #if HAVE_GEOCLUE
741   g_object_unref (location_manager);
742 #endif
743   g_object_unref (ft_factory);
744   g_object_unref (unique_app);
745
746   notify_uninit ();
747
748   return EXIT_SUCCESS;
749 }