comparison src/gtkimhtml.c @ 10782:93fd90cbf45c

[gaim-migrate @ 12410] Mark is right, I should have committed grim's dnd fix here also committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 04 Apr 2005 12:41:08 +0000
parents ffa44a5159e0
children 7638c282b1d3
comparison
equal deleted inserted replaced
10781:f6d630211935 10782:93fd90cbf45c
1534 gchar **links; 1534 gchar **links;
1535 gchar *link; 1535 gchar *link;
1536 char *text = sd->data; 1536 char *text = sd->data;
1537 GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer); 1537 GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer);
1538 GtkTextIter iter; 1538 GtkTextIter iter;
1539 gint i = 0;
1539 1540
1540 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); 1541 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark);
1541 1542
1542 if(gtk_imhtml_get_editable(imhtml) && sd->data){ 1543 if(gtk_imhtml_get_editable(imhtml) && sd->data){
1543 switch (info) { 1544 switch (info) {
1544 case GTK_IMHTML_DRAG_URL: 1545 case GTK_IMHTML_DRAG_URL:
1545 gaim_str_strip_cr(sd->data); 1546 gaim_str_strip_cr(sd->data);
1546 1547
1547 links = g_strsplit(sd->data, "\n", 0); 1548 links = g_strsplit(sd->data, "\n", 0);
1548 while((link = *links++) != NULL){ 1549 while((link = links[i]) != NULL){
1549 if(gaim_str_has_prefix(link, "http://") || 1550 if(gaim_str_has_prefix(link, "http://") ||
1550 gaim_str_has_prefix(link, "https://") || 1551 gaim_str_has_prefix(link, "https://") ||
1551 gaim_str_has_prefix(link, "ftp://")){ 1552 gaim_str_has_prefix(link, "ftp://"))
1552 gtk_imhtml_insert_link(imhtml, mark, link, link); 1553 {
1554 gchar *label;
1555
1556 if(links[i + 1])
1557 i++;
1558
1559 label = links[i];
1560
1561 gtk_imhtml_insert_link(imhtml, mark, link, label);
1553 } else if (link=='\0') { 1562 } else if (link=='\0') {
1554 /* Ignore blank lines */ 1563 /* Ignore blank lines */
1555 } else { 1564 } else {
1556 /* Special reasons, aka images being put in via other tag, etc. */ 1565 /* Special reasons, aka images being put in via other tag, etc. */
1557 /* ... don't pretend we handled it if we didn't */ 1566 /* ... don't pretend we handled it if we didn't */
1558 gtk_drag_finish(dc, FALSE, FALSE, t); 1567 gtk_drag_finish(dc, FALSE, FALSE, t);
1568 g_strfreev(links);
1559 return; 1569 return;
1560 } 1570 }
1571
1572 i++;
1561 } 1573 }
1562 g_strfreev(links); 1574 g_strfreev(links);
1563 break; 1575 break;
1564 case GTK_IMHTML_DRAG_HTML: 1576 case GTK_IMHTML_DRAG_HTML:
1565 { 1577 {
1566 char *utf8 = NULL; 1578 char *utf8 = NULL;
1567 /* Ewww. This is all because mozilla thinks that text/html is 'for internal use only.' 1579 /* Ewww. This is all because mozilla thinks that text/html is 'for internal use only.'