make terminology handle multiple uri dnd of files and display in a

slideshow queue. :)
This commit is contained in:
Carsten Haitzler 2013-03-09 00:13:32 +09:00
parent bba639baf7
commit 2217166f40
2 changed files with 54 additions and 1 deletions

View File

@ -787,6 +787,16 @@ _cb_popup(void *data, Evas_Object *obj __UNUSED__, void *event)
_popmedia_show(term, src);
}
static void
_cb_popup_queue(void *data, Evas_Object *obj __UNUSED__, void *event)
{
Term *term = data;
const char *src = event;
if (!src) src = termio_link_get(term->term);
if (!src) return;
_popmedia_queue_add(term, src);
}
static void
_cb_command(void *data, Evas_Object *obj __UNUSED__, void *event)
{
@ -1479,6 +1489,7 @@ main_term_new(Win *wn, Config *config, const char *cmd,
evas_object_smart_callback_add(o, "exited", _cb_exited, term);
evas_object_smart_callback_add(o, "bell", _cb_bell, term);
evas_object_smart_callback_add(o, "popup", _cb_popup, term);
evas_object_smart_callback_add(o, "popup,queue", _cb_popup_queue, term);
evas_object_smart_callback_add(o, "cmdbox", _cb_cmdbox, term);
evas_object_smart_callback_add(o, "command", _cb_command, term);
evas_object_smart_callback_add(o, "prev", _cb_prev, term);

View File

@ -2985,7 +2985,49 @@ _smart_cb_drop(void *data, Evas_Object *o __UNUSED__, Elm_Selection_Data *ev)
Termio *sd = evas_object_smart_data_get(obj);
if (!sd) return EINA_TRUE;
if (ev->action == ELM_XDND_ACTION_COPY)
evas_object_smart_callback_call(obj, "popup", ev->data);
{
if (strchr(ev->data, '\n'))
{
char *p, *p2, *p3, *tb;
tb = malloc(strlen(ev->data) + 1);
if (tb)
{
for (p = ev->data; p;)
{
p2 = strchr(p, '\n');
p3 = strchr(p, '\r');
if (p2 && p3)
{
if (p3 < p2) p2 = p3;
}
else if (!p2) p3 = p2;
if (p2)
{
strncpy(tb, p, p2 - p);
tb[p2 - p] = 0;
p = p2;
while ((*p) && (isspace(*p))) p++;
if (strlen(tb) > 0)
evas_object_smart_callback_call
(obj, "popup,queue", tb);
}
else
{
strcpy(tb, p);
printf("'%s'\n", tb);
if (strlen(tb) > 0)
evas_object_smart_callback_call
(obj, "popup,queue", tb);
break;
}
}
free(tb);
}
}
else
evas_object_smart_callback_call(obj, "popup", ev->data);
}
else
termpty_write(sd->pty, ev->data, strlen(ev->data));
return EINA_TRUE;