conduit r1584 - in trunk: . conduit/datatypes



Author: jstowers
Date: Wed Jul 23 05:25:12 2008
New Revision: 1584
URL: http://svn.gnome.org/viewvc/conduit?rev=1584&view=rev

Log:
	* conduit/datatypes/Bookmark.py:
	* conduit/datatypes/Makefile.am: Add bookmark datatype.
	Fixes #543738 (Andrew Stormont)


Added:
   trunk/conduit/datatypes/Bookmark.py
Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/conduit/datatypes/Makefile.am

Added: trunk/conduit/datatypes/Bookmark.py
==============================================================================
--- (empty file)
+++ trunk/conduit/datatypes/Bookmark.py	Wed Jul 23 05:25:12 2008
@@ -0,0 +1,44 @@
+# (c) Copyright Andrew Stormont <andyjstormont googlemail com> 2008.
+
+import logging
+log = logging.getLogger("datatypes.Bookmark")
+
+import conduit
+from conduit.datatypes import DataType
+
+class Bookmark(DataType.DataType):
+    """
+    Represents a Bookmark with a title and uri
+    """
+    _name_ = "Bookmark"
+    def __init__(self, title, uri, **kwargs):
+        DataType.DataType.__init__(self)
+        self.title = title
+        self.uri = uri
+
+    def get_title(self):
+        return self.title
+
+    def get_uri(self):
+        return self.uri
+        
+    def get_hash(self):
+        return hash( (self.get_title(), self.get_uri()) )
+
+    def get_bookmark_string(self):
+        return self.__str__()
+
+    def __getstate__(self):
+        data = DataType.DataType.__getstate__(self)
+        data["title"] = self.get_title()
+        data["uri"] = self.get_uri()
+        return data
+
+    def __setstate__(self, data):
+        self.title = data["title"]
+        self.uri = data["uri"]
+        DataType.DataType.__setstate__(self, data)
+
+    def __str__(self):
+        return "%s:%s" % (self.get_title(), self.get_uri() )
+

Modified: trunk/conduit/datatypes/Makefile.am
==============================================================================
--- trunk/conduit/datatypes/Makefile.am	(original)
+++ trunk/conduit/datatypes/Makefile.am	Wed Jul 23 05:25:12 2008
@@ -11,7 +11,8 @@
 	Photo.py \
 	Setting.py \
 	Text.py \
-	Video.py
+	Video.py \
+	Bookmark.py
 
 clean-local:
 	rm -rf *.pyc *.pyo



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