Blame SOURCES/warn-less.patch

477568
From 37bbb9175bbd061d4ae14e86c35e4211602dbeaa Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Mon, 23 Mar 2020 17:57:38 +0100
477568
Subject: [PATCH 1/4] shell/util: Add touch_file_async() helper
477568
477568
Add a small helper method to asynchronously "touch" a file and return
477568
whether the file was created or not.
477568
477568
As g_file_make_directory_with_parents() doesn't have an async variant,
477568
we need a C helper to make the entire operation non-blocking.
477568
477568
https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
477568
---
477568
 src/shell-util.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
477568
 src/shell-util.h |  7 ++++++
477568
 2 files changed, 69 insertions(+)
477568
477568
diff --git a/src/shell-util.c b/src/shell-util.c
477568
index fa3fc08c8..eec67f3d7 100644
477568
--- a/src/shell-util.c
477568
+++ b/src/shell-util.c
477568
@@ -323,6 +323,68 @@ shell_get_file_contents_utf8_sync (const char *path,
477568
   return contents;
477568
 }
477568
 
477568
+static void
477568
+touch_file (GTask        *task,
477568
+            gpointer      object,
477568
+            gpointer      task_data,
477568
+            GCancellable *cancellable)
477568
+{
477568
+  GFile *file = object;
477568
+  g_autoptr (GFile) parent = NULL;
477568
+  g_autoptr (GFileOutputStream) stream = NULL;
477568
+  GError *error = NULL;
477568
+
477568
+  parent = g_file_get_parent (file);
477568
+  g_file_make_directory_with_parents (parent, cancellable, &error);
477568
+
477568
+  if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
477568
+    {
477568
+      g_task_return_error (task, error);
477568
+      return;
477568
+    }
477568
+  g_clear_error (&error);
477568
+
477568
+  stream = g_file_create (file, G_FILE_CREATE_NONE, cancellable, &error);
477568
+
477568
+  if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
477568
+    {
477568
+      g_task_return_error (task, error);
477568
+      return;
477568
+    }
477568
+  g_clear_error (&error);
477568
+
477568
+  if (stream)
477568
+    g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
477568
+
477568
+  g_task_return_boolean (task, stream != NULL);
477568
+}
477568
+
477568
+void
477568
+shell_util_touch_file_async (GFile               *file,
477568
+                             GAsyncReadyCallback  callback,
477568
+                             gpointer             user_data)
477568
+{
477568
+  g_autoptr (GTask) task = NULL;
477568
+
477568
+  g_return_if_fail (G_IS_FILE (file));
477568
+
477568
+  task = g_task_new (file, NULL, callback, user_data);
477568
+  g_task_set_source_tag (task, shell_util_touch_file_async);
477568
+
477568
+  g_task_run_in_thread (task, touch_file);
477568
+}
477568
+
477568
+gboolean
477568
+shell_util_touch_file_finish (GFile         *file,
477568
+                              GAsyncResult  *res,
477568
+                              GError       **error)
477568
+{
477568
+  g_return_val_if_fail (G_IS_FILE (file), FALSE);
477568
+  g_return_val_if_fail (G_IS_TASK (res), FALSE);
477568
+
477568
+  return g_task_propagate_boolean (G_TASK (res), error);
477568
+}
477568
+
477568
 /**
477568
  * shell_util_wifexited:
477568
  * @status: the status returned by wait() or waitpid()
477568
diff --git a/src/shell-util.h b/src/shell-util.h
477568
index 02b8404e9..bedf516ba 100644
477568
--- a/src/shell-util.h
477568
+++ b/src/shell-util.h
477568
@@ -32,6 +32,13 @@ gboolean shell_write_string_to_stream          (GOutputStream    *stream,
477568
 char    *shell_get_file_contents_utf8_sync     (const char       *path,
477568
                                                 GError          **error);
477568
 
477568
+void     shell_util_touch_file_async           (GFile               *file,
477568
+                                                GAsyncReadyCallback  callback,
477568
+                                                gpointer             user_data);
477568
+gboolean shell_util_touch_file_finish          (GFile               *file,
477568
+                                                GAsyncResult        *res,
477568
+                                                GError             **error);
477568
+
477568
 gboolean shell_util_wifexited                  (int               status,
477568
                                                 int              *exit);
477568
 
477568
-- 
477568
2.31.1
477568
477568
477568
From 1f75494bea1ef7017d50d77cf5c7ad6b9668d4f5 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Mon, 23 Mar 2020 18:00:27 +0100
477568
Subject: [PATCH 2/4] environment: Hook up touch_file to GFile prototype
477568
477568
We don't usually extend introspected types with our own API, but in
477568
this case it's too tempting to make the helper functions usable with
477568
Gio._promisify() ...
477568
477568
https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
477568
---
477568
 js/ui/environment.js | 9 ++++++++-
477568
 1 file changed, 8 insertions(+), 1 deletion(-)
477568
477568
diff --git a/js/ui/environment.js b/js/ui/environment.js
477568
index e22ec7402..9c125d3eb 100644
477568
--- a/js/ui/environment.js
477568
+++ b/js/ui/environment.js
477568
@@ -9,7 +9,7 @@ imports.gi.versions.Gtk = '3.0';
477568
 imports.gi.versions.TelepathyGLib = '0.12';
477568
 imports.gi.versions.TelepathyLogger = '0.2';
477568
 
477568
-const { Clutter, GLib, Shell, St } = imports.gi;
477568
+const { Clutter, Gio, GLib, Shell, St } = imports.gi;
477568
 const Gettext = imports.gettext;
477568
 
477568
 // We can't import shell JS modules yet, because they may have
477568
@@ -97,6 +97,13 @@ function init() {
477568
         return St.describe_actor(this);
477568
     };
477568
 
477568
+    Gio._LocalFilePrototype.touch_async = function (callback) {
477568
+        Shell.util_touch_file_async(this, callback);
477568
+    };
477568
+    Gio._LocalFilePrototype.touch_finish = function (result) {
477568
+        return Shell.util_touch_file_finish(this, result);
477568
+    };
477568
+
477568
     let origToString = Object.prototype.toString;
477568
     Object.prototype.toString = function() {
477568
         let base = origToString.call(this);
477568
-- 
477568
2.31.1
477568
477568
477568
From 4bef23c7176a43f4dcf146e70bbb8aaa701b8cd2 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Fri, 20 Mar 2020 12:42:04 +0100
477568
Subject: [PATCH 3/4] main: Do not warn about missing GDM on each login
477568
477568
We now warn on startup if screen locking isn't available, however for
477568
users who choose not to use GDM or logind, repeating the warning on
477568
each login is more annoying than helpful.
477568
477568
Instead, limit the warning to the first login on which the screen lock
477568
became unavailable. That way the notification will still serve the
477568
intended purpose of informing the user, but without being perceived
477568
as nagging.
477568
477568
https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
477568
---
477568
 js/ui/main.js | 36 +++++++++++++++++++++++++++++++-----
477568
 1 file changed, 31 insertions(+), 5 deletions(-)
477568
477568
diff --git a/js/ui/main.js b/js/ui/main.js
477568
index 1203b3c39..a3fad158c 100644
477568
--- a/js/ui/main.js
477568
+++ b/js/ui/main.js
477568
@@ -81,6 +81,9 @@ let _a11ySettings = null;
477568
 let _themeResource = null;
477568
 let _oskResource = null;
477568
 
477568
+Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
477568
+Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish');
477568
+
477568
 function _sessionUpdated() {
477568
     if (sessionMode.isPrimary)
477568
         _loadDefaultStylesheet();
477568
@@ -242,11 +245,8 @@ function _initializeUI() {
477568
         }
477568
 
477568
         if (sessionMode.currentMode !== 'gdm' &&
477568
-            sessionMode.currentMode !== 'initial-setup' &&
477568
-            screenShield === null) {
477568
-            notify(_('Screen Lock disabled'),
477568
-                   _('Screen Locking requires the GNOME display manager.'));
477568
-        }
477568
+            sessionMode.currentMode !== 'initial-setup')
477568
+            _handleLockScreenWarning();
477568
 
477568
         let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");
477568
         if (perfModuleName) {
477568
@@ -257,6 +257,32 @@ function _initializeUI() {
477568
     });
477568
 }
477568
 
477568
+async function _handleLockScreenWarning() {
477568
+    const path = '%s/lock-warning-shown'.format(global.userdatadir);
477568
+    const file = Gio.File.new_for_path(path);
477568
+
477568
+    const hasLockScreen = screenShield !== null;
477568
+    if (hasLockScreen) {
477568
+        try {
477568
+            await file.delete_async(0, null);
477568
+        } catch (e) {
477568
+            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
477568
+                logError(e);
477568
+        }
477568
+    } else {
477568
+        try {
477568
+            if (!await file.touch_async())
477568
+                return;
477568
+        } catch (e) {
477568
+            logError(e);
477568
+        }
477568
+
477568
+        notify(
477568
+            _('Screen Lock disabled'),
477568
+            _('Screen Locking requires the GNOME display manager.'));
477568
+    }
477568
+}
477568
+
477568
 function _getStylesheet(name) {
477568
     let stylesheet;
477568
 
477568
-- 
477568
2.31.1
477568
477568
477568
From c3f34e786826d0ed1af4150190159fed50d9fb87 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Thu, 22 Oct 2020 20:11:14 +0200
477568
Subject: [PATCH 4/4] messageTray: Default to generic policy
477568
477568
How and if notifications are shown is controlled by NotificationPolicy
477568
objects. But ever since 098bd45, only notification daemon sources or
477568
notifications associated with an app are hooked up to GSettings.
477568
477568
The hardcoded default policy for built-in notifications (including
477568
those provided by extensions) arguably made sense back then, but
477568
now that the main setting has been rebranded as "Do Not Disturb"
477568
and is exposed prominently in the calendar drop-down, following
477568
GSettings is a better default.
477568
477568
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3291
477568
477568
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1511>
477568
---
477568
 js/ui/messageTray.js | 2 +-
477568
 1 file changed, 1 insertion(+), 1 deletion(-)
477568
477568
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
477568
index 8f8130451..f6bdae8e4 100644
477568
--- a/js/ui/messageTray.js
477568
+++ b/js/ui/messageTray.js
477568
@@ -731,7 +731,7 @@ var Source = class Source {
477568
     }
477568
 
477568
     _createPolicy() {
477568
-        return new NotificationPolicy();
477568
+        return new NotificationGenericPolicy();
477568
     }
477568
 
477568
     get narrowestPrivacyScope() {
477568
-- 
477568
2.31.1
477568