mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
New config file format
Config updated to the existing programs ede-conf will read config from XDG paths
This commit is contained in:
parent
421a09304f
commit
345807d172
@ -14,3 +14,5 @@ SOURCE = ede-conf.cpp ;
|
|||||||
|
|
||||||
EdeProgram ede-conf : $(SOURCE) ;
|
EdeProgram ede-conf : $(SOURCE) ;
|
||||||
TranslationStrings locale : $(SOURCE) ;
|
TranslationStrings locale : $(SOURCE) ;
|
||||||
|
|
||||||
|
InstallEdeConfigFiles ede-conf.conf ;
|
||||||
|
@ -2,56 +2,30 @@
|
|||||||
# This is a default data for ede-conf
|
# This is a default data for ede-conf
|
||||||
#
|
#
|
||||||
|
|
||||||
[edeconf]
|
[EdeConf]
|
||||||
# main items
|
# main items
|
||||||
Items = edewmconf,ekeyconf,esvrconf,einstall,evolume, edatetime,etipconf
|
items = edewmconf,ede-desktop-conf,ede-screensaver-conf,ede-timedate
|
||||||
|
|
||||||
[edewmconf]
|
[edewmconf]
|
||||||
Name = Window manager
|
name = Window manager
|
||||||
Tip = This item will run window manager configuration
|
tip = This item will run window manager configuration
|
||||||
Exec = ewmconf
|
exec = ewmconf
|
||||||
Icon = preferences-system-windows
|
icon = preferences-system-windows
|
||||||
IconPathAbsolute = false
|
|
||||||
|
|
||||||
[ekeyconf]
|
[ede-desktop-conf]
|
||||||
Name = Keyboard configuration
|
name = Configure background and icons
|
||||||
Tip = This item will run keyboard configuration
|
tip = This item will configure desktop background and icons
|
||||||
Exec = konqueror
|
exec = ede-desktop-conf
|
||||||
#Icon = preferences-desktop-font
|
icon = preferences-desktop-wallpaper
|
||||||
Icon = accessories-character-map
|
|
||||||
IconPathAbsolute = false
|
|
||||||
|
|
||||||
[esvrconf]
|
[ede-screensaver-conf]
|
||||||
Name = Screensaver configuration
|
name = Configure screensaver
|
||||||
Tip = This item will configure screensaver
|
tip = This item will setup screensaver settings
|
||||||
Exec = esvrconf
|
exec = ede-screensaver-conf
|
||||||
Icon = preferences-desktop-screensaver
|
icon = preferences-desktop-screensaver
|
||||||
IconPathAbsolute = false
|
|
||||||
|
|
||||||
[einstall]
|
[ede-timedate]
|
||||||
Name = Install new software
|
name = Configure time and date
|
||||||
Tip = This item will run installer
|
tip = This item will configure system date and time
|
||||||
Exec = einstall
|
exec = ede-timedate
|
||||||
Icon = system-installer
|
icon = preferences-date-time
|
||||||
IconPathAbsolute = false
|
|
||||||
|
|
||||||
[evolume]
|
|
||||||
Name = Sound preferences
|
|
||||||
Tip = This item will set sound preferences
|
|
||||||
Exec = evolume
|
|
||||||
Icon = multimedia-volume-control
|
|
||||||
IconPathAbsolute = false
|
|
||||||
|
|
||||||
[edatetime]
|
|
||||||
Name = Date and time
|
|
||||||
Tip = This item will configure date and time
|
|
||||||
Exec = edatetime
|
|
||||||
Icon = preferences-date-time
|
|
||||||
IconPathAbsolute = false
|
|
||||||
|
|
||||||
[etipconf]
|
|
||||||
Name = Tips
|
|
||||||
Tip = This item will configure tips
|
|
||||||
Exec = etipconf
|
|
||||||
Icon = preferences-user-information
|
|
||||||
IconPathAbsolute = false
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
#include <edelib/Config.h>
|
#include <edelib/Config.h>
|
||||||
|
#include <edelib/Resource.h>
|
||||||
#include <edelib/StrUtil.h>
|
#include <edelib/StrUtil.h>
|
||||||
#include <edelib/Debug.h>
|
#include <edelib/Debug.h>
|
||||||
#include <edelib/ExpandableGroup.h>
|
#include <edelib/ExpandableGroup.h>
|
||||||
@ -43,11 +44,11 @@ static bool file_can_execute(const edelib::String& f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ControlButton : public Fl_Button {
|
class ControlButton : public Fl_Button {
|
||||||
private:
|
private:
|
||||||
Fl_Box* tipbox;
|
Fl_Box* tipbox;
|
||||||
edelib::String tipstr;
|
edelib::String tipstr;
|
||||||
edelib::String exec;
|
edelib::String exec;
|
||||||
public:
|
public:
|
||||||
ControlButton(Fl_Box* t, const edelib::String& ts, const edelib::String& e, int x, int y, int w, int h, const char* l = 0) :
|
ControlButton(Fl_Box* t, const edelib::String& ts, const edelib::String& e, int x, int y, int w, int h, const char* l = 0) :
|
||||||
Fl_Button(x, y, w, h, l), tipbox(t), tipstr(ts), exec(e) {
|
Fl_Button(x, y, w, h, l), tipbox(t), tipstr(ts), exec(e) {
|
||||||
box(FL_FLAT_BOX);
|
box(FL_FLAT_BOX);
|
||||||
@ -101,12 +102,11 @@ static void close_cb(Fl_Widget*, void* w) {
|
|||||||
win->hide();
|
win->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fetch_icon(ControlButton* btn, const char* path, bool abs) {
|
static void fetch_icon(ControlButton* btn, const char* path) {
|
||||||
Fl_Image* img = NULL;
|
// see if path is absolute and if not, fetch icon from icon theme
|
||||||
|
Fl_Image* img = Fl_Shared_Image::get(path);
|
||||||
|
|
||||||
if(abs) {
|
if(!img) {
|
||||||
img = Fl_Shared_Image::get(path);
|
|
||||||
} else {
|
|
||||||
edelib::String p = edelib::IconTheme::get(path, edelib::ICON_SIZE_LARGE);
|
edelib::String p = edelib::IconTheme::get(path, edelib::ICON_SIZE_LARGE);
|
||||||
if(!p.empty()) {
|
if(!p.empty()) {
|
||||||
img = Fl_Shared_Image::get(p.c_str());
|
img = Fl_Shared_Image::get(p.c_str());
|
||||||
@ -123,15 +123,22 @@ static void fetch_icon(ControlButton* btn, const char* path, bool abs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void load_buttons(Fl_Group* g, Fl_Box* tipbox) {
|
static void load_buttons(Fl_Group* g, Fl_Box* tipbox) {
|
||||||
|
#if 0
|
||||||
edelib::Config c;
|
edelib::Config c;
|
||||||
|
|
||||||
if(!c.load("ede-conf.conf")) {
|
if(!c.load("ede-conf.conf")) {
|
||||||
E_WARNING("Can't load config\n");
|
E_WARNING("Can't load config\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
edelib::Resource c;
|
||||||
|
if(!c.load("ede-conf")) {
|
||||||
|
E_WARNING("Can't load config\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
if(!c.get("edeconf", "Items", buff, sizeof(buff))) {
|
if(!c.get("EdeConf", "items", buff, sizeof(buff))) {
|
||||||
E_WARNING("Can't find Items key\n");
|
E_WARNING("Can't find Items key\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -142,7 +149,6 @@ static void load_buttons(Fl_Group* g, Fl_Box* tipbox) {
|
|||||||
if(spl.empty())
|
if(spl.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool abspath;
|
|
||||||
const char* section;
|
const char* section;
|
||||||
//ControlIcon cicon;
|
//ControlIcon cicon;
|
||||||
StrListIter it = spl.begin(), it_end = spl.end();
|
StrListIter it = spl.begin(), it_end = spl.end();
|
||||||
@ -152,25 +158,23 @@ static void load_buttons(Fl_Group* g, Fl_Box* tipbox) {
|
|||||||
section = (*it).c_str();
|
section = (*it).c_str();
|
||||||
edelib::str_trim((char*)section);
|
edelib::str_trim((char*)section);
|
||||||
|
|
||||||
if(c.get(section, "Name", buff, sizeof(buff)))
|
if(c.get(section, "name", buff, sizeof(buff)))
|
||||||
name = buff;
|
name = buff;
|
||||||
else {
|
else {
|
||||||
E_WARNING("No %s, skipping...\n", section);
|
E_WARNING("No %s, skipping...\n", section);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c.get(section, "Tip", buff, sizeof(buff)))
|
if(c.get(section, "tip", buff, sizeof(buff)))
|
||||||
tip = buff;
|
tip = buff;
|
||||||
if(c.get(section, "Exec", buff, sizeof(buff)))
|
if(c.get(section, "exec", buff, sizeof(buff)))
|
||||||
exec = buff;
|
exec = buff;
|
||||||
|
|
||||||
ControlButton* cb = new ControlButton(tipbox, tip, exec, 0, 0, 100, 100);
|
ControlButton* cb = new ControlButton(tipbox, tip, exec, 0, 0, 100, 100);
|
||||||
cb->copy_label(name.c_str());
|
cb->copy_label(name.c_str());
|
||||||
|
|
||||||
c.get(section, "IconPathAbsolute", abspath, false);
|
c.get(section, "icon", buff, sizeof(buff));
|
||||||
|
fetch_icon(cb, buff);
|
||||||
if(c.get(section, "Icon", buff, sizeof(buff)))
|
|
||||||
fetch_icon(cb, buff, abspath);
|
|
||||||
|
|
||||||
g->add(cb);
|
g->add(cb);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user