|
From: <enl...@li...> - 2005-06-05 15:02:49
|
Enlightenment CVS committal
Author : handyande
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_utils.h e_utils.c e_border.c e_int_menus.c
Log Message:
Add some e_utils integration, more to come - should help folk use the handy apps
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_utils.h 30 Apr 2005 04:21:55 -0000 1.6
+++ e_utils.h 5 Jun 2005 15:02:42 -0000 1.7
@@ -11,6 +11,8 @@
EAPI void e_util_wakeup(void);
EAPI void e_util_env_set(const char *var, const char *val);
EAPI E_Zone *e_util_zone_current_get(E_Manager *man);
+EAPI int e_util_utils_installed(void);
+EAPI int e_util_app_installed(char *app);
#endif
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- e_utils.c 3 Jun 2005 19:10:25 -0000 1.7
+++ e_utils.c 5 Jun 2005 15:02:42 -0000 1.8
@@ -113,3 +113,29 @@
_e_util_dummy_timer = NULL;
return 0;
}
+
+int
+e_util_utils_installed(void)
+{
+ return e_util_app_installed("emblem");
+}
+
+int
+e_util_app_installed(char *app)
+{
+ char *cmd, *tmp;
+ int ret, len;
+
+ if (!app)
+ return 0;
+
+ cmd = "which %s > /dev/null 2>&1";
+ len = strlen(cmd) + strlen(app) - 1; // -1 is -2 for "%s" and +1 for "\0"
+ tmp = malloc(len);
+ snprintf(tmp, len, cmd, app);
+
+ ret = system(tmp);
+ free(tmp);
+ return (ret == 0);
+}
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -3 -r1.241 -r1.242
--- e_border.c 4 Jun 2005 16:31:43 -0000 1.241
+++ e_border.c 5 Jun 2005 15:02:42 -0000 1.242
@@ -4277,43 +4277,46 @@
"widgets/border/default/sendto"),
"widgets/border/default/sendto");
- mi = e_menu_item_new(m);
- e_menu_item_separator_set(mi, 1);
-
- a = e_app_window_name_class_find(bd->client.icccm.name,
- bd->client.icccm.class);
-
- if (a)
+ if (e_util_app_installed("emblem"))
{
mi = e_menu_item_new(m);
- e_menu_item_label_set(mi, _("Edit Icon"));
- e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, a->path);
- e_menu_item_icon_edje_set(mi, a->path, "icon");
- }
- else if (bd->client.icccm.class) /* icons with no class useless to borders */
- {
- static char buf[PATH_MAX + 50];
- char *name, *homedir;
- int i, l;
-
- buf[0] = '\0';
- /* generate a reasonable file name from the window class */
- /* FIXME - I think there could be duplicates - how better to do this? */
- name = strdup(bd->client.icccm.class);
- l = strlen(name);
- for (i = 0; i < l; i++)
+ e_menu_item_separator_set(mi, 1);
+
+ a = e_app_window_name_class_find(bd->client.icccm.name,
+ bd->client.icccm.class);
+
+ if (a)
{
- if (name[i] == ' ') name[i] = '_';
+ mi = e_menu_item_new(m);
+ e_menu_item_label_set(mi, _("Edit Icon"));
+ e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, a->path);
+ e_menu_item_icon_edje_set(mi, a->path, "icon");
}
- /* previously this could be null, but it will exist now */
- homedir = e_user_homedir_get();
+ else if (bd->client.icccm.class) /* icons with no class useless to borders */
+ {
+ static char buf[PATH_MAX + 50];
+ char *name, *homedir;
+ int i, l;
+
+ buf[0] = '\0';
+ /* generate a reasonable file name from the window class */
+ /* FIXME - I think there could be duplicates - how better to do this? */
+ name = strdup(bd->client.icccm.class);
+ l = strlen(name);
+ for (i = 0; i < l; i++)
+ {
+ if (name[i] == ' ') name[i] = '_';
+ }
+ /* previously this could be null, but it will exist now */
+ homedir = e_user_homedir_get();
- snprintf(buf, sizeof(buf),
- "--win-class \"%s\" %s/.e/e/applications/all/%s.eapp",
- bd->client.icccm.class, homedir, name);
- mi = e_menu_item_new(m);
- e_menu_item_label_set(mi, _("Create Icon"));
- e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, buf);
+ snprintf(buf, sizeof(buf),
+ "--win-class \"%s\" %s/.e/e/applications/all/%s.eapp",
+ bd->client.icccm.class, homedir, name);
+ mi = e_menu_item_new(m);
+ e_menu_item_label_set(mi, _("Create Icon"));
+ e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, buf);
+ }
}
if (key)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- e_int_menus.c 2 Jun 2005 09:49:07 -0000 1.64
+++ e_int_menus.c 5 Jun 2005 15:02:43 -0000 1.65
@@ -19,6 +19,7 @@
/* local subsystem functions */
static void _e_int_menus_main_del_hook (void *obj);
static void _e_int_menus_main_about (void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_int_menus_main_run (void *data, E_Menu *m, E_Menu_Item*mi);
static void _e_int_menus_main_restart (void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_int_menus_main_exit (void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_int_menus_apps_scan (E_Menu *m);
@@ -122,6 +123,13 @@
e_menu_item_icon_edje_set(mi, s, "e");
IF_FREE(s);
e_menu_item_callback_set(mi, _e_int_menus_main_about, NULL);
+
+ if (e_util_app_installed("exige"))
+ {
+ mi = e_menu_item_new(m);
+ e_menu_item_label_set(mi, _("Run Command"));
+ e_menu_item_callback_set(mi, _e_int_menus_main_run, NULL);
+ }
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
@@ -250,6 +258,15 @@
}
static void
+_e_int_menus_main_run(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ Ecore_Exe *exe;
+
+ exe = ecore_exe_run("exige", NULL);
+ if (exe) ecore_exe_free(exe);
+}
+
+static void
_e_int_menus_main_restart(void *data, E_Menu *m, E_Menu_Item *mi)
{
restart = 1;
|