[totem] Fixes #703502 by porting zeitgeist-dp plugin to zeitgeist-2.0



commit 1130296a0dcd74649c0979aab31043410801d51f
Author: Manish Sinha <manishsinha ubuntu com>
Date:   Tue Jul 2 21:24:55 2013 -0700

    Fixes #703502 by porting zeitgeist-dp plugin to zeitgeist-2.0
    
    This drops the libzeitgeist dependency and replaces it with
    a zeitgeist-2.0 dependency ≥ 0.9.12.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=703502
    
    Signed-off-by: Manish Sinha <manishsinha ubuntu com>

 configure.ac                                       |    4 +-
 src/plugins/zeitgeist-dp/Makefile.am               |    2 +-
 .../zeitgeist-dp/totem-zeitgeist-dp-plugin.vala    |   23 ++++++++++++-------
 3 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8080c78..eb9e9da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -428,10 +428,10 @@ for plugin in ${used_plugins}; do
                                plugin_error_or_ignore "you need introspection support for the zeitgeist-dp 
plugin"
                                add_plugin="0"
                        else
-                               PKG_CHECK_MODULES(LIBZEITGEIST, zeitgeist-1.0 >= 0.3.6,
+                               PKG_CHECK_MODULES(LIBZEITGEIST, zeitgeist-2.0 >= 0.9.12,
                                [HAS_LIBZEITGEIST=yes], [HAS_LIBZEITGEIST=no])
                                if test "${HAS_LIBZEITGEIST}" != "yes" ; then
-                                       plugin_error_or_ignore "you need zeitgeist-1.0 >= 0.3.6 to use the 
zeitgeist-dp plugin"
+                                       plugin_error_or_ignore "you need zeitgeist-2.0 >= 0.9.12 to use the 
zeitgeist-dp plugin"
                                        add_plugin="0"
                                fi
                        fi
diff --git a/src/plugins/zeitgeist-dp/Makefile.am b/src/plugins/zeitgeist-dp/Makefile.am
index ecb798f..b369c5e 100644
--- a/src/plugins/zeitgeist-dp/Makefile.am
+++ b/src/plugins/zeitgeist-dp/Makefile.am
@@ -10,7 +10,7 @@ plugin_in_files = zeitgeist-dp.plugin.in
 AM_VALAFLAGS = \
        --girdir=$(top_builddir)/src    \
        --pkg Totem-1.0 --pkg Peas-1.0 --pkg gtk+-3.0 \
-       --pkg zeitgeist-1.0 \
+       --pkg zeitgeist-2.0 \
        bacon-video.vapi
 
 libtotem_zeitgeist_dp_plugin_la_SOURCES = totem-zeitgeist-dp-plugin.vala
diff --git a/src/plugins/zeitgeist-dp/totem-zeitgeist-dp-plugin.vala 
b/src/plugins/zeitgeist-dp/totem-zeitgeist-dp-plugin.vala
index 9a60ff2..f5b8649 100644
--- a/src/plugins/zeitgeist-dp/totem-zeitgeist-dp-plugin.vala
+++ b/src/plugins/zeitgeist-dp/totem-zeitgeist-dp-plugin.vala
@@ -41,15 +41,16 @@ class ZeitgeistDpPlugin: GLib.Object, Peas.Activatable {
     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,
+    GenericArray<Zeitgeist.Event> templates =
+      new GenericArray<Zeitgeist.Event> ();
+    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
+      templates
     );
     zg_registry.register_data_source.begin (ds, null);
   }
@@ -175,7 +176,7 @@ class ZeitgeistDpPlugin: GLib.Object, Peas.Activatable {
       var video = totem.get_video_widget () as Bacon.VideoWidget;
       video.get_metadata (Bacon.MetadataType.HAS_VIDEO, out val);
       current_media.interpretation = val.get_boolean () ?
-        Zeitgeist.NFO_VIDEO : Zeitgeist.NFO_AUDIO;
+        Zeitgeist.NFO.VIDEO : Zeitgeist.NFO.AUDIO;
 
       query_media_mimetype (current_media.mrl);
 
@@ -208,7 +209,7 @@ class ZeitgeistDpPlugin: GLib.Object, Peas.Activatable {
   private void send_event_to_zg (bool leave_event = false) {
     if (current_media.mrl != null && current_media.title != null) {
       string event_interpretation = leave_event ?
-        Zeitgeist.ZG_LEAVE_EVENT : Zeitgeist.ZG_ACCESS_EVENT;
+        Zeitgeist.ZG.LEAVE_EVENT : Zeitgeist.ZG.ACCESS_EVENT;
       string origin = Path.get_dirname (current_media.mrl);
       var subject = new Zeitgeist.Subject.full (
         current_media.mrl,
@@ -218,12 +219,16 @@ class ZeitgeistDpPlugin: GLib.Object, Peas.Activatable {
         origin,
         current_media.title,
         "");
+      GenericArray<Zeitgeist.Event> events =
+        new GenericArray<Zeitgeist.Event> ();
       var event = new Zeitgeist.Event.full (event_interpretation,
-                                            Zeitgeist.ZG_USER_ACTIVITY,
+                                            Zeitgeist.ZG.USER_ACTIVITY,
                                             "application://totem.desktop",
-                                            subject, null);
-      event.set_timestamp (current_media.timestamp);
-      zg_log.insert_events_no_reply (event, null);
+                                            null);
+      event.add_subject (subject);
+      events.add (event);
+      event.timestamp = current_media.timestamp;
+      zg_log.insert_events_no_reply (events);
     }
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]