gnumeric r16486 - in branches/gnumeric-1-8: . src
- From: jhellan svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16486 - in branches/gnumeric-1-8: . src
- Date: Sun, 30 Mar 2008 16:00:06 +0100 (BST)
Author: jhellan
Date: Sun Mar 30 16:00:05 2008
New Revision: 16486
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16486&view=rev
Log:
2008-03-30 Jon K Hellan <hellan acm org>
* src/gui-clipboard.c (x_targets_received): Request text if holder
of clipboard doesn't offer any target we understand. Broken apps,
including jedit, have been seen to return a bogus list of targets,
but nonetheless return text when asked.
(utf8_content_received): New function. Passes text received from
clipboard to text_to_cell_Region.
Modified:
branches/gnumeric-1-8/ChangeLog
branches/gnumeric-1-8/NEWS
branches/gnumeric-1-8/src/gui-clipboard.c
Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS (original)
+++ branches/gnumeric-1-8/NEWS Sun Mar 30 16:00:05 2008
@@ -3,6 +3,9 @@
Jean:
* Evaluate formulas loaded from a text file. [#525107]
+Jon KÃre:
+ * Receive clipboard from broken apps. [#524756]
+
Nick Lamb:
* Honour detachable-toolbar preference. [#321867]
Modified: branches/gnumeric-1-8/src/gui-clipboard.c
==============================================================================
--- branches/gnumeric-1-8/src/gui-clipboard.c (original)
+++ branches/gnumeric-1-8/src/gui-clipboard.c Sun Mar 30 16:00:05 2008
@@ -214,6 +214,37 @@
g_free (ctxt);
}
+static void
+utf8_content_received (GtkClipboard *clipboard, const gchar *text,
+ gpointer closure)
+{
+ GnmGtkClipboardCtxt *ctxt = closure;
+ WBCGtk *wbcg = ctxt->wbcg;
+ WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
+ GnmPasteTarget *pt = ctxt->paste_target;
+ GnmCellRegion *content = NULL;
+
+ /* Nothing on clipboard? */
+ if (!text || strlen(text) == 0) {
+ ;
+ } else {
+ content = text_to_cell_region (wbcg, text, strlen(text), "UTF-8", TRUE);
+ }
+ if (content) {
+ /*
+ * if the conversion from the X selection -> a cellregion
+ * was canceled this may have content sized -1,-1
+ */
+ if (content->cols > 0 && content->rows > 0)
+ cmd_paste_copy (wbc, pt, content);
+
+ /* Release the resources we used */
+ cellregion_unref (content);
+ }
+ g_free (ctxt->paste_target);
+ g_free (ctxt);
+}
+
/**
* Use the file_opener plugin service to read into a temporary workbook, in
* order to copy from it to the paste target. A temporary sheet would do just
@@ -397,8 +428,8 @@
/* Nothing on clipboard? */
if (targets == NULL || n_targets == 0) {
- g_free (ctxt->paste_target);
- g_free (ctxt);
+ gtk_clipboard_request_text (clipboard, utf8_content_received,
+ ctxt);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]