summaryrefslogtreecommitdiff
path: root/battstat/power-management.c
diff options
context:
space:
mode:
Diffstat (limited to 'battstat/power-management.c')
-rw-r--r--battstat/power-management.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/battstat/power-management.c b/battstat/power-management.c
index 5c4145c6..162801f7 100644
--- a/battstat/power-management.c
+++ b/battstat/power-management.c
@@ -62,9 +62,9 @@
"ACPI subsystem is properly loaded.")
static const char *apm_readinfo (BatteryStatus *status);
-static int pm_initialised;
+static gboolean pm_initialised = FALSE;
#ifdef HAVE_UPOWER
-static int using_upower;
+static gboolean using_upower = FALSE;
#endif
/*
@@ -78,7 +78,6 @@ static int using_upower;
* the problem might be. This error message is not to be freed.
*/
-
/* Uncomment the following to enable a 'testing' backend. When you add the
applet to the panel a window will appear that allows you to manually
change the battery status values for testing purposes.
@@ -133,7 +132,6 @@ initialise_test (void)
G_CALLBACK (test_update_integer), &test_status.minutes);
gtk_box_pack_start (box, w, TRUE, TRUE, 0);
-
w = gtk_toggle_button_new_with_label ("on_ac_power");
g_signal_connect (w, "toggled",
G_CALLBACK (test_update_boolean),
@@ -265,7 +263,7 @@ apm_readinfo (BatteryStatus *status)
fd = open(APMDEVICE, O_RDONLY);
if (fd == -1)
{
- pm_initialised = 0;
+ pm_initialised = FALSE;
return ERR_OPEN_APMDEV;
}
if (ioctl (fd, APM_IOC_GETPOWER, &apminfo) == -1)
@@ -394,14 +392,14 @@ power_management_getinfo (BatteryStatus *status)
return NULL;
}
- #ifdef HAVE_UPOWER
- if (using_upower)
- {
- battstat_upower_get_battery_info (status);
- return NULL;
- }
- #endif
-
+#ifdef HAVE_UPOWER
+ if (using_upower)
+ {
+ battstat_upower_get_battery_info (status);
+ return NULL;
+ }
+#endif
+
retval = apm_readinfo (status);
if (status->percent == -1) {
@@ -444,7 +442,7 @@ power_management_initialise (void (*callback) (void))
if (err == NULL) /* UPOWER is up */
{
- pm_initialised = 1;
+ pm_initialised = TRUE;
using_upower = TRUE;
return NULL;
}
@@ -485,7 +483,7 @@ power_management_initialise (void (*callback) (void))
else
using_acpi = FALSE;
#endif
- pm_initialised = 1;
+ pm_initialised = TRUE;
return NULL;
}
@@ -502,7 +500,7 @@ power_management_cleanup (void)
if (using_upower)
{
battstat_upower_cleanup ();
- pm_initialised = 1;
+ pm_initialised = TRUE;
return;
}
#endif
@@ -521,16 +519,16 @@ power_management_cleanup (void)
}
#endif
- pm_initialised = 0;
+ pm_initialised = FALSE;
}
-int
+gboolean
power_management_using_upower (void)
{
#ifdef HAVE_UPOWER
return using_upower;
#else
- return 0;
+ return FALSE;
#endif
}