From 59c783eb614c0a56e2d1a2daeb0fef0decdf690e Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 7 Sep 2011 18:05:42 +0200 Subject: plugin-base: new 'allowed-subsystems' property The plugins can set this property to filter support check requests by subsystem. The value given to the property should be a NULL-terminated array of C strings, e.g.: const gchar *subsystems[] = { "tty", NULL }; --- src/mm-plugin-base.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mm-plugin-base.c') diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index 31c52720..32e08511 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -67,11 +67,15 @@ typedef struct { GUdevClient *client; GHashTable *tasks; gboolean sort_last; + + /* Plugin-specific setups */ + const gchar **subsystems; } MMPluginBasePrivate; enum { PROP_0, PROP_NAME, + PROP_ALLOWED_SUBSYSTEMS, PROP_SORT_LAST, LAST_PROP }; @@ -1544,6 +1548,10 @@ set_property (GObject *object, guint prop_id, /* Construct only */ priv->name = g_value_dup_string (value); break; + case PROP_ALLOWED_SUBSYSTEMS: + /* Construct only */ + priv->subsystems = (const gchar **)g_value_get_pointer (value); + break; case PROP_SORT_LAST: /* Construct only */ priv->sort_last = g_value_get_boolean (value); @@ -1564,6 +1572,9 @@ get_property (GObject *object, guint prop_id, case PROP_NAME: g_value_set_string (value, priv->name); break; + case PROP_ALLOWED_SUBSYSTEMS: + g_value_set_pointer (value, (gpointer)priv->subsystems); + break; case PROP_SORT_LAST: g_value_set_boolean (value, priv->sort_last); break; @@ -1609,6 +1620,14 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property + (object_class, PROP_ALLOWED_SUBSYSTEMS, + g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS, + "Allowed subsystems", + "List of subsystems this plugin can support, " + "should be an array of strings finished with 'NULL'", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_SORT_LAST, g_param_spec_boolean (MM_PLUGIN_BASE_SORT_LAST, -- cgit v1.2.3-70-g09d2