fix fm exec application remembering. :)

SVN revision: 74203
devs/princeamd/enlightenment-0.17-elive
Carsten Haitzler 11 years ago
parent 23296b46ec
commit 1d5f246de1
  1. 25
      src/bin/e_exehist.c
  2. 30
      src/bin/e_fm.c
  3. 28
      src/modules/fileman/e_fwin.c

@ -278,6 +278,8 @@ e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop)
const char *f;
E_Exehist_Item *ei;
Eina_List *l;
char buf[PATH_MAX];
Efreet_Ini *ini;
if ((!mime) || (!desktop)) 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);
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)
{
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;
Eina_List *l;
fprintf(stderr, "e_exehist_mime_desktop_get(%s)\n", mime);
if (!mime) return NULL;
_e_exehist_load();
fprintf(stderr, "x\n");
if (!_e_exehist) return NULL;
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)))
{
desktop = NULL;
if (ei->exe) desktop = efreet_util_desktop_file_id_find(ei->exe);
fprintf(stderr, " desk = %p\n", desktop);
if (desktop)
{
_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)
{
char buf[PATH_MAX];
const char **itr, *group;
const char **itr = NULL, *group = NULL;
const char *known_groups[] = {
NULL,
"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' */
NULL
};
Evas_Object *o;
if (!_e_fm2_icon_realpath(ic, buf, sizeof(buf)))
return NULL;
if (!_e_fm2_icon_realpath(ic, buf, sizeof(buf))) return NULL;
known_groups[0] = ic->sd->config->icon.key_hint;
if (known_groups[0])
itr = known_groups;
else
itr = known_groups + 1;
if (known_groups[0]) itr = known_groups;
else itr = known_groups + 1;
for (; *itr; itr++)
if (edje_file_group_exists(buf, *itr))
break;
{
if (edje_file_group_exists(buf, *itr)) break;
}
if (*itr)
group = *itr;
group = eina_stringshare_add(*itr);
else
{
Eina_List *l = edje_file_collection_list(buf);
if (!l)
return NULL;
group = eina_list_data_get(l);
if (!l) return NULL;
group = eina_stringshare_add(eina_list_data_get(l));
edje_file_collection_list_free(l);
}
return _e_fm2_icon_thumb_get(evas, ic, group, cb, data, force_gen, type_ret);
if (!group) return NULL;
o = _e_fm2_icon_thumb_get(evas, ic, group, cb, data, force_gen, type_ret);
eina_stringshare_del(group);
return o;
}
/**

@ -932,6 +932,8 @@ _e_fwin_desktop_run(Efreet_Desktop *desktop,
E_Fwin *fwin = page->fwin;
E_Fm2_Icon_Info *ici;
char *file;
skip_history = EINA_FALSE;
selected = e_fm2_selected_list_get(page->fm_obj);
if (!selected) return;
@ -963,15 +965,19 @@ _e_fwin_desktop_run(Efreet_Desktop *desktop,
files = eina_list_append(files, strdup(ici->file));
}
}
eina_list_free(selected);
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)
e_exec(fwin->zone, desktop, NULL, files, "fwin");
EINA_LIST_FREE(files, file)
free(file);
eina_list_free(selected);
EINA_LIST_FREE(files, file) free(file);
chdir(pcwd);
}
@ -1099,6 +1105,7 @@ _e_fwin_file_exec(E_Fwin_Page *page,
e_exec(fwin->win->border->zone, desktop, NULL, NULL, NULL);
else if (fwin->zone)
e_exec(fwin->zone, desktop, NULL, NULL, NULL);
e_exehist_mime_desktop_add(ici->mime, desktop);
efreet_desktop_free(desktop);
}
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);
fprintf(stderr, "GOGOGOGOOGOGOG\n");
if (!always)
{
/* 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;
need_dia = 1;
fprintf(stderr, "XXXXX %i %p\n", has_default, apps);
if ((has_default) && (apps)) desk = apps->data;
else if (mlist) desk = e_exehist_mime_desktop_get(mlist->data);
fprintf(stderr, "mlist = %p\n", mlist);
getcwd(pcwd, sizeof(pcwd));
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"))
need_dia = 0;
}
if (!need_dia)
{
if (mlist)
e_exehist_mime_desktop_add(mlist->data, desk);
}
}
EINA_LIST_FREE(files_list, file)
free(file);
@ -2033,8 +2048,7 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page,
chdir(pcwd);
if (!need_dia)
{
EINA_LIST_FREE(apps, desk)
efreet_desktop_free(desk);
EINA_LIST_FREE(apps, desk) efreet_desktop_free(desk);
mlist = eina_list_free(mlist);
return;
}

Loading…
Cancel
Save