/* owned (gchar *) => TRUE */
GHashTable *capabilities;
TpAccountManager *account_manager;
+ GSettings *gsettings_notif;
} EmpathyNotifyManagerPriv;
G_DEFINE_TYPE (EmpathyNotifyManager, empathy_notify_manager, G_TYPE_OBJECT);
priv->account_manager = NULL;
}
+ tp_clear_object (&priv->gsettings_notif);
+
G_OBJECT_CLASS (empathy_notify_manager_parent_class)->dispose (object);
}
self->priv = priv;
+ priv->gsettings_notif = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
+
priv->capabilities = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
NULL);
empathy_notify_manager_notification_is_enabled (EmpathyNotifyManager *self)
{
EmpathyNotifyManagerPriv *priv = GET_PRIV (self);
- GSettings *gsettings = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
TpConnectionPresenceType presence;
- gboolean ret = FALSE;
- if (!g_settings_get_boolean (gsettings, EMPATHY_PREFS_NOTIFICATIONS_ENABLED))
- goto finally;
+ if (!g_settings_get_boolean (priv->gsettings_notif,
+ EMPATHY_PREFS_NOTIFICATIONS_ENABLED))
+ return FALSE;
if (!tp_account_manager_is_prepared (priv->account_manager,
TP_ACCOUNT_MANAGER_FEATURE_CORE))
{
DEBUG ("account manager is not ready yet; display the notification");
- ret = TRUE;
-
- goto finally;
+ return TRUE;
}
presence = tp_account_manager_get_most_available_presence (
if (presence != TP_CONNECTION_PRESENCE_TYPE_AVAILABLE &&
presence != TP_CONNECTION_PRESENCE_TYPE_UNSET)
{
- if (g_settings_get_boolean (gsettings,
+ if (g_settings_get_boolean (priv->gsettings_notif,
EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY))
- goto finally;
+ return FALSE;
}
- ret = TRUE;
-
-finally:
- g_object_unref (gsettings);
-
- return ret;
+ return TRUE;
}