[gimp] web-page: Make a well-formed URL if necessary
- From: Mukund Sivaraman <muks src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] web-page: Make a well-formed URL if necessary
- Date: Thu, 31 Mar 2011 03:36:25 +0000 (UTC)
commit c7a1846ec8915e800f9702086259cffdab5ed6d0
Author: Mukund Sivaraman <muks banu com>
Date: Thu Mar 31 09:05:57 2011 +0530
web-page: Make a well-formed URL if necessary
plug-ins/common/web-page.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/common/web-page.c b/plug-ins/common/web-page.c
index f2138f7..78193f4 100644
--- a/plug-ins/common/web-page.c
+++ b/plug-ins/common/web-page.c
@@ -23,7 +23,6 @@
* TODO:
* - Add progress bar
* - Add a font scale combo: default, larger, smaller etc.
- * - Try adding http:// itself if it was not provided
* - Save/restore URL and width
* - Set GIMP as user agent
*/
@@ -300,6 +299,7 @@ webpage_capture (void)
gint32 image = -1;
GtkWidget *window;
GtkWidget *view;
+ gchar *scheme;
if ((! webpagevals.url) ||
(strlen (webpagevals.url) == 0))
@@ -308,6 +308,19 @@ webpage_capture (void)
return -1;
}
+ scheme = g_uri_parse_scheme (webpagevals.url);
+ if (!scheme)
+ {
+ char *url;
+
+ /* If we were not given a well-formed URL, make one. */
+
+ url = g_strconcat ("http://", webpagevals.url, NULL);
+ g_free (webpagevals.url);
+ webpagevals.url = url;
+ }
+ g_free (scheme);
+
if (webpagevals.width < 32)
{
g_warning ("Width `%d' is too small. Clamped to 32.",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]