forked from enlightenment/enlightenment
fix fm exec application remembering. :)
SVN revision: 74203
This commit is contained in:
parent
23296b46ec
commit
1d5f246de1
|
@ -278,6 +278,8 @@ e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop)
|
||||||
const char *f;
|
const char *f;
|
||||||
E_Exehist_Item *ei;
|
E_Exehist_Item *ei;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
Efreet_Ini *ini;
|
||||||
|
|
||||||
if ((!mime) || (!desktop)) return;
|
if ((!mime) || (!desktop)) return;
|
||||||
if (!desktop->orig_path) return;
|
if (!desktop->orig_path) return;
|
||||||
|
@ -286,6 +288,25 @@ e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop)
|
||||||
|
|
||||||
f = efreet_util_path_to_file_id(desktop->orig_path);
|
f = efreet_util_path_to_file_id(desktop->orig_path);
|
||||||
if (!f) return;
|
if (!f) return;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%s/applications/defaults.list",
|
||||||
|
efreet_data_home_get());
|
||||||
|
ini = efreet_ini_new(buf);
|
||||||
|
fprintf(stderr, "try open %s = %p\n", buf, ini);
|
||||||
|
if (ini)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "SAVE mime %s with %s\n", mime, desktop->orig_path);
|
||||||
|
if (!efreet_ini_section_set(ini, "Default Applications"))
|
||||||
|
{
|
||||||
|
efreet_ini_section_add(ini, "Default Applications");
|
||||||
|
efreet_ini_section_set(ini, "Default Applications");
|
||||||
|
}
|
||||||
|
if (desktop->orig_path)
|
||||||
|
efreet_ini_string_set(ini, mime, ecore_file_file_get(desktop->orig_path));
|
||||||
|
efreet_ini_save(ini, buf);
|
||||||
|
efreet_ini_free(ini);
|
||||||
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(_e_exehist->mimes, l, ei)
|
EINA_LIST_FOREACH(_e_exehist->mimes, l, ei)
|
||||||
{
|
{
|
||||||
if ((ei->launch_method) && (!strcmp(mime, ei->launch_method)))
|
if ((ei->launch_method) && (!strcmp(mime, ei->launch_method)))
|
||||||
|
@ -325,15 +346,19 @@ e_exehist_mime_desktop_get(const char *mime)
|
||||||
E_Exehist_Item *ei;
|
E_Exehist_Item *ei;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
|
fprintf(stderr, "e_exehist_mime_desktop_get(%s)\n", mime);
|
||||||
if (!mime) return NULL;
|
if (!mime) return NULL;
|
||||||
_e_exehist_load();
|
_e_exehist_load();
|
||||||
|
fprintf(stderr, "x\n");
|
||||||
if (!_e_exehist) return NULL;
|
if (!_e_exehist) return NULL;
|
||||||
EINA_LIST_FOREACH(_e_exehist->mimes, l, ei)
|
EINA_LIST_FOREACH(_e_exehist->mimes, l, ei)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "look for %s == %s\n", mime, ei->launch_method);
|
||||||
if ((ei->launch_method) && (!strcmp(mime, ei->launch_method)))
|
if ((ei->launch_method) && (!strcmp(mime, ei->launch_method)))
|
||||||
{
|
{
|
||||||
desktop = NULL;
|
desktop = NULL;
|
||||||
if (ei->exe) desktop = efreet_util_desktop_file_id_find(ei->exe);
|
if (ei->exe) desktop = efreet_util_desktop_file_id_find(ei->exe);
|
||||||
|
fprintf(stderr, " desk = %p\n", desktop);
|
||||||
if (desktop)
|
if (desktop)
|
||||||
{
|
{
|
||||||
_e_exehist_unload_queue();
|
_e_exehist_unload_queue();
|
||||||
|
|
|
@ -1824,7 +1824,7 @@ static Evas_Object *
|
||||||
_e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb cb, void *data, int force_gen, const char **type_ret)
|
_e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb cb, void *data, int force_gen, const char **type_ret)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
const char **itr, *group;
|
const char **itr = NULL, *group = NULL;
|
||||||
const char *known_groups[] = {
|
const char *known_groups[] = {
|
||||||
NULL,
|
NULL,
|
||||||
"e/desktop/background",
|
"e/desktop/background",
|
||||||
|
@ -1833,32 +1833,32 @@ _e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb cb, v
|
||||||
/* XXX TODO: add more? example 'screenshot', 'preview' */
|
/* XXX TODO: add more? example 'screenshot', 'preview' */
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
if (!_e_fm2_icon_realpath(ic, buf, sizeof(buf)))
|
if (!_e_fm2_icon_realpath(ic, buf, sizeof(buf))) return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
known_groups[0] = ic->sd->config->icon.key_hint;
|
known_groups[0] = ic->sd->config->icon.key_hint;
|
||||||
if (known_groups[0])
|
if (known_groups[0]) itr = known_groups;
|
||||||
itr = known_groups;
|
else itr = known_groups + 1;
|
||||||
else
|
|
||||||
itr = known_groups + 1;
|
|
||||||
|
|
||||||
for (; *itr; itr++)
|
for (; *itr; itr++)
|
||||||
if (edje_file_group_exists(buf, *itr))
|
{
|
||||||
break;
|
if (edje_file_group_exists(buf, *itr)) break;
|
||||||
|
}
|
||||||
|
|
||||||
if (*itr)
|
if (*itr)
|
||||||
group = *itr;
|
group = eina_stringshare_add(*itr);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Eina_List *l = edje_file_collection_list(buf);
|
Eina_List *l = edje_file_collection_list(buf);
|
||||||
if (!l)
|
if (!l) return NULL;
|
||||||
return NULL;
|
group = eina_stringshare_add(eina_list_data_get(l));
|
||||||
group = eina_list_data_get(l);
|
|
||||||
edje_file_collection_list_free(l);
|
edje_file_collection_list_free(l);
|
||||||
}
|
}
|
||||||
|
if (!group) return NULL;
|
||||||
return _e_fm2_icon_thumb_get(evas, ic, group, cb, data, force_gen, type_ret);
|
o = _e_fm2_icon_thumb_get(evas, ic, group, cb, data, force_gen, type_ret);
|
||||||
|
eina_stringshare_del(group);
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -933,6 +933,8 @@ _e_fwin_desktop_run(Efreet_Desktop *desktop,
|
||||||
E_Fm2_Icon_Info *ici;
|
E_Fm2_Icon_Info *ici;
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
|
skip_history = EINA_FALSE;
|
||||||
|
|
||||||
selected = e_fm2_selected_list_get(page->fm_obj);
|
selected = e_fm2_selected_list_get(page->fm_obj);
|
||||||
if (!selected) return;
|
if (!selected) return;
|
||||||
|
|
||||||
|
@ -963,15 +965,19 @@ _e_fwin_desktop_run(Efreet_Desktop *desktop,
|
||||||
files = eina_list_append(files, strdup(ici->file));
|
files = eina_list_append(files, strdup(ici->file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eina_list_free(selected);
|
|
||||||
|
|
||||||
if ((fwin->win) && (desktop))
|
if ((fwin->win) && (desktop))
|
||||||
|
{
|
||||||
e_exec(fwin->win->border->zone, desktop, NULL, files, "fwin");
|
e_exec(fwin->win->border->zone, desktop, NULL, files, "fwin");
|
||||||
|
ici = selected->data;
|
||||||
|
if ((ici) && (ici->mime) && (desktop) && !(skip_history))
|
||||||
|
e_exehist_mime_desktop_add(ici->mime, desktop);
|
||||||
|
}
|
||||||
else if (fwin->zone && desktop)
|
else if (fwin->zone && desktop)
|
||||||
e_exec(fwin->zone, desktop, NULL, files, "fwin");
|
e_exec(fwin->zone, desktop, NULL, files, "fwin");
|
||||||
|
|
||||||
EINA_LIST_FREE(files, file)
|
eina_list_free(selected);
|
||||||
free(file);
|
|
||||||
|
EINA_LIST_FREE(files, file) free(file);
|
||||||
|
|
||||||
chdir(pcwd);
|
chdir(pcwd);
|
||||||
}
|
}
|
||||||
|
@ -1099,6 +1105,7 @@ _e_fwin_file_exec(E_Fwin_Page *page,
|
||||||
e_exec(fwin->win->border->zone, desktop, NULL, NULL, NULL);
|
e_exec(fwin->win->border->zone, desktop, NULL, NULL, NULL);
|
||||||
else if (fwin->zone)
|
else if (fwin->zone)
|
||||||
e_exec(fwin->zone, desktop, NULL, NULL, NULL);
|
e_exec(fwin->zone, desktop, NULL, NULL, NULL);
|
||||||
|
e_exehist_mime_desktop_add(ici->mime, desktop);
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1971,6 +1978,7 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page,
|
||||||
|
|
||||||
apps = _e_fwin_suggested_apps_list_get(files, &mlist, &has_default);
|
apps = _e_fwin_suggested_apps_list_get(files, &mlist, &has_default);
|
||||||
|
|
||||||
|
fprintf(stderr, "GOGOGOGOOGOGOG\n");
|
||||||
if (!always)
|
if (!always)
|
||||||
{
|
{
|
||||||
/* FIXME: well this is simplisitic - if only 1 mime type is being
|
/* FIXME: well this is simplisitic - if only 1 mime type is being
|
||||||
|
@ -1994,8 +2002,10 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page,
|
||||||
Eina_List *files_list = NULL;
|
Eina_List *files_list = NULL;
|
||||||
|
|
||||||
need_dia = 1;
|
need_dia = 1;
|
||||||
|
fprintf(stderr, "XXXXX %i %p\n", has_default, apps);
|
||||||
if ((has_default) && (apps)) desk = apps->data;
|
if ((has_default) && (apps)) desk = apps->data;
|
||||||
else if (mlist) desk = e_exehist_mime_desktop_get(mlist->data);
|
else if (mlist) desk = e_exehist_mime_desktop_get(mlist->data);
|
||||||
|
fprintf(stderr, "mlist = %p\n", mlist);
|
||||||
getcwd(pcwd, sizeof(pcwd));
|
getcwd(pcwd, sizeof(pcwd));
|
||||||
chdir(e_fm2_real_path_get(page->fm_obj));
|
chdir(e_fm2_real_path_get(page->fm_obj));
|
||||||
|
|
||||||
|
@ -2026,6 +2036,11 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page,
|
||||||
if (e_exec(fwin->zone, desk, NULL, files_list, "fwin"))
|
if (e_exec(fwin->zone, desk, NULL, files_list, "fwin"))
|
||||||
need_dia = 0;
|
need_dia = 0;
|
||||||
}
|
}
|
||||||
|
if (!need_dia)
|
||||||
|
{
|
||||||
|
if (mlist)
|
||||||
|
e_exehist_mime_desktop_add(mlist->data, desk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EINA_LIST_FREE(files_list, file)
|
EINA_LIST_FREE(files_list, file)
|
||||||
free(file);
|
free(file);
|
||||||
|
@ -2033,8 +2048,7 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page,
|
||||||
chdir(pcwd);
|
chdir(pcwd);
|
||||||
if (!need_dia)
|
if (!need_dia)
|
||||||
{
|
{
|
||||||
EINA_LIST_FREE(apps, desk)
|
EINA_LIST_FREE(apps, desk) efreet_desktop_free(desk);
|
||||||
efreet_desktop_free(desk);
|
|
||||||
mlist = eina_list_free(mlist);
|
mlist = eina_list_free(mlist);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue