Commit 4b2ddba8 authored by Johan Dahlin's avatar Johan Dahlin Committed by John (J5) Palmieri

Add a bus-address command line option

parent c64fd454
......@@ -19,6 +19,8 @@ parser = optparse.OptionParser(usage="%prog [options] [project-file]")
parser.add_option("-l", "--local-dirs", action="store_true", dest="use_local_dirs",
help="Use files from the local directory tree")
parser.add_option("-a", "--bus-address", action="store", dest="bus_address",
help="Bus address to connect to", default=None)
(options, args) = parser.parse_args()
if options.use_local_dirs:
......@@ -45,4 +47,6 @@ import dfeet.DFeetApp as DFeetApp
#Launch the program
app = DFeetApp.DFeetApp()
if options.bus_address is not None:
app.select_or_add_bus(address=options.bus_address)
DFeetApp.gtk.main()
......@@ -97,6 +97,16 @@ class DFeetApp:
n = self.notebook.page_num(child)
self.notebook.remove_page(n)
def select_or_add_bus(self, address):
for i in range(self.notebook.get_n_pages()):
page = self.notebook.get_nth_page(i)
tab_label = self.notebook.get_tab_label(page)
if tab_label.get_children()[0].get_text() == address:
self.notebook.set_current_page(i)
break
else:
self.add_bus(address=address)
def add_bus(self, bus_type=None, address=None):
if bus_type == dbus_introspector.SESSION_BUS or bus_type == dbus_introspector.SYSTEM_BUS:
bus_watch = BusWatch(bus_type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment