summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKernc <kerncece@gmail.com>2014-10-22 00:14:24 +0200
committerArx Cruz <arxcruz@gnome.org>2014-10-22 10:01:23 +0200
commitfad5a25dcd23a46bf2e25d001b008273cc4ea578 (patch)
tree081d4f233ccc73c4dcbb86563fc6e43b69916570 /src
parentBug #685051 Adding --mid-search option to --list (diff)
downloadzenity-fad5a25dcd23a46bf2e25d001b008273cc4ea578.tar.gz
zenity-fad5a25dcd23a46bf2e25d001b008273cc4ea578.tar.bz2
zenity-fad5a25dcd23a46bf2e25d001b008273cc4ea578.zip
Allow --text-info to load resources also from relative file:// URIs
Diffstat (limited to 'src')
-rw-r--r--src/text.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/text.c b/src/text.c
index e5ba15e9..cf4aa63e 100644
--- a/src/text.c
+++ b/src/text.c
@@ -316,10 +316,19 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
}
else
{
+ gchar *cwd;
+ gchar *dirname;
+ gchar *dirname_uri;
+ dirname = text_data->uri ? g_path_get_dirname (text_data->uri) : g_strdup ("/");
+ cwd = g_get_current_dir ();
+ dirname_uri = g_strconcat ("file://", cwd, "/", dirname, "/", NULL);
+ g_free (cwd);
+ g_free (dirname);
gtk_text_buffer_get_start_iter (text_buffer, &start_iter);
gtk_text_buffer_get_end_iter (text_buffer, &end_iter);
content = gtk_text_buffer_get_text (text_buffer, &start_iter, &end_iter, TRUE);
- webkit_web_view_load_string (WEBKIT_WEB_VIEW(web_kit), content, "text/html", "UTF-8", "file:///");
+ webkit_web_view_load_string (WEBKIT_WEB_VIEW(web_kit), content, "text/html", "UTF-8", dirname_uri);
+ g_free (dirname_uri);
g_free (content);
}
bgstack15