[gnome-panel/wip/muktupavels/api: 2/7] panel-lockdown: add panel_lockdown_get_flags



commit 7b85be0245f01fa382a158d26716646230fb4384
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Apr 14 17:08:54 2020 +0300

    panel-lockdown: add panel_lockdown_get_flags

 gnome-panel/panel-lockdown.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
 gnome-panel/panel-lockdown.h |  6 ++++++
 2 files changed, 51 insertions(+)
---
diff --git a/gnome-panel/panel-lockdown.c b/gnome-panel/panel-lockdown.c
index 3443bace5..8bd5bcb13 100644
--- a/gnome-panel/panel-lockdown.c
+++ b/gnome-panel/panel-lockdown.c
@@ -533,3 +533,48 @@ panel_lockdown_get_disable_force_quit_s (void)
 {
         return panel_lockdown_get_disable_force_quit (panel_lockdown_get ());
 }
+
+GpLockdownFlags
+panel_lockdown_get_flags (PanelLockdown *lockdown,
+                          const char    *iid)
+{
+        GpLockdownFlags flags;
+        int i;
+
+        g_return_val_if_fail (PANEL_IS_LOCKDOWN (lockdown), GP_LOCKDOWN_FLAGS_NONE);
+
+        flags = GP_LOCKDOWN_FLAGS_NONE;
+
+        for (i = 0; lockdown->priv->disabled_applets[i] != NULL; i++) {
+                if (g_strcmp0 (lockdown->priv->disabled_applets[i], iid) == 0) {
+                        flags |= GP_LOCKDOWN_FLAGS_APPLET;
+                        break;
+                }
+        }
+
+        if (lockdown->priv->disable_force_quit)
+                flags |= GP_LOCKDOWN_FLAGS_FORCE_QUIT;
+
+        if (lockdown->priv->panels_locked_down)
+                flags |= GP_LOCKDOWN_FLAGS_LOCKED_DOWN;
+
+        if (lockdown->priv->disable_command_line)
+                flags |= GP_LOCKDOWN_FLAGS_COMMAND_LINE;
+
+        if (lockdown->priv->disable_lock_screen)
+                flags |= GP_LOCKDOWN_FLAGS_LOCK_SCREEN;
+
+        if (lockdown->priv->disable_log_out)
+                flags |= GP_LOCKDOWN_FLAGS_LOG_OUT;
+
+        if (lockdown->priv->disable_switch_user)
+                flags |= GP_LOCKDOWN_FLAGS_USER_SWITCHING;
+
+        return flags;
+}
+
+GpLockdownFlags
+panel_lockdown_get_flags_s (const char *iid)
+{
+        return panel_lockdown_get_flags (panel_lockdown_get (), iid);
+}
diff --git a/gnome-panel/panel-lockdown.h b/gnome-panel/panel-lockdown.h
index 5ae2d64a5..64e1c4e8c 100644
--- a/gnome-panel/panel-lockdown.h
+++ b/gnome-panel/panel-lockdown.h
@@ -25,6 +25,7 @@
 #define __PANEL_LOCKDOWN_H__
 
 #include <gio/gio.h>
+#include "libgnome-panel/gp-lockdown.h"
 
 G_BEGIN_DECLS
 
@@ -81,6 +82,11 @@ gboolean panel_lockdown_get_disable_log_out_s        (void);
 gboolean panel_lockdown_get_disable_switch_user_s    (void);
 gboolean panel_lockdown_get_disable_force_quit_s     (void);
 
+GpLockdownFlags panel_lockdown_get_flags   (PanelLockdown *lockdown,
+                                            const char    *iid);
+
+GpLockdownFlags panel_lockdown_get_flags_s (const char    *iid);
+
 G_END_DECLS
 
 #endif /* __PANEL_LOCKDOWN_H__ */


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