summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ohmd/ohm-module.c2
-rw-r--r--ohmd/ohm-plugin-internal.h1
-rw-r--r--ohmd/ohm-plugin.c19
3 files changed, 19 insertions, 3 deletions
diff --git a/ohmd/ohm-module.c b/ohmd/ohm-module.c
index 6ee2154..99dc34a 100644
--- a/ohmd/ohm-module.c
+++ b/ohmd/ohm-module.c
@@ -107,7 +107,7 @@ key_changed_cb (OhmConf *conf,
notif = (OhmModuleNotify *) l->data;
name = ohm_plugin_get_name (notif->plugin);
ohm_debug ("notify %s with id:%i", name, notif->id);
- ohm_plugin_notify (notif->plugin, notif->id, value);
+ ohm_plugin_notify (notif->plugin, key, notif->id, value);
}
}
diff --git a/ohmd/ohm-plugin-internal.h b/ohmd/ohm-plugin-internal.h
index 92c9bcb..00eea75 100644
--- a/ohmd/ohm-plugin-internal.h
+++ b/ohmd/ohm-plugin-internal.h
@@ -63,6 +63,7 @@ const gchar *ohm_plugin_get_name (OhmPlugin *plugin);
const gchar *ohm_plugin_get_version (OhmPlugin *plugin);
const gchar *ohm_plugin_get_author (OhmPlugin *plugin);
gboolean ohm_plugin_notify (OhmPlugin *plugin,
+ const char *key,
gint id,
gint value);
diff --git a/ohmd/ohm-plugin.c b/ohmd/ohm-plugin.c
index 4012e48..1480ebd 100644
--- a/ohmd/ohm-plugin.c
+++ b/ohmd/ohm-plugin.c
@@ -59,6 +59,7 @@ struct _OhmPluginPrivate
GPtrArray *hal_udis;
OhmPluginHalPropMod hal_property_changed_cb;
OhmPluginHalCondition hal_condition_cb;
+ const char *key_being_set;
};
G_DEFINE_TYPE (OhmPlugin, ohm_plugin, G_TYPE_OBJECT)
@@ -154,7 +155,13 @@ ohm_plugin_conf_set_key (OhmPlugin *plugin,
gboolean ret;
error = NULL;
+ /* key_being_set is used to stop a plugin changing a key notifying
+ * itself if it's interest in that key
+ */
+ plugin->priv->key_being_set = key;
ret = ohm_conf_set_key_internal (plugin->priv->conf, key, value, TRUE, &error);
+ plugin->priv->key_being_set = NULL;
+
if (ret == FALSE) {
g_error ("Cannot set key: %s", error->message);
g_error_free (error);
@@ -164,9 +171,17 @@ ohm_plugin_conf_set_key (OhmPlugin *plugin,
gboolean
ohm_plugin_notify (OhmPlugin *plugin,
- int id,
- int value)
+ const char *key,
+ int id,
+ int value)
{
+ /* check that it wasn't this plugin that changed the key in
+ * the first place
+ */
+ if (plugin->priv->key_being_set &&
+ strcmp(plugin->priv->key_being_set, key) == 0)
+ return TRUE;
+
plugin->desc->notify (plugin, id, value);
return TRUE;
}