summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-03-26 23:17:16 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-03-26 23:17:46 +0100
commitb14c926569ad40d5201787b64f5537eda578c92c (patch)
tree1e7d2bb4968d5a62c7ee0e4cf9d34877b24eda46
parent5e745a2faa5f2780e4ebcd42ea0105bdd9c8bd57 (diff)
downloadd-feet-b14c926569ad40d5201787b64f5537eda578c92c.tar.gz
DFeetApp: add --address
This will allow to open D-Feet directly to a given address from the CLI. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r--src/dfeet/application.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dfeet/application.py b/src/dfeet/application.py
index 7f4f44a..5d88e00 100644
--- a/src/dfeet/application.py
+++ b/src/dfeet/application.py
@@ -33,6 +33,8 @@ class DFeetApp(Gtk.Application):
flags=Gio.ApplicationFlags.FLAGS_NONE)
self.add_main_option_entries([
make_option("--version", description=_("Show version number and exit")),
+ make_option("--address", arg=GLib.OptionArg.STRING, arg_description="ADDRESS",
+ description=_("Open the specified bus address")),
])
def do_handle_local_options(self, options):
@@ -45,6 +47,10 @@ class DFeetApp(Gtk.Application):
# Note that the function in C activate() becomes do_activate() in Python
def do_activate(self):
self._main_win = DFeetWindow(self, self.version, self.data_dir)
+ if self.options.contains("address"):
+ address = self.options.lookup_value("address").get_string()
+ if not self._main_win.connect_to(address):
+ self.quit()
# Note that the function in C startup() becomes do_startup() in Python
def do_startup(self):