[rhythmbox] file-helpers: add helper for constructing resource paths for plugins
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] file-helpers: add helper for constructing resource paths for plugins
- Date: Wed, 10 Aug 2016 04:39:22 +0000 (UTC)
commit 7cfbc97f12a8c1bae86b2e1b6a1f573ff5a9c23b
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Jul 19 22:06:47 2016 +1000
file-helpers: add helper for constructing resource paths for plugins
lib/rb-file-helpers.c | 24 ++++++++++++++++++++++++
lib/rb-file-helpers.h | 2 ++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/lib/rb-file-helpers.c b/lib/rb-file-helpers.c
index f5454ee..dbe48af 100644
--- a/lib/rb-file-helpers.c
+++ b/lib/rb-file-helpers.c
@@ -291,6 +291,30 @@ rb_find_plugin_data_file (GObject *object, const char *name)
}
/**
+ * rb_find_plugin_resource:
+ * @plugin: the plugin object
+ * @name: name of the file to find
+ *
+ * Constructs a resource path for a plugin data file.
+ *
+ * Returns: allocated string containing the resource path
+ */
+char *
+rb_find_plugin_resource (GObject *object, const char *name)
+{
+ PeasPluginInfo *info;
+ const char *plugin_name;
+
+ g_object_get (object, "plugin-info", &info, NULL);
+ if (info == NULL)
+ return NULL;
+
+ plugin_name = peas_plugin_info_get_module_name (info);
+ return g_strdup_printf ("/org/gnome/Rhythmbox/%s/%s", plugin_name, name);
+}
+
+
+/**
* rb_file_helpers_init:
* @uninstalled: if %TRUE, search in source and build directories
* as well as installed locations
diff --git a/lib/rb-file-helpers.h b/lib/rb-file-helpers.h
index cea76f3..606eeb3 100644
--- a/lib/rb-file-helpers.h
+++ b/lib/rb-file-helpers.h
@@ -43,6 +43,8 @@ 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);
+char * rb_find_plugin_resource (GObject *plugin,
+ const char *name);
char * rb_canonicalise_uri (const char *uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]