[rhythmbox/wip/hadess/remove-uninstalled] all: Remove running from an uninstalled directory




commit 9a9b96f7c21cf81e93dd48de47448baae52af821
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 20 11:11:56 2021 +0200

    all: Remove running from an uninstalled directory
    
    It makes finding bugs harder, and using meson is fast enough that
    running installed using a build helper like jhbuild is as fast as
    running partial builds.

 config.h.meson                                    |  9 ---------
 lib/rb-builder-helpers.c                          | 13 ++----------
 lib/rb-file-helpers.c                             | 24 +++--------------------
 lib/rb-file-helpers.h                             |  2 +-
 lib/rb-stock-icons.c                              |  3 ---
 meson.build                                       |  4 ----
 metadata/rb-metadata-dbus-client.c                |  9 ---------
 plugins/android/rb-android-plugin.c               |  4 ----
 plugins/audioscrobbler/rb-audioscrobbler-plugin.c |  6 ------
 plugins/mpris/rb-mpris-plugin.c                   |  4 ----
 shell/main.c                                      |  8 --------
 shell/rb-application.c                            |  7 +------
 shell/rb-shell.c                                  | 13 ------------
 tests/bench-rhythmdb-load.c                       |  2 +-
 tests/meson.build                                 |  5 ++++-
 tests/test-file-helpers.c                         |  2 +-
 tests/test-rhythmdb-property-model.c              |  2 +-
 tests/test-rhythmdb-query-model.c                 |  2 +-
 tests/test-rhythmdb-view.c                        |  2 +-
 tests/test-rhythmdb.c                             |  4 ++--
 tests/test-widgets.c                              |  2 +-
 widgets/test-uri-dialog.c                         |  2 +-
 22 files changed, 20 insertions(+), 109 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index 40504bf47..5ecf69d43 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -92,21 +92,12 @@
 /* Define to the level of RhythmDB sanity checking */
 #mesondefine RHYTHMDB_ENABLE_SANITY_CHECK
 
-/* path to built source data dir */
-#mesondefine SHARE_UNINSTALLED_BUILDDIR
-
-/* path to source data dir */
-#mesondefine SHARE_UNINSTALLED_DIR
-
 /* The size of `long', as computed by sizeof. */
 #mesondefine SIZEOF_LONG
 
 /* Define to 1 if you have the ANSI C header files. */
 #mesondefine STDC_HEADERS
 
-/* Define to look for files in source tree locations */
-#mesondefine USE_UNINSTALLED_DIRS
-
 /* Define if libsecret support is enabled */
 #mesondefine WITH_LIBSECRET
 
diff --git a/lib/rb-builder-helpers.c b/lib/rb-builder-helpers.c
index 730df594d..134951a79 100644
--- a/lib/rb-builder-helpers.c
+++ b/lib/rb-builder-helpers.c
@@ -50,9 +50,8 @@
  * signal handlers where possible.
  *
  * The caller can specify an absolute path to the file, a resource path
- * starting with /org/gnome/Rhythmbox/ or just a filename, in which case
- * the file will be loaded from GResources (in normal builds) or the source
- * data/ui directory (in uninstalled builds).
+ * starting with /org/gnome/Rhythmbox/ or just a filename.
+ * The file will be loaded from GResources.
  *
  * Return value: (transfer full): #GtkBuilder object built from the file
  */
@@ -73,13 +72,8 @@ rb_builder_load (const char *file, gpointer user_data)
                name = file;
                resource = NULL;
        } else {
-#if defined(USE_UNINSTALLED_DIRS)
-               name = rb_file (file);
-               resource = NULL;
-#else
                resource = g_strdup_printf ("/org/gnome/Rhythmbox/ui/%s", file);
                name = NULL;
-#endif
        }
 
        builder = gtk_builder_new ();
@@ -118,8 +112,6 @@ rb_builder_load_plugin_file (GObject *plugin, const char *file, gpointer user_da
 {
        char *path = NULL;
        GtkBuilder *builder;
-
-#if !defined(USE_UNINSTALLED_DIRS)
        GBytes *bytes;
 
        path = rb_find_plugin_resource (plugin, file);
@@ -130,7 +122,6 @@ rb_builder_load_plugin_file (GObject *plugin, const char *file, gpointer user_da
                g_free (path);
                path = NULL;
        }
-#endif
        if (path == NULL) {
                path = rb_find_plugin_data_file (plugin, file);
                if (path == NULL) {
diff --git a/lib/rb-file-helpers.c b/lib/rb-file-helpers.c
index 3639c182e..541c6b3d9 100644
--- a/lib/rb-file-helpers.c
+++ b/lib/rb-file-helpers.c
@@ -63,22 +63,11 @@ static char *dot_dir = NULL;
 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_BUILDDIR "/",
-       SHARE_UNINSTALLED_BUILDDIR "/ui/",
-       SHARE_DIR "/",
-       NULL
-};
-
 static char *installed_paths[] = {
        SHARE_DIR "/",
        NULL
 };
 
-static char **search_paths;
-
 static const char *recurse_attributes =
                G_FILE_ATTRIBUTE_STANDARD_NAME ","
                G_FILE_ATTRIBUTE_STANDARD_TYPE ","
@@ -121,8 +110,8 @@ rb_file (const char *filename)
        if (ret != NULL)
                return ret;
 
-       for (i = 0; search_paths[i] != NULL; i++) {
-               ret = g_strconcat (search_paths[i], filename, NULL);
+       for (i = 0; installed_paths[i] != NULL; i++) {
+               ret = g_strconcat (installed_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;
@@ -320,19 +309,12 @@ rb_find_plugin_resource (GObject *object, const char *name)
 
 /**
  * rb_file_helpers_init:
- * @uninstalled: if %TRUE, search in source and build directories
- * as well as installed locations
  *
  * Sets up file search paths for @rb_file.  Must be called on startup.
  */
 void
-rb_file_helpers_init (gboolean uninstalled)
+rb_file_helpers_init (void)
 {
-       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,
diff --git a/lib/rb-file-helpers.h b/lib/rb-file-helpers.h
index 8196f63fb..4f4fe9e08 100644
--- a/lib/rb-file-helpers.h
+++ b/lib/rb-file-helpers.h
@@ -93,7 +93,7 @@ GFile *               rb_file_find_extant_parent (GFile *file);
 
 gboolean       rb_uri_create_parent_dirs (const char *uri, GError **error);
 
-void           rb_file_helpers_init    (gboolean uninstalled);
+void           rb_file_helpers_init    (void);
 void           rb_file_helpers_shutdown(void);
 
 char *         rb_uri_get_filesystem_type (const char *uri, char **mount_point);
diff --git a/lib/rb-stock-icons.c b/lib/rb-stock-icons.c
index de9e809b5..5a389dedb 100644
--- a/lib/rb-stock-icons.c
+++ b/lib/rb-stock-icons.c
@@ -61,9 +61,6 @@ rb_stock_icons_init (void)
        g_free (dot_icon_dir);
 
        gtk_icon_theme_append_search_path (theme, SHARE_DIR G_DIR_SEPARATOR_S "icons");
-#ifdef USE_UNINSTALLED_DIRS
-       gtk_icon_theme_append_search_path (theme, SHARE_UNINSTALLED_DIR G_DIR_SEPARATOR_S "icons");
-#endif
 
        /* add resource icons */
        gtk_icon_theme_add_resource_path (theme, "/org/gnome/Rhythmbox/icons/hicolor");
diff --git a/meson.build b/meson.build
index 1ad11d3ff..36adf1bf7 100644
--- a/meson.build
+++ b/meson.build
@@ -168,10 +168,6 @@ cdata.set('GETTEXT_PACKAGE', '"rhythmbox"')
 cdata.set('PACKAGE', '"rhythmbox"')
 cdata.set('VERSION', '@0@'.format(meson.project_version()))
 
-cdata.set('SHARE_UNINSTALLED_DIR', '"@0@"'.format(meson.source_root() + '/data'))
-cdata.set('SHARE_UNINSTALLED_BUILDDIR', '"@0@"'.format(meson.build_root() + '/data'))
-cdata.set('METADATA_UNINSTALLED_DIR', '"@0@"'.format(meson.build_root() + '/metadata'))
-
 # Needed so that we can build static libraries and later link them into
 # shared libraries.
 add_global_arguments('-fPIC', language: 'c')
diff --git a/metadata/rb-metadata-dbus-client.c b/metadata/rb-metadata-dbus-client.c
index 4245bcbf9..eba7f80a1 100644
--- a/metadata/rb-metadata-dbus-client.c
+++ b/metadata/rb-metadata-dbus-client.c
@@ -241,16 +241,7 @@ start_metadata_service (GError **error)
                int i;
 
                argv = g_ptr_array_new ();
-               /*
-                * Normally, we find the metadata helper in the libexec dir,
-                * but when --enable-uninstalled-build is specified, we look
-                * in the directory it's built in.
-                */
-#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);
-#endif
                debug_args = rb_debug_get_args ();
                i = 0;
                while (debug_args[i] != NULL) {
diff --git a/plugins/android/rb-android-plugin.c b/plugins/android/rb-android-plugin.c
index 642da06e0..489b47587 100644
--- a/plugins/android/rb-android-plugin.c
+++ b/plugins/android/rb-android-plugin.c
@@ -124,11 +124,7 @@ create_source_cb (RBRemovableMediaManager *rmm, GVolume *volume, RBAndroidPlugin
                return NULL;
        }
 
-#if defined(USE_UNINSTALLED_DIRS)
-       mpi_file = rb_find_plugin_data_file (G_OBJECT (plugin), "android.mpi");
-#else
        mpi_file = "/org/gnome/Rhythmbox/android/android.mpi";
-#endif
        device_info = mpid_device_new_from_mpi_file (mpi_file);
 
        path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c 
b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
index cc882e395..faaa3a429 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
@@ -129,12 +129,6 @@ impl_activate (PeasActivatable *bplugin)
        gtk_icon_theme_append_search_path (theme, icondir);
        g_free (icondir);
 
-#if defined(USE_UNINSTALLED_DIRS)
-       icondir = g_build_filename (peas_plugin_info_get_module_dir (plugin_info), "icons", NULL);
-       gtk_icon_theme_append_search_path (theme, icondir);
-       g_free (icondir);
-#endif
-
        g_signal_connect_object (plugin->lastfm_settings,
                                 "changed",
                                 G_CALLBACK (lastfm_settings_changed_cb),
diff --git a/plugins/mpris/rb-mpris-plugin.c b/plugins/mpris/rb-mpris-plugin.c
index fdafb6f2d..722d5bd4d 100644
--- a/plugins/mpris/rb-mpris-plugin.c
+++ b/plugins/mpris/rb-mpris-plugin.c
@@ -290,11 +290,7 @@ get_root_property (GDBusConnection *connection,
                GVariant *v = NULL;
                char *path;
 
-#ifdef USE_UNINSTALLED_DIRS
-               path = g_build_filename (SHARE_UNINSTALLED_BUILDDIR, "org.gnome.Rhythmbox3.desktop", NULL);
-#else
                path = g_build_filename (DATADIR, "applications", "org.gnome.Rhythmbox3.desktop", NULL);
-#endif
                if (path != NULL) {
                        char *basename;
                        char *ext;
diff --git a/shell/main.c b/shell/main.c
index 1a629f6a7..b00f04a3f 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -62,10 +62,6 @@ main (int argc, char **argv)
 
        g_random_set_seed (time (0));
 
-#ifdef USE_UNINSTALLED_DIRS
-       g_setenv ("GSETTINGS_SCHEMA_DIR", SHARE_UNINSTALLED_BUILDDIR, TRUE);
-#endif
-
        setlocale (LC_ALL, "");
 
 #ifdef ENABLE_NLS
@@ -79,10 +75,6 @@ main (int argc, char **argv)
        g_set_application_name (_("Rhythmbox"));
        gtk_window_set_default_icon_name (RB_APP_ICON);
 
-#if defined(USE_UNINSTALLED_DIRS)
-       g_irepository_prepend_search_path (SHARE_UNINSTALLED_BUILDDIR "/../bindings/gi");
-#endif
-
        rb_threads_init ();
 
        app = rb_application_new ();
diff --git a/shell/rb-application.c b/shell/rb-application.c
index 5feaa3781..a2fcea0e1 100644
--- a/shell/rb-application.c
+++ b/shell/rb-application.c
@@ -464,12 +464,7 @@ rb_application_init (RBApplication *app)
        rb_user_data_dir ();
        rb_refstring_system_init ();
 
-#ifdef USE_UNINSTALLED_DIRS
-       rb_file_helpers_init (TRUE);
-#else
-       rb_file_helpers_init (FALSE);
-#endif
-
+       rb_file_helpers_init ();
        app->priv->shared_menus = g_hash_table_new_full (g_str_hash,
                                                         g_str_equal,
                                                         (GDestroyNotify) g_free,
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index f45eef3e7..9e23286cb 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -101,8 +101,6 @@
 #include "rb-task-list.h"
 #include "rb-task-list-display.h"
 
-#define UNINSTALLED_PLUGINS_LOCATION "plugins"
-
 #define PLAYING_ENTRY_NOTIFY_TIME 4
 
 #define ALBUM_ART_MIN_SIZE     32
@@ -868,17 +866,6 @@ construct_plugins (RBShell *shell)
                                     plugindir);
        g_free (plugindir);
 
-#ifdef USE_UNINSTALLED_DIRS
-       plugindir = g_build_filename (SHARE_UNINSTALLED_BUILDDIR, "..", UNINSTALLED_PLUGINS_LOCATION, NULL);
-       plugindatadir = g_build_filename (SHARE_UNINSTALLED_DIR, "..", UNINSTALLED_PLUGINS_LOCATION, NULL);
-       rb_debug ("uninstalled plugin search path: %s / %s", plugindir, plugindatadir);
-       peas_engine_add_search_path (shell->priv->plugin_engine,
-                                    plugindir,
-                                    plugindatadir);
-       g_free (plugindir);
-       g_free (plugindatadir);
-#endif
-
        plugindir = g_build_filename (LIBDIR, "rhythmbox", "plugins", NULL);
        plugindatadir = g_build_filename (DATADIR, "rhythmbox", "plugins", NULL);
        rb_debug ("plugin search path: %s / %s", plugindir, plugindatadir);
diff --git a/tests/bench-rhythmdb-load.c b/tests/bench-rhythmdb-load.c
index a43e83365..cb1d8af60 100644
--- a/tests/bench-rhythmdb-load.c
+++ b/tests/bench-rhythmdb-load.c
@@ -104,7 +104,7 @@ main (int argc, char **argv)
        gtk_init (&argc, &argv);
        rb_debug_init (FALSE);
        rb_refstring_system_init ();
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        db = rhythmdb_tree_new ("test");
        g_object_set (G_OBJECT (db), "name", name, NULL);
diff --git a/tests/meson.build b/tests/meson.build
index edb0f61d4..6a7f3adf4 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -4,7 +4,10 @@ if check.found()
   test('test-rhythmdb',
     executable('test-rhythmdb',
       ['test-rhythmdb.c', 'test-utils.c'],
-      dependencies: [rhythmbox_core_dep, check]))
+      dependencies: [rhythmbox_core_dep, check],
+      c_args: [
+        '-DTEST_DIR="@0@"'.format(meson.current_source_dir())
+      ]))
 
   test('test-rhythmdb-query-model',
     executable('test-rhythmdb-query-model',
diff --git a/tests/test-file-helpers.c b/tests/test-file-helpers.c
index 76cd35576..d1f99caa3 100644
--- a/tests/test-file-helpers.c
+++ b/tests/test-file-helpers.c
@@ -142,7 +142,7 @@ main (int argc, char **argv)
        rb_threads_init ();
        setlocale (LC_ALL, "");
        rb_debug_init (TRUE);
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        /* setup tests */
        s = rb_file_helpers_suite ();
diff --git a/tests/test-rhythmdb-property-model.c b/tests/test-rhythmdb-property-model.c
index 05a80d36e..827d493be 100644
--- a/tests/test-rhythmdb-property-model.c
+++ b/tests/test-rhythmdb-property-model.c
@@ -773,7 +773,7 @@ main (int argc, char **argv)
        setlocale (LC_ALL, "");
        rb_debug_init (TRUE);
        rb_refstring_system_init ();
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        /* setup tests */
        s = rhythmdb_property_model_suite ();
diff --git a/tests/test-rhythmdb-query-model.c b/tests/test-rhythmdb-query-model.c
index 99d5eadbf..f4c107828 100644
--- a/tests/test-rhythmdb-query-model.c
+++ b/tests/test-rhythmdb-query-model.c
@@ -321,7 +321,7 @@ main (int argc, char **argv)
        setlocale (LC_ALL, "");
        rb_debug_init (TRUE);
        rb_refstring_system_init ();
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        /* setup tests */
        s = rhythmdb_query_model_suite ();
diff --git a/tests/test-rhythmdb-view.c b/tests/test-rhythmdb-view.c
index 01ccd7d29..2dc0f0549 100644
--- a/tests/test-rhythmdb-view.c
+++ b/tests/test-rhythmdb-view.c
@@ -105,7 +105,7 @@ main (int argc, char **argv)
 
        gtk_init (&argc, &argv);
        rb_thread_helpers_init ();
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
        rb_stock_icons_init ();
        rb_debug_init (TRUE);
 
diff --git a/tests/test-rhythmdb.c b/tests/test-rhythmdb.c
index e47235810..8f0d8ad37 100644
--- a/tests/test-rhythmdb.c
+++ b/tests/test-rhythmdb.c
@@ -505,7 +505,7 @@ START_TEST (test_rhythmdb_podcast_upgrade)
        const char *mountpoint;
 
        /* load db with old podcasts setups */
-       g_object_set (G_OBJECT (db), "name", SHARE_UNINSTALLED_DIR "/../tests/podcast-upgrade.xml", NULL);
+       g_object_set (G_OBJECT (db), "name", TEST_DIR "/podcast-upgrade.xml", NULL);
        set_waiting_signal (G_OBJECT (db), "load-complete");
        rhythmdb_load (db);
        wait_for_signal ();
@@ -657,7 +657,7 @@ main (int argc, char **argv)
        rb_threads_init ();
        rb_debug_init (TRUE);
        rb_refstring_system_init ();
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        /* setup tests */
        s = rhythmdb_suite ();
diff --git a/tests/test-widgets.c b/tests/test-widgets.c
index d74c0df47..1e8380267 100644
--- a/tests/test-widgets.c
+++ b/tests/test-widgets.c
@@ -316,7 +316,7 @@ main (int argc, char **argv)
        rb_threads_init ();
        rb_debug_init (TRUE);
        rb_refstring_system_init ();
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        /* setup tests */
        s = rb_query_creator_suite ();
diff --git a/widgets/test-uri-dialog.c b/widgets/test-uri-dialog.c
index fe27f6887..f9c46e0d9 100644
--- a/widgets/test-uri-dialog.c
+++ b/widgets/test-uri-dialog.c
@@ -15,7 +15,7 @@ int main (int argc, char **argv)
        GtkWidget *dialog;
 
        gtk_init (&argc, &argv);
-       rb_file_helpers_init (TRUE);
+       rb_file_helpers_init ();
 
        dialog = rb_uri_dialog_new ("Dialog title", "dialog label");
        g_signal_connect (G_OBJECT (dialog), "location-added",


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