[gnumeric] hlink: fix multihead issues.



commit e6c5e456e23249fee29134d78353fd08d881c322
Author: Morten Welinder <terra gnome org>
Date:   Mon May 31 15:32:24 2010 -0400

    hlink: fix multihead issues.

 ChangeLog        |    2 ++
 src/hlink-impl.h |    2 +-
 src/hlink.c      |   33 ++++++++++++++++++++-------------
 src/hlink.h      |    3 ++-
 src/item-grid.c  |    2 +-
 5 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 96ec4ee..15a9b4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-05-31  Morten Welinder  <terra gnome org>
 
+	* src/hlink.c (gnm_hlink_external_activate): Use go_gtk_url_show.
+
 	* src/wbc-gtk-actions.c (cb_help_web, cb_help_irc, cb_help_bug):
 	use go_gtk_url_show so we get the right screen.
 
diff --git a/src/hlink-impl.h b/src/hlink-impl.h
index e70394f..449f718 100644
--- a/src/hlink-impl.h
+++ b/src/hlink-impl.h
@@ -15,7 +15,7 @@ struct _GnmHLink {
 typedef struct {
 	GObjectClass obj;
 
-	gboolean (*Activate) (GnmHLink *link, WorkbookControl *wbc);
+	gboolean (*Activate) (GnmHLink *link, WBCGtk *wbcg);
 } GnmHLinkClass;
 
 G_END_DECLS
diff --git a/src/hlink.c b/src/hlink.c
index f8c235b..d5950fb 100644
--- a/src/hlink.c
+++ b/src/hlink.c
@@ -50,16 +50,16 @@
 /**
  * gnm_hlink_activate :
  * @link :
- * @wbv : the view that activated the link
+ * @wbcg : the wbcg that activated the link
  *
  * Return TRUE if the link successfully activated.
  **/
 gboolean
-gnm_hlink_activate (GnmHLink *lnk, WorkbookControl *wbc)
+gnm_hlink_activate (GnmHLink *lnk, WBCGtk *wbcg)
 {
 	g_return_val_if_fail (IS_GNM_HLINK (lnk), FALSE);
 
-	return GET_CLASS (lnk)->Activate (lnk, wbc);
+	return GET_CLASS (lnk)->Activate (lnk, wbcg);
 }
 
 GnmHLink *
@@ -147,17 +147,18 @@ typedef struct {
 #define GNM_HLINK_CUR_WB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), gnm_hlink_cur_wb_get_type (), GnmHLinkCurWB))
 
 static gboolean
-gnm_hlink_cur_wb_activate (GnmHLink *lnk, WorkbookControl *wbc)
+gnm_hlink_cur_wb_activate (GnmHLink *lnk, WBCGtk *wbcg)
 {
 	GnmRangeRef const *r;
 	GnmCellPos tmp;
 	Sheet	  *target_sheet;
-	Sheet	  *sheet = wb_control_cur_sheet      (wbc);
+	WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
+	Sheet	  *sheet = wbcg_cur_sheet (wbcg);
 	SheetView *sv	 = wb_control_cur_sheet_view (wbc);
 	GnmValue *target;
 
 	if (!lnk->target) {
-		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbc),
+		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbcg),
 			_("Link target"), _("(none)"));
 		return FALSE;
 	}
@@ -173,7 +174,7 @@ gnm_hlink_cur_wb_activate (GnmHLink *lnk, WorkbookControl *wbc)
 			target = gnm_expr_top_get_range (nexpr->texpr);
 	}
 	if (target == NULL) {
-		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbc),
+		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbcg),
 			_("Link target"), lnk->target);
 		return FALSE;
 	}
@@ -212,18 +213,21 @@ typedef struct {
 } GnmHLinkURL;
 
 static gboolean
-gnm_hlink_url_activate (GnmHLink *lnk, WorkbookControl *wbc)
+gnm_hlink_url_activate (GnmHLink *lnk, WBCGtk *wbcg)
 {
 	GError *err = NULL;
+	GdkScreen *screen;
 
 	if (lnk->target == NULL)
 		return FALSE;
 
-	err = go_url_show (lnk->target);
+	screen = gtk_window_get_screen (wbcg_toplevel (wbcg));
+	err = go_gtk_url_show (lnk->target, screen);
 
 	if (err != NULL) {
 		char *msg = g_strdup_printf (_("Unable to activate the url '%s'"), lnk->target);
-		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbc), msg, err->message);
+		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbcg),
+					      msg, err->message);
 		g_free (msg);
 		g_error_free (err);
 	}
@@ -262,22 +266,25 @@ typedef struct {
 } GnmHLinkExternal;
 
 static gboolean
-gnm_hlink_external_activate (GnmHLink *lnk, WorkbookControl *wbc)
+gnm_hlink_external_activate (GnmHLink *lnk, WBCGtk *wbcg)
 {
 	GError *err = NULL;
 	gboolean res = FALSE;
 	char *cmd;
+	GdkScreen *screen;
 
 	if (lnk->target == NULL)
 		return FALSE;
 
 	cmd = go_shell_arg_to_uri (lnk->target);
-	err = go_url_show (cmd);
+	screen = gtk_window_get_screen (wbcg_toplevel (wbcg));
+	err = go_gtk_url_show (cmd, screen);
 	g_free (cmd);
 
 	if (err != NULL) {
 		char *msg = g_strdup_printf(_("Unable to open '%s'"), lnk->target);
-		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbc), msg, err->message);
+		go_cmd_context_error_invalid (GO_CMD_CONTEXT (wbcg),
+					      msg, err->message);
 		g_free (msg);
 		g_error_free (err);
 	}
diff --git a/src/hlink.h b/src/hlink.h
index 53194a8..d4d47fe 100644
--- a/src/hlink.h
+++ b/src/hlink.h
@@ -3,6 +3,7 @@
 # define _GNM_HLINK_H_
 
 #include "gnumeric.h"
+#include "wbc-gtk.h"
 #include <glib-object.h>
 
 G_BEGIN_DECLS
@@ -18,7 +19,7 @@ G_BEGIN_DECLS
 GnmHLink	*sheet_hlink_find   (Sheet const *sheet, GnmCellPos const *pos);
 
 GType gnm_hlink_get_type (void);
-gboolean         gnm_hlink_activate   (GnmHLink *l, WorkbookControl *wbc);
+gboolean         gnm_hlink_activate   (GnmHLink *l, WBCGtk *wbcg);
 gchar const	*gnm_hlink_get_target (GnmHLink const *lnk);
 void	     	 gnm_hlink_set_target (GnmHLink *lnk, gchar const *url);
 gchar const	*gnm_hlink_get_tip    (GnmHLink const *l);
diff --git a/src/item-grid.c b/src/item-grid.c
index 44b91e6..70aff6e 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -1062,7 +1062,7 @@ item_grid_button_released (GocItem *item, int button, G_GNUC_UNUSED double x_, G
 			/* check for hyper links */
 			link = sheet_hlink_find (sheet, pos);
 			if (link != NULL)
-				gnm_hlink_activate (link, scg_wbc (scg));
+				gnm_hlink_activate (link, scg_wbcg (scg));
 		}
 	}
 	return TRUE;



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