forked from enlightenment/enlightenment
- added function to get path or url from Evry_File, so that sources dont have to set both.
- check evry_file_path/uri_get() before using either. when return not NULL file->path/uri can b$ - make 'open with' plugin only show apps mathings the files mimetype - added 'open with' action which takes any app as second argument - sort actions that match item type before those matching subtype SVN revision: 48418
This commit is contained in:
parent
5aa48ed402
commit
3a5b9456e9
|
@ -16,7 +16,7 @@ struct _Plugin
|
||||||
Eina_List *apps_mime;
|
Eina_List *apps_mime;
|
||||||
Eina_List *apps_all;
|
Eina_List *apps_all;
|
||||||
Eina_List *apps_hist;
|
Eina_List *apps_hist;
|
||||||
const Evry_Item *candidate;
|
|
||||||
Eina_Hash *added;
|
Eina_Hash *added;
|
||||||
|
|
||||||
Evry_Item_App *app_command;
|
Evry_Item_App *app_command;
|
||||||
|
@ -33,22 +33,20 @@ struct _E_Exe_List
|
||||||
Eina_List *list;
|
Eina_List *list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _Module_Config
|
struct _Module_Config
|
||||||
{
|
{
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
unsigned char list_executables;
|
unsigned char list_executables;
|
||||||
|
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
E_Module *module;
|
E_Module *module;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Module_Config *_conf;
|
static Module_Config *_conf;
|
||||||
|
|
||||||
static Evry_Plugin *plug_apps = NULL;
|
static Evry_Plugin *plug_apps = NULL;
|
||||||
|
static Evry_Plugin *plug_apps2 = NULL;
|
||||||
static Evry_Plugin *plug_action = NULL;
|
static Evry_Plugin *plug_action = NULL;
|
||||||
|
static Eina_List *_actions = NULL;
|
||||||
|
static Evry_Item *_act_open_with = NULL;
|
||||||
static Eina_List *exe_path = NULL;
|
static Eina_List *exe_path = NULL;
|
||||||
static Ecore_Idler *exe_scan_idler = NULL;
|
static Ecore_Idler *exe_scan_idler = NULL;
|
||||||
static E_Config_DD *exelist_exe_edd = NULL;
|
static E_Config_DD *exelist_exe_edd = NULL;
|
||||||
|
@ -57,9 +55,8 @@ static DIR *exe_dir = NULL;
|
||||||
static Eina_List *exe_list = NULL;
|
static Eina_List *exe_list = NULL;
|
||||||
static Eina_List *exe_list2 = NULL;
|
static Eina_List *exe_list2 = NULL;
|
||||||
|
|
||||||
static Eina_List *_actions = NULL;
|
static void _scan_executables();
|
||||||
|
|
||||||
static int _scan_idler(void *data);
|
|
||||||
|
|
||||||
static void _hash_free(void *data)
|
static void _hash_free(void *data)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +64,6 @@ static void _hash_free(void *data)
|
||||||
evry_item_free(EVRY_ITEM(app));
|
evry_item_free(EVRY_ITEM(app));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
|
_begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
|
@ -75,22 +71,23 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
|
|
||||||
const char *mime;
|
const char *mime;
|
||||||
|
|
||||||
if (!CHECK_TYPE(item, EVRY_TYPE_FILE))
|
if (!CHECK_TYPE(item, EVRY_TYPE_FILE) &&
|
||||||
|
!CHECK_SUBTYPE(item, EVRY_TYPE_FILE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
GET_FILE(file, item);
|
GET_FILE(file, item);
|
||||||
Efreet_Desktop *d, *d2;
|
Efreet_Desktop *d, *d2;
|
||||||
|
|
||||||
if (!file->path) return NULL;
|
if (!evry_file_path_get(file))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!file->mime)
|
if (!file->mime)
|
||||||
mime = efreet_mime_type_get(file->path);
|
mime = efreet_mime_type_get(file->path);
|
||||||
else
|
else
|
||||||
mime = file->mime;
|
mime = file->mime;
|
||||||
|
|
||||||
if (!mime) return NULL;
|
if (!mime)
|
||||||
|
return NULL;
|
||||||
p->candidate = item;
|
|
||||||
|
|
||||||
p->apps_mime = efreet_util_desktop_mime_list(mime);
|
p->apps_mime = efreet_util_desktop_mime_list(mime);
|
||||||
|
|
||||||
|
@ -131,57 +128,26 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
GET_PLUGIN(p, plugin);
|
GET_PLUGIN(p, plugin);
|
||||||
|
|
||||||
|
DBG("begin %p %p\n", item, _act_open_with);
|
||||||
|
|
||||||
|
if (item && (item != _act_open_with))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
p->added = eina_hash_string_small_new(_hash_free);
|
p->added = eina_hash_string_small_new(_hash_free);
|
||||||
|
|
||||||
if (!_conf->list_executables)
|
if (_conf->list_executables)
|
||||||
return plugin;
|
_scan_executables();
|
||||||
|
|
||||||
/* taken from exebuf module */
|
|
||||||
char *path, *pp, *last;
|
|
||||||
E_Exe_List *el;
|
|
||||||
|
|
||||||
el = e_config_domain_load("exebuf_exelist_cache", exelist_edd);
|
|
||||||
if (el)
|
|
||||||
{
|
|
||||||
E_Exe *ee;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(el->list, ee)
|
|
||||||
{
|
|
||||||
exe_list = eina_list_append(exe_list, strdup(ee->path));
|
|
||||||
eina_stringshare_del(ee->path);
|
|
||||||
free(ee);
|
|
||||||
}
|
|
||||||
free(el);
|
|
||||||
}
|
|
||||||
path = getenv("PATH");
|
|
||||||
if (path)
|
|
||||||
{
|
|
||||||
path = strdup(path);
|
|
||||||
last = path;
|
|
||||||
for (pp = path; pp[0]; pp++)
|
|
||||||
{
|
|
||||||
if (pp[0] == ':') pp[0] = '\0';
|
|
||||||
if (pp[0] == 0)
|
|
||||||
{
|
|
||||||
exe_path = eina_list_append(exe_path, strdup(last));
|
|
||||||
last = pp + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pp > last)
|
|
||||||
exe_path = eina_list_append(exe_path, strdup(last));
|
|
||||||
free(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
exe_scan_idler = ecore_idler_add(_scan_idler, NULL);
|
|
||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_finish(Evry_Plugin *plugin)
|
_finish(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
GET_PLUGIN(p, plugin);
|
GET_PLUGIN(p, plugin);
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
|
char *str;
|
||||||
|
|
||||||
if (p->added)
|
if (p->added)
|
||||||
eina_hash_free(p->added);
|
eina_hash_free(p->added);
|
||||||
|
@ -194,15 +160,8 @@ _finish(Evry_Plugin *plugin)
|
||||||
EINA_LIST_FREE(p->apps_hist, desktop)
|
EINA_LIST_FREE(p->apps_hist, desktop)
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
|
|
||||||
if (plugin == plug_action)
|
if (_conf->list_executables)
|
||||||
{
|
{
|
||||||
EINA_LIST_FREE(p->apps_mime, desktop)
|
|
||||||
efreet_desktop_free(desktop);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
|
|
||||||
if (exe_dir)
|
if (exe_dir)
|
||||||
{
|
{
|
||||||
closedir(exe_dir);
|
closedir(exe_dir);
|
||||||
|
@ -227,6 +186,21 @@ _finish(Evry_Plugin *plugin)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_finish_mime(Evry_Plugin *plugin)
|
||||||
|
{
|
||||||
|
GET_PLUGIN(p, plugin);
|
||||||
|
Efreet_Desktop *desktop;
|
||||||
|
|
||||||
|
if (p->added)
|
||||||
|
eina_hash_free(p->added);
|
||||||
|
|
||||||
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
|
EINA_LIST_FREE(p->apps_mime, desktop)
|
||||||
|
efreet_desktop_free(desktop);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_exec_open_file_action(Evry_Action *act)
|
_exec_open_file_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
|
@ -631,6 +605,26 @@ _add_executables(Plugin *p, const char *input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_fetch_mime(Evry_Plugin *plugin, const char *input)
|
||||||
|
{
|
||||||
|
GET_PLUGIN(p, plugin);
|
||||||
|
Eina_List *l;
|
||||||
|
Evry_Item *it;
|
||||||
|
|
||||||
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
|
/* add apps for a given mimetype */
|
||||||
|
_add_desktop_list(p, p->apps_mime, input);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(plugin->items, l, it)
|
||||||
|
evry_history_item_usage_set(evry_hist->actions, it, input, NULL);
|
||||||
|
|
||||||
|
if (input)
|
||||||
|
EVRY_PLUGIN_ITEMS_SORT(plugin, _cb_sort);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_fetch(Evry_Plugin *plugin, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
|
@ -639,18 +633,11 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
char *file;
|
/* char *file; */
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p)
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
/* add apps for a given mimetype */
|
if (input && !(p->apps_all))
|
||||||
if (plugin == plug_action)
|
|
||||||
_add_desktop_list(p, p->apps_mime, input);
|
|
||||||
|
|
||||||
/* add apps matching input */
|
|
||||||
if (input)
|
|
||||||
{
|
|
||||||
if (!p->apps_all)
|
|
||||||
{
|
{
|
||||||
Eina_List *apps = NULL;
|
Eina_List *apps = NULL;
|
||||||
Eina_List *cat_ss;
|
Eina_List *cat_ss;
|
||||||
|
@ -673,48 +660,40 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
p->apps_all = apps;
|
p->apps_all = apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* .desktop files */
|
||||||
_add_desktop_list(p, p->apps_all, input);
|
_add_desktop_list(p, p->apps_all, input);
|
||||||
}
|
|
||||||
|
/* add executables */
|
||||||
|
_add_executables(p, input);
|
||||||
|
|
||||||
|
/* FIXME update last used from exehist */
|
||||||
|
/* EINA_LIST_FOREACH(e_exehist_list_get(), l, file)
|
||||||
|
* {
|
||||||
|
* double last_used = e_exehist_newest_run_get(file);
|
||||||
|
* History_Item *hi;
|
||||||
|
* it = (Evry_Item *)_item_add(p, NULL, file, 1);
|
||||||
|
* if (!eina_hash_find(evry_hist->subjects, it->id))
|
||||||
|
* {
|
||||||
|
* hi = evry_history_add(evry_hist->subjects, it, NULL, NULL);
|
||||||
|
* if (hi) hi->last_used = last_used;
|
||||||
|
* }
|
||||||
|
* } */
|
||||||
|
|
||||||
/* add exe history items */
|
/* add exe history items */
|
||||||
else if (!plugin->items)
|
if (!plugin->items)
|
||||||
{
|
{
|
||||||
if (!p->apps_hist)
|
if (!p->apps_hist)
|
||||||
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
||||||
else
|
else
|
||||||
_add_desktop_list(p, p->apps_hist, NULL);
|
_add_desktop_list(p, p->apps_hist, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add executables */
|
|
||||||
_add_executables(p, input);
|
|
||||||
|
|
||||||
if (plugin == plug_action)
|
|
||||||
{
|
|
||||||
EINA_LIST_FOREACH(plugin->items, l, it)
|
|
||||||
evry_history_item_usage_set(evry_hist->actions, it, input, NULL);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(plugin->items, l, it)
|
EINA_LIST_FOREACH(plugin->items, l, it)
|
||||||
evry_history_item_usage_set(evry_hist->subjects, it, input, NULL);
|
evry_history_item_usage_set(evry_hist->subjects, it, input, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
if (!input && plugin != plug_action)
|
|
||||||
{
|
|
||||||
EINA_LIST_FOREACH(e_exehist_list_get(), l, file)
|
|
||||||
{
|
|
||||||
double last_used = e_exehist_newest_run_get(file);
|
|
||||||
History_Item *hi;
|
|
||||||
it = (Evry_Item *)_item_add(p, NULL, file, 1);
|
|
||||||
if (!eina_hash_find(evry_hist->subjects, it->id))
|
|
||||||
{
|
|
||||||
hi = evry_history_add(evry_hist->subjects, it, NULL, NULL);
|
|
||||||
if (hi) hi->last_used = last_used;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin != plug_action || input)
|
|
||||||
EVRY_PLUGIN_ITEMS_SORT(plugin, _cb_sort);
|
EVRY_PLUGIN_ITEMS_SORT(plugin, _cb_sort);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -766,6 +745,12 @@ _exec_app_action(Evry_Action *act)
|
||||||
return evry_util_exec_app(act->it1.item, act->it2.item);
|
return evry_util_exec_app(act->it1.item, act->it2.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_exec_file_action(Evry_Action *act)
|
||||||
|
{
|
||||||
|
return evry_util_exec_app(act->it2.item, act->it1.item);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_exec_term_action(Evry_Action *act)
|
_exec_term_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
|
@ -950,8 +935,15 @@ _plugins_init(void)
|
||||||
evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
|
evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
|
||||||
plug_apps = p;
|
plug_apps = p;
|
||||||
|
|
||||||
|
p = EVRY_PLUGIN_NEW(Plugin, N_("Applications"), NULL, EVRY_TYPE_APP,
|
||||||
|
_begin, _finish, _fetch, NULL);
|
||||||
|
p->complete = &_complete;
|
||||||
|
p->config_path = "extensions/everything-apps";
|
||||||
|
evry_plugin_register(p, EVRY_PLUGIN_OBJECT, 1);
|
||||||
|
plug_apps2 = p;
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Plugin, N_("Open With..."), NULL, EVRY_TYPE_APP,
|
p = EVRY_PLUGIN_NEW(Plugin, N_("Open With..."), NULL, EVRY_TYPE_APP,
|
||||||
_begin_open_with, _finish, _fetch, NULL);
|
_begin_open_with, _finish_mime, _fetch_mime, NULL);
|
||||||
|
|
||||||
p->config_path = "extensions/everything-apps";
|
p->config_path = "extensions/everything-apps";
|
||||||
evry_plugin_register(p, EVRY_PLUGIN_ACTION, 1);
|
evry_plugin_register(p, EVRY_PLUGIN_ACTION, 1);
|
||||||
|
@ -998,6 +990,13 @@ _plugins_init(void)
|
||||||
_exec_sudo_action, NULL);
|
_exec_sudo_action, NULL);
|
||||||
_actions = eina_list_append(_actions, act);
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
|
act = EVRY_ACTION_NEW(N_("Open with..."),
|
||||||
|
EVRY_TYPE_FILE, EVRY_TYPE_APP,
|
||||||
|
"everything-launch",
|
||||||
|
_exec_file_action, NULL);
|
||||||
|
_act_open_with = EVRY_ITEM(act);
|
||||||
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(_actions, l, act)
|
EINA_LIST_FOREACH(_actions, l, act)
|
||||||
evry_action_register(act, prio++);
|
evry_action_register(act, prio++);
|
||||||
|
|
||||||
|
@ -1010,6 +1009,7 @@ _plugins_shutdown(void)
|
||||||
Evry_Action *act;
|
Evry_Action *act;
|
||||||
|
|
||||||
EVRY_PLUGIN_FREE(plug_apps);
|
EVRY_PLUGIN_FREE(plug_apps);
|
||||||
|
EVRY_PLUGIN_FREE(plug_apps2);
|
||||||
EVRY_PLUGIN_FREE(plug_action);
|
EVRY_PLUGIN_FREE(plug_action);
|
||||||
|
|
||||||
EINA_LIST_FREE(_actions, act)
|
EINA_LIST_FREE(_actions, act)
|
||||||
|
@ -1236,7 +1236,6 @@ e_modapi_save(E_Module *m)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
@ -1355,3 +1354,45 @@ _scan_idler(void *data)
|
||||||
/* we have mroe scannign to do */
|
/* we have mroe scannign to do */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_scan_executables()
|
||||||
|
{
|
||||||
|
/* taken from exebuf module */
|
||||||
|
char *path, *pp, *last;
|
||||||
|
E_Exe_List *el;
|
||||||
|
|
||||||
|
el = e_config_domain_load("exebuf_exelist_cache", exelist_edd);
|
||||||
|
if (el)
|
||||||
|
{
|
||||||
|
E_Exe *ee;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(el->list, ee)
|
||||||
|
{
|
||||||
|
exe_list = eina_list_append(exe_list, strdup(ee->path));
|
||||||
|
eina_stringshare_del(ee->path);
|
||||||
|
free(ee);
|
||||||
|
}
|
||||||
|
free(el);
|
||||||
|
}
|
||||||
|
path = getenv("PATH");
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
path = strdup(path);
|
||||||
|
last = path;
|
||||||
|
for (pp = path; pp[0]; pp++)
|
||||||
|
{
|
||||||
|
if (pp[0] == ':') pp[0] = '\0';
|
||||||
|
if (pp[0] == 0)
|
||||||
|
{
|
||||||
|
exe_path = eina_list_append(exe_path, strdup(last));
|
||||||
|
last = pp + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pp > last)
|
||||||
|
exe_path = eina_list_append(exe_path, strdup(last));
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
exe_scan_idler = ecore_idler_add(_scan_idler, NULL);
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
#define CMD_SHOW_HIDDEN 2
|
#define CMD_SHOW_HIDDEN 2
|
||||||
#define CMD_SHOW_PARENT 3
|
#define CMD_SHOW_PARENT 3
|
||||||
|
|
||||||
|
#define ACT_TRASH 1
|
||||||
|
#define ACT_DELETE 2
|
||||||
|
#define ACT_COPY 3
|
||||||
|
#define ACT_MOVE 4
|
||||||
|
|
||||||
typedef struct _Plugin Plugin;
|
typedef struct _Plugin Plugin;
|
||||||
typedef struct _Data Data;
|
typedef struct _Data Data;
|
||||||
typedef struct _Module_Config Module_Config;
|
typedef struct _Module_Config Module_Config;
|
||||||
|
@ -121,6 +126,7 @@ static void
|
||||||
_item_free(Evry_Item *it)
|
_item_free(Evry_Item *it)
|
||||||
{
|
{
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
if (file->url) eina_stringshare_del(file->url);
|
||||||
if (file->path) eina_stringshare_del(file->path);
|
if (file->path) eina_stringshare_del(file->path);
|
||||||
if (file->mime) eina_stringshare_del(file->mime);
|
if (file->mime) eina_stringshare_del(file->mime);
|
||||||
|
|
||||||
|
@ -443,7 +449,8 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||||
{
|
{
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
|
||||||
if (!file->path || !ecore_file_is_dir(file->path))
|
if (!evry_file_path_get(file) ||
|
||||||
|
!ecore_file_is_dir(file->path))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = E_NEW(Plugin, 1);
|
p = E_NEW(Plugin, 1);
|
||||||
|
@ -551,17 +558,34 @@ _hist_func(void *data)
|
||||||
|
|
||||||
EINA_LIST_FOREACH_SAFE(p->hist_added, l, ll, file)
|
EINA_LIST_FOREACH_SAFE(p->hist_added, l, ll, file)
|
||||||
{
|
{
|
||||||
if (!ecore_file_exists(file->path))
|
if (!evry_file_path_get(file))
|
||||||
|
{
|
||||||
p->hist_added = eina_list_remove_list(p->hist_added, l);
|
p->hist_added = eina_list_remove_list(p->hist_added, l);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ecore_file_exists(file->path))
|
||||||
|
{
|
||||||
|
p->hist_added = eina_list_remove_list(p->hist_added, l);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!file->mime)
|
if (!file->mime)
|
||||||
{
|
{
|
||||||
file->mime = eina_stringshare_add(efreet_mime_type_get(file->path));
|
file->mime = eina_stringshare_add(efreet_mime_type_get(file->path));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file->mime)
|
||||||
|
{
|
||||||
|
p->hist_added = eina_list_remove_list(p->hist_added, l);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((!strcmp(file->mime, "inode/directory")) ||
|
if ((!strcmp(file->mime, "inode/directory")) ||
|
||||||
(!strcmp(file->mime, "inode/mount-point")))
|
(!strcmp(file->mime, "inode/mount-point")))
|
||||||
EVRY_ITEM(file)->browseable = EINA_TRUE;
|
EVRY_ITEM(file)->browseable = EINA_TRUE;
|
||||||
}
|
|
||||||
|
evry_util_file_detail_set(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,14 +666,12 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
||||||
|
|
||||||
EVRY_ITEM(file)->id = eina_stringshare_ref(file->path);
|
EVRY_ITEM(file)->id = eina_stringshare_ref(file->path);
|
||||||
|
|
||||||
evry_util_file_detail_set(file);
|
/* if (file->mime)
|
||||||
|
* {
|
||||||
if (file->mime)
|
* if ((!strcmp(file->mime, "inode/directory")) ||
|
||||||
{
|
* (!strcmp(file->mime, "inode/mount-point")))
|
||||||
if ((!strcmp(file->mime, "inode/directory")) ||
|
* EVRY_ITEM(file)->browseable = EINA_TRUE;
|
||||||
(!strcmp(file->mime, "inode/mount-point")))
|
* } */
|
||||||
EVRY_ITEM(file)->browseable = EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->hist_added = eina_list_append(p->hist_added, file);
|
p->hist_added = eina_list_append(p->hist_added, file);
|
||||||
break;
|
break;
|
||||||
|
@ -835,11 +857,6 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ACT_TRASH 1
|
|
||||||
#define ACT_DELETE 2
|
|
||||||
#define ACT_COPY 3
|
|
||||||
#define ACT_MOVE 4
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it)
|
_open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it)
|
||||||
{
|
{
|
||||||
|
@ -849,22 +866,26 @@ _open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it)
|
||||||
static int
|
static int
|
||||||
_open_folder_action(Evry_Action *act)
|
_open_folder_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
E_Action *action = e_action_find("fileman");
|
E_Action *action;
|
||||||
char *path;
|
|
||||||
Eina_List *m;
|
Eina_List *m;
|
||||||
|
char *dir;
|
||||||
|
|
||||||
if (!action) return 0;
|
if (!(action = e_action_find("fileman")))
|
||||||
|
return 0;
|
||||||
m = e_manager_list();
|
|
||||||
|
|
||||||
GET_FILE(file, act->it1.item);
|
GET_FILE(file, act->it1.item);
|
||||||
|
|
||||||
if (!act->it1.item->browseable)
|
if (!(evry_file_path_get(file)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
m = e_manager_list();
|
||||||
|
|
||||||
|
if (!IS_BROWSEABLE(file))
|
||||||
{
|
{
|
||||||
path = ecore_file_dir_get(file->path);
|
dir = ecore_file_dir_get(file->path);
|
||||||
if (!path) return 0;
|
if (!dir) return 0;
|
||||||
action->func.go(E_OBJECT(m->data), path);
|
action->func.go(E_OBJECT(m->data), dir);
|
||||||
free(path);
|
free(dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -883,7 +904,10 @@ _open_term_action(Evry_Action *act)
|
||||||
char *dir;
|
char *dir;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (act->it1.item->browseable)
|
if (!(evry_file_path_get(file)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (IS_BROWSEABLE(file))
|
||||||
dir = strdup(file->path);
|
dir = strdup(file->path);
|
||||||
else
|
else
|
||||||
dir = ecore_file_dir_get(file->path);
|
dir = ecore_file_dir_get(file->path);
|
||||||
|
@ -912,75 +936,65 @@ _open_term_action(Evry_Action *act)
|
||||||
static int
|
static int
|
||||||
_file_trash_action(Evry_Action *act)
|
_file_trash_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
Efreet_Uri *uri;
|
Efreet_Uri *euri;
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
char buf[PATH_MAX];
|
|
||||||
int force = (EVRY_ITEM_DATA_INT_GET(act) == ACT_DELETE);
|
int force = (EVRY_ITEM_DATA_INT_GET(act) == ACT_DELETE);
|
||||||
|
|
||||||
GET_FILE(file, act->it1.item);
|
GET_FILE(file, act->it1.item);
|
||||||
|
|
||||||
if (!file->url)
|
if (!(evry_file_uri_get(file)))
|
||||||
{
|
return 0;
|
||||||
/* efreet_uri_decode could be a litle less picky imo */
|
|
||||||
snprintf(buf, sizeof(buf), "file://%s", file->path);
|
|
||||||
uri = efreet_uri_decode(buf);
|
|
||||||
|
|
||||||
printf("delete %s %p\n", buf, uri);
|
euri = efreet_uri_decode(file->url);
|
||||||
}
|
|
||||||
else
|
if (euri)
|
||||||
{
|
{
|
||||||
uri = efreet_uri_decode(file->url);
|
ok = efreet_trash_delete_uri(euri, force);
|
||||||
|
efreet_uri_free(euri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (ok > 0);
|
||||||
if (uri)
|
|
||||||
{
|
|
||||||
ok = efreet_trash_delete_uri(uri, force);
|
|
||||||
efreet_uri_free(uri);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_file_copy_action(Evry_Action *act)
|
_file_copy_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
GET_FILE(file, act->it1.item);
|
GET_FILE(src, act->it1.item);
|
||||||
GET_FILE(dst, act->it2.item);
|
GET_FILE(dst, act->it2.item);
|
||||||
|
|
||||||
char *path;
|
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
int ret;
|
char *ddst;
|
||||||
|
|
||||||
|
if (!(evry_file_path_get(src)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!(evry_file_path_get(dst)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!ecore_file_is_dir(dst->path))
|
if (!ecore_file_is_dir(dst->path))
|
||||||
path = ecore_file_dir_get(dst->path);
|
ddst = ecore_file_dir_get(dst->path);
|
||||||
else
|
else
|
||||||
path = strdup(dst->path);
|
ddst = strdup(dst->path);
|
||||||
|
if (!ddst)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!path) return 0;
|
snprintf(buf, sizeof(buf), "%s/%s", ddst, ecore_file_file_get(src->path));
|
||||||
|
free(ddst);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", path, act->it1.item->label);
|
DBG(" %s -> %s\n", src->path, buf);
|
||||||
free(path);
|
|
||||||
|
|
||||||
if (EVRY_ITEM_DATA_INT_GET(act) == ACT_COPY)
|
if (EVRY_ITEM_DATA_INT_GET(act) == ACT_COPY)
|
||||||
{
|
{
|
||||||
ret = ecore_file_cp(file->path, buf);
|
return ecore_file_cp(src->path, buf);
|
||||||
}
|
}
|
||||||
else if (EVRY_ITEM_DATA_INT_GET(act) == ACT_MOVE)
|
else if (EVRY_ITEM_DATA_INT_GET(act) == ACT_MOVE)
|
||||||
{
|
{
|
||||||
ret = ecore_file_mv(file->path, buf);
|
return ecore_file_mv(src->path, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static int
|
|
||||||
* _complete(Evry_Plugin *p, const Evry_Item *item, char **input)
|
|
||||||
* {
|
|
||||||
* return 0;
|
|
||||||
* } */
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_plugins_init(void)
|
_plugins_init(void)
|
||||||
{
|
{
|
||||||
|
@ -989,45 +1003,62 @@ _plugins_init(void)
|
||||||
if (!evry_api_version_check(EVRY_API_VERSION))
|
if (!evry_api_version_check(EVRY_API_VERSION))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), NULL, EVRY_TYPE_FILE, _begin, _cleanup, _fetch, NULL);
|
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), NULL,
|
||||||
|
EVRY_TYPE_FILE,
|
||||||
|
_begin, _cleanup, _fetch, NULL);
|
||||||
p1->config_path = "extensions/everything-files";
|
p1->config_path = "extensions/everything-files";
|
||||||
evry_plugin_register(p1, EVRY_PLUGIN_SUBJECT, 3);
|
evry_plugin_register(p1, EVRY_PLUGIN_SUBJECT, 3);
|
||||||
/* p1->complete = &_complete; */
|
/* p1->complete = &_complete; */
|
||||||
|
|
||||||
p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), NULL, EVRY_TYPE_FILE, _begin, _cleanup, _fetch, NULL);
|
p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), NULL,
|
||||||
|
EVRY_TYPE_FILE,
|
||||||
|
_begin, _cleanup, _fetch, NULL);
|
||||||
p2->config_path = "extensions/everything-files";
|
p2->config_path = "extensions/everything-files";
|
||||||
evry_plugin_register(p2, EVRY_PLUGIN_OBJECT, 1);
|
evry_plugin_register(p2, EVRY_PLUGIN_OBJECT, 1);
|
||||||
|
|
||||||
act = EVRY_ACTION_NEW(N_("Open Folder (EFM)"), EVRY_TYPE_FILE, 0, "folder-open",
|
act = EVRY_ACTION_NEW(N_("Open Folder (EFM)"),
|
||||||
_open_folder_action, _open_folder_check);
|
EVRY_TYPE_FILE, 0,
|
||||||
|
"folder-open",
|
||||||
|
_open_folder_action,
|
||||||
|
_open_folder_check);
|
||||||
evry_action_register(act, 0);
|
evry_action_register(act, 0);
|
||||||
_actions = eina_list_append(_actions, act);
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
act = EVRY_ACTION_NEW(N_("Open Terminal here"), EVRY_TYPE_FILE, 0, "system-run",
|
act = EVRY_ACTION_NEW(N_("Open Terminal here"),
|
||||||
|
EVRY_TYPE_FILE, 0,
|
||||||
|
"system-run",
|
||||||
_open_term_action, NULL);
|
_open_term_action, NULL);
|
||||||
evry_action_register(act, 2);
|
evry_action_register(act, 2);
|
||||||
_actions = eina_list_append(_actions, act);
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
act = EVRY_ACTION_NEW(N_("Move to Trash"), EVRY_TYPE_FILE, 0, "edit-delete",
|
act = EVRY_ACTION_NEW(N_("Move to Trash"),
|
||||||
|
EVRY_TYPE_FILE, 0,
|
||||||
|
"edit-delete",
|
||||||
_file_trash_action, NULL);
|
_file_trash_action, NULL);
|
||||||
EVRY_ITEM_DATA_INT_SET(act, ACT_TRASH);
|
EVRY_ITEM_DATA_INT_SET(act, ACT_TRASH);
|
||||||
evry_action_register(act, 2);
|
evry_action_register(act, 2);
|
||||||
_actions = eina_list_append(_actions, act);
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
act = EVRY_ACTION_NEW(N_("Delete"), EVRY_TYPE_FILE, 0, "list-remove",
|
act = EVRY_ACTION_NEW(N_("Delete"),
|
||||||
|
EVRY_TYPE_FILE, 0,
|
||||||
|
"list-remove",
|
||||||
_file_trash_action, NULL);
|
_file_trash_action, NULL);
|
||||||
EVRY_ITEM_DATA_INT_SET(act, ACT_DELETE);
|
EVRY_ITEM_DATA_INT_SET(act, ACT_DELETE);
|
||||||
evry_action_register(act, 2);
|
evry_action_register(act, 2);
|
||||||
|
|
||||||
_actions = eina_list_append(_actions, act);
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
act = EVRY_ACTION_NEW(N_("Copy To ..."), EVRY_TYPE_FILE, EVRY_TYPE_FILE, "go-next",
|
act = EVRY_ACTION_NEW(N_("Copy To ..."),
|
||||||
|
EVRY_TYPE_FILE, EVRY_TYPE_FILE,
|
||||||
|
"go-next",
|
||||||
_file_copy_action, NULL);
|
_file_copy_action, NULL);
|
||||||
EVRY_ITEM_DATA_INT_SET(act, ACT_COPY);
|
EVRY_ITEM_DATA_INT_SET(act, ACT_COPY);
|
||||||
evry_action_register(act, 2);
|
evry_action_register(act, 2);
|
||||||
_actions = eina_list_append(_actions, act);
|
_actions = eina_list_append(_actions, act);
|
||||||
|
|
||||||
act = EVRY_ACTION_NEW(N_("Move To ..."), EVRY_TYPE_FILE, EVRY_TYPE_FILE, "go-next",
|
act = EVRY_ACTION_NEW(N_("Move To ..."),
|
||||||
|
EVRY_TYPE_FILE, EVRY_TYPE_FILE,
|
||||||
|
"go-next",
|
||||||
_file_copy_action, NULL);
|
_file_copy_action, NULL);
|
||||||
EVRY_ITEM_DATA_INT_SET(act, ACT_MOVE);
|
EVRY_ITEM_DATA_INT_SET(act, ACT_MOVE);
|
||||||
evry_action_register(act, 2);
|
evry_action_register(act, 2);
|
||||||
|
|
|
@ -41,6 +41,9 @@ _action(Evry_Action *act)
|
||||||
|
|
||||||
GET_FILE(file, act->it1.item);
|
GET_FILE(file, act->it1.item);
|
||||||
|
|
||||||
|
if (!(evry_file_path_get(file)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (import)
|
if (import)
|
||||||
{
|
{
|
||||||
if (import->exe_handler)
|
if (import->exe_handler)
|
||||||
|
|
|
@ -58,7 +58,7 @@ typedef struct _Plugin_Config Plugin_Config;
|
||||||
typedef struct _Plugin_Setting Plugin_Setting;
|
typedef struct _Plugin_Setting Plugin_Setting;
|
||||||
typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
|
typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
|
||||||
|
|
||||||
typedef int Evry_Type;
|
typedef unsigned int Evry_Type;
|
||||||
|
|
||||||
#define EVRY_ITEM(_item) ((Evry_Item *)_item)
|
#define EVRY_ITEM(_item) ((Evry_Item *)_item)
|
||||||
#define EVRY_ACTN(_item) ((Evry_Action *) _item)
|
#define EVRY_ACTN(_item) ((Evry_Action *) _item)
|
||||||
|
@ -72,6 +72,9 @@ typedef int Evry_Type;
|
||||||
#define CHECK_SUBTYPE(_item, _type) \
|
#define CHECK_SUBTYPE(_item, _type) \
|
||||||
(((Evry_Item *)_item)->subtype && ((Evry_Item *)_item)->subtype == _type)
|
(((Evry_Item *)_item)->subtype && ((Evry_Item *)_item)->subtype == _type)
|
||||||
|
|
||||||
|
#define IS_BROWSEABLE(_item) \
|
||||||
|
((Evry_Item *)_item)->browseable
|
||||||
|
|
||||||
#define GET_APP(_app, _item) Evry_Item_App *_app = (Evry_Item_App *) _item
|
#define GET_APP(_app, _item) Evry_Item_App *_app = (Evry_Item_App *) _item
|
||||||
#define GET_FILE(_file, _item) Evry_Item_File *_file = (Evry_Item_File *) _item
|
#define GET_FILE(_file, _item) Evry_Item_File *_file = (Evry_Item_File *) _item
|
||||||
#define GET_EVRY_PLUGIN(_p, _plugin) Evry_Plugin *_p = (Evry_Plugin*) _plugin
|
#define GET_EVRY_PLUGIN(_p, _plugin) Evry_Plugin *_p = (Evry_Plugin*) _plugin
|
||||||
|
@ -439,7 +442,8 @@ EAPI char *evry_util_unescape(const char *string, int length);
|
||||||
EAPI void evry_util_file_detail_set(Evry_Item_File *file);
|
EAPI void evry_util_file_detail_set(Evry_Item_File *file);
|
||||||
EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version);
|
EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version);
|
||||||
EAPI Evas_Object *evry_util_icon_get(Evry_Item *it, Evas *e);
|
EAPI Evas_Object *evry_util_icon_get(Evry_Item *it, Evas *e);
|
||||||
EAPI const char *evry_file_path_get(Evry_Item *it);
|
EAPI const char *evry_file_path_get(Evry_Item_File *file);
|
||||||
|
EAPI const char *evry_file_uri_get(Evry_Item_File *file);
|
||||||
|
|
||||||
/* e_mod_main.c */
|
/* e_mod_main.c */
|
||||||
/* set plugin trigger and view mode first before register !*/
|
/* set plugin trigger and view mode first before register !*/
|
||||||
|
|
|
@ -902,7 +902,11 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
|
||||||
|
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
|
||||||
if (!file->path || !file->mime) return 0;
|
if (!file->mime)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!(evry_file_path_get(file)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!strncmp(file->mime, "image/", 6))
|
if (!strncmp(file->mime, "image/", 6))
|
||||||
{
|
{
|
||||||
|
@ -1116,16 +1120,18 @@ _evry_selector_objects_get(Evry_Action *act)
|
||||||
while (sel->state)
|
while (sel->state)
|
||||||
_evry_state_pop(sel);
|
_evry_state_pop(sel);
|
||||||
|
|
||||||
it = selectors[0]->state->cur_item;
|
it = selectors[1]->state->cur_item;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
EINA_LIST_FOREACH(sel->plugins, l, p)
|
||||||
{
|
{
|
||||||
|
DBG("p %s %d %d\n", p->name, EVRY_ITEM(p)->subtype, act->it2.type);
|
||||||
|
|
||||||
if (!CHECK_SUBTYPE(p, act->it2.type))
|
if (!CHECK_SUBTYPE(p, act->it2.type))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p->begin)
|
if (p->begin)
|
||||||
{
|
{
|
||||||
if ((pp = p->begin(p, it)) || (pp = p->begin(p, NULL)))
|
if ((pp = p->begin(p, it)))
|
||||||
plugins = eina_list_append(plugins, pp);
|
plugins = eina_list_append(plugins, pp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -70,6 +70,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||||
|
|
||||||
if (!eina_list_data_find_list(p->actions, act))
|
if (!eina_list_data_find_list(p->actions, act))
|
||||||
{
|
{
|
||||||
|
act->it1.item = it;
|
||||||
p->actions = eina_list_append(p->actions, act);
|
p->actions = eina_list_append(p->actions, act);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -87,6 +88,21 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
{
|
{
|
||||||
const Evry_Item *it1 = data1;
|
const Evry_Item *it1 = data1;
|
||||||
const Evry_Item *it2 = data2;
|
const Evry_Item *it2 = data2;
|
||||||
|
const Evry_Action *act1 = data1;
|
||||||
|
const Evry_Action *act2 = data2;
|
||||||
|
|
||||||
|
if (act1->it1.item && act2->it1.item)
|
||||||
|
{
|
||||||
|
if ((act1->it1.type == act1->it1.item->type) &&
|
||||||
|
(act2->it1.type != act2->it1.item->type))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if ((act1->it1.type != act1->it1.item->type) &&
|
||||||
|
(act2->it1.type == act2->it1.item->type))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it1->fuzzy_match || it2->fuzzy_match)
|
||||||
|
|
||||||
if (it1->fuzzy_match || it2->fuzzy_match)
|
if (it1->fuzzy_match || it2->fuzzy_match)
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,7 +107,7 @@ _check_item(const Evry_Item *it)
|
||||||
|
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
|
||||||
if (!file->path || !file->mime) return 0;
|
if (!evry_file_path_get(file) || !file->mime) return 0;
|
||||||
|
|
||||||
if (!strncmp(file->mime, "image/", 6))
|
if (!strncmp(file->mime, "image/", 6))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -588,8 +588,8 @@ _pan_item_add(Evas_Object *obj, Evry_Item *item)
|
||||||
it->item = item;
|
it->item = item;
|
||||||
it->changed = EINA_TRUE;
|
it->changed = EINA_TRUE;
|
||||||
|
|
||||||
if (_check_item(item))
|
/* if (_check_item(item))
|
||||||
it->get_thumb = EINA_TRUE;
|
* it->get_thumb = EINA_TRUE; */
|
||||||
|
|
||||||
evry_item_ref(item);
|
evry_item_ref(item);
|
||||||
|
|
||||||
|
@ -1042,8 +1042,8 @@ _view_update(Evry_View *view, int slide)
|
||||||
{
|
{
|
||||||
v_items = eina_list_append(v_items, v_it->item);
|
v_items = eina_list_append(v_items, v_it->item);
|
||||||
|
|
||||||
if (_check_item(v_it->item))
|
/* if (_check_item(v_it->item))
|
||||||
v_it->get_thumb = EINA_TRUE;
|
* v_it->get_thumb = EINA_TRUE; */
|
||||||
|
|
||||||
if (v_it->visible && v_it->changed)
|
if (v_it->visible && v_it->changed)
|
||||||
update = EINA_TRUE;
|
update = EINA_TRUE;
|
||||||
|
|
|
@ -401,26 +401,30 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
|
||||||
|
|
||||||
if (!it_app) return 0;
|
if (!it_app) return 0;
|
||||||
GET_APP(app, it_app);
|
GET_APP(app, it_app);
|
||||||
|
GET_FILE(file, it_file);
|
||||||
|
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
zone = e_util_zone_current_get(e_manager_current_get());
|
||||||
|
|
||||||
if (app->desktop)
|
if (app->desktop)
|
||||||
{
|
{
|
||||||
if (it_file)
|
if (file && evry_file_path_get(file))
|
||||||
{
|
{
|
||||||
GET_FILE(file, it_file);
|
|
||||||
|
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *mime;
|
char *mime;
|
||||||
int open_folder = 0;
|
int open_folder = 0;
|
||||||
|
|
||||||
if (!EVRY_ITEM(file)->browseable)
|
/* when the file is no a directory and the app
|
||||||
|
opens folders, pass only the dir */
|
||||||
|
if (!IS_BROWSEABLE(file))
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(app->desktop->mime_types, l, mime)
|
EINA_LIST_FOREACH(app->desktop->mime_types, l, mime)
|
||||||
{
|
{
|
||||||
if (!strcmp(mime, "x-directory/normal"))
|
if (!strcmp(mime, "x-directory/normal"))
|
||||||
{
|
|
||||||
open_folder = 1;
|
open_folder = 1;
|
||||||
|
|
||||||
|
if (file->mime && !strcmp(mime, file->mime))
|
||||||
|
{
|
||||||
|
open_folder = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,10 +463,8 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
|
||||||
}
|
}
|
||||||
else if (app->file)
|
else if (app->file)
|
||||||
{
|
{
|
||||||
if (it_file)
|
if (file && evry_file_path_get(file))
|
||||||
{
|
{
|
||||||
GET_FILE(file, it_file);
|
|
||||||
|
|
||||||
int len;
|
int len;
|
||||||
tmp = eina_str_escape(file->path);
|
tmp = eina_str_escape(file->path);
|
||||||
len = strlen(app->file) + strlen(tmp) + 2;
|
len = strlen(app->file) + strlen(tmp) + 2;
|
||||||
|
@ -611,6 +613,8 @@ _isalnum(unsigned char in)
|
||||||
}
|
}
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME option to not escape '/' */
|
||||||
EAPI char *
|
EAPI char *
|
||||||
evry_util_url_escape(const char *string, int inlength)
|
evry_util_url_escape(const char *string, int inlength)
|
||||||
{
|
{
|
||||||
|
@ -660,25 +664,47 @@ evry_util_url_escape(const char *string, int inlength)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const char*
|
EAPI const char*
|
||||||
evry_file_path_get(Evry_Item *it)
|
evry_file_path_get(Evry_Item_File *file)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
GET_FILE(file, it);
|
|
||||||
|
|
||||||
if (file->path)
|
if (file->path)
|
||||||
return file->path;
|
return file->path;
|
||||||
|
|
||||||
|
if (!file->url)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!strncmp(file->url, "file://", 7))
|
if (!strncmp(file->url, "file://", 7))
|
||||||
tmp = file->url + 7;
|
tmp = file->url + 7;
|
||||||
else return NULL;
|
else return NULL;
|
||||||
|
|
||||||
if (!(path = evry_util_unescape(tmp, 0)))
|
if (!(path = evry_util_unescape(tmp, 0)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
file->path = eina_stringshare_add(path);
|
file->path = eina_stringshare_add(path);
|
||||||
|
|
||||||
E_FREE(path);
|
E_FREE(path);
|
||||||
|
|
||||||
return file->path;
|
return file->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI const char*
|
||||||
|
evry_file_uri_get(Evry_Item_File *file)
|
||||||
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
|
if (file->url)
|
||||||
|
return file->url;
|
||||||
|
|
||||||
|
if (!file->path)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "file://%s", file->path);
|
||||||
|
|
||||||
|
/* FIXME escape ? */
|
||||||
|
|
||||||
|
file->url = eina_stringshare_add(buf);
|
||||||
|
|
||||||
|
return file->url;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue