add exebuf to the main menu as run command, and add app menu config

formatting to exebuf display of apps


SVN revision: 19710
This commit is contained in:
Carsten Haitzler 2006-01-11 04:23:40 +00:00
parent 36611d3800
commit ec34d0c511
2 changed files with 33 additions and 13 deletions

View File

@ -767,6 +767,7 @@ _e_exebuf_matches_update(void)
E_Exebuf_Exe *exe;
Evas_Coord mw, mh;
Evas_Object *o;
int opt = 0;
exe = calloc(1, sizeof(E_Exebuf_Exe));
eaps = evas_list_append(eaps, exe);
@ -776,7 +777,18 @@ _e_exebuf_matches_update(void)
exe->bg_object = o;
e_theme_edje_object_set(o, "base/theme/exebuf",
"widgets/exebuf/item");
edje_object_part_text_set(o, "title_text", exe->app->name);
if (e_config->menu_eap_name_show && exe->app->name) opt |= 0x4;
if (e_config->menu_eap_generic_show && exe->app->generic) opt |= 0x2;
if (e_config->menu_eap_comment_show && exe->app->comment) opt |= 0x1;
if (opt == 0x7) snprintf(buf, sizeof(buf), "%s (%s) [%s]", exe->app->name, exe->app->generic, exe->app->comment);
else if (opt == 0x6) snprintf(buf, sizeof(buf), "%s (%s)", exe->app->name, exe->app->generic);
else if (opt == 0x5) snprintf(buf, sizeof(buf), "%s [%s]", exe->app->name, exe->app->comment);
else if (opt == 0x4) snprintf(buf, sizeof(buf), "%s", exe->app->name);
else if (opt == 0x3) snprintf(buf, sizeof(buf), "%s [%s]", exe->app->generic, exe->app->comment);
else if (opt == 0x2) snprintf(buf, sizeof(buf), "%s", exe->app->generic);
else if (opt == 0x1) snprintf(buf, sizeof(buf), "%s", exe->app->comment);
else snprintf(buf, sizeof(buf), "%s", exe->app->name);
edje_object_part_text_set(o, "title_text", buf);
evas_object_show(o);
if (edje_object_part_exists(exe->bg_object, "icon_swallow"))
{

View File

@ -23,6 +23,7 @@ static void _e_int_menus_quit (void);
static void _e_int_menus_quit_cb (void *data);
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 int _e_int_menus_main_run_defer_cb (void *data);
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);
@ -79,6 +80,11 @@ e_int_menus_main_new(void)
e_util_menu_item_edje_icon_set(mi, "enlightenment/favorites");
e_menu_item_submenu_set(mi, subm);
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Run Command"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/run");
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);
@ -132,14 +138,6 @@ e_int_menus_main_new(void)
e_util_menu_item_edje_icon_set(mi, "enlightenment/e");
e_menu_item_callback_set(mi, _e_int_menus_main_about, NULL);
if (ecore_file_app_installed("exige"))
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Run Command"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/run");
e_menu_item_callback_set(mi, _e_int_menus_main_run, NULL);
}
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Files"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/fileman");
@ -370,13 +368,23 @@ _e_int_menus_themes_about(void *data, E_Menu *m, E_Menu_Item *mi)
if (about) e_theme_about_show(about);
}
/* FIXME: this is a workaround for menus' haveing a key grab ANd exebuf
* wanting one too
*/
static int
_e_int_menus_main_run_defer_cb(void *data)
{
E_Zone *zone;
zone = data;
e_exebuf_show(zone);
return 0;
}
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);
ecore_idle_enterer_add(_e_int_menus_main_run_defer_cb, m->zone);
}
static void