Commit ed2049d1 authored by Sean Davis's avatar Sean Davis 🕶

Fix the status message toggle

parent d309ad21
......@@ -24,7 +24,6 @@ Known Issues
============
- Allow embedding a keyboard into the window, /embedded-keyboard-enabled, may be non-functional. Onboard crashes when embedded.
- Allow the session status message to be displayed, /status-message-enabled, is currently ignored. The status message is always displayed when received.
Installation
============
......
......@@ -61,6 +61,7 @@ struct GSManagerPrivate {
guint logout_enabled : 1;
guint keyboard_enabled : 1;
guint user_switch_enabled : 1;
guint status_message_enabled : 1;
guint throttled : 1;
char *logout_command;
......@@ -109,6 +110,7 @@ enum {
PROP_LOGOUT_TIMEOUT,
PROP_LOGOUT_COMMAND,
PROP_KEYBOARD_COMMAND,
PROP_STATUS_MESSAGE_ENABLED,
PROP_STATUS_MESSAGE,
PROP_ACTIVE,
PROP_THROTTLED,
......@@ -662,6 +664,20 @@ gs_manager_set_keyboard_command (GSManager *manager,
}
}
void
gs_manager_set_status_message_enabled (GSManager *manager,
gboolean status_message_enabled) {
GSList *l;
g_return_if_fail (GS_IS_MANAGER (manager));
manager->priv->status_message_enabled = status_message_enabled;
for (l = manager->priv->windows; l; l = l->next) {
gs_window_set_status_message_enabled (l->data, manager->priv->status_message_enabled);
}
}
void
gs_manager_set_status_message (GSManager *manager,
const char *status_message) {
......@@ -795,6 +811,9 @@ gs_manager_set_property (GObject *object,
case PROP_KEYBOARD_COMMAND:
gs_manager_set_keyboard_command (self, g_value_get_string (value));
break;
case PROP_STATUS_MESSAGE_ENABLED:
gs_manager_set_status_message_enabled (self, g_value_get_boolean (value));
break;
case PROP_STATUS_MESSAGE:
gs_manager_set_status_message (self, g_value_get_string (value));
break;
......@@ -847,6 +866,9 @@ gs_manager_get_property (GObject *object,
case PROP_KEYBOARD_COMMAND:
g_value_set_string (value, self->priv->keyboard_command);
break;
case PROP_STATUS_MESSAGE_ENABLED:
g_value_set_boolean (value, self->priv->status_message_enabled);
break;
case PROP_STATUS_MESSAGE:
g_value_set_string (value, self->priv->status_message);
break;
......@@ -1450,6 +1472,7 @@ gs_manager_create_window_for_monitor (GSManager *manager,
gs_window_set_logout_command (window, manager->priv->logout_command);
gs_window_set_keyboard_enabled (window, manager->priv->keyboard_enabled);
gs_window_set_keyboard_command (window, manager->priv->keyboard_command);
gs_window_set_status_message_enabled (window, manager->priv->status_message_enabled);
gs_window_set_status_message (window, manager->priv->status_message);
gs_window_set_lock_active (window, manager->priv->lock_active);
......
......@@ -74,6 +74,8 @@ void gs_manager_set_keyboard_enabled (GSManager *manager,
gboolean enabled);
void gs_manager_set_keyboard_command (GSManager *manager,
const char *command);
void gs_manager_set_status_message_enabled(GSManager *manager,
gboolean status_message_enabled);
void gs_manager_set_status_message (GSManager *manager,
const char *message);
void gs_manager_get_saver_enabled (GSManager *manager,
......
......@@ -206,6 +206,7 @@ static void _gs_monitor_update_from_prefs(GSMonitor* monitor, GSPrefs* prefs) {
gs_manager_set_lock_timeout(monitor->priv->manager, monitor->priv->prefs->lock_timeout);
gs_manager_set_logout_enabled(monitor->priv->manager, monitor->priv->prefs->logout_enabled);
gs_manager_set_user_switch_enabled(monitor->priv->manager, user_switch_enabled);
gs_manager_set_status_message_enabled(monitor->priv->manager, monitor->priv->prefs->status_message_enabled);
gs_manager_set_keyboard_enabled(monitor->priv->manager, monitor->priv->prefs->keyboard_enabled);
gs_manager_set_logout_timeout(monitor->priv->manager, monitor->priv->prefs->logout_timeout);
gs_manager_set_logout_command(monitor->priv->manager, monitor->priv->prefs->logout_command);
......
......@@ -70,6 +70,7 @@ struct GSWindowPrivate {
guint user_switch_enabled : 1;
guint logout_enabled : 1;
guint keyboard_enabled : 1;
guint status_message_enabled : 1;
guint64 logout_timeout;
gboolean lock_active;
......@@ -1526,6 +1527,11 @@ is_user_switch_enabled (GSWindow *window) {
return window->priv->user_switch_enabled;
}
static gboolean
is_status_message_enabled (GSWindow *window) {
return window->priv->status_message_enabled;
}
static gint
get_monitor_index (GSWindow *window) {
GdkDisplay *display = gs_window_get_display (window);
......@@ -1563,7 +1569,7 @@ popup_dialog (GSWindow *window) {
g_string_append_printf (command, " --logout-command='%s'", window->priv->logout_command);
}
if (window->priv->status_message) {
if (is_status_message_enabled(window) && window->priv->status_message) {
char *quoted;
quoted = g_shell_quote (window->priv->status_message);
......@@ -1737,6 +1743,14 @@ gs_window_set_user_switch_enabled (GSWindow *window,
window->priv->user_switch_enabled = user_switch_enabled;
}
void
gs_window_set_status_message_enabled (GSWindow *window,
gboolean status_message_enabled) {
g_return_if_fail (GS_IS_WINDOW (window));
window->priv->status_message_enabled = status_message_enabled;
}
void
gs_window_set_logout_timeout (GSWindow *window,
glong logout_timeout) {
......
......@@ -79,6 +79,8 @@ void gs_window_set_keyboard_command (GSWindow *window,
const char *command);
void gs_window_set_user_switch_enabled (GSWindow *window,
gboolean user_switch_enabled);
void gs_window_set_status_message_enabled (GSWindow *window,
gboolean status_message_enabled);
void gs_window_set_logout_timeout (GSWindow *window,
glong timeout);
void gs_window_set_lock_active (GSWindow *window,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment