eog r4853 - in trunk: . src



Author: csaavedra
Date: Sun Oct 26 17:26:00 2008
New Revision: 4853
URL: http://svn.gnome.org/viewvc/eog?rev=4853&view=rev

Log:
2008-10-14  Claudio Saavedra  <csaavedra igalia com>

	* src/eog-window.c: (eog_job_copy_cb): Rename the copied file to
	"eog-wallpaper.orig_ext", to avoid filling the target directory with
	too many images.

Modified:
   trunk/ChangeLog
   trunk/src/eog-window.c

Modified: trunk/src/eog-window.c
==============================================================================
--- trunk/src/eog-window.c	(original)
+++ trunk/src/eog-window.c	Sun Oct 26 17:26:00 2008
@@ -92,6 +92,8 @@
 #define EOG_RECENT_FILES_APP_NAME "Eye of GNOME Image Viewer"
 #define EOG_RECENT_FILES_LIMIT  5
 
+#define EOG_WALLPAPER_FILENAME "eog-wallpaper"
+
 typedef enum {
 	EOG_WINDOW_STATUS_UNKNOWN,
 	EOG_WINDOW_STATUS_INIT,
@@ -2653,12 +2655,30 @@
 eog_job_copy_cb (EogJobCopy *job, gpointer user_data)
 {
 	EogWindow *window = EOG_WINDOW (user_data);
-	gchar *file, *filename;
+	gchar *filepath, *filename, *extension;
 	GtkAction *action;
+	GFile *source_file, *dest_file;
 
+	/* Create source GFile */
 	filename = g_file_get_basename (job->images->data);
-	file = g_build_filename (job->dest, filename, NULL);
-	eog_window_set_wallpaper (window, file);
+	filepath = g_build_filename (job->dest, filename, NULL);
+	source_file = g_file_new_for_path (filepath);
+	g_free (filepath);
+
+	/* Create destination GFile */
+	extension = eog_util_filename_get_extension (filename);
+	g_free (filename);
+	filename = g_strdup_printf  ("%s.%s", EOG_WALLPAPER_FILENAME, extension);
+	filepath = g_build_filename (job->dest, filename, NULL);
+	dest_file = g_file_new_for_path (filepath);
+
+	/* Move the file */
+	g_file_move (source_file, dest_file, G_FILE_COPY_OVERWRITE,
+		     NULL, NULL, NULL, NULL);
+
+	/* Set the wallpaper */
+	eog_window_set_wallpaper (window, filepath);
+	g_free (filepath);
 
 	gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
 			   window->priv->copy_file_cid);
@@ -2668,9 +2688,8 @@
 
 	window->priv->copy_job = NULL;
 
-	g_free (file);
-	g_free (filename);
-
+	g_object_unref (source_file);
+	g_object_unref (dest_file);
 	g_object_unref (G_OBJECT (job->images->data));
 	g_list_free (job->images);
 	g_object_unref (job);



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