summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libzeitgeist/datamodel.vala2
-rw-r--r--python/datamodel.py9
-rw-r--r--src/db-reader.vala2
-rw-r--r--src/engine.vala10
-rw-r--r--src/sql.vala5
-rw-r--r--test/dbus/testutils.py3
6 files changed, 26 insertions, 5 deletions
diff --git a/libzeitgeist/datamodel.vala b/libzeitgeist/datamodel.vala
index 32bfa85c..b30ef385 100644
--- a/libzeitgeist/datamodel.vala
+++ b/libzeitgeist/datamodel.vala
@@ -857,7 +857,7 @@ namespace Zeitgeist
return false;
if (!check_field_match (this.origin, template_subject.origin, false, true))
return false;
- if (!check_field_match (this.current_uri, template_subject.current_origin, false, true))
+ if (!check_field_match (this.current_origin, template_subject.current_origin, false, true))
return false;
if (!check_field_match (this.mimetype, template_subject.mimetype, false, true))
return false;
diff --git a/python/datamodel.py b/python/datamodel.py
index 9595b9d6..27052f1a 100644
--- a/python/datamodel.py
+++ b/python/datamodel.py
@@ -384,6 +384,9 @@ class Subject(list):
def __init__(self, data=None):
if data:
+ if len(data) == len(Subject.Fields) - 2:
+ # current_origin has been added in Zeitgeist 1.0 Beta 1
+ data.append("")
if len(data) == len(Subject.Fields) - 1:
# current_uri has been added in Zeitgeist 0.8.0
data.append("")
@@ -420,13 +423,15 @@ class Subject(list):
:param interpretation: The interpretation type of the subject, given either as a string URI or as a :class:`Interpretation` instance
:param manifestation: The manifestation type of the subject, given either as a string URI or as a :class:`Manifestation` instance
:param origin: The URI of the location where subject resides or can be found
+ :param current_origin: The URI of the location where subject resides or can be found (if it was moved or deleted).
:param mimetype: The mimetype of the subject encoded as a string, if applicable. Eg. *text/plain*.
:param text: Free form textual annotation of the subject.
:param storage: String identifier for the storage medium of the subject. This should be the UUID of the volume or the string "net" for resources requiring a network interface, and the string "deleted" for subjects that are deleted.
"""
self = Subject()
for key, value in values.iteritems():
- if not key in ("uri", "current_uri", "interpretation", "manifestation", "origin",
+ if not key in ("uri", "current_uri", "interpretation",
+ "manifestation", "origin", "current_origin",
"mimetype", "text", "storage"):
raise ValueError("Subject parameter '%s' is not supported" %key)
setattr(self, key, value)
@@ -477,7 +482,7 @@ class Subject(list):
def set_current_origin(self, value):
self[Subject.CurrentOrigin] = value
- origin = property(get_origin, set_origin,
+ current_origin = property(get_current_origin, set_current_origin,
doc="Read/write property with the URI of the location where the subject can be found. For files this is the parent directory, or for downloaded files it would be the URL of the page where you clicked the download link")
def get_mimetype(self):
diff --git a/src/db-reader.vala b/src/db-reader.vala
index 0cd87d75..54e36c66 100644
--- a/src/db-reader.vala
+++ b/src/db-reader.vala
@@ -107,7 +107,7 @@ public class DbReader : Object
subject.current_uri = stmt.column_text (
EventViewRows.SUBJECT_CURRENT_URI);
subject.current_origin = stmt.column_text (
- EventViewRows.SUBJECT_CURRENT_ORIGIN);
+ EventViewRows.SUBJECT_CURRENT_ORIGIN_URI);
subject.interpretation = interpretations_table.get_value (
stmt.column_int (EventViewRows.SUBJECT_INTERPRETATION));
subject.manifestation = manifestations_table.get_value (
diff --git a/src/engine.vala b/src/engine.vala
index 38a83eb2..e574c899 100644
--- a/src/engine.vala
+++ b/src/engine.vala
@@ -139,6 +139,14 @@ public class Engine : DbReader
"'MOVE_EVENT' then subject.uri and " +
"subject.current_uri have to be the same");
}
+ if (event.interpretation != ZG.MOVE_EVENT
+ && subject.origin != subject.current_origin)
+ {
+ throw new EngineError.INVALID_ARGUMENT (
+ "Illegal event: unless event.interpretation is " +
+ "'MOVE_EVENT' then subject.origin and " +
+ "subject.current_origin have to be the same");
+ }
// If subject manifestation and interpretation are not set,
// we try to automatically determine them from the other data.
@@ -234,6 +242,8 @@ public class Engine : DbReader
uris.add (subject.uri);
if (subject.uri != subject.current_uri)
uris.add (subject.current_uri);
+ if (subject.origin != subject.current_origin)
+ uris.add (subject.current_origin);
if (!is_empty_string (subject.origin))
uris.add (subject.origin);
diff --git a/src/sql.vala b/src/sql.vala
index 81eb4a76..7ee4f903 100644
--- a/src/sql.vala
+++ b/src/sql.vala
@@ -45,10 +45,13 @@ namespace Zeitgeist.SQLite
SUBJECT_TEXT,
SUBJECT_STORAGE,
SUBJECT_STORAGE_STATE,
- ORIGIN,
+ EVENT_ORIGIN,
EVENT_ORIGIN_URI,
SUBJECT_CURRENT_URI,
SUBJECT_ID_CURRENT,
+ SUBJECT_TEXT_ID,
+ SUBJECT_STORAGE_ID,
+ ACTOR_URI,
SUBJECT_CURRENT_ORIGIN,
SUBJECT_CURRENT_ORIGIN_URI
}
diff --git a/test/dbus/testutils.py b/test/dbus/testutils.py
index 00cb93dd..d492e996 100644
--- a/test/dbus/testutils.py
+++ b/test/dbus/testutils.py
@@ -68,6 +68,7 @@ def dict2event(d):
subj.interpretation = str(sd.get("interpretation", "").encode("UTF-8"))
subj.manifestation = str(sd.get("manifestation", "").encode("UTF-8"))
subj.origin = str(sd.get("origin", "").encode("UTF-8"))
+ subj.current_origin = str(sd.get("current_origin", "")).encode("UTF-8")
subj.mimetype = str(sd.get("mimetype", "").encode("UTF-8"))
subj.text = str(sd.get("text", "").encode("UTF-8"))
subj.storage = str(sd.get("storage", "").encode("UTF-8"))
@@ -409,6 +410,8 @@ class RemoteTestCase (unittest.TestCase):
for subject in ev.subjects:
if not subject.current_uri:
subject.current_uri = subject.uri
+ if not subject.current_origin:
+ subject.current_origin = subject.origin
popo = []
popo.append(map(unicode, ev[0]))
popo.append([map(unicode, subj) for subj in ev[1]])