forked from enlightenment/enlightenment
centralise getting icon evas object from app
SVN revision: 19038
This commit is contained in:
parent
9e16ed30e9
commit
912cf96418
|
@ -17,6 +17,7 @@ AC_HEADER_STDC
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AM_ENABLE_SHARED
|
AM_ENABLE_SHARED
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
AC_FUNC_ALLOCA
|
||||||
AC_C___ATTRIBUTE__
|
AC_C___ATTRIBUTE__
|
||||||
|
|
||||||
AC_CHECK_FUNCS(setenv)
|
AC_CHECK_FUNCS(setenv)
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ALLOCA_H
|
||||||
|
#include <alloca.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE___ATTRIBUTE__
|
#if HAVE___ATTRIBUTE__
|
||||||
#define __UNUSED__ __attribute__((unused))
|
#define __UNUSED__ __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1242,6 +1242,17 @@ e_app_valid_exe_get(E_App *a)
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
e_app_icon_add(Evas *evas, E_App *a)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
if (!e_util_edje_icon_list_set(o, a->icon_class))
|
||||||
|
edje_object_file_set(o, a->path, "icon");
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
|
|
||||||
|
|
|
@ -106,12 +106,13 @@ EAPI Evas_List *e_app_generic_glob_list (char *generic);
|
||||||
EAPI Evas_List *e_app_exe_glob_list (char *exe);
|
EAPI Evas_List *e_app_exe_glob_list (char *exe);
|
||||||
EAPI Evas_List *e_app_comment_glob_list (char *comment);
|
EAPI Evas_List *e_app_comment_glob_list (char *comment);
|
||||||
|
|
||||||
EAPI void e_app_fields_fill (E_App *a, const char *path);
|
EAPI void e_app_fields_fill (E_App *a, const char *path);
|
||||||
EAPI void e_app_fields_save (E_App *a);
|
EAPI void e_app_fields_save (E_App *a);
|
||||||
EAPI E_App *e_app_raw_new (void);
|
EAPI E_App *e_app_raw_new (void);
|
||||||
EAPI Ecore_List *e_app_dir_file_list_get (E_App *a);
|
EAPI Ecore_List *e_app_dir_file_list_get (E_App *a);
|
||||||
EAPI void e_app_fields_empty (E_App *a);
|
EAPI void e_app_fields_empty (E_App *a);
|
||||||
EAPI int e_app_valid_exe_get (E_App *a);
|
EAPI int e_app_valid_exe_get (E_App *a);
|
||||||
|
EAPI Evas_Object *e_app_icon_add (Evas *evas, E_App *a);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2336,13 +2336,9 @@ e_border_icon_add(E_Border *bd, Evas *evas)
|
||||||
}
|
}
|
||||||
if (a)
|
if (a)
|
||||||
{
|
{
|
||||||
o = edje_object_add(evas);
|
o = e_app_icon_add(evas, a);
|
||||||
if (!e_util_edje_icon_list_set(o, a->icon_class))
|
bd->app = a;
|
||||||
{
|
e_object_ref(E_OBJECT(bd->app));
|
||||||
edje_object_file_set(o, a->path, "icon");
|
|
||||||
bd->app = a;
|
|
||||||
e_object_ref(E_OBJECT(bd->app));
|
|
||||||
}
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
else if (bd->client.netwm.icons)
|
else if (bd->client.netwm.icons)
|
||||||
|
|
|
@ -293,8 +293,7 @@ _e_exebuf_update(void)
|
||||||
if (!a) a = e_app_generic_find(cmd_buf);
|
if (!a) a = e_app_generic_find(cmd_buf);
|
||||||
if (a)
|
if (a)
|
||||||
{
|
{
|
||||||
o = edje_object_add(exebuf->evas);
|
o = e_app_icon_add(exebuf->evas, a);
|
||||||
edje_object_file_set(o, a->path, "icon");
|
|
||||||
icon_object = o;
|
icon_object = o;
|
||||||
edje_object_part_swallow(bg_object, "icon_swallow", o);
|
edje_object_part_swallow(bg_object, "icon_swallow", o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
@ -742,8 +741,7 @@ _e_exebuf_matches_update(void)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
if (edje_object_part_exists(exe->bg_object, "icon_swallow"))
|
if (edje_object_part_exists(exe->bg_object, "icon_swallow"))
|
||||||
{
|
{
|
||||||
o = edje_object_add(exebuf->evas);
|
o = e_app_icon_add(exebuf->evas, exe->app);
|
||||||
edje_object_file_set(o, exe->app->path, "icon");
|
|
||||||
exe->icon_object = o;
|
exe->icon_object = o;
|
||||||
edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
|
edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
@ -787,8 +785,7 @@ _e_exebuf_matches_update(void)
|
||||||
a = e_app_exe_find(exe->file);
|
a = e_app_exe_find(exe->file);
|
||||||
if (a)
|
if (a)
|
||||||
{
|
{
|
||||||
o = edje_object_add(exebuf->evas);
|
o = e_app_icon_add(exebuf->evas, a);
|
||||||
edje_object_file_set(o, a->path, "icon");
|
|
||||||
exe->icon_object = o;
|
exe->icon_object = o;
|
||||||
edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
|
edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
|
@ -216,8 +216,7 @@ e_init_icons_app_add(E_App *app)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
o = edje_object_add(_e_init_evas);
|
o = e_app_icon_add(_e_init_evas, app);
|
||||||
edje_object_file_set(o,app->path, "icon");
|
|
||||||
evas_object_resize(o, _e_init_icon_size, _e_init_icon_size);
|
evas_object_resize(o, _e_init_icon_size, _e_init_icon_size);
|
||||||
e_box_pack_end(_e_init_icon_box, o);
|
e_box_pack_end(_e_init_icon_box, o);
|
||||||
e_box_pack_options_set(o,
|
e_box_pack_options_set(o,
|
||||||
|
|
|
@ -443,7 +443,9 @@ _e_int_menus_apps_scan(E_Menu *m)
|
||||||
e_menu_item_label_set(mi, label);
|
e_menu_item_label_set(mi, label);
|
||||||
if (a->exe)
|
if (a->exe)
|
||||||
{
|
{
|
||||||
e_menu_item_icon_edje_set(mi, a->path, "icon");
|
if (!((a->icon_class) &&
|
||||||
|
(e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
|
||||||
|
e_menu_item_icon_edje_set(mi, a->path, "icon");
|
||||||
e_menu_item_callback_set(mi, _e_int_menus_apps_run, a);
|
e_menu_item_callback_set(mi, _e_int_menus_apps_run, a);
|
||||||
app_count++;
|
app_count++;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +454,9 @@ _e_int_menus_apps_scan(E_Menu *m)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/.directory.eap", a->path);
|
snprintf(buf, sizeof(buf), "%s/.directory.eap", a->path);
|
||||||
e_menu_item_icon_edje_set(mi, buf, "icon");
|
if (!((a->icon_class) &&
|
||||||
|
(e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
|
||||||
|
e_menu_item_icon_edje_set(mi, buf, "icon");
|
||||||
e_menu_item_submenu_set(mi, e_int_menus_apps_new(a->path));
|
e_menu_item_submenu_set(mi, e_int_menus_apps_new(a->path));
|
||||||
app_count++;
|
app_count++;
|
||||||
}
|
}
|
||||||
|
@ -711,11 +715,13 @@ _e_int_menus_clients_pre_cb(void *data, E_Menu *m)
|
||||||
// e_object_breadcrumb_add(E_OBJECT(bd), "clients_menu");
|
// e_object_breadcrumb_add(E_OBJECT(bd), "clients_menu");
|
||||||
e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, bd);
|
e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, bd);
|
||||||
if (!bd->iconic) e_menu_item_toggle_set(mi, 1);
|
if (!bd->iconic) e_menu_item_toggle_set(mi, 1);
|
||||||
a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
|
a = bd->app;
|
||||||
bd->client.icccm.class,
|
if (a)
|
||||||
title,
|
{
|
||||||
bd->client.icccm.window_role);
|
if (!((a->icon_class) &&
|
||||||
if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
|
(e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
|
||||||
|
e_menu_item_icon_edje_set(mi, a->path, "icon");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mi = e_menu_item_new(m);
|
mi = e_menu_item_new(m);
|
||||||
e_menu_item_separator_set(mi, 1);
|
e_menu_item_separator_set(mi, 1);
|
||||||
|
@ -996,11 +1002,13 @@ _e_int_menus_lost_clients_pre_cb(void *data, E_Menu *m)
|
||||||
e_object_ref(E_OBJECT(bd));
|
e_object_ref(E_OBJECT(bd));
|
||||||
// e_object_breadcrumb_add(E_OBJECT(bd), "lost_clients_menu");
|
// e_object_breadcrumb_add(E_OBJECT(bd), "lost_clients_menu");
|
||||||
e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, bd);
|
e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, bd);
|
||||||
a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
|
a = bd->app;
|
||||||
bd->client.icccm.class,
|
if (a)
|
||||||
title,
|
{
|
||||||
bd->client.icccm.window_role);
|
if (!((a->icon_class) &&
|
||||||
if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
|
(e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
|
||||||
|
e_menu_item_icon_edje_set(mi, a->path, "icon");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_lost_clients_free_hook);
|
e_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_lost_clients_free_hook);
|
||||||
e_object_data_set(E_OBJECT(m), borders);
|
e_object_data_set(E_OBJECT(m), borders);
|
||||||
|
|
|
@ -307,7 +307,7 @@ e_util_edje_icon_list_set(Evas_Object *obj, char *list)
|
||||||
char *p, *c;
|
char *p, *c;
|
||||||
|
|
||||||
if ((!list) || (!list[0])) return 0;
|
if ((!list) || (!list[0])) return 0;
|
||||||
buf = malloc(strlen(list) + 1);
|
buf = alloca(strlen(list) + 1);
|
||||||
p = list;
|
p = list;
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
|
@ -316,31 +316,17 @@ e_util_edje_icon_list_set(Evas_Object *obj, char *list)
|
||||||
{
|
{
|
||||||
strncpy(buf, p, c - p);
|
strncpy(buf, p, c - p);
|
||||||
buf[c - p] = 0;
|
buf[c - p] = 0;
|
||||||
if (e_util_edje_icon_set(obj, buf))
|
if (e_util_edje_icon_set(obj, buf)) return 1;
|
||||||
{
|
|
||||||
free(buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
p = c + 1;
|
p = c + 1;
|
||||||
if (!*p)
|
if (!*p) return 0;
|
||||||
{
|
|
||||||
free(buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(buf, p);
|
strcpy(buf, p);
|
||||||
if (e_util_edje_icon_set(obj, buf))
|
if (e_util_edje_icon_set(obj, buf)) return 1;
|
||||||
{
|
|
||||||
free(buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
free(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +337,7 @@ e_util_menu_item_edje_icon_list_set(E_Menu_Item *mi, char *list)
|
||||||
char *p, *c;
|
char *p, *c;
|
||||||
|
|
||||||
if ((!list) || (!list[0])) return 0;
|
if ((!list) || (!list[0])) return 0;
|
||||||
buf = malloc(strlen(list) + 1);
|
buf = alloca(strlen(list) + 1);
|
||||||
p = list;
|
p = list;
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
|
@ -360,29 +346,17 @@ e_util_menu_item_edje_icon_list_set(E_Menu_Item *mi, char *list)
|
||||||
{
|
{
|
||||||
strncpy(buf, p, c - p);
|
strncpy(buf, p, c - p);
|
||||||
buf[c - p] = 0;
|
buf[c - p] = 0;
|
||||||
if (e_util_menu_item_edje_icon_set(mi, buf))
|
if (e_util_menu_item_edje_icon_set(mi, buf)) return 1;
|
||||||
{
|
|
||||||
free(buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
p = c + 1;
|
p = c + 1;
|
||||||
if (!*p)
|
if (!*p) return 0;
|
||||||
{
|
|
||||||
free(buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(buf, p);
|
strcpy(buf, p);
|
||||||
if (e_util_menu_item_edje_icon_set(mi, buf))
|
if (e_util_menu_item_edje_icon_set(mi, buf)) return 1;
|
||||||
{
|
return 0;
|
||||||
free(buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue