[gnome-shell] endSessionDialog: Only show logout inhibiting apps



commit 8850c579dada834e39537a50dcb9eeca46eae7f4
Author: Michael Terry <mike mterry name>
Date:   Sun Aug 30 12:57:19 2020 -0400

    endSessionDialog: Only show logout inhibiting apps
    
    Apps that only inhibit other kinds of activity (like idle or suspend)
    don't need to be shown to user when they are logging out.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3119
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1424>

 data/dbus-interfaces/org.gnome.SessionManager.Inhibitor.xml |  3 +++
 js/misc/gnomeSession.js                                     | 10 +++++++++-
 js/ui/endSessionDialog.js                                   |  6 ++++--
 3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/data/dbus-interfaces/org.gnome.SessionManager.Inhibitor.xml 
b/data/dbus-interfaces/org.gnome.SessionManager.Inhibitor.xml
index c745f81916..aa6a23b856 100644
--- a/data/dbus-interfaces/org.gnome.SessionManager.Inhibitor.xml
+++ b/data/dbus-interfaces/org.gnome.SessionManager.Inhibitor.xml
@@ -3,6 +3,9 @@
     <method name="GetAppId">
       <arg type="s" direction="out"/>
     </method>
+    <method name="GetFlags">
+      <arg type="u" direction="out"/>
+    </method>
     <method name="GetReason">
       <arg type="s" direction="out"/>
     </method>
diff --git a/js/misc/gnomeSession.js b/js/misc/gnomeSession.js
index 2df9c844be..487644fe9b 100644
--- a/js/misc/gnomeSession.js
+++ b/js/misc/gnomeSession.js
@@ -1,5 +1,5 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-/* exported PresenceStatus, Presence, Inhibitor, SessionManager */
+/* exported PresenceStatus, Presence, Inhibitor, SessionManager, InhibitFlags */
 
 const Gio = imports.gi.Gio;
 
@@ -35,3 +35,11 @@ var SessionManagerProxy = Gio.DBusProxy.makeProxyWrapper(SessionManagerIface);
 function SessionManager(initCallback, cancellable) {
     return new SessionManagerProxy(Gio.DBus.session, 'org.gnome.SessionManager', 
'/org/gnome/SessionManager', initCallback, cancellable);
 }
+
+var InhibitFlags = {
+    LOGOUT: 1 << 0,
+    SWITCH: 1 << 1,
+    SUSPEND: 1 << 2,
+    IDLE: 1 << 3,
+    AUTOMOUNT: 1 << 4,
+};
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 053ae8cce0..1fdbd11b93 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -626,8 +626,9 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
         }
 
         let app = findAppFromInhibitor(inhibitor);
+        const [flags] = app ? inhibitor.GetFlagsSync() : [0];
 
-        if (app) {
+        if (app && flags & GnomeSession.InhibitFlags.LOGOUT) {
             let [description] = inhibitor.GetReasonSync();
             let listItem = new Dialog.ListSectionItem({
                 icon_actor: app.create_icon_texture(_ITEM_ICON_SIZE),
@@ -636,7 +637,8 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
             });
             this._applicationSection.list.add_child(listItem);
         } else {
-            // inhibiting app is a service, not an application
+            // inhibiting app is a service (not an application) or is not
+            // inhibiting logout/shutdown
             this._applications.splice(this._applications.indexOf(inhibitor), 1);
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]