[rhythmbox] finish removing references to .gnome2 directories



commit 1b8501be299840b3203f58a62dbb4fcb95f6c4a3
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Jun 6 19:17:32 2011 +1000

    finish removing references to .gnome2 directories

 doc/reference/rhythmbox-sections.txt   |    2 -
 lib/rb-file-helpers.c                  |  109 +++-----------------------------
 lib/rb-file-helpers.h                  |    7 +--
 lib/rb-stock-icons.c                   |    8 +--
 plugins/artdisplay/CoverArtDatabase.py |    7 --
 plugins/magnatune/MagnatuneSource.py   |   39 ++----------
 shell/main.c                           |   17 -----
 shell/rb-shell.c                       |   18 +-----
 8 files changed, 19 insertions(+), 188 deletions(-)
---
diff --git a/doc/reference/rhythmbox-sections.txt b/doc/reference/rhythmbox-sections.txt
index ae07f0c..b7e338c 100644
--- a/doc/reference/rhythmbox-sections.txt
+++ b/doc/reference/rhythmbox-sections.txt
@@ -1025,8 +1025,6 @@ rb_uri_get_filesystem_type
 rb_sanitize_path_for_msdos_filesystem
 rb_sanitize_uri_for_filesystem
 RBUriRecurseFunc
-<SUBSECTION Private>
-rb_dot_dir
 </SECTION>
 
 <SECTION>
diff --git a/lib/rb-file-helpers.c b/lib/rb-file-helpers.c
index a3c579a..8668e3f 100644
--- a/lib/rb-file-helpers.c
+++ b/lib/rb-file-helpers.c
@@ -111,30 +111,6 @@ rb_file (const char *filename)
 }
 
 /**
- * rb_dot_dir:
- *
- * Deprecated.
- *
- * Return value: user's ~/.gnome2/rhythmbox/ dir
- */
-const char *
-rb_dot_dir (void)
-{
-	if (dot_dir == NULL) {
-		dot_dir = g_build_filename (g_get_home_dir (),
-					    ".gnome2",
-					    "rhythmbox",
-					    NULL);
-
-		/* since we don't write any new files in this directory, we shouldn't
-		 * create it if it doesn't already exist.
-		 */
-	}
-	
-	return dot_dir;
-}
-
-/**
  * rb_user_data_dir:
  *
  * This will create the rhythmbox user data directory, using the XDG Base
@@ -206,105 +182,36 @@ rb_music_dir (void)
 	return dir;
 }
 
-static char *
-rb_find_user_file (const char *dir,
-		   const char *name,
-		   GError **error)
-{
-	GError *temp_err = NULL;
-	char *srcpath;
-	char *destpath;
-	GFile *src;
-	GFile *dest;
-	char *use_path;
-
-	/* if the file exists in the target dir, return the path */
-	destpath = g_build_filename (dir, name, NULL);
-	dest = g_file_new_for_path (destpath);
-	if (g_file_query_exists (dest, NULL) == TRUE) {
-		g_object_unref (dest);
-		rb_debug ("found user dir path for '%s': %s", name, destpath);
-		return destpath;
-	}
-
-	/* doesn't exist in the target dir, so try to move it from the .gnome2 dir */
-	srcpath = g_build_filename (rb_dot_dir (), name, NULL);
-	src = g_file_new_for_path (srcpath);
-
-	if (g_file_query_exists (src, NULL)) {
-		g_file_move (src, dest, G_FILE_COPY_NONE, NULL, NULL, NULL, &temp_err);
-		if (temp_err != NULL) {
-			rb_debug ("failed to move user file '%s' from .gnome2 dir, returning .gnome2 path %s: %s",
-				  name, srcpath, temp_err->message);
-
-			use_path = g_file_get_path (src);
-			g_set_error (error,
-				     temp_err->domain,
-				     temp_err->code,
-				     _("Unable to move %s to %s: %s"),
-				     srcpath, destpath, temp_err->message);
-			g_error_free (temp_err);
-		} else {
-			rb_debug ("moved user file '%s' from .gnome2 dir, returning user dir path %s",
-				  name, destpath);
-			use_path = g_file_get_path (dest);
-		}
-	} else {
-		rb_debug ("no existing file for '%s', returning user dir path %s", name, destpath);
-		use_path = g_file_get_path (dest);
-	}
-
-	g_free (srcpath);
-	g_free (destpath);
-
-	g_object_unref (src);
-	g_object_unref (dest);
-
-	return use_path;
-}
-
 /**
  * rb_find_user_data_file:
  * @name: name of file to find
- * @error: returns error information
  *
- * Determines the full path to use for user-specific files, such as rhythmdb.xml.
- * This first checks in the user data directory (see @rb_user_data_dir).
- * If the file does not exist in the user data directory, it then checks the
- * old .gnome2 directory, moving the file to the user data directory if found there.
- * If an error occurs while moving the file, this will be reported through @error 
- * and the .gnome2 path will be returned.
+ * Determines the full path to use for user-specific files, such as rhythmdb.xml,
+ * within the user data directory (see @rb_user_data_dir).
  *
  * Returns: allocated string containing the location of the file to use, even if
  *  an error occurred.
  */
 char *
-rb_find_user_data_file (const char *name,
-			GError **error)
+rb_find_user_data_file (const char *name)
 {
-	return rb_find_user_file (rb_user_data_dir (), name, error);
+	return g_build_filename (rb_user_data_dir (), name, NULL);
 }
 
 /**
  * rb_find_user_cache_file:
  * @name: name of file to find
- * @error: returns error information
  *
- * Determines the full path to use for user-specific cached files.
- * This first checks in the user cache directory (see @rb_user_cache_dir).
- * If the file does not exist in the user cache directory, it then checks the
- * old .gnome2 directory, moving the file to the user cache directory if found there.
- * If an error occurs while moving the file, this will be reported through @error 
- * and the .gnome2 path will be returned.
+ * Determines the full path to use for user-specific cached files
+ * within the user cache directory.
  *
  * Returns: allocated string containing the location of the file to use, even if
  *  an error occurred.
  */
 char *
-rb_find_user_cache_file (const char *name,
-			 GError **error)
+rb_find_user_cache_file (const char *name)
 {
-	return rb_find_user_file (rb_user_cache_dir (), name, error);
+	return g_build_filename (rb_user_cache_dir (), name, NULL);
 }
 
 /**
diff --git a/lib/rb-file-helpers.h b/lib/rb-file-helpers.h
index 45366e3..b32528f 100644
--- a/lib/rb-file-helpers.h
+++ b/lib/rb-file-helpers.h
@@ -34,15 +34,12 @@
 G_BEGIN_DECLS
 
 const char *	rb_file			(const char *filename);
-const char *	rb_dot_dir		(void);
 const char *	rb_user_data_dir	(void);
 const char *	rb_user_cache_dir	(void);
 const char *	rb_music_dir		(void);
 
-char *		rb_find_user_data_file	(const char *name,
-					 GError **error);
-char *		rb_find_user_cache_file	(const char *name,
-					 GError **error);
+char *		rb_find_user_data_file	(const char *name);
+char *		rb_find_user_cache_file	(const char *name);
 char *		rb_find_plugin_data_file (GObject *plugin,
 					 const char *name);
 
diff --git a/lib/rb-stock-icons.c b/lib/rb-stock-icons.c
index 3bb7792..8efa041 100644
--- a/lib/rb-stock-icons.c
+++ b/lib/rb-stock-icons.c
@@ -83,13 +83,7 @@ rb_stock_icons_init (void)
 	int icon_size;
 	char *dot_icon_dir;
 
-	/* add our icon search paths.  the rb_dot_dir() path is deprecated
-	 * and should be removed at some point.
-	 */
-	dot_icon_dir = g_build_filename (rb_dot_dir (), "icons", NULL);
-	gtk_icon_theme_append_search_path (theme, dot_icon_dir);
-	g_free (dot_icon_dir);
-
+	/* add our icon search paths */
 	dot_icon_dir = g_build_filename (rb_user_data_dir (), "icons", NULL);
 	gtk_icon_theme_append_search_path (theme, dot_icon_dir);
 	g_free (dot_icon_dir);
diff --git a/plugins/artdisplay/CoverArtDatabase.py b/plugins/artdisplay/CoverArtDatabase.py
index a1d3e1f..894b23a 100644
--- a/plugins/artdisplay/CoverArtDatabase.py
+++ b/plugins/artdisplay/CoverArtDatabase.py
@@ -44,7 +44,6 @@ from urllib import unquote, pathname2url
 
 ART_SEARCHES_LOCAL = [LocalCoverArtSearch, EmbeddedCoverArtSearch]
 ART_SEARCHES_REMOTE = [PodcastCoverArtSearch, LastFMCoverArtSearch, MusicBrainzCoverArtSearch]
-OLD_ART_FOLDER = '~/.gnome2/rhythmbox/covers'
 
 ART_FOLDER = os.path.join(RB.user_cache_dir(), 'covers')
 ART_CACHE_EXTENSION_JPG = 'jpg'
@@ -127,12 +126,6 @@ class CoverArtDatabase (object):
 	def build_art_cache_filename (self, db, entry, extension):
 		artist, album = get_search_props(db, entry)
 		art_folder = os.path.expanduser (ART_FOLDER)
-		old_art_folder = os.path.expanduser (OLD_ART_FOLDER)
-		if not os.path.exists (art_folder) and os.path.exists (old_art_folder):
-			parent = os.path.dirname(os.path.abspath(art_folder))
-			if not os.path.exists (parent):
-				os.makedirs (parent)
-			os.rename (old_art_folder, art_folder)
 		if not os.path.exists (art_folder):
 			os.makedirs (art_folder)
 
diff --git a/plugins/magnatune/MagnatuneSource.py b/plugins/magnatune/MagnatuneSource.py
index 6a880a0..6c683c2 100644
--- a/plugins/magnatune/MagnatuneSource.py
+++ b/plugins/magnatune/MagnatuneSource.py
@@ -122,9 +122,13 @@ class MagnatuneSource(RB.BrowserSource):
 			self.__db = shell.props.db
 			self.__entry_type = self.props.entry_type
 
-			# move files from old ~/.gnome2 paths
 			if not magnatune_in_progress_dir.query_exists(None):
-				self.__move_data_files()
+				magnatune_in_progress_path = magnatune_in_progress_dir.get_path()
+				os.mkdir(magnatune_in_progress_path, 0700)
+
+			if not magnatune_cache_dir.query_exists(None):
+				magnatune_cache_path = magnatune_cache_dir.get_path()
+				os.mkdir(magnatune_cache_path, 0700)
 
 			self.__activated = True
 			self.__show_loading_screen(True)
@@ -552,35 +556,4 @@ class MagnatuneSource(RB.BrowserSource):
 		self.__db.emit_entry_extra_metadata_notify(entry, 'rb:coverArt-uri', url)
 		return False
 
-	def __move_data_files(self):
-		# create cache and data directories
-		magnatune_in_progress_path = magnatune_in_progress_dir.get_path()
-		magnatune_cache_path = magnatune_cache_dir.get_path()
-
-		# (we know they don't already exist, and we know the parent dirs do)
-		os.mkdir(magnatune_in_progress_path, 0700)
-		if os.path.exists(magnatune_cache_path) is False:
-			os.mkdir(magnatune_cache_path, 0700)
-
-		# move song info to cache dir
-		old_magnatune_dir = os.path.join(RB.dot_dir(), 'magnatune')
-		if os.path.exists(old_magnatune_dir) is False:
-			print "old magnatune directory does not exist"
-			return
-
-		old_song_info = os.path.join(old_magnatune_dir, 'song_info.xml')
-		if os.path.exists(old_song_info):
-			print "moving existing song_info.xml to cache dir"
-			os.rename(old_song_info, magnatune_song_info)
-		else:
-			print "no song_info.xml found (%s)" % old_song_info
-
-		# move in progress downloads to data dir
-		otherfiles = os.listdir(old_magnatune_dir)
-		for f in otherfiles:
-			print "moving file %s to new in-progress dir" % f
-			os.rename(os.path.join(old_magnatune_dir, f),
-				  os.path.join(magnatune_in_progress_path, f))
-
-
 gobject.type_register(MagnatuneSource)
diff --git a/shell/main.c b/shell/main.c
index d590ffc..67d2d4a 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -103,7 +103,6 @@ main (int argc, char **argv)
 	RBShell *rb_shell;
 	gboolean activated;
 	gboolean autostarted;
-	char *accel_map_file = NULL;
 	char *desktop_file_path;
 
 	GOptionContext *context;
@@ -260,18 +259,6 @@ main (int argc, char **argv)
 #else
 		rb_file_helpers_init (FALSE);
 #endif
-
-		/* XXX not sure what to do with this.  should we move it to
-		 * the config dir, or leave it where it is?
-		 */
-		accel_map_file = g_build_filename (g_get_home_dir (),
-						   ".gnome2",
-						   "accels",
-						   "rhythmbox",
-						   NULL);
-		gtk_accel_map_load (accel_map_file);
-
-
 		rb_debug ("Going to create a new shell");
 
 		rb_stock_icons_init ();
@@ -345,10 +332,6 @@ main (int argc, char **argv)
 	rb_debug ("THE END");
 	rb_profile_end ("starting rhythmbox");
 
-	if (accel_map_file != NULL) {
-		gtk_accel_map_save (accel_map_file);
-	}
-
 	gdk_threads_leave ();
 
 	exit (0);
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index f9247b8..5b55a4f 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -1183,7 +1183,6 @@ rb_shell_create_mount_op_cb (RhythmDB *db, RBShell *shell)
 static void
 construct_db (RBShell *shell)
 {
-	GError *error = NULL;
 	char *pathname;
 
 	/* Initialize the database */
@@ -1193,13 +1192,7 @@ construct_db (RBShell *shell)
 	if (shell->priv->rhythmdb_file) {
 		pathname = g_strdup (shell->priv->rhythmdb_file);
 	} else {
-		pathname = rb_find_user_data_file ("rhythmdb.xml", &error);
-		if (error != NULL) {
-			rb_error_dialog (GTK_WINDOW (shell->priv->window),
-					 _("Unable to move user data files"),
-					 "%s", error->message);
-			g_error_free (error);
-		}
+		pathname = rb_find_user_data_file ("rhythmdb.xml");
 	}
 
 #ifdef WITH_RHYTHMDB_TREE
@@ -1400,7 +1393,6 @@ static void
 construct_sources (RBShell *shell)
 {
 	RBDisplayPage *page_group;
-	GError *error = NULL;
 	char *pathname;
 
 	rb_profile_start ("constructing sources");
@@ -1426,13 +1418,7 @@ construct_sources (RBShell *shell)
 	if (shell->priv->playlists_file) {
 		pathname = g_strdup (shell->priv->playlists_file);
 	} else {
-		pathname = rb_find_user_data_file ("playlists.xml", &error);
-		if (error != NULL) {
-			rb_error_dialog (GTK_WINDOW (shell->priv->window),
-					 _("Unable to move user data files"),
-					 "%s", error->message);
-			g_error_free (error);
-		}
+		pathname = rb_find_user_data_file ("playlists.xml");
 	}
 
 	/* Initialize playlist manager */



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