summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/menu.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
commitdf247efec654e512242e4f4f1b0212034f9e01fe (patch)
tree25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/wlib/gtklib/menu.c
parentd0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff)
parenta5ade52caa489cf0a713e0f02b764000d203140e (diff)
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterHEADdebian/1%5.2.0Beta2.1-1master
Diffstat (limited to 'app/wlib/gtklib/menu.c')
-rw-r--r--app/wlib/gtklib/menu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/wlib/gtklib/menu.c b/app/wlib/gtklib/menu.c
index d19805a..79695d4 100644
--- a/app/wlib/gtklib/menu.c
+++ b/app/wlib/gtklib/menu.c
@@ -555,7 +555,7 @@ wMenuList_p wMenuListCreate(
* behind it. In case the maximum number of items is reached the last item is removed.
*
* \param ml IN handle for the menu list - the placeholder item
- * \param index IN currently ignored
+ * \param index IN position of new menu item
* \param labelStr IN the menu label for the new item
* \param data IN application data for the new item
* \return
@@ -611,7 +611,11 @@ void wMenuListAdd(
g_object_set_data( G_OBJECT(MMENUITEM( mi )), WLISTITEM, mi );
// add the item to the menu
- gtk_menu_shell_insert((GtkMenuShell *)(MPARENT( ml )->menu), MMENUITEM( mi ), i + 1 );
+ if ( index < 0 )
+ index = 0;
+ if ( index >= ml->count )
+ index = ml->count - 1;
+ gtk_menu_shell_insert((GtkMenuShell *)(MPARENT( ml )->menu), MMENUITEM( mi ), i + index + 1 );
g_signal_connect( GTK_OBJECT(MMENUITEM( mi )), "activate", G_CALLBACK(pushMenuList), mi );
gtk_widget_show(MMENUITEM( mi ));