Handle case when icon wasn't selected.

By default, 'empty' icon should be used. It is now shown in preview box and will
be selected when icon wasn't explicitly chosen. Also, redraw full desktop when icon was removed, to
prevent displaying icon which isn't available.

Added small delay when icon was removed so directory watcher skip remove event.
This commit is contained in:
Sanel Zukan
2012-05-15 12:49:16 +00:00
parent eccdcd83ef
commit 1c2cfe3739
2 changed files with 14 additions and 5 deletions

View File

@@ -575,10 +575,16 @@ DesktopIcon* Desktop::find_icon_by_path(const char* path, DesktopIconListIter* r
bool Desktop::remove_icon(DesktopIcon *d, bool real_delete) {
bool ret = true;
if(real_delete)
if(real_delete) {
dir_watch_off();
ret = file_remove(d->path().c_str());
Fl::wait(1);
dir_watch_on();
}
remove_icon_by_path(d->path().c_str());
/* TODO: reimplement as 'fast_redraw()' from DesktopIcon */
redraw();
return ret;
}
@@ -610,7 +616,6 @@ bool Desktop::remove_icon_by_path(const char* path) {
/* Fl_Group::remove() does not delete child, just pops it out */
remove(ic);
delete ic;
return true;
}