Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_actions.c e_apps.c e_apps.h
Log Message:
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...
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_actions.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_actions.c 25 May 2005 08:08:43 -0000 1.9
+++ e_actions.c 2 Jun 2005 08:25:14 -0000 1.10
@@ -472,6 +472,18 @@
/***************************************************************************/
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;
if (!obj) return;
@@ -481,10 +493,28 @@
{
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 @@
ACT_GO_KEY(menu_show);
ACT_GO(exec);
+
+ ACT_GO(app);
return 1;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- e_apps.c 11 May 2005 09:07:37 -0000 1.44
+++ e_apps.c 2 Jun 2005 08:25:14 -0000 1.45
@@ -429,6 +429,114 @@
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)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- e_apps.h 3 May 2005 17:27:40 -0000 1.12
+++ e_apps.h 2 Jun 2005 08:25:14 -0000 1.13
@@ -73,6 +73,10 @@
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
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs