[gnumeric] Fix editing of hyperlinks.



commit aed4a7665b831987df63d947cabd9770671c74f2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Jul 25 10:23:31 2010 -0600

    Fix editing of hyperlinks.
    
    2010-07-25  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-hyperlink.c (dialog_hyperlink): duplicate the hyperlink, it
    	  may be used in many cells and we want to change it only here.

 NEWS                           |    1 +
 src/dialogs/ChangeLog          |    5 +++++
 src/dialogs/dialog-hyperlink.c |   14 +++++++++-----
 3 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index a4331de..bac22ec 100644
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ Andreas:
 	  argument tooltips.
 	* Fix undo of Clear->All and Clear->Comments. [#625151][#623803]
 	* Add menu items to allow clearing of filtered rows only.
+	* Fix editing of hyperlinks.
 
 Jean:
 	* Fix strong/weak cursor display. [#623241]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index f2d2bf5..d393818 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-25  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialog-hyperlink.c (dialog_hyperlink): duplicate the hyperlink, it 
+	  may be used in many cells and we want to change it only here.
+	
 2010-07-22  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-function-select.c (pref_tool_page_initializer): add checkboxes
diff --git a/src/dialogs/dialog-hyperlink.c b/src/dialogs/dialog-hyperlink.c
index e1881d0..427d77d 100644
--- a/src/dialogs/dialog-hyperlink.c
+++ b/src/dialogs/dialog-hyperlink.c
@@ -590,15 +590,19 @@ dialog_hyperlink (WBCGtk *wbcg, SheetControl *sc)
 		if (NULL != (link = sheet_style_region_contains_link (sheet, ptr->data)))
 			break;
 
-	if (link == NULL) {
-		link = g_object_new (gnm_hlink_url_get_type (), NULL);
+	/* We are creating a new link since the existing link */
+	/* may be used in many places. */
+	/* We are duplicating it here rather than in an ok handler in case */
+	/* The link is changed for a differnt cell in a different view. */
+	state->link = g_object_new (gnm_hlink_url_get_type (), NULL);
+	if (link == NULL)
 		state->is_new = TRUE;
-	} else {
-		g_object_ref (link);
+	else {
 		state->is_new = FALSE;
+		gnm_hlink_set_target (state->link, gnm_hlink_get_target (link));
+		gnm_hlink_set_tip (state->link, gnm_hlink_get_tip (link));
 	}
 
-	state->link = link;
 	if (dhl_init (state)) {
 		go_gtk_notice_dialog (wbcg_toplevel (wbcg), GTK_MESSAGE_ERROR,
 				 _("Could not create the hyperlink dialog."));



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