[Sugar-devel] [PATCH sugar] Add new string 'Your device is empty' for external devices

Simon Schampijer simon at schampijer.de
Wed Aug 24 06:51:45 EDT 2011


Currently the message will be the same for an empty Journal
or an empty external device or an empty documents folder. This
patch does distinguish betwen an empty Journal and an empty
external device.

Signed-off-by: Simon Schampijer <simon at laptop.org>

---

Note: I am not yet sure about the naming. Maybe device can be
replaced by folder? Other suggestions?
---
 src/jarabe/journal/listview.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index a9f5a53..5397e2c 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -38,7 +38,8 @@ from jarabe.journal import misc
 UPDATE_INTERVAL = 300
 
 MESSAGE_EMPTY_JOURNAL = 0
-MESSAGE_NO_MATCH = 1
+MESSAGE_EMPTY_DEVICE = 1
+MESSAGE_NO_MATCH = 2
 
 
 class TreeView(gtk.TreeView):
@@ -315,7 +316,10 @@ class BaseListView(gtk.Bin):
 
         if len(tree_model) == 0:
             if self._is_query_empty():
-                self._show_message(MESSAGE_EMPTY_JOURNAL)
+                if self._query['mountpoints'] == ['/']:
+                    self._show_message(MESSAGE_EMPTY_JOURNAL)
+                else:
+                    self._show_message(MESSAGE_EMPTY_DEVICE)
             else:
                 self._show_message(MESSAGE_NO_MATCH)
         else:
@@ -385,6 +389,8 @@ class BaseListView(gtk.Bin):
 
         if message == MESSAGE_EMPTY_JOURNAL:
             text = _('Your Journal is empty')
+        elif message == MESSAGE_EMPTY_DEVICE:
+            text = _('Your device is empty')
         elif message == MESSAGE_NO_MATCH:
             text = _('No matching entries')
         else:
-- 
1.7.4.4



More information about the Sugar-devel mailing list