gthumb r2469 - in trunk: . libgthumb src



Author: mjc
Date: Wed Dec 24 01:55:11 2008
New Revision: 2469
URL: http://svn.gnome.org/viewvc/gthumb?rev=2469&view=rev

Log:
2008-12-23  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/file-utils.h:
        * libgthumb/file-utils.c: (dir_make)
        Ported to gfile. Also, use default umask rather than specifying one.
        
        * (dir_remove),
        (dir_remove_recursive), (ensure_dir_exists):
        Rename file -> gfile for clarity.

        * src/catalog-web-exporter.c: (save_image_preview_cb):
        Fixed a crash-causing typo.

        * src/dlg-catalog.c: (new_dir_cb):
        * src/dlg-web-exporter.c: (ensure_local_theme_dir_exists):
        * src/gth-browser-actions-callbacks.c:
        (create_new_folder_or_library):
        Use the umask-less version of dir_make.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/file-utils.c
   trunk/libgthumb/file-utils.h
   trunk/src/catalog-web-exporter.c
   trunk/src/dlg-catalog.c
   trunk/src/dlg-web-exporter.c
   trunk/src/gth-browser-actions-callbacks.c

Modified: trunk/libgthumb/file-utils.c
==============================================================================
--- trunk/libgthumb/file-utils.c	(original)
+++ trunk/libgthumb/file-utils.c	Wed Dec 24 01:55:11 2008
@@ -357,24 +357,41 @@
 
 
 gboolean
-dir_make (const gchar *path,
-	  mode_t       mode)
+dir_make (const gchar *path)
 {
-	return (gnome_vfs_make_directory (path, mode) == GNOME_VFS_OK);
+        GFile    *gfile;
+        gboolean  result;
+	GError   *error;
+
+        gfile = gfile_new (path);
+        result = g_file_make_directory (gfile, NULL, &error);
+
+	if (error != NULL) {
+                gfile_warning ("Could not create directory", gfile, error);
+                g_error_free (error);
+	}
+
+        g_object_unref (gfile);
+        return result;
 }
 
 
 gboolean
 dir_remove (const gchar *path)
 {
-	GFile    *file;
+	GFile    *gfile;
 	gboolean  result;
+	GError   *error;
 	
-	file = gfile_new (path);
-	
-	result = g_file_delete (file, NULL, NULL);
+	gfile = gfile_new (path);
+	result = g_file_delete (gfile, NULL, NULL);
+
+	if (error != NULL) {
+                gfile_warning ("Could not remove directory", gfile, error);
+                g_error_free (error);
+        }
 	
-	g_object_unref (file);
+	g_object_unref (gfile);
 
 	return result;
 }
@@ -383,18 +400,16 @@
 gboolean
 dir_remove_recursive (const char *path)
 {
-	GFile    *file;
+	GFile    *gfile;
 	gboolean  result;
 	
 	if (path == NULL)
 		return FALSE;
 	
-	file = gfile_new (path);
-	
-	result = gfile_dir_remove_recursive (file);
+	gfile = gfile_new (path);
+	result = gfile_dir_remove_recursive (gfile);
 	
-	g_object_unref (file);
-
+	g_object_unref (gfile);
 	return result;
 }
 
@@ -410,18 +425,16 @@
 ensure_dir_exists (const char *path,
 		   mode_t      mode)
 {
-	GFile    *file;
+	GFile    *gfile;
 	gboolean  result;
 	
 	if (path == NULL)
 		return FALSE;
 	
-	file = gfile_new (path);
-	
-	result = gfile_ensure_dir_exists (file, mode, NULL);
+	gfile = gfile_new (path);
+	result = gfile_ensure_dir_exists (gfile, mode, NULL);
 	
-	g_object_unref (file);
-
+	g_object_unref (gfile);
 	return result;
 }
 

Modified: trunk/libgthumb/file-utils.h
==============================================================================
--- trunk/libgthumb/file-utils.h	(original)
+++ trunk/libgthumb/file-utils.h	Wed Dec 24 01:55:11 2008
@@ -92,8 +92,7 @@
 /* Directory utils */
 
 gboolean            dir_is_empty                  (const char       *s);
-gboolean            dir_make                      (const char       *uri,
-						   mode_t            mode);
+gboolean            dir_make                      (const char       *uri);
 gboolean            dir_remove                    (const char       *uri);
 gboolean            dir_remove_recursive          (const char       *path);
 gboolean            local_dir_remove_recursive    (const char       *path);

Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c	(original)
+++ trunk/src/catalog-web-exporter.c	Wed Dec 24 01:55:11 2008
@@ -2618,7 +2618,7 @@
 			g_free (local_file);
 			g_free (src_local_file);
 			g_object_unref (file);
-			g_object_unref (src_local_file);
+			g_object_unref (src_local_gfile);
 		}
 	}
 

Modified: trunk/src/dlg-catalog.c
==============================================================================
--- trunk/src/dlg-catalog.c	(original)
+++ trunk/src/dlg-catalog.c	Wed Dec 24 01:55:11 2008
@@ -156,7 +156,7 @@
 			    name,
 			    NULL);
 
-	dir_make (path, 0775);
+	dir_make (path);
 
 	g_free (path);
 	g_free (name);

Modified: trunk/src/dlg-web-exporter.c
==============================================================================
--- trunk/src/dlg-web-exporter.c	(original)
+++ trunk/src/dlg-web-exporter.c	Wed Dec 24 01:55:11 2008
@@ -777,7 +777,7 @@
 			       "gthumb/albumthemes",
 			       NULL);
 
-	dir_make (theme_dir, 0700);
+	dir_make (theme_dir);
 
 	g_free (theme_dir);
 }

Modified: trunk/src/gth-browser-actions-callbacks.c
==============================================================================
--- trunk/src/gth-browser-actions-callbacks.c	(original)
+++ trunk/src/gth-browser-actions-callbacks.c	Wed Dec 24 01:55:11 2008
@@ -802,7 +802,7 @@
 				       _("The name \"%s\" is already used. " "Please use a different name."), utf8_name);
 		g_free (utf8_name);
 	} 
-	else if (! dir_make (new_path, 0755)) {
+	else if (! dir_make (new_path)) {
 		char *utf8_path;
 
 		utf8_path = get_utf8_display_name_from_uri (new_path);



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