From 512645123a14ad64aff9fc59bcf4e651e91cddfa Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Fri, 18 May 2012 12:06:32 +0000 Subject: [PATCH] Reuse desktop folder path from Desktop class. Also small reordering, so only spaces are replaced inside file name, not full desktop path. --- ede-desktop/DesktopIcon.cpp | 11 +++++++---- ede-desktop/IconDialog.cpp | 10 +++++----- ede-desktop/ede-desktop.h | 2 ++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ede-desktop/DesktopIcon.cpp b/ede-desktop/DesktopIcon.cpp index cf88392..797106f 100644 --- a/ede-desktop/DesktopIcon.cpp +++ b/ede-desktop/DesktopIcon.cpp @@ -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) { diff --git a/ede-desktop/IconDialog.cpp b/ede-desktop/IconDialog.cpp index 9f035c8..3e10c4c 100644 --- a/ede-desktop/IconDialog.cpp +++ b/ede-desktop/IconDialog.cpp @@ -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) diff --git a/ede-desktop/ede-desktop.h b/ede-desktop/ede-desktop.h index 0662e5a..7bdc4a0 100644 --- a/ede-desktop/ede-desktop.h +++ b/ede-desktop/ede-desktop.h @@ -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