summaryrefslogtreecommitdiff
path: root/src/gpm-backlight.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-02-14 07:54:19 +0100
committerraveit65 <[email protected]>2020-03-09 15:26:43 +0100
commit33e52564affb7fbc50ad68a08c43c9f70e7d1bb4 (patch)
tree9ac72ec71977ec83ab647b502dbf4bd4a9639a1f /src/gpm-backlight.c
parent9f3d2d0986a6130b1cefc84caae161d75b4f56ba (diff)
downloadmate-power-manager-33e52564affb7fbc50ad68a08c43c9f70e7d1bb4.tar.bz2
mate-power-manager-33e52564affb7fbc50ad68a08c43c9f70e7d1bb4.tar.xz
Port from EggDebug to the built-in GLib logging framework
Diffstat (limited to 'src/gpm-backlight.c')
-rw-r--r--src/gpm-backlight.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 21eed90..47a1b1b 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -46,7 +46,6 @@
#include "gpm-brightness.h"
#include "gpm-control.h"
#include "gpm-common.h"
-#include "egg-debug.h"
#include "gsd-media-keys-window.h"
#include "gpm-dpms.h"
#include "gpm-idle.h"
@@ -158,7 +157,7 @@ gpm_backlight_set_brightness (GpmBacklight *backlight, guint percentage, GError
}
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
- egg_debug ("emitting brightness-changed : %i", percentage);
+ g_debug ("emitting brightness-changed : %i", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
return ret;
@@ -285,19 +284,19 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
guint old_value;
if (backlight->priv->can_dim == FALSE) {
- egg_warning ("no dimming hardware");
+ g_warning ("no dimming hardware");
return FALSE;
}
do_laptop_lcd = g_settings_get_boolean (backlight->priv->settings, GPM_SETTINGS_BACKLIGHT_ENABLE);
if (do_laptop_lcd == FALSE) {
- egg_warning ("policy is no dimming");
+ g_warning ("policy is no dimming");
return FALSE;
}
/* get the last set brightness */
brightness = backlight->priv->master_percentage / 100.0f;
- egg_debug ("1. main brightness %f", brightness);
+ g_debug ("1. main brightness %f", brightness);
/* get battery status */
g_object_get (backlight->priv->client,
@@ -306,12 +305,12 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
/* reduce if on battery power if we should */
if (use_initial) {
- egg_debug ("Setting initial brightness level");
+ g_debug ("Setting initial brightness level");
battery_reduce = g_settings_get_boolean (backlight->priv->settings, GPM_SETTINGS_BACKLIGHT_BATTERY_REDUCE);
if (on_battery && battery_reduce) {
value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_DIM_BATT);
if (value > 100) {
- egg_warning ("cannot use battery brightness value %i, correcting to 50", value);
+ g_warning ("cannot use battery brightness value %i, correcting to 50", value);
value = 50;
}
scale = (100 - value) / 100.0f;
@@ -319,7 +318,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
} else {
scale = 1.0f;
}
- egg_debug ("2. battery scale %f, brightness %f", scale, brightness);
+ g_debug ("2. battery scale %f, brightness %f", scale, brightness);
}
/* reduce if system is momentarily idle */
@@ -330,7 +329,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
if (enable_action && backlight->priv->system_is_idle) {
value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_IDLE_BRIGHTNESS);
if (value > 100) {
- egg_warning ("cannot use idle brightness value %i, correcting to 50", value);
+ g_warning ("cannot use idle brightness value %i, correcting to 50", value);
value = 50;
}
scale = value / 100.0f;
@@ -338,7 +337,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
} else {
scale = 1.0f;
}
- egg_debug ("3. idle scale %f, brightness %f", scale, brightness);
+ g_debug ("3. idle scale %f, brightness %f", scale, brightness);
/* convert to percentage */
value = (guint) ((brightness * 100.0f) + 0.5);
@@ -346,7 +345,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
/* only do stuff if the brightness is different */
gpm_brightness_get (backlight->priv->brightness, &old_value);
if (old_value == value) {
- egg_debug ("values are the same, no action");
+ g_debug ("values are the same, no action");
return FALSE;
}
@@ -361,7 +360,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
ret = gpm_brightness_set (backlight->priv->brightness, value, &hw_changed);
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
- egg_debug ("emitting brightness-changed : %i", value);
+ g_debug ("emitting brightness-changed : %i", value);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, value);
}
return TRUE;
@@ -400,7 +399,7 @@ gpm_settings_key_changed_cb (GSettings *settings, const gchar *key, GpmBacklight
backlight->priv->idle_dim_timeout = g_settings_get_int (settings, key);
gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout);
} else {
- egg_debug ("unknown key %s", key);
+ g_debug ("unknown key %s", key);
}
}
@@ -432,7 +431,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
guint percentage;
gboolean hw_changed;
gboolean on_battery;
- egg_debug ("Button press event type=%s", type);
+ g_debug ("Button press event type=%s", type);
if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_UP) == 0) {
/* go up one step */
@@ -450,14 +449,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
/* if using AC power supply, save the new brightness settings */
g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL);
if (!on_battery) {
- egg_debug ("saving brightness for ac supply: %i", percentage);
+ g_debug ("saving brightness for ac supply: %i", percentage);
g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC,
percentage*1.0);
}
}
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
- egg_debug ("emitting brightness-changed : %i", percentage);
+ g_debug ("emitting brightness-changed : %i", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
} else if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_DOWN) == 0) {
@@ -476,14 +475,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
/* if using AC power supply, save the new brightness settings */
g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL);
if (!on_battery) {
- egg_debug ("saving brightness for ac supply: %i", percentage);
+ g_debug ("saving brightness for ac supply: %i", percentage);
g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC,
percentage*1.0);
}
}
/* we emit a signal for the brightness applet */
if (ret && hw_changed) {
- egg_debug ("emitting brightness-changed : %i", percentage);
+ g_debug ("emitting brightness-changed : %i", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
} else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) {
@@ -493,7 +492,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
/* ensure backlight is on */
ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
if (!ret) {
- egg_warning ("failed to turn on DPMS: %s", error->message);
+ g_warning ("failed to turn on DPMS: %s", error->message);
g_error_free (error);
}
}
@@ -509,7 +508,7 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i
/* no point continuing */
if (backlight->priv->system_is_idle == is_idle) {
- egg_debug ("state not changed");
+ g_debug ("state not changed");
return FALSE;
}
@@ -518,14 +517,14 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i
g_timer_reset (backlight->priv->idle_timer);
if (is_idle == FALSE) {
- egg_debug ("we have just been idle for %lfs", elapsed);
+ g_debug ("we have just been idle for %lfs", elapsed);
/* The user immediatly undimmed the screen!
* We should double the timeout to avoid this happening again */
if (elapsed < 10) {
/* double the event time */
backlight->priv->idle_dim_timeout *= 2.0;
- egg_debug ("increasing idle dim time to %is", backlight->priv->idle_dim_timeout);
+ g_debug ("increasing idle dim time to %is", backlight->priv->idle_dim_timeout);
gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout);
}
@@ -536,14 +535,14 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i
backlight->priv->idle_dim_timeout =
g_settings_get_int (backlight->priv->settings,
GPM_SETTINGS_IDLE_DIM_TIME);
- egg_debug ("resetting idle dim time to %is", backlight->priv->idle_dim_timeout);
+ g_debug ("resetting idle dim time to %is", backlight->priv->idle_dim_timeout);
gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout);
}
} else {
- egg_debug ("we were active for %lfs", elapsed);
+ g_debug ("we were active for %lfs", elapsed);
}
- egg_debug ("changing powersave idle status to %i", is_idle);
+ g_debug ("changing powersave idle status to %i", is_idle);
backlight->priv->system_is_idle = is_idle;
return TRUE;
}
@@ -573,7 +572,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)
/* don't dim or undim the screen unless ConsoleKit/systemd say we are on the active console */
if (!LOGIND_RUNNING() && !egg_console_kit_is_active (backlight->priv->console)) {
- egg_debug ("ignoring as not on active console");
+ g_debug ("ignoring as not on active console");
return;
}
@@ -585,7 +584,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)
/* ensure backlight is on */
ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
if (!ret) {
- egg_warning ("failed to turn on DPMS: %s", error->message);
+ g_warning ("failed to turn on DPMS: %s", error->message);
g_error_free (error);
}
@@ -598,7 +597,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)
/* ensure backlight is on */
ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
if (!ret) {
- egg_warning ("failed to turn on DPMS: %s", error->message);
+ g_warning ("failed to turn on DPMS: %s", error->message);
g_error_free (error);
}
@@ -619,14 +618,14 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)
/* check if method is valid */
if (dpms_mode == GPM_DPMS_MODE_UNKNOWN || dpms_mode == GPM_DPMS_MODE_ON) {
- egg_warning ("BACKLIGHT method %i unknown. Using OFF.", dpms_mode);
+ g_warning ("BACKLIGHT method %i unknown. Using OFF.", dpms_mode);
dpms_mode = GPM_DPMS_MODE_OFF;
}
/* turn backlight off */
ret = gpm_dpms_set_mode (backlight->priv->dpms, dpms_mode, &error);
if (!ret) {
- egg_warning ("failed to change DPMS: %s", error->message);
+ g_warning ("failed to change DPMS: %s", error->message);
g_error_free (error);
}
@@ -648,7 +647,7 @@ brightness_changed_cb (GpmBrightness *brightness, guint percentage, GpmBacklight
backlight->priv->master_percentage = percentage;
/* we emit a signal for the brightness applet */
- egg_debug ("emitting brightness-changed : %i", percentage);
+ g_debug ("emitting brightness-changed : %i", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
@@ -668,7 +667,7 @@ control_resume_cb (GpmControl *control, GpmControlAction action, GpmBacklight *b
/* ensure backlight is on */
ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
if (!ret) {
- egg_warning ("failed to turn on DPMS: %s", error->message);
+ g_warning ("failed to turn on DPMS: %s", error->message);
g_error_free (error);
}
}