[Xfce4-commits] <gigolo:master> Validate an entered custom URI by trying to parse it

Enrico Tröger noreply at xfce.org
Sun Apr 22 19:36:05 CEST 2012


Updating branch refs/heads/master
         to ef9b15151046c73f2f8895724bc7aff70afa26e5 (commit)
       from a0b7fa48913515b7e9d006b1988e079ea8ed2a88 (commit)

commit ef9b15151046c73f2f8895724bc7aff70afa26e5
Author: Enrico Tröger <enrico at xfce.org>
Date:   Sun Apr 22 19:21:03 2012 +0200

    Validate an entered custom URI by trying to parse it

 src/bookmarkeditdialog.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/bookmarkeditdialog.c b/src/bookmarkeditdialog.c
index a1016cc..c25f051 100644
--- a/src/bookmarkeditdialog.c
+++ b/src/bookmarkeditdialog.c
@@ -194,6 +194,19 @@ static void gigolo_bookmark_edit_dialog_destroy(GtkObject *object)
 }
 
 
+static gboolean check_custom_uri(const gchar *uri)
+{
+	GigoloBookmark *bm;
+	gboolean result;
+
+	bm = gigolo_bookmark_new_from_uri("(validation)", uri);
+	result = gigolo_bookmark_is_valid(bm);
+	g_object_unref(bm);
+
+	return result;
+}
+
+
 gint gigolo_bookmark_edit_dialog_run(GigoloBookmarkEditDialog *dialog)
 {
 	gint res;
@@ -268,7 +281,7 @@ gint gigolo_bookmark_edit_dialog_run(GigoloBookmarkEditDialog *dialog)
 			if (! error && gtk_widget_get_parent(priv->uri_entry) != NULL)
 			{
 				tmp = gtk_entry_get_text(GTK_ENTRY(priv->uri_entry));
-				if (! *tmp)
+				if (! *tmp || ! check_custom_uri(tmp))
 				{
 					error = TRUE;
 					gigolo_message_dialog(dialog, GTK_MESSAGE_ERROR, _("Error"),


More information about the Xfce4-commits mailing list