]> Dogcows Code - chaz/openbox/commitdiff
use openbox/ dir for rc file and menu file. turn menu into a command line option...
authorDana Jansens <danakj@orodu.net>
Sat, 25 May 2002 02:24:30 +0000 (02:24 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 25 May 2002 02:24:30 +0000 (02:24 +0000)
22 files changed:
nls/C/main.m
nls/da_DK/main.m
nls/de_DE/main.m
nls/es_ES/main.m
nls/et_EE/main.m
nls/fr_FR/main.m
nls/hu_HU/main.m
nls/it_IT/main.m
nls/ja_JP/main.m
nls/nl_NL/main.m
nls/pt_BR/main.m
nls/ru_RU/main.m
nls/sl_SI/main.m
nls/sv_SE/main.m
nls/tr_TR/main.m
nls/uk_UA/main.m
nls/zh_CN/main.m
nls/zh_TW/main.m
src/Screen.cc
src/blackbox.cc
src/blackbox.hh
src/main.cc

index b8d2baf6ec3c3f9bacbbe010a5eab316f2d937d7..b6bb06788d366aef0fe43d9408b8cb91121414a9 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # error: '-rc' requires an argument\n
+$ #MENURequiresArg
+# error: '-menu' requires an argument\n
 $ #DISPLAYRequiresArg
 # error: '-display' requires an argument\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tuse display connection.\n\
   -rc <string>\t\t\tuse alternate resource file.\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\tdisplay version and exit.\n\
   -help\t\t\t\tdisplay this help text and exit.\n\n
 $ #CompileOptions
index 02be66e5b3e2a5f57da56c9d20881835449ee7f5..34a3e3951354fef8a5b2fcc269c89226ba0f08e6 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # fejl: '-rc' kræver et argument\n
+$ #MENURequiresArg
+# fejl: '-menu' kræver et argument\n
 $ #DISPLAYRequiresArg
 # fjel: '-display' kræver et argument\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tbrug skærm tilslutning.\n\
   -rc <string>\t\t\tbrug alternativ resource fil.\n\
+  -menu <string>\t\t\tbrug alternativ menu fil.\n\
   -version\t\t\tvis versionsnummer og afslut.\n\
   -help\t\t\t\tvis denne hjælp og afslut.\n\n
 $ #CompileOptions
index ac5a6ca2933081499b81ad1240e899146ba35072..1e028ea02fafb0cf6b99ef88bced461a2644b04a 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # Fehler: '-rc' benötigt einen Parameter\n
+$ #MENURequiresArg
+# Fehler: '-menu' benötigt einen Parameter\n
 $ #DISPLAYRequiresArg
 # Fehler: '-display' benötigt einen Parameter\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tDisplay Verbindung.\n\
   -rc <string>\t\t\talternative Konfigurationsdatei.\n\
+  -menu <string>\t\t\talternate menu file.\n\
   -version\t\t\tzeige Versionsnummer und Beendung.\n\
   -help\t\t\t\tzeige diesen Hilfstext und Beendung.\n\n
 $ #CompileOptions
index fe66cad6d39b3a062eefdb45608276c5d0f24e74..ee81f7db76fe65ac401de2972b824b4f5cef6143 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # error: '-rc' requiere un argumento
+$ #MENURequiresArg
+# error: '-menu' requiere un argumento
 $ #DISPLAYRequiresArg
 # error: '-display' requiere un argumento
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string> conexión de despliegue.\n\
   -rc <string>      archivo alternativo de recuros.\n\
+  -menu <string>    archivo alternativo de menu.\n\
   -version          mostrar la versión y cerrar.\n\
   -help             mostrar este texto de ayuda y cerrar.\n\n
 $ #CompileOptions
index d1c0280ad0db5b1226ee3c4e03eecae44e3ec20e..885b415f315af44a8f7a67921902e7cbafe72fd3 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # viga: '-rc' vajab argumenti\n
+$ #MENURequiresArg
+# viga: '-menu' vajab argumenti\n
 $ #DISPLAYRequiresArg
 # viga: '-display' vajab argumenti\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tkasuta displei ühendust.\n\
   -rc <string>\t\t\tkasuta alternatiivseid resursse.\n\
+  -menu <string>\t\t\tkasuta alternatiivseid menu.\n\
   -version\t\t\tnäita versiooninumber ja välju.\n\
   -help\t\t\t\tnäita seda abiteksti ja välju.\n\n
 $ #CompileOptions
index 2434afd6161e05a2b183f820346d8f1dded8883c..034f3578741497d8226c1c5bedeede5f38f7c6c6 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # Erreur: '-rc' nécessite un argument\n
+$ #MENURequiresArg
+# Erreur: '-menu' nécessite un argument\n
 $ #DISPLAYRequiresArg
 # Erreur: '-display' nécessite un argument\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000 Brad Hughes\n\n\
   -display <chaîne>\t\tutilise la connexion à l'affichage.\n\
   -rc <chaîne>\t\t\tutilise un autre fichier de configuration.\n\
+  -menu <chaîne>\t\t\tutilise un autre fichier de menu.\n\
   -version\t\t\taffiche la version et quitte.\n\
   -help\t\t\t\taffiche ce texte d'aide et quitte.\n\n
 $ #CompileOptions
index 912dabc9a96b1f41aace32a296c62c1f247cc344..79bc33d79655681bd828af26ce3141ad69aea1c5 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # Hiba: '-rc' kapcsoló paramétere hiányzik\n
+$ #MENURequiresArg
+# Hiba: '-menu' kapcsoló paramétere hiányzik\n
 $ #DISPLAYRequiresArg
 # Hiba: '-display' kapcsoló paramétere hiányzik\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000 Brad Hughes\n\n\
   -display <string>\t\thasználandó kijelzõ\n\
   -rc <string>\t\t\tválasztható konfigurációs file.\n\
+  -menu <string>\t\t\tválasztható menu file.\n\
   -version\t\t\tverziószám kijelzése és kilépés.\n\
   -help\t\t\t\tsúgóképernyõ mutatása és kilépés.\n\n
 $ #CompileOptions
index 4a5e1fbc28092682ff4913af110b61b06191c502..5ced55dfffac5c436afc243fb2e6977ecdc4668d 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # errore: '-rc' richiede un argomento\n
+$ #MENURequiresArg
+# errore: '-menu' richiede un argomento\n
 $ #DISPLAYRequiresArg
 # errore: '-display' richiede an argomento\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tusa connessione display.\n\
   -rc <string>\t\t\tusa un file risorsa alternativo.\n\
+  -menu <string>\t\t\tusa un file menu alternativo.\n\
   -version\t\t\tmostra la versione e esci.\n\
   -help\t\t\t\tmostra questo aiuto e esci.\n\n
 $ #CompileOptions
index f008aa22389617a03937c92bd00449101dd3b28e..ba016e67271b3ff20d2d73589d5fe917f8c4c5ff 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # ¥¨¥é¡¼: '-rc' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òɬÍפȤ·¤Þ¤¹\n
+$ #MENURequiresArg
+# ¥¨¥é¡¼: '-menu' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òɬÍפȤ·¤Þ¤¹\n
 $ #DISPLAYRequiresArg
 # ¥¨¥é¡¼: '-display' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òɬÍפȤ·¤Þ¤¹\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\t»ØÄê¥Ç¥£¥¹¥×¥ì¥¤¤ËÀܳ\n\
   -rc <string>\t\t\tÂå¤ê¤Î¥ê¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò»ÈÍÑ\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\t¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɽ¼¨¤·¡¢½ªÎ»\n\
   -help\t\t\t\t¤³¤Î¥Ø¥ë¥×¤òɽ¼¨¤·¡¢½ªÎ»\n\n
 $ #CompileOptions
index 4cb5beecf9dff0a9803e47c4844c08e52fc46d10..64d7b64e897c6a44452b352e15eec098df615297 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # fout: '-rc' heeft een argument nodig (bestandsnaam)\n
+$ #MENURequiresArg
+# fout: '-menu' heeft een argument nodig (bestandsnaam)\n
 $ #DISPLAYRequiresArg
 # fout: '-display' heeft een argument nodig (displaynaam)\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <displaynaam>   gebruik aangegeven display.\n\
   -rc <bestandsnaam>       gebruik alternatief resource bestand.\n\
+  -menu <bestandsnaam>     gebruik alternatief menu bestand.\n\
   -version                 toon versie en stop.\n\
   -help                    toon deze hulp tekst en stop.\n\n
 $ #CompileOptions
index 5b3c3bb48c8b50625ab4f63ebd664b94ceda1b76..5b7347c8a43fe614e61bf44ed3c50d9926e6b801 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # erro: '-rc' requer um argumento\n
+$ #MENURequiresArg
+# erro: '-menu' requer um argumento\n
 $ #DISPLAYRequiresArg
 # erro: '-display' requer um argumento\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tusar conexão com o display.\n\
   -rc <string>\t\t\tusar arquivo alternativo de recursos.\n\
+  -menu <string>\t\t\tusar arquivo alternativo de menu.\n\
   -version\t\t\tmostrar versao e sair.\n\
   -help\t\t\t\tmostrar esta ajuda e sair.\n\n
 $ #CompileOptions
index f3f9431898eb9b5831e73aa91a024bf25a29cc29..3df8e09865b65bf015b0541b2fc1b9160a9675cf 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # ÏÛÉÂËÁ: '-rc' ÔÒÅÂÕÅÔ ÎÁÌÉÞÉÅ ÁÒÇÕÍÅÎÔÁ\n
+$ #MENURequiresArg
+# ÏÛÉÂËÁ: '-menu' ÔÒÅÂÕÅÔ ÎÁÌÉÞÉÅ ÁÒÇÕÍÅÎÔÁ\n
 $ #DISPLAYRequiresArg
 # ÏÛÉÂËÁ: '-display' ÔÒÅÂÕÅÔ ÎÁÌÉÞÉÅ ÁÒÇÕÍÅÎÔÁ\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000 Brad Hughes\n\n\
   -display <string>\t\tÉÓÐÏÌØÚÏ×ÁÔØ ÚÁÄÁÎÎÙÊ ÄÉÓÐÌÅÊ.\n\
   -rc <string>\t\t\tÉÓÐÏÌØÚÏ×ÁÔØ ÁÌØÔÅÒÎÁÔÉ×ÎÙÊ ÆÁÊÌ ÒÅÓÕÒÓÏ×.\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\t×Ù×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓÉÉ É ×ÙÊÔÉ.\n\
   -help\t\t\t\t×Ù×ÅÓÔÉ ÜÔÕ ÐÏÄÓËÁÚËÕ É ×ÙÊÔÉ.\n\n
 $ #CompileOptions
index 8e369222f38c1a71bb89765a60b3e66a3914a108..0bb36fcad3bc4aeab02e4211cc105b2806e3b10d 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # napaka: '-rc' zahteva argument\n
+$ #MENURequiresArg
+# napaka: '-menu' zahteva argument\n
 $ #DISPLAYRequiresArg
 # napaka: '-display' zahteva argument\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tuporabi prikazovalnik.\n\
   -rc <string>\t\t\tuporabi nadomestno datoteko z viri.\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\tprika¾i oznako razlièice in konèaj.\n\
   -help\t\t\t\prika¾i ta navodila in konèaj.\n\n
 $ #CompileOptions
index a4d502338e4ca92e564fe8d2d20ba6774803ad50..573d3d7336b622cd823f0b807ef038e7458294fd 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # fel: '-rc' kräver ett argument\n
+$ #MENURequiresArg
+# fel: '-menu' kräver ett argument\n
 $ #DISPLAYRequiresArg
 # fel: '-display' kräver ett argument\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tanvänd skärmanslutning.\n\
   -rc <string>\t\t\tanvänd alternativ resursfil.\n\
+  -menu <string>\t\t\tanvänd alternativ menufil.\n\
   -version\t\t\tvisa version och avsluta.\n\
   -help\t\t\t\tvisa denna hjälptext och avsluta.\n\n
 $ #CompileOptions
index bdc25606088e4c755a94bd7217aa800923356efe..ca348b61b33e67b0f6407e106fbec43420f30129 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # hata : '-rc' bir argüman bekler\n
+$ #MENURequiresArg
+# hata : '-menu' bir argüman bekler\n
 $ #DISPLAYRequiresArg
 # hata : '-display' bir argüman bekler\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <metin>\t\tekraný kullan.\n\
   -rc <metin>\t\t\tbaþka bir ayarlama dosyasýný kullan.\n\
+  -menu <metin>\t\t\tuse alternate menu file.\n\
   -version\t\t\tnesil bilgisini gösterir ve çýkar.\n\
   -help\t\t\t\tbu yardým iletisini gösterir ve çýkar.\n\n
 $ #CompileOptions
index a5e4bb41dfa7ed291f873d9418c116d3252c3a59..53bc789cd0ffc886e84a06d3fe28b44bb4f5ede4 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # ÐÏÍÉÌËÁ: "-rc" ×ÉÍÁÇÁ¤ ÁÒÇÕÍÅÎÔ\n
+$ #MENURequiresArg
+# ÐÏÍÉÌËÁ: "-menu" ×ÉÍÁÇÁ¤ ÁÒÇÕÍÅÎÔ\n
 $ #DISPLAYRequiresArg
 # ÐÏÍÉÌËÁ: "-display" ×ÉÍÁÇÁ¤ ÁÒÇÕÍÅÎÔ\n
 $ #WarnDisplaySet
@@ -10,6 +12,7 @@ $ #Usage
 # Blackbox %s: (c) 1997 - 2000 Brad Hughes\n\n\
   -display <string>\t\tÏÂÓÌÕÇÏ×Õ×ÁÔÉ ×ËÁÚÁÎÉÊ ÄÉÓÐÌÅÊ.\n\
   -rc <string>\t\t\t×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ ÁÌØÔÅÒÎÁÔÉ×ÎÉÊ ÆÁÊÌ ÒÅÓÕÒÓ¦×.\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\t×É×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓ¦§ ¦ ×ÉÊÔÉ.\n\
   -help\t\t\t\t×É×ÅÓÔÉ ÃÀ Ð¦ÄËÁÚËÕ ¦ ×ÉÊÔÉ.\n\n
 $ #CompileOptions
@@ -17,5 +20,4 @@ $ #CompileOptions
   Debugging\t\t\t%s\n\
   Interlacing:\t\t\t%s\n\
   Shape:\t\t\t%s\n\
-  Slit:\t\t\t\t%s\n\
   8bpp Ordered Dithering:\t%s\n\n
index 266d3547386decc28e369588d65c0e8be33630ab..6e0310f3f0d22a8a9106510f3c7d7e149a75fb4c 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # ´íÎó: '-rc' ÐèÒª²ÎÊý\n
+$ #MENURequiresArg
+# ´íÎó: '-menu' ÐèÒª²ÎÊý\n
 $ #DISPLAYRequiresArg
 # ´íÎó: '-display' ÐèÒª²ÎÊý\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tʹÓÃÏÔʾÁ¬½Ó.\n\
   -rc <string>\t\t\tʹÓÃÆäËûµÄ×ÊÔ´Îļþ.\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\tÏÔʾ°æ±¾.\n\
   -help\t\t\t\tÏÔʾÕâ¸ö°ïÖú.\n\n
 $ #CompileOptions
index b8d2baf6ec3c3f9bacbbe010a5eab316f2d937d7..b6bb06788d366aef0fe43d9408b8cb91121414a9 100644 (file)
@@ -2,6 +2,8 @@ $set 14 #main
 
 $ #RCRequiresArg
 # error: '-rc' requires an argument\n
+$ #MENURequiresArg
+# error: '-menu' requires an argument\n
 $ #DISPLAYRequiresArg
 # error: '-display' requires an argument\n
 $ #WarnDisplaySet
@@ -11,6 +13,7 @@ $ #Usage
   \t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
   -display <string>\t\tuse display connection.\n\
   -rc <string>\t\t\tuse alternate resource file.\n\
+  -menu <string>\t\t\tuse alternate menu file.\n\
   -version\t\t\tdisplay version and exit.\n\
   -help\t\t\t\tdisplay this help text and exit.\n\n
 $ #CompileOptions
index 2844d874eb8bf1e29c289d776ef51b4d47c85541..f793c91e1adcde78f8558c438ad4c0ba6e721f9d 100644 (file)
@@ -1118,56 +1118,64 @@ void BScreen::InitMenu(void) {
   }
   bool defaultMenu = True;
 
-  if (blackbox->getMenuFilename()) {
-    FILE *menu_file = fopen(blackbox->getMenuFilename(), "r");
-
-    if (!menu_file) {
-      perror(blackbox->getMenuFilename());
+  FILE *menu_file = (FILE *) 0;
+  const char *menu_filename = blackbox->getMenuFilename();
+
+  if (menu_filename) 
+    if (!(menu_file = fopen(menu_filename, "r")))
+      perror(menu_filename);
+  if (!menu_file) {     // opening the menu file failed, try the default menu
+    menu_filename = DEFAULTMENU;
+    if (!(menu_file = fopen(menu_filename, "r")))
+      perror(menu_filename);
+  } 
+
+  if (menu_file) {
+    if (feof(menu_file)) {
+      fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile,
+                           "%s: Empty menu file"),
+              menu_filename);
     } else {
-      if (feof(menu_file)) {
-        fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile,
-                             "%s: Empty menu file"),
-                blackbox->getMenuFilename());
-      } else {
-        char line[1024], label[1024];
-        memset(line, 0, 1024);
-        memset(label, 0, 1024);
-
-        while (fgets(line, 1024, menu_file) && ! feof(menu_file)) {
-          if (line[0] != '#') {
-            int i, key = 0, index = -1, len = strlen(line);
-
-            for (i = 0; i < len; i++) {
-              if (line[i] == '[') index = 0;
-              else if (line[i] == ']') break;
-              else if (line[i] != ' ')
-                if (index++ >= 0)
-                  key += tolower(line[i]);
-            }
+      char line[1024], label[1024];
+      memset(line, 0, 1024);
+      memset(label, 0, 1024);
+
+      while (fgets(line, 1024, menu_file) && ! feof(menu_file)) {
+        if (line[0] != '#') {
+          int i, key = 0, index = -1, len = strlen(line);
+
+          for (i = 0; i < len; i++) {
+            if (line[i] == '[') index = 0;
+            else if (line[i] == ']') break;
+            else if (line[i] != ' ')
+              if (index++ >= 0)
+                key += tolower(line[i]);
+          }
 
-            if (key == 517) { // [begin]
-              index = -1;
-              for (i = index; i < len; i++) {
-                if (line[i] == '(') index = 0;
-                else if (line[i] == ')') break;
-                else if (index++ >= 0) {
-                  if (line[i] == '\\' && i < len - 1) i++;
-                  label[index - 1] = line[i];
-                }
+          if (key == 517) { // [begin]
+            index = -1;
+            for (i = index; i < len; i++) {
+              if (line[i] == '(') index = 0;
+              else if (line[i] == ')') break;
+              else if (index++ >= 0) {
+                if (line[i] == '\\' && i < len - 1) i++;
+                label[index - 1] = line[i];
               }
+            }
 
-              if (index == -1) index = 0;
-              label[index] = '\0';
+            if (index == -1) index = 0;
+            label[index] = '\0';
 
-              rootmenu->setLabel(label);
-              defaultMenu = parseMenuFile(menu_file, rootmenu);
-              break;
-            }
+            rootmenu->setLabel(label);
+            defaultMenu = parseMenuFile(menu_file, rootmenu);
+            if (!defaultMenu)
+              blackbox->addMenuTimestamp(menu_filename);
+            break;
           }
         }
       }
-      fclose(menu_file);
     }
+    fclose(menu_file);
   }
 
   if (defaultMenu) {
@@ -1180,9 +1188,7 @@ void BScreen::InitMenu(void) {
     rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"),
                      BScreen::Exit);
     rootmenu->setLabel(i18n(BasemenuSet, BasemenuBlackboxMenu,
-                            "Blackbox Menu"));
-  } else {
-    blackbox->saveMenuFilename(blackbox->getMenuFilename());
+                            "Openbox Menu"));
   }
 }
 
@@ -1339,7 +1345,7 @@ bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
 
               if (! feof(submenufile)) {
                 if (! parseMenuFile(submenufile, menu))
-                  blackbox->saveMenuFilename(newfile);
+                  blackbox->addMenuTimestamp(newfile);
 
                 fclose(submenufile);
               }
@@ -1470,7 +1476,7 @@ bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
                   rootmenuList.push_back(stylesmenu);
                 }
 
-                blackbox->saveMenuFilename(stylesdir);
+                blackbox->addMenuTimestamp(stylesdir);
               } else {
                 fprintf(stderr,
                         i18n(ScreenSet, ScreenSTYLESDIRErrorNotDir,
index 4325933beb8e3e7c695f8f73e008e4c148e97c37..bca48e5d405027a3dbdaa173f73d2e23e9318f73 100644 (file)
@@ -134,7 +134,7 @@ static Bool queueScanner(Display *, XEvent *e, char *args) {
 Blackbox *blackbox;
 
 
-Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc)
+Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
   : BaseDisplay(m_argv[0], dpy_name) {
   if (! XSupportsLocale())
     fprintf(stderr, "X server does not support locale\n");
@@ -144,8 +144,10 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc)
 
   ::blackbox = this;
   argv = m_argv;
-  if (! rc) rc = "~/.blackboxrc";
+  if (! rc) rc = "~/.openbox/rc";
   rc_file = expandTilde(rc);
+  if (! menu) menu = "~/.openbox/menu";
+  menu_file = expandTilde(menu);
 
   no_focus = False;
 
@@ -978,9 +980,6 @@ void Blackbox::save_rc(void) {
 
   load_rc();
 
-  sprintf(rc_string, "session.menuFile:  %s", getMenuFilename());
-  XrmPutLineResource(&new_blackboxrc, rc_string);
-
   sprintf(rc_string, "session.colorsPerChannel:  %d",
           resource.colors_per_channel);
   XrmPutLineResource(&new_blackboxrc, rc_string);
@@ -1186,13 +1185,6 @@ void Blackbox::load_rc(void) {
   int int_value;
   unsigned long long_value;
 
-  if (XrmGetResource(database, "session.menuFile", "Session.MenuFile",
-                     &value_type, &value)) {
-    resource.menu_file = expandTilde(value.addr);
-  } else {
-    resource.menu_file = DEFAULTMENU;
-  }
-
   resource.colors_per_channel = 4;
   if (XrmGetResource(database, "session.colorsPerChannel",
                      "Session.ColorsPerChannel", &value_type, &value) &&
@@ -1595,7 +1587,7 @@ void Blackbox::saveStyleFilename(const string& filename) {
 }
 
 
-void Blackbox::saveMenuFilename(const string& filename) {
+void Blackbox::addMenuTimestamp(const string& filename) {
   assert(! filename.empty());
   bool found = False;
 
index b494039c1c4d41075f13a93ddc43b68695c8f293..0545bcc870495280110ccd5c2b15d64398457011 100644 (file)
@@ -109,7 +109,7 @@ private:
   struct BResource {
     Time double_click_interval;
 
-    std::string menu_file, style_file;
+    std::string style_file;
     int colors_per_channel;
     timeval auto_raise_delay;
     unsigned long cache_life, cache_max;
@@ -148,7 +148,7 @@ private:
   bool no_focus, reconfigure_wait, reread_menu_wait;
   Time last_time;
   char **argv;
-  std::string rc_file;
+  std::string menu_file, rc_file;
 
   Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state,
     xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state,
@@ -205,7 +205,7 @@ private:
 
 
 public:
-  Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0);
+  Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0, char *menu = 0);
   virtual ~Blackbox(void);
 
   Basemenu *searchMenu(Window window);
@@ -235,7 +235,7 @@ public:
   inline const char *getStyleFilename(void) const
     { return resource.style_file.c_str(); }
   inline const char *getMenuFilename(void) const
-    { return resource.menu_file.c_str(); }
+    { return menu_file.c_str(); }
 
   inline int getColorsPerChannel(void) const
     { return resource.colors_per_channel; }
@@ -263,7 +263,7 @@ public:
   void shutdown(void);
   void load_rc(BScreen *screen);
   void saveStyleFilename(const std::string& filename);
-  void saveMenuFilename(const std::string& filename);
+  void addMenuTimestamp(const std::string& filename);
   void restart(const char *prog = 0);
   void reconfigure(void);
   void rereadMenu(void);
index 370e6ecd79382abf94d16e6ff646fce24eca7f68..e213c8085b87cc9cf460a7ddae41218a358b5505 100644 (file)
@@ -65,6 +65,7 @@ static void showHelp(int exitval) {
               "\t\t\t  1997 - 2000, 2002 Brad Hughes\n\n"
               "  -display <string>\t\tuse display connection.\n"
               "  -rc <string>\t\t\tuse alternate resource file.\n"
+              "  -menu <string>\t\t\tuse alternate menu file.\n"
               "  -version\t\t\tdisplay version and exit.\n"
               "  -help\t\t\t\tdisplay this help text and exit.\n\n"),
          __openbox_version);
@@ -101,6 +102,7 @@ static void showHelp(int exitval) {
 int main(int argc, char **argv) {
   char *session_display = (char *) 0;
   char *rc_file = (char *) 0;
+  char *menu_file = (char *) 0;
 
   i18n.openCatalog("blackbox.cat");
 
@@ -117,6 +119,18 @@ int main(int argc, char **argv) {
       }
 
       rc_file = argv[i];
+    } else if (! strcmp(argv[i], "-menu")) {
+      // look for alternative menu file to use
+
+      if ((++i) >= argc) {
+        fprintf(stderr,
+                i18n(mainSet, mainMENURequiresArg,
+                     "error: '-menu' requires and argument\n"));
+
+        ::exit(1);
+      }
+
+      menu_file = argv[i];
     } else if (! strcmp(argv[i], "-display")) {
       // check for -display option... to run on a display other than the one
       // set by the environment variable DISPLAY
@@ -156,7 +170,7 @@ int main(int argc, char **argv) {
   _chdir2(getenv("X11ROOT"));
 #endif // __EMX__
 
-  Blackbox blackbox(argv, session_display, rc_file);
+  Blackbox blackbox(argv, session_display, rc_file, menu_file);
   blackbox.eventLoop();
 
   return(0);
This page took 0.046937 seconds and 4 git commands to generate.