whitespace cleanup

SVN revision: 41716
This commit is contained in:
Hannes Janetzek 2009-08-12 19:00:25 +00:00
parent 9f2d45a90e
commit f5a5cb17b0
11 changed files with 340 additions and 359 deletions

View File

@ -96,9 +96,9 @@ e_modapi_init(E_Module *m)
plugins = eina_module_list_get(NULL, m->dir, 1, &list_cb, NULL);
if (plugins)
printf("plugins loaded\n");
else
else
printf("could not find plugins in %s\n", m->dir);
/* add module supplied action */
act = e_action_add("everything");
if (act)
@ -112,7 +112,7 @@ e_modapi_init(E_Module *m)
e_configure_registry_category_add("extensions", 80, _("Extensions"), NULL, "preferences-extensions");
e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog);
e_module_delayed_set(m, 1);
return m;
@ -122,7 +122,7 @@ EAPI int
e_modapi_shutdown(E_Module *m __UNUSED__)
{
E_Config_Dialog *cfd;
/* remove module-supplied menu additions */
if (maug)
{
@ -145,9 +145,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
eina_module_list_unload(plugins);
eina_module_list_flush(plugins);
eina_array_free(plugins);
eina_module_shutdown();
while ((cfd = e_config_dialog_get("E", "_config_everything_dialog"))) e_object_del(E_OBJECT(cfd));
e_configure_registry_item_del("extensions/run_everything");
e_configure_registry_category_del("extensions");
@ -233,7 +233,7 @@ evry_plugin_register(Evry_Plugin *plugin)
Eina_List *l;
Plugin_Config *pc;
Eina_Bool found = 0;
evry_conf->plugins = eina_list_append(evry_conf->plugins, plugin);
EINA_LIST_FOREACH(evry_conf->plugins_conf, l, pc)
@ -252,18 +252,18 @@ evry_plugin_register(Evry_Plugin *plugin)
pc->enabled = 1;
pc->priority = eina_list_count(evry_conf->plugins);
evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc);
evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc);
}
/* if (plugin->trigger && !pc->trigger)
* pc->trigger = eina_stringshare_add(plugin->trigger); */
plugin->config = pc;
evry_conf->plugins = eina_list_sort(evry_conf->plugins,
eina_list_count(evry_conf->plugins),
_evry_cb_plugin_sort);
/* TODO sorting, initialization, etc */
}

View File

@ -42,7 +42,7 @@ struct _Config
int auto_select_first;
Eina_Hash *key_bindings;
/**/
Eina_List *plugins;
Eina_List *actions;
@ -53,10 +53,10 @@ struct _Config
struct _Plugin_Config
{
const char *name;
int loaded;
int enabled;
/* minimum input chars to query this source */
int min_query;
@ -69,14 +69,14 @@ struct _Plugin_Config
struct _Evry_Item
{
Evry_Plugin *plugin;
const char *label;
const char *uri;
const char *mime;
Eina_Bool browseable;
/* these are only for internally use by plugins */
/* used e.g. as pointer for item data (Efreet_Desktop) or */
/* for internal stuff, like priority hints for sorting, etc */
@ -87,89 +87,89 @@ struct _Evry_Item
Evas_Object *o_icon;
Evas_Object *o_bg;
};
struct _Evry_Plugin
{
const char *name;
const char *icon;
enum {type_subject, type_action, type_object } type;
const char *type_in;
const char *type_out;
const char *trigger;
/* sync/async ?*/
Eina_Bool async_query;
/* whether candidates can be shown without input
* e.g. borders, app history */
Eina_Bool need_query;
Eina_Bool need_query;
Eina_Bool browseable;
/* run when plugin is activated. */
int (*begin) (Evry_Plugin *p, const Evry_Item *item);
int (*browse) (Evry_Plugin *p, const Evry_Item *item);
/* get candidates matching string, fills 'candidates' list */
int (*fetch) (Evry_Plugin *p, const char *input);
/* run before new query and when hiding 'everything' */
void (*cleanup) (Evry_Plugin *p);
Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e);
Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e);
/* provide more information for a candidate */
/* int (*candidate_info) (Evas *evas, Evry_Item *item); */
/* optional: default action for this plugins items */
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input);
Evry_Action *act;
/* optional: create list of items when shown (e.g. for sorting) */
void (*realize_items) (Evry_Plugin *p, Evas *e);
Eina_List *items;
Evas_Object *(*config_page) (void);
void (*config_apply) (void);
/* only for internal use by plugin */
void *private;
/* not to be set by plugin! */
Evas_Object *tab;
Plugin_Config *config;
};
};
struct _Evry_Action
{
const char *name;
const char *type_in1;
const char *type_in2;
const char *type_out;
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input);
int (*check_item) (Evry_Action *act, const Evry_Item *it);
int (*check_item) (Evry_Action *act, const Evry_Item *it);
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e);
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e);
/* use icon name from theme */
const char *icon;
Eina_Bool is_default;
/* only for internal use by plugin */
void *private;
/* not to be set by plugin! */
Evas_Object *o_icon;
};
};
struct _Evry_App
{

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
#include "e_mod_main.h"
/* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */
@ -12,7 +11,7 @@ static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas,
* static int _object = type_object; */
struct _E_Config_Dialog_Data
struct _E_Config_Dialog_Data
{
int width, height;
@ -29,14 +28,14 @@ struct _E_Config_Dialog_Data
EAPI E_Config_Dialog *
evry_config_dialog(E_Container *con, const char *params __UNUSED__)
evry_config_dialog(E_Container *con, const char *params __UNUSED__)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
if (e_config_dialog_find("E", "_config_everything_dialog")) return NULL;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
@ -51,11 +50,11 @@ evry_config_dialog(E_Container *con, const char *params __UNUSED__)
}
static void
_fill_data(E_Config_Dialog_Data *cfdata)
_fill_data(E_Config_Dialog_Data *cfdata)
{
Eina_List *l;
Evry_Plugin *p;
cfdata->scroll_animate = evry_conf->scroll_animate;
cfdata->height = evry_conf->height;
cfdata->width = evry_conf->width;
@ -66,14 +65,14 @@ _fill_data(E_Config_Dialog_Data *cfdata)
else if (p->type == type_action)
cfdata->p_action = eina_list_append(cfdata->p_action, p);
else if (p->type == type_object)
cfdata->p_object = eina_list_append(cfdata->p_object, p);
cfdata->p_object = eina_list_append(cfdata->p_object, p);
}
static void *
_create_data(E_Config_Dialog *cfd __UNUSED__)
{
E_Config_Dialog_Data *cfdata;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata);
return cfdata;
@ -85,7 +84,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
eina_list_free(cfdata->p_subject);
eina_list_free(cfdata->p_action);
eina_list_free(cfdata->p_object);
E_FREE(cfdata);
}
@ -119,7 +118,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, int enabled __UNUSED__)
Evas_Coord w;
Eina_List *l;
Evry_Plugin *p;
/* freeze evas, edje, and list widget */
evas = evas_object_evas_get(obj);
evas_event_freeze(evas);
@ -150,7 +149,7 @@ _plugin_move(Eina_List *plugins, Evas_Object *list, int dir)
{
Evry_Plugin *p;
int prio = 0;
l1 = eina_list_nth_list(plugins, sel);
l2 = eina_list_nth_list(plugins, sel + dir);
@ -159,7 +158,7 @@ _plugin_move(Eina_List *plugins, Evas_Object *list, int dir)
l1->data = l2->data;
l2->data = p;
_fill_list(plugins, list, 0);
_fill_list(plugins, list, 0);
e_widget_ilist_selected_set(list, sel + dir);
EINA_LIST_FOREACH(plugins, l1, p)
@ -185,7 +184,7 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
Evas_Object *o, *of, *ob, *otb;
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("General Settings"), 0);
@ -194,16 +193,16 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
300, 800, 5, 0, NULL,
&(cfdata->width), 200);
e_widget_framelist_object_append(of, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Popup Height"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
200, 800, 5, 0, NULL,
&(cfdata->height), 200);
e_widget_framelist_object_append(of, ob);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Scroll Settings"), 0);
ob = e_widget_check_add(evas, _("Scroll Animate"),
&(cfdata->scroll_animate));
@ -265,10 +264,10 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
cfdata->p_object);
e_widget_framelist_object_append(of, o);
e_widget_list_object_append(ob, of, 1, 1, 0.5);
e_widget_toolbook_page_append(otb, NULL, _("Plugins"),
ob, 0, 0, 0, 0, 0.5, 0.0);
e_widget_toolbook_page_show(otb, 1);
return otb;
}

View File

@ -25,7 +25,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
{
const char *mime;
Inst *inst = NULL;
if (it)
{
Eina_List *l;
@ -55,9 +55,9 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
{
inst = E_NEW(Inst, 1);
}
p->private = inst;
return 1;
}
@ -81,7 +81,7 @@ static void
_cleanup(Evry_Plugin *p)
{
Inst *inst = p->private;
_list_free(p);
if (inst)
@ -91,7 +91,7 @@ _cleanup(Evry_Plugin *p)
efreet_desktop_free(desktop);
EINA_LIST_FREE(inst->apps_all, desktop)
efreet_desktop_free(desktop);
E_FREE(inst);
}
@ -106,12 +106,12 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
Efreet_Desktop *d2;
Inst *inst = p->private;
int already_refd = 0;
if (desktop)
file = desktop->exec;
if (!file) return 0;
if (!desktop)
{
char match[4096];
@ -161,7 +161,7 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
it = evry_item_new(p, desktop->name);
else
it = evry_item_new(p, file);
app = E_NEW(Evry_App, 1);
app->desktop = desktop;
app->file = file;
@ -178,12 +178,12 @@ _add_desktop_list(Evry_Plugin *p, Eina_List *apps, char *m1, char *m2)
{
Efreet_Desktop *desktop;
Eina_List *l;
EINA_LIST_FOREACH(apps, l, desktop)
{
if (eina_list_count(p->items) > 99) continue;
if (!desktop || !desktop->name || !desktop->exec) continue;
if (e_util_glob_case_match(desktop->exec, m1))
_item_add(p, desktop, NULL, 1);
else if (e_util_glob_case_match(desktop->name, m1))
@ -193,7 +193,7 @@ _add_desktop_list(Evry_Plugin *p, Eina_List *apps, char *m1, char *m2)
{
if (eina_list_count(p->items) > 99) continue;
if (!desktop || !desktop->name || !desktop->exec) continue;
if (e_util_glob_case_match(desktop->exec, m2))
_item_add(p, desktop, NULL, 2);
else if (e_util_glob_case_match(desktop->name, m2))
@ -240,7 +240,7 @@ _cb_sort(const void *data1, const void *data2)
if ((int)(t2 - t1))
return (int)(t2 - t1);
// TODO compare exe strings?
else return 0;
}
@ -258,7 +258,7 @@ _fetch(Evry_Plugin *p, const char *input)
Inst *inst = p->private;
inst->added = eina_hash_string_small_new(NULL);
_list_free(p);
if (input)
@ -289,16 +289,16 @@ _fetch(Evry_Plugin *p, const char *input)
if (input)
{
if (!inst->apps_all)
inst->apps_all = efreet_util_desktop_name_glob_list("*");
inst->apps_all = efreet_util_desktop_name_glob_list("*");
_add_desktop_list(p, inst->apps_all, match1, match2);
_add_desktop_list(p, inst->apps_all, match1, match2);
}
/* add exe history items */
else if (!p->items)
{
l = e_exehist_list_get();
EINA_LIST_FREE(l, file)
_item_add(p, NULL, file, 1);
_item_add(p, NULL, file, 1);
}
/* show 'Run Command' item */
@ -311,14 +311,14 @@ _fetch(Evry_Plugin *p, const char *input)
if (input)
{
snprintf(match2, 4096, "%s", input);
if (end = strchr(input, ' '))
{
int len = (end - input) - 1;
if (len >= 0)
snprintf(match2, len, "%s", input);
}
EINA_LIST_FOREACH(exe_path, l, path)
{
snprintf(match1, 4096, "%s/%s", path, match2);
@ -326,10 +326,10 @@ _fetch(Evry_Plugin *p, const char *input)
{
found = 1;
break;
}
}
}
}
if (found || p == p2)
{
it = evry_item_new(p, _("Run Command"));
@ -393,7 +393,7 @@ _exec_app_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
if (app->file && strlen(app->file) > 0)
return 1;
return 0;
}
@ -405,21 +405,21 @@ _app_action(const Evry_Item *it_app, const Evry_Item *it_file)
Efreet_Desktop *desktop = NULL;
Eina_List *files = NULL;
char *exe = NULL;
if (!it_app) return 0;
app = it_app->data[0];
if (!app) return 0;
zone = e_util_zone_current_get(e_manager_current_get());
if (app->desktop)
{
if (it_file && it_file->uri)
files = eina_list_append(files, it_file->uri);
e_exec(zone, app->desktop, NULL, files, "everything");
if (it_file && it_file->mime)
e_exehist_mime_desktop_add(it_file->mime, app->desktop);
@ -436,7 +436,7 @@ _app_action(const Evry_Item *it_app, const Evry_Item *it_file)
snprintf(exe, len, "%s %s", app->file, it_file->uri);
}
else exe = (char *) app->file;
e_exec(zone, NULL, exe, NULL, NULL);
if (it_file && it_file->uri)
@ -457,7 +457,7 @@ _open_with_action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSE
{
Inst *inst = p->private;
if (inst->candidate)
return _app_action(it, inst->candidate);
return _app_action(it, inst->candidate);
}
static int
@ -489,11 +489,11 @@ _edit_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, c
e_user_homedir_get(), app->file);
desktop = efreet_desktop_empty_new(eina_stringshare_add(buf));
/* XXX check if this gets freed by efreet*/
desktop->exec = strdup(app->file);
desktop->exec = strdup(app->file);
}
e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop);
return 1;
}
@ -507,7 +507,7 @@ _new_app_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
if (app->file && strlen(app->file) > 0)
return 1;
return 0;
}
@ -525,7 +525,7 @@ _new_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, co
if (!it1) return 0;
app = it1->data[0];
if (app->desktop)
name = strdup(app->desktop->name);
else
@ -534,7 +534,7 @@ _new_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, co
if ((end = strchr(name, ' ')))
name[end - name] = '\0';
for (i = 0; i < 10; i++)
{
snprintf(buf, 4096, "%s/.local/share/applications/%s-%d.desktop",
@ -548,24 +548,24 @@ _new_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, co
}
free(name);
if (strlen(buf) == 0)
return 0;
if (!app->desktop)
{
desktop = efreet_desktop_empty_new(buf);
desktop->exec = strdup(app->file);
}
else
else
{
efreet_desktop_save_as(app->desktop, buf);
/*XXX hackish - desktop is removed on save_as..*/
efreet_desktop_new(app->desktop->orig_path);
desktop = efreet_desktop_new(buf);
}
e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop);
return 1;
@ -575,7 +575,7 @@ static Eina_Bool
_init(void)
{
char *path, *p, *last;
p1 = E_NEW(Evry_Plugin, 1);
p1->name = "Applications";
p1->type = type_subject;
@ -609,7 +609,7 @@ _init(void)
act->check_item = &_exec_app_check_item;
act->icon = "everything-launch";
evry_action_register(act);
act1 = E_NEW(Evry_Action, 1);
act1->name = "Open File...";
act1->type_in1 = "APPLICATION";
@ -654,7 +654,7 @@ _init(void)
exe_path = eina_list_append(exe_path, strdup(last));
free(path);
}
return EINA_TRUE;
}
@ -662,7 +662,7 @@ static void
_shutdown(void)
{
char *str;
evry_plugin_unregister(p1);
evry_plugin_unregister(p2);
evry_action_unregister(act);

View File

@ -293,26 +293,26 @@ _fetch(Evry_Plugin *plugin, const char *input)
* {
* const char *label;
* int len;
*
*
* if (!it) return EVRY_ACTION_CONTINUE;
*
*
* label = it->label;
* len = eina_stringshare_strlen(label);
*
*
* if (!ecore_x_selection_primary_set(clipboard_win, label, len))
* fprintf(stderr, "ASPELL cannot set primary selection to %#x '%s'\n",
* clipboard_win, label);
* if (!ecore_x_selection_clipboard_set(clipboard_win, label, len))
* fprintf(stderr, "ASPELL cannot set clipboard selection to %#x '%s'\n",
* clipboard_win, label);
*
*
* if (plugin->items)
* {
* Eina_List *l, *l_next;
* Evry_Item *it2;
*
*
* evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_CLEAR);
*
*
* EINA_LIST_FOREACH_SAFE(plugin->items, l, l_next, it2)
* {
* if (it == it2) continue;
@ -321,9 +321,9 @@ _fetch(Evry_Plugin *plugin, const char *input)
* E_FREE(it2);
* }
* }
*
*
* evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_ADD);
*
*
* return EVRY_ACTION_FINISHED;
* } */

View File

@ -99,14 +99,14 @@ _item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), c
else
prio = 0;
}
if (!prio) return;
it = evry_item_new(p, label);
it->data[0] = action_cb;
it->data[1] = (void *) eina_stringshare_add(icon);
it->priority = prio;
p->items = eina_list_prepend(p->items, it);
}
@ -140,12 +140,12 @@ _fetch(Evry_Plugin *p, const char *input __UNUSED__)
m1[0] = 0;
m2[0] = 0;
}
_item_add(p, _("Switch To"), _act_cb_border_switch_to, "go-next", m1, m2);
if (inst->border->iconic)
_item_add(p, _("Uniconify"), _act_cb_border_unminimize, "window-minimize", m1, m2);
else
else
_item_add(p, _("Iconify"), _act_cb_border_minimize, "window-minimize", m1, m2);
if (!inst->border->fullscreen)
@ -179,7 +179,7 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
{
Evas_Object *o;
o = e_icon_add(e);
o = e_icon_add(e);
evry_icon_theme_set(o, (const char *)it->data[1]);
/* icon = edje_object_add(e);

View File

@ -67,7 +67,7 @@ _action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSED__)
if (p->items->next)
{
it = p->items->data;
EINA_LIST_FOREACH(p->items->next, l, it2)
{
if (!strcmp(it->label, it2->label))
@ -97,7 +97,7 @@ static int
_fetch(Evry_Plugin *p, const char *input)
{
char buf[1024];
if (history)
{
p->items = history;
@ -119,7 +119,7 @@ _fetch(Evry_Plugin *p, const char *input)
ecore_exe_send(exe, buf, strlen(buf));
error = 0;
}
return 1;
}
@ -130,7 +130,7 @@ _item_add(Evry_Plugin *p, char *result, int prio)
it = evry_item_new(p, result);
if (!it) return;
p->items = eina_list_prepend(p->items, it);
}
@ -141,7 +141,7 @@ _cb_data(void *data __UNUSED__, int type __UNUSED__, void *event)
Ecore_Exe_Event_Data_Line *l;
if (ev->exe != exe) return 1;
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR);
for (l = ev->lines; l && l->line; l++)

View File

@ -22,7 +22,7 @@ _init(void)
{
Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1);
if (!win) return EINA_FALSE;
act = E_NEW(Evry_Action, 1);
act->name = "Copy to Clipboard";
act->is_default = EINA_TRUE;
@ -33,7 +33,7 @@ _init(void)
evry_action_register(act);
clipboard_win = win;
return EINA_TRUE;
}

View File

@ -25,10 +25,10 @@ _item_add(Evry_Plugin *p, const char *directory, const char *file)
{
Evry_Item *it = NULL;
char buf[4096];
it = evry_item_new(p, file);
if (!it) return NULL;
snprintf(buf, sizeof(buf), "%s/%s", directory, file);
it->uri = eina_stringshare_add(buf);
@ -41,7 +41,7 @@ _item_fill(Evry_Item *it)
const char *mime;
if (it->mime) return;
if ((e_util_glob_case_match(it->label, "*.desktop")) ||
(e_util_glob_case_match(it->label, "*.directory")))
{
@ -98,7 +98,7 @@ _dirbrowse_idler(void *data)
Evry_Item *it;
if (!idler) return 0;
EINA_LIST_FOREACH(s->items, l, it)
{
if (!it->mime)
@ -112,7 +112,7 @@ _dirbrowse_idler(void *data)
if (!s->command)
{
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR);
if (eina_list_count(p->items) > 0)
{
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
@ -120,14 +120,14 @@ _dirbrowse_idler(void *data)
}
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
if (cnt > 0)
{
idler = NULL;
return 0;
}
}
return 1;
}
@ -142,7 +142,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
s = E_NEW(State, 1);
s->directory = eina_stringshare_add(e_user_homedir_get());
p->items = NULL;
files = ecore_file_ls(s->directory);
EINA_LIST_FREE(files, file)
@ -156,7 +156,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
}
it = _item_add(p, s->directory, file);
if (it)
s->items = eina_list_append(s->items, it);
@ -170,7 +170,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
stack = eina_list_prepend(stack, s);
p->private = stack;
return 1;
}
@ -182,7 +182,7 @@ _browse(Evry_Plugin *p, const Evry_Item *it_file)
Eina_List *files;
Evry_Item *it;
Eina_List *stack = p->private;
if (!it_file || !it_file->uri || !ecore_file_is_dir(it_file->uri))
return 0;
@ -204,7 +204,7 @@ _browse(Evry_Plugin *p, const Evry_Item *it_file)
}
it = _item_add(p, s->directory, file);
if (it)
s->items = eina_list_append(s->items, it);
@ -226,9 +226,9 @@ _cleanup(Evry_Plugin *p)
State *s;
Evry_Item *it;
Eina_List *stack = p->private;
if (!stack) return;
s = stack->data;
if (s->directory) eina_stringshare_del(s->directory);
@ -239,21 +239,21 @@ _cleanup(Evry_Plugin *p)
if (it->mime) eina_stringshare_del(it->mime);
evry_item_free(it);
}
if (idler)
{
ecore_idler_del(idler);
idler = NULL;
}
E_FREE(s);
if (p->items) eina_list_free(p->items);
p->items = NULL;
stack = eina_list_remove_list(stack, stack);
p->private = stack;
if (stack)
{
s = stack->data;
@ -271,7 +271,7 @@ _fetch(Evry_Plugin *p, const char *input)
char match2[4096];
int cnt = 0;
State *s = ((Eina_List *)p->private)->data;
if (!s->command)
{
if (p->items) eina_list_free(p->items);
@ -291,7 +291,7 @@ _fetch(Evry_Plugin *p, const char *input)
s->cur = p->items;
s->command = EINA_TRUE;
return 1;
}
else if (!strncmp(input, "..", 2))
{
@ -301,9 +301,9 @@ _fetch(Evry_Plugin *p, const char *input)
int prio = 0;
if (!strcmp(s->directory, "/")) return 0;
snprintf(dir, 4096, "%s", s->directory);
end = strrchr(dir, '/');
end = strrchr(dir, '/');
while (end != dir)
{
@ -342,7 +342,7 @@ _fetch(Evry_Plugin *p, const char *input)
p->items = NULL;
s->command = EINA_FALSE;
}
if (!directory)
directory = s->directory;
@ -378,14 +378,14 @@ _fetch(Evry_Plugin *p, const char *input)
s->cur = p->items;
return 1;
}
return 0;
}
static Evas_Object *
_item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
{
Evas_Object *o = NULL;
Evas_Object *o = NULL;
char *icon_path;
if (!it->mime)
@ -395,7 +395,7 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
if (it->browseable)
{
o = e_icon_add(e);
o = e_icon_add(e);
evry_icon_theme_set(o, "folder");
}
else
@ -409,11 +409,11 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
}
if (!o)
{
o = e_icon_add(e);
o = e_icon_add(e);
evry_icon_theme_set(o, "none");
}
}
return o;
return o;
}
static Eina_Bool

View File

@ -23,7 +23,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
Inst *inst = p->private;
inst->active = 0;
if (!strcmp(it->plugin->type_out, "APPLICATION"))
{
Efreet_Desktop *desktop;
@ -40,10 +40,10 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
if (!app->desktop || !app->desktop->mime_types)
return 1;
rdf_query[0] = '\0';
strcat(rdf_query, "<rdfq:Condition><rdfq:or>");
EINA_LIST_FOREACH(app->desktop->mime_types, l, mime)
{
if (!strcmp(mime, "x-directory/normal"))
@ -71,7 +71,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
static void
_item_add(Evry_Plugin *p, char *file, char *mime, int prio)
{
Evry_Item *it;
Evry_Item *it;
const char *filename;
int folder = (!strcmp(mime, "Folder"));
@ -81,7 +81,7 @@ _item_add(Evry_Plugin *p, char *file, char *mime, int prio)
filename = ecore_file_file_get(file);
if (!filename) return;
it = evry_item_new(p, filename);
it->priority = prio;
it->uri = eina_stringshare_add(file);
@ -93,7 +93,7 @@ _item_add(Evry_Plugin *p, char *file, char *mime, int prio)
}
else
it->mime = eina_stringshare_add(mime);
p->items = eina_list_append(p->items, it);
}
@ -120,10 +120,10 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
char *uri, *mime, *date;
Evry_Plugin *p = data;
Inst *inst = p->private;
if (inst->active) inst->active--;
if (inst->active) return;
if (dbus_error_is_set(error))
{
printf("Error: %s - %s\n", error->name, error->message);
@ -135,9 +135,9 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
{
dbus_message_iter_recurse(&array, &item);
while(dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_ARRAY)
{
{
dbus_message_iter_recurse(&item, &iter);
if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING)
{
dbus_message_iter_get_basic(&iter, &uri);
@ -149,13 +149,13 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
/* dbus_message_iter_next(&iter);
* dbus_message_iter_get_basic(&iter, &date);
* printf("%s : %s\n", date, uri); */
if (uri && mime) _item_add(p, uri, mime, 1);
if (uri && mime) _item_add(p, uri, mime, 1);
}
dbus_message_iter_next(&item);
}
}
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
}
@ -173,7 +173,7 @@ _fetch(Evry_Plugin *p, const char *input)
char *search_text;
char *fields[2];
char *keywords[1];
char *sort_fields[1];
char *sort_fields[1];
fields[0] = "File:Mime";
/* fields[1] = "File:Modified"; */
fields[1] = "File:Accessed";
@ -188,22 +188,22 @@ _fetch(Evry_Plugin *p, const char *input)
if (!conn) return 0;
if (input && (strlen(input) > 2))
{
if (input && (strlen(input) > 2))
{
search_text = malloc(sizeof(char) * strlen(input) + 3);
sprintf(search_text, "*%s*", input);
max_hits = 50;
}
else if (!p->begin && p->type == type_object)
{
sort_by_access = 1;
search_text = "";
}
else return 0;
inst->active++;
msg = dbus_message_new_method_call("org.freedesktop.Tracker",
"/org/freedesktop/Tracker/Search",
"org.freedesktop.Tracker.Search",
@ -236,10 +236,10 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
{
char *icon_path;
Evas_Object *o = NULL;
if (it->browseable)
{
o = e_icon_add(e);
o = e_icon_add(e);
evry_icon_theme_set(o, "folder");
}
else
@ -253,7 +253,7 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
}
else
{
o = e_icon_add(e);
o = e_icon_add(e);
evry_icon_theme_set(o, "none");
}
}
@ -265,7 +265,7 @@ _plugin_new(const char *name, int type, char *service, int max_hits, int begin)
{
Evry_Plugin *p;
Inst *inst;
p = E_NEW(Evry_Plugin, 1);
p->name = name;
p->type = type;
@ -289,9 +289,9 @@ _plugin_new(const char *name, int type, char *service, int max_hits, int begin)
static Eina_Bool
_init(void)
{
{
conn = e_dbus_bus_get(DBUS_BUS_SESSION);
if (!conn) return EINA_FALSE;
_plugin_new("Folders", type_subject, "Folders", 20, 0);
@ -303,7 +303,7 @@ _init(void)
_plugin_new("Find Files", type_object, "Files", 20, 1);
_plugin_new("Folders", type_object, "Folders", 20, 0);
return EINA_TRUE;
}
@ -312,11 +312,11 @@ _shutdown(void)
{
Inst *inst;
Evry_Plugin *p;
if (conn) e_dbus_connection_close(conn);
EINA_LIST_FREE(plugins, p)
{
{
evry_plugin_unregister(p);
inst = p->private;
if (inst->condition[0]) free(inst->condition);