[gnumeric] Fix copy/paste of graphs to other programs. [#660242]



commit 0488e3190134172c8929acbd2e8e834fd3e03d45
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Sep 27 14:59:22 2011 -0600

    Fix copy/paste of graphs to other programs. [#660242]
    
    2011-09-27 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/gui-clipboard.c (target_list_to_entries): deleted and
    	replace all calls with gtk_target_table_new_from_list
    	(gnm_x_claim_clipboard): free the targets using gtk_target_table_free

 ChangeLog           |    6 ++++++
 NEWS                |    3 ++-
 src/gui-clipboard.c |   23 ++++-------------------
 3 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fb636cf..da69cef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-27 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/gui-clipboard.c (target_list_to_entries): deleted and
+	replace all calls with gtk_target_table_new_from_list
+	(gnm_x_claim_clipboard): free the targets using gtk_target_table_free
+
 2011-09-27  Jean Brefort  <jean brefort normalesup org>
 
 	* src/gnm-graph-window.c (gnm_graph_window_set_graph): make the graph
diff --git a/NEWS b/NEWS
index 5915533..9e3a24e 100644
--- a/NEWS
+++ b/NEWS
@@ -13,13 +13,14 @@ Andreas:
 	* Add HPFILTER function calculating the Hodrick Prescott Filter.
 	* Fix saving of newlines to xls. [#356711]
 	* Enable markup selection in scientific format selector.
-	* Be compatible wih the changed LibreOffice ODF documents with tab 
+	* Be compatible with the changed LibreOffice ODF documents with tab 
 	colours.
 	* Persist selection and edit positions through ODF files. [#657506]
 	* Some more number formatting improvements to ODF import/export.
 	* Read and write tick spacing from/to ODF files.
 	* Fix graph editor crash. [#658223]
 	* Fix import of non-UTF8 csv files. [#658916]
+	* Fix copy/paste of graphs to other programs. [#660242]
 
 Jean:
 	* Make things build against gtk+-3.0.
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index b98ed08..a0dc09b 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -1011,18 +1011,6 @@ gnm_x_request_clipboard (WBCGtk *wbcg, GnmPasteTarget const *pt)
 				       x_targets_received, ctxt);
 }
 
-static GtkTargetEntry*
-target_list_to_entries (GtkTargetList *target_list, int *n_entries)
-{
-	GtkTargetEntry *entries;
-
-	if (!target_list || n_entries == NULL)
-		return NULL;
-
-	return gtk_target_table_new_from_list (target_list, (unsigned *) &n_entries);
-	return entries;
-}
-
 /* Restrict the	set of formats offered to clipboard manager. */
 /* We include bmp in the whitelist because that's the only image format
  * we share with OOo over clipboard (!) */
@@ -1109,14 +1097,14 @@ gnm_x_claim_clipboard (WBCGtk *wbcg)
 		tl = sheet_object_exportable_get_target_list (exportable);
 		/* _add_table prepends to target_list */
 		gtk_target_list_add_table (tl, table_targets, 1);
-		targets = target_list_to_entries (tl, &n_targets);
+		targets = gtk_target_table_new_from_list (tl, &n_targets);
 		gtk_target_list_unref (tl);
 	}
 	if (imageable) {
 		tl = sheet_object_get_target_list (imageable);
 		/* _add_table prepends to target_list */
 		gtk_target_list_add_table (tl, targets, (exportable)? n_targets: 1);
-		targets = target_list_to_entries (tl, &n_targets);
+		targets = gtk_target_table_new_from_list (tl, &n_targets);
 		gtk_target_list_unref (tl);
 	}
 	/* Register a x_clipboard_clear_cb only for CLIPBOARD, not for
@@ -1137,11 +1125,8 @@ gnm_x_claim_clipboard (WBCGtk *wbcg)
 			NULL,
 			gnm_app_get_app ());
 	}
-	if (exportable || imageable) {
-		for (i = 0; i < n_targets; i++)
-			g_free (targets[i].target);
-		g_free (targets);
-	}
+	if (exportable || imageable)
+		gtk_target_table_free (targets, n_targets);
 
 	return ret;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]