I have made the following changes intended for : CE:MW:Shared / ngfd Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/8144 Thank You, Juho Hämäläinen [This message was auto-generated] --- Request # 8144: Messages from BOSS: State: review at 2013-02-20T14:56:50 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:jhamalai:branches:CE:MW:Shared / ngfd -> CE:MW:Shared / ngfd changes files: -------------- --- ngfd.changes +++ ngfd.changes @@ -0,0 +1,3 @@ +* Wed Feb 20 2013 Juho Hämäläinen <[email protected]> - 0.63 +- Possibility to define optional plugins in configuration. + old: ---- ngfd-0.62.tar.gz new: ---- ngfd-0.63.tar.gz spec files: ----------- --- ngfd.spec +++ ngfd.spec @@ -9,7 +9,7 @@ # << macros Summary: Non-graphic feedback service for sounds and other events -Version: 0.62 +Version: 0.63 Release: 1 Group: System/Daemons License: LGPL 2.1 other changes: -------------- ++++++ ngfd-0.62.tar.gz -> ngfd-0.63.tar.gz --- .gitignore +++ .gitignore @@ -1,23 +0,0 @@ -Makefile -Makefile.in -INSTALL -aclocal.m4 -compile -config.* -configure -depcomp -install-sh -libtool -ltmain.sh -missing -stamp-h1 -ngfd -*.pc -doc/html/ -doc/doxygen.log -.libs -.deps -*.la -*.lo -autom4te.cache/ -m4/ \ No newline at end of file --- data/plugins.d/ffmemless.ini +++ data/plugins.d/ffmemless.ini @@ -1,13 +1,14 @@ [ffmemless] -# System wide effect settings file. -# The if there are parameters for any effects in the system settings file, -# they will override the effect settings for those effects. Other -# effects remain unchanged. -system_effects_file = /usr/share/jolla-settings/feedback.ini +# System wide effect settings file evironment variable. +# The if there are parameters for any effects in the system settings file +# pointed by the given environment variable, they will override the effect +# settings for those effects. Other effects remain unchanged. +system_effects_env = FF_MEMLESS_SETTINGS # EXAMPLE: re-define NGF_SHORT in system settings file -# contents of "system_effects_file" would look like this +# export FF_MEMLESS_SETTINGS=/path/to/my/feedback.ini +# contents of "feedback.ini" would look like this #[ffmemless] #NGF_SHORT_TYPE = rumble #NGF_SHORT_DURATION = 110 --- src/ngf/core-internal.h +++ src/ngf/core-internal.h @@ -40,6 +40,7 @@ gchar *plugin_path; /* plugin path */ GList *required_plugins; /* plugins to load (required) */ + GList *optional_plugins; /* plugins to load (loading may fail, and won't disturb operation) */ GList *plugins; /* NPlugin* */ NSinkInterface **sinks; /* sink interfaces registered */ --- src/ngf/core.c +++ src/ngf/core.c @@ -317,7 +317,7 @@ /* check for required plugins. */ - if (!core->required_plugins) { + if (!core->required_plugins && !core->optional_plugins) { N_ERROR (LOG_CAT "no plugins to load defined in configuration"); goto failed_init; } @@ -329,6 +329,7 @@ /* load all plugins */ + /* first mandatory plugins */ for (p = g_list_first (core->required_plugins); p; p = g_list_next (p)) { if (!(plugin = n_core_load_plugin (core, (const char*) p->data))) goto failed_init; @@ -336,6 +337,15 @@ core->plugins = g_list_append (core->plugins, plugin); } + /* then optional plugins */ + for (p = g_list_first (core->optional_plugins); p; p = g_list_next (p)) { + if ((plugin = n_core_load_plugin (core, (const char*) p->data))) + core->plugins = g_list_append (core->plugins, plugin); + + if (!plugin) + N_INFO (LOG_CAT "optional plugin %s not loaded.", p->data); + } + /* setup the sink priorities based on the sink-order */ n_core_set_sink_priorities (core->sinks, core->sink_order); @@ -424,6 +434,12 @@ core->required_plugins = NULL; } + if (core->optional_plugins) { + g_list_foreach (core->optional_plugins, (GFunc) g_free, NULL); + g_list_free (core->optional_plugins); + core->optional_plugins = NULL; + } + core->shutdown_done = TRUE; } @@ -686,6 +702,17 @@ g_strfreev (sink_list); } +static void +parse_plugins (gchar **plugins, GList **list) +{ + g_assert (plugins); + + gchar **item = NULL; + + for (item = plugins; *item; ++item) + *list = g_list_append (*list, g_strdup (*item)); +} + static int n_core_parse_configuration (NCore *core) { @@ -696,7 +723,6 @@ GError *error = NULL; gchar *filename = NULL; gchar **plugins = NULL; - gchar **item = NULL; filename = g_build_filename (core->conf_path, DEFAULT_CONF_FILENAME, NULL); keyfile = g_key_file_new (); @@ -712,13 +738,14 @@ N_DEBUG (LOG_CAT "parsing configuration file '%s'", filename); /* parse the required plugins. */ + if ((plugins = g_key_file_get_string_list (keyfile, "general", "plugins", NULL, NULL)) != NULL) { + parse_plugins (plugins, &core->required_plugins); + g_strfreev (plugins); + } - plugins = g_key_file_get_string_list (keyfile, "general", "plugins", NULL, NULL); - if (plugins) { - for (item = plugins; *item; ++item) { - core->required_plugins = g_list_append (core->required_plugins, - g_strdup (*item)); - } + /* parse the optional plugins. */ + if ((plugins = g_key_file_get_string_list (keyfile, "general", "plugins-optional", NULL, NULL)) != NULL) { + parse_plugins (plugins, &core->optional_plugins); g_strfreev (plugins); } --- src/plugins/ffmemless/plugin.c +++ src/plugins/ffmemless/plugin.c @@ -33,7 +33,7 @@ #define FFM_PLUGIN_NAME "ffmemless" #define FFM_KEY "plugin.ffmemless.data" -#define FFM_SYSTEM_CONFIG_FILE "system_effects_file" +#define FFM_SYSTEM_CONFIG_KEY "system_effects_env" #define FFM_DEVFILE_KEY "device_file_path" #define FFM_EFFECTLIST_KEY "supported_effects" #define FFM_EFFECT_KEY "ffmemless.effect" @@ -146,6 +146,10 @@ GError *error = NULL; gchar *value = NULL; + if (!file_name) { + N_DEBUG (LOG_CAT "NULL file_name parameter, cannot read props"); + return NULL; + } keyfile = g_key_file_new (); N_DEBUG (LOG_CAT "Loading properties from file \"%s\"", file_name); @@ -623,6 +627,7 @@ N_PLUGIN_LOAD(plugin) { const NProplist *props = n_plugin_get_params(plugin); + const gchar *system_settings_file; N_DEBUG (LOG_CAT "plugin load"); @@ -638,8 +643,9 @@ }; ffm.ngfd_props = props; - ffm.sys_props = ffm_read_props(n_proplist_get_string(props, - FFM_SYSTEM_CONFIG_FILE)); + system_settings_file = g_getenv(n_proplist_get_string(props, + FFM_SYSTEM_CONFIG_KEY)); + ffm.sys_props = ffm_read_props(system_settings_file); n_proplist_dump(ffm.ngfd_props); if (ffm.sys_props) ++++++ ngfd.yaml --- ngfd.yaml +++ ngfd.yaml @@ -1,6 +1,6 @@ Name: ngfd Summary: Non-graphic feedback service for sounds and other events -Version: 0.62 +Version: 0.63 Release: 1 Group: System/Daemons License: LGPL 2.1
