Evry_Action.: reorganized and allow to check for subtype

- remove trigger from config when length is 0


SVN revision: 48389
This commit is contained in:
Hannes Janetzek 2010-04-28 12:58:24 +00:00
parent bc22c23029
commit 7016b51af8
11 changed files with 48 additions and 47 deletions

View File

@ -230,14 +230,7 @@ _finish(Evry_Plugin *plugin)
static int static int
_exec_open_file_action(Evry_Action *act) _exec_open_file_action(Evry_Action *act)
{ {
printf("exec\n"); return evry_util_exec_app(EVRY_ITEM(act), act->it1.item);
printf("exec %p %p\n", act, act->item1);
printf("exec %s\n", EVRY_ITEM(act)->label);
printf("exec %s\n", act->item1->label);
return evry_util_exec_app(EVRY_ITEM(act), act->item1);
} }
static Evas_Object * static Evas_Object *
@ -770,13 +763,13 @@ _exec_app_check_item(Evry_Action *act, const Evry_Item *it)
static int static int
_exec_app_action(Evry_Action *act) _exec_app_action(Evry_Action *act)
{ {
return evry_util_exec_app(act->item1, act->item2); return evry_util_exec_app(act->it1.item, act->it2.item);
} }
static int static int
_exec_term_action(Evry_Action *act) _exec_term_action(Evry_Action *act)
{ {
GET_APP(app, act->item1); GET_APP(app, act->it1.item);
Evry_Item_App *tmp; Evry_Item_App *tmp;
char buf[1024]; char buf[1024];
int ret; int ret;
@ -812,7 +805,7 @@ _exec_term_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
static int static int
_exec_sudo_action(Evry_Action *act) _exec_sudo_action(Evry_Action *act)
{ {
GET_APP(app, act->item1); GET_APP(app, act->it1.item);
Evry_Item_App *tmp; Evry_Item_App *tmp;
char buf[1024]; char buf[1024];
int ret; int ret;
@ -847,7 +840,7 @@ static int
_edit_app_action(Evry_Action *act) _edit_app_action(Evry_Action *act)
{ {
Efreet_Desktop *desktop; Efreet_Desktop *desktop;
GET_APP(app, act->item1); GET_APP(app, act->it1.item);
if (app->desktop) if (app->desktop)
desktop = app->desktop; desktop = app->desktop;
@ -891,7 +884,7 @@ _new_app_action(Evry_Action *act)
Efreet_Desktop *desktop; Efreet_Desktop *desktop;
int i; int i;
GET_APP(app, act->item1); GET_APP(app, act->it1.item);
if (app->desktop) if (app->desktop)
name = strdup(app->desktop->name); name = strdup(app->desktop->name);

View File

@ -859,9 +859,9 @@ _open_folder_action(Evry_Action *act)
m = e_manager_list(); m = e_manager_list();
GET_FILE(file, act->item1); GET_FILE(file, act->it1.item);
if (!act->item1->browseable) if (!act->it1.item->browseable)
{ {
path = ecore_file_dir_get(file->path); path = ecore_file_dir_get(file->path);
if (!path) return 0; if (!path) return 0;
@ -879,13 +879,13 @@ _open_folder_action(Evry_Action *act)
static int static int
_open_term_action(Evry_Action *act) _open_term_action(Evry_Action *act)
{ {
GET_FILE(file, act->item1); GET_FILE(file, act->it1.item);
Evry_Item_App *tmp; Evry_Item_App *tmp;
char cwd[4096]; char cwd[4096];
char *dir; char *dir;
int ret = 0; int ret = 0;
if (act->item1->browseable) if (act->it1.item->browseable)
dir = strdup(file->path); dir = strdup(file->path);
else else
dir = ecore_file_dir_get(file->path); dir = ecore_file_dir_get(file->path);
@ -919,7 +919,7 @@ _file_trash_action(Evry_Action *act)
char buf[PATH_MAX]; 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->item1); GET_FILE(file, act->it1.item);
if (!file->url) if (!file->url)
{ {
@ -948,8 +948,8 @@ _file_trash_action(Evry_Action *act)
static int static int
_file_copy_action(Evry_Action *act) _file_copy_action(Evry_Action *act)
{ {
GET_FILE(file, act->item1); GET_FILE(file, act->it1.item);
GET_FILE(dst, act->item2); GET_FILE(dst, act->it2.item);
char *path; char *path;
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -962,7 +962,7 @@ _file_copy_action(Evry_Action *act)
if (!path) return 0; if (!path) return 0;
snprintf(buf, sizeof(buf), "%s/%s", path, act->item1->label); snprintf(buf, sizeof(buf), "%s/%s", path, act->it1.item->label);
free(path); free(path);
if (EVRY_ITEM_DATA_INT_GET(act) == ACT_COPY) if (EVRY_ITEM_DATA_INT_GET(act) == ACT_COPY)

View File

@ -91,7 +91,7 @@ _action(Evry_Action *act)
char buf[1024]; char buf[1024];
int found = 0; int found = 0;
eci = act->item1->data; eci = act->it1.item->data;
con = e_container_current_get(e_manager_current_get()); con = e_container_current_get(e_manager_current_get());
EINA_LIST_FOREACH(e_configure_registry, l, ecat) EINA_LIST_FOREACH(e_configure_registry, l, ecat)

View File

@ -36,10 +36,10 @@ static Evry_Action *_act;
static int static int
_action(Evry_Action *act) _action(Evry_Action *act)
{ {
if (!evry_item_type_check(act->item1, "FILE", NULL)) if (!evry_item_type_check(act->it1.item, "FILE", NULL))
return 0; return 0;
GET_FILE(file, act->item1); GET_FILE(file, act->it1.item);
if (import) if (import)
{ {

View File

@ -286,7 +286,7 @@ _act_border(Evry_Action *act)
{ {
int action = EVRY_ITEM_DATA_INT_GET(act); int action = EVRY_ITEM_DATA_INT_GET(act);
E_Border *bd = act->item1->data; E_Border *bd = act->it1.item->data;
E_Zone *zone = e_util_zone_current_get(e_manager_current_get()); E_Zone *zone = e_util_zone_current_get(e_manager_current_get());
int focus = 0; int focus = 0;

View File

@ -168,11 +168,19 @@ struct _Evry_Action
/* identifier */ /* identifier */
const char *name; const char *name;
const char *type_in1; struct
const char *type_in2; {
const Evry_Item *item;
const char *type;
const char *subtype;
} it1;
const Evry_Item *item1; struct
const Evry_Item *item2; {
const Evry_Item *item;
const char *type;
const char *subtype;
} it2;
int (*action) (Evry_Action *act); int (*action) (Evry_Action *act);
int (*check_item) (Evry_Action *act, const Evry_Item *it); int (*check_item) (Evry_Action *act, const Evry_Item *it);

View File

@ -112,8 +112,6 @@ EAPI int
e_modapi_shutdown(E_Module *m __UNUSED__) e_modapi_shutdown(E_Module *m __UNUSED__)
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
printf("________________________________________________\n");
evry_shutdown(); evry_shutdown();
view_thumb_shutdown(); view_thumb_shutdown();
@ -148,7 +146,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
E_CONFIG_DD_FREE(plugin_conf_edd); E_CONFIG_DD_FREE(plugin_conf_edd);
E_CONFIG_DD_FREE(plugin_setting_edd); E_CONFIG_DD_FREE(plugin_setting_edd);
e_datastore_del("everything_loaded"); e_datastore_del("everything_loaded");
printf("________________________________________________\n");
return 1; return 1;
} }
@ -500,6 +497,11 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
} }
conf[type] = eina_list_append(conf[type], pc); conf[type] = eina_list_append(conf[type], pc);
} }
if (pc->trigger && strlen(pc->trigger) == 0)
{
eina_stringshare_del(pc->trigger);
pc->trigger = NULL;
}
p->config = pc; p->config = pc;
pc->plugin = p; pc->plugin = p;
@ -531,10 +533,10 @@ evry_plugin_unregister(Evry_Plugin *p)
if (l && eina_list_data_find_list(l, p->config)) if (l && eina_list_data_find_list(l, p->config))
{ {
/* char buf[256]; char buf[256];
* snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
*
* e_action_predef_name_del(_("Everything"), buf); */ e_action_predef_name_del(_("Everything"), buf);
} }
} }

View File

@ -1203,8 +1203,6 @@ _evry_state_pop(Evry_Selector *sel)
EINA_LIST_FREE(s->plugins, p) EINA_LIST_FREE(s->plugins, p)
p->finish(p); p->finish(p);
/* sel->aggregator->finish(sel->aggregator); */
if (s->sel_items) if (s->sel_items)
eina_list_free(s->sel_items); eina_list_free(s->sel_items);

View File

@ -167,8 +167,8 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{ {
if (pc->trigger) if (pc->trigger)
eina_stringshare_del(pc->trigger); eina_stringshare_del(pc->trigger);
if (cfdata->page[i].trigger[i]) if (cfdata->page[i].trigger[0])
pc->trigger = eina_stringshare_add(cfdata->page[i].trigger); pc->trigger = eina_stringshare_add(cfdata->page[i].trigger);
else else
pc->trigger = NULL; pc->trigger = NULL;

View File

@ -65,8 +65,8 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
EINA_LIST_FOREACH(evry_conf->actions, l, act) EINA_LIST_FOREACH(evry_conf->actions, l, act)
{ {
if ((!act->type_in1) || if ((!act->it1.type) ||
((act->type_in1 == type) && ((act->it1.type == type) &&
(!act->check_item || act->check_item(act, it)))) (!act->check_item || act->check_item(act, it))))
{ {
act->base.plugin = plugin; act->base.plugin = plugin;
@ -193,8 +193,8 @@ _action_free_cb(Evry_Item *it)
GET_ACTION(act, it); GET_ACTION(act, it);
if (act->name) eina_stringshare_del(act->name); if (act->name) eina_stringshare_del(act->name);
if (act->type_in1) eina_stringshare_del(act->type_in1); if (act->it1.type) eina_stringshare_del(act->it1.type);
if (act->type_in2) eina_stringshare_del(act->type_in2); if (act->it2.type) eina_stringshare_del(act->it2.type);
E_FREE(act); E_FREE(act);
} }
@ -214,8 +214,8 @@ evry_action_new(const char *name, const char *label,
act->name = eina_stringshare_add(name); act->name = eina_stringshare_add(name);
act->type_in1 = (type_in1 ? eina_stringshare_add(type_in1) : NULL); act->it1.type = (type_in1 ? eina_stringshare_add(type_in1) : NULL);
act->type_in2 = (type_in2 ? eina_stringshare_add(type_in2) : NULL); act->it2.type = (type_in2 ? eina_stringshare_add(type_in2) : NULL);
act->action = action; act->action = action;
act->check_item = check_item; act->check_item = check_item;

View File

@ -7,7 +7,7 @@ static Ecore_X_Window clipboard_win = 0;
static int static int
_action(Evry_Action *act) _action(Evry_Action *act)
{ {
const Evry_Item *it = act->item1; const Evry_Item *it = act->it1.item;
ecore_x_selection_primary_set(clipboard_win, it->label, strlen(it->label)); ecore_x_selection_primary_set(clipboard_win, it->label, strlen(it->label));
ecore_x_selection_clipboard_set(clipboard_win, it->label, strlen(it->label)); ecore_x_selection_clipboard_set(clipboard_win, it->label, strlen(it->label));