Do not exit from read_config() even if reading file fails; edelib::Config class will simply use fallback values instead.

This commit is contained in:
Sanel Zukan 2013-06-06 09:44:50 +00:00
parent 932e2c85fd
commit 0d6f18e867

View File

@ -240,14 +240,7 @@ Panel::Panel() : PanelWindow(300, 30, "ede-panel") {
void Panel::read_config(void) { void Panel::read_config(void) {
Resource r; Resource r;
r.load("ede-panel");
/* try to load applets even if panel configuration isn't present */
if(E_UNLIKELY(r.load("ede-panel") == false)) {
load_applets();
hider = new Hider();
add(hider);
return;
}
int tmp; int tmp;
if(r.get("Panel", "position", tmp, PANEL_POSITION_BOTTOM)) { if(r.get("Panel", "position", tmp, PANEL_POSITION_BOTTOM)) {
@ -266,10 +259,17 @@ void Panel::read_config(void) {
/* small button on the right edge for panel sliding */ /* small button on the right edge for panel sliding */
r.get("Panel", "hider", tmp, 1); r.get("Panel", "hider", tmp, 1);
if(tmp) { if(tmp) {
if(!hider) {
hider = new Hider(); hider = new Hider();
add(hider); add(hider);
} }
/* in case was hidden before */
hider->show();
} else {
if(hider) hider->hide();
}
char buf[128]; char buf[128];
if(r.get("Panel", "applets", buf, sizeof(buf))) if(r.get("Panel", "applets", buf, sizeof(buf)))
load_applets(buf); load_applets(buf);
@ -541,6 +541,8 @@ int Panel::handle(int e) {
} }
void Panel::load_applets(const char *applets) { void Panel::load_applets(const char *applets) {
mgr.clear(this);
/* /*
* Hardcoded order, unless configuration file was found. For easier and uniform parsing * Hardcoded order, unless configuration file was found. For easier and uniform parsing
* (similar string is expected from configuration), fallback is plain string. * (similar string is expected from configuration), fallback is plain string.