← Back to team overview

gtg team mailing list archive

[Bug 515431] Re: Autostart from DBus (for gtg_new_task)

 

** Changed in: gtg
       Status: Fix Committed => Fix Released

-- 
Autostart from DBus (for gtg_new_task)
https://bugs.launchpad.net/bugs/515431
You received this bug notification because you are a member of Gtg
contributors, which is subscribed to Getting Things GNOME!.

Status in Getting Things GNOME!: Fix Released

Bug description:
As set up, gtg_new_task only works if gtg is already running. This is unnecessary and can be fixed with simple changes to that script and addition of a .service file.

Add file: /usr/share/dbus-1/services/org.GTG.service containing

"""
[D-BUS Service]
Name=org.GTG
Exec=/usr/bin/gtg

"""

and change the get_task() function of gtg_new_task to

"""
def get_task() :
    #We will connect on the session bus
    bus = dbus.SessionBus()
    liste = bus.list_names()
    busname = "org.GTG"
    remote_object = bus.get_object(busname,"/org/GTG")
    timi = dbus.Interface(remote_object,dbus_interface="org.GTG")
    #Calling the method
    timi.open_new_task()
    
"""

The existing code searches for an already existing bus rather than trying to connect automatically so wouldn't work with just the addition of the .service file above.

(I don't know if .service files are meant to be provided by applications or distributions)