summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2007-01-26 01:44:02 +0000
committerRichard Hughes <richard@hughsie.com>2007-01-26 01:44:02 +0000
commitcf1951755df867f5c231f8719cb7b730b0f26d2d (patch)
tree097f953ac454d43b722373a562a3614f87598af3 /plugins
parent4252742005d995524bdd9a3cd03ab18733285ec2 (diff)
change load into preload
Change the load() function into preload() and make it return success. There's no point loading plugins when we haven't got the hardware.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/acadapter/ohm-plugin-acadapter.c9
-rw-r--r--plugins/backlight/ohm-plugin-backlight.c9
-rw-r--r--plugins/battery/ohm-plugin-battery.c9
-rw-r--r--plugins/dpms/ohm-plugin-dpms.c13
-rw-r--r--plugins/idle/ohm-plugin-idle.c9
-rw-r--r--plugins/powerstatus/ohm-plugin-powerstatus.c9
-rw-r--r--plugins/timeremaining/ohm-plugin-timeremaining.c9
7 files changed, 39 insertions, 28 deletions
diff --git a/plugins/acadapter/ohm-plugin-acadapter.c b/plugins/acadapter/ohm-plugin-acadapter.c
index 0ba8a10..12cef6d 100644
--- a/plugins/acadapter/ohm-plugin-acadapter.c
+++ b/plugins/acadapter/ohm-plugin-acadapter.c
@@ -34,18 +34,19 @@ OhmPluginCacheData data;
OhmPlugin *plugin_global; /* ick, needed as there is no userdata with libhal */
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
ohm_plugin_conf_provide (plugin, "acadapter.state");
plugin_global = plugin;
+ return TRUE;
}
/**
@@ -120,7 +121,7 @@ static OhmPluginInfo plugin_info = {
"OHM HAL AC Adapter", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
plugin_unload, /* unload */
plugin_coldplug, /* coldplug */
NULL, /* conf_notify */
diff --git a/plugins/backlight/ohm-plugin-backlight.c b/plugins/backlight/ohm-plugin-backlight.c
index b91dd11..508e85f 100644
--- a/plugins/backlight/ohm-plugin-backlight.c
+++ b/plugins/backlight/ohm-plugin-backlight.c
@@ -55,15 +55,15 @@ typedef struct {
OhmPluginCacheData data;
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
/* FIXME: detect if we have any backlights in the system and return false if not */
/* add in the required, suggested and prevented plugins */
@@ -73,6 +73,7 @@ plugin_load (OhmPlugin *plugin)
/* tell ohmd what keys we are going to provide so it can create them */
ohm_plugin_conf_provide (plugin, "backlight.state");
ohm_plugin_conf_provide (plugin, "backlight.brightness");
+ return TRUE;
}
/**
@@ -177,7 +178,7 @@ static OhmPluginInfo plugin_info = {
"OHM Backlight", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
NULL, /* unload */
plugin_coldplug, /* coldplug */
plugin_conf_notify, /* conf_notify */
diff --git a/plugins/battery/ohm-plugin-battery.c b/plugins/battery/ohm-plugin-battery.c
index 8b4d768..14d34ec 100644
--- a/plugins/battery/ohm-plugin-battery.c
+++ b/plugins/battery/ohm-plugin-battery.c
@@ -34,20 +34,21 @@ OhmPluginCacheData data;
OhmPlugin *plugin_global; /* ick, needed as there is no userdata with libhal */
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
/* tell ohmd what keys we are going to provide - don't set keys
* unless you provide them */
ohm_plugin_conf_provide (plugin, "battery.percentage");
plugin_global = plugin;
+ return TRUE;
}
/**
@@ -122,7 +123,7 @@ static OhmPluginInfo plugin_info = {
"OHM HAL Battery", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
plugin_unload, /* unload */
plugin_coldplug, /* coldplug */
NULL, /* conf_notify */
diff --git a/plugins/dpms/ohm-plugin-dpms.c b/plugins/dpms/ohm-plugin-dpms.c
index 63a9955..990f9d2 100644
--- a/plugins/dpms/ohm-plugin-dpms.c
+++ b/plugins/dpms/ohm-plugin-dpms.c
@@ -54,18 +54,23 @@ typedef struct {
OhmPluginCacheData data;
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
+#ifndef HAVE_DPMS_EXTENSION
+ /* no point loading this plugin if we have no DPMS support */
+ return FALSE;
+#endif
/* add in the required, suggested and prevented plugins */
ohm_plugin_require (plugin, "backlight");
+ return TRUE;
}
@@ -236,7 +241,7 @@ static OhmPluginInfo plugin_info = {
"OHM DPMS", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
NULL, /* unload */
plugin_coldplug, /* coldplug */
plugin_conf_notify, /* conf_notify */
diff --git a/plugins/idle/ohm-plugin-idle.c b/plugins/idle/ohm-plugin-idle.c
index 66b2cce..0f08f3f 100644
--- a/plugins/idle/ohm-plugin-idle.c
+++ b/plugins/idle/ohm-plugin-idle.c
@@ -24,18 +24,19 @@
#include <ohm-plugin.h>
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
/* tell ohmd what keys we are going to provide */
ohm_plugin_conf_provide (plugin, "idle.system_idle");
+ return TRUE;
}
/**
@@ -55,7 +56,7 @@ static OhmPluginInfo plugin_info = {
"OHM PowerStatus", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
NULL, /* unload */
plugin_coldplug, /* coldplug */
NULL, /* conf_notify */
diff --git a/plugins/powerstatus/ohm-plugin-powerstatus.c b/plugins/powerstatus/ohm-plugin-powerstatus.c
index ef22b9c..1c26310 100644
--- a/plugins/powerstatus/ohm-plugin-powerstatus.c
+++ b/plugins/powerstatus/ohm-plugin-powerstatus.c
@@ -39,15 +39,15 @@ typedef struct {
OhmPluginCacheData data;
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
/* add in the required, suggested and prevented plugins */
ohm_plugin_suggest (plugin, "battery");
@@ -55,6 +55,7 @@ plugin_load (OhmPlugin *plugin)
/* tell ohmd what keys we are going to provide so it can create them */
ohm_plugin_conf_provide (plugin, "powerstatus.low");
ohm_plugin_conf_provide (plugin, "powerstatus.critical");
+ return TRUE;
}
/**
@@ -134,7 +135,7 @@ static OhmPluginInfo plugin_info = {
"OHM PowerStatus", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
NULL, /* unload */
plugin_coldplug, /* coldplug */
plugin_conf_notify, /* conf_notify */
diff --git a/plugins/timeremaining/ohm-plugin-timeremaining.c b/plugins/timeremaining/ohm-plugin-timeremaining.c
index dc99d7b..8fe5e0c 100644
--- a/plugins/timeremaining/ohm-plugin-timeremaining.c
+++ b/plugins/timeremaining/ohm-plugin-timeremaining.c
@@ -37,15 +37,15 @@ typedef struct {
OhmPluginCacheData data;
/**
- * plugin_load:
+ * plugin_preload:
* @plugin: This class instance
*
* Called before the plugin is coldplg.
* Define any modules that the plugin depends on, but do not do coldplug here
* as some of the modules may not have loaded yet.
*/
-static void
-plugin_load (OhmPlugin *plugin)
+static gboolean
+plugin_preload (OhmPlugin *plugin)
{
/* add in the required, suggested and prevented plugins */
ohm_plugin_suggest (plugin, "battery");
@@ -54,6 +54,7 @@ plugin_load (OhmPlugin *plugin)
/* tell ohmd what keys we are going to provide so it can create them */
ohm_plugin_conf_provide (plugin, "timeremaining.to_charge");
ohm_plugin_conf_provide (plugin, "timeremaining.to_discharge");
+ return TRUE;
}
/**
@@ -115,7 +116,7 @@ static OhmPluginInfo plugin_info = {
"OHM timeremaining", /* description */
"0.0.1", /* version */
"richard@hughsie.com", /* author */
- plugin_load, /* load */
+ plugin_preload, /* preload */
NULL, /* unload */
plugin_coldplug, /* coldplug */
plugin_conf_notify, /* conf_notify */