gtkhtml r9089 - in trunk: . components/editor



Author: mbarnes
Date: Sun Jan 11 05:31:51 2009
New Revision: 9089
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=9089&view=rev

Log:
2009-01-10  Matthew Barnes  <mbarnes redhat com>

	* configure.in:
	Bump gtk_minimum_version to 2.14.0 for gtk_show_uri().

	* components/editor/gtkhtml-editor-private.c
	(gtkhtml_editor_show_uri):
	New convenience function calls gtk_show_uri() and displays an
	error dialog if the URI cannot be shown.

	* components/editor/gtkhtml-editor-actions.c (action_test_url_cb):
	* components/editor/gtkhtml-editor-signals.c
	(gtkhtml_editor_image_properties_url_button_clicked_cb):
	Call gtkhtml_editor_show_uri() instead of gnome_url_show().



Modified:
   trunk/ChangeLog
   trunk/components/editor/ChangeLog
   trunk/components/editor/gtkhtml-editor-actions.c
   trunk/components/editor/gtkhtml-editor-private.c
   trunk/components/editor/gtkhtml-editor-private.h
   trunk/components/editor/gtkhtml-editor-signals.c
   trunk/configure.in

Modified: trunk/components/editor/gtkhtml-editor-actions.c
==============================================================================
--- trunk/components/editor/gtkhtml-editor-actions.c	(original)
+++ trunk/components/editor/gtkhtml-editor-actions.c	Sun Jan 11 05:31:51 2009
@@ -20,8 +20,6 @@
 
 #include "gtkhtml-editor-private.h"
 
-#include <libgnome/gnome-url.h>
-
 /******************************************************************************
  * Action Group Quick Reference
  *
@@ -1095,13 +1093,17 @@
 action_test_url_cb (GtkAction *action,
                     GtkhtmlEditor *editor)
 {
+	GtkEntry *entry;
+	GtkWindow *window;
 	const gchar *text;
 
-	text = gtk_entry_get_text (
-		GTK_ENTRY (WIDGET (LINK_PROPERTIES_URL_ENTRY)));
+	entry = GTK_ENTRY (WIDGET (LINK_PROPERTIES_URL_ENTRY));
+	window = GTK_WINDOW (WIDGET (LINK_PROPERTIES_WINDOW));
+
+	text = gtk_entry_get_text (entry);
 
 	if (text != NULL && *text != '\0')
-		gnome_url_show (text, NULL);
+		gtkhtml_editor_show_uri (window, text);
 }
 
 static void

Modified: trunk/components/editor/gtkhtml-editor-private.c
==============================================================================
--- trunk/components/editor/gtkhtml-editor-private.c	(original)
+++ trunk/components/editor/gtkhtml-editor-private.c	Sun Jan 11 05:31:51 2009
@@ -583,6 +583,40 @@
 }
 
 void
+gtkhtml_editor_show_uri (GtkWindow *parent,
+                         const gchar *uri)
+{
+	GtkWidget *dialog;
+	GdkScreen *screen = NULL;
+	GError *error = NULL;
+	guint32 timestamp;
+
+	g_return_if_fail (uri != NULL);
+
+	timestamp = gtk_get_current_event_time ();
+
+	if (parent != NULL)
+		screen = gtk_widget_get_screen (GTK_WIDGET (parent));
+
+	if (gtk_show_uri (screen, uri, timestamp, &error))
+		return;
+
+	dialog = gtk_message_dialog_new_with_markup (
+		parent, GTK_DIALOG_DESTROY_WITH_PARENT,
+		GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+		"<big><b>%s</b></big>",
+		_("Could not open the link."));
+
+	gtk_message_dialog_format_secondary_text (
+		GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
+	g_error_free (error);
+}
+
+void
 gtkhtml_editor_spell_check (GtkhtmlEditor *editor,
                             gboolean whole_document)
 {

Modified: trunk/components/editor/gtkhtml-editor-private.h
==============================================================================
--- trunk/components/editor/gtkhtml-editor-private.h	(original)
+++ trunk/components/editor/gtkhtml-editor-private.h	Sun Jan 11 05:31:51 2009
@@ -192,6 +192,8 @@
 gint		gtkhtml_editor_insert_file	 (GtkhtmlEditor *editor,
 						  const gchar *title,
 						  GCallback response_cb);
+void		gtkhtml_editor_show_uri		 (GtkWindow *parent,
+						  const gchar *uri);
 void		gtkhtml_editor_spell_check	 (GtkhtmlEditor *editor,
 						  gboolean whole_document);
 gboolean	gtkhtml_editor_next_spell_error	 (GtkhtmlEditor *editor);

Modified: trunk/components/editor/gtkhtml-editor-signals.c
==============================================================================
--- trunk/components/editor/gtkhtml-editor-signals.c	(original)
+++ trunk/components/editor/gtkhtml-editor-signals.c	Sun Jan 11 05:31:51 2009
@@ -965,7 +965,7 @@
 	text = gtk_entry_get_text (GTK_ENTRY (widget));
 
 	g_return_if_fail (text != NULL);
-	gnome_url_show (text, NULL);
+	gtkhtml_editor_show_uri (GTK_WINDOW (window), text);
 
 	g_object_unref (editor);
 }

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Jan 11 05:31:51 2009
@@ -6,7 +6,7 @@
 PACKAGE=gtkhtml
 
 # Required Package Versions
-m4_define([gtk_minimum_version], [2.12.0])
+m4_define([gtk_minimum_version], [2.14.0])
 m4_define([gail_minimum_version], [1.1.0])
 m4_define([gnome_icon_theme_minimum_version], [2.22.0])
 m4_define([libbonobo_minimum_version], [2.20.3])



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