rewrite image handler to work more like notification-daemon (aka correctly)

SVN revision: 64701
This commit is contained in:
Mike Blumenkrantz 2011-11-03 14:32:55 +00:00
parent b516fb6bb1
commit 26d555de4d
1 changed files with 39 additions and 36 deletions

View File

@ -392,55 +392,58 @@ _notification_popup_refresh(Popup_Data *popup)
} }
/* Check if the app specify an icon either by a path or by a hint */ /* Check if the app specify an icon either by a path or by a hint */
if ((icon_path = e_notification_app_icon_get(popup->notif)) && *icon_path) img = e_notification_hint_image_data_get(popup->notif);
if (!img)
{ {
if (!memcmp(icon_path, "file://", 7)) icon_path += 7; icon_path = e_notification_hint_image_path_get(popup->notif);
if (!ecore_file_exists(icon_path)) if ((!icon_path) || (!icon_path[0]))
icon_path = e_notification_app_icon_get(popup->notif);
if (icon_path)
{ {
const char *new_path; if (!strncmp(icon_path, "file://", 7)) icon_path += 7;
unsigned int size; if (!ecore_file_exists(icon_path))
size = e_util_icon_size_normalize(width * e_scale);
new_path = efreet_icon_path_find(e_config->icon_theme,
icon_path, size);
if (new_path)
icon_path = new_path;
else
{ {
Evas_Object *o = e_icon_add(popup->e); const char *new_path;
if (!e_util_icon_theme_set(o, icon_path)) evas_object_del(o); unsigned int size;
size = e_util_icon_size_normalize(width * e_scale);
new_path = efreet_icon_path_find(e_config->icon_theme,
icon_path, size);
if (new_path)
icon_path = new_path;
else else
{ {
popup->app_icon = o; Evas_Object *o = e_icon_add(popup->e);
w = width; if (!e_util_icon_theme_set(o, icon_path)) evas_object_del(o);
h = height; else
{
popup->app_icon = o;
w = width;
h = height;
}
} }
} }
}
if (!popup->app_icon) if (!popup->app_icon)
{
popup->app_icon = e_icon_add(popup->e);
if (!e_icon_file_set(popup->app_icon, icon_path))
{ {
evas_object_del(popup->app_icon); popup->app_icon = e_icon_add(popup->e);
popup->app_icon = NULL; if (!e_icon_file_set(popup->app_icon, icon_path))
{
evas_object_del(popup->app_icon);
popup->app_icon = NULL;
}
else e_icon_size_get(popup->app_icon, &w, &h);
} }
else e_icon_size_get(popup->app_icon, &w, &h);
} }
} }
else if ((!img) && (!popup->app_icon))
img = e_notification_hint_icon_data_get(popup->notif);
if (img)
{ {
img = e_notification_hint_icon_data_get(popup->notif); popup->app_icon = e_notification_image_evas_object_add(popup->e, img);
if (!img) img = e_notification_hint_image_data_get(popup->notif); evas_object_image_filled_set(popup->app_icon, EINA_TRUE);
if (img) evas_object_image_alpha_set(popup->app_icon, EINA_TRUE);
{ evas_object_image_size_get(popup->app_icon, &w, &h);
popup->app_icon = e_notification_image_evas_object_add(popup->e,
img);
evas_object_image_filled_set(popup->app_icon, EINA_TRUE);
evas_object_image_alpha_set(popup->app_icon, EINA_TRUE);
evas_object_image_size_get(popup->app_icon, &w, &h);
}
} }
if (!popup->app_icon) if (!popup->app_icon)