Remove commented code

Some refactoring
This commit is contained in:
Sanel Zukan 2008-10-03 10:14:57 +00:00
parent 8a08b132ad
commit 40400c0654
2 changed files with 13 additions and 45 deletions

View File

@ -120,31 +120,6 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
imenu->menu(icon_menu); imenu->menu(icon_menu);
load_icon(ICON_FACE_ONE); load_icon(ICON_FACE_ONE);
#if 0
if(!settings->icon.empty()) {
const char* nn = settings->icon.c_str();
//edelib::String ipath = edelib::IconTheme::get(nn, edelib::ICON_SIZE_MEDIUM);
edelib::String ipath = edelib::IconTheme::get(nn, edelib::ICON_SIZE_HUGE);
if(!ipath.empty()) {
Fl_Image* img = Fl_Shared_Image::get(ipath.c_str());
if(img) {
int img_w = img->w();
int img_h = img->h();
// resize box if icon is larger
if(img_w > ICON_SIZE_MIN_W || img_h > ICON_SIZE_MIN_H)
size(img_w + OFFSET_W, img_h + OFFSET_H);
image(img);
} else
E_DEBUG(E_STRLOC ": Unable to load %s\n", ipath.c_str());
} else
E_DEBUG(E_STRLOC ": Got empty icon name ?!?\n");
}
#endif
fix_position(x(), y()); fix_position(x(), y());
//Use desktop color as color for icon background //Use desktop color as color for icon background
@ -337,8 +312,6 @@ void DesktopIcon::icon2(void) {
} }
void DesktopIcon::fast_redraw(void) { void DesktopIcon::fast_redraw(void) {
E_ASSERT(parent() != NULL && "Impossible !");
int wsz = w(); int wsz = w();
int xpos = x(); int xpos = x();

View File

@ -192,13 +192,14 @@ Desktop::~Desktop() {
} }
void Desktop::init_internals(void) { void Desktop::init_internals(void) {
edelib::String p;
init_atoms(); init_atoms();
update_workarea(); update_workarea();
/* /*
* NOTE: order how childs are added is important. First * NOTE: order how childs are added is important. First non iconable ones should be
* non iconable ones should be added (wallpaper, menu, ...) * added (wallpaper, menu, ...) then icons, so they can be drawn at top of them.
* then icons, so they can be drawn at top of them.
*/ */
begin(); begin();
dmenu = new Fl_Menu_Button(0, 0, 0, 0); dmenu = new Fl_Menu_Button(0, 0, 0, 0);
@ -216,28 +217,22 @@ void Desktop::init_internals(void) {
dbus = NULL; dbus = NULL;
} }
// read main config
read_config(); read_config();
/* // now try to load icons, looking inside ~/Desktop directory
* Now try to load icons, first looking inside ~/Desktop directory p = edelib::dir_home();
* FIXME: dir_exists() can't handle '~/Desktop' ??? edelib::String desktop_path = edelib::build_filename(p.c_str(), "Desktop");
*/
edelib::String desktop_path = edelib::dir_home();
if(desktop_path.empty()) {
E_WARNING(E_STRLOC ": can't read home directory; icons will not be loaded\n");
return;
}
desktop_path += "/Desktop";
// setup watcher on ~/Desktop and Trash directories // setup watcher used for Desktop and Trash directories
edelib::DirWatch::init(); edelib::DirWatch::init();
if(edelib::dir_exists(desktop_path.c_str())) { if(edelib::dir_exists(desktop_path.c_str())) {
load_icons(desktop_path.c_str()); load_icons(desktop_path.c_str());
if(!edelib::DirWatch::add(desktop_path.c_str(), if(!edelib::DirWatch::add(desktop_path.c_str(),
edelib::DW_CREATE | edelib::DW_MODIFY | edelib::DW_RENAME | edelib::DW_DELETE)) { edelib::DW_CREATE | edelib::DW_MODIFY | edelib::DW_RENAME | edelib::DW_DELETE))
{
E_WARNING(E_STRLOC ": Unable to watch %s\n", desktop_path.c_str()); E_WARNING(E_STRLOC ": Unable to watch %s\n", desktop_path.c_str());
} }
} }
@ -248,8 +243,8 @@ void Desktop::init_internals(void) {
* *
* FIXME: at startup it should be checked is Trash empty and update icons for that * FIXME: at startup it should be checked is Trash empty and update icons for that
*/ */
trash_path = edelib::user_data_dir(); p = edelib::user_data_dir();
trash_path += "/Trash/files"; trash_path = edelib::build_filename(p.c_str(), "Trash/files");
if(edelib::dir_exists(trash_path.c_str())) { if(edelib::dir_exists(trash_path.c_str())) {
if(!edelib::DirWatch::add(trash_path.c_str(), edelib::DW_CREATE | edelib::DW_DELETE)) if(!edelib::DirWatch::add(trash_path.c_str(), edelib::DW_CREATE | edelib::DW_DELETE))