deskbar-applet r2122 - in branches/gnome-2-22: . deskbar/ui deskbar/ui/cuemiac
- From: sebp svn gnome org
- To: svn-commits-list gnome org
- Subject: deskbar-applet r2122 - in branches/gnome-2-22: . deskbar/ui deskbar/ui/cuemiac
- Date: Tue, 15 Apr 2008 22:03:36 +0100 (BST)
Author: sebp
Date: Tue Apr 15 22:03:36 2008
New Revision: 2122
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2122&view=rev
Log:
Adjust layout when applet is moved from one panel to another
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/deskbar/ui/CuemiacAlignedView.py
branches/gnome-2-22/deskbar/ui/cuemiac/CuemiacAlignedWindow.py
Modified: branches/gnome-2-22/deskbar/ui/CuemiacAlignedView.py
==============================================================================
--- branches/gnome-2-22/deskbar/ui/CuemiacAlignedView.py (original)
+++ branches/gnome-2-22/deskbar/ui/CuemiacAlignedView.py Tue Apr 15 22:03:36 2008
@@ -36,6 +36,7 @@
self.set_keep_above(True)
self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR)
self.applet.set_flags(gtk.CAN_FOCUS)
+ self.applet.connect("change-orient", self._on_change_orient)
self._screen_height = self.get_screen().get_height ()
self._screen_width = self.get_screen().get_width ()
@@ -309,17 +310,31 @@
C{gnomeapplet.ORIENT_LEFT}, C{gnomeapplet.ORIENT_RIGHT}.
"""
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)
else:
# 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)
+
+ def __set_sort_order_by_orientation(self, orient):
+ 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)
+ else:
+ 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)
+
+ def _on_change_orient(self, applet, orient):
+ self.__set_sort_order_by_orientation(orient)
+ if orient in [gnomeapplet.ORIENT_LEFT, gnomeapplet.ORIENT_RIGHT, gnomeapplet.ORIENT_DOWN]:
+ self.vbox_main.reorder_child(self.header, 0)
+ self.vbox_main.reorder_child(self.results_box, 2)
+ else:
+ self.vbox_main.reorder_child(self.results_box, 0)
+ self.vbox_main.reorder_child(self.header, 2)
+
\ No newline at end of file
Modified: branches/gnome-2-22/deskbar/ui/cuemiac/CuemiacAlignedWindow.py
==============================================================================
--- branches/gnome-2-22/deskbar/ui/cuemiac/CuemiacAlignedWindow.py (original)
+++ branches/gnome-2-22/deskbar/ui/cuemiac/CuemiacAlignedWindow.py Tue Apr 15 22:03:36 2008
@@ -29,7 +29,6 @@
self.widgetToAlignWith = widgetToAlignWith
self.applet = applet
- self.alignment = applet.get_orient ()
self.realize_status = None
self.connect ("realize", lambda win : self.__register_realize ())
@@ -72,8 +71,9 @@
screen = self.get_screen()
monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (self.applet.window))
+ alignment = self.applet.get_orient()
- if self.alignment == gnomeapplet.ORIENT_LEFT:
+ if alignment == gnomeapplet.ORIENT_LEFT:
x = ax - ww
y = ay
@@ -88,7 +88,7 @@
else:
gravity = gtk.gdk.GRAVITY_NORTH_WEST
- elif self.alignment == gnomeapplet.ORIENT_RIGHT:
+ elif alignment == gnomeapplet.ORIENT_RIGHT:
x = ax + aw
y = ay
@@ -103,7 +103,7 @@
else:
gravity = gtk.gdk.GRAVITY_NORTH_EAST
- elif self.alignment == gnomeapplet.ORIENT_DOWN:
+ elif alignment == gnomeapplet.ORIENT_DOWN:
x = ax
y = ay + ah
@@ -114,7 +114,7 @@
x = 0
gravity = gtk.gdk.GRAVITY_NORTH_WEST
- elif self.alignment == gnomeapplet.ORIENT_UP:
+ elif alignment == gnomeapplet.ORIENT_UP:
x = ax
y = ay - wh
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]