? deskbar-applet-addressbook-search.patch Index: deskbar/DeskbarHistory.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/DeskbarHistory.py,v retrieving revision 1.12 diff -u -p -r1.12 DeskbarHistory.py --- deskbar/DeskbarHistory.py 11 Feb 2006 13:33:55 -0000 1.12 +++ deskbar/DeskbarHistory.py 13 Feb 2006 21:49:54 -0000 @@ -22,6 +22,22 @@ class DeskbarHistoryIter : raise StopIteration return item +# The sort function ids +SORT_CHRONOLOGICAL = 1 + +class SortedDeskbarHistory (gtk.TreeModelSort): + def __init__(self): + gtk.TreeModelSort.__init__(self, get_deskbar_history()) + self.set_sort_func(SORT_CHRONOLOGICAL, self.on_sort_chronological) + self.set_sort_column_id(SORT_CHRONOLOGICAL, gtk.SORT_ASCENDING) + + def set_sort_order(self, order): + print 'Set sort order hhh' + self.set_sort_column_id(SORT_CHRONOLOGICAL, order) + + def on_sort_chronological(self, model, iter1, iter2): + return 1 + class DeskbarHistory (gtk.ListStore) : """ Iteraating over a DeskbarHistory with a for loop returns (text,match) pairs. Index: deskbar/deskbar-applet.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/deskbar-applet.py,v retrieving revision 1.13 diff -u -p -r1.13 deskbar-applet.py --- deskbar/deskbar-applet.py 10 Feb 2006 14:36:25 -0000 1.13 +++ deskbar/deskbar-applet.py 13 Feb 2006 21:49:54 -0000 @@ -58,7 +58,8 @@ def build_window(): app.set_property('resizable', False) applet = gnomeapplet.Applet() - applet.get_orient = lambda: gnomeapplet.ORIENT_DOWN + #applet.get_orient = lambda: gnomeapplet.ORIENT_DOWN + applet.get_orient = lambda: gnomeapplet.ORIENT_UP applet_factory(applet, None) applet.reparent(app) Index: deskbar/ui/cuemiac/Cuemiac.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/ui/cuemiac/Cuemiac.py,v retrieving revision 1.54 diff -u -p -r1.54 Cuemiac.py --- deskbar/ui/cuemiac/Cuemiac.py 11 Feb 2006 12:31:48 -0000 1.54 +++ deskbar/ui/cuemiac/Cuemiac.py 13 Feb 2006 21:49:55 -0000 @@ -592,7 +592,7 @@ class CuemiacUI (DeskbarUI): self.entry = self.icon_entry.get_entry () self.entry_icon = gtk.Image () self.history = get_deskbar_history () - self.history_popup = CuemiacHistoryPopup (self.history, self.deskbar_button.button_arrow, applet) + self.history_popup = CuemiacHistoryPopup (self.deskbar_button.button_arrow, applet) self.model = CuemiacModel () self.cview = CuemiacTreeView (self.model) self.scroll_win = gtk.ScrolledWindow () @@ -776,12 +776,14 @@ class CuemiacUI (DeskbarUI): self.box.pack_start (self.scroll_win) self.cview.append_method = gtk.TreeStore.append self.cview.get_model().set_sort_order(gtk.SORT_DESCENDING) + self.history_popup.set_sort_order(gtk.SORT_DESCENDING) else: # We are at a bottom panel. Put entry on bottom, and prepend matches (instead of append). self.box.pack_start (self.scroll_win) self.box.pack_start (self.icon_entry, False) self.cview.append_method = gtk.TreeStore.prepend self.cview.get_model().set_sort_order(gtk.SORT_ASCENDING) + self.history_popup.set_sort_order(gtk.SORT_ASCENDING) # Update icon accordingto direction self.on_change_size (self.applet) Index: deskbar/ui/cuemiac/CuemiacHistory.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/ui/cuemiac/CuemiacHistory.py,v retrieving revision 1.6 diff -u -p -r1.6 CuemiacHistory.py --- deskbar/ui/cuemiac/CuemiacHistory.py 10 Feb 2006 01:23:01 -0000 1.6 +++ deskbar/ui/cuemiac/CuemiacHistory.py 13 Feb 2006 21:49:55 -0000 @@ -3,16 +3,17 @@ import cgi import deskbar from deskbar.ui.cuemiac.CuemiacAlignedWindow import CuemiacAlignedWindow +from deskbar.DeskbarHistory import get_deskbar_history, SortedDeskbarHistory -class CuemaicHistoryView (gtk.TreeView): +class CuemiacHistoryView (gtk.TreeView): __gsignals__ = { "match-selected" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]), } - def __init__ (self, deskbar_history): - gtk.TreeView.__init__ (self, deskbar_history) - + def __init__ (self): + gtk.TreeView.__init__ (self, SortedDeskbarHistory()) + icon = gtk.CellRendererPixbuf () title = gtk.CellRendererText () title.set_property ("ellipsize", pango.ELLIPSIZE_END) @@ -57,9 +58,9 @@ class CuemiacHistoryPopup (CuemiacAligne "match-selected" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]), } - def __init__ (self, deskbar_history, widget_to_align_with, applet): + def __init__ (self, widget_to_align_with, applet): CuemiacAlignedWindow.__init__ (self, widget_to_align_with, applet) - self.list_view = CuemaicHistoryView (deskbar_history) + self.list_view = CuemiacHistoryView () self.add (self.list_view) self.list_view.connect ("match-selected", self.on_match_selected) @@ -80,6 +81,10 @@ class CuemiacHistoryPopup (CuemiacAligne def on_match_selected (self, sender, match): self.emit ("match-selected", match) + + def set_sort_order(self, order): + print 'set_sort_order history' + self.list_view.get_model().set_sort_order(order) if gtk.pygtk_version < (2,8,0): gobject.type_register (CuemiacHistoryView) Index: deskbar/ui/entriac/CuemiacEntryUI.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/ui/entriac/CuemiacEntryUI.py,v retrieving revision 1.2 diff -u -p -r1.2 CuemiacEntryUI.py --- deskbar/ui/entriac/CuemiacEntryUI.py 10 Feb 2006 01:41:11 -0000 1.2 +++ deskbar/ui/entriac/CuemiacEntryUI.py 13 Feb 2006 21:49:55 -0000 @@ -27,7 +27,7 @@ class CuemiacEntryUI (DeskbarUI): self.entry_icon = gtk.Image () self.icon_event_box = gtk.EventBox () self.history = get_deskbar_history () - self.history_popup = CuemiacHistoryPopup (self.history, self.entry_icon, applet) + self.history_popup = CuemiacHistoryPopup (self.entry_icon, applet) self.model = CuemiacModel () self.cview = CuemiacTreeView (self.model) self.scroll_win = gtk.ScrolledWindow () @@ -231,10 +231,12 @@ class CuemiacEntryUI (DeskbarUI): if orient in [gnomeapplet.ORIENT_LEFT, gnomeapplet.ORIENT_RIGHT, gnomeapplet.ORIENT_DOWN]: self.cview.append_method = gtk.TreeStore.append self.cview.get_model().set_sort_order(gtk.SORT_DESCENDING) + self.history_popup.set_sort_order(gtk.SORT_DESCENDING) else: # We are at a bottom panel. Put entry on bottom, and prepend matches (instead of append). self.cview.append_method = gtk.TreeStore.prepend self.cview.get_model().set_sort_order(gtk.SORT_ASCENDING) + self.history_popup.set_sort_order(gtk.SORT_ASCENDING) # Update how the popups is aligned self.popup.alignment = self.applet.get_orient () @@ -260,7 +262,7 @@ class CuemiacEntryUI (DeskbarUI): self.cview.set_query_string (qstring) if qstring == "": self.model.clear() - self.hide_window (self.popup) # FIXME the entry looses focus here... We really need an event time to fix this + self.hide_window (self.popup) self.emit ("stop-query") return @@ -394,7 +396,12 @@ class CuemiacEntryUI (DeskbarUI): self.applet.emit ("button-press-event", event) return True elif event.button == 1: - self.history_popup.show (event.time) + if self.history_popup.get_property('visible'): + self.history_popup.hide() + self.applet.request_focus(event.time) + else: + self.hide_window (self.popup, event.time) + self.history_popup.show (event.time) return True return False