icon selector from fm prop works now. only on "all types of this file" - per
file stuff is unimplemented still. SVN revision: 29829
This commit is contained in:
parent
668ca67d16
commit
ed72cd25ea
|
@ -5092,8 +5092,7 @@ _e_fm2_file_rename_yes_cb(char *text, void *data)
|
|||
{
|
||||
snprintf(oldpath, sizeof(oldpath), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||
snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text);
|
||||
// if (e_filereg_file_protected(oldpath)) return;
|
||||
|
||||
if (e_filereg_file_protected(oldpath)) return;
|
||||
_e_fm2_client_file_move(ic->sd->id, oldpath, newpath, "", 0, -9999, -9999);
|
||||
}
|
||||
}
|
||||
|
@ -5211,7 +5210,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
|
|||
{
|
||||
ici = l->data;
|
||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file);
|
||||
// if (e_filereg_file_protected(buf)) continue;
|
||||
if (e_filereg_file_protected(buf)) continue;
|
||||
printf("rm -rf %s\n", buf);
|
||||
_e_fm2_client_file_del(ic->sd->id, buf);
|
||||
}
|
||||
|
@ -5220,7 +5219,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
|
|||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||
// if (e_filereg_file_protected(buf)) return;
|
||||
if (e_filereg_file_protected(buf)) return;
|
||||
printf("rm -rf %s\n", buf);
|
||||
_e_fm2_client_file_del(ic->sd->id, buf);
|
||||
}
|
||||
|
|
|
@ -662,13 +662,14 @@ _e_file_add_mod(int id, const char *path, int op, int listing)
|
|||
* stat_info[stat size] + broken_link[1] + path[n]\0 + lnk[n]\0 + rlnk[n]\0 */
|
||||
[sizeof(struct stat) + 1 + 4096 + 4096 + 4096];
|
||||
|
||||
lnk = ecore_file_readlink(buf);
|
||||
lnk = ecore_file_readlink(path);
|
||||
if (stat(path, &st) == -1)
|
||||
{
|
||||
if ((path[0] == 0) || (lnk)) broken_lnk = 1;
|
||||
else return;
|
||||
}
|
||||
if ((lnk) && (lnk[0] != '/')) rlnk = ecore_file_realpath(path);
|
||||
else if (lnk) rlnk = strdup(lnk);
|
||||
if (!lnk) lnk = strdup("");
|
||||
if (!rlnk) rlnk = strdup("");
|
||||
|
||||
|
@ -693,6 +694,7 @@ _e_file_add_mod(int id, const char *path, int op, int listing)
|
|||
p += strlen(rlnk) + 1;
|
||||
|
||||
bsz = p - buf;
|
||||
printf("SEND +++ %s | %s | %s\n", path , lnk , rlnk);
|
||||
ecore_ipc_server_send(_e_ipc_server, 6/*E_IPC_DOMAIN_FM*/, op, 0, id,
|
||||
listing, buf, bsz);
|
||||
if (lnk) free(lnk);
|
||||
|
|
|
@ -48,6 +48,10 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E
|
|||
static void _cb_icon_sel(void *data, void *data2);
|
||||
static void _cb_type(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _cb_preview_update(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _cb_fsel_sel(void *data, Evas_Object *obj);
|
||||
static void _cb_fsel_ok(void *data, E_Dialog *dia);
|
||||
static void _cb_fsel_cancel(void *data, E_Dialog *dia);
|
||||
static void _cb_file_change(void *data);
|
||||
|
||||
/* Actual config data we will be playing with whil the dialog is active */
|
||||
struct _E_Config_Dialog_Data
|
||||
|
@ -58,6 +62,8 @@ struct _E_Config_Dialog_Data
|
|||
Evas_Object *icon_wid;
|
||||
Evas_Object *preview;
|
||||
Evas_Object *preview_table;
|
||||
Evas_Object *fsel_wid;
|
||||
E_Dialog *fsel;
|
||||
} gui;
|
||||
/*- BASIC -*/
|
||||
char *file;
|
||||
|
@ -141,7 +147,8 @@ _create_data(E_Config_Dialog *cfd)
|
|||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
/* Free the cfdata */
|
||||
if (cfdata->gui.fsel)
|
||||
e_object_del(E_OBJECT(cfdata->gui.fsel));
|
||||
E_FREE(cfdata->file);
|
||||
E_FREE(cfdata->size);
|
||||
E_FREE(cfdata->mod_date);
|
||||
|
@ -197,29 +204,77 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
{
|
||||
if (cfdata->icon_mime) /* modify mimetype */
|
||||
{
|
||||
Evas_List *l;
|
||||
E_Config_Mime_Icon *mi = NULL;
|
||||
int found = 0;
|
||||
|
||||
if (!cfdata->picon_mime) /* remove previous custom icon info */
|
||||
e_fm2_custom_file_del(buf);
|
||||
for (l = e_config->mime_icons; l; l = l->next)
|
||||
{
|
||||
mi = l->data;
|
||||
if (!mi) continue;
|
||||
if (strcmp(mi->mime, cfdata->mime)) continue;
|
||||
if (mi->icon)
|
||||
{
|
||||
evas_stringshare_del(mi->icon);
|
||||
mi->icon = NULL;
|
||||
}
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
if ((!found) && (cfdata->icon_type != 0))
|
||||
{
|
||||
mi = E_NEW(E_Config_Mime_Icon, 1);
|
||||
mi->mime = evas_stringshare_add(cfdata->mime);
|
||||
e_config->mime_icons = evas_list_append(e_config->mime_icons, mi);
|
||||
}
|
||||
/* FIXME: modify mime info */
|
||||
if (cfdata->icon_type == 0)
|
||||
{
|
||||
if (found)
|
||||
{
|
||||
e_config->mime_icons = evas_list_remove(e_config->mime_icons, mi);
|
||||
if (mi->mime) evas_stringshare_del(mi->mime);
|
||||
if (mi->icon) evas_stringshare_del(mi->icon);
|
||||
free(mi);
|
||||
}
|
||||
}
|
||||
else if (cfdata->icon_type == 1)
|
||||
{
|
||||
mi->icon = evas_stringshare_add("THUMB");
|
||||
}
|
||||
else if (cfdata->icon_type == 2)
|
||||
{
|
||||
mi->icon = evas_stringshare_add(cfdata->icon);
|
||||
}
|
||||
e_config_save_queue();
|
||||
e_fm_mime_icon_cache_flush();
|
||||
}
|
||||
else /* custom for this file */
|
||||
{
|
||||
/* FIXME: custom icons don't work yet */
|
||||
E_Fm2_Custom_File *cf, cf0;
|
||||
|
||||
cf = e_fm2_custom_file_get(buf);
|
||||
if (!cf)
|
||||
{
|
||||
memset(cf, 0, sizeof(E_Fm2_Custom_File));
|
||||
memset(&cf0, 0, sizeof(E_Fm2_Custom_File));
|
||||
cf = &cf0;
|
||||
}
|
||||
cf->icon.type = cfdata->icon_type;
|
||||
if (cf->icon.icon)
|
||||
evas_stringshare_del(cf->icon.icon);
|
||||
cf->icon.icon = NULL;
|
||||
if (cfdata->icon)
|
||||
cf->icon.icon = evas_stringshare_add(cfdata->icon);
|
||||
// don't leak for now
|
||||
// if (cfdata->icon)
|
||||
// cf->icon.icon = evas_stringshare_add(cfdata->icon);
|
||||
cf->icon.valid = 1;
|
||||
e_fm2_custom_file_set(buf, cf);
|
||||
}
|
||||
cfdata->picon_type = cfdata->icon_type;
|
||||
cfdata->picon_mime = cfdata->icon_mime;
|
||||
|
||||
e_fm2_all_icons_update();
|
||||
}
|
||||
|
||||
|
@ -388,9 +443,42 @@ static void
|
|||
_cb_icon_sel(void *data, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
E_Config_Dialog *cfd;
|
||||
E_Dialog *dia;
|
||||
Evas_Object *o;
|
||||
Evas_Coord w, h;
|
||||
|
||||
cfdata = data;
|
||||
/* FIXME: select an icon */
|
||||
if (!cfdata) return;
|
||||
if (cfdata->gui.fsel) return;
|
||||
|
||||
cfd = data2;
|
||||
if (!cfd) return;
|
||||
|
||||
dia = e_dialog_new(cfd->con, "E", "_fm2_file_properties_icon_select_dialog");
|
||||
if (!dia) return;
|
||||
// if (cfdata->type == EDJ)
|
||||
// e_dialog_title_set(dia, _("Select an Edj File"));
|
||||
// else if (cfdata->type == IMG)
|
||||
e_dialog_title_set(dia, _("Select an Image"));
|
||||
|
||||
dia->data = cfdata;
|
||||
o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
|
||||
_cb_fsel_sel, cfdata, NULL, cfdata, 1);
|
||||
|
||||
cfdata->gui.fsel_wid = o;
|
||||
evas_object_show(o);
|
||||
e_widget_min_size_get(o, &w, &h);
|
||||
e_dialog_content_set(dia, o, w, h);
|
||||
|
||||
e_dialog_button_add(dia, _("OK"), NULL, _cb_fsel_ok, cfdata);
|
||||
e_dialog_button_add(dia, _("Cancel"), NULL, _cb_fsel_cancel, cfdata);
|
||||
e_dialog_resizable_set(dia, 1);
|
||||
e_win_centered_set(dia->win, 1);
|
||||
e_dialog_show(dia);
|
||||
e_win_resize(dia->win, 475, 341);
|
||||
|
||||
cfdata->gui.fsel = dia;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -415,3 +503,56 @@ _cb_preview_update(void *data, Evas_Object *obj, void *event_info)
|
|||
cfdata->gui.preview,
|
||||
0, 0, 1, 1, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_fsel_sel(void *data, Evas_Object *obj)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_fsel_ok(void *data, E_Dialog *dia)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
const char *file, *ext;
|
||||
Evas_Object *icon = NULL;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
|
||||
file = e_widget_fsel_selection_path_get(cfdata->gui.fsel_wid);
|
||||
E_FREE(cfdata->icon);
|
||||
if (file) cfdata->icon = strdup(file);
|
||||
_cb_fsel_cancel(data, dia);
|
||||
ext = strrchr(cfdata->icon, '.');
|
||||
if (ext)
|
||||
{
|
||||
if (!strcasecmp(ext, ".edj"))
|
||||
{
|
||||
icon = edje_object_add( evas_object_evas_get(cfdata->gui.icon_wid));
|
||||
edje_object_file_set(icon, cfdata->file, "icon");
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = e_widget_image_add_from_file(evas_object_evas_get(cfdata->gui.icon_wid), cfdata->icon, 48, 48);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = e_widget_image_add_from_file(evas_object_evas_get(cfdata->gui.icon_wid), cfdata->icon, 48, 48);
|
||||
}
|
||||
if (icon) e_widget_button_icon_set(cfdata->gui.icon_wid, icon);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_fsel_cancel(void *data, E_Dialog *dia)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
e_object_del(E_OBJECT(dia));
|
||||
cfdata->gui.fsel = NULL;
|
||||
}
|
||||
|
|
|
@ -712,10 +712,10 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
|
|||
e_fwin_new(fwin->win->container, ici->link, "/");
|
||||
else if ((ici->link) && (ici->removable))
|
||||
e_fwin_new(fwin->win->container, ici->link, "/");
|
||||
else if (ici->link)
|
||||
else if (ici->real_link)
|
||||
{
|
||||
if (S_ISDIR(ici->statinfo.st_mode))
|
||||
e_fwin_new(fwin->win->container, NULL, ici->link);
|
||||
e_fwin_new(fwin->win->container, NULL, ici->real_link);
|
||||
else
|
||||
need_dia = 1;
|
||||
}
|
||||
|
|
|
@ -229,7 +229,12 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
break;
|
||||
case DEFAULT:
|
||||
if (found)
|
||||
e_config->mime_icons = evas_list_remove(e_config->mime_icons, mi);
|
||||
{
|
||||
e_config->mime_icons = evas_list_remove(e_config->mime_icons, mi);
|
||||
if (mi->mime) evas_stringshare_del(mi->mime);
|
||||
if (mi->icon) evas_stringshare_del(mi->icon);
|
||||
free(mi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,10 +164,11 @@ _e_wid_fsel_favorites_selected(void *data, Evas_Object *obj, void *event_info)
|
|||
selected = e_fm2_selected_list_get(wd->o_favorites_fm);
|
||||
if (!selected) return;
|
||||
ici = selected->data;
|
||||
printf("SEL %s | %s | %s\n", ici->file, ici->real_link, ici->link);
|
||||
if ((ici->link) && (ici->mount))
|
||||
e_fm2_path_set(wd->o_files_fm, ici->link, "/");
|
||||
else if (ici->link)
|
||||
e_fm2_path_set(wd->o_files_fm, NULL, ici->link);
|
||||
else if (ici->real_link)
|
||||
e_fm2_path_set(wd->o_files_fm, NULL, ici->real_link);
|
||||
evas_list_free(selected);
|
||||
e_widget_scrollframe_child_pos_set(wd->o_files_frame, 0, 0);
|
||||
e_widget_entry_text_set(wd->o_entry,
|
||||
|
|
Loading…
Reference in New Issue