Merge lp:~mhr3/libzeitgeist/various-fixes into lp:libzeitgeist
- various-fixes
- Merge into trunk
Proposed by
Michal Hruby
Status: | Merged |
---|---|
Merged at revision: | 191 |
Proposed branch: | lp:~mhr3/libzeitgeist/various-fixes |
Merge into: | lp:libzeitgeist |
Diff against target: |
514 lines (+0/-451) 6 files modified
Makefile.am (+0/-4) configure.ac (+0/-26) module/Makefile.am (+0/-28) module/gapplaunchhandlerzeitgeist.c (+0/-304) module/gapplaunchhandlerzeitgeist.h (+0/-49) module/zeitgeist-module.c (+0/-40) |
To merge this branch: | bzr merge lp:~mhr3/libzeitgeist/various-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
LibZeitgeist Developers | Pending | ||
Review via email: mp+48904@code.launchpad.net |
Commit message
Description of the change
Remove the GIO module, it's Ubuntu specific and its function is now overtaken by datahub.
To post a comment you must log in.
- 191. By Mikkel Kamstrup Erlandsen
-
Merge Michal's branch, lp:~mhr3/libzeitgeist/various-fixes, removing the giomodule. The same functionality has been implemented in lp:zeitgeist-datahub trunk.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile.am' | |||
2 | --- Makefile.am 2010-08-18 19:51:26 +0000 | |||
3 | +++ Makefile.am 2011-02-08 11:56:54 +0000 | |||
4 | @@ -5,10 +5,6 @@ | |||
5 | 5 | examples \ | 5 | examples \ |
6 | 6 | tests | 6 | tests |
7 | 7 | 7 | ||
8 | 8 | if ENABLE_GIOMODULE | ||
9 | 9 | SUBDIRS += module | ||
10 | 10 | endif | ||
11 | 11 | |||
12 | 12 | pkgconfigdir = $(libdir)/pkgconfig | 8 | pkgconfigdir = $(libdir)/pkgconfig |
13 | 13 | pkgconfig_DATA = zeitgeist-1.0.pc | 9 | pkgconfig_DATA = zeitgeist-1.0.pc |
14 | 14 | 10 | ||
15 | 15 | 11 | ||
16 | === modified file 'configure.ac' | |||
17 | --- configure.ac 2010-12-17 10:41:52 +0000 | |||
18 | +++ configure.ac 2011-02-08 11:56:54 +0000 | |||
19 | @@ -67,19 +67,6 @@ | |||
20 | 67 | AC_SUBST(MAINTAINER_CFLAGS) | 67 | AC_SUBST(MAINTAINER_CFLAGS) |
21 | 68 | 68 | ||
22 | 69 | #################################################################### | 69 | #################################################################### |
23 | 70 | # Check whether to build GIO extension point module | ||
24 | 71 | #################################################################### | ||
25 | 72 | AC_ARG_ENABLE([module], | ||
26 | 73 | AS_HELP_STRING([--enable-module=@<:@yes/no@:>@],[build GIO extension point module @<:@default=yes@:>@]),, | ||
27 | 74 | [enable_module=yes]) | ||
28 | 75 | |||
29 | 76 | if test "x$enable_module" = "xyes"; then | ||
30 | 77 | AC_DEFINE(ENABLE_GIOMODULE, 1, [build GIO extension point module]) | ||
31 | 78 | fi | ||
32 | 79 | |||
33 | 80 | AM_CONDITIONAL(ENABLE_GIOMODULE, test "$enable_module" = "yes") | ||
34 | 81 | |||
35 | 82 | #################################################################### | ||
36 | 83 | # Check library deps | 70 | # Check library deps |
37 | 84 | #################################################################### | 71 | #################################################################### |
38 | 85 | GLIB_REQUIRED=2.26 | 72 | GLIB_REQUIRED=2.26 |
39 | @@ -93,16 +80,6 @@ | |||
40 | 93 | AC_SUBST(ZEITGEIST_CFLAGS) | 80 | AC_SUBST(ZEITGEIST_CFLAGS) |
41 | 94 | AC_SUBST(ZEITGEIST_LIBS) | 81 | AC_SUBST(ZEITGEIST_LIBS) |
42 | 95 | 82 | ||
43 | 96 | ZEITGEIST_GIOMODULE_CFLAGS="$GLIB2_CFLAGS $GOBJECT2_CFLAGS $GIO2_CFLAGS $GIO_UNIX2_CFLAGS $ZEITGEIST_CFLAGS" | ||
44 | 97 | ZEITGEIST_GIOMODULE_LIBS="$GLIB2_LIBS $GOBJECT2_LIBS $GIO2_LIBS $GIO_UNIX2_LIBS $ZEITGEIST_LIBS" | ||
45 | 98 | AC_SUBST(ZEITGEIST_GIOMODULE_CFLAGS) | ||
46 | 99 | AC_SUBST(ZEITGEIST_GIOMODULE_LIBS) | ||
47 | 100 | |||
48 | 101 | # Make giomodulesdir honour 'prefix', so that distcheck works. | ||
49 | 102 | origgiomodulesdir=`pkg-config --variable=giomoduledir gio-2.0` | ||
50 | 103 | giomodulesdir=`echo "$origgiomodulesdir" | sed 's|/usr|${prefix}|'` | ||
51 | 104 | AC_SUBST(giomodulesdir) | ||
52 | 105 | |||
53 | 106 | GTK_DOC_CHECK(1.0) | 83 | GTK_DOC_CHECK(1.0) |
54 | 107 | 84 | ||
55 | 108 | AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums) | 85 | AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums) |
56 | @@ -120,7 +97,6 @@ | |||
57 | 120 | examples/Makefile | 97 | examples/Makefile |
58 | 121 | src/Makefile | 98 | src/Makefile |
59 | 122 | tests/Makefile | 99 | tests/Makefile |
60 | 123 | module/Makefile | ||
61 | 124 | ]) | 100 | ]) |
62 | 125 | 101 | ||
63 | 126 | AC_MSG_NOTICE([ | 102 | AC_MSG_NOTICE([ |
64 | @@ -132,8 +108,6 @@ | |||
65 | 132 | 108 | ||
66 | 133 | Build API docs : ${enable_gtk_doc} | 109 | Build API docs : ${enable_gtk_doc} |
67 | 134 | 110 | ||
68 | 135 | Build GIO module : ${enable_module} | ||
69 | 136 | |||
70 | 137 | Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS | 111 | Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS |
71 | 138 | ]) | 112 | ]) |
72 | 139 | 113 | ||
73 | 140 | 114 | ||
74 | === removed directory 'module' | |||
75 | === removed file 'module/Makefile.am' | |||
76 | --- module/Makefile.am 2010-11-17 14:48:02 +0000 | |||
77 | +++ module/Makefile.am 1970-01-01 00:00:00 +0000 | |||
78 | @@ -1,28 +0,0 @@ | |||
79 | 1 | libdir = $(giomodulesdir) | ||
80 | 2 | lib_LTLIBRARIES = libgiozeitgeist.la | ||
81 | 3 | |||
82 | 4 | |||
83 | 5 | libgiozeitgeist_la_SOURCES = \ | ||
84 | 6 | gapplaunchhandlerzeitgeist.c \ | ||
85 | 7 | gapplaunchhandlerzeitgeist.h \ | ||
86 | 8 | zeitgeist-module.c \ | ||
87 | 9 | $(NULL) | ||
88 | 10 | |||
89 | 11 | libgiozeitgeist_la_CFLAGS = \ | ||
90 | 12 | -I$(top_srcdir)/src \ | ||
91 | 13 | -I$(top_builddir)/src \ | ||
92 | 14 | $(ZEITGEIST_GIOMODULE_CFLAGS) \ | ||
93 | 15 | -DG_LOG_DOMAIN=\"ZeitgeistGIOModule\" \ | ||
94 | 16 | $(NULL) | ||
95 | 17 | |||
96 | 18 | module_flags = -export_dynamic -avoid-version -module -no-undefined -export-symbols-regex '^g_io_module_(load|unload)' | ||
97 | 19 | |||
98 | 20 | libgiozeitgeist_la_LDFLAGS = \ | ||
99 | 21 | $(module_flags) \ | ||
100 | 22 | $(NULL) | ||
101 | 23 | |||
102 | 24 | libgiozeitgeist_la_LIBADD = \ | ||
103 | 25 | $(ZEITGEIST_GIOMODULE_LIBS) \ | ||
104 | 26 | $(top_builddir)/src/libzeitgeist-1.0.la \ | ||
105 | 27 | $(NULL) | ||
106 | 28 | |||
107 | 29 | 0 | ||
108 | === removed file 'module/gapplaunchhandlerzeitgeist.c' | |||
109 | --- module/gapplaunchhandlerzeitgeist.c 2010-09-16 12:11:26 +0000 | |||
110 | +++ module/gapplaunchhandlerzeitgeist.c 1970-01-01 00:00:00 +0000 | |||
111 | @@ -1,304 +0,0 @@ | |||
112 | 1 | /* | ||
113 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
114 | 3 | * | ||
115 | 4 | * This library is free software; you can redistribute it and/or modify | ||
116 | 5 | * it under the terms of the GNU Lesser General Public License | ||
117 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
118 | 7 | * | ||
119 | 8 | * This library is distributed in the hope that it will be useful, | ||
120 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
121 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
122 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
123 | 12 | * | ||
124 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
125 | 14 | * License along with this library. If not, see | ||
126 | 15 | * <http://www.gnu.org/licenses/>. | ||
127 | 16 | * | ||
128 | 17 | * Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com> | ||
129 | 18 | */ | ||
130 | 19 | |||
131 | 20 | #include <config.h> | ||
132 | 21 | |||
133 | 22 | #include <glib.h> | ||
134 | 23 | #include <gio/gio.h> | ||
135 | 24 | #include <gio/gdesktopappinfo.h> | ||
136 | 25 | #include <zeitgeist.h> | ||
137 | 26 | |||
138 | 27 | #include "gapplaunchhandlerzeitgeist.h" | ||
139 | 28 | |||
140 | 29 | static ZeitgeistLog *log = NULL; | ||
141 | 30 | static gpointer log_w = NULL; | ||
142 | 31 | |||
143 | 32 | struct _GAppLaunchHandlerZeitgeist { | ||
144 | 33 | GObject parent; | ||
145 | 34 | |||
146 | 35 | }; | ||
147 | 36 | |||
148 | 37 | static void launch_handler_iface_init (GDesktopAppInfoLaunchHandlerIface *iface); | ||
149 | 38 | static void g_app_launch_handler_zeitgeist_finalize (GObject *object); | ||
150 | 39 | static void ensure_log (void); | ||
151 | 40 | |||
152 | 41 | #define _G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ | ||
153 | 42 | const GInterfaceInfo g_implement_interface_info = { \ | ||
154 | 43 | (GInterfaceInitFunc) iface_init, NULL, NULL \ | ||
155 | 44 | }; \ | ||
156 | 45 | g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ | ||
157 | 46 | } | ||
158 | 47 | |||
159 | 48 | G_DEFINE_DYNAMIC_TYPE_EXTENDED (GAppLaunchHandlerZeitgeist, g_app_launch_handler_zeitgeist, G_TYPE_OBJECT, 0, | ||
160 | 49 | _G_IMPLEMENT_INTERFACE_DYNAMIC (G_TYPE_DESKTOP_APP_INFO_LAUNCH_HANDLER, | ||
161 | 50 | launch_handler_iface_init)) | ||
162 | 51 | |||
163 | 52 | /* We lazily create the ZeitgeistLog lazily because it creates a dbus | ||
164 | 53 | * connection, which if set up during the GIOModule registration phase | ||
165 | 54 | * (ie inside g_app_launch_handler_zeitgeist_register()) might mess up the | ||
166 | 55 | * gio module initialization process. | ||
167 | 56 | * | ||
168 | 57 | * Spurious deadlocks and segfaults have been observed without | ||
169 | 58 | * lazy setup of the log. | ||
170 | 59 | */ | ||
171 | 60 | static void | ||
172 | 61 | ensure_log (void) | ||
173 | 62 | { | ||
174 | 63 | if (log_w == NULL) | ||
175 | 64 | { | ||
176 | 65 | log = zeitgeist_log_new (); | ||
177 | 66 | log_w = log; | ||
178 | 67 | g_object_add_weak_pointer (G_OBJECT (log), &log_w); | ||
179 | 68 | } | ||
180 | 69 | } | ||
181 | 70 | |||
182 | 71 | static void | ||
183 | 72 | g_app_launch_handler_zeitgeist_finalize (GObject *object) | ||
184 | 73 | { | ||
185 | 74 | if (G_OBJECT_CLASS (g_app_launch_handler_zeitgeist_parent_class)->finalize) | ||
186 | 75 | (*G_OBJECT_CLASS (g_app_launch_handler_zeitgeist_parent_class)->finalize) (object); | ||
187 | 76 | } | ||
188 | 77 | |||
189 | 78 | static GObject * | ||
190 | 79 | g_app_launch_handler_zeitgeist_constructor (GType type, | ||
191 | 80 | guint n_construct_properties, | ||
192 | 81 | GObjectConstructParam *construct_properties) | ||
193 | 82 | { | ||
194 | 83 | GObject *object; | ||
195 | 84 | GAppLaunchHandlerZeitgeistClass *klass; | ||
196 | 85 | GObjectClass *parent_class; | ||
197 | 86 | |||
198 | 87 | object = NULL; | ||
199 | 88 | |||
200 | 89 | /* Invoke parent constructor. */ | ||
201 | 90 | klass = G_APP_LAUNCH_HANDLER_ZEITGEIST_CLASS (g_type_class_peek (G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST)); | ||
202 | 91 | parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass)); | ||
203 | 92 | object = parent_class->constructor (type, | ||
204 | 93 | n_construct_properties, | ||
205 | 94 | construct_properties); | ||
206 | 95 | |||
207 | 96 | return object; | ||
208 | 97 | } | ||
209 | 98 | |||
210 | 99 | static void | ||
211 | 100 | g_app_launch_handler_zeitgeist_init (GAppLaunchHandlerZeitgeist *lookup) | ||
212 | 101 | { | ||
213 | 102 | } | ||
214 | 103 | |||
215 | 104 | static void | ||
216 | 105 | g_app_launch_handler_zeitgeist_class_finalize (GAppLaunchHandlerZeitgeistClass *klass) | ||
217 | 106 | { | ||
218 | 107 | } | ||
219 | 108 | |||
220 | 109 | |||
221 | 110 | static void | ||
222 | 111 | g_app_launch_handler_zeitgeist_class_init (GAppLaunchHandlerZeitgeistClass *klass) | ||
223 | 112 | { | ||
224 | 113 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | ||
225 | 114 | |||
226 | 115 | gobject_class->constructor = g_app_launch_handler_zeitgeist_constructor; | ||
227 | 116 | gobject_class->finalize = g_app_launch_handler_zeitgeist_finalize; | ||
228 | 117 | } | ||
229 | 118 | |||
230 | 119 | /* | ||
231 | 120 | static void | ||
232 | 121 | on_subject_info_ready (GFile *file, | ||
233 | 122 | GAsyncResult *res, | ||
234 | 123 | ZeitgeistEvent *ev) | ||
235 | 124 | { | ||
236 | 125 | ZeitgeistSubject *su; | ||
237 | 126 | GError *error; | ||
238 | 127 | GFileInfo *info; | ||
239 | 128 | GFile *parent_file; | ||
240 | 129 | gchar *uri, *parent_uri; | ||
241 | 130 | const gchar *display_name, *filesystem, *mimetype; | ||
242 | 131 | |||
243 | 132 | uri = g_file_get_uri (file); | ||
244 | 133 | |||
245 | 134 | error = NULL; | ||
246 | 135 | info = g_file_query_info_finish (file, res, &error); | ||
247 | 136 | if (error != NULL) | ||
248 | 137 | { | ||
249 | 138 | // On anything but a file-not-found we complain in the log | ||
250 | 139 | if (error->code != G_IO_ERROR_NOT_FOUND) | ||
251 | 140 | g_warning ("Error querying file info for '%s': %s", | ||
252 | 141 | uri, error->message); | ||
253 | 142 | |||
254 | 143 | g_free (uri); | ||
255 | 144 | g_object_unref (ev); | ||
256 | 145 | g_error_free (error); | ||
257 | 146 | return; | ||
258 | 147 | } | ||
259 | 148 | |||
260 | 149 | display_name = g_file_info_get_attribute_string (info, | ||
261 | 150 | G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME); | ||
262 | 151 | filesystem = g_file_info_get_attribute_string (info, | ||
263 | 152 | G_FILE_ATTRIBUTE_ID_FILESYSTEM); | ||
264 | 153 | mimetype = g_file_info_get_attribute_string (info, | ||
265 | 154 | G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE); | ||
266 | 155 | |||
267 | 156 | parent_file = g_file_get_parent (file); | ||
268 | 157 | parent_uri = g_file_get_uri (parent_file); | ||
269 | 158 | |||
270 | 159 | // If we couldn't query the filesystem for the subject assume it was a | ||
271 | 160 | // residing online somwhere | ||
272 | 161 | filesystem = filesystem != NULL ? filesystem : "net"; | ||
273 | 162 | |||
274 | 163 | su = zeitgeist_subject_new_full (uri, | ||
275 | 164 | zeitgeist_interpretation_for_mimetype (mimetype), | ||
276 | 165 | zeitgeist_manifestation_for_uri (uri), | ||
277 | 166 | mimetype, | ||
278 | 167 | parent_uri, | ||
279 | 168 | display_name, | ||
280 | 169 | filesystem); | ||
281 | 170 | zeitgeist_event_add_subject (ev, su); | ||
282 | 171 | |||
283 | 172 | // FIXME: Right now we actually insert one event for each subject. | ||
284 | 173 | // We should rather collect all subject data (async) and | ||
285 | 174 | // insert one event with all the subjects | ||
286 | 175 | zeitgeist_log_insert_events_no_reply (log, ev, NULL); | ||
287 | 176 | |||
288 | 177 | g_free (uri); | ||
289 | 178 | g_free (parent_uri); | ||
290 | 179 | g_object_unref (parent_file); | ||
291 | 180 | g_object_unref (info); | ||
292 | 181 | } | ||
293 | 182 | */ | ||
294 | 183 | |||
295 | 184 | /* Create an application://app.desktop URI. Caller must g_free() the result | ||
296 | 185 | * if it's != NULL */ | ||
297 | 186 | static gchar* | ||
298 | 187 | get_application_uri (GDesktopAppInfo *appinfo) | ||
299 | 188 | { | ||
300 | 189 | gchar *app_id = NULL; | ||
301 | 190 | |||
302 | 191 | app_id = g_strdup (g_app_info_get_id (G_APP_INFO (appinfo))); | ||
303 | 192 | |||
304 | 193 | if (app_id != NULL) | ||
305 | 194 | { | ||
306 | 195 | app_id = g_strconcat ("application://", app_id, NULL); | ||
307 | 196 | } | ||
308 | 197 | else if (g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (appinfo))) | ||
309 | 198 | { | ||
310 | 199 | const gchar *path = g_desktop_app_info_get_filename ( | ||
311 | 200 | G_DESKTOP_APP_INFO (appinfo)); | ||
312 | 201 | gchar *basename = g_path_get_basename (path); | ||
313 | 202 | app_id = g_strconcat ("application://", basename, NULL); | ||
314 | 203 | g_free (basename); | ||
315 | 204 | } | ||
316 | 205 | |||
317 | 206 | return app_id; | ||
318 | 207 | } | ||
319 | 208 | |||
320 | 209 | /* Idle handler for logging the app launch event. We do this in an | ||
321 | 210 | * idle call to make sure it's done in the mainloop in order to be | ||
322 | 211 | * thread safe */ | ||
323 | 212 | static gboolean | ||
324 | 213 | log_event (ZeitgeistEvent *event) | ||
325 | 214 | { | ||
326 | 215 | ensure_log (); | ||
327 | 216 | |||
328 | 217 | g_return_val_if_fail (ZEITGEIST_IS_EVENT (event), FALSE); | ||
329 | 218 | g_return_val_if_fail (ZEITGEIST_IS_LOG (log), FALSE); | ||
330 | 219 | |||
331 | 220 | /* Send the event to Zeitgeist */ | ||
332 | 221 | zeitgeist_log_insert_events_no_reply (log, event, NULL); | ||
333 | 222 | |||
334 | 223 | return FALSE; | ||
335 | 224 | } | ||
336 | 225 | |||
337 | 226 | static void | ||
338 | 227 | on_launched (GDesktopAppInfoLaunchHandler *launch_handler, | ||
339 | 228 | GDesktopAppInfo *app_info, | ||
340 | 229 | GList *uris, | ||
341 | 230 | GAppLaunchContext *launch_ctx, | ||
342 | 231 | gint pid) | ||
343 | 232 | { | ||
344 | 233 | ZeitgeistEvent *ev; | ||
345 | 234 | ZeitgeistSubject *su; | ||
346 | 235 | GFile *file; | ||
347 | 236 | gchar *subject_uri, *actor, *prgname; | ||
348 | 237 | |||
349 | 238 | g_return_if_fail (G_IS_DESKTOP_APP_INFO (app_info)); | ||
350 | 239 | |||
351 | 240 | /* Don't log stuff about apps not shown in user menus */ | ||
352 | 241 | if (! g_app_info_should_show (G_APP_INFO (app_info))) | ||
353 | 242 | return; | ||
354 | 243 | |||
355 | 244 | ev = zeitgeist_event_new (); | ||
356 | 245 | su = zeitgeist_subject_new (); | ||
357 | 246 | |||
358 | 247 | subject_uri = get_application_uri (app_info); | ||
359 | 248 | |||
360 | 249 | if (subject_uri == NULL) | ||
361 | 250 | { | ||
362 | 251 | /* We where unable to figure out the launched app... */ | ||
363 | 252 | g_object_unref (ev); | ||
364 | 253 | g_object_unref (su); | ||
365 | 254 | return; | ||
366 | 255 | } | ||
367 | 256 | |||
368 | 257 | /* Set event metadata */ | ||
369 | 258 | prgname = g_get_prgname (); | ||
370 | 259 | zeitgeist_event_set_interpretation (ev, ZEITGEIST_ZG_ACCESS_EVENT); | ||
371 | 260 | zeitgeist_event_set_manifestation (ev, ZEITGEIST_ZG_USER_ACTIVITY); | ||
372 | 261 | actor = prgname ? g_strdup_printf ("application://%s.desktop", prgname) : | ||
373 | 262 | g_strdup (""); | ||
374 | 263 | zeitgeist_event_set_actor (ev, actor); | ||
375 | 264 | g_free (actor); | ||
376 | 265 | |||
377 | 266 | zeitgeist_event_add_subject (ev, su); | ||
378 | 267 | |||
379 | 268 | zeitgeist_subject_set_uri (su, subject_uri); | ||
380 | 269 | zeitgeist_subject_set_interpretation (su, ZEITGEIST_NFO_SOFTWARE); | ||
381 | 270 | zeitgeist_subject_set_manifestation (su, ZEITGEIST_NFO_SOFTWARE_ITEM); | ||
382 | 271 | zeitgeist_subject_set_mimetype (su, "application/x-desktop"); | ||
383 | 272 | zeitgeist_subject_set_text (su, g_app_info_get_display_name ( | ||
384 | 273 | G_APP_INFO (app_info))); | ||
385 | 274 | g_free (subject_uri); | ||
386 | 275 | // FIXME: subject origin and storage? | ||
387 | 276 | |||
388 | 277 | /* Do all DBus interactions in an idle handler to make sure | ||
389 | 278 | * we are thread safe. The floating ref on ev swallowed by idle | ||
390 | 279 | * handler log_event() */ | ||
391 | 280 | g_idle_add ((GSourceFunc) log_event, ev); | ||
392 | 281 | } | ||
393 | 282 | |||
394 | 283 | static void | ||
395 | 284 | launch_handler_iface_init (GDesktopAppInfoLaunchHandlerIface *iface) | ||
396 | 285 | { | ||
397 | 286 | iface->on_launched = on_launched; | ||
398 | 287 | } | ||
399 | 288 | |||
400 | 289 | void | ||
401 | 290 | g_app_launch_handler_zeitgeist_register (GIOModule *module) | ||
402 | 291 | { | ||
403 | 292 | g_app_launch_handler_zeitgeist_register_type (G_TYPE_MODULE (module)); | ||
404 | 293 | g_io_extension_point_implement (G_DESKTOP_APP_INFO_LAUNCH_HANDLER_EXTENSION_POINT_NAME, | ||
405 | 294 | G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST, | ||
406 | 295 | "zeitgeist", | ||
407 | 296 | 10); | ||
408 | 297 | } | ||
409 | 298 | |||
410 | 299 | void | ||
411 | 300 | g_app_launch_handler_zeitgeist_unregister (GIOModule *module) | ||
412 | 301 | { | ||
413 | 302 | if (log_w != NULL) | ||
414 | 303 | g_object_unref (log); | ||
415 | 304 | } | ||
416 | 305 | 0 | ||
417 | === removed file 'module/gapplaunchhandlerzeitgeist.h' | |||
418 | --- module/gapplaunchhandlerzeitgeist.h 2010-08-18 19:51:26 +0000 | |||
419 | +++ module/gapplaunchhandlerzeitgeist.h 1970-01-01 00:00:00 +0000 | |||
420 | @@ -1,49 +0,0 @@ | |||
421 | 1 | /* | ||
422 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
423 | 3 | * | ||
424 | 4 | * This library is free software; you can redistribute it and/or modify | ||
425 | 5 | * it under the terms of the GNU Lesser General Public License | ||
426 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
427 | 7 | * | ||
428 | 8 | * This library is distributed in the hope that it will be useful, | ||
429 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
430 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
431 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
432 | 12 | * | ||
433 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
434 | 14 | * License along with this library. If not, see | ||
435 | 15 | * <http://www.gnu.org/licenses/>. | ||
436 | 16 | * | ||
437 | 17 | * Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com> | ||
438 | 18 | */ | ||
439 | 19 | |||
440 | 20 | #ifndef __G_APP_LAUNCH_HANDLER_ZEITGEIST_H__ | ||
441 | 21 | #define __G_APP_LAUNCH_HANDLER_ZEITGEIST_H__ | ||
442 | 22 | |||
443 | 23 | #include <glib-object.h> | ||
444 | 24 | #include <gio/gio.h> | ||
445 | 25 | #include <gio/gdesktopappinfo.h> | ||
446 | 26 | |||
447 | 27 | |||
448 | 28 | G_BEGIN_DECLS | ||
449 | 29 | |||
450 | 30 | #define G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST (g_app_launch_handler_zeitgeist_get_type ()) | ||
451 | 31 | #define G_APP_LAUNCH_HANDLER_ZEITGEIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST, GAppLaunchHandlerZeitgeist)) | ||
452 | 32 | #define G_APP_LAUNCH_HANDLER_ZEITGEIST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST, GAppLaunchHandlerZeitgeistClass)) | ||
453 | 33 | #define G_IS_APP_LAUNCH_HANDLER_ZEITGEIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST)) | ||
454 | 34 | #define G_IS_APP_LAUNCH_HANDLER_ZEITGEIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_APP_LAUNCH_HANDLER_ZEITGEIST)) | ||
455 | 35 | |||
456 | 36 | typedef struct _GAppLaunchHandlerZeitgeist GAppLaunchHandlerZeitgeist; | ||
457 | 37 | typedef struct _GAppLaunchHandlerZeitgeistClass GAppLaunchHandlerZeitgeistClass; | ||
458 | 38 | |||
459 | 39 | struct _GAppLaunchHandlerZeitgeistClass { | ||
460 | 40 | GObjectClass parent_class; | ||
461 | 41 | }; | ||
462 | 42 | |||
463 | 43 | GType g_app_launch_handler_zeitgeist_get_type (void) G_GNUC_CONST; | ||
464 | 44 | void g_app_launch_handler_zeitgeist_register (GIOModule *module); | ||
465 | 45 | void g_app_launch_handler_zeitgeist_unregister (GIOModule *module); | ||
466 | 46 | |||
467 | 47 | G_END_DECLS | ||
468 | 48 | |||
469 | 49 | #endif /* __G_APP_LAUNCH_HANDLER_ZEITGEIST_H__ */ | ||
470 | 50 | 0 | ||
471 | === removed file 'module/zeitgeist-module.c' | |||
472 | --- module/zeitgeist-module.c 2010-08-19 11:57:08 +0000 | |||
473 | +++ module/zeitgeist-module.c 1970-01-01 00:00:00 +0000 | |||
474 | @@ -1,40 +0,0 @@ | |||
475 | 1 | /* | ||
476 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
477 | 3 | * | ||
478 | 4 | * This library is free software; you can redistribute it and/or modify | ||
479 | 5 | * it under the terms of the GNU Lesser General Public License | ||
480 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
481 | 7 | * | ||
482 | 8 | * This library is distributed in the hope that it will be useful, | ||
483 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
484 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
485 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
486 | 12 | * | ||
487 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
488 | 14 | * License along with this library. If not, see | ||
489 | 15 | * <http://www.gnu.org/licenses/>. | ||
490 | 16 | * | ||
491 | 17 | * Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com> | ||
492 | 18 | */ | ||
493 | 19 | |||
494 | 20 | #include <config.h> | ||
495 | 21 | |||
496 | 22 | #include <glib.h> | ||
497 | 23 | #include <gmodule.h> | ||
498 | 24 | #include <gio/gio.h> | ||
499 | 25 | #include <zeitgeist.h> | ||
500 | 26 | |||
501 | 27 | #include "gapplaunchhandlerzeitgeist.h" | ||
502 | 28 | |||
503 | 29 | void | ||
504 | 30 | g_io_module_load (GIOModule *module) | ||
505 | 31 | { | ||
506 | 32 | g_app_launch_handler_zeitgeist_register (module); | ||
507 | 33 | } | ||
508 | 34 | |||
509 | 35 | void | ||
510 | 36 | g_io_module_unload (GIOModule *module) | ||
511 | 37 | { | ||
512 | 38 | g_app_launch_handler_zeitgeist_unregister (module); | ||
513 | 39 | } | ||
514 | 40 |