deskbar-applet r1867 - in branches/button-ui/deskbar: core ui



Author: sebp
Date: Thu Jan 24 17:48:07 2008
New Revision: 1867
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=1867&view=rev

Log:
Sort history according to applet's orientation as well

Modified:
   branches/button-ui/deskbar/core/DeskbarHistory.py
   branches/button-ui/deskbar/ui/CuemiacAlignedView.py

Modified: branches/button-ui/deskbar/core/DeskbarHistory.py
==============================================================================
--- branches/button-ui/deskbar/core/DeskbarHistory.py	(original)
+++ branches/button-ui/deskbar/core/DeskbarHistory.py	Thu Jan 24 17:48:07 2008
@@ -53,7 +53,7 @@
         """
         gtk.ListStore.__init__ (self, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) # timestamp, query, match
         
-        self.set_sort_column_id (self.COL_TIME, gtk.SORT_DESCENDING)
+        self.set_sort_order (gtk.SORT_DESCENDING)
         self.set_sort_func (self.COL_TIME, self.__sort_actions)
         
         self._index = 0 # We don't want to show ChooseFromHistoryAction
@@ -61,6 +61,17 @@
         
         self.append(0, "", ChooseFromHistoryAction())
     
+    def set_sort_order(self, order):
+        """
+        @param order Either C{gtk.SORT_DESCENDING} or C{gtk.SORT_ASCENDING}
+        """
+        self.set_sort_column_id(self.COL_TIME, order)
+        if order == gtk.SORT_DESCENDING:
+            # Alternatively gtk.TreeStore.prepend for bottom panel layout
+            self.append_method = gtk.ListStore.append
+        else:
+            self.append_method = gtk.ListStore.prepend
+    
     @staticmethod
     def get_instance(max_history_items=25):
         """
@@ -152,7 +163,7 @@
         """
         *Do not* use this method. Always use L{add}.
         """
-        gtk.ListStore.append (self, (timestamp, text, action))
+        self.append_method (self, (timestamp, text, action))
     
     def prepend (self, timestamp, text, action):
         """

Modified: branches/button-ui/deskbar/ui/CuemiacAlignedView.py
==============================================================================
--- branches/button-ui/deskbar/ui/CuemiacAlignedView.py	(original)
+++ branches/button-ui/deskbar/ui/CuemiacAlignedView.py	Thu Jan 24 17:48:07 2008
@@ -310,6 +310,7 @@
         if orient in [gnomeapplet.ORIENT_LEFT, gnomeapplet.ORIENT_RIGHT, gnomeapplet.ORIENT_DOWN]:
             self.treeview_model.set_sort_order (gtk.SORT_ASCENDING)
             self.actions_model.set_sort_order (gtk.SORT_ASCENDING)
+            self._model.get_history().set_sort_order (gtk.SORT_DESCENDING)
             self.vbox_main.pack_start(self.header, False)
             self.vbox_main.pack_start(self.history_box, False)
             self.vbox_main.pack_start(self.results_box)
@@ -317,6 +318,7 @@
             # We are at a bottom panel. Put entry on bottom, and prepend matches (instead of append).
             self.treeview_model.set_sort_order (gtk.SORT_DESCENDING)
             self.actions_model.set_sort_order (gtk.SORT_DESCENDING)
+            self._model.get_history().set_sort_order (gtk.SORT_ASCENDING)
             self.vbox_main.pack_start(self.results_box)
             self.vbox_main.pack_start(self.history_box, False)
             self.vbox_main.pack_start(self.header, False)



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