Ok pushed.<br><br>Gonzalo<br><br><div class="gmail_quote">On Fri, Jun 24, 2011 at 8:38 AM, Simon Schampijer <span dir="ltr"><<a href="mailto:simon@schampijer.de">simon@schampijer.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks for the patch Gonzalo. The patch looks good and works well, tested here.<br>
<br>
Acked-By: Simon Schampijer <<a href="mailto:simon@laptop.org" target="_blank">simon@laptop.org</a>><br>
<br>
Regards,<br>
   Simon<div><div></div><div class="h5"><br>
<br>
On 06/17/2011 04:20 PM, <a href="mailto:godiard@sugarlabs.org" target="_blank">godiard@sugarlabs.org</a> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
From: Gonzalo Odiard<<a href="mailto:godiard@gmail.com" target="_blank">godiard@gmail.com</a>><br>
<br>
This patch enable saving metadata and renaming files in device<br>
with write permission.<br>
There are code to avoid break if the user change the title and other<br>
properties, like description, tags or favorites, because changing<br>
the title, the files used to save the meatata change the name too.<br>
<br>
Signed-off-by: Gonzalo Odiard<<a href="mailto:gonzalo@laptop.org" target="_blank">gonzalo@laptop.org</a>><br>
---<br>
  src/jarabe/journal/<u></u>expandedentry.py |   20 ++++++++++++++++++--<br>
  src/jarabe/journal/listview.py      |    3 ---<br>
  src/jarabe/journal/model.py         |    6 ++++--<br>
  3 files changed, 22 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/jarabe/journal/<u></u>expandedentry.py b/src/jarabe/journal/<u></u>expandedentry.py<br>
index fe2f320..d293694 100644<br>
--- a/src/jarabe/journal/<u></u>expandedentry.py<br>
+++ b/src/jarabe/journal/<u></u>expandedentry.py<br>
@@ -18,6 +18,7 @@ import logging<br>
  from gettext import gettext as _<br>
  import StringIO<br>
  import time<br>
+import os<br>
<br>
  import hippo<br>
  import cairo<br>
@@ -406,7 +407,14 @@ class ExpandedEntry(hippo.CanvasBox)<u></u>:<br>
              needs_update = True<br>
<br>
          if needs_update:<br>
-            model.write(self._metadata, update_mtime=False)<br>
+            if self._metadata.get('<u></u>mountpoint', '/') == '/':<br>
+                model.write(self._metadata, update_mtime=False)<br>
+            else:<br>
+                old_file_path = os.path.join(self._metadata['<u></u>mountpoint'],<br>
+                        model.get_file_name(old_title,<br>
+                        self._metadata['mime_type']))<br>
+                model.write(self._metadata, file_path=old_file_path,<br>
+                        update_mtime=False)<br>
<br>
          self._update_title_sid = None<br>
<br>
@@ -420,7 +428,15 @@ class ExpandedEntry(hippo.CanvasBox)<u></u>:<br>
              self._metadata['keep'] = 0<br>
          else:<br>
              self._metadata['keep'] = 1<br>
-        model.write(self._metadata, update_mtime=False)<br>
+<br>
+        if self._metadata.get('<u></u>mountpoint', '/') == '/':<br>
+            model.write(self._metadata, update_mtime=False)<br>
+        else:<br>
+            f_path = os.path.join(self._metadata['<u></u>mountpoint'],<br>
+                    model.get_file_name(self._<u></u>metadata['title'],<br>
+                    self._metadata['mime_type']))<br>
+            model.write(self._metadata, file_path=f_path,<br>
+                    update_mtime=False)<br>
<br>
          keep_icon.props.keep = self.get_keep()<br>
<br>
diff --git a/src/jarabe/journal/listview.<u></u>py b/src/jarabe/journal/listview.<u></u>py<br>
index 1bc8f8a..78e109a 100644<br>
--- a/src/jarabe/journal/listview.<u></u>py<br>
+++ b/src/jarabe/journal/listview.<u></u>py<br>
@@ -328,9 +328,6 @@ class BaseListView(gtk.Bin):<br>
          self._scroll_position = self.tree_view.props.<u></u>vadjustment.props.value<br>
          logging.debug('ListView.__map_<u></u>cb %r', self._scroll_position)<br>
<br>
-        is_editable = self._query.get('mountpoints', '') == '/'<br>
-        self.cell_title.props.editable = is_editable<br>
-<br>
      def _is_query_empty(self):<br>
          # FIXME: This is a hack, we shouldn't have to update this every time<br>
          # a new search term is added.<br>
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py<br>
index fd25681..2be2bde 100644<br>
--- a/src/jarabe/journal/model.py<br>
+++ b/src/jarabe/journal/model.py<br>
@@ -782,5 +782,7 @@ def get_unique_file_name(mount_<u></u>point, file_name):<br>
<br>
<br>
  def is_editable(metadata):<br>
-    mountpoint = metadata.get('mountpoint', '/')<br>
-    return mountpoint == '/'<br>
+    if metadata.get('mountpoint', '/') == '/':<br>
+        return True<br>
+    else:<br>
+        return os.access(metadata['<u></u>mountpoint'], os.W_OK)<br>
</blockquote>
<br></div></div>
______________________________<u></u>_________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.<u></u>org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/<u></u>listinfo/sugar-devel</a><br>
</blockquote></div><br>