1
/* Joe's Window Manager Configuration
3
* This program configures JWM using tinyxml2 and FLTK
5
* Copyright (C) 2014 Israel <israel@torios.org>
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
* This has been developed as a part of the ToriOS Project
19
* This has been developed by Israel<israel@torios.org>
22
* You may redistribute this, but you must keep this comment in place
23
* Jesus is my Lord, and if you don't like it feel free to ignore it.
29
std::string icons = "icons";
30
std::string configPath = ".jwm/";
32
tinyxml2::XMLDocument doc;
35
///what will be the default Icon set here??
36
std::string recoveryFileText ="<?xml version=\"1.0\"?>\n\
38
<IconPath>"+ homePathNoFile() + configPath + "Moka/32x32/apps</IconPath>\n\
39
<IconPath>" + homePathNoFile() + configPath + "Moka/32x32/actions</IconPath>\n\
40
<IconPath>"+ homePathNoFile() + configPath +"</IconPath>\n\
41
<IconPath>/usr/share/pixmaps</IconPath>\n\
43
setRecoveryText(recoveryFileText);
51
void flIcons::addIcons(const char* path){
52
tinyxml2::XMLNode *iconNode = doc.FirstChildElement( "JWM" );
53
tinyxml2::XMLNode *node = doc.NewElement("IconPath");
54
iconNode->InsertEndChild(node);
55
tinyxml2::XMLText *icons = doc.NewText(path);
56
node->LinkEndChild(icons);
60
void flIcons::getIcons(Fl_Browser *o){
61
for(const tinyxml2::XMLElement* node=doc.FirstChildElement("JWM")->FirstChildElement("IconPath");node;node=node->NextSiblingElement()){
62
std::string value = node->GetText();
63
if(value.c_str() !=NULL){
64
const char * v = value.c_str();
67
//std::cout<<value<<std::endl;
71
void flIcons::removeIcons(const char * icons){
72
for(tinyxml2::XMLElement* node=doc.FirstChildElement("JWM")->FirstChildElement("IconPath");node;node=node->NextSiblingElement()){
73
std::string fromDoc = node->GetText();
74
unsigned found = fromDoc.find_last_of(" ");
75
fromDoc = fromDoc.erase(0,found+1);
76
const char* value = fromDoc.c_str();
77
std::string fromProgram = icons;
78
//std::cout<<"Value: "<<value<<" Icons: "<<icons<<std::endl;
79
if(fromProgram.compare(value) ==0){
80
node->DeleteChild(node);
81
//std::cout<<"deleted "<<icons<<std::endl;