11[DBus (name = " org.bluez.Agent1" )]
22public class Agent : Object
33{
4+ public GLib . Menu menu;
5+ public GLib . SimpleActionGroup actions;
6+
7+ private GLib . SimpleAction pin_action;
48 private MainLoop loop;
59 private Bluetooth bluetooth;
610
711 public Agent (Bluetooth bluez )
812 {
13+ // Menu
14+ menu = new GLib .Menu ();
15+ GLib . MenuItem item = new GLib .MenuItem (" PIN" , " password" );
16+ item. set_attribute_value (" x-canonical-type" , new Variant .string (" com.canonical.snapdecision.textfield" ));
17+ item. set_attribute_value (" x-echo-mode-password" , new Variant .boolean (false ));
18+ menu. append_item (item);
19+
20+ // Actions
21+ actions = new GLib .SimpleActionGroup ();
22+ pin_action = new GLib .SimpleAction .stateful (" password" , null , new Variant .string (" " ));
23+ pin_action. change_state. connect ((value ) = > {
24+ warning (" HELLO!" );
25+ });
26+ actions. add_action (pin_action);
27+
928 loop = new MainLoop (null , false );
1029 bluetooth = bluez;
1130 Notify . init (" ayatana-indicator-bluetooth" );
@@ -22,6 +41,22 @@ public class Agent: Object
2241 {
2342 notification. set_hint (" x-lomiri-snap-decisions" , true );
2443 notification. set_hint (" x-lomiri-private-affirmative-tint" , " true" );
44+
45+ VariantBuilder actions_builder = new VariantBuilder (new VariantType (" a{sv}" ));
46+ actions_builder. add (" {sv}" , " notifications" , new Variant .string (" /agent/actions" ));
47+ Variant actions = actions_builder. end ();
48+
49+ VariantBuilder builder = new VariantBuilder (new VariantType (" a{sv}" ));
50+ builder. add (" {sv}" , " busName" , new Variant .string (" org.ayatana.indicator.bluetooth" ));
51+ builder. add (" {sv}" , " menuPath" , new Variant .string (" /agent/menu" ));
52+ builder. add (" {sv}" , " actions" , actions);
53+ Variant stuff = builder. end ();
54+
55+ notification. set_hint (" x-lomiri-private-menu-model" , stuff);
56+
57+ string some_shit = actions. print(true );
58+ string other_shit = stuff. print(true );
59+ warning (@" we got some stuff! $some_shit $other_shit " );
2560 }
2661
2762 notification. add_action(" yes_id" , " Yes" , (notif, action) = > {
0 commit comments