forked from enlightenment/enlightenment
'everything'
- fix module unloadin - add '.' trigger for files to show parent dirs - fix 'create new app' action - keep the current view on update SVN revision: 48198
This commit is contained in:
parent
1b4a60ff87
commit
65175a6137
|
@ -925,38 +925,40 @@ _new_app_action(Evry_Action *act)
|
|||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
free(name);
|
||||
|
||||
if (strlen(buf) == 0)
|
||||
if (!buf || strlen(buf) == 0)
|
||||
return 0;
|
||||
|
||||
if (!app->desktop)
|
||||
{
|
||||
desktop = efreet_desktop_empty_new(buf);
|
||||
desktop->exec = strdup(app->file);
|
||||
desktop->exec = (char *)eina_stringshare_add(app->file);
|
||||
}
|
||||
else
|
||||
{
|
||||
efreet_desktop_save_as(app->desktop, buf);
|
||||
desktop = efreet_desktop_new(buf);
|
||||
desktop = efreet_desktop_empty_new(buf);
|
||||
if (app->desktop->name)
|
||||
desktop->name = strdup(app->desktop->name);
|
||||
if (app->desktop->comment)
|
||||
desktop->comment = strdup(app->desktop->comment);
|
||||
if (app->desktop->generic_name)
|
||||
desktop->generic_name = strdup(app->desktop->generic_name);
|
||||
if (app->desktop->generic_name)
|
||||
desktop->generic_name = strdup(app->desktop->generic_name);
|
||||
if (app->desktop->exec)
|
||||
desktop->exec = strdup(app->desktop->exec);
|
||||
if (app->desktop->mime_types)
|
||||
desktop->mime_types = eina_list_clone(app->desktop->mime_types);
|
||||
}
|
||||
|
||||
e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop);
|
||||
if (desktop)
|
||||
e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//#define TIME_FACTOR(_now) (1.0 - (evry_hist->begin / _now)) / 1000000000000000.0
|
||||
|
||||
static void
|
||||
_free_plugin(Evry_Plugin *plugin)
|
||||
{
|
||||
PLUGIN(p, plugin);
|
||||
|
||||
E_FREE(p);
|
||||
}
|
||||
|
||||
|
||||
static Eina_Bool
|
||||
module_init(void)
|
||||
|
@ -966,13 +968,13 @@ module_init(void)
|
|||
|
||||
p1 = E_NEW(Plugin, 1);
|
||||
EVRY_PLUGIN_NEW(EVRY_PLUGIN(p1), N_("Applications"), type_subject, "", "APPLICATION",
|
||||
_begin, _cleanup, _fetch, _icon_get, _free_plugin);
|
||||
_begin, _cleanup, _fetch, _icon_get, NULL);
|
||||
EVRY_PLUGIN(p1)->complete = &_complete;
|
||||
|
||||
p2 = E_NEW(Plugin, 1);
|
||||
EVRY_PLUGIN_NEW(EVRY_PLUGIN(p2), N_("Open With..."), type_action, "FILE", "",
|
||||
_begin_open_with, _cleanup, _fetch,
|
||||
_icon_get, _free_plugin);
|
||||
_icon_get, NULL);
|
||||
|
||||
EVRY_PLUGIN(p2)->action = &_open_with_action;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ struct _Plugin
|
|||
Eina_Bool is_first;
|
||||
};
|
||||
|
||||
static Plugin *plugin = NULL;
|
||||
static Plugin *_plug = NULL;
|
||||
|
||||
static Eina_Bool
|
||||
_exe_restart(Plugin *p)
|
||||
|
@ -160,11 +160,11 @@ _cb_data(void *data, int type __UNUSED__, void *event)
|
|||
switch (l->line[0])
|
||||
{
|
||||
case '*':
|
||||
_item_add(plugin, word, word_size, 1);
|
||||
_item_add(p, word, word_size, 1);
|
||||
break;
|
||||
case '&':
|
||||
_item_add(plugin, word, word_size, 1);
|
||||
_suggestions_add(plugin, l->line);
|
||||
_item_add(p, word, word_size, 1);
|
||||
_suggestions_add(p, l->line);
|
||||
break;
|
||||
case '#':
|
||||
break;
|
||||
|
@ -321,14 +321,6 @@ _cleanup(Evry_Plugin *plugin)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_free_plugin(Evry_Plugin *plugin)
|
||||
{
|
||||
PLUGIN(p, plugin);
|
||||
|
||||
E_FREE(p);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
module_init(void)
|
||||
{
|
||||
|
@ -340,7 +332,7 @@ module_init(void)
|
|||
p = E_NEW(Plugin, 1);
|
||||
|
||||
EVRY_PLUGIN_NEW(p, N_("Spell Checker"), type_subject, "", "TEXT",
|
||||
NULL, _cleanup, _fetch, NULL, _free_plugin);
|
||||
NULL, _cleanup, _fetch, NULL, NULL);
|
||||
|
||||
EVRY_PLUGIN(p)->aggregate = EINA_FALSE;
|
||||
EVRY_PLUGIN(p)->history = EINA_FALSE;
|
||||
|
@ -350,14 +342,15 @@ module_init(void)
|
|||
|
||||
evry_plugin_register(EVRY_PLUGIN(p), 100);
|
||||
|
||||
plugin = p;
|
||||
_plug = p;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
module_shutdown(void)
|
||||
{
|
||||
EVRY_PLUGIN_FREE(plugin);
|
||||
EVRY_PLUGIN_FREE(_plug);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -124,7 +124,7 @@ _scan_func(void *data)
|
|||
Plugin *p = d->plugin;
|
||||
char *filename;
|
||||
const char *mime;
|
||||
|
||||
|
||||
Evry_Item_File *file;
|
||||
char buf[4096];
|
||||
int cnt = 0;
|
||||
|
@ -460,6 +460,21 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_folder_item_add(Plugin *p, const char *path)
|
||||
{
|
||||
Evry_Item_File *file = E_NEW(Evry_Item_File, 1);
|
||||
|
||||
if (!file) return;
|
||||
|
||||
evry_item_new(EVRY_ITEM(file), EVRY_PLUGIN(p), path, _item_free);
|
||||
file->path = eina_stringshare_add(path);
|
||||
file->mime = eina_stringshare_add("inode/directory");
|
||||
EVRY_ITEM(file)->browseable = EINA_TRUE;
|
||||
p->files = eina_list_append(p->files, file);
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, file);
|
||||
}
|
||||
|
||||
static int
|
||||
_fetch(Evry_Plugin *plugin, const char *input)
|
||||
{
|
||||
|
@ -467,7 +482,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
Evry_Item_File *file;
|
||||
Eina_List *l;
|
||||
int cnt = 0;
|
||||
|
||||
int cmd = 0;
|
||||
|
||||
if (!p->command)
|
||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||
|
||||
|
@ -478,52 +494,103 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
if (!p->parent)
|
||||
{
|
||||
/* input is command ? */
|
||||
if (input && !strcmp(input, "/"))
|
||||
if (input && !strncmp(input, "/", 1))
|
||||
{
|
||||
if (!p->command)
|
||||
{
|
||||
/* browse root */
|
||||
EINA_LIST_FREE(p->files, file)
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
|
||||
eina_stringshare_del(p->directory);
|
||||
p->directory = eina_stringshare_add("/");
|
||||
_read_directory(p);
|
||||
|
||||
p->command = EINA_TRUE;
|
||||
}
|
||||
|
||||
cmd = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->directory && input && !strncmp(input, ".", 1))
|
||||
{
|
||||
if (!p->command)
|
||||
{
|
||||
char *end;
|
||||
char dir[4096];
|
||||
char *tmp;
|
||||
int prio = 0;
|
||||
|
||||
/* browse root */
|
||||
EINA_LIST_FREE(p->hist_added, file)
|
||||
{
|
||||
p->files = eina_list_remove(p->files, file);
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
}
|
||||
EINA_LIST_FREE(p->files, file)
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
|
||||
eina_stringshare_del(p->directory);
|
||||
p->directory = eina_stringshare_add("/");
|
||||
_read_directory(p);
|
||||
if (strncmp(p->directory, "/", 1)) return 0;
|
||||
if (!strcmp(p->directory, "/")) return 0;
|
||||
|
||||
snprintf(dir, 4096, "%s", p->directory);
|
||||
end = strrchr(dir, '/');
|
||||
|
||||
p->command = EINA_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* add recent files */
|
||||
if (!p->hist_added && (_conf->show_recent || (input && _conf->search_recent)))
|
||||
{
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
||||
}
|
||||
else if (p->hist_added && !input && _conf->search_recent)
|
||||
{
|
||||
EINA_LIST_FREE(p->hist_added, file)
|
||||
while (end != dir)
|
||||
{
|
||||
p->files = eina_list_remove(p->files, file);
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
tmp = strdup(dir);
|
||||
snprintf(dir, (end - dir) + 1, "%s", tmp);
|
||||
|
||||
_folder_item_add(p, dir);
|
||||
|
||||
end = strrchr(dir, '/');
|
||||
free(tmp);
|
||||
prio--;
|
||||
}
|
||||
|
||||
_folder_item_add(p, "/");
|
||||
p->command = EINA_TRUE;
|
||||
}
|
||||
cmd = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* clear command items */
|
||||
if (!p->parent && !input && p->command)
|
||||
if (!cmd && p->command)
|
||||
{
|
||||
p->command = EINA_FALSE;
|
||||
|
||||
EINA_LIST_FREE(p->files, file)
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
|
||||
eina_stringshare_del(p->directory);
|
||||
if (p->directory)
|
||||
eina_stringshare_del(p->directory);
|
||||
|
||||
p->directory = eina_stringshare_add(e_user_homedir_get());
|
||||
_read_directory(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* add recent files */
|
||||
if ((!p->parent && !p->command && !p->hist_added) &&
|
||||
(_conf->show_recent || (input && _conf->search_recent)))
|
||||
{
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
||||
}
|
||||
else if (p->hist_added && !input && _conf->search_recent)
|
||||
{
|
||||
EINA_LIST_FREE(p->hist_added, file)
|
||||
{
|
||||
p->files = eina_list_remove(p->files, file);
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
}
|
||||
}
|
||||
|
||||
if (input)
|
||||
{
|
||||
/* skip command prefix */
|
||||
/* skip command prefix FIXME */
|
||||
if (p->command)
|
||||
p->input = eina_stringshare_add(input + 1);
|
||||
else
|
||||
|
|
|
@ -962,10 +962,13 @@ _view_update(Evry_View *view, int slide)
|
|||
return 1;
|
||||
}
|
||||
|
||||
v->mode = v->mode_prev;
|
||||
|
||||
if (p->view_mode >= 0)
|
||||
v->mode = p->view_mode;
|
||||
if (p != v->plugin)
|
||||
{
|
||||
v->mode = v->mode_prev;
|
||||
|
||||
if (p->view_mode >= 0)
|
||||
v->mode = p->view_mode;
|
||||
}
|
||||
|
||||
/* go through current view items */
|
||||
EINA_LIST_FOREACH(sd->items, l, v_it)
|
||||
|
|
Loading…
Reference in New Issue