! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
plugin menu items added in reverse order compared to 4.6
Status:
RESOLVED: FIXED
Product:
Xfce4-panel
Component:
Libxfce4panel

Comments

Description Landry Breuil editbugs 2011-01-16 13:16:20 CET
This only affects mpc plugin, where i'm doing a ugly hack:
i need to insert an item at a 'known' place, ie my menu is :

"commands" label - repeat checkbox - random checkbox - launch command - separator - "outputs" - output 1 checkbox - output 2 checkbox -... output X checkbox - separator

         xfce_panel_plugin_menu_insert_item(mpc->plugin,GTK_MENU_ITEM(chkitem));
         /* XXX HACK */
         menu = g_object_get_data (G_OBJECT (mpc->plugin), I_("xfce-panel-plugin-menu"));
         gtk_menu_reorder_child(GTK_MENU(menu),chkitem, 12 + i); /* 12 is after 'Outputs' menuitem */
         gtk_widget_show (chkitem);

with panel 4.7, menu is :

output 2 checkbox - output 1 checkbox -"outputs" - separator - launch command - random checkbox repeat checkbox - "commands' label - separator - separator

This is probably because in 4.6, insert_item() used gtk_menu_shell_insert, and in 4.7 it uses g_slist_prepend(). If i use g_slist_append() instead, things are back to previous behaviour.

according to the doc in
 http://library.gnome.org/devel/glib/unstable/glib-Singly-Linked-Lists.html#g-slist-prepend, apppend might not be the best choice, but at least mpc shows the items in the right order.

and btw, feature request for 4.9/4.10, make insert_item() take an optional position argument (or neighbour) and call g_slist_insert() so that i can choose where to insert my item and not resort to hacks :)
Comment 1 Nick Schermer editbugs 2011-01-23 12:49:26 CET
Fixed in 39c0258. Performance between append/prepend is not noticeable when there are only a couple of items. I don't see any need for a position argument here.

Bug #7102

Reported by:
Landry Breuil
Reported on: 2011-01-16
Last modified on: 2011-01-23

People

Assignee:
Nick Schermer
CC List:
0 users

Version

Version:
Unspecified

Attachments

Additional information