[Sugar-devel] [PATCH StopWatch] Add mime type when save in the journal

godiard at sugarlabs.org godiard at sugarlabs.org
Fri Feb 10 08:49:36 EST 2012


From: Agustin Zubiaga <aguz at sugarlabs.org>

This enable to other activities to identify the data

Signed-off-by: Agustin Zubiaga <aguz at sugarlabs.org>
Reviewed-by: Gonzalo Odiard <gonzalo at laptop.org>
---
 activity.py            |    1 +
 activity/activity.info |    1 +
 activity/mimetypes.xml |    7 +++++++
 3 files changed, 9 insertions(+), 0 deletions(-)
 create mode 100644 activity/mimetypes.xml

diff --git a/activity.py b/activity.py
index 88313e2..306b081 100644
--- a/activity.py
+++ b/activity.py
@@ -166,6 +166,7 @@ class StopWatchActivity(Activity):
         self.gui.set_all(q)
     
     def write_file(self, file_path):
+        self.metadata['mime_type'] = 'application/x-stopwatch-activity'
         q = self.gui.get_all()
         f = open(file_path, 'w')
         cPickle.dump(q, f)
diff --git a/activity/activity.info b/activity/activity.info
index c8fd3da..5ccabfa 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -6,3 +6,4 @@ icon = activity-stopwatch
 activity_version = 13
 show_launcher = yes
 license = GPLv3+
+mime_types = application/x-stopwatch-activity;
diff --git a/activity/mimetypes.xml b/activity/mimetypes.xml
new file mode 100644
index 0000000..2426820
--- /dev/null
+++ b/activity/mimetypes.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+  <mime-type type="application/x-stopwatch-activity">
+         <comment xml:lang="en">StopWatch Activity</comment>
+         <glob pattern="*.stopwatch"/>
+  </mime-type>
+</mime-info>
-- 
1.7.7.6



More information about the Sugar-devel mailing list