|
16 | 16 | #include "schema.h" |
17 | 17 |
|
18 | 18 | static bool no_duplicates; |
| 19 | +static bool no_footer; |
| 20 | +static bool no_header; |
19 | 21 |
|
20 | 22 | static const char labwc_menu_generator_usage[] = |
21 | 23 | "Usage: labwc-menu-generator [options...]\n" |
@@ -133,9 +135,11 @@ print_menu(GList *dirs, GList *apps) |
133 | 135 | { |
134 | 136 | GString *submenu = g_string_new(NULL); |
135 | 137 |
|
136 | | - printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); |
137 | | - printf("<openbox_menu>\n"); |
138 | | - printf("<menu id=\"root-menu\" label=\"root-menu\">\n"); |
| 138 | + if (!no_header) { |
| 139 | + printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); |
| 140 | + printf("<openbox_menu>\n"); |
| 141 | + printf("<menu id=\"root-menu\" label=\"root-menu\">\n"); |
| 142 | + } |
139 | 143 |
|
140 | 144 | /* Handle all directories except 'Other' */ |
141 | 145 | GList *iter; |
@@ -173,8 +177,10 @@ print_menu(GList *dirs, GList *apps) |
173 | 177 | printf("\t</menu> <!-- %s -->\n", dir->name); |
174 | 178 | } |
175 | 179 |
|
176 | | - printf("</menu> <!-- root-menu -->\n"); |
177 | | - printf("</openbox_menu>\n"); |
| 180 | + if (!no_footer) { |
| 181 | + printf("</menu> <!-- root-menu -->\n"); |
| 182 | + printf("</openbox_menu>\n"); |
| 183 | + } |
178 | 184 |
|
179 | 185 | g_string_free(submenu, TRUE); |
180 | 186 | } |
|
257 | 263 | main(int argc, char **argv) |
258 | 264 | { |
259 | 265 | int c; |
260 | | - while ((c = getopt(argc, argv, "hn")) != -1) { |
| 266 | + while ((c = getopt(argc, argv, "bhn")) != -1) { |
261 | 267 | switch (c) { |
| 268 | + case 'b': |
| 269 | + no_footer = true; |
| 270 | + no_header = true; |
| 271 | + break; |
262 | 272 | case 'n': |
263 | 273 | no_duplicates = false; |
264 | 274 | break; |
|
0 commit comments