diff options
author | Ali Abdallah <ali.slackware@gmail.com> | 2009-04-14 07:49:27 +0000 |
---|---|---|
committer | Ali Abdallah <ali.slackware@gmail.com> | 2009-04-14 07:49:27 +0000 |
commit | f2a8cd6e1d4c4dec906d3a28a96aa207755f9b7e (patch) | |
tree | 7618d0247f9eda2878c2ca33087abf4c7ebde5e4 /src | |
parent | bba762c1a95bf822f2781073150e79e75aed1180 (diff) | |
download | ixfce4-power-manager-f2a8cd6e1d4c4dec906d3a28a96aa207755f9b7e.tar.gz |
Commit all changes for beta2
(Old svn revision: 7196)
Diffstat (limited to 'src')
-rw-r--r-- | src/xfpm-battery.c | 46 | ||||
-rw-r--r-- | src/xfpm-xfconf.c | 4 |
2 files changed, 37 insertions, 13 deletions
diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c index 0a5e8ad7..ff36d106 100644 --- a/src/xfpm-battery.c +++ b/src/xfpm-battery.c @@ -46,6 +46,7 @@ #include "xfpm-xfconf.h" #include "xfpm-config.h" #include "xfpm-adapter.h" +#include "xfpm-debug.h" /* Init */ static void xfpm_battery_class_init (XfpmBatteryClass *klass); @@ -158,6 +159,10 @@ xfpm_battery_refresh_icon (XfpmBattery *battery, guint percentage ) { + gchar *icon; + + XFPM_DEBUG_ENUM ("battery state", battery->priv->state, XFPM_TYPE_BATTERY_STATE) + if ( !is_present ) { xfpm_tray_icon_set_icon (battery->priv->icon, @@ -172,19 +177,38 @@ xfpm_battery_refresh_icon (XfpmBattery *battery, xfpm_tray_icon_set_icon (battery->priv->icon, battery->priv->adapter_present ? "gpm-primary-charged" : "gpm-primary-100"); else { - gchar *icon = g_strdup_printf("%s%s", - battery->priv->icon_prefix, - xfpm_battery_get_icon_index (battery->priv->type, percentage)); + icon = g_strdup_printf("%s%s", + battery->priv->icon_prefix, + xfpm_battery_get_icon_index (battery->priv->type, percentage)); xfpm_tray_icon_set_icon (battery->priv->icon, icon); g_free(icon); } } - else if ( battery->priv->state == BATTERY_IS_CHARGING || battery->priv->state == BATTERY_NOT_FULLY_CHARGED ) + else if ( battery->priv->state == BATTERY_NOT_FULLY_CHARGED ) + { + if ( battery->priv->adapter_present ) + { + icon = g_strdup_printf("%s%s-%s", + battery->priv->icon_prefix, + xfpm_battery_get_icon_index (battery->priv->type, percentage), + "charging"); + } + else + { + icon = g_strdup_printf("%s%s", + battery->priv->icon_prefix, + xfpm_battery_get_icon_index (battery->priv->type, percentage)); + } + xfpm_tray_icon_set_icon (battery->priv->icon, icon); + g_free(icon); + + } + else if ( battery->priv->state == BATTERY_IS_CHARGING ) { - gchar *icon = g_strdup_printf("%s%s-%s", - battery->priv->icon_prefix, - xfpm_battery_get_icon_index (battery->priv->type, percentage), - "charging"); + icon = g_strdup_printf("%s%s-%s", + battery->priv->icon_prefix, + xfpm_battery_get_icon_index (battery->priv->type, percentage), + "charging"); xfpm_tray_icon_set_icon (battery->priv->icon, icon); g_free(icon); @@ -192,9 +216,9 @@ xfpm_battery_refresh_icon (XfpmBattery *battery, else if ( battery->priv->state == BATTERY_IS_DISCHARGING || battery->priv->state == BATTERY_CHARGE_CRITICAL || battery->priv->state == BATTERY_CHARGE_LOW ) { - gchar *icon = g_strdup_printf("%s%s", - battery->priv->icon_prefix, - xfpm_battery_get_icon_index (battery->priv->type, percentage)); + icon = g_strdup_printf("%s%s", + battery->priv->icon_prefix, + xfpm_battery_get_icon_index (battery->priv->type, percentage)); xfpm_tray_icon_set_icon (battery->priv->icon, icon); g_free(icon); diff --git a/src/xfpm-xfconf.c b/src/xfpm-xfconf.c index c9d737ee..b67c23f4 100644 --- a/src/xfpm-xfconf.c +++ b/src/xfpm-xfconf.c @@ -632,6 +632,8 @@ gboolean xfpm_xfconf_get_property_bool (XfpmXfconf *conf, const gchar *property) #endif /* HAVE_DPMS */ else if ( xfpm_strequal (property, INACTIVITY_SLEEP_MODE) ) return conf->priv->sleep_inactivity; + else if ( xfpm_strequal (property, ENABLE_BRIGHTNESS_CONTROL) ) + return conf->priv->enable_brightness; g_warn_if_reached (); @@ -656,8 +658,6 @@ guint8 xfpm_xfconf_get_property_enum (XfpmXfconf *conf, const gchar *property) return conf->priv->power_button; else if ( xfpm_strequal (property, HIBERNATE_SWITCH_CFG ) ) return conf->priv->hibernate_button; - else if ( xfpm_strequal (property, ENABLE_BRIGHTNESS_CONTROL) ) - return conf->priv->enable_brightness; g_warn_if_reached (); |