diff options
-rw-r--r-- | data/indicator-session.convert | 8 | ||||
-rw-r--r-- | src/settings-helper.c | 27 |
2 files changed, 22 insertions, 13 deletions
diff --git a/data/indicator-session.convert b/data/indicator-session.convert index 8cf9e12..c98eddb 100644 --- a/data/indicator-session.convert +++ b/data/indicator-session.convert @@ -1,5 +1,5 @@ [com.canonical.indicator.session] -suppress_logout_restart_shutdown = /apps/indicator-session/suppress-logout-restart-shutdown -suppress_logout_menuitem = /apps/indicator-session/suppress-logout-menuitem -suppress_restart_menuitem = /apps/indicator-session/suppress-restart-menuitem -suppress_shutdown_menuitem = /apps/indicator-session/suppress-shutdown-menuitem +suppress-logout-restart-shutdown = /apps/indicator-session/suppress_logout_restart_shutdown +suppress-logout-menuitem = /apps/indicator-session/suppress_logout_menuitem +suppress-restart-menuitem = /apps/indicator-session/suppress_restart_menuitem +suppress-shutdown-menuitem = /apps/indicator-session/suppress_shutdown_menuitem diff --git a/src/settings-helper.c b/src/settings-helper.c index d70df95..007f83f 100644 --- a/src/settings-helper.c +++ b/src/settings-helper.c @@ -38,41 +38,49 @@ static guint logout_notify = 0; static guint restart_notify = 0; static guint shutdown_notify = 0; -static void +static gboolean build_settings (void) { - if(!settings) { + if (settings == NULL) { settings = g_settings_new (SESSION_SCHEMA); } - return; + if (settings == NULL) { + return FALSE; + } + return TRUE; } gboolean supress_confirmations (void) { - build_settings(); + gboolean settings_built = build_settings(); + g_return_val_if_fail(settings_built, FALSE); return g_settings_get_boolean (settings, SUPPRESS_KEY) ; } gboolean should_show_user_menu (void) { - build_settings(); + gboolean settings_built = build_settings(); + g_return_val_if_fail(settings_built, TRUE); return g_settings_get_boolean (settings, SHOW_USER_MENU) ; } gboolean show_logout (void) { - build_settings(); + gboolean settings_built = build_settings(); + g_return_val_if_fail(settings_built, TRUE); return !g_settings_get_boolean (settings, LOGOUT_KEY) ; } gboolean show_restart (void) { - build_settings(); + gboolean settings_built = build_settings(); + g_return_val_if_fail(settings_built, TRUE); return !g_settings_get_boolean (settings, RESTART_KEY) ; } gboolean show_shutdown (void) { - build_settings(); + gboolean settings_built = build_settings(); + g_return_val_if_fail(settings_built, TRUE); return !g_settings_get_boolean (settings, SHUTDOWN_KEY) ; } @@ -122,7 +130,8 @@ update_shutdown_callback (GSettings * settings, const gchar * key, gpointer data void update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi) { /* If we don't have a client, build one. */ - build_settings(); + gboolean settings_built = build_settings(); + g_return_if_fail(settings_built); if (confirmation_notify != 0) { g_signal_handler_disconnect (settings, confirmation_notify); |