mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Icon renaming support.
This commit is contained in:
parent
c2366025b5
commit
eccdcd83ef
@ -83,8 +83,11 @@ static void open_cb(Fl_Widget*, void* d) {
|
||||
static void rename_cb(Fl_Widget*, void* d) {
|
||||
DesktopIcon* di = (DesktopIcon*)d;
|
||||
|
||||
const char* new_name = input(_("New name"), di->label());
|
||||
di->rename(new_name);
|
||||
const char* new_name = input(_("Change desktop icon name to:"), di->label());
|
||||
if(new_name) {
|
||||
di->rename(new_name);
|
||||
Desktop::instance()->rename_icon(di, new_name);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_cb(Fl_Widget*, void* d) {
|
||||
@ -95,7 +98,7 @@ static void delete_cb(Fl_Widget*, void* d) {
|
||||
}
|
||||
|
||||
static void props_cb(Fl_Widget*, void* d) {
|
||||
DesktopIcon* di = (DesktopIcon*)d;
|
||||
//DesktopIcon* di = (DesktopIcon*)d;
|
||||
}
|
||||
|
||||
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
|
||||
|
@ -582,6 +582,20 @@ bool Desktop::remove_icon(DesktopIcon *d, bool real_delete) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Desktop::rename_icon(DesktopIcon *d, const char *n) {
|
||||
DesktopFile f;
|
||||
const char *p = d->path().c_str();
|
||||
|
||||
E_RETURN_VAL_IF_FAIL(f.load(p), false);
|
||||
|
||||
dir_watch_off();
|
||||
f.set_name(n);
|
||||
bool ret = f.save(p);
|
||||
dir_watch_on();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Desktop::remove_icon_by_path(const char* path) {
|
||||
DesktopIconListIter pos;
|
||||
DesktopIcon* ic = find_icon_by_path(path, &pos);
|
||||
|
@ -157,6 +157,7 @@ public:
|
||||
|
||||
bool add_icon_by_path(const char* path, edelib::Resource* conf);
|
||||
bool remove_icon(DesktopIcon *d, bool real_delete);
|
||||
bool rename_icon(DesktopIcon *d, const char *n);
|
||||
|
||||
void update_workarea(void);
|
||||
void area(int& X, int& Y, int& W, int& H) { X = x(); Y = y(); W = w(); H = h(); }
|
||||
|
Loading…
Reference in New Issue
Block a user