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
1=== modified file 'CHANGELOG'
2--- CHANGELOG 2010-08-04 00:30:22 +0000
3+++ CHANGELOG 2010-08-13 23:43:05 +0000
4@@ -4,6 +4,7 @@
5 * Fixed bug with data consistency #579189, by Marko Kevac
6 * Added samba bugzilla to the bugzilla plugin, by Jelmer Vernoij
7 * Fixed bug #532392, a start date is later than a due date, by Volodymyr Floreskul
8+ * support for gtg:// URIs by Luca Invernizzi
9
10 2010-03-01 Getting Things GNOME! 0.2.2
11 * Autostart on login, by Luca Invernizzi
12
13=== modified file 'GTG/__init__.py'
14--- GTG/__init__.py 2010-03-12 11:16:15 +0000
15+++ GTG/__init__.py 2010-08-13 23:43:05 +0000
16@@ -92,3 +92,13 @@
17
18 if os.path.isdir(os.path.join(config_home, 'gtg/plugins')):
19 PLUGIN_DIR.append(os.path.join(config_home, 'gtg/plugins'))
20+
21+#Register GTG URI (temporary, it should be created by a schema upon installing)
22+import gconf
23+domain = "/desktop/gnome/url-handlers/gtg/"
24+client = gconf.client_get_default()
25+#this should work both in debugging mode and in deployed mode
26+client.set_string(os.path.join(domain, "command"), "gtg %s")
27+client.set_bool(os.path.join(domain, "enabled"), True)
28+client.set_bool(os.path.join(domain, "needs_terminal"), False)
29+
30
31=== modified file 'GTG/gtg.py'
32--- GTG/gtg.py 2010-08-03 17:07:31 +0000
33+++ GTG/gtg.py 2010-08-13 23:43:05 +0000
34@@ -46,8 +46,8 @@
35
36 #=== IMPORT ===================================================================
37 import os
38+import sys
39 import logging
40-
41 import dbus
42
43 #our own imports
44@@ -55,7 +55,7 @@
45 from GTG import _
46 from GTG.core import CoreConfig
47 from GTG.core.datastore import DataStore
48-#from GTG.gtk.crashhandler import signal_catcher
49+from GTG.gtk.crashhandler import signal_catcher
50 from GTG.gtk.manager import Manager
51 from GTG.tools.logger import Log
52
53@@ -66,8 +66,11 @@
54 #that's why we put the pid file in the data directory :
55 #we allow one instance of gtg by data directory.
56
57-def check_instance(directory):
58- """Check if gtg is already running."""
59+def check_instance(directory, uri_list = []):
60+ """
61+ Check if gtg is already running.
62+ If so, open the tasks whose ids are in the uri_list
63+ """
64 pidfile = os.path.join(directory, "gtg.pid")
65 if not os.path.exists(pidfile):
66 open(pidfile, "w").close()
67@@ -83,6 +86,10 @@
68 d=dbus.SessionBus().get_object(CoreConfig.BUSNAME,\
69 CoreConfig.BUSINTERFACE)
70 d.show_task_browser()
71+ #if the user has specified a task to open, do that
72+ for uri in uri_list:
73+ if uri.startswith("gtg://"):
74+ d.open_task_editor(uri[6:])
75 raise SystemExit
76
77 #write the pid file
78@@ -102,10 +109,10 @@
79 #To be more user friendly and get the logs of crashes, we show an apport
80 # hooked window upon crashes
81 if options.no_crash_handler == False:
82- #FIXME: Why is this disabled? Please comment when disabling functionality so we know. :-)
83- #with signal_catcher(manager.close_browser):
84- pass
85- manager.main(once_thru=options.boot_test)
86+ with signal_catcher(manager.close_browser):
87+ manager.main(once_thru=options.boot_test, uri_list = args)
88+ else:
89+ manager.main(once_thru=options.boot_test, uri_list = args)
90 core_main_quit(config, ds)
91
92 def core_main_init(options = None, args = None):
93@@ -116,10 +123,11 @@
94 if options.debug:
95 Log.setLevel(logging.DEBUG)
96 Log.debug("Debug output enabled.")
97- Log.set_debugging_mode(True)
98-
99+ else:
100+ Log.setLevel(logging.INFO)
101+ Log.set_debugging_mode(options.debug)
102 config = CoreConfig()
103- check_instance(config.get_data_dir())
104+ check_instance(config.get_data_dir(), args)
105 backends_list = BackendFactory().get_saved_backends_list()
106 # Load data store
107 ds = DataStore()
108@@ -145,6 +153,8 @@
109 # Ending the application: we save configuration
110 config.save()
111 ds.save(quit = True)
112+ sys.exit(0)
113+
114
115 #=== EXECUTION ================================================================
116
117
118=== modified file 'GTG/gtk/browser/browser.py'
119--- GTG/gtk/browser/browser.py 2010-08-10 17:30:24 +0000
120+++ GTG/gtk/browser/browser.py 2010-08-13 23:43:05 +0000
121@@ -953,7 +953,9 @@
122 text = \
123 text.replace("%s%s:%s" % (spaces, attribute, args), "")
124 # Create the new task
125- task = self.req.new_task(tags=[t.get_name() for t in tags], newtask=True)
126+ task = self.req.new_task( newtask=True)
127+ for tag in tags:
128+ task.add_tag(tag.get_name())
129 if text != "":
130 task.set_title(text.strip())
131 task.set_to_keep()
132
133=== modified file 'GTG/gtk/manager.py'
134--- GTG/gtk/manager.py 2010-08-03 17:07:31 +0000
135+++ GTG/gtk/manager.py 2010-08-13 23:43:05 +0000
136@@ -211,7 +211,11 @@
137 self.close_task(t)
138
139 ### MAIN ###################################################################
140- def main(self, once_thru=False):
141+
142+ def main(self, once_thru = False, uri_list = []):
143+ for uri in uri_list:
144+ if uri.startswith("gtg://"):
145+ self.open_task(uri[6:])
146 gobject.threads_init()
147 if once_thru:
148 gtk.main_iteration()

Subscribers

People subscribed via source and target branches

to status/vote changes: