[gnome-control-center] user-accounts: Pass --user argument to select user in malcontent-control



commit e8d9fc565b2de0fa0cea39ce96b18a53bdb6fe8f
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Oct 20 12:50:48 2020 +0100

    user-accounts: Pass --user argument to select user in malcontent-control
    
    This eases the transition from g-c-c to malcontent-control a little.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/19

 meson.build                          | 2 ++
 panels/user-accounts/cc-user-panel.c | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index a2405087a..22b9f8241 100644
--- a/meson.build
+++ b/meson.build
@@ -210,6 +210,8 @@ config_h.set('HAVE_SNAP', enable_snap,
 enable_malcontent = get_option('malcontent')
 if enable_malcontent
   malcontent_dep = dependency('malcontent-0', version: '>= 0.7.0')
+  config_h.set('HAVE_MALCONTENT_0_10', malcontent_dep.version().version_compare('>= 0.10.0'),
+               description: 'Define to 1 if malcontent ≥ 0.10.0')
 endif
 config_h.set('HAVE_MALCONTENT', enable_malcontent,
              description: 'Define to 1 if malcontent support is enabled')
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index 5a9b5c221..c6d2fcb74 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -1223,7 +1223,14 @@ spawn_malcontent_control (CcUserPanel *self)
 
         /* no-op if the user is administrator */
         if (act_user_get_account_type (user) != ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) {
-                const gchar *argv[] = { "malcontent-control", NULL };
+                const gchar *argv[] = {
+                        "malcontent-control",
+#ifdef HAVE_MALCONTENT_0_10
+                        "--user",
+                        act_user_get_user_name (user),
+#endif  /* HAVE_MALCONTENT_0_10 */
+                        NULL
+                };
                 g_spawn_async (NULL, (char **)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
         }
 }


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