diff -Nru zeitgeist-datasources-0.1.0-0~manish6/chrome/zeitgeist.js zeitgeist-datasources-0.1.0+bzr20100127/chrome/zeitgeist.js --- zeitgeist-datasources-0.1.0-0~manish6/chrome/zeitgeist.js 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/chrome/zeitgeist.js 2011-01-22 14:59:28.000000000 +0000 @@ -46,7 +46,9 @@ sendAccessEvent(request); } -plugin.setActor("application://google-chrome.desktop"); +var is_chromium = /chromium/.test( navigator.userAgent.toLowerCase() ); +if (!is_chromium) plugin.setActor("application://google-chrome.desktop"); +else plugin.setActor("application://chromium-browser.desktop"); //chrome.extension.onConnect.addListener (onExtensionConnect); chrome.extension.onRequest.addListener (onExtensionRequest); diff -Nru zeitgeist-datasources-0.1.0-0~manish6/debian/changelog zeitgeist-datasources-0.1.0+bzr20100127/debian/changelog --- zeitgeist-datasources-0.1.0-0~manish6/debian/changelog 2011-01-11 19:36:09.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/debian/changelog 2011-01-27 19:28:41.000000000 +0000 @@ -1,3 +1,16 @@ +zeitgeist-datasources (0.1.0+bzr20100127-0ubuntu1~maverick1~ppa2) maverick; urgency=low + + * Bug fixes + - Fix Firefox incognito mode + - Fix local install of Firefox DP + - Tomboy dataprovider now registers itself in DataSourceRegistry + - Add leave event in XChat when application exits + - Vim plugin fails gracefully when there is no session bus + - Chromium Fixes + + -- Manish Sinha Thurs, 28 Jan 2010 00:58:41 +0530 + + zeitgeist-datasources (0.1.0-0~manish6-maverick) maverick; urgency=low * Added xchat dataprovider. diff -Nru zeitgeist-datasources-0.1.0-0~manish6/firefox-libzg/extension/chrome/content/zeitgeist.xul zeitgeist-datasources-0.1.0+bzr20100127/firefox-libzg/extension/chrome/content/zeitgeist.xul --- zeitgeist-datasources-0.1.0-0~manish6/firefox-libzg/extension/chrome/content/zeitgeist.xul 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/firefox-libzg/extension/chrome/content/zeitgeist.xul 2011-01-27 17:11:47.000000000 +0000 @@ -6,6 +6,8 @@ var enable_googlemail = false; var googlemail_view_regex = new RegExp("mail\\.google\\.com"); + var pbs = Components.classes["@mozilla.org/privatebrowsing;1"] + .getService(Components.interfaces.nsIPrivateBrowsingService); var debug = function (aMessage) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] @@ -109,6 +111,8 @@ var ZeitgeistProgressListener = { onStateChange: function(aBrowser, aProgress, aRequest, aStateFlags) { + var inPrivateBrowsingMode = pbs.privateBrowsingEnabled; + if (inPrivateBrowsingMode) return; if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) { var uri = aBrowser.currentURI.spec; var mimetype = aBrowser.contentDocument.contentType; diff -Nru zeitgeist-datasources-0.1.0-0~manish6/firefox-libzg/extension/Makefile.am zeitgeist-datasources-0.1.0+bzr20100127/firefox-libzg/extension/Makefile.am --- zeitgeist-datasources-0.1.0-0~manish6/firefox-libzg/extension/Makefile.am 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/firefox-libzg/extension/Makefile.am 2011-01-27 17:11:47.000000000 +0000 @@ -27,7 +27,7 @@ # we want to allow also local install EXTENSION_CONTENT = \ - $(xul_ext_DATA) \ + $(dist_xul_ext_DATA) \ defaults \ chrome \ components/libzeitgeist_xpcom.so \ diff -Nru zeitgeist-datasources-0.1.0-0~manish6/firefox-libzg/extension/Makefile.in zeitgeist-datasources-0.1.0+bzr20100127/firefox-libzg/extension/Makefile.in --- zeitgeist-datasources-0.1.0-0~manish6/firefox-libzg/extension/Makefile.in 2011-01-11 19:19:51.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/firefox-libzg/extension/Makefile.in 2011-01-27 17:16:44.000000000 +0000 @@ -295,7 +295,7 @@ # we want to allow also local install EXTENSION_CONTENT = \ - $(xul_ext_DATA) \ + $(dist_xul_ext_DATA) \ defaults \ chrome \ components/libzeitgeist_xpcom.so \ diff -Nru zeitgeist-datasources-0.1.0-0~manish6/tomboy/ZeitgeistAddin.cs zeitgeist-datasources-0.1.0+bzr20100127/tomboy/ZeitgeistAddin.cs --- zeitgeist-datasources-0.1.0-0~manish6/tomboy/ZeitgeistAddin.cs 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/tomboy/ZeitgeistAddin.cs 2011-01-22 14:59:58.000000000 +0000 @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using Zeitgeist.Datamodel; +using Zeitgeist; namespace Tomboy.Zeitgeist { @@ -11,6 +12,8 @@ public ZeitgeistAddin () { notesList = new List(); + + dsReg = new DataSourceClient(); } #region Overridden methods @@ -27,6 +30,23 @@ { Console.WriteLine("Zg#: init new"); + Event ev = new Event(); + ev.Actor = ZeitgeistAddin.TomboyUri; + Subject sub = new Subject(); + sub.Interpretation = Interpretation.Instance.Document.Document; + sub.Manifestation = Manifestation.Instance.FileDataObject.FileDataObject; + ev.Subjects.Add(sub); + + try + { + dsReg.RegisterDataSources(tomboyDataSourceId, + tomboyDataSourceName, + tomboyDataSourceDesc , + new List(){ev}); + } + catch(Exception) + {} + // Initialize the handlers for hooking into Tomboy InitHandlers(); @@ -78,13 +98,25 @@ private bool _init = false; - #region Public Constants + private DataSourceClient dsReg; + #region Public Constants + public const string TomboyUri = "application://tomboy.desktop"; public const string NoteMimetype = "application/x-note"; #endregion + + #region Private Constants + + private const string tomboyDataSourceId = "org.gnome.Tomboy,dataprovider"; + + private const string tomboyDataSourceName = "Tomboy Datasource"; + + private const string tomboyDataSourceDesc = "This datasource pushes the 4 events for tomboy - Open/Close Note, Create/Delete Note"; + + #endregion } } diff -Nru zeitgeist-datasources-0.1.0-0~manish6/totem-libzg/totem-zeitgeist-plugin.c zeitgeist-datasources-0.1.0+bzr20100127/totem-libzg/totem-zeitgeist-plugin.c --- zeitgeist-datasources-0.1.0-0~manish6/totem-libzg/totem-zeitgeist-plugin.c 2011-01-11 19:20:14.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/totem-libzg/totem-zeitgeist-plugin.c 2011-01-27 17:17:02.000000000 +0000 @@ -28,6 +28,7 @@ typedef struct _ZeitgeistPluginClass ZeitgeistPluginClass; typedef struct _ZeitgeistPluginPrivate ZeitgeistPluginPrivate; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_ptr_array_free0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_free (var, TRUE), NULL))) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) struct _MediaInfo { @@ -58,6 +59,7 @@ gint signals_length1; gint _signals_size_; ZeitgeistLog* zg_log; + ZeitgeistDataSourceRegistry* zg_registry; TotemObject* totem_object; }; @@ -182,22 +184,41 @@ } +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + static gboolean zeitgeist_plugin_real_activate (TotemPlugin* base, TotemObject* totem, GError** error) { ZeitgeistPlugin * self; gboolean result = FALSE; ZeitgeistLog* _tmp0_; - MediaInfo _tmp1_ = {0}; - MediaInfo _tmp2_; + ZeitgeistDataSourceRegistry* _tmp1_; + MediaInfo _tmp2_ = {0}; + MediaInfo _tmp3_; + GPtrArray* templates; + ZeitgeistEvent* event; + GPtrArray* _tmp4_; + ZeitgeistDataSource* ds; self = (ZeitgeistPlugin*) base; g_return_val_if_fail (totem != NULL, FALSE); self->priv->zg_log = (_tmp0_ = zeitgeist_log_new (), _g_object_unref0 (self->priv->zg_log), _tmp0_); + self->priv->zg_registry = (_tmp1_ = zeitgeist_data_source_registry_new (), _g_object_unref0 (self->priv->zg_registry), _tmp1_); self->priv->totem_object = totem; - self->priv->current_media = (_tmp2_ = (memset (&_tmp1_, 0, sizeof (MediaInfo)), _tmp1_), media_info_destroy (&self->priv->current_media), _tmp2_); + self->priv->current_media = (_tmp3_ = (memset (&_tmp2_, 0, sizeof (MediaInfo)), _tmp2_), media_info_destroy (&self->priv->current_media), _tmp3_); _vala_array_add1 (&self->priv->signals, &self->priv->signals_length1, &self->priv->_signals_size_, g_signal_connect_swapped (totem, "file-opened", (GCallback) zeitgeist_plugin_file_opened, self)); _vala_array_add2 (&self->priv->signals, &self->priv->signals_length1, &self->priv->_signals_size_, g_signal_connect_swapped (totem, "file-closed", (GCallback) zeitgeist_plugin_file_closed, self)); _vala_array_add3 (&self->priv->signals, &self->priv->signals_length1, &self->priv->_signals_size_, g_signal_connect_swapped (totem, "metadata-updated", (GCallback) zeitgeist_plugin_metadata_changed, self)); _vala_array_add4 (&self->priv->signals, &self->priv->signals_length1, &self->priv->_signals_size_, g_signal_connect_swapped (totem, "notify::playing", (GCallback) zeitgeist_plugin_playing_changed, self)); + templates = g_ptr_array_new (); + event = g_object_ref_sink (zeitgeist_event_new_full ("", ZEITGEIST_ZG_USER_ACTIVITY, "application://totem.desktop", NULL, NULL)); + g_ptr_array_add (templates, event); + ds = g_object_ref_sink (zeitgeist_data_source_new_full ("org.gnome.Totem,dataprovider", "Totem dataprovider", "Logs access/leave events for media files played with Totem", (_tmp4_ = templates, templates = NULL, _tmp4_))); + zeitgeist_data_source_registry_register_data_source (self->priv->zg_registry, _g_object_ref0 (ds), NULL, NULL, NULL); result = TRUE; + _g_object_unref0 (ds); + _g_object_unref0 (event); + _g_ptr_array_free0 (templates); return result; } @@ -277,7 +298,7 @@ self->priv->media_info_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 250, _zeitgeist_plugin_wait_for_media_info_gsource_func, g_object_ref (self), g_object_unref); zeitgeist_plugin_restart_watcher (self, (guint) 15000); } else { - g_warning ("totem-zeitgeist-plugin.vala:85: already had timeout!"); + g_warning ("totem-zeitgeist-plugin.vala:101: already had timeout!"); } } @@ -389,7 +410,7 @@ err = _inner_error_; _inner_error_ = NULL; { - g_warning ("totem-zeitgeist-plugin.vala:146: %s", err->message); + g_warning ("totem-zeitgeist-plugin.vala:162: %s", err->message); _g_error_free0 (err); } } @@ -456,7 +477,6 @@ const char* _tmp1_; char* event_interpretation; char* origin; - const char* substr; ZeitgeistSubject* subject; ZeitgeistEvent* event; _tmp1_ = NULL; @@ -466,14 +486,7 @@ _tmp1_ = ZEITGEIST_ZG_ACCESS_EVENT; } event_interpretation = g_strdup (_tmp1_); - origin = g_strdup (""); - substr = g_utf8_strrchr (self->priv->current_media.mrl, (gssize) (-1), (gunichar) '/'); - if (substr != NULL) { - gsize n; - char* _tmp2_; - n = ((gchar*) substr) - ((gchar*) self->priv->current_media.mrl); - origin = (_tmp2_ = g_strndup (self->priv->current_media.mrl, n), _g_free0 (origin), _tmp2_); - } + origin = g_path_get_dirname (self->priv->current_media.mrl); subject = g_object_ref_sink (zeitgeist_subject_new_full (self->priv->current_media.mrl, self->priv->current_media.interpretation, ZEITGEIST_NFO_FILE_DATA_OBJECT, self->priv->current_media.mimetype, origin, self->priv->current_media.title, "")); event = g_object_ref_sink (zeitgeist_event_new_full (event_interpretation, ZEITGEIST_ZG_USER_ACTIVITY, "application://totem.desktop", subject, NULL, NULL)); zeitgeist_event_set_timestamp (event, self->priv->current_media.timestamp); @@ -518,6 +531,7 @@ media_info_destroy (&self->priv->current_media); self->priv->signals = (g_free (self->priv->signals), NULL); _g_object_unref0 (self->priv->zg_log); + _g_object_unref0 (self->priv->zg_registry); G_OBJECT_CLASS (zeitgeist_plugin_parent_class)->finalize (obj); } diff -Nru zeitgeist-datasources-0.1.0-0~manish6/totem-libzg/totem-zeitgeist-plugin.vala zeitgeist-datasources-0.1.0+bzr20100127/totem-libzg/totem-zeitgeist-plugin.vala --- zeitgeist-datasources-0.1.0-0~manish6/totem-libzg/totem-zeitgeist-plugin.vala 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/totem-libzg/totem-zeitgeist-plugin.vala 2011-01-27 17:11:47.000000000 +0000 @@ -20,10 +20,13 @@ private ulong[] signals; private Zeitgeist.Log zg_log; + private Zeitgeist.DataSourceRegistry zg_registry; private unowned Totem.Object totem_object; public override bool activate (Totem.Object totem) throws GLib.Error { zg_log = new Zeitgeist.Log (); + zg_registry = new Zeitgeist.DataSourceRegistry (); + totem_object = totem; current_media = MediaInfo (); @@ -35,6 +38,19 @@ (Callback) metadata_changed, this); signals += Signal.connect_swapped (totem, "notify::playing", (Callback) playing_changed, this); + + PtrArray templates = new PtrArray (); + var event = new Zeitgeist.Event.full ("", Zeitgeist.ZG_USER_ACTIVITY, + "application://totem.desktop", null); + templates.add (event); + var ds = new Zeitgeist.DataSource.full ( + "org.gnome.Totem,dataprovider", + "Totem dataprovider", + "Logs access/leave events for media files played with Totem", + (owned) templates + ); + zg_registry.register_data_source.begin (ds, null); + return true; } @@ -185,12 +201,7 @@ current_media.title, current_media.mimetype); */ - string origin = ""; - unowned string substr = current_media.mrl.rchr (-1, '/'); - if (substr != null) { - size_t n = (char*)substr - (char*)current_media.mrl; - origin = current_media.mrl.ndup (n); - } + string origin = Path.get_dirname (current_media.mrl); var subject = new Zeitgeist.Subject.full (current_media.mrl, current_media.interpretation, Zeitgeist.NFO_FILE_DATA_OBJECT, diff -Nru zeitgeist-datasources-0.1.0-0~manish6/vim/zeitgeist.vim zeitgeist-datasources-0.1.0+bzr20100127/vim/zeitgeist.vim --- zeitgeist-datasources-0.1.0-0~manish6/vim/zeitgeist.vim 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/vim/zeitgeist.vim 2011-01-22 14:59:28.000000000 +0000 @@ -46,7 +46,8 @@ from zeitgeist.client import ZeitgeistClient from zeitgeist.datamodel import Subject, Event, Interpretation, Manifestation - zeitgeistclient = ZeitgeistClient() if os.getuid() != 0 else None + precond = os.getuid() != 0 and os.getenv('DBUS_SESSION_BUS_ADDRESS') != None + zeitgeistclient = ZeitgeistClient() if precond else None except RuntimeError, e: zeitgeistclient = None except ImportError, e: diff -Nru zeitgeist-datasources-0.1.0-0~manish6/xchat/Makefile.in zeitgeist-datasources-0.1.0+bzr20100127/xchat/Makefile.in --- zeitgeist-datasources-0.1.0-0~manish6/xchat/Makefile.in 2011-01-11 19:19:52.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/xchat/Makefile.in 2011-01-27 17:16:44.000000000 +0000 @@ -35,7 +35,7 @@ build_triplet = @build@ host_triplet = @host@ subdir = xchat -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ diff -Nru zeitgeist-datasources-0.1.0-0~manish6/xchat/README zeitgeist-datasources-0.1.0+bzr20100127/xchat/README --- zeitgeist-datasources-0.1.0-0~manish6/xchat/README 1970-01-01 00:00:00.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/xchat/README 2011-01-22 14:59:28.000000000 +0000 @@ -0,0 +1,13 @@ +Zeitgeist plugin to the XChat irc client +**************************************** + +To use this plugin: + +* Install Zeitgeist 0.3 (or greater) +* Type "make" and "sudo make install" for a system-wide installation; "make" and "make local-install" + for a local installation + +************************************************************************************************************* + N.B. Please don't install both system-wide and locally! XChat will load both plugins, getting double events + on your Zeitgeist. +************************************************************************************************************* diff -Nru zeitgeist-datasources-0.1.0-0~manish6/xchat/zeitgeist-dataprovider.c zeitgeist-datasources-0.1.0+bzr20100127/xchat/zeitgeist-dataprovider.c --- zeitgeist-datasources-0.1.0-0~manish6/xchat/zeitgeist-dataprovider.c 2011-01-11 19:19:04.000000000 +0000 +++ zeitgeist-datasources-0.1.0+bzr20100127/xchat/zeitgeist-dataprovider.c 2011-01-22 14:59:28.000000000 +0000 @@ -22,17 +22,16 @@ #include "xchat-plugin.h" #include - #define PNAME "Zeitgeist" #define PDESC "Inform Zeitgeist about your activity" #define PVERSION "0.1" -static xchat_plugin *ph = NULL; /* plugin handle */ -static ZeitgeistLog *zg_log = NULL; /* Zeitgeist-daemon hanlde*/ +static xchat_plugin *ph = NULL; /* plugin handle */ +static ZeitgeistLog *zg_log = NULL; /* Zeitgeist-daemon hanlde*/ +static GSList *channel_list = NULL; /* List of joined channels */ static void send_event_to_zeitgeist(char *url_, char* text_, const char* ev_interpretation) { - /* type is 0 for PART event, 1 for JOIN event */ const char *url, *origin, *mimetype, *text; const char *interpretation = NULL; const char *manifestation = NULL; @@ -40,7 +39,7 @@ url = url_; origin = url; - mimetype = "text/plain"; //? + mimetype = "text/plain"; text = text_; interpretation = ZEITGEIST_NMO_IMMESSAGE; manifestation = ZEITGEIST_NFO_SOFTWARE_SERVICE; @@ -66,7 +65,7 @@ text, ev_interpretation);*/ - zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); + zeitgeist_log_insert_events_no_reply (zg_log, event, NULL); } static int join_cb(char *word[], void *userdata) @@ -75,11 +74,16 @@ const char *channel = word[2]; char *url, *text; + channel_list = g_slist_prepend(channel_list, g_strdup(channel)); + url = g_strconcat("irc://", server, "/", channel, NULL); text = g_strconcat("You joined ", channel, NULL); send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_ACCESS_EVENT); + g_free(url); + g_free(text); + return XCHAT_EAT_NONE; } @@ -88,11 +92,26 @@ const char *server = xchat_get_info(ph, "host"); const char *channel = word[3]; char *url, *text; - + GSList *tmp = channel_list; + url = g_strconcat("irc://", server, "/", channel, NULL); text = g_strconcat("You parted from ", channel, NULL); send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_LEAVE_EVENT); + + while(tmp) + { + if (g_strcmp0 (tmp->data, channel) == 0) + { + g_free(tmp->data); + channel_list = g_slist_delete_link(channel_list, tmp); + break; + } + tmp = tmp->next; + } + + g_free(url); + g_free(text); return XCHAT_EAT_NONE; } @@ -104,10 +123,13 @@ char *url, *text; url = g_strconcat("irc://", server, "/", channel, NULL); - text = g_strconcat(channel, ": you sent a message: ", word[2], NULL); + text = g_strconcat(channel, ": you sent \"", word[2],"\".", NULL); send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_SEND_EVENT); + g_free(url); + g_free(text); + return XCHAT_EAT_NONE; } @@ -118,13 +140,31 @@ char *url, *text; url = g_strconcat("irc://", server, "/", channel, NULL); - text = g_strconcat(channel, ": you received a message from ", word[1],": ", word[2], NULL); + text = g_strconcat(channel, ": you received \"", word[2],"\" from ", word[1], NULL); send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_RECEIVE_EVENT); - + + g_free(url); + g_free(text); + return XCHAT_EAT_NONE; } +static void on_quit(gpointer data, gpointer userdata) +{ + const char *server = xchat_get_info(ph, "host"); + const char *channel = (const char*) data; + char *url, *text; + + url = g_strconcat("irc://", server, "/", channel, NULL); + text = g_strconcat("You parted from ", channel, NULL); + + send_event_to_zeitgeist(url, text, ZEITGEIST_ZG_LEAVE_EVENT); + + g_free(url); + g_free(text); +} + void xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved) { *name = PNAME; @@ -132,6 +172,9 @@ *version = PVERSION; } +static int initialized = 0; +static int reinit_tried = 0; + int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, @@ -139,6 +182,16 @@ char *arg) { ph = plugin_handle; + + /* Block double initalization. */ + if (initialized != 0) { + xchat_print(ph, "Zeitgeist plugin already loaded"); + /* deinit is called even when init fails, so keep track + * of a reinit failure. */ + reinit_tried++; + return 0; + } + initialized = 1; *plugin_name = PNAME; *plugin_desc = PDESC; @@ -155,3 +208,21 @@ return 1; } + +int xchat_plugin_deinit() +{ + /* A reinitialization was tried. Just give up */ + if (reinit_tried) { + reinit_tried--; + return 1; + } + + g_slist_foreach(channel_list, on_quit, NULL); + g_slist_foreach(channel_list, (GFunc)g_free, NULL); + g_slist_free(channel_list); + channel_list = NULL; + + g_object_unref(zg_log); + zg_log = NULL; + return 1; +}