typedef char *(*text_converter_func)(AppData *ad, int type_index, const char *str);
#define ITEM_CNT_MAX 20
+#define COPIED_DATA_STORAGE_DIR "/opt/var/.cbhm_files"
#include "clipdrawer.h"
#include "item_manager.h"
item->ad->storage_item_del(item->ad, item);
}
if (item->data)
+ {
+ if(item->type_index == ATOM_INDEX_IMAGE)
+ ecore_file_remove(item->data);
+
FREE(item->data);
+ }
if (item->ad)
{
CNP_ITEM *item_add_by_data(AppData *ad, Ecore_X_Atom type, void *data, int len)
{
+ char *copied_path = NULL;
+ char *filename = NULL;
+ int size_path=0;
+
if (!ad || !data)
{
DMSG("WRONG PARAMETER in %s\n", __func__);
if (!item)
return NULL;
item->type_index = atom_type_index_get(ad, type);
+
+ if(item->type_index == ATOM_INDEX_IMAGE)
+ {
+ filename = ecore_file_file_get(data);
+ size_path = snprintf(NULL, 0, COPIED_DATA_STORAGE_DIR"/%s", filename) + 1;
+ copied_path = MALLOC(sizeof(char) * size_path);
+
+ if(copied_path)
+ snprintf(copied_path, size_path, COPIED_DATA_STORAGE_DIR"/%s", filename);
+
+ if(!ecore_file_cp(data, copied_path))
+ DMSG("ecore_file_cp fail!");
+
+ data = copied_path;
+ len = strlen(copied_path) + 1;
+ }
+
item->data = data;
item->len = len;
{
ad->x_disp = ecore_x_display_get();
DMSG("x_disp: 0x%x\n", ad->x_disp);
+
+ if(!ecore_file_mkpath(COPIED_DATA_STORAGE_DIR))
+ DMSG("ecore_file_mkpath fail");
+
if (ad->x_disp)
{
Ecore_X_Atom clipboard_manager_atom = XInternAtom(ad->x_disp, ATOM_CLIPBOARD_MANAGER_NAME, False);