Author: nick
Date: 2008-10-23 17:50:09 +0000 (Thu, 23 Oct 2008)
New Revision: 28387
Modified:
xfce4-panel/trunk/plugins/launcher/launcher.c
Log:
* Reverse the order of the launcher menu when the panel is on
the top of the screen (Bug #4450).
Modified: xfce4-panel/trunk/plugins/launcher/launcher.c
===================================================================
--- xfce4-panel/trunk/plugins/launcher/launcher.c 2008-10-23 17:35:49 UTC
(rev 28386)
+++ xfce4-panel/trunk/plugins/launcher/launcher.c 2008-10-23 17:50:09 UTC
(rev 28387)
@@ -679,6 +679,7 @@
LauncherEntry *entry;
GtkWidget *mi, *image;
GdkPixbuf *pixbuf;
+ GtkArrowType arrow_type;
/* destroy the old menu */
if (G_UNLIKELY (launcher->menu))
@@ -692,6 +693,9 @@
/* set the menu screen */
gtk_menu_set_screen (GTK_MENU (launcher->menu), screen);
+
+ /* get the arrow direction of the button */
+ arrow_type = xfce_arrow_button_get_arrow_type (XFCE_ARROW_BUTTON
(launcher->arrow_button));
/* walk through the entries */
for (li = launcher->entries; li != NULL; li = li->next, n++)
@@ -704,8 +708,13 @@
/* create menu item */
mi = gtk_image_menu_item_new_with_label (entry->name ? entry->name :
_("New Item"));
- gtk_menu_shell_prepend (GTK_MENU_SHELL (launcher->menu), mi);
gtk_widget_show (mi);
+
+ /* fix menu order when it's on the top or bottom of the screen */
+ if (arrow_type == GTK_ARROW_DOWN)
+ gtk_menu_shell_append (GTK_MENU_SHELL (launcher->menu), mi);
+ else
+ gtk_menu_shell_prepend (GTK_MENU_SHELL (launcher->menu), mi);
/* try to set an image */
if (G_LIKELY (entry->icon))
@@ -1158,6 +1167,9 @@
/* set the arrow direction */
xfce_arrow_button_set_arrow_type (XFCE_ARROW_BUTTON
(launcher->arrow_button), arrow_type);
+
+ /* destroy the menu, so menu items appear in the correct direction */
+ launcher_menu_destroy (launcher);
}
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits