Browsing files support. Real removal, but yet incomplete

This commit is contained in:
Sanel Zukan 2012-05-10 11:19:19 +00:00
parent b195c061e0
commit 05f5f43aca
2 changed files with 20 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include <FL/Fl_Choice.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_File_Chooser.H>
#include <edelib/Nls.h>
#include <edelib/String.h>
@ -152,14 +153,22 @@ static void img_browse_cb(Fl_Widget*, void*) {
img->redraw();
}
static void file_browse_cb(Fl_Widget*, void*) {
const char *p = fl_file_chooser(_("Choose program path to execute"), "*", 0, 0);
if(!p) return;
execute->value(p);
}
void icon_dialog_icon_create(void) {
win = new Fl_Window(430, 170, _("Create desktop icon"));
img = new Fl_Button(10, 10, 75, 75);
img->callback(img_browse_cb);
img->tooltip(_("Click to select icon"));
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:"));
browse = new Fl_Button(395, 70, 25, 25, "...");
browse->callback(file_browse_cb);
icon_type = new Fl_Choice(205, 100, 215, 25, _("Type:"));
icon_type->down_box(FL_BORDER_BOX);
icon_type->menu(menu_items);

View File

@ -25,9 +25,13 @@
#include <FL/fl_draw.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Output.H>
#include <edelib/Debug.h>
#include <edelib/FileTest.h>
#include <edelib/File.h>
#include <edelib/Directory.h>
#include <edelib/DesktopFile.h>
#include <edelib/DirWatch.h>
@ -92,6 +96,7 @@ EDELIB_NS_USING(netwm_callback_add)
EDELIB_NS_USING(netwm_callback_remove)
EDELIB_NS_USING(font_cache_find)
EDELIB_NS_USING(file_test)
EDELIB_NS_USING(file_remove)
EDELIB_NS_USING(dir_home)
EDELIB_NS_USING(build_filename)
EDELIB_NS_USING(FILE_TEST_IS_DIR)
@ -568,7 +573,12 @@ DesktopIcon* Desktop::find_icon_by_path(const char* path, DesktopIconListIter* r
}
bool Desktop::remove_icon(DesktopIcon *d, bool real_delete) {
bool ret = remove_icon_by_path(d->path().c_str());
bool ret = true;
if(real_delete)
ret = file_remove(d->path().c_str());
remove_icon_by_path(d->path().c_str());
return ret;
}