summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2012-08-09 10:58:47 +0900
committerDaiki Ueno <ueno@unixuser.org>2012-08-09 10:58:47 +0900
commit72ecfb351a1fe56cd23f9dc1db0a1c56ce7e65d3 (patch)
tree98d8fd42d1d43d6f4fecf7edb82e3d6f7f0a5778 /bus
parentbed48104cc27c4820b956f62cb853abadf8801a4 (diff)
downloadibus-72ecfb351a1fe56cd23f9dc1db0a1c56ce7e65d3.tar.gz
Fix testcase failure when IBus is not installed.
BUG=none Review URL: https://codereview.appspot.com/6455068
Diffstat (limited to 'bus')
-rw-r--r--bus/registry.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/bus/registry.c b/bus/registry.c
index cece1f7f..f8f42855 100644
--- a/bus/registry.c
+++ b/bus/registry.c
@@ -213,31 +213,40 @@ bus_registry_load (BusRegistry *registry)
{
g_assert (BUS_IS_REGISTRY (registry));
- gchar *dirname;
- IBusObservedPath *path;
+ const gchar *envstr;
+ GPtrArray *path;
+ gchar *dirname, **d, **search_path;
+
+ path = g_ptr_array_new();
+
+ envstr = g_getenv ("IBUS_COMPONENT_PATH");
+ if (envstr) {
+ char **dirs = g_strsplit (envstr, G_SEARCHPATH_SEPARATOR_S, 0);
+ for (d = dirs; *d != NULL; d++)
+ g_ptr_array_add (path, *d);
+ g_free (dirs);
+ }
dirname = g_build_filename (PKGDATADIR, "component", NULL);
-
- path = ibus_observed_path_new (dirname, TRUE);
- registry->observed_paths = g_list_append (registry->observed_paths, path);
-
- bus_registry_load_in_dir (registry, dirname);
-
- g_free (dirname);
+ g_ptr_array_add (path, dirname);
#if 0
/* FIXME Should we support install some IME in user dir? */
dirname = g_build_filename (g_get_user_data_dir (), "ibus", "component", NULL);
+ g_ptr_array_add (path, dirname);
+#endif
- path = ibus_observed_path_new (dirname, TRUE);
- registry->observed_paths = g_list_append (registry->observed_paths, path);
+ g_ptr_array_add (path, NULL);
+ search_path = (char**) g_ptr_array_free (path, FALSE);
+ for (d = search_path; *d != NULL; d++) {
+ IBusObservedPath *observed_path = ibus_observed_path_new (*d, TRUE);
- if (g_file_test (dirname, G_FILE_TEST_EXISTS)) {
- bus_registry_load_in_dir (registry, dirname);
- }
+ registry->observed_paths = g_list_append (registry->observed_paths,
+ observed_path);
- g_free (dirname);
-#endif
+ bus_registry_load_in_dir (registry, *d);
+ }
+ g_strfreev (search_path);
}
#define g_string_append_indent(string, indent) \