]> git.0d.be Git - empathy.git/blobdiff - src/empathy.c
Merge branch 'approvers-redone-599158'
[empathy.git] / src / empathy.c
index 5f313138975912fdb9680c585b8b3409435b00f4..2c7ea2a7f4d59c35057b09a171a6f9b525827e03 100644 (file)
 #include <telepathy-glib/connection-manager.h>
 #include <telepathy-glib/interfaces.h>
 
-#ifdef ENABLE_TPL
 #include <telepathy-logger/log-manager.h>
-#include <telepathy-logger/log-store-empathy.h>
-#else
 
-#include <libempathy/empathy-log-manager.h>
-#endif /* ENABLE_TPL */
 #include <libempathy/empathy-idle.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-dispatch-operation.h>
 #include <libempathy/empathy-ft-factory.h>
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-tp-chat.h>
 #include <libempathy/empathy-tp-call.h>
 
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 #include <libempathy-gtk/empathy-location-manager.h>
 
@@ -168,17 +163,14 @@ dispatch_cb (EmpathyDispatcher *dispatcher,
 }
 
 static void
-use_conn_notify_cb (EmpathyConf *conf,
+use_conn_notify_cb (GSettings *gsettings,
     const gchar *key,
     gpointer     user_data)
 {
   EmpathyConnectivity *connectivity = user_data;
-  gboolean     use_conn;
 
-  if (empathy_conf_get_bool (conf, key, &use_conn))
-    {
-      empathy_connectivity_set_use_conn (connectivity, use_conn);
-    }
+  empathy_connectivity_set_use_conn (connectivity,
+      g_settings_get_boolean (gsettings, key));
 }
 
 static void
@@ -353,8 +345,8 @@ account_manager_ready_cb (GObject *source_object,
   GError *error = NULL;
   EmpathyIdle *idle;
   EmpathyConnectivity *connectivity;
-  gboolean autoconnect = TRUE;
   TpConnectionPresenceType presence;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
 
   if (!tp_account_manager_prepare_finish (manager, result, &error))
     {
@@ -370,9 +362,8 @@ account_manager_ready_cb (GObject *source_object,
   presence = tp_account_manager_get_most_available_presence (manager, NULL,
       NULL);
 
-  empathy_conf_get_bool (empathy_conf_get (),
-      EMPATHY_PREFS_AUTOCONNECT, &autoconnect);
-  if (autoconnect && !no_connect &&
+  if (g_settings_get_boolean (gsettings, EMPATHY_PREFS_AUTOCONNECT) &&
+      !no_connect &&
       tp_connection_presence_type_cmp_availability
           (presence, TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
             <= 0)
@@ -387,6 +378,7 @@ account_manager_ready_cb (GObject *source_object,
 
   g_object_unref (idle);
   g_object_unref (connectivity);
+  g_object_unref (gsettings);
 }
 
 static EmpathyDispatcher *
@@ -561,15 +553,14 @@ chatroom_manager_ready_cb (EmpathyChatroomManager *chatroom_manager,
 }
 
 static void
-empathy_idle_set_auto_away_cb (EmpathyConf *conf,
+empathy_idle_set_auto_away_cb (GSettings *gsettings,
                                const gchar *key,
                                gpointer user_data)
 {
-       gboolean autoaway;
        EmpathyIdle *idle = user_data;
 
-       empathy_conf_get_bool (conf, key, &autoaway);
-       empathy_idle_set_auto_away (idle, autoaway);
+       empathy_idle_set_auto_away (idle,
+      g_settings_get_boolean (gsettings, key));
 }
 
 int
@@ -581,11 +572,7 @@ main (int argc, char *argv[])
   EmpathyStatusIcon *icon;
   EmpathyDispatcher *dispatcher;
   TpAccountManager *account_manager;
-#ifdef ENABLE_TPL
   TplLogManager *log_manager;
-#else
-  EmpathyLogManager *log_manager;
-#endif /* ENABLE_TPL */
   EmpathyChatroomManager *chatroom_manager;
   EmpathyCallFactory *call_factory;
   EmpathyFTFactory  *ft_factory;
@@ -600,6 +587,7 @@ main (int argc, char *argv[])
 #ifdef ENABLE_DEBUG
   TpDebugSender *debug_sender;
 #endif
+  GSettings *gsettings;
 
   GOptionContext *optcontext;
   GOptionEntry options[] = {
@@ -666,22 +654,22 @@ main (int argc, char *argv[])
   /* Setting up Idle */
   idle = empathy_idle_dup_singleton ();
 
-  empathy_conf_get_bool (empathy_conf_get (),
-      EMPATHY_PREFS_AUTOAWAY, &autoaway);
+  gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
+  autoaway = g_settings_get_boolean (gsettings, EMPATHY_PREFS_AUTOAWAY);
 
-  empathy_conf_notify_add (empathy_conf_get (),
-                          EMPATHY_PREFS_AUTOAWAY,
-                          empathy_idle_set_auto_away_cb,
-                          idle);
+  g_signal_connect (gsettings,
+      "changed::" EMPATHY_PREFS_AUTOAWAY,
+      G_CALLBACK (empathy_idle_set_auto_away_cb), idle);
 
   empathy_idle_set_auto_away (idle, autoaway);
 
   /* Setting up Connectivity */
   connectivity = empathy_connectivity_dup_singleton ();
-  use_conn_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
+  use_conn_notify_cb (gsettings, EMPATHY_PREFS_USE_CONN,
       connectivity);
-  empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
-      use_conn_notify_cb, connectivity);
+  g_signal_connect (gsettings,
+      "changed::" EMPATHY_PREFS_USE_CONN,
+      G_CALLBACK (use_conn_notify_cb), connectivity);
 
   /* account management */
   account_manager = tp_account_manager_dup ();
@@ -705,12 +693,7 @@ main (int argc, char *argv[])
       G_CALLBACK (unique_app_message_cb), window);
 
   /* Logging */
-#ifdef ENABLE_TPL
   log_manager = tpl_log_manager_dup_singleton ();
-#else
-  log_manager = empathy_log_manager_dup_singleton ();
-  empathy_log_manager_observe (log_manager, dispatcher);
-#endif
 
   chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
   empathy_chatroom_manager_observe (chatroom_manager, dispatcher);
@@ -763,6 +746,7 @@ main (int argc, char *argv[])
 #endif
   g_object_unref (ft_factory);
   g_object_unref (unique_app);
+  g_object_unref (gsettings);
 
   notify_uninit ();
   xmlCleanupParser ();