mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Reuse desktop folder path from Desktop class. Also small reordering, so only spaces are
replaced inside file name, not full desktop path.
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "ede-desktop.h"
|
#include "ede-desktop.h"
|
||||||
#include "DesktopIcon.h"
|
#include "DesktopIcon.h"
|
||||||
|
#include "IconDialog.h"
|
||||||
#include "MovableIcon.h"
|
#include "MovableIcon.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
@@ -56,13 +57,12 @@ EDELIB_NS_USING(run_async)
|
|||||||
static void open_cb(Fl_Widget*, void* d);
|
static void open_cb(Fl_Widget*, void* d);
|
||||||
static void rename_cb(Fl_Widget*, void* d);
|
static void rename_cb(Fl_Widget*, void* d);
|
||||||
static void delete_cb(Fl_Widget*, void* d);
|
static void delete_cb(Fl_Widget*, void* d);
|
||||||
static void props_cb(Fl_Widget*, void* d);
|
|
||||||
|
|
||||||
static MenuItem icon_menu[] = {
|
static MenuItem icon_menu[] = {
|
||||||
{_("&Open"), 0, open_cb, 0},
|
{_("&Open"), 0, open_cb, 0},
|
||||||
{_("&Rename"), 0, rename_cb, 0},
|
{_("&Rename"), 0, rename_cb, 0},
|
||||||
{_("&Delete"), 0, delete_cb, 0, FL_MENU_DIVIDER},
|
{_("&Delete"), 0, delete_cb, 0},
|
||||||
{_("&Properties"), 0, props_cb, 0},
|
/* {_("&Properties"), 0, props_cb, 0}, */
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -97,9 +97,12 @@ static void delete_cb(Fl_Widget*, void* d) {
|
|||||||
Desktop::instance()->remove_icon(di, true);
|
Desktop::instance()->remove_icon(di, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void props_cb(Fl_Widget*, void* d) {
|
static void props_cb(Fl_Widget*, void* d) {
|
||||||
//DesktopIcon* di = (DesktopIcon*)d;
|
DesktopIcon* di = (DesktopIcon*)d;
|
||||||
|
icon_dialog_icon_property(di);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
|
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
|
||||||
Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {
|
Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {
|
||||||
|
@@ -115,13 +115,13 @@ static void ok_cb(Fl_Widget*, void*) {
|
|||||||
str_tolower((unsigned char*)fp);
|
str_tolower((unsigned char*)fp);
|
||||||
file += ".desktop";
|
file += ".desktop";
|
||||||
|
|
||||||
/* TODO: let 'Desktop' (class) returns full desktop path */
|
/* go through the file and replace spaces with '_' */
|
||||||
String path = build_filename(dir_home().c_str(), "Desktop", file.c_str());
|
for(char *p = (char*)file.c_str(); p && *p; p++)
|
||||||
|
|
||||||
/* go through path and replace spaces with '_' */
|
|
||||||
for(char *p = (char*)path.c_str(); p && *p; p++)
|
|
||||||
if(isspace(*p)) *p = '_';
|
if(isspace(*p)) *p = '_';
|
||||||
|
|
||||||
|
/* TODO: let 'Desktop' (class) returns full desktop path */
|
||||||
|
String path = build_filename(Desktop::instance()->desktop_path(), file.c_str());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* disable watching on folder and explicitly add file (probably as notification will be fired up faster than
|
* disable watching on folder and explicitly add file (probably as notification will be fired up faster than
|
||||||
* file will be available on that location)
|
* file will be available on that location)
|
||||||
|
@@ -167,6 +167,8 @@ public:
|
|||||||
void dir_watch(const char* dir, const char* changed, int flags);
|
void dir_watch(const char* dir, const char* changed, int flags);
|
||||||
void dir_watch_on(void) { do_dirwatch = true; }
|
void dir_watch_on(void) { do_dirwatch = true; }
|
||||||
void dir_watch_off(void) { do_dirwatch = false; }
|
void dir_watch_off(void) { do_dirwatch = false; }
|
||||||
|
|
||||||
|
const char *desktop_path(void) { return desktop_dir_path.c_str(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user