blob: 17c2042a634fbbf8c8b151838734777e5e9d615c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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;
}
}
|