gthumb r2390 - in trunk: . libgthumb src



Author: mjc
Date: Sat Aug  9 12:39:25 2008
New Revision: 2390
URL: http://svn.gnome.org/viewvc/gthumb?rev=2390&view=rev

Log:
2008-08-09  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/file-utils.c: (get_path_relative_to_uri):
        * src/catalog-web-exporter.c: (gth_parsed_doc_print):
        Fixed bug 546875 â Web exporter: attribute " relative_path" of tag
        <gthumb:file_path/> does not work. Patch by Christophe BisiÃre.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/file-utils.c
   trunk/src/catalog-web-exporter.c

Modified: trunk/libgthumb/file-utils.c
==============================================================================
--- trunk/libgthumb/file-utils.c	(original)
+++ trunk/libgthumb/file-utils.c	Sat Aug  9 12:39:25 2008
@@ -1683,6 +1683,10 @@
  * example 3 : uri      = smb:///xxx/yyy/foo
  *             desturi  = file://hhh/xxx
  *             return   : smb:///xxx/yyy/foo
+ *
+ * example 4 : uri      = file://hhh/xxx
+ *             desturi  = file://hhh/xxx
+ *             return   : ./
  */
 char *
 get_path_relative_to_uri (const char *uri,
@@ -1695,6 +1699,9 @@
 	char     *result;
 	GString  *relpath;
 
+	if (strcmp (uri, desturi) == 0)
+		return g_strdup ("./");
+	
 	if (strcmp (get_uri_host (uri), get_uri_host (desturi)) != 0)
 		return g_strdup (uri);
 

Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c	(original)
+++ trunk/src/catalog-web-exporter.c	Sat Aug  9 12:39:25 2008
@@ -1492,6 +1492,7 @@
 		GthTag     *tag = scan->data;
 		ImageData  *idata;
 		GFile      *file;
+		GFile      *dir;
 		char       *line = NULL;
 		char       *image_src = NULL;
 		char       *unescaped_path = NULL;
@@ -1731,23 +1732,22 @@
 				break;
 			}
 
-			//FIXME: broken
+			dir = g_file_get_parent (file);
+			
 			relative = (gth_tag_get_var (ce, tag, "relative_path") != 0);
 
 			if (relative)
-				unescaped_path = file_get_relative_path (file, 
-									 relative_to);
+				line = file_get_relative_path (dir, 
+							       relative_to);
 			else
-				unescaped_path = file_get_path (file);
-			
-			line = remove_level_from_path (unescaped_path);
-			g_free (unescaped_path);
+				line = file_get_path (dir);
 
 			if  (gth_tag_get_var (ce, tag, "utf8") != 0)
 				write_markup_escape_locale_line (line, fout);
 			else
 				write_markup_escape_line (line, fout);
 
+			g_object_unref (dir);
 			g_object_unref (file);
 			break;
 



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