static int init(struct appdata *ad)
{
/* FIXME : add checking multiple instance */
-
xcnp_init(ad);
init_appview(ad);
init_scrcapture(ad);
char* filepath = NULL;
Eina_List *igl = NULL;
unsigned int igl_counter = 0;
- filepath = &imagepath[7]; // skip 'file://'
+
+ if (!check_regular_file(imagepath))
+ {
+ DTRACE("Error : it isn't normal file = %s\n", imagepath);
+ return -1;
+ }
igl = elm_gengrid_items_get(ad->imggrid);
igl_counter = eina_list_count(igl);
}
newgenimg = malloc(sizeof(gridimgitem_t));
- newgenimg->path = eina_stringshare_add(filepath);
+ newgenimg->path = eina_stringshare_add(imagepath);
newgenimg->item = elm_gengrid_item_append(ad->imggrid, &gic, newgenimg, NULL, NULL);
return TRUE;
for (i = 0; i < N_IMAGES; i++)
{
- newgenimg = malloc(sizeof(gridimgitem_t));
- newgenimg->path = eina_stringshare_add(g_images_path[i]);
- newgenimg->item = elm_gengrid_item_append(ad->imggrid, &gic, newgenimg, NULL, NULL);
-// evas_object_data_set(newgenimg->item, "URI", g_images_path[i]);
+ clipdrawer_add_image_item(g_images_path[i]);
}
evas_object_show (ad->imggrid);
return 0;
}
+int check_regular_file(char *path)
+{
+ struct stat fattr;
+ if (stat(path, &fattr))
+ {
+ DTRACE("Cannot get file at path = %s\n", path);
+ return FALSE;
+ }
+
+ return S_ISREG(fattr.st_mode);
+}
char *get_item_contents_by_pos(int pos);
int close_storage();
+int check_regular_file(char *path);
+
#endif // _storage_h_
struct appdata *ad = data;
DTRACE("xcnp_init().. start!\n");
- if(!_cbhm_init())
+ if(!_cbhm_init(ad))
{
DTRACE("Failed - _cbhm_init()..!\n");
return NULL;
1. does the file exist?
2. dose the file wanted type? */
if (!strncmp(unesc, "file://", 7) &&
- (strstr(unesc,".png") || strstr(unesc,".jpg")))
+ (strstr(unesc,".png") || strstr(unesc,".jpg")) &&
+ check_regular_file(unesc+7))
{
- DTRACE("clipdrawer add path = %s\n", unesc);
- clipdrawer_add_image_item(unesc);
+ DTRACE("clipdrawer add path = %s\n", unesc+7);
+ clipdrawer_add_image_item(unesc+7);
}
else
add_to_storage_buffer(ad, unesc, unesc_len);
return 0;
}
-static int _cbhm_init()
+static int _cbhm_init(void *data)
{
+ struct appdata *ad = data;
//Set default data structure
//Control that the libraries are properly initialized
if (!ecore_init()) return EXIT_FAILURE;
int set_selection_secondary_data(char *sdata)
{
-// elm_selection_set(1, obj, /*mark up*/1, p);
Ecore_X_Window setwin = get_selection_secondary_target_win();
if (setwin == None)
return 0;
int get_selection_content(void *data);
int processing_selection_request(Ecore_X_Event_Selection_Request *ev);
-static int _cbhm_init();
+static int _cbhm_init(void *data);
static void _cbhm_fini();
static int _xsel_clear_cb(void *data, int ev_type, void *event);
static int _xsel_request_cb(void *data, int ev_type, void *event);