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 };
This commit is contained in:

committed by
Aleksander Morgado

parent
27e1d97aca
commit
59c783eb61
@@ -67,11 +67,15 @@ typedef struct {
|
|||||||
GUdevClient *client;
|
GUdevClient *client;
|
||||||
GHashTable *tasks;
|
GHashTable *tasks;
|
||||||
gboolean sort_last;
|
gboolean sort_last;
|
||||||
|
|
||||||
|
/* Plugin-specific setups */
|
||||||
|
const gchar **subsystems;
|
||||||
} MMPluginBasePrivate;
|
} MMPluginBasePrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
|
PROP_ALLOWED_SUBSYSTEMS,
|
||||||
PROP_SORT_LAST,
|
PROP_SORT_LAST,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
@@ -1544,6 +1548,10 @@ set_property (GObject *object, guint prop_id,
|
|||||||
/* Construct only */
|
/* Construct only */
|
||||||
priv->name = g_value_dup_string (value);
|
priv->name = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ALLOWED_SUBSYSTEMS:
|
||||||
|
/* Construct only */
|
||||||
|
priv->subsystems = (const gchar **)g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
case PROP_SORT_LAST:
|
case PROP_SORT_LAST:
|
||||||
/* Construct only */
|
/* Construct only */
|
||||||
priv->sort_last = g_value_get_boolean (value);
|
priv->sort_last = g_value_get_boolean (value);
|
||||||
@@ -1564,6 +1572,9 @@ get_property (GObject *object, guint prop_id,
|
|||||||
case PROP_NAME:
|
case PROP_NAME:
|
||||||
g_value_set_string (value, priv->name);
|
g_value_set_string (value, priv->name);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ALLOWED_SUBSYSTEMS:
|
||||||
|
g_value_set_pointer (value, (gpointer)priv->subsystems);
|
||||||
|
break;
|
||||||
case PROP_SORT_LAST:
|
case PROP_SORT_LAST:
|
||||||
g_value_set_boolean (value, priv->sort_last);
|
g_value_set_boolean (value, priv->sort_last);
|
||||||
break;
|
break;
|
||||||
@@ -1609,6 +1620,14 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass)
|
|||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
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
|
g_object_class_install_property
|
||||||
(object_class, PROP_SORT_LAST,
|
(object_class, PROP_SORT_LAST,
|
||||||
g_param_spec_boolean (MM_PLUGIN_BASE_SORT_LAST,
|
g_param_spec_boolean (MM_PLUGIN_BASE_SORT_LAST,
|
||||||
|
@@ -113,6 +113,7 @@ void mm_plugin_base_supports_task_add_custom_init_command (MMPluginBaseSupportsT
|
|||||||
#define MM_PLUGIN_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_BASE, MMPluginBaseClass))
|
#define MM_PLUGIN_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_BASE, MMPluginBaseClass))
|
||||||
|
|
||||||
#define MM_PLUGIN_BASE_NAME "name"
|
#define MM_PLUGIN_BASE_NAME "name"
|
||||||
|
#define MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS "allowed-subsystems"
|
||||||
#define MM_PLUGIN_BASE_SORT_LAST "sort-last"
|
#define MM_PLUGIN_BASE_SORT_LAST "sort-last"
|
||||||
|
|
||||||
typedef struct _MMPluginBase MMPluginBase;
|
typedef struct _MMPluginBase MMPluginBase;
|
||||||
|
Reference in New Issue
Block a user