allw filechooser to be remembered (give it its own name/class so it can be
unique) and have the import dialog rememebr its last dir. SVN revision: 24682
This commit is contained in:
parent
ce206f330e
commit
f717fa75db
|
@ -5651,7 +5651,10 @@ _e_border_eval(E_Border *bd)
|
|||
/* Recreate state */
|
||||
e_hints_window_init(bd);
|
||||
|
||||
if (bd->client.e.state.centered)
|
||||
if ((bd->client.e.state.centered) &&
|
||||
((!bd->remember) ||
|
||||
((bd->remember) &&
|
||||
(!(bd->remember->apply & E_REMEMBER_APPLY_POS)))))
|
||||
{
|
||||
bd->x = bd->zone->x + (bd->zone->w - bd->w) / 2;
|
||||
bd->y = bd->zone->y + (bd->zone->h - bd->h) / 2;
|
||||
|
|
|
@ -470,6 +470,9 @@ e_config_init(void)
|
|||
E_CONFIG_VAL(D, T, border_raise_on_mouse_action, INT);
|
||||
E_CONFIG_VAL(D, T, border_raise_on_focus, INT);
|
||||
E_CONFIG_VAL(D, T, desk_flip_wrap, INT);
|
||||
|
||||
E_CONFIG_VAL(D, T, wallpaper_import_last_dev, STR);
|
||||
E_CONFIG_VAL(D, T, wallpaper_import_last_path, STR);
|
||||
|
||||
e_config = e_config_domain_load("e", _e_config_edd);
|
||||
if (e_config)
|
||||
|
@ -1160,6 +1163,13 @@ e_config_init(void)
|
|||
e_config->border_raise_on_mouse_action = 1;
|
||||
e_config->border_raise_on_focus = 1;
|
||||
e_config->desk_flip_wrap = 0;
|
||||
e_config->wallpaper_import_last_dev = NULL;
|
||||
e_config->wallpaper_import_last_path = NULL;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x0096); /* the version # where this value(s) was introduced */
|
||||
e_config->wallpaper_import_last_dev = evas_stringshare_add("~/");
|
||||
e_config->wallpaper_import_last_path = evas_stringshare_add("/");
|
||||
IFCFGEND;
|
||||
|
||||
#if 0 /* example of new config */
|
||||
|
|
|
@ -233,6 +233,9 @@ struct _E_Config
|
|||
int border_raise_on_mouse_action; // GUI
|
||||
int border_raise_on_focus; // GUI
|
||||
int desk_flip_wrap; // GUI
|
||||
|
||||
char *wallpaper_import_last_dev; // INTERNAL
|
||||
char *wallpaper_import_last_path; // INTERNAL
|
||||
};
|
||||
|
||||
struct _E_Config_Module
|
||||
|
|
|
@ -49,7 +49,9 @@ struct _E_Config_Dialog_Data
|
|||
static Ecore_Event_Handler *_import_edje_cc_exit_handler = NULL;
|
||||
|
||||
static void _import_opt_disabled_set(Import *import, int disabled);
|
||||
static void _import_cb_sel_selected(void *data, Evas_Object *obj);
|
||||
static void _import_cb_sel_change(void *data, Evas_Object *obj);
|
||||
static void _import_path_save(Import *import);
|
||||
static void _import_edj_gen(Import *import);
|
||||
static int _import_cb_edje_cc_exit(void *data, int type, void *event);
|
||||
static void _import_cb_delete(E_Win *win);
|
||||
|
@ -59,9 +61,6 @@ static void _import_cb_ok(void *data, void *data2);
|
|||
static void _import_cb_wid_on_focus(void *data, Evas_Object *obj);
|
||||
static void _import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
|
||||
|
||||
/* FIXME: save previous dev/dir and restore it to browse that dir */
|
||||
/* FIXME: rememebr size and maybe location? */
|
||||
|
||||
EAPI E_Win *
|
||||
e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
||||
{
|
||||
|
@ -73,6 +72,7 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
Evas_Coord w, h;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_Modifier_Mask mask;
|
||||
char *fdev, *fpath;
|
||||
|
||||
import = E_NEW(Import, 1);
|
||||
if (!import) return NULL;
|
||||
|
@ -98,7 +98,7 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
e_win_delete_callback_set(win, _import_cb_delete);
|
||||
e_win_resize_callback_set(win, _import_cb_resize);
|
||||
e_win_dialog_set(win, 1);
|
||||
e_win_name_class_set(win, "E", "_dialog");
|
||||
e_win_name_class_set(win, "E", "_wallpaper_import_dialog");
|
||||
|
||||
o = edje_object_add(evas);
|
||||
import->bg_obj = o;
|
||||
|
@ -129,8 +129,15 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
o = e_widget_list_add(evas, 0, 0);
|
||||
import->content_obj = o;
|
||||
|
||||
ofm = e_widget_fsel_add(evas, "~/", "/", NULL, NULL,
|
||||
_import_cb_sel_change, import,
|
||||
fdev = e_config->wallpaper_import_last_dev;
|
||||
fpath = e_config->wallpaper_import_last_path;
|
||||
if ((!fdev) && (!fpath))
|
||||
{
|
||||
fdev = "~/";
|
||||
fpath = "/";
|
||||
}
|
||||
ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL,
|
||||
_import_cb_sel_selected, import,
|
||||
_import_cb_sel_change, import, 0
|
||||
);
|
||||
import->fsel_obj = ofm;
|
||||
|
@ -207,6 +214,7 @@ e_int_config_wallpaper_del(E_Win *win)
|
|||
Import *import;
|
||||
|
||||
import = win->data;
|
||||
_import_path_save(import);
|
||||
if (import->exe_handler) ecore_event_handler_del(import->exe_handler);
|
||||
import->exe_handler = NULL;
|
||||
if (import->tmpf) unlink(import->tmpf);
|
||||
|
@ -231,6 +239,15 @@ _import_opt_disabled_set(Import *import, int disabled)
|
|||
e_widget_disabled_set(import->frame_quality_obj, disabled);
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_sel_selected(void *data, Evas_Object *obj)
|
||||
{
|
||||
Import *import;
|
||||
|
||||
import = data;
|
||||
_import_cb_ok(import->win, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_sel_change(void *data, Evas_Object *obj)
|
||||
{
|
||||
|
@ -248,6 +265,24 @@ _import_cb_sel_change(void *data, Evas_Object *obj)
|
|||
_import_opt_disabled_set(import, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_import_path_save(Import *import)
|
||||
{
|
||||
const char *fdev = NULL, *fpath = NULL;
|
||||
|
||||
e_widget_fsel_path_get(import->fsel_obj, &fdev, &fpath);
|
||||
if ((fdev) || (fpath))
|
||||
{
|
||||
if (e_config->wallpaper_import_last_dev) evas_stringshare_del(e_config->wallpaper_import_last_dev);
|
||||
if (fdev) e_config->wallpaper_import_last_dev = (char *)evas_stringshare_add(fdev);
|
||||
else e_config->wallpaper_import_last_dev = NULL;
|
||||
if (e_config->wallpaper_import_last_path) evas_stringshare_del(e_config->wallpaper_import_last_path);
|
||||
if (fpath) e_config->wallpaper_import_last_path = (char *)evas_stringshare_add(fpath);
|
||||
else e_config->wallpaper_import_last_path = NULL;
|
||||
e_config_save_queue();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_import_edj_gen(Import *import)
|
||||
{
|
||||
|
@ -291,7 +326,7 @@ _import_edj_gen(Import *import)
|
|||
f = fopen(tmpn, "w");
|
||||
if (!f)
|
||||
{
|
||||
printf("Cannot open %s for writting\n", tmpn);
|
||||
printf("Cannot open %s for writing\n", tmpn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,9 +189,6 @@ _e_wid_fsel_files_selected(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
/* externally accessible functions */
|
||||
/* FIXME: callback only exists for double-clicking and selecting. need to add
|
||||
* one for when the selection changes as well
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
e_widget_fsel_add(Evas *evas, char *dev, char *path, char *selected, char *filter,
|
||||
void (*sel_func) (void *data, Evas_Object *obj), void *sel_data,
|
||||
|
@ -430,6 +427,26 @@ e_widget_fsel_add(Evas *evas, char *dev, char *path, char *selected, char *filte
|
|||
return obj;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_widget_fsel_path_get(Evas_Object *obj, const char **dev, const char **path)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
|
||||
if (!obj) return;
|
||||
wd = e_widget_data_get(obj);
|
||||
return e_fm2_path_get(wd->o_files_fm, dev, path);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_widget_fsel_selection_path_get(Evas_Object *obj)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
|
||||
if (!obj) return NULL;
|
||||
wd = e_widget_data_get(obj);
|
||||
return wd->path;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_wid_fsel_preview_file(E_Widget_Data *wd)
|
||||
{
|
||||
|
@ -454,16 +471,6 @@ _e_wid_fsel_preview_file(E_Widget_Data *wd)
|
|||
free(time);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_widget_fsel_selection_path_get(Evas_Object *obj)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
|
||||
if (!obj) return NULL;
|
||||
wd = e_widget_data_get(obj);
|
||||
return wd->path;
|
||||
}
|
||||
|
||||
static char *
|
||||
_e_wid_file_size_get(off_t st_size)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ EAPI Evas_Object *e_widget_fsel_add(Evas *evas, char *dev, char *path, char *sel
|
|||
void (*sel_func) (void *data, Evas_Object *obj), void *sel_data,
|
||||
void (*chg_func) (void *data, Evas_Object *obj), void *chg_data, int preview);
|
||||
EAPI const char *e_widget_fsel_selection_path_get(Evas_Object *obj);
|
||||
EAPI void e_widget_fsel_path_get(Evas_Object *obj, const char **dev, const char **path);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue