an app action - that launches an app - looked up by varios means (exe, name,

generic, filename)

the parameters to the "app" action can be

  name: Gnome Terminal
OR
  name: XMMS
OR
  exe: xmms
OR
  exe: gimp
OR
  generic: Web Browser
OR
  generic: Terminal
OR
  file: xterm.eapp
OR
  file: gimp.eapp

as a sample...


SVN revision: 15053
This commit is contained in:
Carsten Haitzler 2005-06-02 08:25:14 +00:00
parent 22b7afa394
commit 747900bff1
4 changed files with 148 additions and 5 deletions

1
TODO
View File

@ -55,7 +55,6 @@ Also look at all the .c files - they have their own localized TODO lists
These are in no particular order:
* add app execute action (execute eapp - not just exe line)
* add locale and encoding fields to eapp files (to launch eapp in that locale+encoding)
* add input method selector stuff to eapp - same as locale
* libechack needs to come back - and execute all things with libehack preloads active

View File

@ -471,6 +471,18 @@ ACT_FN_GO_KEY(menu_show)
/***************************************************************************/
ACT_FN_GO(exec)
{
if (params)
{
Ecore_Exe *exe;
exe = ecore_exe_run(params, NULL);
if (exe) ecore_exe_free(exe);
}
}
/***************************************************************************/
ACT_FN_GO(app)
{
E_Zone *zone;
@ -481,10 +493,28 @@ ACT_FN_GO(exec)
{
if (params)
{
Ecore_Exe *exe;
E_App *a = NULL;
char *p, *p2;
exe = ecore_exe_run(params, NULL);
if (exe) ecore_exe_free(exe);
p2 = strdup(params);
if (p2)
{
p = strchr(p2, ' ');
if (p)
{
*p = 0;
if (!strcmp(p2, "file:"))
a = e_app_file_find(p + 1);
else if (!strcmp(p2, "name:"))
a = e_app_name_find(p + 1);
else if (!strcmp(p2, "generic:"))
a = e_app_generic_find(p + 1);
else if (!strcmp(p2, "exe:"))
a = e_app_exe_find(p + 1);
if (a) e_app_exec(a);
}
free(p2);
}
}
}
}
@ -543,6 +573,8 @@ e_actions_init(void)
ACT_GO_KEY(menu_show);
ACT_GO(exec);
ACT_GO(app);
return 1;
}

View File

@ -429,6 +429,114 @@ e_app_window_name_class_find(char *name, char *class)
return NULL;
}
E_App *
e_app_file_find(char *file)
{
Evas_List *l;
if (!file) return NULL;
for (l = _e_apps_list; l; l = l->next)
{
E_App *a;
a = l->data;
if (a->path)
{
char *p;
p = strchr(a->path, '/');
if (p)
{
p++;
if (!strcmp(p, file))
{
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
_e_apps_list = evas_list_prepend(_e_apps_list, a);
return a;
}
}
}
}
return NULL;
}
E_App *
e_app_name_find(char *name)
{
Evas_List *l;
if (!name) return NULL;
for (l = _e_apps_list; l; l = l->next)
{
E_App *a;
a = l->data;
if (a->name)
{
if (!strcasecmp(a->name, name))
{
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
_e_apps_list = evas_list_prepend(_e_apps_list, a);
return a;
}
}
}
return NULL;
}
E_App *
e_app_generic_find(char *generic)
{
Evas_List *l;
if (!generic) return NULL;
for (l = _e_apps_list; l; l = l->next)
{
E_App *a;
a = l->data;
if (a->generic)
{
if (!strcasecmp(a->generic, generic))
{
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
_e_apps_list = evas_list_prepend(_e_apps_list, a);
return a;
}
}
}
return NULL;
}
E_App *
e_app_exe_find(char *exe)
{
Evas_List *l;
if (!exe) return NULL;
for (l = _e_apps_list; l; l = l->next)
{
E_App *a;
a = l->data;
if (a->exe)
{
if (!strcmp(a->exe, exe))
{
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
_e_apps_list = evas_list_prepend(_e_apps_list, a);
return a;
}
}
}
return NULL;
}
/* local subsystem functions */
static void
_e_app_free(E_App *a)

View File

@ -73,6 +73,10 @@ EAPI void e_app_change_callback_add(void (*func) (void *data, E_App *a, E_App_
EAPI void e_app_change_callback_del(void (*func) (void *data, E_App *a, E_App_Change ch), void *data);
EAPI E_App *e_app_window_name_class_find(char *name, char *class);
EAPI E_App *e_app_file_find(char *file);
EAPI E_App *e_app_name_find(char *name);
EAPI E_App *e_app_generic_find(char *generic);
EAPI E_App *e_app_exe_find(char *exe);
#endif
#endif