aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2023-04-06 13:25:21 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-04-27 21:22:09 +0200
commitb4cabeb1a0d7d36a8d25a53fef7dd86be1b1c8b3 (patch)
tree0aaebd5bb035e3ed39400c307fd63e8d690b693f /src
parent8ab10462cd87ae2d0fa2c6560d441cd80872cc48 (diff)
downloadayatana-indicator-session-b4cabeb1a0d7d36a8d25a53fef7dd86be1b1c8b3.tar.gz
ayatana-indicator-session-b4cabeb1a0d7d36a8d25a53fef7dd86be1b1c8b3.tar.bz2
ayatana-indicator-session-b4cabeb1a0d7d36a8d25a53fef7dd86be1b1c8b3.zip
Add options to hide items in the admin section
Diffstat (limited to 'src')
-rw-r--r--src/service.c83
1 files changed, 61 insertions, 22 deletions
diff --git a/src/service.c b/src/service.c
index 760c64b..6f4e294 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
- * Copyright 2021-2022 Robert Tari
+ * Copyright 2021-2023 Robert Tari
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
@@ -379,30 +379,59 @@ create_admin_section (IndicatorSessionService * self)
{
GMenu * menu;
priv_t * p = self->priv;
- gchar * desktop_help_label = NULL;
- gchar * distro_help_label = NULL;
- if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0)
- {
- desktop_help_label = g_strdup(_("About Ubuntu Touch…"));
- distro_help_label = g_strdup(_("About UBports Foundation…"));
- }
- else
- {
- desktop_help_label = g_strdup_printf(_("%s Help…"), get_desktop_name());
- distro_help_label = g_strdup_printf(_("%s Help…"), get_distro_name());
- }
menu = g_menu_new ();
- if (ayatana_common_utils_is_lomiri()) {
- g_menu_append (menu, _("About This Device…"), "indicator.about");
- } else {
- g_menu_append (menu, _("About This Computer"), "indicator.about");
+ gboolean bShowDeviceInfo = g_settings_get_boolean (self->priv->indicator_settings, "show-device-info");
+
+ if (bShowDeviceInfo)
+ {
+ if (ayatana_common_utils_is_lomiri())
+ {
+ g_menu_append (menu, _("About This Device…"), "indicator.about");
+ }
+ else
+ {
+ g_menu_append (menu, _("About This Computer"), "indicator.about");
+ }
+ }
+
+ gboolean bShowDesktopHelp = g_settings_get_boolean (self->priv->indicator_settings, "show-desktop-help");
+
+ if (bShowDesktopHelp)
+ {
+ gchar *desktop_help_label = NULL;
+
+ if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0)
+ {
+ desktop_help_label = g_strdup(_("About Ubuntu Touch…"));
+ }
+ else
+ {
+ desktop_help_label = g_strdup_printf(_("%s Help…"), get_desktop_name());
+ }
+
+ g_menu_append (menu, desktop_help_label, "indicator.desktop_help");
+ g_free (desktop_help_label);
}
- g_menu_append (menu, desktop_help_label, "indicator.desktop_help");
- g_menu_append (menu, distro_help_label, "indicator.distro_help");
- g_free (desktop_help_label);
- g_free (distro_help_label);
+ gboolean bShowDistroHelp = g_settings_get_boolean (self->priv->indicator_settings, "show-distro-help");
+
+ if (bShowDistroHelp)
+ {
+ gchar *distro_help_label = NULL;
+
+ if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0)
+ {
+ distro_help_label = g_strdup(_("About UBports Foundation…"));
+ }
+ else
+ {
+ distro_help_label = g_strdup_printf(_("%s Help…"), get_distro_name());
+ }
+
+ g_menu_append (menu, distro_help_label, "indicator.distro_help");
+ g_free (distro_help_label);
+ }
if (p->usage_mode_action && ayatana_common_utils_is_lomiri())
{
@@ -413,7 +442,13 @@ create_admin_section (IndicatorSessionService * self)
g_object_unref(menu_item);
}
- g_menu_append (menu, _("Report a Bug…"), "indicator.bug");
+ gboolean bShowBugReport = g_settings_get_boolean (self->priv->indicator_settings, "show-bug-report");
+
+ if (bShowBugReport)
+ {
+ g_menu_append (menu, _("Report a Bug…"), "indicator.bug");
+ }
+
return G_MENU_MODEL (menu);
}
@@ -1383,6 +1418,10 @@ indicator_session_service_init (IndicatorSessionService * self)
G_CALLBACK(rebuild_header_soon), self);
g_signal_connect_swapped (gp, "changed::user-show-menu",
G_CALLBACK(user_show_menu_changed), self);
+ g_signal_connect_swapped (gp, "changed::show-device-info", G_CALLBACK (rebuild_admin_section_soon), self);
+ g_signal_connect_swapped (gp, "changed::show-desktop-help", G_CALLBACK (rebuild_admin_section_soon), self);
+ g_signal_connect_swapped (gp, "changed::show-distro-help", G_CALLBACK (rebuild_admin_section_soon), self);
+ g_signal_connect_swapped (gp, "changed::show-bug-report", G_CALLBACK (rebuild_admin_section_soon), self);
/* watch for changes to the lock keybinding */
gp = p->keybinding_settings;