@@ -21,13 +21,15 @@ static bool no_footer;
21
21
static bool no_header ;
22
22
static bool pipemenu ;
23
23
static bool show_desktop_filename ;
24
+ static bool show_icons ;
24
25
static char * terminal_prefix ;
25
26
26
27
static const struct option long_options [] = {
27
28
{"bare" , no_argument , NULL , 'b' },
28
29
{"desktop" , no_argument , NULL , 'd' },
29
30
{"help" , no_argument , NULL , 'h' },
30
31
{"ignore" , required_argument , NULL , 'i' },
32
+ {"icons" , no_argument , NULL , 'I' },
31
33
{"no-duplicates" , no_argument , NULL , 'n' },
32
34
{"pipemenu" , no_argument , NULL , 'p' },
33
35
{"terminal-prefix" , required_argument , NULL , 't' },
@@ -40,6 +42,7 @@ static const char labwc_menu_generator_usage[] =
40
42
" -d, --desktop Add .desktop filename as a comment in the XML output\n"
41
43
" -h, --help Show help message and quit\n"
42
44
" -i, --ignore <file> Specify file listing .desktop files to ignore\n"
45
+ " -I, --icons Add icon=\"\" attribute\n"
43
46
" -n, --no-duplicates Limit desktop entries to one directory only\n"
44
47
" -p, --pipemenu Output in pipemenu format\n"
45
48
" -t, --terminal-prefix Specify prefix for Terminal=true entries\n" ;
@@ -86,9 +89,14 @@ print_app_to_buffer(struct app *app, GString *submenu)
86
89
exit (EXIT_FAILURE );
87
90
}
88
91
89
- g_string_append_printf (submenu ,
90
- " <item label=\"%s\" icon=\"%s\">\n" ,
91
- app -> name_localized ? app -> name_localized : app -> name , app -> icon );
92
+ g_string_append_printf (submenu , " <item label=\"%s\"" ,
93
+ app -> name_localized ? app -> name_localized : app -> name );
94
+ if (show_icons ) {
95
+ g_string_append_printf (submenu , " icon=\"%s\"" , app -> icon );
96
+ }
97
+ g_string_append_printf (submenu , ">\n" );
98
+
99
+
92
100
g_string_append_printf (submenu ,
93
101
" <action name=\"Execute\"><command>%s</command></action>\n" ,
94
102
command );
@@ -312,7 +320,7 @@ main(int argc, char **argv)
312
320
int c ;
313
321
while (1 ) {
314
322
int index = 0 ;
315
- c = getopt_long (argc , argv , "bdhi:npt :" , long_options , & index );
323
+ c = getopt_long (argc , argv , "bdhi:Inpt :" , long_options , & index );
316
324
if (c == -1 ) {
317
325
break ;
318
326
}
@@ -327,6 +335,9 @@ main(int argc, char **argv)
327
335
case 'i' :
328
336
ignore_init (optarg );
329
337
break ;
338
+ case 'I' :
339
+ show_icons = true;
340
+ break ;
330
341
case 'n' :
331
342
no_duplicates = true;
332
343
break ;
0 commit comments