aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-06-07 11:46:05 (GMT)
committerrathnor <rathnor>2004-06-07 11:46:05 (GMT)
commitfff4456dee29e675d7f2ed3490db39bcb7e10e53 (patch)
tree2d2dbf386551773cbdc8231b2a93b493187bd733 /src/fluxbox.cc
parent073065ac56b388db1169108d44f37d32f1d19c67 (diff)
downloadfluxbox_pavel-fff4456dee29e675d7f2ed3490db39bcb7e10e53.zip
fluxbox_pavel-fff4456dee29e675d7f2ed3490db39bcb7e10e53.tar.bz2
update NLS string handling...
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc73
1 files changed, 35 insertions, 38 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 9f0f24e..c26145c 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,11 +22,10 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.242 2004/05/02 20:48:16 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.243 2004/06/07 11:46:04 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
29#include "I18n.hh"
30#include "Screen.hh" 29#include "Screen.hh"
31#include "Window.hh" 30#include "Window.hh"
32#include "Workspace.hh" 31#include "Workspace.hh"
@@ -37,6 +36,7 @@
37#include "FbAtoms.hh" 36#include "FbAtoms.hh"
38#include "defaults.hh" 37#include "defaults.hh"
39 38
39#include "FbTk/I18n.hh"
40#include "FbTk/Image.hh" 40#include "FbTk/Image.hh"
41#include "FbTk/KeyUtil.hh" 41#include "FbTk/KeyUtil.hh"
42#include "FbTk/ImageControl.hh" 42#include "FbTk/ImageControl.hh"
@@ -432,14 +432,14 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
432 m_RC_PATH("fluxbox"), 432 m_RC_PATH("fluxbox"),
433 m_RC_INIT_FILE("init") { 433 m_RC_INIT_FILE("init") {
434 434
435 435 _FB_USES_NLS;
436 if (s_singleton != 0) 436 if (s_singleton != 0)
437 throw string("Fatal! There can only one instance of fluxbox class."); 437 throw string(_FBTEXT(Fluxbox, FatalSingleton, "Fatal! There can only one instance of fluxbox class.", "Error displayed on weird error where an instance of the Fluxbox class already exists!"));
438 438
439 if (display() == 0) { 439 if (display() == 0) {
440 //!! TODO: NLS 440 throw string(_FBTEXT(Fluxbox, NoDisplay,
441 throw string("Can not connect to X server.\n" 441 "Can not connect to X server.\nMake sure you started X before you start Fluxbox.",
442 "Make sure you started X before you start Fluxbox."); 442 "Error message when no X display appears to exist"));
443 } 443 }
444 // For KDE dock applets 444 // For KDE dock applets
445 // KDE v1.x 445 // KDE v1.x
@@ -513,10 +513,10 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
513 setupConfigFiles(); 513 setupConfigFiles();
514 514
515 if (! XSupportsLocale()) 515 if (! XSupportsLocale())
516 cerr<<"Warning: X server does not support locale"<<endl; 516 cerr<<_FBTEXT(Fluxbox, WarningLocale, "Warning: X server does not support locale", "XSupportsLocale returned false")<<endl;
517 517
518 if (XSetLocaleModifiers("") == 0) 518 if (XSetLocaleModifiers("") == 0)
519 cerr<<"Warning: cannot set locale modifiers"<<endl; 519 cerr<<_FBTEXT(Fluxbox, WarningLocaleModifiers, "Warning: cannot set locale modifiers", "XSetLocaleModifiers returned false")<<endl;
520 520
521 521
522#ifdef HAVE_GETPID 522#ifdef HAVE_GETPID
@@ -599,9 +599,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
599 m_keyscreen = m_mousescreen = m_screen_list.front(); 599 m_keyscreen = m_mousescreen = m_screen_list.front();
600 600
601 if (m_screen_list.empty()) { 601 if (m_screen_list.empty()) {
602 //!! TODO: NLS 602 throw string(_FBTEXT(Fluxbox, ErrorNoScreens,
603 throw string("Couldn't find screens to manage.\n" 603 "Couldn't find screens to manage.\nMake sure you don't have another window manager running.", "Error message when no unmanaged screens found - usually means another window manager is running"));
604 "Make sure you don't have another window manager running.");
605 } 604 }
606 605
607 // setup theme manager to have our style file ready to be scanned 606 // setup theme manager to have our style file ready to be scanned
@@ -728,10 +727,12 @@ void Fluxbox::setupConfigFiles() {
728#ifdef DEBUG 727#ifdef DEBUG
729 cerr <<__FILE__<<"("<<__LINE__<<"): Creating dir: " << dirname.c_str() << endl; 728 cerr <<__FILE__<<"("<<__LINE__<<"): Creating dir: " << dirname.c_str() << endl;
730#endif // DEBUG 729#endif // DEBUG
731 730 _FB_USES_NLS;
732 // create directory with perm 700 731 // create directory with perm 700
733 if (mkdir(dirname.c_str(), 0700)) { 732 if (mkdir(dirname.c_str(), 0700)) {
734 cerr << "Can't create " << dirname << " directory!" << endl; 733 fprintf(stderr, _FBTEXT(Fluxbox, ErrorCreatingDirectory,
734 "Can't create %s directory", "Can't create a directory, one %s for directory name"), dirname.c_str());
735 cerr<<endl;
735 return; 736 return;
736 } 737 }
737 738
@@ -755,6 +756,7 @@ void Fluxbox::setupConfigFiles() {
755} 756}
756 757
757void Fluxbox::handleEvent(XEvent * const e) { 758void Fluxbox::handleEvent(XEvent * const e) {
759 _FB_USES_NLS;
758 m_last_event = *e; 760 m_last_event = *e;
759 761
760 // it is possible (e.g. during moving) for a window 762 // it is possible (e.g. during moving) for a window
@@ -885,7 +887,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
885 screen = searchScreen(e->xmaprequest.parent); 887 screen = searchScreen(e->xmaprequest.parent);
886 888
887 if (screen == 0) { 889 if (screen == 0) {
888 cerr<<"Fluxbox Warning! Could not find screen to map window on!"<<endl; 890 cerr<<"Fluxbox "<<_FBTEXT(Fluxbox, CantMapWindow, "Warning! Could not find screen to map window on!", "")<<endl;
889 } else 891 } else
890 win = screen->createWindow(e->xmaprequest.window); 892 win = screen->createWindow(e->xmaprequest.window);
891 893
@@ -1288,7 +1290,8 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1288 1290
1289/// handle system signals 1291/// handle system signals
1290void Fluxbox::handleSignal(int signum) { 1292void Fluxbox::handleSignal(int signum) {
1291 I18n *i18n = I18n::instance(); 1293 _FB_USES_NLS;
1294
1292 static int re_enter = 0; 1295 static int re_enter = 0;
1293 1296
1294 switch (signum) { 1297 switch (signum) {
@@ -1314,25 +1317,19 @@ void Fluxbox::handleSignal(int signum) {
1314 break; 1317 break;
1315 default: 1318 default:
1316 fprintf(stderr, 1319 fprintf(stderr,
1317 i18n->getMessage( 1320 _FBTEXT(BaseDisplay, SignalCaught, "%s: signal %d caught\n", "signal catch debug message. Include %s for command and %d for signal number"),
1318 FBNLS::BaseDisplaySet, FBNLS::BaseDisplaySignalCaught,
1319 "%s: signal %d caught\n"),
1320 m_argv[0], signum); 1321 m_argv[0], signum);
1321 1322
1322 if (! m_starting && ! re_enter) { 1323 if (! m_starting && ! re_enter) {
1323 re_enter = 1; 1324 re_enter = 1;
1324 fprintf(stderr, 1325 fprintf(stderr,
1325 i18n->getMessage( 1326 _FBTEXT(BaseDisplay, ShuttingDown, "Shutting Down\n", "Quitting because of signal, end with newline"));
1326 FBNLS::BaseDisplaySet, FBNLS::BaseDisplayShuttingDown,
1327 "shutting down\n"));
1328 shutdown(); 1327 shutdown();
1329 } 1328 }
1330 1329
1331 1330
1332 fprintf(stderr, 1331 fprintf(stderr,
1333 i18n->getMessage( 1332 _FBTEXT(BaseDisplay, Aborting, "Aborting... dumping core\n", "Aboring and dumping core, end with newline"));
1334 FBNLS::BaseDisplaySet, FBNLS::BaseDisplayAborting,
1335 "aborting... dumping core\n"));
1336 abort(); 1333 abort();
1337 break; 1334 break;
1338 } 1335 }
@@ -1607,7 +1604,7 @@ void Fluxbox::shutdown() {
1607 1604
1608/// saves resources 1605/// saves resources
1609void Fluxbox::save_rc() { 1606void Fluxbox::save_rc() {
1610 1607 _FB_USES_NLS;
1611 XrmDatabase new_blackboxrc = 0; 1608 XrmDatabase new_blackboxrc = 0;
1612 1609
1613 char rc_string[1024]; 1610 char rc_string[1024];
@@ -1618,7 +1615,7 @@ void Fluxbox::save_rc() {
1618 m_resourcemanager.save(dbfile.c_str(), dbfile.c_str()); 1615 m_resourcemanager.save(dbfile.c_str(), dbfile.c_str());
1619 m_screen_rm.save(dbfile.c_str(), dbfile.c_str()); 1616 m_screen_rm.save(dbfile.c_str(), dbfile.c_str());
1620 } else 1617 } else
1621 cerr<<"database filename is invalid!"<<endl; 1618 cerr<<_FBTEXT(Fluxbox, BadRCFile, "rc filename is invalid!", "Bad settings file")<<endl;
1622 1619
1623 ScreenList::iterator it = m_screen_list.begin(); 1620 ScreenList::iterator it = m_screen_list.begin();
1624 ScreenList::iterator it_end = m_screen_list.end(); 1621 ScreenList::iterator it_end = m_screen_list.end();
@@ -1678,20 +1675,20 @@ void Fluxbox::getDefaultDataFilename(char *name, string &filename) {
1678 1675
1679/// loads resources 1676/// loads resources
1680void Fluxbox::load_rc() { 1677void Fluxbox::load_rc() {
1681 1678 _FB_USES_NLS;
1682 //get resource filename 1679 //get resource filename
1683 string dbfile(getRcFilename()); 1680 string dbfile(getRcFilename());
1684 1681
1685 if (!dbfile.empty()) { 1682 if (!dbfile.empty()) {
1686 if (!m_resourcemanager.load(dbfile.c_str())) { 1683 if (!m_resourcemanager.load(dbfile.c_str())) {
1687 cerr<<"Failed to load database:"<<dbfile<<endl; 1684 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<dbfile<<endl;
1688 cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl; 1685 cerr<<_FBTEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl;
1689 if (!m_resourcemanager.load(DEFAULT_INITFILE)) 1686 if (!m_resourcemanager.load(DEFAULT_INITFILE))
1690 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl; 1687 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
1691 } 1688 }
1692 } else { 1689 } else {
1693 if (!m_resourcemanager.load(DEFAULT_INITFILE)) 1690 if (!m_resourcemanager.load(DEFAULT_INITFILE))
1694 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl; 1691 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
1695 } 1692 }
1696 1693
1697 if (m_rc_menufile->empty()) 1694 if (m_rc_menufile->empty())
@@ -1714,12 +1711,13 @@ void Fluxbox::load_rc() {
1714 *m_rc_stylefile = DEFAULTSTYLE; 1711 *m_rc_stylefile = DEFAULTSTYLE;
1715 1712
1716 if (!Workspace::loadGroups(*m_rc_groupfile)) { 1713 if (!Workspace::loadGroups(*m_rc_groupfile)) {
1717 cerr<<"Failed to load groupfile: "<<*m_rc_groupfile<<endl; 1714 cerr<<_FBTEXT(Fluxbox, CantLoadGroupFile, "Failed to load groupfile", "Couldn't load the groupfile")<<": "<<*m_rc_groupfile<<endl;
1718 } 1715 }
1719} 1716}
1720 1717
1721void Fluxbox::load_rc(BScreen &screen) { 1718void Fluxbox::load_rc(BScreen &screen) {
1722 //get resource filename 1719 //get resource filename
1720 _FB_USES_NLS;
1723 string dbfile(getRcFilename()); 1721 string dbfile(getRcFilename());
1724 1722
1725 XrmDatabaseHelper database; 1723 XrmDatabaseHelper database;
@@ -1774,16 +1772,15 @@ void Fluxbox::load_rc(BScreen &screen) {
1774 1772
1775 if (!dbfile.empty()) { 1773 if (!dbfile.empty()) {
1776 if (!m_screen_rm.load(dbfile.c_str())) { 1774 if (!m_screen_rm.load(dbfile.c_str())) {
1777 cerr<<"Failed to load database:"<<dbfile<<endl; 1775 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<dbfile<<endl;
1778 cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl; 1776 cerr<<_FBTEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl;
1779 if (!m_screen_rm.load(DEFAULT_INITFILE)) 1777 if (!m_screen_rm.load(DEFAULT_INITFILE))
1780 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl; 1778 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
1781 } 1779 }
1782 } else { 1780 } else {
1783 if (!m_screen_rm.load(DEFAULT_INITFILE)) 1781 if (!m_screen_rm.load(DEFAULT_INITFILE))
1784 cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl; 1782 cerr<<_FBTEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
1785 } 1783 }
1786
1787} 1784}
1788 1785
1789void Fluxbox::loadRootCommand(BScreen &screen) { 1786void Fluxbox::loadRootCommand(BScreen &screen) {