AC_C_CONST
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
+AC_FUNC_ALLOCA
AC_C___ATTRIBUTE__
AC_CHECK_FUNCS(setenv)
#include "config.h"
#endif
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
#if HAVE___ATTRIBUTE__
#define __UNUSED__ __attribute__((unused))
#else
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 */
EAPI Evas_List *e_app_exe_glob_list (char *exe);
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_save (E_App *a);
-EAPI E_App *e_app_raw_new (void);
-EAPI Ecore_List *e_app_dir_file_list_get (E_App *a);
-EAPI void e_app_fields_empty (E_App *a);
-EAPI int e_app_valid_exe_get (E_App *a);
-
+EAPI void e_app_fields_fill (E_App *a, const char *path);
+EAPI void e_app_fields_save (E_App *a);
+EAPI E_App *e_app_raw_new (void);
+EAPI Ecore_List *e_app_dir_file_list_get (E_App *a);
+EAPI void e_app_fields_empty (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
}
if (a)
{
- o = edje_object_add(evas);
- if (!e_util_edje_icon_list_set(o, a->icon_class))
- {
- edje_object_file_set(o, a->path, "icon");
- bd->app = a;
- e_object_ref(E_OBJECT(bd->app));
- }
+ o = e_app_icon_add(evas, a);
+ bd->app = a;
+ e_object_ref(E_OBJECT(bd->app));
return o;
}
else if (bd->client.netwm.icons)
if (!a) a = e_app_generic_find(cmd_buf);
if (a)
{
- o = edje_object_add(exebuf->evas);
- edje_object_file_set(o, a->path, "icon");
+ o = e_app_icon_add(exebuf->evas, a);
icon_object = o;
edje_object_part_swallow(bg_object, "icon_swallow", o);
evas_object_show(o);
evas_object_show(o);
if (edje_object_part_exists(exe->bg_object, "icon_swallow"))
{
- o = edje_object_add(exebuf->evas);
- edje_object_file_set(o, exe->app->path, "icon");
+ o = e_app_icon_add(exebuf->evas, exe->app);
exe->icon_object = o;
edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
evas_object_show(o);
a = e_app_exe_find(exe->file);
if (a)
{
- o = edje_object_add(exebuf->evas);
- edje_object_file_set(o, a->path, "icon");
+ o = e_app_icon_add(exebuf->evas, a);
exe->icon_object = o;
edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
evas_object_show(o);
evas_object_show(o);
}
- o = edje_object_add(_e_init_evas);
- edje_object_file_set(o,app->path, "icon");
+ o = e_app_icon_add(_e_init_evas, app);
evas_object_resize(o, _e_init_icon_size, _e_init_icon_size);
e_box_pack_end(_e_init_icon_box, o);
e_box_pack_options_set(o,
e_menu_item_label_set(mi, label);
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);
app_count++;
}
char buf[4096];
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));
app_count++;
}
// e_object_breadcrumb_add(E_OBJECT(bd), "clients_menu");
e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, bd);
if (!bd->iconic) e_menu_item_toggle_set(mi, 1);
- a = e_app_window_name_class_title_role_find(bd->client.icccm.name,
- bd->client.icccm.class,
- title,
- bd->client.icccm.window_role);
- if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
+ a = bd->app;
+ if (a)
+ {
+ 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");
+ }
}
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
e_object_ref(E_OBJECT(bd));
// e_object_breadcrumb_add(E_OBJECT(bd), "lost_clients_menu");
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,
- bd->client.icccm.class,
- title,
- bd->client.icccm.window_role);
- if (a) e_menu_item_icon_edje_set(mi, a->path, "icon");
+ a = bd->app;
+ if (a)
+ {
+ 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_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_lost_clients_free_hook);
e_object_data_set(E_OBJECT(m), borders);
char *p, *c;
if ((!list) || (!list[0])) return 0;
- buf = malloc(strlen(list) + 1);
+ buf = alloca(strlen(list) + 1);
p = list;
while (p)
{
{
strncpy(buf, p, c - p);
buf[c - p] = 0;
- if (e_util_edje_icon_set(obj, buf))
- {
- free(buf);
- return 1;
- }
+ if (e_util_edje_icon_set(obj, buf)) return 1;
p = c + 1;
- if (!*p)
- {
- free(buf);
- return 0;
- }
+ if (!*p) return 0;
}
else
{
strcpy(buf, p);
- if (e_util_edje_icon_set(obj, buf))
- {
- free(buf);
- return 1;
- }
- free(buf);
+ if (e_util_edje_icon_set(obj, buf)) return 1;
return 0;
}
}
- free(buf);
return 0;
}
char *p, *c;
if ((!list) || (!list[0])) return 0;
- buf = malloc(strlen(list) + 1);
+ buf = alloca(strlen(list) + 1);
p = list;
while (p)
{
{
strncpy(buf, p, c - p);
buf[c - p] = 0;
- if (e_util_menu_item_edje_icon_set(mi, buf))
- {
- free(buf);
- return 1;
- }
+ if (e_util_menu_item_edje_icon_set(mi, buf)) return 1;
p = c + 1;
- if (!*p)
- {
- free(buf);
- return 0;
- }
+ if (!*p) return 0;
}
else
{
strcpy(buf, p);
- if (e_util_menu_item_edje_icon_set(mi, buf))
- {
- free(buf);
- return 1;
- }
+ if (e_util_menu_item_edje_icon_set(mi, buf)) return 1;
+ return 0;
}
}
- free(buf);
return 0;
}