summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-02-05 17:49:02 -0500
committerB Stack <bgstack15@gmail.com>2020-02-05 17:49:02 -0500
commitf088008e452f5d58d332d777df09a176855c198d (patch)
treef828ad210ea5afef4e8951540a4f504bcded7ab2
parentclang-format (diff)
downloadmktrayicon-f088008e452f5d58d332d777df09a176855c198d.tar.gz
mktrayicon-f088008e452f5d58d332d777df09a176855c198d.tar.bz2
mktrayicon-f088008e452f5d58d332d777df09a176855c198d.zip
accept "-----" as a separator in the menu spec
-rw-r--r--mktrayicon.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mktrayicon.c b/mktrayicon.c
index a0fed9a..fe235f4 100644
--- a/mktrayicon.c
+++ b/mktrayicon.c
@@ -395,10 +395,15 @@ outer:
// Now create the menu item widgets and attach them on the menu
for (int i = 0; i < menusize; i++) {
- GtkWidget *w = gtk_menu_item_new_with_label(onmenu[i].name);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
- g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(click_menu_item),
- NULL);
+ if (strncmp(onmenu[i].name, "-----", 5) == 0) {
+ GtkWidget *w = gtk_separator_menu_item_new() ;
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
+ } else {
+ GtkWidget *w = gtk_menu_item_new_with_label(onmenu[i].name);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), w);
+ g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(click_menu_item),
+ NULL);
+ }
}
gtk_widget_show_all(menu);
free(param);
bgstack15