GTG

Merge lp:~gtg-user/gtg/uri-support into lp:~gtg/gtg/old-trunk

Proposed by Luca Invernizzi
Status: Superseded
Proposed branch: lp:~gtg-user/gtg/uri-support
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 148 lines (+40/-13)
5 files modified
CHANGELOG (+1/-0)
GTG/__init__.py (+10/-0)
GTG/gtg.py (+21/-11)
GTG/gtk/browser/browser.py (+3/-1)
GTG/gtk/manager.py (+5/-1)
To merge this branch: bzr merge lp:~gtg-user/gtg/uri-support
Reviewer Review Type Date Requested Status
Gtg developers Pending
Review via email: mp+32128@code.launchpad.net

This proposal has been superseded by a proposal from 2010-08-13.

Description of the change

GTG support for URIs of the format gtg://<gtg-task-id>
These URIs are useful for putting tasks links in other programs (e.g, in a tomboy note).
I'm currently using it in the Zeitgeist backend, to let the tasks registered in Zeitgeist and shown through the Activity Journal to be clickable.

On every start, GTG checks if GNOME knows about this kind of URI and, if not, puts itself as an application capable of handling those. Therefore, you can use
xdg-open gtg://<gtg-task-id>.

Tomboy has the same kind of feature through a note:// URI.

To post a comment you must log in.
Revision history for this message
Luca Invernizzi (invernizzi) wrote :

Ps: the last commits messages have the very meaningful name of "a" because I had to do a series of cherrypicking. Only the file that's picked matters.

lp:~gtg-user/gtg/uri-support updated
870. By Luca Invernizzi

merge with trunk

871. By Luca Invernizzi

merge with trunk

872. By Luca Invernizzi

updated changelog

873. By Luca Invernizzi

merge with trunk

874. By Luca Invernizzi

GTG can be opened just with some TaskEditor windows

875. By Luca Invernizzi

merge w/ trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CHANGELOG'
--- CHANGELOG 2010-08-04 00:30:22 +0000
+++ CHANGELOG 2010-08-13 23:43:05 +0000
@@ -4,6 +4,7 @@
4 * Fixed bug with data consistency #579189, by Marko Kevac4 * Fixed bug with data consistency #579189, by Marko Kevac
5 * Added samba bugzilla to the bugzilla plugin, by Jelmer Vernoij5 * Added samba bugzilla to the bugzilla plugin, by Jelmer Vernoij
6 * Fixed bug #532392, a start date is later than a due date, by Volodymyr Floreskul6 * Fixed bug #532392, a start date is later than a due date, by Volodymyr Floreskul
7 * support for gtg:// URIs by Luca Invernizzi
78
82010-03-01 Getting Things GNOME! 0.2.292010-03-01 Getting Things GNOME! 0.2.2
9 * Autostart on login, by Luca Invernizzi10 * Autostart on login, by Luca Invernizzi
1011
=== modified file 'GTG/__init__.py'
--- GTG/__init__.py 2010-03-12 11:16:15 +0000
+++ GTG/__init__.py 2010-08-13 23:43:05 +0000
@@ -92,3 +92,13 @@
9292
93if os.path.isdir(os.path.join(config_home, 'gtg/plugins')):93if os.path.isdir(os.path.join(config_home, 'gtg/plugins')):
94 PLUGIN_DIR.append(os.path.join(config_home, 'gtg/plugins'))94 PLUGIN_DIR.append(os.path.join(config_home, 'gtg/plugins'))
95
96#Register GTG URI (temporary, it should be created by a schema upon installing)
97import gconf
98domain = "/desktop/gnome/url-handlers/gtg/"
99client = gconf.client_get_default()
100#this should work both in debugging mode and in deployed mode
101client.set_string(os.path.join(domain, "command"), "gtg %s")
102client.set_bool(os.path.join(domain, "enabled"), True)
103client.set_bool(os.path.join(domain, "needs_terminal"), False)
104
95105
=== modified file 'GTG/gtg.py'
--- GTG/gtg.py 2010-08-03 17:07:31 +0000
+++ GTG/gtg.py 2010-08-13 23:43:05 +0000
@@ -46,8 +46,8 @@
4646
47#=== IMPORT ===================================================================47#=== IMPORT ===================================================================
48import os48import os
49import sys
49import logging50import logging
50
51import dbus51import dbus
5252
53#our own imports53#our own imports
@@ -55,7 +55,7 @@
55from GTG import _55from GTG import _
56from GTG.core import CoreConfig56from GTG.core import CoreConfig
57from GTG.core.datastore import DataStore57from GTG.core.datastore import DataStore
58#from GTG.gtk.crashhandler import signal_catcher58from GTG.gtk.crashhandler import signal_catcher
59from GTG.gtk.manager import Manager59from GTG.gtk.manager import Manager
60from GTG.tools.logger import Log60from GTG.tools.logger import Log
6161
@@ -66,8 +66,11 @@
66#that's why we put the pid file in the data directory :66#that's why we put the pid file in the data directory :
67#we allow one instance of gtg by data directory.67#we allow one instance of gtg by data directory.
6868
69def check_instance(directory):69def check_instance(directory, uri_list = []):
70 """Check if gtg is already running."""70 """
71 Check if gtg is already running.
72 If so, open the tasks whose ids are in the uri_list
73 """
71 pidfile = os.path.join(directory, "gtg.pid")74 pidfile = os.path.join(directory, "gtg.pid")
72 if not os.path.exists(pidfile):75 if not os.path.exists(pidfile):
73 open(pidfile, "w").close()76 open(pidfile, "w").close()
@@ -83,6 +86,10 @@
83 d=dbus.SessionBus().get_object(CoreConfig.BUSNAME,\86 d=dbus.SessionBus().get_object(CoreConfig.BUSNAME,\
84 CoreConfig.BUSINTERFACE)87 CoreConfig.BUSINTERFACE)
85 d.show_task_browser()88 d.show_task_browser()
89 #if the user has specified a task to open, do that
90 for uri in uri_list:
91 if uri.startswith("gtg://"):
92 d.open_task_editor(uri[6:])
86 raise SystemExit93 raise SystemExit
87 94
88 #write the pid file95 #write the pid file
@@ -102,10 +109,10 @@
102 #To be more user friendly and get the logs of crashes, we show an apport109 #To be more user friendly and get the logs of crashes, we show an apport
103 # hooked window upon crashes110 # hooked window upon crashes
104 if options.no_crash_handler == False:111 if options.no_crash_handler == False:
105 #FIXME: Why is this disabled? Please comment when disabling functionality so we know. :-)112 with signal_catcher(manager.close_browser):
106 #with signal_catcher(manager.close_browser):113 manager.main(once_thru=options.boot_test, uri_list = args)
107 pass114 else:
108 manager.main(once_thru=options.boot_test)115 manager.main(once_thru=options.boot_test, uri_list = args)
109 core_main_quit(config, ds)116 core_main_quit(config, ds)
110117
111def core_main_init(options = None, args = None):118def core_main_init(options = None, args = None):
@@ -116,10 +123,11 @@
116 if options.debug:123 if options.debug:
117 Log.setLevel(logging.DEBUG)124 Log.setLevel(logging.DEBUG)
118 Log.debug("Debug output enabled.")125 Log.debug("Debug output enabled.")
119 Log.set_debugging_mode(True)126 else:
120127 Log.setLevel(logging.INFO)
128 Log.set_debugging_mode(options.debug)
121 config = CoreConfig()129 config = CoreConfig()
122 check_instance(config.get_data_dir())130 check_instance(config.get_data_dir(), args)
123 backends_list = BackendFactory().get_saved_backends_list()131 backends_list = BackendFactory().get_saved_backends_list()
124 # Load data store132 # Load data store
125 ds = DataStore()133 ds = DataStore()
@@ -145,6 +153,8 @@
145 # Ending the application: we save configuration153 # Ending the application: we save configuration
146 config.save()154 config.save()
147 ds.save(quit = True)155 ds.save(quit = True)
156 sys.exit(0)
157
148158
149#=== EXECUTION ================================================================159#=== EXECUTION ================================================================
150160
151161
=== modified file 'GTG/gtk/browser/browser.py'
--- GTG/gtk/browser/browser.py 2010-08-10 17:30:24 +0000
+++ GTG/gtk/browser/browser.py 2010-08-13 23:43:05 +0000
@@ -953,7 +953,9 @@
953 text = \953 text = \
954 text.replace("%s%s:%s" % (spaces, attribute, args), "")954 text.replace("%s%s:%s" % (spaces, attribute, args), "")
955 # Create the new task955 # Create the new task
956 task = self.req.new_task(tags=[t.get_name() for t in tags], newtask=True)956 task = self.req.new_task( newtask=True)
957 for tag in tags:
958 task.add_tag(tag.get_name())
957 if text != "":959 if text != "":
958 task.set_title(text.strip())960 task.set_title(text.strip())
959 task.set_to_keep()961 task.set_to_keep()
960962
=== modified file 'GTG/gtk/manager.py'
--- GTG/gtk/manager.py 2010-08-03 17:07:31 +0000
+++ GTG/gtk/manager.py 2010-08-13 23:43:05 +0000
@@ -211,7 +211,11 @@
211 self.close_task(t)211 self.close_task(t)
212 212
213### MAIN ###################################################################213### MAIN ###################################################################
214 def main(self, once_thru=False):214
215 def main(self, once_thru = False, uri_list = []):
216 for uri in uri_list:
217 if uri.startswith("gtg://"):
218 self.open_task(uri[6:])
215 gobject.threads_init()219 gobject.threads_init()
216 if once_thru:220 if once_thru:
217 gtk.main_iteration()221 gtk.main_iteration()

Subscribers

People subscribed via source and target branches

to status/vote changes: