rhythmbox r6179 - in trunk: . lib metadata plugins shell tests



Author: jmatthew
Date: Sat Mar  7 05:43:05 2009
New Revision: 6179
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6179&view=rev

Log:
2009-03-07  Jonathan Matthew  <jonathan d14n org>

	* configure.ac:
	Always define uninstalled locations, since we need to use them to run
	tests.

	* lib/rb-file-helpers.c: (rb_file), (rb_file_helpers_init):
	* lib/rb-file-helpers.h:
	Decide whether to use uninstalled locations at runtime, rather than
	compile time.

	* lib/rb-stock-icons.c: (rb_stock_icons_init):
	* metadata/rb-metadata-dbus-client.c: (start_metadata_service):
	* plugins/rb-plugin.c: (rb_get_plugin_paths):
	* shell/main.c: (main):
	Uninstalled locations are always defined now, so use
	USE_UNINSTALLED_DIRS to decide whether to use them.

	* tests/bench-rhythmdb-load.c: (main):
	* tests/test-file-helpers.c: (main):
	* tests/test-rhythmdb-property-model.c: (main):
	* tests/test-rhythmdb-query-model.c: (main):
	* tests/test-rhythmdb-view.c: (main):
	* tests/test-rhythmdb.c: (main):
	* tests/test-widgets.c: (main):
	Always use uninstalled locations in test programs.  Fixes #563051.


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/lib/rb-file-helpers.c
   trunk/lib/rb-file-helpers.h
   trunk/lib/rb-stock-icons.c
   trunk/metadata/rb-metadata-dbus-client.c
   trunk/plugins/rb-plugin.c
   trunk/shell/main.c
   trunk/tests/bench-rhythmdb-load.c
   trunk/tests/test-file-helpers.c
   trunk/tests/test-rhythmdb-property-model.c
   trunk/tests/test-rhythmdb-query-model.c
   trunk/tests/test-rhythmdb-view.c
   trunk/tests/test-rhythmdb.c
   trunk/tests/test-widgets.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat Mar  7 05:43:05 2009
@@ -457,11 +457,11 @@
 			     [Search for files in build directory as well]),
 	      enable_uninstalled=yes,)
 if test x"$enable_uninstalled" = xyes; then
-	ROOT_UNINSTALLED_DIR="`pwd`"
 	AC_DEFINE(USE_UNINSTALLED_DIRS, 1, [Define to look for files in source tree locations])
-	AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_DIR,"`pwd`/data",[path to source data dir])
-	AC_DEFINE_UNQUOTED(METADATA_UNINSTALLED_DIR,"`pwd`/metadata",[path to metadata build dir])
 fi
+ROOT_UNINSTALLED_DIR="`pwd`"
+AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_DIR,"`pwd`/data",[path to source data dir])
+AC_DEFINE_UNQUOTED(METADATA_UNINSTALLED_DIR,"`pwd`/metadata",[path to metadata build dir])
 AC_SUBST(ROOT_UNINSTALLED_DIR)
 
 AC_ARG_WITH(internal-libsexy,

Modified: trunk/lib/rb-file-helpers.c
==============================================================================
--- trunk/lib/rb-file-helpers.c	(original)
+++ trunk/lib/rb-file-helpers.c	Sat Mar  7 05:43:05 2009
@@ -49,32 +49,41 @@
 static char *user_data_dir = NULL;
 static char *user_cache_dir = NULL;
 
+static char *uninstalled_paths[] = {
+	SHARE_UNINSTALLED_DIR "/",
+	SHARE_UNINSTALLED_DIR "/ui/",
+	SHARE_UNINSTALLED_DIR "/glade/",
+	SHARE_UNINSTALLED_DIR "/art/",
+	SHARE_DIR "/",
+	SHARE_DIR "/glade/",
+	SHARE_DIR "/art/",
+	NULL
+};
+
+static char *installed_paths[] = {
+	SHARE_DIR "/",
+	SHARE_DIR "/glade/",
+	SHARE_DIR "/art/",
+	NULL
+};
+
+static char **search_paths;
+
+
 const char *
 rb_file (const char *filename)
 {
 	char *ret;
 	int i;
 
-	static char *paths[] = {
-#ifdef SHARE_UNINSTALLED_DIR
-		SHARE_UNINSTALLED_DIR "/",
-		SHARE_UNINSTALLED_DIR "/ui/",
-		SHARE_UNINSTALLED_DIR "/glade/",
-		SHARE_UNINSTALLED_DIR "/art/",
-#endif
-		SHARE_DIR "/",
-		SHARE_DIR "/glade/",
-		SHARE_DIR "/art/",
-	};
-	
 	g_assert (files != NULL);
 
 	ret = g_hash_table_lookup (files, filename);
 	if (ret != NULL)
 		return ret;
 
-	for (i = 0; i < (int) G_N_ELEMENTS (paths); i++) {
-		ret = g_strconcat (paths[i], filename, NULL);
+	for (i = 0; search_paths[i] != NULL; i++) {
+		ret = g_strconcat (search_paths[i], filename, NULL);
 		if (g_file_test (ret, G_FILE_TEST_EXISTS) == TRUE) {
 			g_hash_table_insert (files, g_strdup (filename), ret);
 			return (const char *) ret;
@@ -268,8 +277,13 @@
 }
 
 void
-rb_file_helpers_init (void)
+rb_file_helpers_init (gboolean uninstalled)
 {
+	if (uninstalled)
+		search_paths = uninstalled_paths;
+	else
+		search_paths = installed_paths;
+
 	files = g_hash_table_new_full (g_str_hash,
 				       g_str_equal,
 				       (GDestroyNotify) g_free,

Modified: trunk/lib/rb-file-helpers.h
==============================================================================
--- trunk/lib/rb-file-helpers.h	(original)
+++ trunk/lib/rb-file-helpers.h	Sat Mar  7 05:43:05 2009
@@ -91,7 +91,7 @@
 
 gboolean	rb_uri_create_parent_dirs (const char *uri, GError **error);
 
-void		rb_file_helpers_init	(void);
+void		rb_file_helpers_init	(gboolean uninstalled);
 void		rb_file_helpers_shutdown(void);
 
 char *		rb_uri_get_filesystem_type (const char *uri);

Modified: trunk/lib/rb-stock-icons.c
==============================================================================
--- trunk/lib/rb-stock-icons.c	(original)
+++ trunk/lib/rb-stock-icons.c	Sat Mar  7 05:43:05 2009
@@ -89,7 +89,7 @@
 	g_free (dot_icon_dir);
 
 	gtk_icon_theme_append_search_path (theme, SHARE_DIR G_DIR_SEPARATOR_S "icons");
-#ifdef SHARE_UNINSTALLED_DIR
+#ifdef USE_UNINSTALLED_DIRS
 	gtk_icon_theme_append_search_path (theme, SHARE_UNINSTALLED_DIR G_DIR_SEPARATOR_S "icons");
 #endif
 

Modified: trunk/metadata/rb-metadata-dbus-client.c
==============================================================================
--- trunk/metadata/rb-metadata-dbus-client.c	(original)
+++ trunk/metadata/rb-metadata-dbus-client.c	Sat Mar  7 05:43:05 2009
@@ -244,7 +244,7 @@
 		 * but when --enable-uninstalled-build is specified, we look
 		 * in the directory it's built in.
 		 */
-#ifdef METADATA_UNINSTALLED_DIR
+#ifdef USE_UNINSTALLED_DIRS
 		g_ptr_array_add (argv, METADATA_UNINSTALLED_DIR "/rhythmbox-metadata");
 #else
 		g_ptr_array_add (argv, LIBEXEC_DIR G_DIR_SEPARATOR_S INSTALLED_METADATA_HELPER);

Modified: trunk/plugins/rb-plugin.c
==============================================================================
--- trunk/plugins/rb-plugin.c	(original)
+++ trunk/plugins/rb-plugin.c	Sat Mar  7 05:43:05 2009
@@ -210,7 +210,7 @@
 		paths = g_list_prepend (paths, path);
 	}
 
-#ifdef SHARE_UNINSTALLED_DIR
+#ifdef USE_UNINSTALLED_DIRS
 	path = g_build_filename (UNINSTALLED_PLUGINS_LOCATION, NULL);
 	paths = g_list_prepend (paths, path);
 	path = g_build_filename ("..", UNINSTALLED_PLUGINS_LOCATION, NULL);

Modified: trunk/shell/main.c
==============================================================================
--- trunk/shell/main.c	(original)
+++ trunk/shell/main.c	Sat Mar  7 05:43:05 2009
@@ -257,7 +257,11 @@
 
 		rb_refstring_system_init ();
 
-		rb_file_helpers_init ();
+#ifdef USE_UNINSTALLED_DIRS
+		rb_file_helpers_init (TRUE);
+#else
+		rb_file_helpers_init (FALSE);
+#endif
 
 		rb_debug ("Going to create a new shell");
 

Modified: trunk/tests/bench-rhythmdb-load.c
==============================================================================
--- trunk/tests/bench-rhythmdb-load.c	(original)
+++ trunk/tests/bench-rhythmdb-load.c	Sat Mar  7 05:43:05 2009
@@ -103,7 +103,7 @@
 	gtk_init (&argc, &argv);
 	rb_debug_init (FALSE);
 	rb_refstring_system_init ();
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 
 	GDK_THREADS_ENTER ();
 

Modified: trunk/tests/test-file-helpers.c
==============================================================================
--- trunk/tests/test-file-helpers.c	(original)
+++ trunk/tests/test-file-helpers.c	Sat Mar  7 05:43:05 2009
@@ -125,7 +125,7 @@
 	rb_threads_init ();
 	gtk_set_locale ();
 	rb_debug_init (TRUE);
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 
 	/* setup tests */
 	s = rb_file_helpers_suite ();

Modified: trunk/tests/test-rhythmdb-property-model.c
==============================================================================
--- trunk/tests/test-rhythmdb-property-model.c	(original)
+++ trunk/tests/test-rhythmdb-property-model.c	Sat Mar  7 05:43:05 2009
@@ -452,7 +452,7 @@
 	gtk_init (&argc, &argv);
 	rb_debug_init (TRUE);
 	rb_refstring_system_init ();
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 
 
 	GDK_THREADS_ENTER ();

Modified: trunk/tests/test-rhythmdb-query-model.c
==============================================================================
--- trunk/tests/test-rhythmdb-query-model.c	(original)
+++ trunk/tests/test-rhythmdb-query-model.c	Sat Mar  7 05:43:05 2009
@@ -247,7 +247,7 @@
 	gtk_set_locale ();
 	rb_debug_init (TRUE);
 	rb_refstring_system_init ();
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 
 	/* setup tests */
 	s = rhythmdb_query_model_suite ();

Modified: trunk/tests/test-rhythmdb-view.c
==============================================================================
--- trunk/tests/test-rhythmdb-view.c	(original)
+++ trunk/tests/test-rhythmdb-view.c	Sat Mar  7 05:43:05 2009
@@ -110,7 +110,7 @@
 	g_thread_init (NULL);
 	gdk_threads_init ();
 	rb_thread_helpers_init ();
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 	rb_stock_icons_init ();
 	rb_debug_init (TRUE);
 

Modified: trunk/tests/test-rhythmdb.c
==============================================================================
--- trunk/tests/test-rhythmdb.c	(original)
+++ trunk/tests/test-rhythmdb.c	Sat Mar  7 05:43:05 2009
@@ -520,7 +520,7 @@
 	rb_threads_init ();
 	rb_debug_init (TRUE);
 	rb_refstring_system_init ();
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 
 	/* setup tests */
 	s = rhythmdb_suite ();

Modified: trunk/tests/test-widgets.c
==============================================================================
--- trunk/tests/test-widgets.c	(original)
+++ trunk/tests/test-widgets.c	Sat Mar  7 05:43:05 2009
@@ -432,7 +432,7 @@
 	rb_threads_init ();
 	rb_debug_init (TRUE);
 	rb_refstring_system_init ();
-	rb_file_helpers_init ();
+	rb_file_helpers_init (TRUE);
 
 	/* setup tests */
 	s = rb_query_creator_suite ();



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