diff options
author | Sebastien Estienne <sebastien.estienne@gmail.com> | 2005-10-02 15:13:35 +0000 |
---|---|---|
committer | Sebastien Estienne <sebastien.estienne@gmail.com> | 2005-10-02 15:13:35 +0000 |
commit | 2bbf4f654ab32b899f591475601d5d1a2571cc4f (patch) | |
tree | c75f113e9cd3c71539c199b5874d15dd4e1e6d7d | |
parent | 656ba17f60a00a1ebbecdeb73912a55434605c28 (diff) |
* make the event box behave like a menubar and handle gnome-panel position
git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@28 3be567f1-68ff-0310-b24a-ad7cc433fd2f
-rwxr-xr-x | src/service-discovery-applet.in | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/service-discovery-applet.in b/src/service-discovery-applet.in index 75efdbe..7160e73 100755 --- a/src/service-discovery-applet.in +++ b/src/service-discovery-applet.in @@ -269,12 +269,29 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): self.service_menu.remove(self.zc_types[type].get_attach_widget()) del self.zc_types[type] + def position_popup_cb(self, widget): + x, y = self.applet.window.get_origin() + applet_width = self.applet.allocation.width + applet_height = self.applet.allocation.height + widget_width ,widget_height = widget.size_request() + print x, y,applet_width, applet_height,widget_height, widget_width + orientation = self.applet.get_orient() + if orientation == gnomeapplet.ORIENT_UP: + y -= widget_height + elif orientation == gnomeapplet.ORIENT_DOWN: + y += applet_height + elif orientation == gnomeapplet.ORIENT_LEFT: + x -= widget_width + elif orientation == gnomeapplet.ORIENT_RIGHT: + x += applet_width + return (x, y, True) + def on_button_press(self, widget, event): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: return False elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: self.service_menu.show_all() - self.service_menu.popup(None, None, None, event.button, event.time) + self.service_menu.popup(None, None, self.position_popup_cb, event.button, event.time) return True def on_eventbox_size_allocate(self, eventbox, rect): |