[Xfce4-commits] [apps/xfce4-screensaver] 01/01: Fix the status message toggle

noreply at xfce.org noreply at xfce.org
Thu Nov 22 12:57:09 CET 2018


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit ed2049d17fe4034870751b8dd9585ad71ed49dcd
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Thu Nov 22 06:57:03 2018 -0500

    Fix the status message toggle
---
 README.md           |  1 -
 src/gs-manager.c    | 23 +++++++++++++++++++++++
 src/gs-manager.h    |  2 ++
 src/gs-monitor.c    |  1 +
 src/gs-window-x11.c | 16 +++++++++++++++-
 src/gs-window.h     |  2 ++
 6 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index ee20287..c966093 100644
--- a/README.md
+++ b/README.md
@@ -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
 ============
diff --git a/src/gs-manager.c b/src/gs-manager.c
index b3c66c4..dc7719e 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -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,
@@ -663,6 +665,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) {
     GSList *l;
@@ -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);
 
diff --git a/src/gs-manager.h b/src/gs-manager.h
index ad1e162..f27db31 100644
--- a/src/gs-manager.h
+++ b/src/gs-manager.h
@@ -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,
diff --git a/src/gs-monitor.c b/src/gs-monitor.c
index 1e6fdef..b600278 100644
--- a/src/gs-monitor.c
+++ b/src/gs-monitor.c
@@ -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);
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 4e13222..ed93eb4 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -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);
@@ -1738,6 +1744,14 @@ gs_window_set_user_switch_enabled (GSWindow *window,
 }
 
 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) {
     g_return_if_fail (GS_IS_WINDOW (window));
diff --git a/src/gs-window.h b/src/gs-window.h
index f3aa6ba..77e2a37 100644
--- a/src/gs-window.h
+++ b/src/gs-window.h
@@ -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,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list