aboutsummaryrefslogtreecommitdiff
path: root/src/greeter.vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-05-15 09:51:50 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-05-15 09:51:50 +0200
commitcd978f758a34f636a375383b1456f4a636a97be5 (patch)
tree442184e910e2fed27cc865c4f0162e1d843339de /src/greeter.vala
parent9dad6b4b1aaecd3ee02ac9d1e4241771ddf2ae25 (diff)
parent2647235691ad8e6b9c06cc5feff4d362c85e37ab (diff)
downloadayatana-indicator-bluetooth-main.tar.gz
ayatana-indicator-bluetooth-main.tar.bz2
ayatana-indicator-bluetooth-main.zip
Merge branch 'tari01-pr/add-desktop-greeter-profile'HEADmain
Attributes GH PR #55: https://github.com/AyatanaIndicators/ayatana-indicator-bluetooth/pull/55
Diffstat (limited to 'src/greeter.vala')
-rw-r--r--src/greeter.vala50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/greeter.vala b/src/greeter.vala
new file mode 100644
index 0000000..17c2042
--- /dev/null
+++ b/src/greeter.vala
@@ -0,0 +1,50 @@
+/*
+* Copyright 2025 Robert Tari <robert@tari.in>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; version 3.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class Greeter: Profile
+{
+ GLib.SimpleActionGroup action_group;
+
+ public Greeter (Bluetooth bluetooth, GLib.SimpleActionGroup action_group)
+ {
+ base (bluetooth, "greeter");
+ this.bluetooth = bluetooth;
+ this.action_group = action_group;
+ GLib.Action[] actions = {};
+ actions += root_action;
+ actions += create_supported_action (bluetooth);
+ actions += create_enabled_action (bluetooth);
+
+ foreach (GLib.Action action in actions)
+ {
+ action_group.add_action (action);
+ }
+
+ GLib.Menu section = new GLib.Menu ();
+ GLib.MenuItem menu_item = create_enabled_menuitem ();
+ section.append_item (menu_item);
+ menu.append_section (null, section);
+
+ bluetooth.notify.connect (() => update_visibility ());
+ update_visibility ();
+ bluetooth.notify.connect (() => update_root_action_state ());
+ }
+
+ void update_visibility ()
+ {
+ visible = bluetooth.enabled;
+ }
+}