diff options
author | Arthur Mello <arthur.mello@canonical.com> | 2016-07-01 16:35:21 -0300 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-07-08 02:07:29 +0200 |
commit | 559730101e171a821f9bb75c0e90cc9b19c60023 (patch) | |
tree | c6cd0ef264e015f5701d238f2933d53d94df0c14 /src | |
parent | fb29c9e706c143e38726ea057fdb754a8e30c2aa (diff) | |
download | ayatana-indicator-datetime-559730101e171a821f9bb75c0e90cc9b19c60023.tar.gz ayatana-indicator-datetime-559730101e171a821f9bb75c0e90cc9b19c60023.tar.bz2 ayatana-indicator-datetime-559730101e171a821f9bb75c0e90cc9b19c60023.zip |
Do not fail gracefully if gsettings schema is not installed
Diffstat (limited to 'src')
-rw-r--r-- | src/settings-live.cpp | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/src/settings-live.cpp b/src/settings-live.cpp index d1ea91b..01de7b8 100644 --- a/src/settings-live.cpp +++ b/src/settings-live.cpp @@ -38,21 +38,10 @@ LiveSettings::~LiveSettings() g_clear_object(&m_settings); } -LiveSettings::LiveSettings(): m_settings(g_settings_new(SETTINGS_INTERFACE)), m_settings_cal_notification(NULL) +LiveSettings::LiveSettings(): m_settings(g_settings_new(SETTINGS_INTERFACE)), m_settings_cal_notification(g_settings_new_with_path(SETTINGS_NOTIFY_SCHEMA_ID, SETTINGS_NOTIFY_CALENDAR_PATH)) { g_signal_connect (m_settings, "changed", G_CALLBACK(on_changed_ccid), this); - - if (ayatana_common_utils_is_lomiri()) - { - GSettingsSchemaSource *source = g_settings_schema_source_get_default(); - if (g_settings_schema_source_lookup(source, SETTINGS_NOTIFY_SCHEMA_ID, true)) { - m_settings_cal_notification = g_settings_new_with_path(SETTINGS_NOTIFY_SCHEMA_ID, SETTINGS_NOTIFY_CALENDAR_PATH); - } - - if (m_settings_cal_notification) { - g_signal_connect (m_settings_cal_notification, "changed", G_CALLBACK(on_changed_cal_notification), this); - } - } + g_signal_connect (m_settings_cal_notification, "changed", G_CALLBACK(on_changed_cal_notification), this); // init the Properties from the GSettings backend update_custom_time_format(); @@ -305,47 +294,27 @@ void LiveSettings::update_snooze_duration() void LiveSettings::update_cal_notification_enabled() { - if (m_settings_cal_notification) { - cal_notification_enabled.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_ENABLED_KEY)); - } else { - cal_notification_enabled.set(true); - } + cal_notification_enabled.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_ENABLED_KEY)); } void LiveSettings::update_cal_notification_sounds() { - if (m_settings_cal_notification) { - cal_notification_sounds.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_SOUNDS_KEY)); - } else { - cal_notification_sounds.set(true); - } + cal_notification_sounds.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_SOUNDS_KEY)); } void LiveSettings::update_cal_notification_vibrations() { - if (m_settings_cal_notification) { - cal_notification_vibrations.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_VIBRATIONS_KEY)); - } else { - cal_notification_vibrations.set(true); - } + cal_notification_vibrations.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_VIBRATIONS_KEY)); } void LiveSettings::update_cal_notification_bubbles() { - if (m_settings_cal_notification) { - cal_notification_bubbles.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_BUBBLES_KEY)); - } else { - cal_notification_bubbles.set(true); - } + cal_notification_bubbles.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_BUBBLES_KEY)); } void LiveSettings::update_cal_notification_list() { - if (m_settings_cal_notification) { - cal_notification_list.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_LIST_KEY)); - } else { - cal_notification_list.set(true); - } + cal_notification_list.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_LIST_KEY)); } /*** |