Merge lp:~mhr3/libzeitgeist/various-fixes into lp:libzeitgeist

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
Reviewer Review Type Date Requested Status
LibZeitgeist Developers Pending
Review via email: mp+48904@code.launchpad.net

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

Subscribers

People subscribed via source and target branches