move e_util_icon_save to e_desktop_editor for better waylanding

This commit is contained in:
Mike Blumenkrantz 2013-08-19 14:12:21 +01:00
parent c2be19c093
commit 1b22c40555
3 changed files with 33 additions and 33 deletions

View File

@ -61,6 +61,38 @@ static void _e_desktop_editor_icon_entry_changed(void *data, Evas_Object
#define IFDUP(src, dst) if (src) dst = strdup(src); else \ #define IFDUP(src, dst) if (src) dst = strdup(src); else \
dst = NULL dst = NULL
static int
_e_util_icon_save(Ecore_X_Icon *icon, const char *filename)
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *im;
int ret;
ee = ecore_evas_buffer_new(icon->width, icon->height);
if (!ee) return 0;
evas = ecore_evas_get(ee);
evas_image_cache_set(evas, 0);
evas_font_cache_set(evas, 0);
im = evas_object_image_add(evas);
if (!im)
{
ecore_evas_free(ee);
return 0;
}
evas_object_move(im, 0, 0);
evas_object_resize(im, icon->width, icon->height);
evas_object_image_size_set(im, icon->width, icon->height);
evas_object_image_data_copy_set(im, icon->data);
evas_object_image_alpha_set(im, 1);
evas_object_show(im);
ret = evas_object_image_save(im, filename, NULL, NULL);
evas_object_del(im);
ecore_evas_free(ee);
return ret;
}
/* externally accessible functions */ /* externally accessible functions */
EAPI Efreet_Desktop * EAPI Efreet_Desktop *
@ -143,7 +175,7 @@ e_desktop_client_create(E_Client *ec)
snprintf(file, sizeof(file), "%s-%.6f.png", bname ?: "", ecore_time_get()); snprintf(file, sizeof(file), "%s-%.6f.png", bname ?: "", ecore_time_get());
snprintf(path, sizeof(path), "%s/%s", icon_dir, file); snprintf(path, sizeof(path), "%s/%s", icon_dir, file);
if (e_util_icon_save(&(ec->netwm.icons[0]), path)) if (_e_util_icon_save(&(ec->netwm.icons[0]), path))
desktop->icon = strdup(file); desktop->icon = strdup(file);
else else
fprintf(stderr, "Could not save file from ARGB: %s\n", path); fprintf(stderr, "Could not save file from ARGB: %s\n", path);

View File

@ -614,37 +614,6 @@ e_util_filename_escape(const char *filename)
return buf; return buf;
} }
EAPI int
e_util_icon_save(Ecore_X_Icon *icon, const char *filename)
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *im;
int ret;
ee = ecore_evas_buffer_new(icon->width, icon->height);
if (!ee) return 0;
evas = ecore_evas_get(ee);
evas_image_cache_set(evas, 0);
evas_font_cache_set(evas, 0);
im = evas_object_image_add(evas);
if (!im)
{
ecore_evas_free(ee);
return 0;
}
evas_object_move(im, 0, 0);
evas_object_resize(im, icon->width, icon->height);
evas_object_image_size_set(im, icon->width, icon->height);
evas_object_image_data_copy_set(im, icon->data);
evas_object_image_alpha_set(im, 1);
evas_object_show(im);
ret = evas_object_image_save(im, filename, NULL, NULL);
evas_object_del(im);
ecore_evas_free(ee);
return ret;
}
EAPI char * EAPI char *
e_util_shell_env_path_eval(const char *path) e_util_shell_env_path_eval(const char *path)

View File

@ -39,7 +39,6 @@ EAPI E_Client *e_util_desk_client_below(E_Client *ec);
EAPI int e_util_edje_collection_exists(const char *file, const char *coll); EAPI int e_util_edje_collection_exists(const char *file, const char *coll);
EAPI E_Dialog *e_util_dialog_internal(const char *title, const char *txt); EAPI E_Dialog *e_util_dialog_internal(const char *title, const char *txt);
EAPI const char *e_util_filename_escape(const char *filename); EAPI const char *e_util_filename_escape(const char *filename);
EAPI int e_util_icon_save(Ecore_X_Icon *icon, const char *filename);
EAPI char *e_util_shell_env_path_eval(const char *path); EAPI char *e_util_shell_env_path_eval(const char *path);
EAPI char *e_util_size_string_get(off_t size); EAPI char *e_util_size_string_get(off_t size);
EAPI char *e_util_file_time_get(time_t ftime); EAPI char *e_util_file_time_get(time_t ftime);