1 diff -ur xfce4-places-plugin-1.2.0/panel-plugin/view.c xfce4-places-plugin-1.2.0-position/panel-plugin/view.c
2 --- xfce4-places-plugin-1.2.0/panel-plugin/view.c 2011-03-03 13:43:31.938573607 +0100
3 +++ xfce4-places-plugin-1.2.0-position/panel-plugin/view.c 2011-03-03 13:42:28.099573608 +0100
8 +pview_position_menu (GtkMenu *menu,
15 + GtkRequisition requisition;
16 + GtkOrientation orientation;
18 + button = view->button;
19 + orientation = xfce_panel_plugin_get_orientation (view->plugin);
20 + gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
21 + gdk_window_get_origin (GTK_WIDGET (view->plugin)->window, x, y);
23 + switch (orientation)
25 + case GTK_ORIENTATION_HORIZONTAL:
26 + if (*y + button->allocation.height + requisition.height > gdk_screen_height ())
27 + /* Show menu above */
28 + *y -= requisition.height;
30 + /* Show menu below */
31 + *y += button->allocation.height;
33 + if (*x + requisition.width > gdk_screen_width ())
34 + /* Adjust horizontal position */
35 + *x = gdk_screen_width () - requisition.width;
38 + case GTK_ORIENTATION_VERTICAL:
39 + if (*x + button->allocation.width + requisition.width > gdk_screen_width ())
40 + /* Show menu on the right */
41 + *x -= requisition.width;
43 + /* Show menu on the left */
44 + *x += button->allocation.width;
46 + if (*y + requisition.height > gdk_screen_height ())
47 + /* Adjust vertical position */
48 + *y = gdk_screen_height () - requisition.height;
57 pview_open_menu(PlacesView *pd)
59 /* check if menu is needed, or it needs an update */
63 gtk_menu_popup (GTK_MENU (pd->menu), NULL, NULL,
64 - xfce_panel_plugin_position_menu,
66 + (GtkMenuPositionFunc)pview_position_menu, pd, 0,
67 gtk_get_current_event_time ());
69 /* menu timeout to poll for model changes */