mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
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:
parent
eccdcd83ef
commit
1c2cfe3739
@ -31,13 +31,16 @@
|
||||
#include <edelib/StrUtil.h>
|
||||
#include <edelib/Util.h>
|
||||
#include <edelib/MessageBox.h>
|
||||
#include <edelib/IconLoader.h>
|
||||
|
||||
#include "IconDialog.h"
|
||||
#include "DesktopIcon.h"
|
||||
#include "ede-desktop.h"
|
||||
|
||||
EDELIB_NS_USING_LIST(9, (str_tolower, icon_chooser, dir_home, build_filename, alert,
|
||||
ICON_SIZE_HUGE, String, DesktopFile, DESK_FILE_TYPE_APPLICATION))
|
||||
EDELIB_NS_USING_LIST(10, (str_tolower, icon_chooser, dir_home, build_filename, alert,
|
||||
ICON_SIZE_HUGE, String, IconLoader, DesktopFile, DESK_FILE_TYPE_APPLICATION))
|
||||
|
||||
#define DEFAULT_ICON "empty"
|
||||
|
||||
/* it is safe to be globals */
|
||||
static Fl_Window *win;
|
||||
@ -100,7 +103,7 @@ static void ok_cb(Fl_Widget*, void*) {
|
||||
df.set_icon(p);
|
||||
}
|
||||
} else {
|
||||
df.set_icon("empty");
|
||||
df.set_icon(DEFAULT_ICON);
|
||||
}
|
||||
|
||||
df.set_exec(execute->value());
|
||||
@ -164,6 +167,7 @@ void icon_dialog_icon_create(void) {
|
||||
img = new Fl_Button(10, 10, 75, 75);
|
||||
img->callback(img_browse_cb);
|
||||
img->tooltip(_("Click to select icon"));
|
||||
IconLoader::set(img, DEFAULT_ICON, ICON_SIZE_HUGE);
|
||||
name = new Fl_Input(205, 10, 215, 25, _("Name:"));
|
||||
comment = new Fl_Input(205, 40, 215, 25, _("Comment:"));
|
||||
execute = new Fl_Input(205, 70, 185, 25, _("Execute:"));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user