[meld/meld-1-8] asdasd



commit 8a4403b2e0def8ae36b5aecd119c4f1985ba3a4f
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jun 14 07:10:17 2014 +1000

    asdasd

 data/ui/EditableList.ui |    6 ++++--
 meld/preferences.py     |   29 ++++++++++++++++-------------
 2 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/EditableList.ui b/data/ui/EditableList.ui
index 12d7821..5da925c 100644
--- a/data/ui/EditableList.ui
+++ b/data/ui/EditableList.ui
@@ -6,7 +6,9 @@
     <columns>
       <!-- column-name Active -->
       <column type="gboolean"/>
-      <!-- column-name Name -->
+      <!-- column-name ID -->
+      <column type="gchararray"/>
+      <!-- column-name Label -->
       <column type="gchararray"/>
     </columns>
     <signal name="row-inserted" handler="_update_sensitivity" swapped="no"/>
@@ -59,7 +61,7 @@
                         <child>
                           <object class="GtkCellRendererText" id="cr_name"/>
                           <attributes>
-                            <attribute name="text">1</attribute>
+                            <attribute name="text">2</attribute>
                           </attributes>
                         </child>
                       </object>
diff --git a/meld/preferences.py b/meld/preferences.py
index 802c58e..3a1389c 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -101,11 +101,11 @@ class FilterList(listwidget.ListWidget):
 
 class ColumnList(listwidget.ListWidget):
 
-    available_columns = set((
-        "size",
-        "modification time",
-        "permissions",
-    ))
+    available_columns = {
+        "size": _("Size"),
+        "modification time": _("Modification time"),
+        "permissions": _("Permissions"),
+    }
 
     def __init__(self, prefs, key):
         listwidget.ListWidget.__init__(self, "EditableList.ui",
@@ -114,16 +114,19 @@ class ColumnList(listwidget.ListWidget):
         self.prefs = prefs
         self.key = key
 
-        prefs_columns = []
-        for column in getattr(self.prefs, self.key):
+        column_vis = {}
+        column_order = {}
+        for sort_key, column in enumerate(getattr(self.prefs, self.key)):
             column_name, visibility = column.rsplit(" ", 1)
-            visibility = bool(int(visibility))
-            prefs_columns.append((column_name, visibility))
+            column_vis[column_name] = bool(int(visibility))
+            column_order[column_name] = sort_key
+
+        columns = [(column_vis.get(name, True), name, label) for
+                   name, label in self.available_columns.items()]
+        columns = sorted(columns, key=lambda c: column_order.get(c[1], 0))
 
-        missing = self.available_columns - set([c[0] for c in prefs_columns])
-        prefs_columns.extend([(m, False) for m in missing])
-        for column_name, visibility in prefs_columns:
-            self.model.append([visibility, _(column_name.capitalize())])
+        for visibility, name, label in columns:
+            self.model.append([visibility, name, label])
 
         for signal in ('row-changed', 'row-deleted', 'row-inserted',
                        'rows-reordered'):


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