raster pushed a commit to branch master.

commit 2217166f40236251a66993406302c1300a3c7371
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Sat Mar 9 00:13:32 2013 +0900

    make terminology handle multiple uri dnd of files and display in a
    slideshow queue. :)
---
 src/bin/main.c   | 11 +++++++++++
 src/bin/termio.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/src/bin/main.c b/src/bin/main.c
index 0388da4..d929d7b 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -788,6 +788,16 @@ _cb_popup(void *data, Evas_Object *obj __UNUSED__, void 
*event)
 }
 
 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)
 {
    Term *term = data;
@@ -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);
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 668930f..870f6dc 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -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;

-- 

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev

Reply via email to