@@ -20,9 +20,11 @@ static bool no_duplicates;
20
20
static bool no_footer ;
21
21
static bool no_header ;
22
22
static bool pipemenu ;
23
+ static bool show_desktop_filename ;
23
24
24
25
static const struct option long_options [] = {
25
26
{"bare" , no_argument , NULL , 'b' },
27
+ {"desktop" , no_argument , NULL , 'd' },
26
28
{"help" , no_argument , NULL , 'h' },
27
29
{"ignore" , required_argument , NULL , 'i' },
28
30
{"no-duplicates" , no_argument , NULL , 'n' },
@@ -33,6 +35,7 @@ static const struct option long_options[] = {
33
35
static const char labwc_menu_generator_usage [] =
34
36
"Usage: labwc-menu-generator [options...]\n"
35
37
" -b, --bare Show no header or footer\n"
38
+ " -d, --desktop Add .desktop filename as a comment in the XML output\n"
36
39
" -h, --help Show help message and quit\n"
37
40
" -i, --ignore <file> Specify file listing .desktop files to ignore\n"
38
41
" -n, --no-duplicates Limit desktop entries to one directory only\n"
@@ -62,6 +65,10 @@ ismatch(gchar **dir_categories, const char *app_categories)
62
65
static void
63
66
print_app_to_buffer (struct app * app , GString * submenu )
64
67
{
68
+ if (show_desktop_filename ) {
69
+ g_string_append_printf (submenu , " <!-- %s -->\n" , app -> filename );
70
+ }
71
+
65
72
/* TODO: handle app->terminal */
66
73
g_string_append_printf (submenu ,
67
74
" <item label=\"%s\" icon=\"%s\">\n" ,
@@ -287,7 +294,7 @@ main(int argc, char **argv)
287
294
int c ;
288
295
while (1 ) {
289
296
int index = 0 ;
290
- c = getopt_long (argc , argv , "bhi :np" , long_options , & index );
297
+ c = getopt_long (argc , argv , "bdhi :np" , long_options , & index );
291
298
if (c == -1 ) {
292
299
break ;
293
300
}
@@ -296,6 +303,9 @@ main(int argc, char **argv)
296
303
no_footer = true;
297
304
no_header = true;
298
305
break ;
306
+ case 'd' :
307
+ show_desktop_filename = true;
308
+ break ;
299
309
case 'i' :
300
310
ignore_init (optarg );
301
311
break ;
0 commit comments