aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2026-06-11 19:40:30 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2026-06-13 20:17:48 +0200
commitce2286e1c9cdea9a8fe8ffccd854ce268c1c645f (patch)
treecb2ee30f21699436ed26483a04ce303f3f7a0e32
parentf7a59246658cc2034b2a25a6e2c5a50ca9fa1dc1 (diff)
downloadayatana-indicator-bluetooth-ce2286e1c9cdea9a8fe8ffccd854ce268c1c645f.tar.gz
ayatana-indicator-bluetooth-ce2286e1c9cdea9a8fe8ffccd854ce268c1c645f.tar.bz2
ayatana-indicator-bluetooth-ce2286e1c9cdea9a8fe8ffccd854ce268c1c645f.zip
phone_greeter: Introduce profile that applies to bt indicator when run as part of a phone's greeter
-rw-r--r--data/org.ayatana.indicator.bluetooth4
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/CMakeLists.txt13
-rw-r--r--src/desktop_greeter.vala50
-rw-r--r--src/phone_greeter.vala (renamed from src/greeter.vala)6
-rw-r--r--src/service.vala3
6 files changed, 70 insertions, 8 deletions
diff --git a/data/org.ayatana.indicator.bluetooth b/data/org.ayatana.indicator.bluetooth
index 9f95e01..9b9e137 100644
--- a/data/org.ayatana.indicator.bluetooth
+++ b/data/org.ayatana.indicator.bluetooth
@@ -14,9 +14,9 @@ Position=36
ObjectPath=/org/ayatana/indicator/bluetooth/desktop
[phone_greeter]
-ObjectPath=/org/ayatana/indicator/bluetooth/phone
+ObjectPath=/org/ayatana/indicator/bluetooth/phone_greeter
Position=36
[desktop_greeter]
-ObjectPath=/org/ayatana/indicator/bluetooth/greeter
+ObjectPath=/org/ayatana/indicator/bluetooth/desktop_greeter
Position=36
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 181facd..106e1e1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,10 +6,12 @@ src/agent.vala
src/bluetooth.vala
src/bluez.vala
src/desktop.vala
+src/desktop_greeter.vala
src/device.vala
src/killswitch.vala
src/main.vala
src/phone.vala
+src/phone_greeter.vala
src/profile.vala
src/service.vala
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d616baf..d63eda2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -56,7 +56,7 @@ vala_add(ayatana-indicator-bluetooth-service
)
vala_add(ayatana-indicator-bluetooth-service
- greeter.vala
+ desktop_greeter.vala
DEPENDS
profile
bluetooth
@@ -80,6 +80,14 @@ vala_add(ayatana-indicator-bluetooth-service
)
vala_add(ayatana-indicator-bluetooth-service
+ phone_greeter.vala
+ DEPENDS
+ profile
+ bluetooth
+ device
+)
+
+vala_add(ayatana-indicator-bluetooth-service
profile.vala
DEPENDS
bluetooth
@@ -93,8 +101,9 @@ vala_add(ayatana-indicator-bluetooth-service
profile
device
phone
+ phone_greeter
desktop
- greeter
+ desktop_greeter
agent
)
diff --git a/src/desktop_greeter.vala b/src/desktop_greeter.vala
new file mode 100644
index 0000000..01737e0
--- /dev/null
+++ b/src/desktop_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 DesktopGreeter: Profile
+{
+ GLib.SimpleActionGroup action_group;
+
+ public DesktopGreeter (Bluetooth bluetooth, GLib.SimpleActionGroup action_group)
+ {
+ base (bluetooth, "desktop_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;
+ }
+}
diff --git a/src/greeter.vala b/src/phone_greeter.vala
index 17c2042..d9fe437 100644
--- a/src/greeter.vala
+++ b/src/phone_greeter.vala
@@ -14,13 +14,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class Greeter: Profile
+class PhoneGreeter: Profile
{
GLib.SimpleActionGroup action_group;
- public Greeter (Bluetooth bluetooth, GLib.SimpleActionGroup action_group)
+ public PhoneGreeter (Bluetooth bluetooth, GLib.SimpleActionGroup action_group)
{
- base (bluetooth, "greeter");
+ base (bluetooth, "phone_greeter");
this.bluetooth = bluetooth;
this.action_group = action_group;
GLib.Action[] actions = {};
diff --git a/src/service.vala b/src/service.vala
index cff90d3..f5b33be 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -78,8 +78,9 @@ public class Service: Object
profiles = new HashTable<string,Profile> (str_hash, str_equal);
profiles.insert ("phone", new Phone (bluetooth, actions));
+ profiles.insert ("phone_greeter", new PhoneGreeter (bluetooth, actions));
profiles.insert ("desktop", new Desktop (bluetooth, actions));
- profiles.insert ("greeter", new Greeter (bluetooth, actions));
+ profiles.insert ("desktop_greeter", new DesktopGreeter (bluetooth, actions));
}
public int run ()