Intro
Generate dbus code for golang according to gschema file. A little convenient tool for working in Deepin.
Request
- kingpin for commandline parse.
- pkg.deepin.io/lib/dbus
- gir
Usage
$ gschema-to-godbus --help
usage: gschema-to-godbus --schema=SCHEMA --dest=DEST --path=PATH [<flags>]
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-s, --schema=SCHEMA schema which is going to be translated.
-n, --pkg_name="main" package name used for golang package, default is main.
-d, --dest=DEST dbus dest used for dbus.
-p, --path=PATH dbus path used for dbus.
-o, --output_dir=. output directory to save generated files, default is current directory.
autogen_gsettings.go
and autogen_gsettings_type.go
will be generated, a setter, a getter and a changed signal will be generated for each key. If the range tag is specific, a GetRangeOfX
method will be generated too, like GetRangeOfZoomLevel
.
A function named NewX
and a function named NewXWithHook
, like NewDesktopPreferences
and NewDesktopPreferencesWithHook
, will be generated for each schema. The hook is nullable which should follow SettingHook interface, and if you want to implement your own hook, DefaultSettingHook can be embeded for convenient.
References
- gschema.dtd.
- GVariant doc
- GVariant format strings
- GSettings doc
License
MIT License