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:
Sanel Zukan 2012-05-18 12:06:32 +00:00
parent a786d9ea7a
commit 512645123a
3 changed files with 14 additions and 9 deletions

View File

@ -29,6 +29,7 @@
#include "ede-desktop.h"
#include "DesktopIcon.h"
#include "IconDialog.h"
#include "MovableIcon.h"
#include "Utils.h"
@ -56,13 +57,12 @@ EDELIB_NS_USING(run_async)
static void open_cb(Fl_Widget*, void* d);
static void rename_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[] = {
{_("&Open"), 0, open_cb, 0},
{_("&Rename"), 0, rename_cb, 0},
{_("&Delete"), 0, delete_cb, 0, FL_MENU_DIVIDER},
{_("&Properties"), 0, props_cb, 0},
{_("&Delete"), 0, delete_cb, 0},
/* {_("&Properties"), 0, props_cb, 0}, */
{0}
};
@ -97,9 +97,12 @@ static void delete_cb(Fl_Widget*, void* d) {
Desktop::instance()->remove_icon(di, true);
}
/*
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) :
Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {

View File

@ -115,13 +115,13 @@ static void ok_cb(Fl_Widget*, void*) {
str_tolower((unsigned char*)fp);
file += ".desktop";
/* TODO: let 'Desktop' (class) returns full desktop path */
String path = build_filename(dir_home().c_str(), "Desktop", file.c_str());
/* go through path and replace spaces with '_' */
for(char *p = (char*)path.c_str(); p && *p; p++)
/* go through the file and replace spaces with '_' */
for(char *p = (char*)file.c_str(); p && *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
* file will be available on that location)

View File

@ -167,6 +167,8 @@ public:
void dir_watch(const char* dir, const char* changed, int flags);
void dir_watch_on(void) { do_dirwatch = true; }
void dir_watch_off(void) { do_dirwatch = false; }
const char *desktop_path(void) { return desktop_dir_path.c_str(); }
};
#endif