From 96569c764125b9c80909c7cece9e37b65eb632ca Mon Sep 17 00:00:00 2001 From: Danielle Madeley Date: Thu, 10 Jun 2010 14:16:00 +1000 Subject: Port Empathy code to GSettings, remove EmpathyConf --- libempathy-gtk/empathy-notify-manager.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'libempathy-gtk/empathy-notify-manager.c') diff --git a/libempathy-gtk/empathy-notify-manager.c b/libempathy-gtk/empathy-notify-manager.c index 8f7991166..d0e0aadec 100644 --- a/libempathy-gtk/empathy-notify-manager.c +++ b/libempathy-gtk/empathy-notify-manager.c @@ -25,10 +25,10 @@ #include +#include #include #include -#include #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include @@ -184,23 +184,20 @@ gboolean empathy_notify_manager_notification_is_enabled (EmpathyNotifyManager *self) { EmpathyNotifyManagerPriv *priv = GET_PRIV (self); - EmpathyConf *conf; - gboolean res; + GSettings *gsettings = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA); TpConnectionPresenceType presence; + gboolean ret = FALSE; - conf = empathy_conf_get (); - res = FALSE; - - empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_ENABLED, &res); - - if (!res) - return FALSE; + if (!g_settings_get_boolean (gsettings, EMPATHY_PREFS_NOTIFICATIONS_ENABLED)) + goto finally; if (!tp_account_manager_is_prepared (priv->account_manager, TP_ACCOUNT_MANAGER_FEATURE_CORE)) { DEBUG ("account manager is not ready yet; display the notification"); - return TRUE; + ret = TRUE; + + goto finally; } presence = tp_account_manager_get_most_available_presence ( @@ -210,12 +207,15 @@ empathy_notify_manager_notification_is_enabled (EmpathyNotifyManager *self) if (presence != TP_CONNECTION_PRESENCE_TYPE_AVAILABLE && presence != TP_CONNECTION_PRESENCE_TYPE_UNSET) { - empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY, - &res); - - if (res) - return FALSE; + if (!g_settings_get_boolean (gsettings, + EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY)) + goto finally; } - return TRUE; + ret = TRUE; + +finally: + g_object_unref (gsettings); + + return ret; } -- cgit v1.2.3