DBUS: Add WIP dbus functionality
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
2c08ae1195
commit
2bb70d5fd7
4 changed files with 28 additions and 1 deletions
|
@ -33,6 +33,12 @@ public class PipeTap.Application : Adw.Application {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool dbus_register (GLib.DBusConnection connection, string object_path) {
|
||||||
|
base.dbus_register (connection, object_path);
|
||||||
|
DBus.init (connection, object_path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
ActionEntry[] action_entries = {
|
ActionEntry[] action_entries = {
|
||||||
{ "about", this.on_about_action },
|
{ "about", this.on_about_action },
|
||||||
|
@ -124,4 +130,4 @@ public class PipeTap.Application : Adw.Application {
|
||||||
settings.apply ();
|
settings.apply ();
|
||||||
this.settings.apply ();
|
this.settings.apply ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
src/dbus-iface.vala
Normal file
4
src/dbus-iface.vala
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[DBus (name = "io.gitlab.nekocwd.pipetap1")]
|
||||||
|
public interface PipeTap.DBus.ServerIface : Object {
|
||||||
|
public abstract int focus { get; set; }
|
||||||
|
}
|
14
src/dbus.vala
Normal file
14
src/dbus.vala
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
namespace PipeTap.DBus {
|
||||||
|
public class Server : ServerIface, Object {
|
||||||
|
public int focus {
|
||||||
|
get { message ("Gett"); return Logic.find_ctrl (Logic.Ctrl.CtrlType.Focus).value; }
|
||||||
|
set { message ("Sett %d", value); Logic.find_ctrl (Logic.Ctrl.CtrlType.Focus).value = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Server server;
|
||||||
|
public void init (GLib.DBusConnection conn, string path) {
|
||||||
|
server = new Server ();
|
||||||
|
message ("DBUS connection is %snull", conn != null ? "not " : "");
|
||||||
|
conn.register_object<ServerIface> (path, server);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,8 @@ pipetap_sources = [
|
||||||
'gui/settings.vala',
|
'gui/settings.vala',
|
||||||
'logic/ctrl.vala',
|
'logic/ctrl.vala',
|
||||||
'logic/wireplumber.vala',
|
'logic/wireplumber.vala',
|
||||||
|
'dbus.vala',
|
||||||
|
'dbus-iface.vala',
|
||||||
]
|
]
|
||||||
|
|
||||||
wp_api = gnome.generate_vapi(
|
wp_api = gnome.generate_vapi(
|
||||||
|
@ -21,6 +23,7 @@ add_project_arguments(['--vapidir', meson.current_build_dir()], language: 'vala'
|
||||||
|
|
||||||
pipetap_deps = [
|
pipetap_deps = [
|
||||||
config_dep,
|
config_dep,
|
||||||
|
dependency('gio-2.0'),
|
||||||
dependency('gtk4'),
|
dependency('gtk4'),
|
||||||
dependency('libadwaita-1', version: '>= 1.4'),
|
dependency('libadwaita-1', version: '>= 1.4'),
|
||||||
dependency('gtk4-layer-shell-0'),
|
dependency('gtk4-layer-shell-0'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue