On Sun, 28 Feb 2010 18:48:05 +1000 Adam Nielsen <a.niel...@shikadi.net> wrote:
> I'm currently working on a plugin for XMMS2 that allows multiple configuration > files to be specified. > > I want to do this like the effect plugins, so that when you set the effects.0 > option an effects.1 option gets created, so you can specify a list of values. > > Unfortunately I'm not quite sure how to achieve this. I borrowed some of the > effect code from xform.c, however because the config callback functions only > get called during playback, a file has to actually be playing before I can > change my options. If I change them when playback is stopped, the extra > dynamic option doesn't get created. It seems rather strange to me that config callbacks only get called during playback. Maybe you are removing them when playback is stopped? I have no experience with xforms in xmms2, but maybe you should have different callbacks for updating the config list and applying the configuration. The first would live forever, the latter only when your plugin is actually active (i.e. when playback is active). /* making xmms2 and the plugin acquainted */ static gboolean XX_plugin_setup (...) { ... xmms_config_property_callback_set (config_item, update_config_list, GINT_TO_POINTER(n) ); /* or set the callback immediately when registering the prop with xmms_xform_plugin_config_property_register */ ... } /* initialization of an instance of the xform */ static gboolean XX_plugin_init (...) { ... xmms_config_property_callback_set (config_item, config_changed, udata); ... } /* destruction of an instance of the xform */ static gboolean XX_plugin_destroy (...) { ... xmms_config_property_callback_remove (config_item, config_changed, udata); /* we leave the update_config_list callback, since we want that to be called even when we're not active */ ... } static void update_config_list (...) { ... /* analogy of xform.c:update_effect_properties - checking validity of configuration value, and - setting up effects.[n+1] after effect.n has been changed */ } static void config_changed (...) { ... /* do something with the instance's private data. */ } I hope I got this right. Regards, Erik Massop / nesciens -- _______________________________________________ Xmms2-devel mailing list Xmms2-devel@lists.xmms.se http://lists.xmms.se/cgi-bin/mailman/listinfo/xmms2-devel