Index: deskbar/aligned_window.py =================================================================== RCS file: deskbar/aligned_window.py diff -N deskbar/aligned_window.py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ deskbar/aligned_window.py 16 Oct 2005 22:05:56 -0000 @@ -0,0 +1,93 @@ +#!/usr/bin/python +import gtk +import gnomeapplet + +class AlignedWindow(gtk.Window): + + def __init__(self, widgetToAlignWith, orient_func): + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + self.set_decorated(False) + + self.widgetToAlignWith = widgetToAlignWith + self.get_orient = orient_func + + def positionWindow(self): + # Get our own dimensions & position + self.realize() + gtk.gdk.flush() + ourWidth = (self.window.get_geometry())[2] + ourHeight = (self.window.get_geometry())[3] + + # Skip the taskbar, and the pager, stick and stay on top + self.stick() + self.set_keep_above(True) + self.set_skip_pager_hint(True) + self.set_skip_taskbar_hint(True) + self.set_type_hint (gtk.gdk.WINDOW_TYPE_HINT_DOCK) + + # Get the dimensions/position of the widgetToAlignWith + self.widgetToAlignWith.realize() + (x, y) = self.widgetToAlignWith.window.get_origin() + + (w, h) = self.get_size() + (w, h) = self.size_request() + + button_w = self.widgetToAlignWith.allocation.width + button_h = self.widgetToAlignWith.allocation.height + + screen = self.get_screen() + + found_monitor = False + n = screen.get_n_monitors() + for i in range(0, n): + monitor = screen.get_monitor_geometry(i) + if (x >= monitor.x and x <= monitor.x + monitor.width and \ + y >= monitor.y and y <= monitor.y + monitor.height): + found_monitor = True + break + + if not found_monitor: + monitor = gtk.gdk.Rectangle(0, 0, screen.get_width(), screen.get_width()) + + orient = self.get_orient() + if orient == gnomeapplet.ORIENT_RIGHT: + x += button_w + + if ((y + h) > monitor.y + monitor.height): + y -= (y + h) - (monitor.y + monitor.height) + + if ((y + h) > (monitor.height / 2)): + gravity = gtk.gdk.GRAVITY_SOUTH_WEST + else: + gravity = gtk.gdk.GRAVITY_NORTH_WEST + elif orient == gnomeapplet.ORIENT_LEFT: + x -= w + + if ((y + h) > monitor.y + monitor.height): + y -= (y + h) - (monitor.y + monitor.height) + + if ((y + h) > (monitor.height / 2)): + gravity = gtk.gdk.GRAVITY_SOUTH_EAST + else: + gravity = gtk.gdk.GRAVITY_NORTH_EAST + elif orient == gnomeapplet.ORIENT_DOWN: + y += button_h + + if ((x + w) > monitor.x + monitor.width): + x -= (x + w) - (monitor.x + monitor.width) + + gravity = gtk.gdk.GRAVITY_NORTH_WEST + elif orient == gnomeapplet.ORIENT_UP: + y -= h + + if ((x + w) > monitor.x + monitor.width): + x -= (x + w) - (monitor.x + monitor.width) + + gravity = gtk.gdk.GRAVITY_SOUTH_WEST + + # -"Coordinates locked in captain." + # -"Engage." + self.move(x, y) + self.set_gravity(gravity) + self.show() + Index: deskbar/applet.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/applet.py,v retrieving revision 1.24 diff -u -p -r1.24 applet.py --- deskbar/applet.py 16 Oct 2005 20:57:59 -0000 1.24 +++ deskbar/applet.py 16 Oct 2005 22:05:56 -0000 @@ -7,6 +7,8 @@ import deskbar, deskbar.deskbarentry, de from deskbar.module_list import ModuleLoader, ModuleList, ModuleLoader from deskbar.preferences import update_modules_priority +import aligned_window + class DeskbarApplet: def __init__(self, applet): self.applet = applet @@ -23,13 +25,16 @@ class DeskbarApplet: self.loader.connect ("module-initialized", self.module_list.module_toggled_cb) self.loader.connect ("module-initialized", self.on_module_initialized) self.loader.connect ("module-stopped", self.module_list.module_toggled_cb) - + self.entry = deskbar.deskbarentry.DeskbarEntry(self.module_list) self.entry.get_evbox().connect("button-press-event", self.on_icon_button_press) self.entry.get_entry().connect("button-press-event", self.on_entry_button_press) self.loader.connect ("module-initialized", self.entry._connect_if_async) self.on_applet_sensivity_update(False) - + + self.dropdown = aligned_window.AlignedWindow(self.entry, self.applet.get_orient) + self.entry.add_to_dropdown(self.dropdown) + self.keybinder = deskbar.applet_keybinder.AppletKeybinder(self) # Set and retreive entry width from gconf Index: deskbar/deskbarentry.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/deskbarentry.py,v retrieving revision 1.17 diff -u -p -r1.17 deskbarentry.py --- deskbar/deskbarentry.py 16 Oct 2005 20:57:59 -0000 1.17 +++ deskbar/deskbarentry.py 16 Oct 2005 22:05:56 -0000 @@ -94,6 +94,24 @@ class DeskbarEntry(deskbar.iconentry.Ico completion.pack_start(renderer) completion.add_attribute(renderer, "markup", ACTION_COL) + def add_to_dropdown(self, dropdown): + tv = gtk.TreeView(self._completion_model) + tv.show() + dropdown.add(tv) + + renderer = gtk.CellRendererPixbuf() + column_icon = gtk.TreeViewColumn ("Icon", renderer) + column_icon.set_attributes (renderer, pixbuf=ICON_COL) + + renderer = gtk.CellRendererText () + column_description = gtk.TreeViewColumn ("Description", renderer) + column_description.set_attributes (renderer, markup=ACTION_COL) + + tv.append_column(column_icon) + tv.append_column(column_description) + + self.dropdown = dropdown + def get_evbox(self): return self._evbox @@ -235,6 +253,8 @@ class DeskbarEntry(deskbar.iconentry.Ico self._append_matches (result) else: self._append_matches (matches) + + self.dropdown.show() def _append_matches (self, matches): """