From: Dana Jansens Date: Sat, 25 May 2002 02:24:30 +0000 (+0000) Subject: use openbox/ dir for rc file and menu file. turn menu into a command line option... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=b3737edc7cc7d1ebc52ec204dcaa71d9cb859c5a;p=chaz%2Fopenbox use openbox/ dir for rc file and menu file. turn menu into a command line option instead of an rc file option --- diff --git a/nls/C/main.m b/nls/C/main.m index b8d2baf6..b6bb0678 100644 --- a/nls/C/main.m +++ b/nls/C/main.m @@ -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 \t\tuse display connection.\n\ -rc \t\t\tuse alternate resource file.\n\ + -menu \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 diff --git a/nls/da_DK/main.m b/nls/da_DK/main.m index 02be66e5..34a3e395 100644 --- a/nls/da_DK/main.m +++ b/nls/da_DK/main.m @@ -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 \t\tbrug skærm tilslutning.\n\ -rc \t\t\tbrug alternativ resource fil.\n\ + -menu \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 diff --git a/nls/de_DE/main.m b/nls/de_DE/main.m index ac5a6ca2..1e028ea0 100644 --- a/nls/de_DE/main.m +++ b/nls/de_DE/main.m @@ -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 \t\tDisplay Verbindung.\n\ -rc \t\t\talternative Konfigurationsdatei.\n\ + -menu \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 diff --git a/nls/es_ES/main.m b/nls/es_ES/main.m index fe66cad6..ee81f7db 100644 --- a/nls/es_ES/main.m +++ b/nls/es_ES/main.m @@ -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 conexión de despliegue.\n\ -rc archivo alternativo de recuros.\n\ + -menu archivo alternativo de menu.\n\ -version mostrar la versión y cerrar.\n\ -help mostrar este texto de ayuda y cerrar.\n\n $ #CompileOptions diff --git a/nls/et_EE/main.m b/nls/et_EE/main.m index d1c0280a..885b415f 100644 --- a/nls/et_EE/main.m +++ b/nls/et_EE/main.m @@ -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 \t\tkasuta displei ühendust.\n\ -rc \t\t\tkasuta alternatiivseid resursse.\n\ + -menu \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 diff --git a/nls/fr_FR/main.m b/nls/fr_FR/main.m index 2434afd6..034f3578 100644 --- a/nls/fr_FR/main.m +++ b/nls/fr_FR/main.m @@ -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 \t\tutilise la connexion à l'affichage.\n\ -rc \t\t\tutilise un autre fichier de configuration.\n\ + -menu \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 diff --git a/nls/hu_HU/main.m b/nls/hu_HU/main.m index 912dabc9..79bc33d7 100644 --- a/nls/hu_HU/main.m +++ b/nls/hu_HU/main.m @@ -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 \t\thasználandó kijelzõ\n\ -rc \t\t\tválasztható konfigurációs file.\n\ + -menu \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 diff --git a/nls/it_IT/main.m b/nls/it_IT/main.m index 4a5e1fbc..5ced55df 100644 --- a/nls/it_IT/main.m +++ b/nls/it_IT/main.m @@ -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 \t\tusa connessione display.\n\ -rc \t\t\tusa un file risorsa alternativo.\n\ + -menu \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 diff --git a/nls/ja_JP/main.m b/nls/ja_JP/main.m index f008aa22..ba016e67 100644 --- a/nls/ja_JP/main.m +++ b/nls/ja_JP/main.m @@ -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 \t\t»ØÄê¥Ç¥£¥¹¥×¥ì¥¤¤ËÀܳ\n\ -rc \t\t\tÂå¤ê¤Î¥ê¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò»ÈÍÑ\n\ + -menu \t\t\tuse alternate menu file.\n\ -version\t\t\t¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɽ¼¨¤·¡¢½ªÎ»\n\ -help\t\t\t\t¤³¤Î¥Ø¥ë¥×¤òɽ¼¨¤·¡¢½ªÎ»\n\n $ #CompileOptions diff --git a/nls/nl_NL/main.m b/nls/nl_NL/main.m index 4cb5beec..64d7b64e 100644 --- a/nls/nl_NL/main.m +++ b/nls/nl_NL/main.m @@ -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 gebruik aangegeven display.\n\ -rc gebruik alternatief resource bestand.\n\ + -menu gebruik alternatief menu bestand.\n\ -version toon versie en stop.\n\ -help toon deze hulp tekst en stop.\n\n $ #CompileOptions diff --git a/nls/pt_BR/main.m b/nls/pt_BR/main.m index 5b3c3bb4..5b7347c8 100644 --- a/nls/pt_BR/main.m +++ b/nls/pt_BR/main.m @@ -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 \t\tusar conexão com o display.\n\ -rc \t\t\tusar arquivo alternativo de recursos.\n\ + -menu \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 diff --git a/nls/ru_RU/main.m b/nls/ru_RU/main.m index f3f94318..3df8e098 100644 --- a/nls/ru_RU/main.m +++ b/nls/ru_RU/main.m @@ -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 \t\tÉÓÐÏÌØÚÏ×ÁÔØ ÚÁÄÁÎÎÙÊ ÄÉÓÐÌÅÊ.\n\ -rc \t\t\tÉÓÐÏÌØÚÏ×ÁÔØ ÁÌØÔÅÒÎÁÔÉ×ÎÙÊ ÆÁÊÌ ÒÅÓÕÒÓÏ×.\n\ + -menu \t\t\tuse alternate menu file.\n\ -version\t\t\t×Ù×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓÉÉ É ×ÙÊÔÉ.\n\ -help\t\t\t\t×Ù×ÅÓÔÉ ÜÔÕ ÐÏÄÓËÁÚËÕ É ×ÙÊÔÉ.\n\n $ #CompileOptions diff --git a/nls/sl_SI/main.m b/nls/sl_SI/main.m index 8e369222..0bb36fca 100644 --- a/nls/sl_SI/main.m +++ b/nls/sl_SI/main.m @@ -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 \t\tuporabi prikazovalnik.\n\ -rc \t\t\tuporabi nadomestno datoteko z viri.\n\ + -menu \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 diff --git a/nls/sv_SE/main.m b/nls/sv_SE/main.m index a4d50233..573d3d73 100644 --- a/nls/sv_SE/main.m +++ b/nls/sv_SE/main.m @@ -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 \t\tanvänd skärmanslutning.\n\ -rc \t\t\tanvänd alternativ resursfil.\n\ + -menu \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 diff --git a/nls/tr_TR/main.m b/nls/tr_TR/main.m index bdc25606..ca348b61 100644 --- a/nls/tr_TR/main.m +++ b/nls/tr_TR/main.m @@ -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 \t\tekraný kullan.\n\ -rc \t\t\tbaþka bir ayarlama dosyasýný kullan.\n\ + -menu \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 diff --git a/nls/uk_UA/main.m b/nls/uk_UA/main.m index a5e4bb41..53bc789c 100644 --- a/nls/uk_UA/main.m +++ b/nls/uk_UA/main.m @@ -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 \t\tÏÂÓÌÕÇÏ×Õ×ÁÔÉ ×ËÁÚÁÎÉÊ ÄÉÓÐÌÅÊ.\n\ -rc \t\t\t×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ ÁÌØÔÅÒÎÁÔÉ×ÎÉÊ ÆÁÊÌ ÒÅÓÕÒÓ¦×.\n\ + -menu \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 diff --git a/nls/zh_CN/main.m b/nls/zh_CN/main.m index 266d3547..6e0310f3 100644 --- a/nls/zh_CN/main.m +++ b/nls/zh_CN/main.m @@ -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 \t\tʹÓÃÏÔʾÁ¬½Ó.\n\ -rc \t\t\tʹÓÃÆäËûµÄ×ÊÔ´Îļþ.\n\ + -menu \t\t\tuse alternate menu file.\n\ -version\t\t\tÏÔʾ°æ±¾.\n\ -help\t\t\t\tÏÔʾÕâ¸ö°ïÖú.\n\n $ #CompileOptions diff --git a/nls/zh_TW/main.m b/nls/zh_TW/main.m index b8d2baf6..b6bb0678 100644 --- a/nls/zh_TW/main.m +++ b/nls/zh_TW/main.m @@ -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 \t\tuse display connection.\n\ -rc \t\t\tuse alternate resource file.\n\ + -menu \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 diff --git a/src/Screen.cc b/src/Screen.cc index 2844d874..f793c91e 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -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, diff --git a/src/blackbox.cc b/src/blackbox.cc index 4325933b..bca48e5d 100644 --- a/src/blackbox.cc +++ b/src/blackbox.cc @@ -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; diff --git a/src/blackbox.hh b/src/blackbox.hh index b494039c..0545bcc8 100644 --- a/src/blackbox.hh +++ b/src/blackbox.hh @@ -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); diff --git a/src/main.cc b/src/main.cc index 370e6ecd..e213c808 100644 --- a/src/main.cc +++ b/src/main.cc @@ -65,6 +65,7 @@ static void showHelp(int exitval) { "\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n" " -display \t\tuse display connection.\n" " -rc \t\t\tuse alternate resource file.\n" + " -menu \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);