int pos = get_current_history_position()-hc;
if (pos < 0)
- pos = pos+(HISTORY_QUEUE_MAX_TXT_ITEMS);
+ pos = pos+(HISTORY_QUEUE_MAX_ITEMS);
fprintf(stderr, "## pos = %d, %s\n", pos, get_item_contents_by_pos(pos));
char *p = strdup(get_item_contents_by_pos(pos));
// if (get_clipdrawer_mode())
// clipdrawer_change_mode(ad);
- for (i = 0; i < HISTORY_QUEUE_MAX_TXT_ITEMS; i++)
+ for (i = 0; i < HISTORY_QUEUE_MAX_ITEMS; i++)
{
pos = get_current_history_position() - i;
if (pos < 0)
- pos = pos+HISTORY_QUEUE_MAX_TXT_ITEMS;
+ pos = pos+HISTORY_QUEUE_MAX_ITEMS;
if (get_item_contents_by_pos(pos) != NULL && strlen(get_item_contents_by_pos(pos)) > 0)
{
{
struct appdata *ad = g_get_main_appdata();
griditem_t *newgi = NULL;
- char* filepath = NULL;
Eina_List *igl = NULL;
unsigned int igl_counter = 0;
// if (get_clipdrawer_mode())
// clipdrawer_change_mode(ad);
-/*
- if (!check_regular_file(imagepath))
- {
- DTRACE("Error : it isn't normal file = %s\n", imagepath);
- return -1;
- }
-
- igl = elm_gengrid_items_get(ad->hig);
- igl_counter = eina_list_count(igl);
-
- Eina_List *l;
- Elm_Gengrid_Item *item;
- griditem_t *ti = NULL;
-
- EINA_LIST_FOREACH(igl, l, item)
- {
- ti = elm_gengrid_item_data_get(item);
- if (!strcmp(ti->path, imagepath))
- {
- DTRACE("Error : duplicated file path = %s\n", imagepath);
- return -1;
- }
- }
-
- if (igl_counter >= HISTORY_QUEUE_MAX_IMG_ITEMS)
- {
- elm_gengrid_item_del(eina_list_data_get(eina_list_last(igl)));
- }
-
- newgi = malloc(sizeof(griditem_t));
- newgi->itype = GI_IMAGE;
- newgi->idata = eina_stringshare_add(imagepath);
- newgi->item = elm_gengrid_item_prepend(ad->hig, &gic, newgi, NULL, NULL);
-*/
-
-/*
- static int testmode = 0;
- testmode++;
-
- newgi = malloc(sizeof(griditem_t));
- if (testmode % 3)
- {
- newgi->itype = GI_IMAGE;
- newgi->idata = eina_stringshare_add(imagepath);
- }
- else
- {
- newgi->itype = GI_TEXT;
- newgi->idata = eina_strbuf_new();
- eina_strbuf_append(newgi->idata, "hello!! <item absize=40x30 href=file:///usr/share/icon/cbhm/cbhm_default_img.png></item>");
-
- }
- newgi->item = elm_gengrid_item_append(ad->hig, &gic, newgi, NULL, NULL);
-*/
newgi = malloc(sizeof(griditem_t));
newgi->itype = type;
+ igl = elm_gengrid_items_get(ad->hig);
+ igl_counter = eina_list_count(igl);
fprintf(stderr, "## add - %d : %s\n", newgi->itype, idata);
if (type == GI_TEXT)
}
else //if (type == GI_IMAGE)
{
+ Eina_List *l;
+ Elm_Gengrid_Item *item;
+ griditem_t *ti = NULL;
+
+ if (!check_regular_file(idata))
+ {
+ DTRACE("Error : it isn't normal file = %s\n", idata);
+ return -1;
+ }
+
+ EINA_LIST_FOREACH(igl, l, item)
+ {
+ ti = elm_gengrid_item_data_get(item);
+ if ((ti->itype == type) && !strcmp(ti->ipathdata, idata))
+ {
+ DTRACE("Error : duplicated file path = %s\n", idata);
+ return -1;
+ }
+ }
+
newgi->ipathdata = eina_stringshare_add(idata);
}
+
+ if (igl_counter >= HISTORY_QUEUE_MAX_ITEMS)
+ {
+ elm_gengrid_item_del(eina_list_data_get(eina_list_last(igl)));
+ }
+
newgi->item = elm_gengrid_item_prepend(ad->hig, &gic, newgi, NULL, NULL);
return TRUE;
int increment_current_history_position()
{
int pos = g_history_pos+1;
- if (pos >= HISTORY_QUEUE_MAX_TXT_ITEMS)
+ if (pos >= HISTORY_QUEUE_MAX_ITEMS)
pos = 0;
g_history_pos = pos;
return pos;
{
int pos = g_history_pos-1;
if (pos < 0)
- pos = HISTORY_QUEUE_MAX_TXT_ITEMS-1;
+ pos = HISTORY_QUEUE_MAX_ITEMS-1;
return pos;
}
return -1;
if (g_lastest_content == NULL)
- g_lastest_content = malloc(sizeof(char)*(HISTORY_QUEUE_TXT_ITEM_SIZE));
- if (g_history_pos >= HISTORY_QUEUE_MAX_TXT_ITEMS)
+ g_lastest_content = malloc(sizeof(char)*(HISTORY_QUEUE_ITEM_SIZE));
+ if (g_history_pos >= HISTORY_QUEUE_MAX_ITEMS)
g_history_pos = 0;
// FIXME: remove g_lasteset_content
{
int pos;
int i = 0;
- for (i = 0; i < HISTORY_QUEUE_MAX_TXT_ITEMS; i++)
+ for (i = 0; i < HISTORY_QUEUE_MAX_ITEMS; i++)
{
pos = get_current_history_position()+i;
- if (pos > HISTORY_QUEUE_MAX_TXT_ITEMS-1)
- pos = pos-HISTORY_QUEUE_MAX_TXT_ITEMS;
+ if (pos > HISTORY_QUEUE_MAX_ITEMS-1)
+ pos = pos-HISTORY_QUEUE_MAX_ITEMS;
DTRACE("%d: %s\n", i, get_item_contents_by_pos(pos) != NULL ? get_item_contents_by_pos(pos) : "NULL");
}
}
Atom atomCBHM_cRAW = XInternAtom(g_disp, "CBHM_cRAW", False);
Atom atomXKey_MSG = XInternAtom(g_disp, "_XKEY_COMPOSITION", False);
char atomname[10];
- Atom cbhm_atoms[HISTORY_QUEUE_MAX_TXT_ITEMS];
+ Atom cbhm_atoms[HISTORY_QUEUE_MAX_ITEMS];
Ecore_X_Window reqwin = ev->win;
int i, pos;
int num = ev->data.b[5] - '0';
int cur = get_current_history_position();
num = cur + num - 1;
- if (num > HISTORY_QUEUE_MAX_TXT_ITEMS-1)
- num = num-HISTORY_QUEUE_MAX_TXT_ITEMS;
+ if (num > HISTORY_QUEUE_MAX_ITEMS-1)
+ num = num-HISTORY_QUEUE_MAX_ITEMS;
- if (num >= 0 && num < HISTORY_QUEUE_MAX_TXT_ITEMS)
+ if (num >= 0 && num < HISTORY_QUEUE_MAX_ITEMS)
{
DTRACE("## pos : #%d\n", num);
// FIXME : handle with correct atom
}
pos--;
if (pos < 0)
- pos = HISTORY_QUEUE_MAX_TXT_ITEMS-1;
+ pos = HISTORY_QUEUE_MAX_ITEMS-1;
}
}
else if (strcmp("get raw", ev->data.b) == 0)