[gnome-power-manager] Port from EggDebug to the built-in GLib logging framework
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Port from EggDebug to the built-in GLib logging framework
- Date: Tue, 26 Oct 2010 09:33:05 +0000 (UTC)
commit b1c459eb0be141d21a584b7835ac84a8388fa73a
Author: Richard Hughes <richard hughsie com>
Date: Tue Oct 26 11:30:18 2010 +0100
Port from EggDebug to the built-in GLib logging framework
src/Makefile.am | 13 +--
src/cc-power-panel.c | 1 -
src/egg-console-kit.c | 15 +--
src/egg-debug.c | 308 ------------------------------------------------
src/egg-debug.h | 83 -------------
src/gpm-array-float.c | 7 +-
src/gpm-backlight.c | 59 +++++-----
src/gpm-brightness.c | 88 +++++++-------
src/gpm-button.c | 22 ++--
src/gpm-common.c | 11 +-
src/gpm-control.c | 21 ++--
src/gpm-debug.c | 193 ++++++++++++++++++++++++++++++
src/gpm-debug.h | 31 +++++
src/gpm-disks.c | 17 ++--
src/gpm-dpms.c | 13 +-
src/gpm-engine.c | 74 ++++++------
src/gpm-graph-widget.c | 24 ++--
src/gpm-idle.c | 45 ++++----
src/gpm-load.c | 13 +-
src/gpm-main.c | 32 ++---
src/gpm-manager.c | 139 +++++++++++-----------
src/gpm-phone.c | 31 +++---
src/gpm-point-obj.c | 1 -
src/gpm-screensaver.c | 29 ++---
src/gpm-self-test.c | 9 +-
src/gpm-statistics.c | 21 ++--
src/gpm-tray-icon.c | 19 ++--
src/gpm-upower.c | 12 +-
28 files changed, 560 insertions(+), 771 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 04e2cec..2d3a06f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,10 +24,7 @@ INCLUDES = \
-DGPM_DATA=\"$(pkgdatadir)\" \
-DGTKBUILDERDIR=\"$(pkgdatadir)\" \
-DUP_DISABLE_DEPRECATED \
- -DEGG_LOG_FILE=\""/tmp/gpm.log"\" \
- -DEGG_VERBOSE="\"GPM_VERBOSE\"" \
- -DEGG_LOGGING="\"GPM_LOGGING\"" \
- -DEGG_CONSOLE="\"GPM_CONSOLE\"" \
+ -DG_LOG_DOMAIN=\"PowerManager\" \
-I$(top_srcdir)
ccpanelsdir = $(PANELS_DIR)
@@ -46,8 +43,8 @@ check_PROGRAMS = \
noinst_LIBRARIES = libgpmshared.a
libgpmshared_a_SOURCES = \
- egg-debug.h \
- egg-debug.c \
+ gpm-debug.h \
+ gpm-debug.c \
gpm-array-float.c \
gpm-array-float.h \
gpm-idletime.h \
@@ -95,8 +92,8 @@ gnome_power_statistics_CFLAGS = \
libpower_la_SOURCES = \
egg-console-kit.h \
egg-console-kit.c \
- egg-debug.h \
- egg-debug.c \
+ gpm-debug.h \
+ gpm-debug.c \
gpm-brightness.h \
gpm-brightness.c \
gpm-common.h \
diff --git a/src/cc-power-panel.c b/src/cc-power-panel.c
index fd56d7b..78c06eb 100644
--- a/src/cc-power-panel.c
+++ b/src/cc-power-panel.c
@@ -27,7 +27,6 @@
#include <gtk/gtk.h>
#include <libupower-glib/upower.h>
-#include "egg-debug.h"
#include "egg-console-kit.h"
#include "gpm-common.h"
diff --git a/src/egg-console-kit.c b/src/egg-console-kit.c
index 946ab72..312188e 100644
--- a/src/egg-console-kit.c
+++ b/src/egg-console-kit.c
@@ -27,7 +27,6 @@
#include <glib.h>
#include <gio/gio.h>
-#include "egg-debug.h"
#include "egg-console-kit.h"
static void egg_console_kit_finalize (GObject *object);
@@ -206,7 +205,7 @@ egg_console_kit_is_local (EggConsoleKit *console, gboolean *is_local, GError **e
/* maybe console kit does not know about our session */
if (console->priv->proxy_session == NULL) {
- egg_warning ("no ConsoleKit session");
+ g_warning ("no ConsoleKit session");
goto out;
}
@@ -247,7 +246,7 @@ egg_console_kit_is_active (EggConsoleKit *console, gboolean *is_active, GError *
/* maybe console kit does not know about our session */
if (console->priv->proxy_session == NULL) {
- egg_warning ("no ConsoleKit session");
+ g_warning ("no ConsoleKit session");
goto out;
}
@@ -282,7 +281,7 @@ egg_console_kit_proxy_signal_cb (GDBusProxy *proxy, const gchar *sender_name, co
gboolean active;
if (g_strcmp0 (signal_name, "ActiveChanged") == 0) {
g_variant_get (parameters, "(b)", &active);
- egg_debug ("emitting active: %i", active);
+ g_debug ("emitting active: %i", active);
g_signal_emit (console, signals [EGG_CONSOLE_KIT_ACTIVE_CHANGED], 0, active);
}
}
@@ -329,7 +328,7 @@ egg_console_kit_init (EggConsoleKit *console)
CONSOLEKIT_MANAGER_INTERFACE,
NULL, &error);
if (console->priv->proxy_manager == NULL) {
- egg_warning ("cannot connect to ConsoleKit: %s", error->message);
+ g_warning ("cannot connect to ConsoleKit: %s", error->message);
g_error_free (error);
goto out;
}
@@ -342,12 +341,12 @@ egg_console_kit_init (EggConsoleKit *console)
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
if (result == NULL) {
- egg_warning ("Failed to get session for pid %i: %s", pid, error->message);
+ g_warning ("Failed to get session for pid %i: %s", pid, error->message);
g_error_free (error);
goto out;
}
g_variant_get (result, "(o)", &console->priv->session_id);
- egg_debug ("ConsoleKit session ID: %s", console->priv->session_id);
+ g_debug ("ConsoleKit session ID: %s", console->priv->session_id);
/* connect to session */
console->priv->proxy_session =
@@ -359,7 +358,7 @@ egg_console_kit_init (EggConsoleKit *console)
CONSOLEKIT_SESSION_INTERFACE,
NULL, &error);
if (console->priv->proxy_session == NULL) {
- egg_warning ("cannot connect to %s: %s", console->priv->session_id, error->message);
+ g_warning ("cannot connect to %s: %s", console->priv->session_id, error->message);
g_error_free (error);
goto out;
}
diff --git a/src/gpm-array-float.c b/src/gpm-array-float.c
index 9796008..efc728f 100644
--- a/src/gpm-array-float.c
+++ b/src/gpm-array-float.c
@@ -29,7 +29,6 @@
#include <glib.h>
-#include "egg-debug.h"
#include "gpm-array-float.h"
/**
@@ -150,7 +149,7 @@ gpm_array_float_compute_gaussian (guint length, gfloat sigma)
half_length = (length / 2) + 1;
for (i=0; i<half_length; i++) {
division = half_length - (i + 1);
- egg_debug ("half_length=%i, div=%f, sigma=%f", half_length, division, sigma);
+ g_debug ("half_length=%i, div=%f, sigma=%f", half_length, division, sigma);
g_array_index (array, gfloat, i) = gpm_array_float_guassian_value (division, sigma);
}
@@ -163,7 +162,7 @@ gpm_array_float_compute_gaussian (guint length, gfloat sigma)
/* make sure we get an accurate gaussian */
value = gpm_array_float_sum (array);
if (fabs (value - 1.0f) > 0.01f) {
- egg_warning ("got wrong sum (%f), perhaps sigma too high for size?", value);
+ g_debug ("got wrong sum (%f), perhaps sigma too high for size?", value);
gpm_array_float_free (array);
array = NULL;
}
@@ -207,7 +206,7 @@ gpm_array_float_print (GpmArrayFloat *array)
length = array->len;
/* debug out */
for (i=0; i<length; i++)
- egg_debug ("[%i]\tval=%f", i, g_array_index (array, gfloat, i));
+ g_debug ("[%i]\tval=%f", i, g_array_index (array, gfloat, i));
return TRUE;
}
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 00bf709..fed4b2c 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -45,7 +45,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"
@@ -177,7 +176,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;
@@ -300,19 +299,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,
@@ -324,7 +323,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
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;
@@ -332,7 +331,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 */
if (!on_battery)
@@ -342,7 +341,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;
@@ -350,7 +349,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);
@@ -358,7 +357,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;
}
@@ -373,7 +372,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;
@@ -412,7 +411,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);
}
}
@@ -443,7 +442,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
GError *error = NULL;
guint percentage;
gboolean hw_changed;
- 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 */
@@ -461,7 +460,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
}
/* 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) {
@@ -480,7 +479,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
}
/* 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) {
@@ -490,7 +489,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);
}
}
@@ -506,7 +505,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;
}
@@ -515,14 +514,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);
}
@@ -533,14 +532,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;
}
@@ -572,11 +571,11 @@ gpm_backlight_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *ba
/* don't dim or undim the screen unless we are on the active console */
ret = egg_console_kit_is_active (backlight->priv->consolekit, &is_active, &error);
if (!ret) {
- egg_warning ("failed to get console active status: %s", error->message);
+ g_warning ("failed to get console active status: %s", error->message);
g_error_free (error);
}
if (!is_active) {
- egg_debug ("ignoring as not on active console");
+ g_debug ("ignoring as not on active console");
return;
}
@@ -588,7 +587,7 @@ gpm_backlight_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *ba
/* 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);
}
@@ -601,7 +600,7 @@ gpm_backlight_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *ba
/* 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);
}
@@ -622,14 +621,14 @@ gpm_backlight_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *ba
/* check if method is valid */
if (dpms_mode == GPM_DPMS_MODE_UNKNOWN || dpms_mode == GPM_DPMS_MODE_ON) {
- egg_warning ("BACKLIGHT method %s unknown. Using OFF.", gpm_dpms_mode_to_string (dpms_mode));
+ g_warning ("BACKLIGHT method %s unknown. Using OFF.", gpm_dpms_mode_to_string (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);
}
}
@@ -650,7 +649,7 @@ gpm_backlight_brightness_changed_cb (GpmBrightness *brightness, guint percentage
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);
/* and one for Dbus users */
@@ -679,7 +678,7 @@ gpm_backlight_control_resume_cb (GpmControl *control, GpmControlAction action, G
/* 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);
}
}
diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c
index 8e9ac13..36f79f8 100644
--- a/src/gpm-brightness.c
+++ b/src/gpm-brightness.c
@@ -40,8 +40,6 @@
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
-#include "egg-debug.h"
-
#include "gpm-brightness.h"
#include "gpm-common.h"
#include "gpm-marshal.h"
@@ -139,11 +137,11 @@ gpm_brightness_helper_get_value (const gchar *argument)
ret = g_spawn_command_line_sync (command,
&stdout_data, NULL, &exit_status, &error);
if (!ret) {
- egg_error ("failed to get value: %s", error->message);
+ g_error ("failed to get value: %s", error->message);
g_error_free (error);
goto out;
}
- egg_debug ("executing %s retval: %i", command, exit_status);
+ g_debug ("executing %s retval: %i", command, exit_status);
/* parse for a number */
ret = gpm_brightness_helper_strtoint (stdout_data, &value);
@@ -170,11 +168,11 @@ gpm_brightness_helper_set_value (const gchar *argument, gint value)
command = g_strdup_printf ("pkexec " SBINDIR "/gnome-power-backlight-helper --%s %i", argument, value);
ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
if (!ret) {
- egg_error ("failed to get value: %s", error->message);
+ g_error ("failed to get value: %s", error->message);
g_error_free (error);
goto out;
}
- egg_debug ("executing %s retval: %i", command, exit_status);
+ g_debug ("executing %s retval: %i", command, exit_status);
out:
g_free (command);
return ret;
@@ -216,7 +214,7 @@ gpm_brightness_output_get_internal (GpmBrightness *brightness, RROutput output,
0, 4, False, False, None,
&actual_type, &actual_format,
&nitems, &bytes_after, ((unsigned char **)&prop)) != Success) {
- egg_debug ("failed to get property");
+ g_debug ("failed to get property");
return FALSE;
}
if (actual_type == XA_INTEGER && nitems == 1 && actual_format == 32) {
@@ -244,7 +242,7 @@ gpm_brightness_output_set_internal (GpmBrightness *brightness, RROutput output,
XFlush (brightness->priv->dpy);
gdk_flush ();
if (gdk_error_trap_pop ()) {
- egg_warning ("failed to XRRChangeOutputProperty for brightness %i", value);
+ g_warning ("failed to XRRChangeOutputProperty for brightness %i", value);
ret = FALSE;
}
/* we changed the hardware */
@@ -266,22 +264,22 @@ gpm_brightness_setup_display (GpmBrightness *brightness)
/* get the display */
brightness->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
if (!brightness->priv->dpy) {
- egg_error ("Cannot open display");
+ g_error ("Cannot open display");
return FALSE;
}
/* is XRandR new enough? */
if (!XRRQueryVersion (brightness->priv->dpy, &major, &minor)) {
- egg_debug ("RandR extension missing");
+ g_debug ("RandR extension missing");
return FALSE;
}
if (major < 1 || (major == 1 && minor < 2)) {
- egg_debug ("RandR version %d.%d too old", major, minor);
+ g_debug ("RandR version %d.%d too old", major, minor);
return FALSE;
}
/* can we support BACKLIGHT */
brightness->priv->backlight = XInternAtom (brightness->priv->dpy, "BACKLIGHT", True);
if (brightness->priv->backlight == None) {
- egg_debug ("No outputs have backlight property");
+ g_debug ("No outputs have backlight property");
return FALSE;
}
return TRUE;
@@ -301,14 +299,14 @@ gpm_brightness_setup_version (GpmBrightness *brightness)
/* get the display */
brightness->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
if (!brightness->priv->dpy) {
- egg_error ("Cannot open display");
+ g_error ("Cannot open display");
return FALSE;
}
if (!XRRQueryVersion (brightness->priv->dpy, &major, &minor)) {
return FALSE;
}
if (major == 1 && minor < 3) {
- egg_debug ("RandR version %d.%d does not support XRRGetScreenResourcesCurrent", major, minor);
+ g_debug ("RandR version %d.%d does not support XRRGetScreenResourcesCurrent", major, minor);
return FALSE;
}
return TRUE;
@@ -329,11 +327,11 @@ gpm_brightness_output_get_limits (GpmBrightness *brightness, RROutput output,
info = XRRQueryOutputProperty (brightness->priv->dpy, output, brightness->priv->backlight);
if (info == NULL) {
- egg_debug ("could not get output property");
+ g_debug ("could not get output property");
return FALSE;
}
if (!info->range || info->num_values != 2) {
- egg_debug ("was not range");
+ g_debug ("was not range");
ret = FALSE;
goto out;
}
@@ -363,9 +361,9 @@ gpm_brightness_output_get_percentage (GpmBrightness *brightness, RROutput output
ret = gpm_brightness_output_get_limits (brightness, output, &min, &max);
if (!ret || min == max)
return FALSE;
- egg_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
+ g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
percentage = gpm_discrete_to_percent (cur, (max-min)+1);
- egg_debug ("percentage %i", percentage);
+ g_debug ("percentage %i", percentage);
brightness->priv->shared_value = percentage;
return TRUE;
}
@@ -389,14 +387,14 @@ gpm_brightness_output_down (GpmBrightness *brightness, RROutput output)
ret = gpm_brightness_output_get_limits (brightness, output, &min, &max);
if (!ret || min == max)
return FALSE;
- egg_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
+ g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
if (cur == min) {
- egg_debug ("already min");
+ g_debug ("already min");
return TRUE;
}
step = gpm_brightness_get_step ((max-min)+1);
if (cur < step) {
- egg_debug ("truncating to %i", min);
+ g_debug ("truncating to %i", min);
cur = min;
} else {
cur -= step;
@@ -423,14 +421,14 @@ gpm_brightness_output_up (GpmBrightness *brightness, RROutput output)
ret = gpm_brightness_output_get_limits (brightness, output, &min, &max);
if (!ret || min == max)
return FALSE;
- egg_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
+ g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
if (cur == max) {
- egg_debug ("already max");
+ g_debug ("already max");
return TRUE;
}
cur += gpm_brightness_get_step ((max-min)+1);
if (cur > max) {
- egg_debug ("truncating to %i", max);
+ g_debug ("truncating to %i", max);
cur = max;
}
ret = gpm_brightness_output_set_internal (brightness, output, cur);
@@ -460,15 +458,15 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output)
return FALSE;
shared_value_abs = gpm_discrete_from_percent (brightness->priv->shared_value, (max-min)+1);
- egg_debug ("percent=%i, absolute=%i", brightness->priv->shared_value, shared_value_abs);
+ g_debug ("percent=%i, absolute=%i", brightness->priv->shared_value, shared_value_abs);
- egg_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
+ g_debug ("hard value=%i, min=%i, max=%i", cur, min, max);
if (shared_value_abs > (gint) max)
shared_value_abs = max;
if (shared_value_abs < (gint) min)
shared_value_abs = min;
if ((gint) cur == shared_value_abs) {
- egg_debug ("already set %i", cur);
+ g_debug ("already set %i", cur);
return TRUE;
}
@@ -477,7 +475,7 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output)
/* some adaptors have a large number of steps */
step = gpm_brightness_get_step (shared_value_abs - cur);
- egg_debug ("using step of %i", step);
+ g_debug ("using step of %i", step);
/* going up */
for (i=cur; i<=shared_value_abs; i+=step) {
@@ -491,7 +489,7 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output)
/* some adaptors have a large number of steps */
step = gpm_brightness_get_step (cur - shared_value_abs);
- egg_debug ("using step of %i", step);
+ g_debug ("using step of %i", step);
/* going down */
for (i=cur; i>=shared_value_abs; i-=step) {
@@ -521,7 +519,7 @@ gpm_brightness_foreach_resource (GpmBrightness *brightness, GpmXRandROp op, XRRS
/* do for each output */
for (i=0; i<resources->noutput; i++) {
output = resources->outputs[i];
- egg_debug ("resource %i of %i", i+1, resources->noutput);
+ g_debug ("resource %i of %i", i+1, resources->noutput);
if (op==ACTION_BACKLIGHT_GET) {
ret = gpm_brightness_output_get_percentage (brightness, output);
} else if (op==ACTION_BACKLIGHT_INC) {
@@ -532,7 +530,7 @@ gpm_brightness_foreach_resource (GpmBrightness *brightness, GpmXRandROp op, XRRS
ret = gpm_brightness_output_set (brightness, output);
} else {
ret = FALSE;
- egg_warning ("op not known");
+ g_warning ("op not known");
}
if (ret) {
success_any = TRUE;
@@ -563,7 +561,7 @@ gpm_brightness_foreach_screen (GpmBrightness *brightness, GpmXRandROp op)
length = brightness->priv->resources->len;
for (i=0; i<length; i++) {
resource = (XRRScreenResources *) g_ptr_array_index (brightness->priv->resources, i);
- egg_debug ("using resource %p", resource);
+ g_debug ("using resource %p", resource);
ret = gpm_brightness_foreach_resource (brightness, op, resource);
if (ret)
success_any = TRUE;
@@ -583,7 +581,7 @@ gpm_brightness_trust_cache (GpmBrightness *brightness)
g_return_val_if_fail (GPM_IS_BRIGHTNESS (brightness), FALSE);
/* only return the cached value if the cache is trusted and we have change events */
if (brightness->priv->cache_trusted && brightness->priv->has_changed_events) {
- egg_debug ("using cache for value %u (okay)", brightness->priv->cache_percentage);
+ g_debug ("using cache for value %u (okay)", brightness->priv->cache_percentage);
return TRUE;
}
@@ -591,7 +589,7 @@ gpm_brightness_trust_cache (GpmBrightness *brightness)
* if we have multiple things setting policy on the workstation, e.g. fast user switching
* or kpowersave, then this will be invalid -- this logic may be insane */
if (GPM_SOLE_SETTER_USE_CACHE && brightness->priv->cache_trusted) {
- egg_warning ("using cache for value %u (probably okay)", brightness->priv->cache_percentage);
+ g_warning ("using cache for value %u (probably okay)", brightness->priv->cache_percentage);
return TRUE;
}
return FALSE;
@@ -615,7 +613,7 @@ gpm_brightness_set (GpmBrightness *brightness, guint percentage, gboolean *hw_ch
/* can we check the new value with the cache? */
trust_cache = gpm_brightness_trust_cache (brightness);
if (trust_cache && percentage == brightness->priv->cache_percentage) {
- egg_debug ("not setting the same value %i", percentage);
+ g_debug ("not setting the same value %i", percentage);
return TRUE;
}
@@ -685,7 +683,7 @@ gpm_brightness_get (GpmBrightness *brightness, guint *percentage)
/* valid? */
if (percentage_local > 100) {
- egg_warning ("percentage value of %i will be truncated", percentage_local);
+ g_warning ("percentage value of %i will be truncated", percentage_local);
percentage_local = 100;
}
@@ -810,7 +808,6 @@ out:
return ret;
}
-
/**
* gpm_brightness_may_have_changed:
**/
@@ -821,10 +818,10 @@ gpm_brightness_may_have_changed (GpmBrightness *brightness)
guint percentage;
ret = gpm_brightness_get (brightness, &percentage);
if (!ret) {
- egg_warning ("failed to get output");
+ g_warning ("failed to get output");
return;
}
- egg_debug ("emitting brightness-changed (%i)", percentage);
+ g_debug ("emitting brightness-changed (%i)", percentage);
g_signal_emit (brightness, signals [BRIGHTNESS_CHANGED], 0, percentage);
}
@@ -841,7 +838,6 @@ gpm_brightness_filter_xevents (GdkXEvent *xevent, GdkEvent *event, gpointer data
return GDK_FILTER_CONTINUE;
}
-
static void gpm_brightness_update_cache (GpmBrightness *brightness);
/**
@@ -878,12 +874,12 @@ gpm_brightness_update_cache (GpmBrightness *brightness)
display = gdk_display_get_default ();
length = ScreenCount (brightness->priv->dpy);
for (screen = 0; screen < (gint) length; screen++) {
- egg_debug ("screen %i of %i", screen+1, length);
+ g_debug ("screen %i of %i", screen+1, length);
gscreen = gdk_display_get_screen (display, screen);
/* if we have not setup the changed on the monitor, set it here */
if (g_object_get_data (G_OBJECT (gscreen), "gpk-set-monitors-changed") == NULL) {
- egg_debug ("watching ::monitors_changed on %p", gscreen);
+ g_debug ("watching ::monitors_changed on %p", gscreen);
g_object_set_data (G_OBJECT (gscreen), "gpk-set-monitors-changed", (gpointer) "true");
g_signal_connect (G_OBJECT (gscreen), "monitors_changed",
G_CALLBACK (gpm_brightness_monitors_changed), brightness);
@@ -903,7 +899,7 @@ gpm_brightness_update_cache (GpmBrightness *brightness)
resource = XRRGetScreenResources (brightness->priv->dpy, root);
if (resource != NULL) {
- egg_debug ("adding resource %p", resource);
+ g_debug ("adding resource %p", resource);
g_ptr_array_add (brightness->priv->resources, resource);
}
}
@@ -991,7 +987,7 @@ gpm_brightness_init (GpmBrightness *brightness)
brightness->priv->has_randr13 = gpm_brightness_setup_version (brightness);
#endif
if (brightness->priv->has_extension == FALSE)
- egg_debug ("no XRANDR extension");
+ g_debug ("no XRANDR extension");
screen = gdk_screen_get_default ();
brightness->priv->root_window = gdk_screen_get_root_window (screen);
@@ -999,7 +995,7 @@ gpm_brightness_init (GpmBrightness *brightness)
/* as we a filtering by a window, we have to add an event type */
if (!XRRQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default()), &event_base, &ignore)) {
- egg_warning ("can't get event_base for XRR");
+ g_warning ("can't get event_base for XRR");
}
gdk_x11_register_standard_event_type (display, event_base, RRNotify + 1);
gdk_window_add_filter (brightness->priv->root_window,
@@ -1013,7 +1009,7 @@ gpm_brightness_init (GpmBrightness *brightness)
RROutputPropertyNotifyMask); /* <--- the only one we need, but see rh:345551 */
gdk_flush ();
if (gdk_error_trap_pop ())
- egg_warning ("failed to select XRRSelectInput");
+ g_warning ("failed to select XRRSelectInput");
/* create cache of XRRScreenResources as XRRGetScreenResources() is slow */
gpm_brightness_update_cache (brightness);
diff --git a/src/gpm-button.c b/src/gpm-button.c
index f656eb3..d133292 100644
--- a/src/gpm-button.c
+++ b/src/gpm-button.c
@@ -34,8 +34,6 @@
#include "gpm-common.h"
#include "gpm-button.h"
-#include "egg-debug.h"
-
static void gpm_button_finalize (GObject *object);
#define GPM_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_BUTTON, GpmButtonPrivate))
@@ -74,11 +72,11 @@ gpm_button_emit_type (GpmButton *button, const gchar *type)
/* did we just have this button before the timeout? */
if (g_strcmp0 (type, button->priv->last_button) == 0 &&
g_timer_elapsed (button->priv->timer, NULL) < GPM_BUTTON_DUPLICATE_TIMEOUT) {
- egg_debug ("ignoring duplicate button %s", type);
+ g_debug ("ignoring duplicate button %s", type);
return FALSE;
}
- egg_debug ("emitting button-pressed : %s", type);
+ g_debug ("emitting button-pressed : %s", type);
g_signal_emit (button, signals [BUTTON_PRESSED], 0, type);
/* save type and last size */
@@ -113,12 +111,12 @@ gpm_button_filter_x_events (GdkXEvent *xevent, GdkEvent *event, gpointer data)
/* found anything? */
if (key == NULL) {
- egg_debug ("Key %i not found in hash", keycode);
+ g_debug ("Key %i not found in hash", keycode);
/* pass normal keypresses on, which might help with accessibility access */
return GDK_FILTER_CONTINUE;
}
- egg_debug ("Key %i mapped to key %s", keycode, key);
+ g_debug ("Key %i mapped to key %s", keycode, key);
gpm_button_emit_type (button, key);
return GDK_FILTER_REMOVE;
@@ -154,7 +152,7 @@ gpm_button_grab_keystring (GpmButton *button, guint64 keycode)
GDK_WINDOW_XID (button->priv->window), True,
GrabModeAsync, GrabModeAsync);
if (ret == BadAccess) {
- egg_warning ("Failed to grab modmask=%u, keycode=%li",
+ g_warning ("Failed to grab modmask=%u, keycode=%li",
modmask, (long int) keycode);
return FALSE;
}
@@ -164,7 +162,7 @@ gpm_button_grab_keystring (GpmButton *button, guint64 keycode)
GDK_WINDOW_XID (button->priv->window), True,
GrabModeAsync, GrabModeAsync);
if (ret == BadAccess) {
- egg_warning ("Failed to grab modmask=%u, keycode=%li",
+ g_warning ("Failed to grab modmask=%u, keycode=%li",
LockMask | modmask, (long int) keycode);
return FALSE;
}
@@ -173,7 +171,7 @@ gpm_button_grab_keystring (GpmButton *button, guint64 keycode)
gdk_flush ();
gdk_error_trap_pop_ignored ();
- egg_debug ("Grabbed modmask=%x, keycode=%li", modmask, (long int) keycode);
+ g_debug ("Grabbed modmask=%x, keycode=%li", modmask, (long int) keycode);
return TRUE;
}
@@ -200,7 +198,7 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name)
/* convert from keysym to keycode */
keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default()), keysym);
if (keycode == 0) {
- egg_warning ("could not map keysym %x to keycode", keysym);
+ g_warning ("could not map keysym %x to keycode", keysym);
return FALSE;
}
@@ -208,7 +206,7 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name)
keycode_str = g_strdup_printf ("0x%x", keycode);
key = g_hash_table_lookup (button->priv->keysym_to_name_hash, (gpointer) keycode_str);
if (key != NULL) {
- egg_warning ("found in hash %i", keycode);
+ g_warning ("found in hash %i", keycode);
g_free (keycode_str);
return FALSE;
}
@@ -216,7 +214,7 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name)
/* try to register X event */
ret = gpm_button_grab_keystring (button, keycode);
if (!ret) {
- egg_warning ("Failed to grab %i", keycode);
+ g_warning ("Failed to grab %i", keycode);
g_free (keycode_str);
return FALSE;
}
diff --git a/src/gpm-common.c b/src/gpm-common.c
index 26196d3..69a77c0 100644
--- a/src/gpm-common.c
+++ b/src/gpm-common.c
@@ -30,7 +30,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include "egg-debug.h"
#include "gpm-common.h"
/**
@@ -127,7 +126,7 @@ gpm_precision_round_up (gfloat value, gint smallest)
if (fabs (value) < 0.01)
return 0;
if (smallest == 0) {
- egg_warning ("divisor zero");
+ g_warning ("divisor zero");
return 0;
}
division = (gfloat) value / (gfloat) smallest;
@@ -154,7 +153,7 @@ gpm_precision_round_down (gfloat value, gint smallest)
if (fabs (value) < 0.01)
return 0;
if (smallest == 0) {
- egg_warning ("divisor zero");
+ g_warning ("divisor zero");
return 0;
}
division = (gfloat) value / (gfloat) smallest;
@@ -180,7 +179,7 @@ gpm_discrete_from_percent (guint percentage, guint levels)
if (percentage > 100)
return levels;
if (levels == 0) {
- egg_warning ("levels is 0!");
+ g_warning ("levels is 0!");
return 0;
}
return ((gfloat) percentage * (gfloat) (levels - 1)) / 100.0f;
@@ -202,7 +201,7 @@ gpm_discrete_to_percent (guint discrete, guint levels)
if (discrete > levels)
return 100;
if (levels == 0) {
- egg_warning ("levels is 0!");
+ g_warning ("levels is 0!");
return 0;
}
return (guint) ((gfloat) discrete * (100.0f / (gfloat) (levels - 1)));
@@ -224,7 +223,7 @@ gpm_discrete_to_fraction (guint discrete, guint levels)
if (discrete > levels)
return 1.0;
if (levels == 0) {
- egg_warning ("levels is 0!");
+ g_warning ("levels is 0!");
return 0.0;
}
return (guint) ((gfloat) discrete / ((gfloat) (levels - 1)));
diff --git a/src/gpm-control.c b/src/gpm-control.c
index 1371699..0fc864d 100644
--- a/src/gpm-control.c
+++ b/src/gpm-control.c
@@ -41,7 +41,6 @@
#include <gconf/gconf-client.h>
#include <libupower-glib/upower.h>
-#include "egg-debug.h"
#include "egg-console-kit.h"
#include "gpm-screensaver.h"
@@ -120,10 +119,10 @@ gpm_control_get_lock_policy (GpmControl *control, const gchar *policy)
use_ss_setting = g_settings_get_boolean (control->priv->settings, GPM_SETTINGS_LOCK_USE_SCREENSAVER);
if (use_ss_setting) {
do_lock = gconf_client_get_bool (control->priv->conf, GS_CONF_PREF_LOCK_ENABLED, NULL);
- egg_debug ("Using ScreenSaver settings (%i)", do_lock);
+ g_debug ("Using ScreenSaver settings (%i)", do_lock);
} else {
do_lock = g_settings_get_boolean (control->priv->settings, policy);
- egg_debug ("Using custom locking settings (%i)", do_lock);
+ g_debug ("Using custom locking settings (%i)", do_lock);
}
return do_lock;
}
@@ -148,7 +147,7 @@ gpm_control_suspend (GpmControl *control, GError **error)
"can-suspend", &allowed,
NULL);
if (!allowed) {
- egg_debug ("cannot suspend as not allowed from policy");
+ g_debug ("cannot suspend as not allowed from policy");
g_set_error_literal (error, GPM_CONTROL_ERROR, GPM_CONTROL_ERROR_GENERAL, "Cannot suspend");
goto out;
}
@@ -158,7 +157,7 @@ gpm_control_suspend (GpmControl *control, GError **error)
if (lock_gnome_keyring) {
keyres = gnome_keyring_lock_all_sync ();
if (keyres != GNOME_KEYRING_RESULT_OK)
- egg_warning ("could not lock keyring");
+ g_warning ("could not lock keyring");
}
do_lock = gpm_control_get_lock_policy (control, GPM_SETTINGS_LOCK_ON_SUSPEND);
@@ -168,12 +167,12 @@ gpm_control_suspend (GpmControl *control, GError **error)
}
/* Do the suspend */
- egg_debug ("emitting sleep");
+ g_debug ("emitting sleep");
g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_SUSPEND);
ret = up_client_suspend_sync (control->priv->client, NULL, error);
- egg_debug ("emitting resume");
+ g_debug ("emitting resume");
g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_SUSPEND);
if (do_lock) {
@@ -207,7 +206,7 @@ gpm_control_hibernate (GpmControl *control, GError **error)
"can-hibernate", &allowed,
NULL);
if (!allowed) {
- egg_debug ("cannot hibernate as not allowed from policy");
+ g_debug ("cannot hibernate as not allowed from policy");
g_set_error_literal (error, GPM_CONTROL_ERROR, GPM_CONTROL_ERROR_GENERAL, "Cannot hibernate");
goto out;
}
@@ -217,7 +216,7 @@ gpm_control_hibernate (GpmControl *control, GError **error)
if (lock_gnome_keyring) {
keyres = gnome_keyring_lock_all_sync ();
if (keyres != GNOME_KEYRING_RESULT_OK) {
- egg_warning ("could not lock keyring");
+ g_warning ("could not lock keyring");
}
}
@@ -227,12 +226,12 @@ gpm_control_hibernate (GpmControl *control, GError **error)
gpm_screensaver_lock (screensaver);
}
- egg_debug ("emitting sleep");
+ g_debug ("emitting sleep");
g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_HIBERNATE);
ret = up_client_hibernate_sync (control->priv->client, NULL, error);
- egg_debug ("emitting resume");
+ g_debug ("emitting resume");
g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_HIBERNATE);
if (do_lock) {
diff --git a/src/gpm-debug.c b/src/gpm-debug.c
new file mode 100644
index 0000000..0f58487
--- /dev/null
+++ b/src/gpm-debug.c
@@ -0,0 +1,193 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2010 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <glib/gi18n.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <gpm-debug.h>
+
+#include "config.h"
+
+static gboolean _verbose = FALSE;
+static gboolean _console = FALSE;
+
+/**
+ * gpm_debug_is_verbose:
+ *
+ * Returns: TRUE if we have debugging enabled
+ **/
+gboolean
+gpm_debug_is_verbose (void)
+{
+ /* local first */
+ if (_verbose)
+ return TRUE;
+
+ /* fall back to env variable */
+ if (g_getenv ("VERBOSE") != NULL)
+ return TRUE;
+ return FALSE;
+}
+
+/**
+ * gpm_debug_ignore_cb:
+ **/
+static void
+gpm_debug_ignore_cb (const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer user_data)
+{
+}
+
+#define CONSOLE_RESET 0
+#define CONSOLE_BLACK 30
+#define CONSOLE_RED 31
+#define CONSOLE_GREEN 32
+#define CONSOLE_YELLOW 33
+#define CONSOLE_BLUE 34
+#define CONSOLE_MAGENTA 35
+#define CONSOLE_CYAN 36
+#define CONSOLE_WHITE 37
+
+#define GPM_DEBUG_LOG_DOMAIN_LENGTH 20
+
+/**
+ * gpm_debug_handler_cb:
+ **/
+static void
+gpm_debug_handler_cb (const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer user_data)
+{
+ gchar str_time[255];
+ time_t the_time;
+ guint len;
+ guint i;
+
+ /* time header */
+ time (&the_time);
+ strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
+
+ /* no color please, we're British */
+ if (!_console) {
+ if (log_level == G_LOG_LEVEL_DEBUG) {
+ g_print ("%s\t%s\t%s\n", str_time, log_domain, message);
+ } else {
+ g_print ("***\n%s\t%s\t%s\n***\n", str_time, log_domain, message);
+ }
+ return;
+ }
+
+ /* time in green */
+ g_print ("%c[%dm%s\t", 0x1B, CONSOLE_GREEN, str_time);
+
+ /* log domain in either blue */
+ if (g_strcmp0 (log_domain, G_LOG_DOMAIN) == 0)
+ g_print ("%c[%dm%s%c[%dm", 0x1B, CONSOLE_BLUE, log_domain, 0x1B, CONSOLE_RESET);
+ else
+ g_print ("%c[%dm%s%c[%dm", 0x1B, CONSOLE_CYAN, log_domain, 0x1B, CONSOLE_RESET);
+
+ /* pad with spaces */
+ len = strlen (log_domain);
+ for (i=len; i<GPM_DEBUG_LOG_DOMAIN_LENGTH; i++)
+ g_print (" ");
+
+ /* critical is also in red */
+ if (log_level == G_LOG_LEVEL_CRITICAL ||
+ log_level == G_LOG_LEVEL_ERROR) {
+ g_print ("%c[%dm%s\n%c[%dm", 0x1B, CONSOLE_RED, message, 0x1B, CONSOLE_RESET);
+ } else {
+ /* debug in blue */
+ g_print ("%c[%dm%s\n%c[%dm", 0x1B, CONSOLE_BLUE, message, 0x1B, CONSOLE_RESET);
+ }
+}
+
+/**
+ * gpm_debug_pre_parse_hook:
+ */
+static gboolean
+gpm_debug_pre_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
+{
+ const GOptionEntry main_entries[] = {
+ { "verbose", 'v', 0, G_OPTION_ARG_NONE, &_verbose,
+ /* TRANSLATORS: turn on all debugging */
+ N_("Show debugging information for all files"), NULL },
+ { NULL}
+ };
+
+ /* add main entry */
+ g_option_context_add_main_entries (context, main_entries, NULL);
+ return TRUE;
+}
+
+/**
+ * gpm_debug_add_log_domain:
+ */
+void
+gpm_debug_add_log_domain (const gchar *log_domain)
+{
+ if (_verbose) {
+ g_log_set_fatal_mask (log_domain, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
+ g_log_set_handler (log_domain,
+ G_LOG_LEVEL_ERROR |
+ G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_DEBUG |
+ G_LOG_LEVEL_WARNING,
+ gpm_debug_handler_cb, NULL);
+ } else {
+ /* hide all debugging */
+ g_log_set_handler (log_domain,
+ G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_WARNING,
+ gpm_debug_ignore_cb, NULL);
+ }
+}
+
+/**
+ * gpm_debug_post_parse_hook:
+ */
+static gboolean
+gpm_debug_post_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
+{
+ /* verbose? */
+ gpm_debug_add_log_domain (G_LOG_DOMAIN);
+ _console = (isatty (fileno (stdout)) == 1);
+ g_debug ("Verbose debugging %s (on console %i)", _verbose ? "enabled" : "disabled", _console);
+ return TRUE;
+}
+
+/**
+ * gpm_debug_get_option_group:
+ *
+ * Returns a #GOptionGroup for the commandline arguments recognized
+ * by debugging. You should add this group to your #GOptionContext
+ * with g_option_context_add_group(), if you are using
+ * g_option_context_parse() to parse your commandline arguments.
+ *
+ * Returns: a #GOptionGroup for the commandline arguments
+ */
+GOptionGroup *
+gpm_debug_get_option_group (void)
+{
+ GOptionGroup *group;
+ group = g_option_group_new ("debug", _("Debugging Options"), _("Show debugging options"), NULL, NULL);
+ g_option_group_set_parse_hooks (group, gpm_debug_pre_parse_hook, gpm_debug_post_parse_hook);
+ return group;
+}
+
diff --git a/src/gpm-debug.h b/src/gpm-debug.h
new file mode 100644
index 0000000..f4a812f
--- /dev/null
+++ b/src/gpm-debug.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2010 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __GPM_DEBUG_H__
+#define __GPM_DEBUG_H__
+
+#include <glib.h>
+
+gboolean gpm_debug_is_verbose (void);
+GOptionGroup *gpm_debug_get_option_group (void);
+void gpm_debug_add_log_domain (const gchar *log_domain);
+
+#endif /* __GPM_DEBUG_H__ */
diff --git a/src/gpm-disks.c b/src/gpm-disks.c
index 6bcada1..9c917c3 100644
--- a/src/gpm-disks.c
+++ b/src/gpm-disks.c
@@ -24,7 +24,6 @@
#include <glib.h>
#include <gio/gio.h>
-#include "egg-debug.h"
#include "gpm-disks.h"
static void gpm_disks_finalize (GObject *object);
@@ -53,7 +52,7 @@ gpm_disks_unregister (GpmDisks *disks)
/* no UDisks */
if (disks->priv->proxy == NULL) {
- egg_warning ("no UDisks");
+ g_warning ("no UDisks");
goto out;
}
@@ -66,7 +65,7 @@ gpm_disks_unregister (GpmDisks *disks)
-1, NULL, &error);
if (retval == NULL) {
/* abort as the DBUS method failed */
- egg_warning ("failed to clear spindown timeout: %s", error->message);
+ g_warning ("failed to clear spindown timeout: %s", error->message);
g_error_free (error);
goto out;
}
@@ -92,7 +91,7 @@ gpm_disks_register (GpmDisks *disks, gint timeout)
/* no UDisks */
if (disks->priv->proxy == NULL) {
- egg_warning ("no UDisks");
+ g_warning ("no UDisks");
goto out;
}
@@ -106,7 +105,7 @@ gpm_disks_register (GpmDisks *disks, gint timeout)
-1, NULL, &error);
if (retval == NULL) {
/* abort as the DBUS method failed */
- egg_warning ("failed to set spindown timeout: %s", error->message);
+ g_warning ("failed to set spindown timeout: %s", error->message);
g_error_free (error);
goto out;
}
@@ -130,20 +129,20 @@ gpm_disks_set_spindown_timeout (GpmDisks *disks, gint timeout)
/* get rid of last request */
if (disks->priv->cookie != NULL) {
- egg_debug ("unregistering %s", disks->priv->cookie);
+ g_debug ("unregistering %s", disks->priv->cookie);
gpm_disks_unregister (disks);
}
/* is not enabled? */
if (timeout == 0) {
- egg_debug ("disk spindown disabled");
+ g_debug ("disk spindown disabled");
goto out;
}
/* register */
ret = gpm_disks_register (disks, timeout);
if (ret)
- egg_debug ("registered %s (%i)", disks->priv->cookie, timeout);
+ g_debug ("registered %s (%i)", disks->priv->cookie, timeout);
out:
return ret;
}
@@ -171,7 +170,7 @@ gpm_disks_init (GpmDisks *disks)
"org.freedesktop.UDisks",
NULL, &error);
if (disks->priv->proxy == NULL) {
- egg_warning ("failed to setup disks proxy: %s", error->message);
+ g_warning ("failed to setup disks proxy: %s", error->message);
g_error_free (error);
}
}
diff --git a/src/gpm-dpms.c b/src/gpm-dpms.c
index a3668d5..1248a98 100644
--- a/src/gpm-dpms.c
+++ b/src/gpm-dpms.c
@@ -40,7 +40,6 @@
#include <X11/Xproto.h>
#include <X11/extensions/dpms.h>
-#include "egg-debug.h"
#include "gpm-dpms.h"
static void gpm_dpms_finalize (GObject *object);
@@ -138,21 +137,21 @@ gpm_dpms_x11_set_mode (GpmDpms *dpms, GpmDpmsMode mode, GError **error)
BOOL current_enabled;
if (!dpms->priv->dpms_capable) {
- egg_debug ("not DPMS capable");
+ g_debug ("not DPMS capable");
g_set_error (error, GPM_DPMS_ERROR, GPM_DPMS_ERROR_GENERAL,
"Display is not DPMS capable");
return FALSE;
}
if (!DPMSInfo (dpms->priv->display, ¤t_state, ¤t_enabled)) {
- egg_debug ("couldn't get DPMS info");
+ g_debug ("couldn't get DPMS info");
g_set_error (error, GPM_DPMS_ERROR, GPM_DPMS_ERROR_GENERAL,
"Unable to get DPMS state");
return FALSE;
}
if (!current_enabled) {
- egg_debug ("DPMS not enabled");
+ g_debug ("DPMS not enabled");
g_set_error (error, GPM_DPMS_ERROR, GPM_DPMS_ERROR_GENERAL,
"DPMS is not enabled");
return FALSE;
@@ -247,7 +246,7 @@ gpm_dpms_set_mode (GpmDpms *dpms, GpmDpmsMode mode, GError **error)
g_return_val_if_fail (GPM_IS_DPMS (dpms), FALSE);
if (mode == GPM_DPMS_MODE_UNKNOWN) {
- egg_debug ("mode unknown");
+ g_debug ("mode unknown");
g_set_error (error, GPM_DPMS_ERROR, GPM_DPMS_ERROR_GENERAL,
"Unknown DPMS mode");
return FALSE;
@@ -305,11 +304,11 @@ gpm_dpms_clear_timeouts (GpmDpms *dpms)
/* never going to work */
if (!dpms->priv->dpms_capable) {
- egg_debug ("not DPMS capable");
+ g_debug ("not DPMS capable");
goto out;
}
- egg_debug ("set timeouts to zero");
+ g_debug ("set timeouts to zero");
ret = DPMSSetTimeouts (dpms->priv->display, 0, 0, 0);
out:
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index dd439b8..75c05ab 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -26,14 +26,13 @@
#include <glib/gi18n.h>
#include <libupower-glib/upower.h>
-#include "egg-debug.h"
-
#include "gpm-common.h"
#include "gpm-upower.h"
#include "gpm-marshal.h"
#include "gpm-engine.h"
#include "gpm-stock-icons.h"
#include "gpm-phone.h"
+#include "gpm-debug.h"
static void gpm_engine_finalize (GObject *object);
@@ -148,7 +147,7 @@ gpm_engine_get_warning_time (GpmEngine *engine, UpDevice *device)
/* this is probably an error condition */
if (time_to_empty == 0) {
- egg_debug ("time zero, falling back to percentage for %s", up_device_kind_to_string (kind));
+ g_debug ("time zero, falling back to percentage for %s", up_device_kind_to_string (kind));
return gpm_engine_get_warning_percentage (engine, device);
}
@@ -270,7 +269,7 @@ gpm_engine_get_summary (GpmEngine *engine)
/* remove the last \n */
g_string_truncate (tooltip, tooltip->len-1);
- egg_debug ("tooltip: %s", tooltip->str);
+ g_debug ("tooltip: %s", tooltip->str);
return g_string_free (tooltip, FALSE);
}
@@ -339,7 +338,7 @@ gpm_engine_get_icon (GpmEngine *engine)
/* policy */
if (engine->priv->icon_policy == GPM_ICON_POLICY_NEVER) {
- egg_debug ("no icon allowed, so no icon will be displayed.");
+ g_debug ("no icon allowed, so no icon will be displayed.");
return NULL;
}
@@ -359,7 +358,7 @@ gpm_engine_get_icon (GpmEngine *engine)
/* policy */
if (engine->priv->icon_policy == GPM_ICON_POLICY_CRITICAL) {
- egg_debug ("no devices critical, so no icon will be displayed.");
+ g_debug ("no devices critical, so no icon will be displayed.");
return NULL;
}
@@ -379,7 +378,7 @@ gpm_engine_get_icon (GpmEngine *engine)
/* policy */
if (engine->priv->icon_policy == GPM_ICON_POLICY_LOW) {
- egg_debug ("no devices low, so no icon will be displayed.");
+ g_debug ("no devices low, so no icon will be displayed.");
return NULL;
}
@@ -393,7 +392,7 @@ gpm_engine_get_icon (GpmEngine *engine)
/* policy */
if (engine->priv->icon_policy == GPM_ICON_POLICY_CHARGE) {
- egg_debug ("no devices (dis)charging, so no icon will be displayed.");
+ g_debug ("no devices (dis)charging, so no icon will be displayed.");
return NULL;
}
@@ -407,7 +406,7 @@ gpm_engine_get_icon (GpmEngine *engine)
/* policy */
if (engine->priv->icon_policy == GPM_ICON_POLICY_PRESENT) {
- egg_debug ("no devices present, so no icon will be displayed.");
+ g_debug ("no devices present, so no icon will be displayed.");
return NULL;
}
@@ -433,7 +432,7 @@ gpm_engine_recalculate_state_icon (GpmEngine *engine)
if (engine->priv->previous_icon == NULL)
return FALSE;
/* icon before, now none */
- egg_debug ("** EMIT: icon-changed: none");
+ g_debug ("** EMIT: icon-changed: none");
g_signal_emit (engine, signals [ICON_CHANGED], 0, NULL);
g_object_unref (engine->priv->previous_icon);
@@ -456,7 +455,7 @@ gpm_engine_recalculate_state_icon (GpmEngine *engine)
return TRUE;
}
- egg_debug ("no change");
+ g_debug ("no change");
/* nothing to do */
g_object_unref (icon);
return FALSE;
@@ -473,7 +472,7 @@ gpm_engine_recalculate_state_summary (GpmEngine *engine)
summary = gpm_engine_get_summary (engine);
if (engine->priv->previous_summary == NULL) {
engine->priv->previous_summary = summary;
- egg_debug ("** EMIT: summary-changed(1): %s", summary);
+ g_debug ("** EMIT: summary-changed(1): %s", summary);
g_signal_emit (engine, signals [SUMMARY_CHANGED], 0, summary);
return TRUE;
}
@@ -481,11 +480,11 @@ gpm_engine_recalculate_state_summary (GpmEngine *engine)
if (strcmp (engine->priv->previous_summary, summary) != 0) {
g_free (engine->priv->previous_summary);
engine->priv->previous_summary = summary;
- egg_debug ("** EMIT: summary-changed(2): %s", summary);
+ g_debug ("** EMIT: summary-changed(2): %s", summary);
g_signal_emit (engine, signals [SUMMARY_CHANGED], 0, summary);
return TRUE;
}
- egg_debug ("no change");
+ g_debug ("no change");
/* nothing to do */
g_free (summary);
return FALSE;
@@ -557,7 +556,7 @@ gpm_engine_device_check_capacity (GpmEngine *engine, UpDevice *device)
/* only emit this if specified in the settings */
ret = g_settings_get_boolean (engine->priv->settings, GPM_SETTINGS_NOTIFY_LOW_CAPACITY);
if (ret) {
- egg_debug ("** EMIT: low-capacity");
+ g_debug ("** EMIT: low-capacity");
g_signal_emit (engine, signals [LOW_CAPACITY], 0, device);
}
return TRUE;
@@ -594,7 +593,7 @@ gpm_engine_get_composite_device (GpmEngine *engine, UpDevice *original_device)
/* just use the original device if only one primary battery */
if (battery_devices <= 1) {
- egg_debug ("using original device as only one primary battery");
+ g_debug ("using original device as only one primary battery");
device = original_device;
goto out;
}
@@ -635,7 +634,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
gchar *text;
/* are we printing to console? */
- debug = egg_debug_enabled ();
+ debug = gpm_debug_is_verbose ();
/* get the type of the original device */
g_object_get (original_device,
@@ -658,7 +657,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
if (debug) {
text = up_device_to_text (device);
- egg_debug ("printing device %i:\n%s", i, text);
+ g_debug ("printing device %i:\n%s", i, text);
g_free (text);
}
@@ -679,7 +678,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
/* just use the original device if only one primary battery */
if (battery_devices == 1) {
- egg_debug ("using original device as only one primary battery");
+ g_debug ("using original device as only one primary battery");
device = original_device;
goto out;
}
@@ -708,7 +707,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
/* okay, we can use the composite device */
device = engine->priv->battery_composite;
- egg_debug ("printing composite device");
+ g_debug ("printing composite device");
g_object_set (device,
"energy", energy,
"energy-full", energy_full,
@@ -720,7 +719,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
NULL);
if (debug) {
text = up_device_to_text (device);
- egg_debug ("composite:\n%s", text);
+ g_debug ("composite:\n%s", text);
g_free (text);
}
@@ -756,11 +755,11 @@ gpm_engine_device_add (GpmEngine *engine, UpDevice *device)
NULL);
/* add old state for transitions */
- egg_debug ("adding %s with state %s", up_device_get_object_path (device), up_device_state_to_string (state));
+ g_debug ("adding %s with state %s", up_device_get_object_path (device), up_device_state_to_string (state));
g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state));
if (kind == UP_DEVICE_KIND_BATTERY) {
- egg_debug ("updating because we added a device");
+ g_debug ("updating because we added a device");
composite = gpm_engine_update_composite_device (engine, device);
/* get the same values for the composite device */
@@ -799,7 +798,7 @@ gpm_engine_check_recall (GpmEngine *engine, UpDevice *device)
goto out;
/* emit signal for manager */
- egg_debug ("** EMIT: perhaps-recall");
+ g_debug ("** EMIT: perhaps-recall");
g_signal_emit (engine, signals [PERHAPS_RECALL], 0, device, recall_vendor, recall_url);
out:
g_free (recall_vendor);
@@ -825,7 +824,7 @@ gpm_engine_coldplug_idle_cb (GpmEngine *engine)
/* get devices from UPower */
ret = up_client_enumerate_devices_sync (engine->priv->client, NULL, &error);
if (!ret) {
- egg_error ("failed to get device list: %s", error->message);
+ g_error ("failed to get device list: %s", error->message);
g_error_free (error);
goto out;
}
@@ -875,7 +874,6 @@ gpm_engine_device_removed_cb (UpClient *client, UpDevice *device, GpmEngine *eng
gpm_engine_recalculate_state (engine);
}
-
/**
* gpm_engine_device_changed_cb:
**/
@@ -895,7 +893,7 @@ gpm_engine_device_changed_cb (UpClient *client, UpDevice *device, GpmEngine *eng
/* if battery then use composite device to cope with multiple batteries */
if (kind == UP_DEVICE_KIND_BATTERY) {
- egg_debug ("updating because %s changed", up_device_get_object_path (device));
+ g_debug ("updating because %s changed", up_device_get_object_path (device));
device = gpm_engine_update_composite_device (engine, device);
}
@@ -904,16 +902,16 @@ gpm_engine_device_changed_cb (UpClient *client, UpDevice *device, GpmEngine *eng
"state", &state,
NULL);
- egg_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state));
+ g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state));
/* see if any interesting state changes have happened */
state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old"));
if (state_old != state) {
if (state == UP_DEVICE_STATE_DISCHARGING) {
- egg_debug ("** EMIT: discharging");
+ g_debug ("** EMIT: discharging");
g_signal_emit (engine, signals [DISCHARGING], 0, device);
} else if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
- egg_debug ("** EMIT: fully charged");
+ g_debug ("** EMIT: fully charged");
g_signal_emit (engine, signals [FULLY_CHARGED], 0, device);
}
@@ -926,13 +924,13 @@ gpm_engine_device_changed_cb (UpClient *client, UpDevice *device, GpmEngine *eng
warning = gpm_engine_get_warning (engine, device);
if (warning != warning_old) {
if (warning == GPM_ENGINE_WARNING_LOW) {
- egg_debug ("** EMIT: charge-low");
+ g_debug ("** EMIT: charge-low");
g_signal_emit (engine, signals [CHARGE_LOW], 0, device);
} else if (warning == GPM_ENGINE_WARNING_CRITICAL) {
- egg_debug ("** EMIT: charge-critical");
+ g_debug ("** EMIT: charge-critical");
g_signal_emit (engine, signals [CHARGE_CRITICAL], 0, device);
} else if (warning == GPM_ENGINE_WARNING_ACTION) {
- egg_debug ("** EMIT: charge-action");
+ g_debug ("** EMIT: charge-action");
g_signal_emit (engine, signals [CHARGE_ACTION], 0, device);
}
/* save new state */
@@ -1006,7 +1004,7 @@ phone_device_added_cb (GpmPhone *phone, guint idx, GpmEngine *engine)
UpDevice *device;
device = up_device_new ();
- egg_debug ("phone added %i", idx);
+ g_debug ("phone added %i", idx);
/* get device properties */
g_object_set (device,
@@ -1032,7 +1030,7 @@ phone_device_removed_cb (GpmPhone *phone, guint idx, GpmEngine *engine)
UpDevice *device;
UpDeviceKind kind;
- egg_debug ("phone removed %i", idx);
+ g_debug ("phone removed %i", idx);
for (i=0; i<engine->priv->array->len; i++) {
device = g_ptr_array_index (engine->priv->array, i);
@@ -1065,7 +1063,7 @@ phone_device_refresh_cb (GpmPhone *phone, guint idx, GpmEngine *engine)
gboolean is_present;
gdouble percentage;
- egg_debug ("phone refresh %i", idx);
+ g_debug ("phone refresh %i", idx);
for (i=0; i<engine->priv->array->len; i++) {
device = g_ptr_array_index (engine->priv->array, i);
@@ -1151,9 +1149,9 @@ gpm_engine_init (GpmEngine *engine)
/* we can disable this if the time remaining is inaccurate or just plain wrong */
engine->priv->use_time_primary = g_settings_get_boolean (engine->priv->settings, GPM_SETTINGS_USE_TIME_POLICY);
if (engine->priv->use_time_primary)
- egg_debug ("Using per-time notification policy");
+ g_debug ("Using per-time notification policy");
else
- egg_debug ("Using percentage notification policy");
+ g_debug ("Using percentage notification policy");
idle_id = g_idle_add ((GSourceFunc) gpm_engine_coldplug_idle_cb, engine);
g_source_set_name_by_id (idle_id, "[GpmEngine] coldplug");
diff --git a/src/gpm-graph-widget.c b/src/gpm-graph-widget.c
index 499070f..39d881e 100644
--- a/src/gpm-graph-widget.c
+++ b/src/gpm-graph-widget.c
@@ -29,8 +29,6 @@
#include "gpm-point-obj.h"
#include "gpm-graph-widget.h"
-#include "egg-debug.h"
-
G_DEFINE_TYPE (GpmGraphWidget, gpm_graph_widget, GTK_TYPE_DRAWING_AREA);
#define GPM_GRAPH_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_GRAPH_WIDGET, GpmGraphWidgetPrivate))
#define GPM_GRAPH_WIDGET_FONT "Sans 8"
@@ -118,7 +116,7 @@ gpm_graph_widget_key_data_add (GpmGraphWidget *graph, guint32 color, const gchar
g_return_val_if_fail (GPM_IS_GRAPH_WIDGET (graph), FALSE);
- egg_debug ("add to list %s", desc);
+ g_debug ("add to list %s", desc);
keyitem = g_new0 (GpmGraphWidgetKeyData, 1);
keyitem->color = color;
@@ -648,7 +646,7 @@ gpm_graph_widget_autorange_x (GpmGraphWidget *graph)
/* no data in any array */
if (len == 0) {
- egg_debug ("no data");
+ g_debug ("no data");
graph->priv->start_x = 0;
graph->priv->stop_x = 10;
return;
@@ -665,7 +663,7 @@ gpm_graph_widget_autorange_x (GpmGraphWidget *graph)
smallest_x = point->x;
}
}
- egg_debug ("Data range is %f<x<%f", smallest_x, biggest_x);
+ g_debug ("Data range is %f<x<%f", smallest_x, biggest_x);
/* don't allow no difference */
if (biggest_x - smallest_x < 0.0001) {
biggest_x++;
@@ -692,7 +690,7 @@ gpm_graph_widget_autorange_x (GpmGraphWidget *graph)
graph->priv->start_x = gpm_precision_round_down (smallest_x, rounding_x);
graph->priv->stop_x = gpm_precision_round_up (biggest_x, rounding_x);
- egg_debug ("Processed(1) range is %i<x<%i",
+ g_debug ("Processed(1) range is %i<x<%i",
graph->priv->start_x, graph->priv->stop_x);
/* if percentage, and close to the end points, then extend */
@@ -706,7 +704,7 @@ gpm_graph_widget_autorange_x (GpmGraphWidget *graph)
graph->priv->start_x = 0;
}
- egg_debug ("Processed range is %i<x<%i",
+ g_debug ("Processed range is %i<x<%i",
graph->priv->start_x, graph->priv->stop_x);
}
@@ -742,7 +740,7 @@ gpm_graph_widget_autorange_y (GpmGraphWidget *graph)
/* no data in any array */
if (len == 0) {
- egg_debug ("no data");
+ g_debug ("no data");
graph->priv->start_y = 0;
graph->priv->stop_y = 10;
return;
@@ -759,7 +757,7 @@ gpm_graph_widget_autorange_y (GpmGraphWidget *graph)
smallest_y = point->y;
}
}
- egg_debug ("Data range is %f<y<%f", smallest_y, biggest_y);
+ g_debug ("Data range is %f<y<%f", smallest_y, biggest_y);
/* don't allow no difference */
if (biggest_y - smallest_y < 0.0001) {
biggest_y++;
@@ -794,7 +792,7 @@ gpm_graph_widget_autorange_y (GpmGraphWidget *graph)
graph->priv->stop_y = -graph->priv->start_y;
}
- egg_debug ("Processed(1) range is %i<y<%i",
+ g_debug ("Processed(1) range is %i<y<%i",
graph->priv->start_y, graph->priv->stop_y);
if (graph->priv->type_y == GPM_GRAPH_WIDGET_TYPE_PERCENTAGE) {
@@ -807,7 +805,7 @@ gpm_graph_widget_autorange_y (GpmGraphWidget *graph)
graph->priv->start_y = 0;
}
- egg_debug ("Processed range is %i<y<%i",
+ g_debug ("Processed range is %i<y<%i",
graph->priv->start_y, graph->priv->stop_y);
}
@@ -902,7 +900,7 @@ gpm_graph_widget_draw_line (GpmGraphWidget *graph, cairo_t *cr)
guint i, j;
if (graph->priv->data_list->len == 0) {
- egg_debug ("no data");
+ g_debug ("no data");
return;
}
cairo_save (cr);
@@ -1004,7 +1002,7 @@ gpm_graph_widget_draw_legend (GpmGraphWidget *graph, gint x, gint y, gint width,
keydataitem = (GpmGraphWidgetKeyData *) g_slist_nth_data (graph->priv->key_data, i);
if (keydataitem == NULL) {
/* this shouldn't ever happen */
- egg_warning ("keydataitem NULL!");
+ g_warning ("keydataitem NULL!");
break;
}
gpm_graph_widget_draw_legend_line (cr, x + 8, y_count, keydataitem->color);
diff --git a/src/gpm-idle.c b/src/gpm-idle.c
index 7bdca27..639feb0 100644
--- a/src/gpm-idle.c
+++ b/src/gpm-idle.c
@@ -39,7 +39,6 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
-#include "egg-debug.h"
#include "gpm-idletime.h"
#include "gpm-idle.h"
@@ -106,7 +105,7 @@ gpm_idle_set_mode (GpmIdle *idle, GpmIdleMode mode)
if (mode != idle->priv->mode) {
idle->priv->mode = mode;
- egg_debug ("Doing a state transition: %s", gpm_idle_mode_to_string (mode));
+ g_debug ("Doing a state transition: %s", gpm_idle_mode_to_string (mode));
g_signal_emit (idle, signals [IDLE_CHANGED], 0, mode);
}
}
@@ -120,7 +119,7 @@ void
gpm_idle_set_check_cpu (GpmIdle *idle, gboolean check_type_cpu)
{
g_return_if_fail (GPM_IS_IDLE (idle));
- egg_debug ("Setting the CPU load check to %i", check_type_cpu);
+ g_debug ("Setting the CPU load check to %i", check_type_cpu);
idle->priv->check_type_cpu = check_type_cpu;
}
@@ -141,7 +140,7 @@ static gboolean
gpm_idle_blank_cb (GpmIdle *idle)
{
if (idle->priv->mode > GPM_IDLE_MODE_BLANK) {
- egg_debug ("ignoring current mode %s", gpm_idle_mode_to_string (idle->priv->mode));
+ g_debug ("ignoring current mode %s", gpm_idle_mode_to_string (idle->priv->mode));
return FALSE;
}
gpm_idle_set_mode (idle, GPM_IDLE_MODE_BLANK);
@@ -162,7 +161,7 @@ gpm_idle_sleep_cb (GpmIdle *idle)
load = gpm_load_get_current (idle->priv->load);
if (load > GPM_IDLE_CPU_LIMIT) {
/* check if system is "idle" enough */
- egg_debug ("Detected that the CPU is busy");
+ g_debug ("Detected that the CPU is busy");
ret = TRUE;
goto out;
}
@@ -228,7 +227,7 @@ gpm_idle_is_session_inhibited (GpmIdle *idle, guint mask)
&error);
if (retval == NULL) {
/* abort as the DBUS method failed */
- egg_warning ("IsInhibited failed: %s", error->message);
+ g_warning ("IsInhibited failed: %s", error->message);
g_error_free (error);
goto out;
}
@@ -254,7 +253,7 @@ gpm_idle_evaluate (GpmIdle *idle)
/* check we are really idle */
if (!idle->priv->x_idle) {
gpm_idle_set_mode (idle, GPM_IDLE_MODE_NORMAL);
- egg_debug ("X not idle");
+ g_debug ("X not idle");
if (idle->priv->timeout_blank_id != 0) {
g_source_remove (idle->priv->timeout_blank_id);
idle->priv->timeout_blank_id = 0;
@@ -269,7 +268,7 @@ gpm_idle_evaluate (GpmIdle *idle)
/* are we inhibited from going idle */
is_idle_inhibited = gpm_idle_is_session_inhibited (idle, GPM_IDLE_INHIBIT_MASK_IDLE);
if (is_idle_inhibited) {
- egg_debug ("inhibited, so using normal state");
+ g_debug ("inhibited, so using normal state");
gpm_idle_set_mode (idle, GPM_IDLE_MODE_NORMAL);
if (idle->priv->timeout_blank_id != 0) {
g_source_remove (idle->priv->timeout_blank_id);
@@ -284,7 +283,7 @@ gpm_idle_evaluate (GpmIdle *idle)
/* normal to dim */
if (idle->priv->mode == GPM_IDLE_MODE_NORMAL) {
- egg_debug ("normal to dim");
+ g_debug ("normal to dim");
gpm_idle_set_mode (idle, GPM_IDLE_MODE_DIM);
}
@@ -292,7 +291,7 @@ gpm_idle_evaluate (GpmIdle *idle)
* but only if we actually want to blank. */
if (idle->priv->timeout_blank_id == 0 &&
idle->priv->timeout_blank != 0) {
- egg_debug ("setting up blank callback for %is", idle->priv->timeout_blank);
+ g_debug ("setting up blank callback for %is", idle->priv->timeout_blank);
idle->priv->timeout_blank_id = g_timeout_add_seconds (idle->priv->timeout_blank,
(GSourceFunc) gpm_idle_blank_cb, idle);
g_source_set_name_by_id (idle->priv->timeout_blank_id, "[GpmIdle] blank");
@@ -302,7 +301,7 @@ gpm_idle_evaluate (GpmIdle *idle)
is_idle = gpm_idle_is_session_idle (idle);
is_suspend_inhibited = gpm_idle_is_session_inhibited (idle, GPM_IDLE_INHIBIT_MASK_SUSPEND);
if (is_suspend_inhibited) {
- egg_debug ("suspend inhibited");
+ g_debug ("suspend inhibited");
if (idle->priv->timeout_sleep_id != 0) {
g_source_remove (idle->priv->timeout_sleep_id);
idle->priv->timeout_sleep_id = 0;
@@ -311,7 +310,7 @@ gpm_idle_evaluate (GpmIdle *idle)
/* only do the sleep timeout when the session is idle and we aren't inhibited from sleeping */
if (idle->priv->timeout_sleep_id == 0 &&
idle->priv->timeout_sleep != 0) {
- egg_debug ("setting up sleep callback %is", idle->priv->timeout_sleep);
+ g_debug ("setting up sleep callback %is", idle->priv->timeout_sleep);
idle->priv->timeout_sleep_id = g_timeout_add_seconds (idle->priv->timeout_sleep,
(GSourceFunc) gpm_idle_sleep_cb, idle);
g_source_set_name_by_id (idle->priv->timeout_sleep_id, "[GpmIdle] sleep");
@@ -364,11 +363,11 @@ gpm_idle_set_timeout_dim (GpmIdle *idle, guint timeout)
idle_time_in_msec = gpm_idletime_get_time (idle->priv->idletime);
timeout_adjusted = gpm_idle_adjust_timeout_dim (idle_time_in_msec / 1000, timeout);
- egg_debug ("Current idle time=%lldms, timeout was %us, becomes %us after adjustment",
+ g_debug ("Current idle time=%lldms, timeout was %us, becomes %us after adjustment",
(long long int)idle_time_in_msec, timeout, timeout_adjusted);
timeout = timeout_adjusted;
- egg_debug ("Setting dim idle timeout: %ds", timeout);
+ g_debug ("Setting dim idle timeout: %ds", timeout);
if (idle->priv->timeout_dim != timeout) {
idle->priv->timeout_dim = timeout;
@@ -389,7 +388,7 @@ gpm_idle_set_timeout_blank (GpmIdle *idle, guint timeout)
{
g_return_val_if_fail (GPM_IS_IDLE (idle), FALSE);
- egg_debug ("Setting blank idle timeout: %ds", timeout);
+ g_debug ("Setting blank idle timeout: %ds", timeout);
if (idle->priv->timeout_blank != timeout) {
idle->priv->timeout_blank = timeout;
gpm_idle_evaluate (idle);
@@ -406,7 +405,7 @@ gpm_idle_set_timeout_sleep (GpmIdle *idle, guint timeout)
{
g_return_val_if_fail (GPM_IS_IDLE (idle), FALSE);
- egg_debug ("Setting sleep idle timeout: %ds", timeout);
+ g_debug ("Setting sleep idle timeout: %ds", timeout);
if (idle->priv->timeout_sleep != timeout) {
idle->priv->timeout_sleep = timeout;
gpm_idle_evaluate (idle);
@@ -422,7 +421,7 @@ gpm_idle_set_timeout_sleep (GpmIdle *idle, guint timeout)
static void
gpm_idle_idletime_alarm_expired_cb (GpmIdletime *idletime, guint alarm_id, GpmIdle *idle)
{
- egg_debug ("idletime alarm: %i", alarm_id);
+ g_debug ("idletime alarm: %i", alarm_id);
/* set again */
idle->priv->x_idle = TRUE;
@@ -437,7 +436,7 @@ gpm_idle_idletime_alarm_expired_cb (GpmIdletime *idletime, guint alarm_id, GpmId
static void
gpm_idle_idletime_reset_cb (GpmIdletime *idletime, GpmIdle *idle)
{
- egg_debug ("idletime reset");
+ g_debug ("idletime reset");
idle->priv->x_idle = FALSE;
gpm_idle_evaluate (idle);
@@ -453,12 +452,12 @@ gpm_idle_dbus_signal_cb (GDBusProxy *proxy, const gchar *sender_name, const gcha
if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 ||
g_strcmp0 (signal_name, "InhibitorRemoved") == 0) {
- egg_debug ("Received gnome session inhibitor change");
+ g_debug ("Received gnome session inhibitor change");
gpm_idle_evaluate (idle);
return;
}
if (g_strcmp0 (signal_name, "StatusChanged") == 0) {
- egg_debug ("Received gnome session status change");
+ g_debug ("Received gnome session status change");
gpm_idle_evaluate (idle);
return;
}
@@ -549,7 +548,7 @@ gpm_idle_init (GpmIdle *idle)
/* get connection */
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection == NULL) {
- egg_warning ("Failed to get session connection: %s", error->message);
+ g_warning ("Failed to get session connection: %s", error->message);
g_error_free (error);
return;
}
@@ -563,7 +562,7 @@ gpm_idle_init (GpmIdle *idle)
"org.gnome.SessionManager",
NULL, &error);
if (idle->priv->proxy == NULL) {
- egg_warning ("Cannot connect to session manager: %s", error->message);
+ g_warning ("Cannot connect to session manager: %s", error->message);
g_error_free (error);
return;
}
@@ -578,7 +577,7 @@ gpm_idle_init (GpmIdle *idle)
"org.gnome.SessionManager.Presence",
NULL, &error);
if (idle->priv->proxy_presence == NULL) {
- egg_warning ("Cannot connect to session manager: %s", error->message);
+ g_warning ("Cannot connect to session manager: %s", error->message);
g_error_free (error);
return;
}
diff --git a/src/gpm-load.c b/src/gpm-load.c
index eab0129..a0f6224 100644
--- a/src/gpm-load.c
+++ b/src/gpm-load.c
@@ -41,7 +41,6 @@
#include "gpm-common.h"
#include "gpm-marshal.h"
-#include "egg-debug.h"
#include "gpm-load.h"
@@ -94,18 +93,18 @@ gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total)
kc = kstat_open();
if (!kc) {
- egg_warning ("Cannot open kstat!\n");
+ g_warning ("Cannot open kstat!\n");
return FALSE;
}
ks = kstat_lookup(kc, "unix", 0, "system_misc");
if (kstat_read(kc, ks, NULL) == -1) {
- egg_warning ("Cannot read kstat on module unix!\n");
+ g_warning ("Cannot read kstat on module unix!\n");
goto out;
}
kn = kstat_data_lookup (ks, "ncpus");
if (!kn) {
- egg_warning ("Cannot get number of cpus in current system!\n");
+ g_warning ("Cannot get number of cpus in current system!\n");
goto out;
}
ncpus = kn->value.ui32;
@@ -118,16 +117,16 @@ gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total)
ks = kstat_lookup(kc, "cpu_stat", count, NULL);
if (ks == NULL) {
- egg_warning ("Null output for kstat on cpu%d\n", count);
+ g_warning ("Null output for kstat on cpu%d\n", count);
goto out;
}
if (kstat_read(kc, ks, &data) == -1) {
- egg_warning ("Cannot read kstat entry on cpu%d\n", count);
+ g_warning ("Cannot read kstat entry on cpu%d\n", count);
goto out;
}
- egg_debug ("cpu%d:\t%lu\t%lu\t%lu\t%lu\n", count,
+ g_debug ("cpu%d:\t%lu\t%lu\t%lu\t%lu\n", count,
data.cpu_sysinfo.cpu[CPU_IDLE],
data.cpu_sysinfo.cpu[CPU_USER],
data.cpu_sysinfo.cpu[CPU_KERNEL],
diff --git a/src/gpm-main.c b/src/gpm-main.c
index 092c583..af0f060 100644
--- a/src/gpm-main.c
+++ b/src/gpm-main.c
@@ -37,8 +37,7 @@
#include "gpm-stock-icons.h"
#include "gpm-common.h"
#include "gpm-manager.h"
-
-#include "egg-debug.h"
+#include "gpm-debug.h"
static GDBusProxy *session_proxy = NULL;
static GDBusProxy *session_proxy_client = NULL;
@@ -73,7 +72,7 @@ gpm_main_session_end_session_response (gboolean is_okay, const gchar *reason)
/* no gnome-session */
if (session_proxy == NULL) {
- egg_warning ("no gnome-session");
+ g_warning ("no gnome-session");
goto out;
}
@@ -85,7 +84,7 @@ gpm_main_session_end_session_response (gboolean is_okay, const gchar *reason)
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
if (retval == NULL) {
- egg_debug ("ERROR: %s", error->message);
+ g_debug ("ERROR: %s", error->message);
g_error_free (error);
goto out;
}
@@ -142,7 +141,7 @@ gpm_main_session_register_client (const gchar *app_id, const gchar *client_start
/* get connection */
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection == NULL) {
- egg_warning ("Failed to get session connection: %s", error->message);
+ g_warning ("Failed to get session connection: %s", error->message);
g_error_free (error);
return FALSE;
}
@@ -158,7 +157,7 @@ gpm_main_session_register_client (const gchar *app_id, const gchar *client_start
"org.gnome.SessionManager",
NULL, &error);
if (session_proxy == NULL) {
- egg_warning ("Failed to get gnome-session: %s", error->message);
+ g_warning ("Failed to get gnome-session: %s", error->message);
g_error_free (error);
return FALSE;
}
@@ -172,7 +171,7 @@ gpm_main_session_register_client (const gchar *app_id, const gchar *client_start
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
if (retval == NULL) {
- egg_warning ("failed to register client '%s': %s", client_startup_id, error->message);
+ g_warning ("failed to register client '%s': %s", client_startup_id, error->message);
g_error_free (error);
goto out;
}
@@ -190,7 +189,7 @@ gpm_main_session_register_client (const gchar *app_id, const gchar *client_start
"org.gnome.SessionManager.ClientPrivate",
NULL, &error);
if (session_proxy_client == NULL) {
- egg_warning ("failed to setup private proxy: %s", error->message);
+ g_warning ("failed to setup private proxy: %s", error->message);
g_error_free (error);
goto out;
}
@@ -198,7 +197,7 @@ gpm_main_session_register_client (const gchar *app_id, const gchar *client_start
/* success */
ret = TRUE;
- egg_debug ("registered startup '%s' to client id '%s'", client_startup_id, client_id);
+ g_debug ("registered startup '%s' to client id '%s'", client_startup_id, client_id);
out:
if (retval != NULL)
g_variant_unref (retval);
@@ -214,7 +213,6 @@ main (int argc, char *argv[])
{
GDBusConnection *system_connection;
GDBusConnection *session_connection;
- gboolean verbose = FALSE;
gboolean version = FALSE;
gboolean timed_exit = FALSE;
gboolean immediate_exit = FALSE;
@@ -225,8 +223,6 @@ main (int argc, char *argv[])
guint timer_id;
const GOptionEntry options[] = {
- { "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose,
- N_("Show extra debugging information"), NULL },
{ "version", '\0', 0, G_OPTION_ARG_NONE, &version,
N_("Show version of installed program and exit"), NULL },
{ "timed-exit", '\0', 0, G_OPTION_ARG_NONE, &timed_exit,
@@ -248,6 +244,7 @@ main (int argc, char *argv[])
context = g_option_context_new (N_("GNOME Power Manager"));
/* TRANSLATORS: program name, a simple app to view pending updates */
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+ g_option_context_add_group (context, gpm_debug_get_option_group ());
g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
g_option_context_set_summary (context, _("GNOME Power Manager"));
g_option_context_parse (context, &argc, &argv, NULL);
@@ -261,16 +258,15 @@ main (int argc, char *argv[])
g_thread_init (NULL);
gtk_init (&argc, &argv);
- egg_debug_init (verbose);
- egg_debug ("GNOME %s %s", GPM_NAME, VERSION);
+ g_debug ("GNOME %s %s", GPM_NAME, VERSION);
/* check dbus connections, exit if not valid */
system_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (error) {
- egg_warning ("%s", error->message);
+ g_warning ("%s", error->message);
g_error_free (error);
- egg_error ("This program cannot start until you start "
+ g_error ("This program cannot start until you start "
"the dbus system service.\n"
"It is <b>strongly recommended</b> you reboot "
"your computer after starting this service.");
@@ -278,9 +274,9 @@ main (int argc, char *argv[])
session_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (error) {
- egg_warning ("%s", error->message);
+ g_warning ("%s", error->message);
g_error_free (error);
- egg_error ("This program cannot start until you start the "
+ g_error ("This program cannot start until you start the "
"dbus session service.\n\n"
"This is usually started automatically in X "
"or gnome startup when you start a new session.");
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 1790df2..c44872f 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -40,7 +40,6 @@
#include <libupower-glib/upower.h>
#include <libnotify/notify.h>
-#include "egg-debug.h"
#include "egg-console-kit.h"
#include "gpm-button.h"
@@ -177,7 +176,7 @@ static gboolean
gpm_manager_play_loop_stop (GpmManager *manager)
{
if (manager->priv->critical_alert_timeout_id == 0) {
- egg_warning ("no sound loop present to stop");
+ g_warning ("no sound loop present to stop");
return FALSE;
}
@@ -204,18 +203,18 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_ENABLE_SOUND);
if (!ret && !force) {
- egg_debug ("ignoring sound due to policy");
+ g_debug ("ignoring sound due to policy");
return FALSE;
}
if (timeout == 0) {
- egg_warning ("received invalid timeout");
+ g_warning ("received invalid timeout");
return FALSE;
}
/* if a sound loop is already running, stop the existing loop */
if (manager->priv->critical_alert_timeout_id != 0) {
- egg_warning ("was instructed to play a sound loop with one already playing");
+ g_warning ("was instructed to play a sound loop with one already playing");
gpm_manager_play_loop_stop (manager);
}
@@ -227,7 +226,7 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
/* no match */
if (id == NULL) {
- egg_warning ("no sound match for %i", action);
+ g_warning ("no sound match for %i", action);
return FALSE;
}
@@ -248,7 +247,7 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
CA_PROP_EVENT_ID, id,
CA_PROP_EVENT_DESCRIPTION, desc, NULL);
if (retval < 0)
- egg_warning ("failed to play %s: %s", id, ca_strerror (retval));
+ g_warning ("failed to play %s: %s", id, ca_strerror (retval));
return TRUE;
}
@@ -266,7 +265,7 @@ gpm_manager_play (GpmManager *manager, GpmManagerSound action, gboolean force)
ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_ENABLE_SOUND);
if (!ret && !force) {
- egg_debug ("ignoring sound due to policy");
+ g_debug ("ignoring sound due to policy");
return FALSE;
}
@@ -314,7 +313,7 @@ gpm_manager_play (GpmManager *manager, GpmManagerSound action, gboolean force)
/* no match */
if (id == NULL) {
- egg_warning ("no match");
+ g_warning ("no match");
return FALSE;
}
@@ -324,7 +323,7 @@ gpm_manager_play (GpmManager *manager, GpmManagerSound action, gboolean force)
CA_PROP_EVENT_ID, id,
CA_PROP_EVENT_DESCRIPTION, desc, NULL);
if (retval < 0)
- egg_warning ("failed to play %s: %s", id, ca_strerror (retval));
+ g_warning ("failed to play %s: %s", id, ca_strerror (retval));
return TRUE;
}
@@ -393,11 +392,11 @@ gpm_manager_blank_screen (GpmManager *manager, GError **noerror)
GPM_SETTINGS_LOCK_ON_BLANK_SCREEN);
if (do_lock) {
if (!gpm_screensaver_lock (manager->priv->screensaver))
- egg_debug ("Could not lock screen via gnome-screensaver");
+ g_debug ("Could not lock screen via gnome-screensaver");
}
gpm_dpms_set_mode (manager->priv->dpms, GPM_DPMS_MODE_OFF, &error);
if (error) {
- egg_debug ("Unable to set DPMS mode: %s", error->message);
+ g_debug ("Unable to set DPMS mode: %s", error->message);
g_error_free (error);
ret = FALSE;
}
@@ -421,7 +420,7 @@ gpm_manager_unblank_screen (GpmManager *manager, GError **noerror)
gpm_dpms_set_mode (manager->priv->dpms, GPM_DPMS_MODE_ON, &error);
if (error) {
- egg_debug ("Unable to set DPMS mode: %s", error->message);
+ g_debug ("Unable to set DPMS mode: %s", error->message);
g_error_free (error);
ret = FALSE;
}
@@ -448,7 +447,7 @@ gpm_manager_notify_close (GpmManager *manager, NotifyNotification *notification)
/* try to close */
ret = notify_notification_close (notification, &error);
if (!ret) {
- egg_warning ("failed to close notification: %s", error->message);
+ g_warning ("failed to close notification: %s", error->message);
g_error_free (error);
goto out;
}
@@ -462,7 +461,7 @@ out:
static void
gpm_manager_notification_closed_cb (NotifyNotification *notification, NotifyNotification **notification_class)
{
- egg_debug ("caught notification closed signal %p", notification);
+ g_debug ("caught notification closed signal %p", notification);
/* the object is already unreffed in _close_signal_handler */
*notification_class = NULL;
}
@@ -508,12 +507,12 @@ gpm_manager_notify (GpmManager *manager, NotifyNotification **notification_class
notify_notification_set_timeout (notification, timeout);
notify_notification_set_urgency (notification, urgency);
g_signal_connect (notification, "closed", G_CALLBACK (gpm_manager_notification_closed_cb), notification_class);
- egg_debug ("notification %p: %s : %s", notification, title, message);
+ g_debug ("notification %p: %s : %s", notification, title, message);
/* try to show */
ret = notify_notification_show (notification, &error);
if (!ret) {
- egg_warning ("failed to show notification: %s", error->message);
+ g_warning ("failed to show notification: %s", error->message);
g_error_free (error);
g_object_unref (notification);
goto out;
@@ -571,7 +570,7 @@ gpm_manager_sleep_failure (GpmManager *manager, gboolean is_suspend, const gchar
/* only show this if specified in settings */
show_sleep_failed = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_NOTIFY_SLEEP_FAILED);
- egg_debug ("sleep failed");
+ g_debug ("sleep failed");
gpm_manager_play (manager, GPM_MANAGER_SOUND_SUSPEND_ERROR, TRUE);
/* only emit if in GConf */
@@ -632,7 +631,7 @@ gpm_manager_action_suspend (GpmManager *manager, const gchar *reason)
if (gpm_manager_is_inhibit_valid (manager, FALSE, "suspend") == FALSE)
return FALSE;
- egg_debug ("suspending, reason: %s", reason);
+ g_debug ("suspending, reason: %s", reason);
ret = gpm_control_suspend (manager->priv->control, &error);
if (!ret) {
gpm_manager_sleep_failure (manager, TRUE, error->message);
@@ -655,7 +654,7 @@ gpm_manager_action_hibernate (GpmManager *manager, const gchar *reason)
if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
return FALSE;
- egg_debug ("hibernating, reason: %s", reason);
+ g_debug ("hibernating, reason: %s", reason);
ret = gpm_control_hibernate (manager->priv->control, &error);
if (!ret) {
gpm_manager_sleep_failure (manager, TRUE, error->message);
@@ -680,7 +679,7 @@ gpm_manager_logout (GpmManager *manager)
/* connect to gnome-session */
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection == NULL) {
- egg_warning ("Failed to connect to the session: %s", error->message);
+ g_warning ("Failed to connect to the session: %s", error->message);
g_error_free (error);
goto out;
}
@@ -693,7 +692,7 @@ gpm_manager_logout (GpmManager *manager)
"org.gnome.SessionManager",
NULL, &error);
if (proxy == NULL) {
- egg_warning ("Failed to shutdown session: %s", error->message);
+ g_warning ("Failed to shutdown session: %s", error->message);
g_error_free (error);
goto out;
}
@@ -704,7 +703,7 @@ gpm_manager_logout (GpmManager *manager)
NULL, G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
if (retval == NULL) {
- egg_debug ("Failed to shutdown session: %s", error->message);
+ g_debug ("Failed to shutdown session: %s", error->message);
g_error_free (error);
goto out;
}
@@ -737,9 +736,9 @@ gpm_manager_perform_policy (GpmManager *manager, const gchar *policy_key, const
return FALSE;
policy = g_settings_get_enum (manager->priv->settings, policy_key);
- egg_debug ("action: %s set to %i (%s)", policy_key, policy, reason);
+ g_debug ("action: %s set to %i (%s)", policy_key, policy, reason);
if (policy == GPM_ACTION_POLICY_NOTHING) {
- egg_debug ("doing nothing, reason: %s", reason);
+ g_debug ("doing nothing, reason: %s", reason);
} else if (policy == GPM_ACTION_POLICY_SUSPEND) {
gpm_manager_action_suspend (manager, reason);
@@ -750,14 +749,14 @@ gpm_manager_perform_policy (GpmManager *manager, const gchar *policy_key, const
gpm_manager_blank_screen (manager, NULL);
} else if (policy == GPM_ACTION_POLICY_SHUTDOWN) {
- egg_debug ("shutting down, reason: %s", reason);
+ g_debug ("shutting down, reason: %s", reason);
gpm_control_shutdown (manager->priv->control, NULL);
} else if (policy == GPM_ACTION_POLICY_INTERACTIVE) {
- egg_debug ("logout, reason: %s", reason);
+ g_debug ("logout, reason: %s", reason);
gpm_manager_logout (manager);
} else {
- egg_warning ("unknown action %i", policy);
+ g_warning ("unknown action %i", policy);
}
return TRUE;
@@ -783,32 +782,32 @@ gpm_manager_idle_do_sleep (GpmManager *manager)
policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_SLEEP_TYPE_BATT);
if (policy == GPM_ACTION_POLICY_NOTHING) {
- egg_debug ("doing nothing as system idle action");
+ g_debug ("doing nothing as system idle action");
} else if (policy == GPM_ACTION_POLICY_SUSPEND) {
- egg_debug ("suspending, reason: System idle");
+ g_debug ("suspending, reason: System idle");
ret = gpm_control_suspend (manager->priv->control, &error);
if (!ret) {
- egg_warning ("cannot suspend (error: %s), so trying hibernate", error->message);
+ g_warning ("cannot suspend (error: %s), so trying hibernate", error->message);
g_error_free (error);
error = NULL;
ret = gpm_control_hibernate (manager->priv->control, &error);
if (!ret) {
- egg_warning ("cannot suspend or hibernate: %s", error->message);
+ g_warning ("cannot suspend or hibernate: %s", error->message);
g_error_free (error);
}
}
} else if (policy == GPM_ACTION_POLICY_HIBERNATE) {
- egg_debug ("hibernating, reason: System idle");
+ g_debug ("hibernating, reason: System idle");
ret = gpm_control_hibernate (manager->priv->control, &error);
if (!ret) {
- egg_warning ("cannot hibernate (error: %s), so trying suspend", error->message);
+ g_warning ("cannot hibernate (error: %s), so trying suspend", error->message);
g_error_free (error);
error = NULL;
ret = gpm_control_suspend (manager->priv->control, &error);
if (!ret) {
- egg_warning ("cannot suspend or hibernate: %s", error->message);
+ g_warning ("cannot suspend or hibernate: %s", error->message);
g_error_free (error);
}
}
@@ -828,7 +827,7 @@ gpm_manager_is_active (GpmManager *manager)
/* if we fail, assume we are on active console */
ret = egg_console_kit_is_active (manager->priv->console, &is_active, &error);
if (!ret) {
- egg_warning ("failed to get active status: %s", error->message);
+ g_warning ("failed to get active status: %s", error->message);
g_error_free (error);
}
return is_active;
@@ -850,7 +849,7 @@ gpm_manager_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manage
{
/* ConsoleKit says we are not on active console */
if (!gpm_manager_is_active (manager)) {
- egg_debug ("ignoring as not on active console");
+ g_debug ("ignoring as not on active console");
return;
}
@@ -859,12 +858,12 @@ gpm_manager_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manage
* moves the mouse on systems that do not support hardware blanking. */
if (gpm_button_is_lid_closed (manager->priv->button) &&
mode == GPM_IDLE_MODE_NORMAL) {
- egg_debug ("lid is closed, so we are ignoring ->NORMAL state changes");
+ g_debug ("lid is closed, so we are ignoring ->NORMAL state changes");
return;
}
if (mode == GPM_IDLE_MODE_SLEEP) {
- egg_debug ("Idle state changed: SLEEP");
+ g_debug ("Idle state changed: SLEEP");
if (gpm_manager_is_inhibit_valid (manager, FALSE, "timeout action") == FALSE)
return;
gpm_manager_idle_do_sleep (manager);
@@ -894,13 +893,13 @@ gpm_manager_lid_button_pressed (GpmManager *manager, gboolean pressed)
}
if (!manager->priv->on_battery) {
- egg_debug ("Performing AC policy");
+ g_debug ("Performing AC policy");
gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_LID_AC,
"Lid closed on AC power.");
return;
}
- egg_debug ("Performing battery policy");
+ g_debug ("Performing battery policy");
gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_LID_BATT,
"Lid closed on battery power.");
}
@@ -975,11 +974,11 @@ static void
gpm_manager_button_pressed_cb (GpmButton *button, const gchar *type, GpmManager *manager)
{
gchar *message;
- egg_debug ("Button press event type=%s", type);
+ g_debug ("Button press event type=%s", type);
/* ConsoleKit says we are not on active console */
if (!gpm_manager_is_active (manager)) {
- egg_debug ("ignoring as not on active console");
+ g_debug ("ignoring as not on active console");
return;
}
@@ -1057,20 +1056,20 @@ gpm_manager_client_changed_cb (UpClient *client, GpmManager *manager)
"lid-is-closed", &lid_is_closed,
NULL);
if (on_battery == manager->priv->on_battery) {
- egg_debug ("same state as before, ignoring");
+ g_debug ("same state as before, ignoring");
return;
}
/* close any discharging notifications */
if (!on_battery) {
- egg_debug ("clearing notify due ac being present");
+ g_debug ("clearing notify due ac being present");
gpm_manager_notify_close (manager, manager->priv->notification_warning_low);
gpm_manager_notify_close (manager, manager->priv->notification_discharging);
}
/* if we are playing a critical charge sound loop, stop it */
if (!on_battery && manager->priv->critical_alert_timeout_id) {
- egg_debug ("stopping alert loop due to ac being present");
+ g_debug ("stopping alert loop due to ac being present");
gpm_manager_play_loop_stop (manager);
}
@@ -1079,11 +1078,11 @@ gpm_manager_client_changed_cb (UpClient *client, GpmManager *manager)
/* ConsoleKit says we are not on active console */
if (!gpm_manager_is_active (manager)) {
- egg_debug ("ignoring as not on active console");
+ g_debug ("ignoring as not on active console");
return;
}
- egg_debug ("on_battery: %d", on_battery);
+ g_debug ("on_battery: %d", on_battery);
/* set disk spindown threshold */
timeout = gpm_manager_get_spindown_timeout (manager);
@@ -1182,7 +1181,7 @@ gpm_manager_screensaver_auth_request_cb (GpmScreensaver *screensaver, gboolean a
* See #350291 for more details */
gpm_dpms_set_mode (manager->priv->dpms, GPM_DPMS_MODE_ON, &error);
if (error != NULL) {
- egg_warning ("Failed to turn on DPMS: %s", error->message);
+ g_warning ("Failed to turn on DPMS: %s", error->message);
g_error_free (error);
error = NULL;
}
@@ -1278,14 +1277,14 @@ gpm_manager_engine_perhaps_recall_cb (GpmEngine *engine, UpDevice *device, gchar
/* don't show when running under GDM */
if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
- egg_debug ("running under gdm, so no notification");
+ g_debug ("running under gdm, so no notification");
return;
}
/* already shown, and dismissed */
ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_NOTIFY_PERHAPS_RECALL);
if (!ret) {
- egg_debug ("GConf prevents notification: %s", GPM_SETTINGS_NOTIFY_PERHAPS_RECALL);
+ g_debug ("GConf prevents notification: %s", GPM_SETTINGS_NOTIFY_PERHAPS_RECALL);
return;
}
@@ -1328,7 +1327,7 @@ gpm_manager_engine_low_capacity_cb (GpmEngine *engine, UpDevice *device, GpmMana
/* don't show when running under GDM */
if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
- egg_debug ("running under gdm, so no notification");
+ g_debug ("running under gdm, so no notification");
goto out;
}
@@ -1368,13 +1367,13 @@ gpm_manager_engine_fully_charged_cb (GpmEngine *engine, UpDevice *device, GpmMan
/* only action this if specified in the setings */
ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_NOTIFY_FULLY_CHARGED);
if (!ret) {
- egg_debug ("no notification");
+ g_debug ("no notification");
goto out;
}
/* don't show when running under GDM */
if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
- egg_debug ("running under gdm, so no notification");
+ g_debug ("running under gdm, so no notification");
goto out;
}
@@ -1422,7 +1421,7 @@ gpm_manager_engine_discharging_cb (GpmEngine *engine, UpDevice *device, GpmManag
/* only action this if specified in the settings */
ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_NOTIFY_DISCHARGING);
if (!ret) {
- egg_debug ("no notification");
+ g_debug ("no notification");
goto out;
}
@@ -1534,14 +1533,14 @@ gpm_manager_engine_charge_low_cb (GpmEngine *engine, UpDevice *device, GpmManage
GPM_SETTINGS_NOTIFY_LOW_POWER_DEVICE);
}
if (!ret) {
- egg_debug ("ignoring notication for type %s", up_device_kind_to_string (kind));
+ g_debug ("ignoring notication for type %s", up_device_kind_to_string (kind));
goto out;
}
/* check to see if the batteries have not noticed we are on AC */
if (kind == UP_DEVICE_KIND_BATTERY) {
if (!manager->priv->on_battery) {
- egg_warning ("ignoring critically low message as we are not on battery power");
+ g_warning ("ignoring critically low message as we are not on battery power");
goto out;
}
}
@@ -1659,7 +1658,7 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
/* check to see if the batteries have not noticed we are on AC */
if (kind == UP_DEVICE_KIND_BATTERY) {
if (!manager->priv->on_battery) {
- egg_warning ("ignoring critically low message as we are not on battery power");
+ g_warning ("ignoring critically low message as we are not on battery power");
goto out;
}
}
@@ -1674,7 +1673,7 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
GPM_SETTINGS_NOTIFY_LOW_POWER_DEVICE);
}
if (!ret) {
- egg_debug ("ignoring notication for type %s", up_device_kind_to_string (kind));
+ g_debug ("ignoring notication for type %s", up_device_kind_to_string (kind));
goto out;
}
@@ -1799,7 +1798,7 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
case UP_DEVICE_KIND_BATTERY:
case UP_DEVICE_KIND_UPS:
- egg_debug ("critical charge level reached, starting sound loop");
+ g_debug ("critical charge level reached, starting sound loop");
gpm_manager_play_loop_start (manager,
GPM_MANAGER_SOUND_BATTERY_LOW,
TRUE,
@@ -1836,7 +1835,7 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
/* check to see if the batteries have not noticed we are on AC */
if (kind == UP_DEVICE_KIND_BATTERY) {
if (!manager->priv->on_battery) {
- egg_warning ("ignoring critically low message as we are not on battery power");
+ g_warning ("ignoring critically low message as we are not on battery power");
goto out;
}
}
@@ -1934,16 +1933,16 @@ out:
static void
gpm_manager_dpms_mode_changed_cb (GpmDpms *dpms, GpmDpmsMode mode, GpmManager *manager)
{
- egg_debug ("DPMS mode changed: %d", mode);
+ g_debug ("DPMS mode changed: %d", mode);
if (mode == GPM_DPMS_MODE_ON)
- egg_debug ("dpms on");
+ g_debug ("dpms on");
else if (mode == GPM_DPMS_MODE_STANDBY)
- egg_debug ("dpms standby");
+ g_debug ("dpms standby");
else if (mode == GPM_DPMS_MODE_SUSPEND)
- egg_debug ("suspend");
+ g_debug ("suspend");
else if (mode == GPM_DPMS_MODE_OFF)
- egg_debug ("dpms off");
+ g_debug ("dpms off");
gpm_manager_update_dpms_throttle (manager);
}
@@ -2068,7 +2067,7 @@ gpm_manager_name_lost_cb (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
- egg_warning ("name lost %s", name);
+ g_warning ("name lost %s", name);
}
/**
@@ -2125,7 +2124,7 @@ gpm_manager_init (GpmManager *manager)
GPM_MANAGER_NOTIFY_TIMEOUT_LONG,
GTK_STOCK_DIALOG_WARNING,
NOTIFY_URGENCY_NORMAL);
- egg_error ("no GSettings schema installed!");
+ g_error ("no GSettings schema installed!");
}
/* coldplug so we are in the correct state at startup */
@@ -2156,12 +2155,12 @@ gpm_manager_init (GpmManager *manager)
G_CALLBACK (gpm_manager_dpms_mode_changed_cb), manager);
/* use the control object */
- egg_debug ("creating new control instance");
+ g_debug ("creating new control instance");
manager->priv->control = gpm_control_new ();
g_signal_connect (manager->priv->control, "resume",
G_CALLBACK (gpm_manager_control_resume_cb), manager);
- egg_debug ("creating new tray icon");
+ g_debug ("creating new tray icon");
manager->priv->tray_icon = gpm_tray_icon_new ();
/* keep a reference for the notifications */
diff --git a/src/gpm-phone.c b/src/gpm-phone.c
index 166ddaa..51e7209 100644
--- a/src/gpm-phone.c
+++ b/src/gpm-phone.c
@@ -27,7 +27,6 @@
#include <gio/gio.h>
#include "gpm-phone.h"
-#include "egg-debug.h"
#include "gpm-marshal.h"
static void gpm_phone_finalize (GObject *object);
@@ -71,14 +70,14 @@ gpm_phone_coldplug (GpmPhone *phone)
g_return_val_if_fail (GPM_IS_PHONE (phone), FALSE);
if (phone->priv->proxy == NULL) {
- egg_warning ("not connected");
+ g_warning ("not connected");
return FALSE;
}
reply = g_dbus_proxy_call_sync (phone->priv->proxy, "Coldplug",
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
if (error != NULL) {
- egg_warning ("DEBUG: ERROR: %s", error->message);
+ g_warning ("DEBUG: ERROR: %s", error->message);
g_error_free (error);
}
@@ -149,11 +148,11 @@ gpm_phone_battery_state_changed (GDBusProxy *proxy, guint idx, guint percentage,
{
g_return_if_fail (GPM_IS_PHONE (phone));
- egg_debug ("got BatteryStateChanged %i = %i (%i)", idx, percentage, on_ac);
+ g_debug ("got BatteryStateChanged %i = %i (%i)", idx, percentage, on_ac);
phone->priv->percentage = percentage;
phone->priv->onac = on_ac;
phone->priv->present = TRUE;
- egg_debug ("emitting device-refresh : (%i)", idx);
+ g_debug ("emitting device-refresh : (%i)", idx);
g_signal_emit (phone, signals [DEVICE_REFRESH], 0, idx);
}
@@ -164,9 +163,9 @@ gpm_phone_num_batteries_changed (GDBusProxy *proxy, guint number, GpmPhone *phon
{
g_return_if_fail (GPM_IS_PHONE (phone));
- egg_debug ("got NumberBatteriesChanged %i", number);
+ g_debug ("got NumberBatteriesChanged %i", number);
if (number > 1) {
- egg_warning ("number not 0 or 1, not valid!");
+ g_warning ("number not 0 or 1, not valid!");
return;
}
@@ -175,13 +174,13 @@ gpm_phone_num_batteries_changed (GDBusProxy *proxy, guint number, GpmPhone *phon
phone->priv->present = FALSE;
phone->priv->percentage = 0;
phone->priv->onac = FALSE;
- egg_debug ("emitting device-removed : (%i)", 0);
+ g_debug ("emitting device-removed : (%i)", 0);
g_signal_emit (phone, signals [DEVICE_REMOVED], 0, 0);
return;
}
if (phone->priv->present) {
- egg_warning ("duplicate NumberBatteriesChanged with no change");
+ g_warning ("duplicate NumberBatteriesChanged with no change");
return;
}
@@ -189,7 +188,7 @@ gpm_phone_num_batteries_changed (GDBusProxy *proxy, guint number, GpmPhone *phon
phone->priv->present = TRUE;
phone->priv->percentage = 0;
phone->priv->onac = FALSE;
- egg_debug ("emitting device-added : (%i)", 0);
+ g_debug ("emitting device-added : (%i)", 0);
g_signal_emit (phone, signals [DEVICE_ADDED], 0, 0);
}
@@ -272,18 +271,18 @@ gpm_phone_service_appeared_cb (GDBusConnection *connection,
g_return_if_fail (GPM_IS_PHONE (phone));
if (phone->priv->connection == NULL) {
- egg_debug ("get connection");
+ g_debug ("get connection");
g_clear_error (&error);
phone->priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (phone->priv->connection == NULL) {
- egg_warning ("Could not connect to DBUS daemon: %s", error->message);
+ g_warning ("Could not connect to DBUS daemon: %s", error->message);
g_error_free (error);
phone->priv->connection = NULL;
return;
}
}
if (phone->priv->proxy == NULL) {
- egg_debug ("get proxy");
+ g_debug ("get proxy");
g_clear_error (&error);
phone->priv->proxy = g_dbus_proxy_new_sync (phone->priv->connection,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
@@ -293,7 +292,7 @@ gpm_phone_service_appeared_cb (GDBusConnection *connection,
GNOME_PHONE_MANAGER_DBUS_INTERFACE,
NULL, &error);
if (phone->priv->proxy == NULL) {
- egg_warning ("Cannot connect, maybe the daemon is not running: %s", error->message);
+ g_warning ("Cannot connect, maybe the daemon is not running: %s", error->message);
g_error_free (error);
phone->priv->proxy = NULL;
return;
@@ -314,13 +313,13 @@ gpm_phone_service_vanished_cb (GDBusConnection *connection,
g_return_if_fail (GPM_IS_PHONE (phone));
if (phone->priv->proxy != NULL) {
- egg_debug ("removing proxy");
+ g_debug ("removing proxy");
g_object_unref (phone->priv->proxy);
phone->priv->proxy = NULL;
if (phone->priv->present) {
phone->priv->present = FALSE;
phone->priv->percentage = 0;
- egg_debug ("emitting device-removed : (%i)", 0);
+ g_debug ("emitting device-removed : (%i)", 0);
g_signal_emit (phone, signals [DEVICE_REMOVED], 0, 0);
}
}
diff --git a/src/gpm-point-obj.c b/src/gpm-point-obj.c
index b3bfa5c..cdc1ce0 100644
--- a/src/gpm-point-obj.c
+++ b/src/gpm-point-obj.c
@@ -20,7 +20,6 @@
#include <glib.h>
-#include "egg-debug.h"
#include "gpm-point-obj.h"
/**
diff --git a/src/gpm-screensaver.c b/src/gpm-screensaver.c
index 63401d3..cc21ae9 100644
--- a/src/gpm-screensaver.c
+++ b/src/gpm-screensaver.c
@@ -29,7 +29,6 @@
#include "gpm-screensaver.h"
#include "gpm-common.h"
-#include "egg-debug.h"
static void gpm_screensaver_finalize (GObject *object);
@@ -81,11 +80,11 @@ gpm_screensaver_lock (GpmScreensaver *screensaver)
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
if (screensaver->priv->proxy == NULL) {
- egg_warning ("not connected");
+ g_warning ("not connected");
return FALSE;
}
- egg_debug ("doing gnome-screensaver lock");
+ g_debug ("doing gnome-screensaver lock");
g_dbus_proxy_call (screensaver->priv->proxy,
"Lock",
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
@@ -102,7 +101,7 @@ gpm_screensaver_lock (GpmScreensaver *screensaver)
/* Sleep for 1/10s */
g_usleep (1000 * 100);
if (sleepcount++ > 50) {
- egg_debug ("timeout waiting for gnome-screensaver");
+ g_debug ("timeout waiting for gnome-screensaver");
break;
}
}
@@ -127,7 +126,7 @@ gpm_screensaver_add_throttle (GpmScreensaver *screensaver, const char *reason)
g_return_val_if_fail (reason != NULL, 0);
if (screensaver->priv->proxy == NULL) {
- egg_warning ("not connected to the screensaver");
+ g_warning ("not connected to the screensaver");
goto out;
}
@@ -141,14 +140,14 @@ gpm_screensaver_add_throttle (GpmScreensaver *screensaver, const char *reason)
&error);
if (retval == NULL) {
/* abort as the DBUS method failed */
- egg_warning ("Throttle failed: %s", error->message);
+ g_warning ("Throttle failed: %s", error->message);
g_error_free (error);
goto out;
}
/* success */
g_variant_get (retval, "(s)", &cookie);
- egg_debug ("adding throttle reason: '%s': id %u", reason, cookie);
+ g_debug ("adding throttle reason: '%s': id %u", reason, cookie);
out:
if (retval != NULL)
g_variant_unref (retval);
@@ -168,11 +167,11 @@ gpm_screensaver_remove_throttle (GpmScreensaver *screensaver, guint cookie)
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
if (screensaver->priv->proxy == NULL) {
- egg_warning ("not connected to the screensaver");
+ g_warning ("not connected to the screensaver");
goto out;
}
- egg_debug ("removing throttle: id %u", cookie);
+ g_debug ("removing throttle: id %u", cookie);
retval = g_dbus_proxy_call_sync (screensaver->priv->proxy,
"UnThrottle",
g_variant_new ("(s)", cookie),
@@ -181,7 +180,7 @@ gpm_screensaver_remove_throttle (GpmScreensaver *screensaver, guint cookie)
&error);
if (retval == NULL) {
/* abort as the DBUS method failed */
- egg_warning ("UnThrottle failed!: %s", error->message);
+ g_warning ("UnThrottle failed!: %s", error->message);
g_error_free (error);
return FALSE;
}
@@ -209,7 +208,7 @@ gpm_screensaver_check_running (GpmScreensaver *screensaver)
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
if (screensaver->priv->proxy == NULL) {
- egg_warning ("not connected to screensaver");
+ g_warning ("not connected to screensaver");
goto out;
}
@@ -219,7 +218,7 @@ gpm_screensaver_check_running (GpmScreensaver *screensaver)
-1, NULL, &error);
if (retval == NULL) {
- egg_debug ("ERROR: %s", error->message);
+ g_debug ("ERROR: %s", error->message);
g_error_free (error);
goto out;
}
@@ -246,11 +245,11 @@ gpm_screensaver_poke (GpmScreensaver *screensaver)
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
if (screensaver->priv->proxy == NULL) {
- egg_warning ("not connected");
+ g_warning ("not connected");
return FALSE;
}
- egg_debug ("poke");
+ g_debug ("poke");
g_dbus_proxy_call (screensaver->priv->proxy,
"SimulateUserActivity",
NULL, G_DBUS_CALL_FLAGS_NONE,
@@ -294,7 +293,7 @@ gpm_screensaver_init (GpmScreensaver *screensaver)
GS_LISTENER_INTERFACE,
NULL, &error);
if (screensaver->priv->proxy == NULL) {
- egg_warning ("failed to setup screensaver proxy: %s", error->message);
+ g_warning ("failed to setup screensaver proxy: %s", error->message);
g_error_free (error);
}
screensaver->priv->conf = gconf_client_get_default ();
diff --git a/src/gpm-self-test.c b/src/gpm-self-test.c
index c3189e2..4d70550 100644
--- a/src/gpm-self-test.c
+++ b/src/gpm-self-test.c
@@ -26,8 +26,6 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include "egg-debug.h"
-
#include "gpm-screensaver.h"
#include "gpm-dpms.h"
#include "gpm-phone.h"
@@ -36,7 +34,6 @@
#include "gpm-idletime.h"
#include "gpm-array-float.h"
-
/** ver:1.0 ***********************************************************/
static GMainLoop *_test_loop = NULL;
static guint _test_loop_timeout_id = 0;
@@ -158,7 +155,7 @@ static void
gpm_test_idle_func_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, gpointer user_data)
{
_mode = mode;
- egg_debug ("idle-changed %s", gpm_idle_mode_to_string (mode));
+ g_debug ("idle-changed %s", gpm_idle_mode_to_string (mode));
_g_test_loop_quit ();
}
@@ -301,7 +298,7 @@ gpm_test_phone_func (void)
static void
gpm_test_screensaver_func_auth_request_cb (GpmScreensaver *screensaver, gboolean auth, gpointer user_data)
{
- egg_debug ("auth request = %i", auth);
+ g_debug ("auth request = %i", auth);
test_got_request = auth;
_g_test_loop_quit ();
@@ -425,7 +422,6 @@ gpm_test_color_func (void)
g_assert_cmpint (color, ==, 0xffffff);
}
-
static void
gpm_test_array_float_func (void)
{
@@ -697,7 +693,6 @@ gpm_test_array_float_func (void)
gpm_array_float_free (kernel);
}
-
static void
gpm_test_idletime_wait (guint time_ms)
{
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index 4671a37..ff78895 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -30,13 +30,12 @@
#include <gconf/gconf-client.h>
#include <libupower-glib/upower.h>
-#include "egg-debug.h"
-
#include "gpm-array-float.h"
#include "gpm-common.h"
#include "gpm-stock-icons.h"
#include "gpm-upower.h"
#include "gpm-graph-widget.h"
+#include "gpm-debug.h"
static GtkBuilder *builder = NULL;
static GtkListStore *list_store_info = NULL;
@@ -1151,7 +1150,7 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
g_settings_set_string (settings, GPM_SETTINGS_INFO_LAST_DEVICE, current_device);
/* show transaction_id */
- egg_debug ("selected row is: %s", current_device);
+ g_debug ("selected row is: %s", current_device);
/* is special device */
if (g_strcmp0 (current_device, "wakeups") == 0) {
@@ -1164,7 +1163,7 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
}
} else {
- egg_debug ("no row selected");
+ g_debug ("no row selected");
}
}
@@ -1215,7 +1214,7 @@ gpm_stats_device_added_cb (UpClient *client, UpDevice *device, gpointer user_dat
{
const gchar *object_path;
object_path = up_device_get_object_path (device);
- egg_debug ("added: %s", object_path);
+ g_debug ("added: %s", object_path);
gpm_stats_add_device (device);
}
@@ -1229,7 +1228,7 @@ gpm_stats_device_changed_cb (UpClient *client, UpDevice *device, gpointer user_d
object_path = up_device_get_object_path (device);
if (object_path == NULL || current_device == NULL)
return;
- egg_debug ("changed: %s", object_path);
+ g_debug ("changed: %s", object_path);
if (g_strcmp0 (current_device, object_path) == 0)
gpm_stats_update_info_data (device);
}
@@ -1246,7 +1245,7 @@ gpm_stats_device_removed_cb (UpClient *client, UpDevice *device, gpointer user_d
gboolean ret;
object_path = up_device_get_object_path (device);
- egg_debug ("removed: %s", object_path);
+ g_debug ("removed: %s", object_path);
if (g_strcmp0 (current_device, object_path) == 0) {
gtk_list_store_clear (list_store_info);
}
@@ -1539,13 +1538,11 @@ gpm_stats_commandline_cb (GApplication *application,
/* TRANSLATORS: the program name */
g_option_context_set_summary (context, _("Power Statistics"));
g_option_context_add_main_entries (context, options, NULL);
+ g_option_context_add_group (context, gpm_debug_get_option_group ());
ret = g_option_context_parse (context, &argc, &argv, NULL);
if (!ret)
goto out;
- /* set debugging level */
- egg_debug_init (verbose);
-
/* get from GSettings if we never specified on the command line */
if (last_device == NULL)
last_device = g_settings_get_string (settings, GPM_SETTINGS_INFO_LAST_DEVICE);
@@ -1554,7 +1551,7 @@ gpm_stats_commandline_cb (GApplication *application,
if (last_device != NULL) {
ret = gpm_stats_highlight_device (last_device);
if (!ret)
- egg_warning ("failed to select");
+ g_warning ("failed to select");
g_free (last_device);
}
@@ -1592,7 +1589,7 @@ gpm_stats_startup_cb (GApplication *application,
builder = gtk_builder_new ();
retval = gtk_builder_add_from_file (builder, GPM_DATA "/gpm-statistics.ui", &error);
if (retval == 0) {
- egg_warning ("failed to load ui: %s", error->message);
+ g_warning ("failed to load ui: %s", error->message);
g_error_free (error);
}
diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c
index 46ded9e..a919c7c 100644
--- a/src/gpm-tray-icon.c
+++ b/src/gpm-tray-icon.c
@@ -40,8 +40,6 @@
#include <gtk/gtk.h>
#include <libupower-glib/upower.h>
-#include "egg-debug.h"
-
#include "gpm-upower.h"
#include "gpm-engine.h"
#include "gpm-common.h"
@@ -123,14 +121,14 @@ gpm_tray_icon_set_icon (GpmTrayIcon *icon, GIcon *gicon)
if (gicon != NULL) {
filename = g_icon_to_string (gicon);
- egg_debug ("Setting icon to %s", filename);
+ g_debug ("Setting icon to %s", filename);
gtk_status_icon_set_from_gicon (icon->priv->status_icon, gicon);
/* make sure that we are visible */
gpm_tray_icon_show (icon, TRUE);
} else {
/* remove icon */
- egg_debug ("no icon will be displayed");
+ g_debug ("no icon will be displayed");
/* make sure that we are hidden */
gpm_tray_icon_show (icon, FALSE);
@@ -151,7 +149,7 @@ gpm_tray_icon_show_info_cb (GtkMenuItem *item, gpointer data)
object_path = g_object_get_data (G_OBJECT (item), "object-path");
path = g_strdup_printf ("%s/gnome-power-statistics --device %s", BINDIR, object_path);
if (!g_spawn_command_line_async (path, NULL))
- egg_warning ("Couldn't execute command: %s", path);
+ g_warning ("Couldn't execute command: %s", path);
g_free (path);
}
@@ -165,7 +163,7 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data)
const gchar *command = "gnome-control-center power";
if (g_spawn_command_line_async (command, NULL) == FALSE)
- egg_warning ("Couldn't execute command: %s", command);
+ g_warning ("Couldn't execute command: %s", command);
}
/**
@@ -216,7 +214,7 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr
continue;
object_path = up_device_get_object_path (device);
- egg_debug ("adding device %s", object_path);
+ g_debug ("adding device %s", object_path);
added++;
/* generate the labels */
@@ -361,7 +359,7 @@ static void
gpm_tray_icon_popup_cleared_cd (GtkWidget *widget, GpmTrayIcon *icon)
{
g_return_if_fail (GPM_IS_TRAY_ICON (icon));
- egg_debug ("clear tray");
+ g_debug ("clear tray");
g_object_ref_sink (widget);
g_object_unref (widget);
}
@@ -396,11 +394,10 @@ gpm_tray_icon_popup_menu (GpmTrayIcon *icon, guint32 timestamp)
static void
gpm_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint32 timestamp, GpmTrayIcon *icon)
{
- egg_debug ("icon right clicked");
+ g_debug ("icon right clicked");
gpm_tray_icon_popup_menu (icon, timestamp);
}
-
/**
* gpm_tray_icon_activate_cb:
* @button: Which buttons are pressed
@@ -410,7 +407,7 @@ gpm_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint32 t
static void
gpm_tray_icon_activate_cb (GtkStatusIcon *status_icon, GpmTrayIcon *icon)
{
- egg_debug ("icon left clicked");
+ g_debug ("icon left clicked");
gpm_tray_icon_popup_menu (icon, gtk_get_current_event_time());
}
diff --git a/src/gpm-upower.c b/src/gpm-upower.c
index 7e29850..1b1c3f7 100644
--- a/src/gpm-upower.c
+++ b/src/gpm-upower.c
@@ -24,8 +24,6 @@
#include <glib/gi18n.h>
#include <libupower-glib/upower.h>
-#include "egg-debug.h"
-
#include "gpm-upower.h"
#include "gpm-common.h"
@@ -179,11 +177,11 @@ gpm_upower_get_device_icon (UpDevice *device, gboolean use_symbolic)
/* nothing matched */
if (filename->len == 0) {
- egg_warning ("nothing matched, falling back to default icon");
+ g_warning ("nothing matched, falling back to default icon");
g_string_append (filename, "dialog-warning;");
}
- egg_debug ("got filename: %s", filename->str);
+ g_debug ("got filename: %s", filename->str);
iconnames = g_strsplit (filename->str, ";", -1);
icon = g_themed_icon_new_from_names (iconnames, -1);
@@ -342,7 +340,7 @@ gpm_upower_get_device_summary (UpDevice *device)
}
/* fallback */
- egg_warning ("in an undefined state we are not charging or "
+ g_warning ("in an undefined state we are not charging or "
"discharging and the batteries are also not charged");
g_string_append (description, device_desc);
g_string_append_printf (description, " (%.0f%%)", percentage);
@@ -567,7 +565,7 @@ gpm_device_kind_to_localised_string (UpDeviceKind kind, guint number)
break;
#endif
default:
- egg_warning ("enum unrecognised: %i", kind);
+ g_warning ("enum unrecognised: %i", kind);
text = up_device_kind_to_string (kind);
}
return text;
@@ -617,7 +615,7 @@ gpm_device_kind_to_icon (UpDeviceKind kind)
break;
#endif
default:
- egg_warning ("enum unrecognised: %i", kind);
+ g_warning ("enum unrecognised: %i", kind);
icon = "gtk-help";
}
return icon;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]