[gnome-session/wip/benzea/systemd-user-switch: 31/31] shell-extensions: Touch login warning file when disabling extensions



commit c7d438dc39e0dca70c68b7b0e817e4bd6e415fb4
Author: Benjamin Berg <bberg redhat com>
Date:   Mon May 13 11:37:53 2019 +0200

    shell-extensions: Touch login warning file when disabling extensions
    
    gnome-shell can show a warning on login when the extensions were
    disabled due to an error. Touch the corresponding file to use this
    behaviour for non-systemd managed sessions.

 gnome-session/gsm-shell-extensions.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/gnome-session/gsm-shell-extensions.c b/gnome-session/gsm-shell-extensions.c
index 73d898fd..b7527e34 100644
--- a/gnome-session/gsm-shell-extensions.c
+++ b/gnome-session/gsm-shell-extensions.c
@@ -184,9 +184,32 @@ gsm_shell_extensions_init (GsmShellExtensions *self)
 gboolean
 gsm_shell_extensions_disable_all (GsmShellExtensions *self)
 {
-  return g_settings_set_boolean (self->priv->settings,
-                                 DISABLE_EXTENSIONS_KEY,
-                                 TRUE);
+  gboolean res;
+
+  res = g_settings_set_boolean (self->priv->settings,
+                                DISABLE_EXTENSIONS_KEY,
+                                TRUE);
+
+  if (res)
+    {
+      g_autofree gchar *path = NULL;
+      g_autoptr(GFile) file = NULL;
+      g_autoptr(GFileOutputStream) output_stream = NULL;
+      g_autoptr(GError) error = NULL;
+
+      path = g_build_path (g_get_user_config_dir (),
+                           "gnome-shell-extensions-disabled-warning",
+                           NULL);
+
+      file = g_file_new_for_path (path);
+      output_stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, &error);
+
+      if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
+        g_warning ("Could not create gnome-shell-extensions-disabled-warning: %s",
+                   error->message);
+    }
+
+  return res;
 }
 
 guint


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