forked from enlightenment/ecrire
45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
#include "config.h"
|
|
#include <Elementary.h>
|
|
|
|
typedef struct _File_Selector_Data
|
|
{
|
|
Evas_Object *inwin;
|
|
void (*func)(void *, Evas_Object *, void *);
|
|
void *data;
|
|
} File_Selector_Data;
|
|
|
|
static void
|
|
_cleaning_cb(void *data, Evas_Object *obj, void *event_info)
|
|
{
|
|
File_Selector_Data *fsdata = data;
|
|
fsdata->func(fsdata->data, obj, event_info);
|
|
evas_object_del(fsdata->inwin);
|
|
free(fsdata);
|
|
}
|
|
|
|
void
|
|
ui_file_open_save_dialog_open(Evas_Object *parent, Eina_Bool save,
|
|
Evas_Smart_Cb func, void *data)
|
|
{
|
|
Evas_Object *fs;
|
|
Evas_Object *inwin;
|
|
File_Selector_Data *fsdata;
|
|
|
|
inwin = elm_win_inwin_add(parent);
|
|
evas_object_show(inwin);
|
|
|
|
fs = elm_fileselector_add(inwin);
|
|
elm_fileselector_is_save_set(fs, save);
|
|
elm_fileselector_expandable_set(fs, EINA_FALSE);
|
|
elm_fileselector_path_set(fs, getenv("HOME"));
|
|
elm_win_inwin_content_set(inwin, fs);
|
|
evas_object_show(fs);
|
|
|
|
fsdata = malloc(sizeof(File_Selector_Data));
|
|
fsdata->inwin = inwin;
|
|
fsdata->func = func;
|
|
fsdata->data = data;
|
|
|
|
evas_object_smart_callback_add(fs, "done", _cleaning_cb, fsdata);
|
|
}
|