← Back to team overview

zeitgeist team mailing list archive

lp:~zeitgeist/unity-lens-files/fix-1196800-port-to-libzeitgeist2 into lp:unity-lens-files

 

Manish Sinha (मनीष सिन्हा) has proposed merging lp:~zeitgeist/unity-lens-files/fix-1196800-port-to-libzeitgeist2 into lp:unity-lens-files.

Requested reviews:
  Unity Team (unity-team)
Related bugs:
  Bug #1196800 in unity-lens-files: "Port Unity Files Lens to libzeitgeist2"
  https://bugs.launchpad.net/unity-lens-files/+bug/1196800

For more details, see:
https://code.launchpad.net/~zeitgeist/unity-lens-files/fix-1196800-port-to-libzeitgeist2/+merge/172464

Port unity-lens-files to libzeitgeist2 as the older libzeitgeist (libzeitgeist1) would be deprecated.

(PS: Have signed the contributor's agreement)
-- 
https://code.launchpad.net/~zeitgeist/unity-lens-files/fix-1196800-port-to-libzeitgeist2/+merge/172464
Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/unity-lens-files/fix-1196800-port-to-libzeitgeist2.
=== modified file 'configure.ac'
--- configure.ac	2013-05-16 11:42:23 +0000
+++ configure.ac	2013-07-02 06:07:25 +0000
@@ -62,7 +62,7 @@
                   gio-unix-2.0 >= $GLIB_REQUIRED
                   gee-1.0
                   dee-1.0 >= 0.5.16
-                  zeitgeist-1.0 >= 0.3.17
+                  zeitgeist-2.0 >= 0.9.12
                   unity >= 7.0.0)
 
 

=== modified file 'debian/control'
--- debian/control	2013-05-16 16:47:22 +0000
+++ debian/control	2013-07-02 06:07:25 +0000
@@ -9,9 +9,9 @@
                libglib2.0-dev (>= 2.27),
                libgee-dev,
                libdee-dev (>= 0.5.16),
-               libzeitgeist-dev (>= 0.3.17),
+               libzeitgeist-dev (>= 0.9.12),
                libunity-dev (>= 7.0.0),
-               zeitgeist-core (>= 0.5.0-0ubuntu2),
+               zeitgeist-core (>= 0.9.12),
                dh-autoreconf,
                dh-translations,
 Standards-Version: 3.9.4

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2013-05-16 11:41:12 +0000
+++ src/Makefile.am	2013-07-02 06:07:25 +0000
@@ -23,7 +23,7 @@
 unity_files_daemon_VALAFLAGS = \
   -C \
   --pkg dee-1.0 \
-  --pkg zeitgeist-1.0 \
+  --pkg zeitgeist-2.0 \
   --pkg unity \
   --pkg gee-1.0 \
   --pkg gio-2.0 \

=== modified file 'src/blacklist-tracker.vala'
--- src/blacklist-tracker.vala	2012-03-15 10:20:44 +0000
+++ src/blacklist-tracker.vala	2013-07-02 06:07:25 +0000
@@ -101,8 +101,8 @@
       {
         if (e.num_subjects () > 0)
         {
-          unowned Subject s = e.get_subject (0);
-          unowned string uri = s.get_uri ();
+          Subject s = e.get_subject (0);
+          string uri = s.uri;
           if (uri == null || uri == "") continue;
 
           if (uri.has_suffix ("*"))

=== modified file 'src/daemon.vala'
--- src/daemon.vala	2013-06-21 20:49:58 +0000
+++ src/daemon.vala	2013-07-02 06:07:25 +0000
@@ -78,14 +78,14 @@
       index = new Zeitgeist.Index ();
 
       /* Listen for all file:// related events from Zeitgeist */
-      var templates = new PtrArray ();
+      var templates = new GenericArray<Event>();
       var event = new Zeitgeist.Event ();
       var subject = new Zeitgeist.Subject ();
-      subject.set_uri ("file://*");
+      subject.uri = "file://*";
       event.add_subject (subject);
-      templates.add (event.ref ());
+      templates.add (event);
       monitor = new Zeitgeist.Monitor (new Zeitgeist.TimeRange.from_now (),
-                                       (owned) templates);
+                                       templates);
       monitor.events_inserted.connect (on_zeitgeist_changed);
       monitor.events_deleted.connect (on_zeitgeist_changed);
       log.install_monitor (monitor);
@@ -216,76 +216,75 @@
                                  string manifestation, string uri_prefix)
     {
       Event event;
+      Subject sub;
 
       /* Section.ALL_FILES */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               "", "", "", "", "", ""));
+      event = new Event.full("", manifestation, "", "");
+      sub = new Subject.full(uri_prefix, "", "", "", "", "", "");
+      event.add_subject(sub);
       templates["all"] = event;
 
       /* Section.DOCUMENTS */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               NFO_DOCUMENT,
-                                               "", "", "", "", ""),
-                             new Subject.full ("",
-                                               "!"+NFO_PRESENTATION,
-                                               "", "", "", "", ""));
+      event = new Event.full("", manifestation, "", "");
+      sub = new Subject.full (uri_prefix, NFO.DOCUMENT, "", "", "", "", "");
+      event.add_subject(sub);
+      sub = new Subject.full ("", "!"+NFO.PRESENTATION, "", "", "", "", "");
+      event.add_subject(sub);
       templates["documents"] = event;
 
       /* Section.FOLDERS
        * - we're using special ORIGIN queries here */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               "", "", "", "", "", ""));
+      event = new Event.full("", manifestation, "", "");
+      sub =  new Subject.full (uri_prefix, "", "", "", "", "", "");
+      event.add_subject(sub);
       templates["folders"] = event;
 
       /* Section.IMAGES */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               NFO_IMAGE, "", "", "", "", ""));
+      event = new Event.full("", manifestation, "", "");
+      sub = new Subject.full (uri_prefix, NFO.IMAGE, "", "", "", "", "");
+      event.add_subject(sub);
       templates["images"] = event;
 
       /* Section.AUDIO */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               NFO_AUDIO, "", "", "", "", ""));
+      event = new Event.full("", manifestation, "", "");
+      sub = new Subject.full (uri_prefix, NFO.AUDIO, "", "", "", "", "");
+      event.add_subject(sub);
       templates["audio"] = event;
 
       /* Section.VIDEOS */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               NFO_VIDEO, "", "", "", "", ""));
+      event = new Event.full("", manifestation, "", "" );
+      sub = new Subject.full (uri_prefix, NFO.VIDEO, "", "", "", "", "");
+      event.add_subject(sub);
       templates["videos"] = event;
 
       /* Section.PRESENTATIONS
        * FIXME: Zeitgeist logger needs to user finer granularity
        *        on classification as I am not sure it uses
-       *        NFO_PRESENTATION yet */
-      event = new Event.full("", manifestation, "",
-                             new Subject.full (uri_prefix,
-                                               NFO_PRESENTATION, "", "", "", "", ""));
+       *        NFO.PRESENTATION yet */
+      event = new Event.full("", manifestation, "", "");
+      sub = new Subject.full (uri_prefix, NFO.PRESENTATION, "", "", "", "", "");
+      event.add_subject(sub);
       templates["presentations"] = event;
 
       /* Section.OTHER
        * Note that subject templates are joined with logical AND */
       event = new Event.full("", manifestation, "");
       event.add_subject (new Subject.full (uri_prefix,
-                                           "!"+NFO_DOCUMENT, "", "", "", "", ""));
-      event.add_subject (new Subject.full ("",
-                                           "!"+NFO_IMAGE,
-                                           "",
-                                           "", "", "", ""));
-      event.add_subject (new Subject.full ("",
-                                           "!"+NFO_AUDIO,
-                                           "",
-                                           "", "", "", ""));
-      event.add_subject (new Subject.full ("",
-                                           "!"+NFO_VIDEO,
-                                           "",
-                                           "", "", "", ""));
-      event.add_subject (new Subject.full ("",
-                                           "!"+NFO_PRESENTATION,
+                                           "!"+NFO.DOCUMENT, "", "", "", "", ""));
+      event.add_subject (new Subject.full ("",
+                                           "!"+NFO.IMAGE,
+                                           "",
+                                           "", "", "", ""));
+      event.add_subject (new Subject.full ("",
+                                           "!"+NFO.AUDIO,
+                                           "",
+                                           "", "", "", ""));
+      event.add_subject (new Subject.full ("",
+                                           "!"+NFO.VIDEO,
+                                           "",
+                                           "", "", "", ""));
+      event.add_subject (new Subject.full ("",
+                                           "!"+NFO.PRESENTATION,
                                            "",
                                            "", "", "", ""));
       templates["other"] = event;
@@ -294,7 +293,7 @@
     private void prepare_type_templates ()
     {
       type_templates = new HashTable<string, Event> (str_hash, str_equal);
-      init_templates (type_templates, ZG_USER_ACTIVITY, "file:*");
+      init_templates (type_templates, ZG.USER_ACTIVITY, "file:*");
 
       unowned string download_path;
       download_path = Environment.get_user_special_dir (UserDirectory.DOWNLOAD);
@@ -675,11 +674,11 @@
       string date = option == null ? "all" : option.id;
 
       if (date == "last-7-days")
-        return new TimeRange (Timestamp.now() - Timestamp.WEEK, Timestamp.now ());
+        return new TimeRange (Timestamp.from_now() - Timestamp.WEEK, Timestamp.from_now ());
       else if (date == "last-30-days")
-        return new TimeRange (Timestamp.now() - (Timestamp.WEEK * 4), Timestamp.now());
+        return new TimeRange (Timestamp.from_now() - (Timestamp.WEEK * 4), Timestamp.from_now());
       else if (date == "last-year")
-        return new TimeRange (Timestamp.now() - Timestamp.YEAR, Timestamp.now ());
+        return new TimeRange (Timestamp.from_now() - Timestamp.YEAR, Timestamp.from_now ());
       else
         return new TimeRange.anytime ();
     }
@@ -769,7 +768,7 @@
       if (templates == null) return null;
 
       /* Copy the templates to a PtrArray which libzg expects */
-      var ptr_arr = new PtrArray ();
+      var ptr_arr = new GenericArray<Event>();
       for (int i = 0; i < templates.length; i++)
       {
         ptr_arr.add (templates[i]);
@@ -779,7 +778,7 @@
       if (is_search_empty (search))
       {
         results = yield log.find_events (time_range,
-                                         (owned) ptr_arr,
+                                         ptr_arr,
                                          Zeitgeist.StorageState.ANY,
                                          num_results,
                                          result_type,
@@ -791,7 +790,7 @@
 
         results = yield index.search (search_string,
                                       time_range,
-                                      (owned) ptr_arr,
+                                      ptr_arr,
                                       0, // offset
                                       num_results,
                                       result_type,
@@ -886,7 +885,7 @@
         // check if we match the timerange
         uint64 mtime = info.get_attribute_uint64 (FileAttribute.TIME_MODIFIED) * 1000;
 
-        if (mtime < timerange.get_start() || mtime > timerange.get_end ())
+        if (mtime < timerange.start || mtime > timerange.end)
           continue;
 
         // check if type matches
@@ -1231,7 +1230,7 @@
         {
           if (ev.num_subjects () > 0)
           {
-            string origin = ev.get_subject (0).get_origin ();
+            string origin = ev.get_subject (0).origin;
             if (origin == null || origin == "") continue;
             var f = File.new_for_uri (origin);
             origin = f.get_uri ();
@@ -1267,7 +1266,7 @@
           }
         }
         // we need this because of way ResultSet works with foreach
-        if (events.size () > 0) events.seek (0);
+        if (events.size () > 0) events.reset ();
       }
       foreach (var ev in events)
       {
@@ -1282,17 +1281,17 @@
 
           if (ResultFlags.USE_ORIGIN in flags)
           {
-            uri = su.get_origin ();
+            uri = su.origin;
             display_name = "";
             mimetype = "inode/directory";
           }
           else
           {
-            uri = su.get_current_uri ();
-            display_name = su.get_text ();
-            mimetype = su.get_mimetype ();
-            mimetype = su.get_mimetype () != null ?
-                       su.get_mimetype () : "application/octet-stream";
+            uri = su.current_uri;
+            display_name = su.text;
+            mimetype = su.mimetype;
+            mimetype = su.mimetype != null ?
+                       su.mimetype : "application/octet-stream";
           }
           if (uri == null) continue;
           File file = File.new_for_uri (uri);

=== modified file 'src/utils.vala'
--- src/utils.vala	2013-05-16 11:41:12 +0000
+++ src/utils.vala	2013-07-02 06:07:25 +0000
@@ -350,25 +350,25 @@
       switch (type_id)
       {
         case "documents":
-          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_DOCUMENT)
-            && !Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_PRESENTATION);
+          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.DOCUMENT)
+            && !Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.PRESENTATION);
         case "folders":
           return content_type == "inode/directory";
         case "images":
-          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_IMAGE);
+          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.IMAGE);
         case "audio":
-          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_AUDIO);
+          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.AUDIO);
         case "videos":
-          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_VIDEO);
+          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.VIDEO);
         case "presentations":
-          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_PRESENTATION);
+          return Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.PRESENTATION);
         case "other":
           bool is_recognized = false;
           is_recognized |= content_type == "inode/directory";
           // DOCUMENT includes PRESENTATION
-          is_recognized |= Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_DOCUMENT);
+          is_recognized |= Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.DOCUMENT);
           // MEDIA includes AUDIO, VIDEO, IMAGE
-          is_recognized |= Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO_MEDIA);
+          is_recognized |= Zeitgeist.Symbol.is_a (interpretation, Zeitgeist.NFO.MEDIA);
           return !is_recognized;
         case "all":
           return true;
@@ -386,7 +386,7 @@
       foreach (var ev in results)
         {
           for (int i = 0; i  < ev.num_subjects(); i++)
-            uris.add (ev.get_subject (i).get_uri ());
+            uris.add (ev.get_subject (i).uri);
         }
       
       return uris;


Follow ups