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 {
|
||||
ActionEntry[] action_entries = {
|
||||
{ "about", this.on_about_action },
|
||||
|
|
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',
|
||||
'logic/ctrl.vala',
|
||||
'logic/wireplumber.vala',
|
||||
'dbus.vala',
|
||||
'dbus-iface.vala',
|
||||
]
|
||||
|
||||
wp_api = gnome.generate_vapi(
|
||||
|
@ -21,6 +23,7 @@ add_project_arguments(['--vapidir', meson.current_build_dir()], language: 'vala'
|
|||
|
||||
pipetap_deps = [
|
||||
config_dep,
|
||||
dependency('gio-2.0'),
|
||||
dependency('gtk4'),
|
||||
dependency('libadwaita-1', version: '>= 1.4'),
|
||||
dependency('gtk4-layer-shell-0'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue