diff options
45 files changed, 420 insertions, 1667 deletions
diff --git a/applets/brightness/Makefile.am b/applets/brightness/Makefile.am index 4560164..aeba0ad 100644 --- a/applets/brightness/Makefile.am +++ b/applets/brightness/Makefile.am @@ -28,8 +28,6 @@ libexec_PROGRAMS=mate-brightness-applet mate_brightness_applet_SOURCES = \ brightness-applet.c \ - egg-debug.c \ - egg-debug.h \ gpm-common.c \ gpm-common.h diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c index 168d849..3525d2b 100644 --- a/applets/brightness/brightness-applet.c +++ b/applets/brightness/brightness-applet.c @@ -35,7 +35,6 @@ #include <glib-object.h> #include <dbus/dbus-glib.h> -#include "egg-debug.h" #include "gpm-common.h" #define GPM_TYPE_BRIGHTNESS_APPLET (gpm_brightness_applet_get_type ()) @@ -121,7 +120,7 @@ gpm_applet_get_brightness (GpmBrightnessApplet *applet) guint policy_brightness; if (applet->proxy == NULL) { - egg_warning ("not connected\n"); + g_warning ("not connected\n"); return FALSE; } @@ -130,14 +129,14 @@ gpm_applet_get_brightness (GpmBrightnessApplet *applet) G_TYPE_UINT, &policy_brightness, G_TYPE_INVALID); if (error) { - egg_debug ("ERROR: %s\n", error->message); + g_debug ("ERROR: %s\n", error->message); g_error_free (error); } if (ret) { applet->level = policy_brightness; } else { /* abort as the DBUS method failed */ - egg_warning ("GetBrightness failed!\n"); + g_warning ("GetBrightness failed!\n"); } return ret; @@ -154,7 +153,7 @@ gpm_applet_set_brightness (GpmBrightnessApplet *applet) gboolean ret; if (applet->proxy == NULL) { - egg_warning ("not connected"); + g_warning ("not connected"); return FALSE; } @@ -163,12 +162,12 @@ gpm_applet_set_brightness (GpmBrightnessApplet *applet) G_TYPE_INVALID, G_TYPE_INVALID); if (error) { - egg_debug ("ERROR: %s", error->message); + g_debug ("ERROR: %s", error->message); g_error_free (error); } if (!ret) { /* abort as the DBUS method failed */ - egg_warning ("SetBrightness failed!"); + g_warning ("SetBrightness failed!"); } return ret; @@ -208,9 +207,9 @@ gpm_applet_get_icon (GpmBrightnessApplet *applet) icon, applet->size - 2, 0, NULL); if (applet->icon == NULL) { - egg_warning ("Cannot find %s!\n", icon); + g_warning ("Cannot find %s!\n", icon); } else { - egg_debug ("got icon %s!\n", icon); + g_debug ("got icon %s!\n", icon); /* update size cache */ applet->icon_height = gdk_pixbuf_get_height (applet->icon); applet->icon_width = gdk_pixbuf_get_width (applet->icon); @@ -867,7 +866,7 @@ brightness_changed_cb (DBusGProxy *proxy, guint brightness, GpmBrightnessApplet *applet) { - egg_debug ("BrightnessChanged detected: %i\n", brightness); + g_debug ("BrightnessChanged detected: %i\n", brightness); applet->level = brightness; } @@ -880,18 +879,18 @@ gpm_brightness_applet_dbus_connect (GpmBrightnessApplet *applet) GError *error = NULL; if (applet->connection == NULL) { - egg_debug ("get connection\n"); + g_debug ("get connection\n"); g_clear_error (&error); applet->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (error != 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); applet->connection = NULL; return FALSE; } } if (applet->proxy == NULL) { - egg_debug ("get proxy\n"); + g_debug ("get proxy\n"); g_clear_error (&error); applet->proxy = dbus_g_proxy_new_for_name_owner (applet->connection, GPM_DBUS_SERVICE, @@ -899,7 +898,7 @@ gpm_brightness_applet_dbus_connect (GpmBrightnessApplet *applet) GPM_DBUS_INTERFACE_BACKLIGHT, &error); if (error != NULL) { - egg_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message); + g_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message); g_error_free (error); applet->proxy = NULL; return FALSE; @@ -922,7 +921,7 @@ gboolean gpm_brightness_applet_dbus_disconnect (GpmBrightnessApplet *applet) { if (applet->proxy != NULL) { - egg_debug ("removing proxy\n"); + g_debug ("removing proxy\n"); g_object_unref (applet->proxy); applet->proxy = NULL; } diff --git a/applets/brightness/egg-debug.c b/applets/brightness/egg-debug.c deleted file mode 100644 index 2f140f2..0000000 --- a/applets/brightness/egg-debug.c +++ /dev/null @@ -1,308 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007-2008 Richard Hughes <[email protected]> - * - * 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. - */ - -/** - * SECTION:egg-debug - * @short_description: Debugging functions - * - * This file contains functions that can be used for debugging. - */ - -#include <glib.h> -#include <glib/gi18n.h> -#include <glib/gprintf.h> -#include <stdio.h> -#include <string.h> -#include <stdarg.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#include <execinfo.h> - -#include "egg-debug.h" - -#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 - -static gint fd = -1; - -/** - * pk_set_console_mode: - **/ -static void -pk_set_console_mode (guint console_code) -{ - gchar command[13]; - - /* don't put extra commands into logs */ - if (!egg_debug_is_console ()) - return; - - /* Command is the control command to the terminal */ - g_snprintf (command, 13, "%c[%dm", 0x1B, console_code); - printf ("%s", command); -} - -/** - * egg_debug_backtrace: - **/ -void -egg_debug_backtrace (void) -{ - void *call_stack[512]; - int call_stack_size; - char **symbols; - int i = 1; - - call_stack_size = backtrace (call_stack, G_N_ELEMENTS (call_stack)); - symbols = backtrace_symbols (call_stack, call_stack_size); - if (symbols != NULL) { - pk_set_console_mode (CONSOLE_RED); - g_print ("Traceback:\n"); - while (i < call_stack_size) { - g_print ("\t%s\n", symbols[i]); - i++; - } - pk_set_console_mode (CONSOLE_RESET); - free (symbols); - } -} - -/** - * pk_log_line: - **/ -static void -pk_log_line (const gchar *buffer) -{ - ssize_t count; - /* open a file */ - if (fd == -1) { - /* ITS4: ignore, /var/log/foo is owned by root, and this is just debug text */ - fd = open (EGG_LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0777); - if (fd == -1) - g_error ("could not open log: '%s'", EGG_LOG_FILE); - } - - /* ITS4: ignore, debug text always NULL terminated */ - count = write (fd, buffer, strlen (buffer)); - if (count == -1) - g_warning ("could not write %s", buffer); - /* newline */ - count = write (fd, "\n", 1); - if (count == -1) - g_warning ("could not write newline"); -} - -/** - * pk_print_line: - **/ -static void -pk_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color) -{ - gchar *str_time; - gchar *header; - time_t the_time; - GThread *thread; - - time (&the_time); - str_time = g_new0 (gchar, 255); - strftime (str_time, 254, "%H:%M:%S", localtime (&the_time)); - thread = g_thread_self (); - - /* generate header text */ - header = g_strdup_printf ("TI:%s\tTH:%p\tFI:%s\tFN:%s,%d", str_time, thread, file, func, line); - g_free (str_time); - - /* always in light green */ - pk_set_console_mode (CONSOLE_GREEN); - printf ("%s\n", header); - - /* different colors according to the severity */ - pk_set_console_mode (color); - printf (" - %s\n", buffer); - pk_set_console_mode (CONSOLE_RESET); - - /* log to a file */ - if (egg_debug_is_logging ()) { - pk_log_line (header); - pk_log_line (buffer); - } - - /* flush this output, as we need to debug */ - fflush (stdout); - - g_free (header); -} - -/** - * egg_debug_real: - **/ -void -egg_debug_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - if (!egg_debug_enabled ()) - return; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - pk_print_line (func, file, line, buffer, CONSOLE_BLUE); - - g_free(buffer); -} - -/** - * egg_warning_real: - **/ -void -egg_warning_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - if (!egg_debug_enabled ()) - return; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - /* do extra stuff for a warning */ - if (!egg_debug_is_console ()) - printf ("*** WARNING ***\n"); - pk_print_line (func, file, line, buffer, CONSOLE_RED); - - g_free(buffer); -} - -/** - * egg_error_real: - **/ -void -egg_error_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - /* do extra stuff for a warning */ - if (!egg_debug_is_console ()) - printf ("*** ERROR ***\n"); - pk_print_line (func, file, line, buffer, CONSOLE_RED); - g_free(buffer); - - /* we want to fix this! */ - egg_debug_backtrace (); - - exit (1); -} - -/** - * egg_debug_enabled: - * - * Returns: TRUE if we have debugging enabled - **/ -gboolean -egg_debug_enabled (void) -{ - const gchar *env; - env = g_getenv (EGG_VERBOSE); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_is_logging: - * - * Returns: TRUE if we have logging enabled - **/ -gboolean -egg_debug_is_logging (void) -{ - const gchar *env; - env = g_getenv (EGG_LOGGING); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_is_console: - * - * Returns: TRUE if we have debugging enabled - **/ -gboolean -egg_debug_is_console (void) -{ - const gchar *env; - env = g_getenv (EGG_CONSOLE); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_set_logging: - **/ -void -egg_debug_set_logging (gboolean enabled) -{ - if (enabled) - g_setenv (EGG_LOGGING, "1", TRUE); - else - g_setenv (EGG_LOGGING, "0", TRUE); - - if (egg_debug_is_logging ()) - egg_debug ("logging to %s", EGG_LOG_FILE); -} - -/** - * egg_debug_init: - * @debug: If we should print out verbose logging - **/ -void -egg_debug_init (gboolean debug) -{ - /* check if we are on console */ - if (isatty (fileno (stdout)) == 1) - g_setenv (EGG_CONSOLE, "1", FALSE); - else - g_setenv (EGG_CONSOLE, "0", FALSE); - if (debug) - g_setenv (EGG_VERBOSE, "1", FALSE); - else - g_setenv (EGG_VERBOSE, "0", FALSE); - egg_debug ("Verbose debugging %i (on console %i)%s", egg_debug_enabled (), egg_debug_is_console (), EGG_VERBOSE); -} - diff --git a/applets/brightness/egg-debug.h b/applets/brightness/egg-debug.h deleted file mode 100644 index fdfb02b..0000000 --- a/applets/brightness/egg-debug.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007-2008 Richard Hughes <[email protected]> - * - * 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 __EGG_DEBUG_H -#define __EGG_DEBUG_H - -#include <stdarg.h> -#include <glib.h> - -G_BEGIN_DECLS - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -/** - * egg_debug: - * - * Non critical debugging - */ -#define egg_debug(...) egg_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -/** - * egg_warning: - * - * Important debugging - */ -#define egg_warning(...) egg_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -/** - * egg_error: - * - * Critical debugging, with exit - */ -#define egg_error(...) egg_error_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -#elif defined(__GNUC__) && __GNUC__ >= 3 -#define egg_debug(...) egg_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#define egg_warning(...) egg_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#define egg_error(...) egg_error_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#else -#define egg_debug(...) -#define egg_warning(...) -#define egg_error(...) -#endif - -void egg_debug_init (gboolean debug); -void egg_debug_set_logging (gboolean enabled); -gboolean egg_debug_enabled (void); -gboolean egg_debug_is_logging (void); -gboolean egg_debug_is_console (void); -void egg_debug_backtrace (void); -void egg_debug_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) __attribute__((format (printf,4,5))); -void egg_warning_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) __attribute__((format (printf,4,5))); -void egg_error_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5))); - -G_END_DECLS - -#endif /* __EGG_DEBUG_H */ diff --git a/applets/brightness/gpm-common.c b/applets/brightness/gpm-common.c index 9ebfbf0..da278d0 100644 --- a/applets/brightness/gpm-common.c +++ b/applets/brightness/gpm-common.c @@ -27,7 +27,6 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> -#include "egg-debug.h" #include "gpm-common.h" /** diff --git a/applets/inhibit/Makefile.am b/applets/inhibit/Makefile.am index 3ec2f90..116f4e1 100644 --- a/applets/inhibit/Makefile.am +++ b/applets/inhibit/Makefile.am @@ -28,8 +28,6 @@ libexec_PROGRAMS=mate-inhibit-applet mate_inhibit_applet_SOURCES = \ inhibit-applet.c \ - egg-debug.c \ - egg-debug.h \ gpm-common.c \ gpm-common.h diff --git a/applets/inhibit/egg-debug.c b/applets/inhibit/egg-debug.c deleted file mode 100644 index 2f140f2..0000000 --- a/applets/inhibit/egg-debug.c +++ /dev/null @@ -1,308 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007-2008 Richard Hughes <[email protected]> - * - * 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. - */ - -/** - * SECTION:egg-debug - * @short_description: Debugging functions - * - * This file contains functions that can be used for debugging. - */ - -#include <glib.h> -#include <glib/gi18n.h> -#include <glib/gprintf.h> -#include <stdio.h> -#include <string.h> -#include <stdarg.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#include <execinfo.h> - -#include "egg-debug.h" - -#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 - -static gint fd = -1; - -/** - * pk_set_console_mode: - **/ -static void -pk_set_console_mode (guint console_code) -{ - gchar command[13]; - - /* don't put extra commands into logs */ - if (!egg_debug_is_console ()) - return; - - /* Command is the control command to the terminal */ - g_snprintf (command, 13, "%c[%dm", 0x1B, console_code); - printf ("%s", command); -} - -/** - * egg_debug_backtrace: - **/ -void -egg_debug_backtrace (void) -{ - void *call_stack[512]; - int call_stack_size; - char **symbols; - int i = 1; - - call_stack_size = backtrace (call_stack, G_N_ELEMENTS (call_stack)); - symbols = backtrace_symbols (call_stack, call_stack_size); - if (symbols != NULL) { - pk_set_console_mode (CONSOLE_RED); - g_print ("Traceback:\n"); - while (i < call_stack_size) { - g_print ("\t%s\n", symbols[i]); - i++; - } - pk_set_console_mode (CONSOLE_RESET); - free (symbols); - } -} - -/** - * pk_log_line: - **/ -static void -pk_log_line (const gchar *buffer) -{ - ssize_t count; - /* open a file */ - if (fd == -1) { - /* ITS4: ignore, /var/log/foo is owned by root, and this is just debug text */ - fd = open (EGG_LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0777); - if (fd == -1) - g_error ("could not open log: '%s'", EGG_LOG_FILE); - } - - /* ITS4: ignore, debug text always NULL terminated */ - count = write (fd, buffer, strlen (buffer)); - if (count == -1) - g_warning ("could not write %s", buffer); - /* newline */ - count = write (fd, "\n", 1); - if (count == -1) - g_warning ("could not write newline"); -} - -/** - * pk_print_line: - **/ -static void -pk_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color) -{ - gchar *str_time; - gchar *header; - time_t the_time; - GThread *thread; - - time (&the_time); - str_time = g_new0 (gchar, 255); - strftime (str_time, 254, "%H:%M:%S", localtime (&the_time)); - thread = g_thread_self (); - - /* generate header text */ - header = g_strdup_printf ("TI:%s\tTH:%p\tFI:%s\tFN:%s,%d", str_time, thread, file, func, line); - g_free (str_time); - - /* always in light green */ - pk_set_console_mode (CONSOLE_GREEN); - printf ("%s\n", header); - - /* different colors according to the severity */ - pk_set_console_mode (color); - printf (" - %s\n", buffer); - pk_set_console_mode (CONSOLE_RESET); - - /* log to a file */ - if (egg_debug_is_logging ()) { - pk_log_line (header); - pk_log_line (buffer); - } - - /* flush this output, as we need to debug */ - fflush (stdout); - - g_free (header); -} - -/** - * egg_debug_real: - **/ -void -egg_debug_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - if (!egg_debug_enabled ()) - return; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - pk_print_line (func, file, line, buffer, CONSOLE_BLUE); - - g_free(buffer); -} - -/** - * egg_warning_real: - **/ -void -egg_warning_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - if (!egg_debug_enabled ()) - return; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - /* do extra stuff for a warning */ - if (!egg_debug_is_console ()) - printf ("*** WARNING ***\n"); - pk_print_line (func, file, line, buffer, CONSOLE_RED); - - g_free(buffer); -} - -/** - * egg_error_real: - **/ -void -egg_error_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - /* do extra stuff for a warning */ - if (!egg_debug_is_console ()) - printf ("*** ERROR ***\n"); - pk_print_line (func, file, line, buffer, CONSOLE_RED); - g_free(buffer); - - /* we want to fix this! */ - egg_debug_backtrace (); - - exit (1); -} - -/** - * egg_debug_enabled: - * - * Returns: TRUE if we have debugging enabled - **/ -gboolean -egg_debug_enabled (void) -{ - const gchar *env; - env = g_getenv (EGG_VERBOSE); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_is_logging: - * - * Returns: TRUE if we have logging enabled - **/ -gboolean -egg_debug_is_logging (void) -{ - const gchar *env; - env = g_getenv (EGG_LOGGING); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_is_console: - * - * Returns: TRUE if we have debugging enabled - **/ -gboolean -egg_debug_is_console (void) -{ - const gchar *env; - env = g_getenv (EGG_CONSOLE); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_set_logging: - **/ -void -egg_debug_set_logging (gboolean enabled) -{ - if (enabled) - g_setenv (EGG_LOGGING, "1", TRUE); - else - g_setenv (EGG_LOGGING, "0", TRUE); - - if (egg_debug_is_logging ()) - egg_debug ("logging to %s", EGG_LOG_FILE); -} - -/** - * egg_debug_init: - * @debug: If we should print out verbose logging - **/ -void -egg_debug_init (gboolean debug) -{ - /* check if we are on console */ - if (isatty (fileno (stdout)) == 1) - g_setenv (EGG_CONSOLE, "1", FALSE); - else - g_setenv (EGG_CONSOLE, "0", FALSE); - if (debug) - g_setenv (EGG_VERBOSE, "1", FALSE); - else - g_setenv (EGG_VERBOSE, "0", FALSE); - egg_debug ("Verbose debugging %i (on console %i)%s", egg_debug_enabled (), egg_debug_is_console (), EGG_VERBOSE); -} - diff --git a/applets/inhibit/egg-debug.h b/applets/inhibit/egg-debug.h deleted file mode 100644 index fdfb02b..0000000 --- a/applets/inhibit/egg-debug.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007-2008 Richard Hughes <[email protected]> - * - * 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 __EGG_DEBUG_H -#define __EGG_DEBUG_H - -#include <stdarg.h> -#include <glib.h> - -G_BEGIN_DECLS - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -/** - * egg_debug: - * - * Non critical debugging - */ -#define egg_debug(...) egg_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -/** - * egg_warning: - * - * Important debugging - */ -#define egg_warning(...) egg_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -/** - * egg_error: - * - * Critical debugging, with exit - */ -#define egg_error(...) egg_error_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -#elif defined(__GNUC__) && __GNUC__ >= 3 -#define egg_debug(...) egg_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#define egg_warning(...) egg_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#define egg_error(...) egg_error_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#else -#define egg_debug(...) -#define egg_warning(...) -#define egg_error(...) -#endif - -void egg_debug_init (gboolean debug); -void egg_debug_set_logging (gboolean enabled); -gboolean egg_debug_enabled (void); -gboolean egg_debug_is_logging (void); -gboolean egg_debug_is_console (void); -void egg_debug_backtrace (void); -void egg_debug_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) __attribute__((format (printf,4,5))); -void egg_warning_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) __attribute__((format (printf,4,5))); -void egg_error_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5))); - -G_END_DECLS - -#endif /* __EGG_DEBUG_H */ diff --git a/applets/inhibit/gpm-common.c b/applets/inhibit/gpm-common.c index 9ebfbf0..da278d0 100644 --- a/applets/inhibit/gpm-common.c +++ b/applets/inhibit/gpm-common.c @@ -27,7 +27,6 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> -#include "egg-debug.h" #include "gpm-common.h" /** diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c index 82403b3..108f335 100644 --- a/applets/inhibit/inhibit-applet.c +++ b/applets/inhibit/inhibit-applet.c @@ -34,7 +34,6 @@ #include <glib/gi18n.h> #include <dbus/dbus-glib.h> -#include "egg-debug.h" #include "gpm-common.h" #define GPM_TYPE_INHIBIT_APPLET (gpm_inhibit_applet_get_type ()) @@ -103,7 +102,7 @@ gpm_applet_inhibit (GpmInhibitApplet *applet, g_return_val_if_fail (cookie != NULL, FALSE); if (applet->proxy == NULL) { - egg_warning ("not connected\n"); + g_warning ("not connected\n"); return FALSE; } @@ -136,7 +135,7 @@ gpm_applet_uninhibit (GpmInhibitApplet *applet, gboolean ret; if (applet->proxy == NULL) { - egg_warning ("not connected"); + g_warning ("not connected"); return FALSE; } @@ -367,18 +366,18 @@ gpm_inhibit_applet_dbus_connect (GpmInhibitApplet *applet) GError *error = NULL; if (applet->connection == NULL) { - egg_debug ("get connection\n"); + g_debug ("get connection\n"); g_clear_error (&error); applet->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (error != 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); applet->connection = NULL; return FALSE; } } if (applet->proxy == NULL) { - egg_debug ("get proxy\n"); + g_debug ("get proxy\n"); g_clear_error (&error); applet->proxy = dbus_g_proxy_new_for_name_owner (applet->connection, GS_DBUS_SERVICE, @@ -386,7 +385,7 @@ gpm_inhibit_applet_dbus_connect (GpmInhibitApplet *applet) GS_DBUS_INTERFACE, &error); if (error != NULL) { - egg_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message); + g_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message); g_error_free (error); applet->proxy = NULL; return FALSE; @@ -402,7 +401,7 @@ gboolean gpm_inhibit_applet_dbus_disconnect (GpmInhibitApplet *applet) { if (applet->proxy != NULL) { - egg_debug ("removing proxy\n"); + g_debug ("removing proxy\n"); g_object_unref (applet->proxy); applet->proxy = NULL; /* we have no inhibit, these are not persistent across reboots */ diff --git a/data/mate-power-manager.1 b/data/mate-power-manager.1 index 43c41e3..c568507 100644 --- a/data/mate-power-manager.1 +++ b/data/mate-power-manager.1 @@ -2,7 +2,7 @@ .SH NAME mate-power-manager \- MATE power manager userspace daemon .SH SYNOPSIS -\fBmate-power-manager\fR [ \fB\-\-verbose\fR ] [ \fB\-\-debug\fR ] [ \fB\-\-help\fR ] +\fBmate-power-manager\fR [ \fB\-\-help\fR ] .SH "DESCRIPTION" \fBmate-power-manager\fR is the backend program of the MATE power management infrastructure providing a complete and integrated solution to power management under the MATE desktop environment. .PP @@ -12,14 +12,8 @@ It supports features such as suspending, hibernating, screen blanking, cpu frequ \fB\-\-help\fR Show summary of options. .TP -\fB\-\-verbose\fR -Show extra debugging. -.TP \fB\-\-no-daemon\fR Do not detach \fBmate-power-manager\fR into the background so that error messages will be displayed on console. -.TP -\fB\-\-debug\fR -Only show specific debugging options. Useful for developers only. .SH "SEE ALSO" .PP mate-power-preferences (1). diff --git a/data/mate-power-preferences.1 b/data/mate-power-preferences.1 index f160c64..f53fed8 100644 --- a/data/mate-power-preferences.1 +++ b/data/mate-power-preferences.1 @@ -2,16 +2,13 @@ .SH NAME mate-power-preferences \- MATE power preferences GUI .SH SYNOPSIS -\fBmate-power-preferences\fR [ \fB\-\-verbose\fR ] [ \fB\-\-help\fR ] +\fBmate-power-preferences\fR [ \fB\-\-help\fR ] .SH "DESCRIPTION" \fBmate-power-preferences\fR is the gui program for the mate power management infrastructure .SH "OPTIONS" .TP \fB\-\-help\fR Show summary of options. -.TP -\fB\-\-verbose\fR -Show extra debugging. .SH "SEE ALSO" .PP mate-power-manager (1). diff --git a/data/mate-power-statistics.1 b/data/mate-power-statistics.1 index 38a2785..5dc1be5 100644 --- a/data/mate-power-statistics.1 +++ b/data/mate-power-statistics.1 @@ -2,7 +2,7 @@ .SH NAME mate-power-statistics \- MATE power statistics GUI .SH SYNOPSIS -\fBmate-power-statistics\fR [ \fB\-\-verbose\fR ] [ \fB\-\-help\fR ] +\fBmate-power-statistics\fR [ \fB\-\-help\fR ] .SH "DESCRIPTION" \fBmate-power-statistics\fR is the gui program for the mate power management infrastructure. .PP @@ -11,9 +11,6 @@ It allows users to visualize the power consumption of laptop hardware. .TP \fB\-\-help\fR Show summary of options. -.TP -\fB\-\-verbose\fR -Show extra debugging. .SH "SEE ALSO" .PP mate-power-manager (1), mate-power-preferences (1). diff --git a/help/C/index.docbook b/help/C/index.docbook index f5bf494..5a99169 100644 --- a/help/C/index.docbook +++ b/help/C/index.docbook @@ -150,7 +150,7 @@ <term>Command line</term> <listitem> <para> - Type <command>mate-power-manager --verbose --no-daemon</command>, + Type <command>G_MESSAGES_DEBUG=PowerManager mate-power-manager --no-daemon</command>, then press <keycap>Return</keycap>: </para> </listitem> diff --git a/src/Makefile.am b/src/Makefile.am index 1778cef..ef097af 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,10 +32,7 @@ AM_CPPFLAGS = \ -DGPM_ICONS_DATA=\"$(pkgdatadir)/icons\" \ -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) \ $(DISABLE_DEPRECATED) @@ -60,8 +57,6 @@ noinst_LIBRARIES = libgpmshared.a libgpmshared_a_SOURCES = \ egg-color.c \ egg-color.h \ - egg-debug.h \ - egg-debug.c \ egg-precision.h \ egg-precision.c \ egg-array-float.c \ @@ -222,8 +217,6 @@ mate_power_self_test_SOURCES = \ egg-color.c \ egg-test.h \ egg-test.c \ - egg-debug.h \ - egg-debug.c \ egg-precision.h \ egg-precision.c \ egg-idletime.h \ diff --git a/src/egg-array-float.c b/src/egg-array-float.c index 51f8594..711f0ae 100644 --- a/src/egg-array-float.c +++ b/src/egg-array-float.c @@ -29,7 +29,6 @@ #include <glib.h> -#include "egg-debug.h" #include "egg-array-float.h" /** @@ -150,7 +149,7 @@ egg_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) = egg_array_float_guassian_value (division, sigma); } @@ -163,7 +162,7 @@ egg_array_float_compute_gaussian (guint length, gfloat sigma) /* make sure we get an accurate gaussian */ value = egg_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_warning ("got wrong sum (%f), perhaps sigma too high for size?", value); egg_array_float_free (array); array = NULL; } @@ -207,7 +206,7 @@ egg_array_float_print (EggArrayFloat *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/egg-console-kit.c b/src/egg-console-kit.c index 32a81bd..3c3c977 100644 --- a/src/egg-console-kit.c +++ b/src/egg-console-kit.c @@ -28,7 +28,6 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus.h> -#include "egg-debug.h" #include "egg-console-kit.h" static void egg_console_kit_finalize (GObject *object); @@ -75,7 +74,7 @@ egg_console_kit_restart (EggConsoleKit *console, GError **error) ret = dbus_g_proxy_call (console->priv->proxy_manager, "Restart", &error_local, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't restart: %s", error_local->message); + g_warning ("Couldn't restart: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -98,7 +97,7 @@ egg_console_kit_stop (EggConsoleKit *console, GError **error) ret = dbus_g_proxy_call (console->priv->proxy_manager, "Stop", &error_local, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't stop: %s", error_local->message); + g_warning ("Couldn't stop: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -122,7 +121,7 @@ egg_console_kit_suspend (EggConsoleKit *console, GError **error) G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't suspend: %s", error_local->message); + g_warning ("Couldn't suspend: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -146,7 +145,7 @@ egg_console_kit_hibernate (EggConsoleKit *console, GError **error) G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't hibernate: %s", error_local->message); + g_warning ("Couldn't hibernate: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -170,7 +169,7 @@ egg_console_kit_can_stop (EggConsoleKit *console, gboolean *can_stop, GError **e G_TYPE_INVALID, G_TYPE_BOOLEAN, can_stop, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't do CanStop: %s", error_local->message); + g_warning ("Couldn't do CanStop: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -197,7 +196,7 @@ egg_console_kit_can_restart (EggConsoleKit *console, gboolean *can_restart, GErr G_TYPE_INVALID, G_TYPE_BOOLEAN, can_restart, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't do CanRestart: %s", error_local->message); + g_warning ("Couldn't do CanRestart: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -225,7 +224,7 @@ egg_console_kit_can_suspend (EggConsoleKit *console, gboolean *can_suspend, GErr G_TYPE_INVALID, G_TYPE_STRING, &retval, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't do CanSuspend: %s", error_local->message); + g_warning ("Couldn't do CanSuspend: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -256,7 +255,7 @@ egg_console_kit_can_hibernate (EggConsoleKit *console, gboolean *can_hibernate, G_TYPE_INVALID, G_TYPE_STRING, &retval, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't do CanHibernate: %s", error_local->message); + g_warning ("Couldn't do CanHibernate: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -283,7 +282,7 @@ egg_console_kit_is_local (EggConsoleKit *console) /* 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; } @@ -318,7 +317,7 @@ egg_console_kit_is_active (EggConsoleKit *console) /* 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; } @@ -343,7 +342,7 @@ out: static void egg_console_kit_active_changed_cb (DBusGProxy *proxy, gboolean active, EggConsoleKit *console) { - egg_debug ("emitting active: %i", active); + g_debug ("emitting active: %i", active); g_signal_emit (console, signals [EGG_CONSOLE_KIT_ACTIVE_CHANGED], 0, active); } @@ -382,7 +381,7 @@ egg_console_kit_init (EggConsoleKit *console) /* connect to D-Bus */ console->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (console->priv->connection == NULL) { - egg_warning ("Failed to connect to the D-Bus daemon: %s", error->message); + g_warning ("Failed to connect to the D-Bus daemon: %s", error->message); g_error_free (error); goto out; } @@ -392,7 +391,7 @@ egg_console_kit_init (EggConsoleKit *console) dbus_g_proxy_new_for_name (console->priv->connection, CONSOLEKIT_NAME, CONSOLEKIT_MANAGER_PATH, CONSOLEKIT_MANAGER_INTERFACE); if (console->priv->proxy_manager == NULL) { - egg_warning ("cannot connect to ConsoleKit"); + g_warning ("cannot connect to ConsoleKit"); goto out; } @@ -404,18 +403,18 @@ egg_console_kit_init (EggConsoleKit *console) DBUS_TYPE_G_OBJECT_PATH, &console->priv->session_id, G_TYPE_INVALID); if (!ret) { - 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; } - 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 = dbus_g_proxy_new_for_name (console->priv->connection, CONSOLEKIT_NAME, console->priv->session_id, CONSOLEKIT_SESSION_INTERFACE); if (console->priv->proxy_session == NULL) { - egg_warning ("cannot connect to: %s", console->priv->session_id); + g_warning ("cannot connect to: %s", console->priv->session_id); goto out; } dbus_g_proxy_add_signal (console->priv->proxy_session, "ActiveChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); diff --git a/src/egg-debug.c b/src/egg-debug.c deleted file mode 100644 index 2f140f2..0000000 --- a/src/egg-debug.c +++ /dev/null @@ -1,308 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007-2008 Richard Hughes <[email protected]> - * - * 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. - */ - -/** - * SECTION:egg-debug - * @short_description: Debugging functions - * - * This file contains functions that can be used for debugging. - */ - -#include <glib.h> -#include <glib/gi18n.h> -#include <glib/gprintf.h> -#include <stdio.h> -#include <string.h> -#include <stdarg.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#include <execinfo.h> - -#include "egg-debug.h" - -#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 - -static gint fd = -1; - -/** - * pk_set_console_mode: - **/ -static void -pk_set_console_mode (guint console_code) -{ - gchar command[13]; - - /* don't put extra commands into logs */ - if (!egg_debug_is_console ()) - return; - - /* Command is the control command to the terminal */ - g_snprintf (command, 13, "%c[%dm", 0x1B, console_code); - printf ("%s", command); -} - -/** - * egg_debug_backtrace: - **/ -void -egg_debug_backtrace (void) -{ - void *call_stack[512]; - int call_stack_size; - char **symbols; - int i = 1; - - call_stack_size = backtrace (call_stack, G_N_ELEMENTS (call_stack)); - symbols = backtrace_symbols (call_stack, call_stack_size); - if (symbols != NULL) { - pk_set_console_mode (CONSOLE_RED); - g_print ("Traceback:\n"); - while (i < call_stack_size) { - g_print ("\t%s\n", symbols[i]); - i++; - } - pk_set_console_mode (CONSOLE_RESET); - free (symbols); - } -} - -/** - * pk_log_line: - **/ -static void -pk_log_line (const gchar *buffer) -{ - ssize_t count; - /* open a file */ - if (fd == -1) { - /* ITS4: ignore, /var/log/foo is owned by root, and this is just debug text */ - fd = open (EGG_LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0777); - if (fd == -1) - g_error ("could not open log: '%s'", EGG_LOG_FILE); - } - - /* ITS4: ignore, debug text always NULL terminated */ - count = write (fd, buffer, strlen (buffer)); - if (count == -1) - g_warning ("could not write %s", buffer); - /* newline */ - count = write (fd, "\n", 1); - if (count == -1) - g_warning ("could not write newline"); -} - -/** - * pk_print_line: - **/ -static void -pk_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color) -{ - gchar *str_time; - gchar *header; - time_t the_time; - GThread *thread; - - time (&the_time); - str_time = g_new0 (gchar, 255); - strftime (str_time, 254, "%H:%M:%S", localtime (&the_time)); - thread = g_thread_self (); - - /* generate header text */ - header = g_strdup_printf ("TI:%s\tTH:%p\tFI:%s\tFN:%s,%d", str_time, thread, file, func, line); - g_free (str_time); - - /* always in light green */ - pk_set_console_mode (CONSOLE_GREEN); - printf ("%s\n", header); - - /* different colors according to the severity */ - pk_set_console_mode (color); - printf (" - %s\n", buffer); - pk_set_console_mode (CONSOLE_RESET); - - /* log to a file */ - if (egg_debug_is_logging ()) { - pk_log_line (header); - pk_log_line (buffer); - } - - /* flush this output, as we need to debug */ - fflush (stdout); - - g_free (header); -} - -/** - * egg_debug_real: - **/ -void -egg_debug_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - if (!egg_debug_enabled ()) - return; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - pk_print_line (func, file, line, buffer, CONSOLE_BLUE); - - g_free(buffer); -} - -/** - * egg_warning_real: - **/ -void -egg_warning_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - if (!egg_debug_enabled ()) - return; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - /* do extra stuff for a warning */ - if (!egg_debug_is_console ()) - printf ("*** WARNING ***\n"); - pk_print_line (func, file, line, buffer, CONSOLE_RED); - - g_free(buffer); -} - -/** - * egg_error_real: - **/ -void -egg_error_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...) -{ - va_list args; - gchar *buffer = NULL; - - va_start (args, format); - g_vasprintf (&buffer, format, args); - va_end (args); - - /* do extra stuff for a warning */ - if (!egg_debug_is_console ()) - printf ("*** ERROR ***\n"); - pk_print_line (func, file, line, buffer, CONSOLE_RED); - g_free(buffer); - - /* we want to fix this! */ - egg_debug_backtrace (); - - exit (1); -} - -/** - * egg_debug_enabled: - * - * Returns: TRUE if we have debugging enabled - **/ -gboolean -egg_debug_enabled (void) -{ - const gchar *env; - env = g_getenv (EGG_VERBOSE); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_is_logging: - * - * Returns: TRUE if we have logging enabled - **/ -gboolean -egg_debug_is_logging (void) -{ - const gchar *env; - env = g_getenv (EGG_LOGGING); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_is_console: - * - * Returns: TRUE if we have debugging enabled - **/ -gboolean -egg_debug_is_console (void) -{ - const gchar *env; - env = g_getenv (EGG_CONSOLE); - return (g_strcmp0 (env, "1") == 0); -} - -/** - * egg_debug_set_logging: - **/ -void -egg_debug_set_logging (gboolean enabled) -{ - if (enabled) - g_setenv (EGG_LOGGING, "1", TRUE); - else - g_setenv (EGG_LOGGING, "0", TRUE); - - if (egg_debug_is_logging ()) - egg_debug ("logging to %s", EGG_LOG_FILE); -} - -/** - * egg_debug_init: - * @debug: If we should print out verbose logging - **/ -void -egg_debug_init (gboolean debug) -{ - /* check if we are on console */ - if (isatty (fileno (stdout)) == 1) - g_setenv (EGG_CONSOLE, "1", FALSE); - else - g_setenv (EGG_CONSOLE, "0", FALSE); - if (debug) - g_setenv (EGG_VERBOSE, "1", FALSE); - else - g_setenv (EGG_VERBOSE, "0", FALSE); - egg_debug ("Verbose debugging %i (on console %i)%s", egg_debug_enabled (), egg_debug_is_console (), EGG_VERBOSE); -} - diff --git a/src/egg-debug.h b/src/egg-debug.h deleted file mode 100644 index fdfb02b..0000000 --- a/src/egg-debug.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007-2008 Richard Hughes <[email protected]> - * - * 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 __EGG_DEBUG_H -#define __EGG_DEBUG_H - -#include <stdarg.h> -#include <glib.h> - -G_BEGIN_DECLS - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -/** - * egg_debug: - * - * Non critical debugging - */ -#define egg_debug(...) egg_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -/** - * egg_warning: - * - * Important debugging - */ -#define egg_warning(...) egg_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -/** - * egg_error: - * - * Critical debugging, with exit - */ -#define egg_error(...) egg_error_real (__func__, __FILE__, __LINE__, __VA_ARGS__) - -#elif defined(__GNUC__) && __GNUC__ >= 3 -#define egg_debug(...) egg_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#define egg_warning(...) egg_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#define egg_error(...) egg_error_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) -#else -#define egg_debug(...) -#define egg_warning(...) -#define egg_error(...) -#endif - -void egg_debug_init (gboolean debug); -void egg_debug_set_logging (gboolean enabled); -gboolean egg_debug_enabled (void); -gboolean egg_debug_is_logging (void); -gboolean egg_debug_is_console (void); -void egg_debug_backtrace (void); -void egg_debug_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) __attribute__((format (printf,4,5))); -void egg_warning_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) __attribute__((format (printf,4,5))); -void egg_error_real (const gchar *func, - const gchar *file, - int line, - const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5))); - -G_END_DECLS - -#endif /* __EGG_DEBUG_H */ diff --git a/src/egg-discrete.c b/src/egg-discrete.c index fe910cc..603217d 100644 --- a/src/egg-discrete.c +++ b/src/egg-discrete.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <glib.h> -#include "egg-debug.h" #include "egg-discrete.h" /** @@ -44,7 +43,7 @@ egg_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 (guint) ((((gfloat) percentage * (gfloat) (levels - 1)) / 100.0f) + 0.5f); @@ -66,7 +65,7 @@ egg_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))) + 0.5f); @@ -88,7 +87,7 @@ egg_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/egg-precision.c b/src/egg-precision.c index 02f0cce..bc4e07b 100644 --- a/src/egg-precision.c +++ b/src/egg-precision.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <glib.h> -#include "egg-debug.h" #include "egg-precision.h" /** @@ -45,7 +44,7 @@ egg_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; @@ -72,7 +71,7 @@ egg_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; diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c index 21eed90..47a1b1b 100644 --- a/src/gpm-backlight.c +++ b/src/gpm-backlight.c @@ -46,7 +46,6 @@ #include "gpm-brightness.h" #include "gpm-control.h" #include "gpm-common.h" -#include "egg-debug.h" #include "gsd-media-keys-window.h" #include "gpm-dpms.h" #include "gpm-idle.h" @@ -158,7 +157,7 @@ gpm_backlight_set_brightness (GpmBacklight *backlight, guint percentage, GError } /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - egg_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %i", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } return ret; @@ -285,19 +284,19 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int guint old_value; if (backlight->priv->can_dim == FALSE) { - egg_warning ("no dimming hardware"); + g_warning ("no dimming hardware"); return FALSE; } do_laptop_lcd = g_settings_get_boolean (backlight->priv->settings, GPM_SETTINGS_BACKLIGHT_ENABLE); if (do_laptop_lcd == FALSE) { - egg_warning ("policy is no dimming"); + g_warning ("policy is no dimming"); return FALSE; } /* get the last set brightness */ brightness = backlight->priv->master_percentage / 100.0f; - egg_debug ("1. main brightness %f", brightness); + g_debug ("1. main brightness %f", brightness); /* get battery status */ g_object_get (backlight->priv->client, @@ -306,12 +305,12 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int /* reduce if on battery power if we should */ if (use_initial) { - egg_debug ("Setting initial brightness level"); + g_debug ("Setting initial brightness level"); battery_reduce = g_settings_get_boolean (backlight->priv->settings, GPM_SETTINGS_BACKLIGHT_BATTERY_REDUCE); if (on_battery && battery_reduce) { value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_DIM_BATT); if (value > 100) { - egg_warning ("cannot use battery brightness value %i, correcting to 50", value); + g_warning ("cannot use battery brightness value %i, correcting to 50", value); value = 50; } scale = (100 - value) / 100.0f; @@ -319,7 +318,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int } else { scale = 1.0f; } - egg_debug ("2. battery scale %f, brightness %f", scale, brightness); + g_debug ("2. battery scale %f, brightness %f", scale, brightness); } /* reduce if system is momentarily idle */ @@ -330,7 +329,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int if (enable_action && backlight->priv->system_is_idle) { value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_IDLE_BRIGHTNESS); if (value > 100) { - egg_warning ("cannot use idle brightness value %i, correcting to 50", value); + g_warning ("cannot use idle brightness value %i, correcting to 50", value); value = 50; } scale = value / 100.0f; @@ -338,7 +337,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int } else { scale = 1.0f; } - egg_debug ("3. idle scale %f, brightness %f", scale, brightness); + g_debug ("3. idle scale %f, brightness %f", scale, brightness); /* convert to percentage */ value = (guint) ((brightness * 100.0f) + 0.5); @@ -346,7 +345,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int /* only do stuff if the brightness is different */ gpm_brightness_get (backlight->priv->brightness, &old_value); if (old_value == value) { - egg_debug ("values are the same, no action"); + g_debug ("values are the same, no action"); return FALSE; } @@ -361,7 +360,7 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int ret = gpm_brightness_set (backlight->priv->brightness, value, &hw_changed); /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - egg_debug ("emitting brightness-changed : %i", value); + g_debug ("emitting brightness-changed : %i", value); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, value); } return TRUE; @@ -400,7 +399,7 @@ gpm_settings_key_changed_cb (GSettings *settings, const gchar *key, GpmBacklight backlight->priv->idle_dim_timeout = g_settings_get_int (settings, key); gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout); } else { - egg_debug ("unknown key %s", key); + g_debug ("unknown key %s", key); } } @@ -432,7 +431,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli guint percentage; gboolean hw_changed; gboolean on_battery; - egg_debug ("Button press event type=%s", type); + g_debug ("Button press event type=%s", type); if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_UP) == 0) { /* go up one step */ @@ -450,14 +449,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli /* if using AC power supply, save the new brightness settings */ g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL); if (!on_battery) { - egg_debug ("saving brightness for ac supply: %i", percentage); + g_debug ("saving brightness for ac supply: %i", percentage); g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC, percentage*1.0); } } /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - egg_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %i", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } } else if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_DOWN) == 0) { @@ -476,14 +475,14 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli /* if using AC power supply, save the new brightness settings */ g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL); if (!on_battery) { - egg_debug ("saving brightness for ac supply: %i", percentage); + g_debug ("saving brightness for ac supply: %i", percentage); g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC, percentage*1.0); } } /* we emit a signal for the brightness applet */ if (ret && hw_changed) { - egg_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %i", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } } else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) { @@ -493,7 +492,7 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli /* ensure backlight is on */ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error); if (!ret) { - egg_warning ("failed to turn on DPMS: %s", error->message); + g_warning ("failed to turn on DPMS: %s", error->message); g_error_free (error); } } @@ -509,7 +508,7 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i /* no point continuing */ if (backlight->priv->system_is_idle == is_idle) { - egg_debug ("state not changed"); + g_debug ("state not changed"); return FALSE; } @@ -518,14 +517,14 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i g_timer_reset (backlight->priv->idle_timer); if (is_idle == FALSE) { - egg_debug ("we have just been idle for %lfs", elapsed); + g_debug ("we have just been idle for %lfs", elapsed); /* The user immediatly undimmed the screen! * We should double the timeout to avoid this happening again */ if (elapsed < 10) { /* double the event time */ backlight->priv->idle_dim_timeout *= 2.0; - egg_debug ("increasing idle dim time to %is", backlight->priv->idle_dim_timeout); + g_debug ("increasing idle dim time to %is", backlight->priv->idle_dim_timeout); gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout); } @@ -536,14 +535,14 @@ gpm_backlight_notify_system_idle_changed (GpmBacklight *backlight, gboolean is_i backlight->priv->idle_dim_timeout = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_IDLE_DIM_TIME); - egg_debug ("resetting idle dim time to %is", backlight->priv->idle_dim_timeout); + g_debug ("resetting idle dim time to %is", backlight->priv->idle_dim_timeout); gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout); } } else { - egg_debug ("we were active for %lfs", elapsed); + g_debug ("we were active for %lfs", elapsed); } - egg_debug ("changing powersave idle status to %i", is_idle); + g_debug ("changing powersave idle status to %i", is_idle); backlight->priv->system_is_idle = is_idle; return TRUE; } @@ -573,7 +572,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight) /* don't dim or undim the screen unless ConsoleKit/systemd say we are on the active console */ if (!LOGIND_RUNNING() && !egg_console_kit_is_active (backlight->priv->console)) { - egg_debug ("ignoring as not on active console"); + g_debug ("ignoring as not on active console"); return; } @@ -585,7 +584,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight) /* ensure backlight is on */ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error); if (!ret) { - egg_warning ("failed to turn on DPMS: %s", error->message); + g_warning ("failed to turn on DPMS: %s", error->message); g_error_free (error); } @@ -598,7 +597,7 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight) /* ensure backlight is on */ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error); if (!ret) { - egg_warning ("failed to turn on DPMS: %s", error->message); + g_warning ("failed to turn on DPMS: %s", error->message); g_error_free (error); } @@ -619,14 +618,14 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight) /* check if method is valid */ if (dpms_mode == GPM_DPMS_MODE_UNKNOWN || dpms_mode == GPM_DPMS_MODE_ON) { - egg_warning ("BACKLIGHT method %i unknown. Using OFF.", dpms_mode); + g_warning ("BACKLIGHT method %i unknown. Using OFF.", dpms_mode); dpms_mode = GPM_DPMS_MODE_OFF; } /* turn backlight off */ ret = gpm_dpms_set_mode (backlight->priv->dpms, dpms_mode, &error); if (!ret) { - egg_warning ("failed to change DPMS: %s", error->message); + g_warning ("failed to change DPMS: %s", error->message); g_error_free (error); } @@ -648,7 +647,7 @@ brightness_changed_cb (GpmBrightness *brightness, guint percentage, GpmBacklight backlight->priv->master_percentage = percentage; /* we emit a signal for the brightness applet */ - egg_debug ("emitting brightness-changed : %i", percentage); + g_debug ("emitting brightness-changed : %i", percentage); g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage); } @@ -668,7 +667,7 @@ control_resume_cb (GpmControl *control, GpmControlAction action, GpmBacklight *b /* ensure backlight is on */ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error); if (!ret) { - egg_warning ("failed to turn on DPMS: %s", error->message); + g_warning ("failed to turn on DPMS: %s", error->message); g_error_free (error); } } diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c index d749d96..5a3853e 100644 --- a/src/gpm-brightness.c +++ b/src/gpm-brightness.c @@ -41,7 +41,6 @@ #endif /* HAVE_UNISTD_H */ #include "egg-discrete.h" -#include "egg-debug.h" #include "gpm-brightness.h" #include "gpm-common.h" @@ -131,11 +130,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); @@ -162,11 +161,11 @@ gpm_brightness_helper_set_value (const gchar *argument, gint value) command = g_strdup_printf ("pkexec " SBINDIR "/mate-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; @@ -208,7 +207,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) { @@ -239,7 +238,7 @@ gpm_brightness_output_set_internal (GpmBrightness *brightness, RROutput output, XFlush (brightness->priv->dpy); gdk_display_flush (display); if (gdk_x11_display_error_trap_pop (display)) { - egg_warning ("failed to XRRChangeOutputProperty for brightness %i", value); + g_warning ("failed to XRRChangeOutputProperty for brightness %i", value); ret = FALSE; } /* we changed the hardware */ @@ -261,16 +260,16 @@ 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 < 3)) { - 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" */ @@ -279,7 +278,7 @@ gpm_brightness_setup_display (GpmBrightness *brightness) /* Do we support "BACKLIGHT" (legacy) */ 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; } } @@ -300,11 +299,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; } @@ -334,9 +333,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 = egg_discrete_to_percent (cur, (max-min)+1); - egg_debug ("percentage %i", percentage); + g_debug ("percentage %i", percentage); brightness->priv->shared_value = percentage; return TRUE; } @@ -360,14 +359,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; @@ -394,14 +393,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); @@ -431,15 +430,15 @@ gpm_brightness_output_set (GpmBrightness *brightness, RROutput output) return FALSE; shared_value_abs = egg_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; } @@ -448,7 +447,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) { @@ -462,7 +461,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) { @@ -492,7 +491,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) { @@ -503,7 +502,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; @@ -534,7 +533,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; @@ -554,7 +553,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; } @@ -562,7 +561,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; @@ -586,7 +585,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; } @@ -656,7 +655,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; } @@ -784,10 +783,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 +840,7 @@ gpm_brightness_update_cache (GpmBrightness *brightness) /* 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); @@ -852,11 +851,11 @@ gpm_brightness_update_cache (GpmBrightness *brightness) gdk_x11_display_error_trap_push (display); resource = XRRGetScreenResourcesCurrent (brightness->priv->dpy, root); if (gdk_x11_display_error_trap_pop (display) || resource == NULL) { - egg_warning ("failed to XRRGetScreenResourcesCurrent"); + g_warning ("failed to XRRGetScreenResourcesCurrent"); } if (resource != NULL) { - egg_debug ("adding resource %p", resource); + g_debug ("adding resource %p", resource); g_ptr_array_add (brightness->priv->resources, resource); } } @@ -938,7 +937,7 @@ gpm_brightness_init (GpmBrightness *brightness) /* can we do this */ brightness->priv->has_extension = gpm_brightness_setup_display (brightness); 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); @@ -946,7 +945,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, @@ -960,7 +959,7 @@ gpm_brightness_init (GpmBrightness *brightness) RROutputPropertyNotifyMask); /* <--- the only one we need, but see rh:345551 */ gdk_display_flush (display); if (gdk_x11_display_error_trap_pop (display)) - 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 0975966..23656bf 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); struct GpmButtonPrivate @@ -72,11 +70,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 */ @@ -111,12 +109,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_display_flush (gdkdisplay); gdk_x11_display_error_trap_pop_ignored (gdkdisplay); - 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; } @@ -271,13 +269,13 @@ gpm_button_is_lid_closed (GpmButton *button) NULL, &error ); if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", error->message); + g_error("Error connecting to dbus - %s", error->message); g_error_free (error); return -1; } - res = g_dbus_proxy_call_sync (proxy, "Get", - g_variant_new( "(ss)", + res = g_dbus_proxy_call_sync (proxy, "Get", + g_variant_new( "(ss)", "org.freedesktop.UPower", "LidIsClosed"), G_DBUS_CALL_FLAGS_NONE, @@ -292,7 +290,7 @@ gpm_button_is_lid_closed (GpmButton *button) g_variant_unref (res); return lid; } else if (error != NULL ) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); } g_object_unref(proxy); diff --git a/src/gpm-common.c b/src/gpm-common.c index 754ac9e..fedc594 100644 --- a/src/gpm-common.c +++ b/src/gpm-common.c @@ -27,7 +27,6 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> -#include "egg-debug.h" #include "gpm-common.h" /** diff --git a/src/gpm-control.c b/src/gpm-control.c index 25bc392..5f9d528 100644 --- a/src/gpm-control.c +++ b/src/gpm-control.c @@ -43,7 +43,6 @@ #include <gnome-keyring.h> #endif /* WITH_KEYRING */ -#include "egg-debug.h" #include "egg-console-kit.h" #include "gpm-screensaver.h" @@ -93,7 +92,7 @@ gpm_control_systemd_shutdown (void) { GDBusProxy *proxy; GVariant *res = NULL; - egg_debug ("Requesting systemd to shutdown"); + g_debug ("Requesting systemd to shutdown"); proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL, @@ -104,7 +103,7 @@ gpm_control_systemd_shutdown (void) { &error ); //append all our arguments if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", error->message); + g_error("Error connecting to dbus - %s", error->message); g_error_free (error); return FALSE; } @@ -117,7 +116,7 @@ gpm_control_systemd_shutdown (void) { &error ); if (error != NULL) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); return FALSE; } @@ -189,11 +188,11 @@ gpm_control_get_lock_policy (GpmControl *control, const gchar *policy) GSettings *settings_ss; settings_ss = g_settings_new (GS_SETTINGS_SCHEMA); do_lock = g_settings_get_boolean (settings_ss, GS_SETTINGS_PREF_LOCK_ENABLED); - egg_debug ("Using ScreenSaver settings (%i)", do_lock); + g_debug ("Using ScreenSaver settings (%i)", do_lock); g_object_unref (settings_ss); } 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; } @@ -228,7 +227,7 @@ gpm_control_suspend (GpmControl *control, GError **error) g_object_unref (console); 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; } @@ -240,7 +239,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"); } #endif /* WITH_KEYRING */ @@ -255,7 +254,7 @@ gpm_control_suspend (GpmControl *control, GError **error) gpm_networkmanager_sleep (); /* Do the suspend */ - egg_debug ("emitting sleep"); + g_debug ("emitting sleep"); g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_SUSPEND); if (LOGIND_RUNNING()) { @@ -269,7 +268,7 @@ gpm_control_suspend (GpmControl *control, GError **error) NULL, &dbus_error ); if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", dbus_error->message); + g_error ("Error connecting to dbus - %s", dbus_error->message); g_error_free (dbus_error); ret = FALSE; goto out; @@ -282,7 +281,7 @@ gpm_control_suspend (GpmControl *control, GError **error) &dbus_error ); if (dbus_error != NULL ) { - egg_debug ("Error in dbus - %s", dbus_error->message); + g_debug ("Error in dbus - %s", dbus_error->message); g_error_free (dbus_error); ret = TRUE; } @@ -298,7 +297,7 @@ gpm_control_suspend (GpmControl *control, GError **error) g_object_unref (console); } - egg_debug ("emitting resume"); + g_debug ("emitting resume"); g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_SUSPEND); if (do_lock) { @@ -346,7 +345,7 @@ gpm_control_hibernate (GpmControl *control, GError **error) g_object_unref (console); 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; } @@ -358,7 +357,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"); } } #endif /* WITH_KEYRING */ @@ -373,7 +372,7 @@ gpm_control_hibernate (GpmControl *control, GError **error) if (nm_sleep) gpm_networkmanager_sleep (); - egg_debug ("emitting sleep"); + g_debug ("emitting sleep"); g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_HIBERNATE); if (LOGIND_RUNNING()) { @@ -387,7 +386,7 @@ gpm_control_hibernate (GpmControl *control, GError **error) NULL, &dbus_error ); if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", dbus_error->message); + g_error ("Error connecting to dbus - %s", dbus_error->message); g_error_free (dbus_error); ret = FALSE; goto out; @@ -400,7 +399,7 @@ gpm_control_hibernate (GpmControl *control, GError **error) &dbus_error ); if (dbus_error != NULL ) { - egg_debug ("Error in dbus - %s", dbus_error->message); + g_debug ("Error in dbus - %s", dbus_error->message); g_error_free (dbus_error); ret = TRUE; } @@ -415,7 +414,7 @@ gpm_control_hibernate (GpmControl *control, GError **error) g_object_unref (console); } - 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-dpms.c b/src/gpm-dpms.c index d0e4434..9c310dd 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); @@ -136,21 +135,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; @@ -198,7 +197,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; @@ -256,11 +255,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 c626c9f..feab0dd 100644 --- a/src/gpm-engine.c +++ b/src/gpm-engine.c @@ -26,8 +26,6 @@ #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" @@ -150,7 +148,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); } @@ -219,7 +217,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; } @@ -239,7 +237,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; } @@ -259,7 +257,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; } @@ -273,7 +271,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; } @@ -287,12 +285,12 @@ 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; } /* we fallback to the ac_adapter icon */ - egg_debug ("Using fallback"); + g_debug ("Using fallback"); return g_strdup (GPM_ICON_AC_ADAPTER); } @@ -314,7 +312,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_free (engine->priv->previous_icon); @@ -324,7 +322,7 @@ gpm_engine_recalculate_state_icon (GpmEngine *engine) /* no icon before, now icon */ if (engine->priv->previous_icon == NULL) { - egg_debug ("** EMIT: icon-changed: %s", icon); + g_debug ("** EMIT: icon-changed: %s", icon); g_signal_emit (engine, signals [ICON_CHANGED], 0, icon); engine->priv->previous_icon = icon; return TRUE; @@ -334,12 +332,12 @@ gpm_engine_recalculate_state_icon (GpmEngine *engine) if (strcmp (engine->priv->previous_icon, icon) != 0) { g_free (engine->priv->previous_icon); engine->priv->previous_icon = icon; - egg_debug ("** EMIT: icon-changed: %s", icon); + g_debug ("** EMIT: icon-changed: %s", icon); g_signal_emit (engine, signals [ICON_CHANGED], 0, icon); return TRUE; } - egg_debug ("no change"); + g_debug ("no change"); /* nothing to do */ g_free (icon); return FALSE; @@ -356,19 +354,19 @@ 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; - } + } 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; @@ -441,7 +439,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; @@ -465,7 +463,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device gchar *text; text = up_device_to_text (engine->priv->battery_composite); - egg_debug ("composite:\n%s", text); + g_debug ("composite:\n%s", text); g_free (text); /* force update of icon */ @@ -499,11 +497,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 */ @@ -594,7 +592,7 @@ gpm_engine_device_changed_cb (UpDevice *device, GParamSpec *pspec, GpmEngine *en /* 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); } @@ -603,16 +601,16 @@ gpm_engine_device_changed_cb (UpDevice *device, GParamSpec *pspec, GpmEngine *en "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); } @@ -625,13 +623,13 @@ gpm_engine_device_changed_cb (UpDevice *device, GParamSpec *pspec, GpmEngine *en 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 */ @@ -705,7 +703,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, @@ -731,7 +729,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); @@ -764,7 +762,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); @@ -842,9 +840,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 3809d2b..fba1412 100644 --- a/src/gpm-graph-widget.c +++ b/src/gpm-graph-widget.c @@ -30,7 +30,6 @@ #include "gpm-point-obj.h" #include "gpm-graph-widget.h" -#include "egg-debug.h" #include "egg-color.h" #include "egg-precision.h" @@ -121,7 +120,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; @@ -649,7 +648,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; @@ -666,7 +665,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++; @@ -693,7 +692,7 @@ gpm_graph_widget_autorange_x (GpmGraphWidget *graph) graph->priv->start_x = egg_precision_round_down (smallest_x, rounding_x); graph->priv->stop_x = egg_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 */ @@ -707,7 +706,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); } @@ -743,7 +742,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; @@ -760,7 +759,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++; @@ -795,7 +794,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) { @@ -808,7 +807,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); } @@ -903,7 +902,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); @@ -1005,7 +1004,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 a2f1cfc..c058ffb 100644 --- a/src/gpm-idle.c +++ b/src/gpm-idle.c @@ -37,7 +37,6 @@ #include <glib.h> #include <glib/gi18n.h> -#include "egg-debug.h" #include "egg-idletime.h" #include "gpm-idle.h" @@ -102,7 +101,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); } } @@ -116,7 +115,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; } @@ -137,7 +136,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); @@ -158,7 +157,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; } @@ -181,12 +180,12 @@ gpm_idle_evaluate (GpmIdle *idle) is_idle = gpm_session_get_idle (idle->priv->session); is_idle_inhibited = gpm_session_get_idle_inhibited (idle->priv->session); is_suspend_inhibited = gpm_session_get_suspend_inhibited (idle->priv->session); - egg_debug ("session_idle=%i, idle_inhibited=%i, suspend_inhibited=%i, x_idle=%i", is_idle, is_idle_inhibited, is_suspend_inhibited, idle->priv->x_idle); + g_debug ("session_idle=%i, idle_inhibited=%i, suspend_inhibited=%i, x_idle=%i", is_idle, is_idle_inhibited, is_suspend_inhibited, idle->priv->x_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; @@ -200,7 +199,7 @@ gpm_idle_evaluate (GpmIdle *idle) /* are we inhibited from going 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); @@ -215,7 +214,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); } @@ -223,7 +222,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"); @@ -231,7 +230,7 @@ gpm_idle_evaluate (GpmIdle *idle) /* are we inhibited from sleeping */ 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; @@ -240,7 +239,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"); @@ -293,11 +292,11 @@ gpm_idle_set_timeout_dim (GpmIdle *idle, guint timeout) idle_time_in_msec = egg_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; @@ -318,7 +317,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); @@ -335,7 +334,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); @@ -352,7 +351,7 @@ gpm_idle_set_timeout_sleep (GpmIdle *idle, guint timeout) static void gpm_idle_session_idle_changed_cb (GpmSession *session, gboolean is_idle, GpmIdle *idle) { - egg_debug ("Received mate session idle changed: %i", is_idle); + g_debug ("Received mate session idle changed: %i", is_idle); idle->priv->x_idle = is_idle; gpm_idle_evaluate (idle); } @@ -363,7 +362,7 @@ gpm_idle_session_idle_changed_cb (GpmSession *session, gboolean is_idle, GpmIdle static void gpm_idle_session_inhibited_changed_cb (GpmSession *session, gboolean is_idle_inhibited, gboolean is_suspend_inhibited, GpmIdle *idle) { - egg_debug ("Received mate session inhibited changed: idle=(%i), suspend=(%i)", is_idle_inhibited, is_suspend_inhibited); + g_debug ("Received mate session inhibited changed: idle=(%i), suspend=(%i)", is_idle_inhibited, is_suspend_inhibited); gpm_idle_evaluate (idle); } @@ -375,7 +374,7 @@ gpm_idle_session_inhibited_changed_cb (GpmSession *session, gboolean is_idle_inh static void gpm_idle_idletime_alarm_expired_cb (EggIdletime *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; @@ -390,7 +389,7 @@ gpm_idle_idletime_alarm_expired_cb (EggIdletime *idletime, guint alarm_id, GpmId static void gpm_idle_idletime_reset_cb (EggIdletime *idletime, GpmIdle *idle) { - egg_debug ("idletime reset"); + g_debug ("idletime reset"); idle->priv->x_idle = FALSE; gpm_idle_evaluate (idle); @@ -510,14 +509,14 @@ static void gpm_idle_test_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, EggTest *test) { _mode = mode; - egg_debug ("idle-changed %s", gpm_idle_mode_to_string (mode)); + g_debug ("idle-changed %s", gpm_idle_mode_to_string (mode)); egg_test_loop_quit (test); } static gboolean gpm_idle_test_delay_cb (EggTest *test) { - egg_warning ("timing out"); + g_warning ("timing out"); egg_test_loop_quit (test); return FALSE; } diff --git a/src/gpm-kbd-backlight.c b/src/gpm-kbd-backlight.c index 6f363e8..38da913 100644 --- a/src/gpm-kbd-backlight.c +++ b/src/gpm-kbd-backlight.c @@ -24,7 +24,6 @@ #include <libupower-glib/upower.h> #include <gtk/gtk.h> -#include "egg-debug.h" #include "gpm-button.h" #include "gpm-common.h" #include "gpm-control.h" @@ -139,16 +138,16 @@ gpm_kbd_backlight_set (GpmKbdBacklight *backlight, NULL, NULL); } - egg_debug("Set brightness to %i", backlight->priv->brightness); + g_debug("Set brightness to %i", backlight->priv->brightness); return TRUE; } -/** +/** * gpm_kbd_backlight_dialog_init **/ static void -gpm_kbd_backlight_dialog_init (GpmKbdBacklight *backlight) -{ +gpm_kbd_backlight_dialog_init (GpmKbdBacklight *backlight) +{ if (backlight->priv->popup != NULL && !msd_osd_window_is_valid (MSD_OSD_WINDOW (backlight->priv->popup))) { gtk_widget_destroy (backlight->priv->popup); @@ -517,9 +516,9 @@ gpm_kbd_backlight_button_pressed_cb (GpmButton *button, if (g_strcmp0 (type, GPM_BUTTON_KBD_BRIGHT_UP) == 0) { ret = gpm_kbd_backlight_brightness_up (backlight); - + if (ret) { - egg_debug("Going to display OSD"); + g_debug("Going to display OSD"); gpm_kbd_backlight_dialog_init (backlight); msd_media_keys_window_set_volume_level (MSD_MEDIA_KEYS_WINDOW (backlight->priv->popup), backlight->priv->brightness_percent); gpm_kbd_backlight_dialog_show (backlight); @@ -529,12 +528,12 @@ gpm_kbd_backlight_button_pressed_cb (GpmButton *button, ret = gpm_kbd_backlight_brightness_down (backlight); if (ret) { - egg_debug("Going to display OSD"); + g_debug("Going to display OSD"); gpm_kbd_backlight_dialog_init (backlight); msd_media_keys_window_set_volume_level (MSD_MEDIA_KEYS_WINDOW (backlight->priv->popup), backlight->priv->brightness_percent); gpm_kbd_backlight_dialog_show (backlight); } - + } else if (g_strcmp0 (type, GPM_BUTTON_KBD_BRIGHT_TOGGLE) == 0) { if (backlight->priv->master_percentage == 0) { /* backlight is off turn it back on */ @@ -570,7 +569,7 @@ gpm_kbd_backlight_idle_changed_cb (GpmIdle *idle, gboolean on_battery; gboolean enable_action; - egg_debug("Idle changed"); + g_debug("Idle changed"); lid_closed = gpm_button_is_lid_closed (backlight->priv->button); @@ -590,16 +589,16 @@ gpm_kbd_backlight_idle_changed_cb (GpmIdle *idle, return; if (mode == GPM_IDLE_MODE_NORMAL) { - egg_debug("GPM_IDLE_MODE_NORMAL"); + g_debug ("GPM_IDLE_MODE_NORMAL"); backlight->priv->master_percentage = 100; gpm_kbd_backlight_evaluate_power_source_and_set (backlight); } else if (mode == GPM_IDLE_MODE_DIM) { - egg_debug("GPM_IDLE_MODE_DIM"); + g_debug ("GPM_IDLE_MODE_DIM"); brightness = backlight->priv->master_percentage; value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_KBD_BRIGHTNESS_DIM_BY_ON_IDLE); if (value > 100) { - egg_warning ("Cannot scale brightness down by more than 100%%. Scaling by 50%%"); + g_warning ("Cannot scale brightness down by more than 100%%. Scaling by 50%%"); value = 50; } diff --git a/src/gpm-load.c b/src/gpm-load.c index 4fbd134..8496c32 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" @@ -78,7 +77,7 @@ gpm_load_class_init (GpmLoadClass *klass) **/ static gboolean gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total) -{ +{ long unsigned cpu_user = 0; long unsigned cpu_kernel = 0; long unsigned cpu_wait = 0; @@ -88,47 +87,47 @@ gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total) cpu_stat_t data; int ncpus; int count; - + 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; - /* + /* * To aggresive ticks used of all cpus, * traverse kstat chain to access very cpu_stat instane. */ for(count = 0, *cpu_idle =0, *cpu_total = 0; count < ncpus; count++){ - + 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, - data.cpu_sysinfo.cpu[CPU_IDLE], - data.cpu_sysinfo.cpu[CPU_USER], - data.cpu_sysinfo.cpu[CPU_KERNEL], - data.cpu_sysinfo.cpu[CPU_WAIT]); + 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], + data.cpu_sysinfo.cpu[CPU_WAIT]); *cpu_idle += data.cpu_sysinfo.cpu[CPU_IDLE]; cpu_user += data.cpu_sysinfo.cpu[CPU_USER]; diff --git a/src/gpm-main.c b/src/gpm-main.c index e7444ff..dcea806 100644 --- a/src/gpm-main.c +++ b/src/gpm-main.c @@ -43,8 +43,6 @@ #include "org.mate.PowerManager.h" -#include "egg-debug.h" - /** * gpm_object_register: * @connection: What we want to register to @@ -76,12 +74,12 @@ gpm_object_register (DBusGConnection *connection, G_TYPE_UINT, &request_name_result, G_TYPE_INVALID); if (error) { - egg_debug ("ERROR: %s", error->message); + g_debug ("ERROR: %s", error->message); g_error_free (error); } if (!ret) { /* abort as the DBUS method failed */ - egg_warning ("RequestName failed!"); + g_warning ("RequestName failed!"); return FALSE; } @@ -156,7 +154,6 @@ main (int argc, char *argv[]) GMainLoop *loop; DBusGConnection *system_connection; DBusGConnection *session_connection; - gboolean verbose = FALSE; gboolean version = FALSE; gboolean timed_exit = FALSE; gboolean immediate_exit = FALSE; @@ -168,8 +165,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, @@ -201,29 +196,28 @@ main (int argc, char *argv[]) dbus_g_thread_init (); gtk_init (&argc, &argv); - egg_debug_init (verbose); - egg_debug ("MATE %s %s", GPM_NAME, VERSION); + g_debug ("MATE %s %s", GPM_NAME, VERSION); /* check dbus connections, exit if not valid */ system_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &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 dbus system service.\n" - "It is <b>strongly recommended</b> you reboot " - "your computer after starting this service."); + 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."); } session_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &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 " - "dbus session service.\n\n" - "This is usually started automatically in X " - "or mate startup when you start a new session."); + g_error ("This program cannot start until you start the " + "dbus session service.\n\n" + "This is usually started automatically in X " + "or mate startup when you start a new session."); } /* add application specific icons to search path */ @@ -243,7 +237,7 @@ main (int argc, char *argv[]) manager = gpm_manager_new (); if (!gpm_object_register (session_connection, G_OBJECT (manager))) { - egg_error ("%s is already running in this session.", GPM_NAME); + g_error ("%s is already running in this session.", GPM_NAME); goto unref_program; } @@ -253,10 +247,10 @@ main (int argc, char *argv[]) DBUS_NAME_FLAG_REPLACE_EXISTING, NULL); switch (ret) { case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: - egg_debug ("Successfully acquired interface org.freedesktop.Policy.Power."); + g_debug ("Successfully acquired interface org.freedesktop.Policy.Power."); break; case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: - egg_debug ("Queued for interface org.freedesktop.Policy.Power."); + g_debug ("Queued for interface org.freedesktop.Policy.Power."); break; default: break; diff --git a/src/gpm-manager.c b/src/gpm-manager.c index 0c85d78..d241721 100644 --- a/src/gpm-manager.c +++ b/src/gpm-manager.c @@ -43,7 +43,6 @@ #include <libupower-glib/upower.h> #include <libnotify/notify.h> -#include "egg-debug.h" #include "egg-console-kit.h" #include "gpm-button.h" @@ -174,7 +173,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; } @@ -201,18 +200,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); } @@ -224,7 +223,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; } @@ -246,7 +245,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; } @@ -264,7 +263,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; } @@ -312,7 +311,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; } @@ -322,7 +321,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; } @@ -391,11 +390,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 mate-screensaver"); + g_debug ("Could not lock screen via mate-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; } @@ -419,7 +418,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; } @@ -446,7 +445,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; } @@ -460,7 +459,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; } @@ -491,12 +490,12 @@ gpm_manager_notify (GpmManager *manager, NotifyNotification **notification_class 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); /* show modal dialog as libmatenotify failed */ @@ -564,7 +563,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 specified in settings */ @@ -625,7 +624,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); @@ -648,7 +647,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); @@ -676,10 +675,10 @@ 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); @@ -690,17 +689,17 @@ 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) { GpmSession *session; - egg_debug ("logout, reason: %s", reason); + g_debug ("logout, reason: %s", reason); session = gpm_session_new (); gpm_session_logout (session); g_object_unref (session); } else { - egg_warning ("unknown action %i", policy); + g_warning ("unknown action %i", policy); } return TRUE; @@ -726,32 +725,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); } } @@ -774,7 +773,7 @@ gpm_manager_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manage { /* ConsoleKit/systemd say we are not on active console */ if (!LOGIND_RUNNING() && !egg_console_kit_is_active (manager->priv->console)) { - egg_debug ("ignoring as not on active console"); + g_debug ("ignoring as not on active console"); return; } @@ -783,12 +782,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); @@ -818,13 +817,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, "The lid has been 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, "The lid has been closed on battery power."); } @@ -899,11 +898,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/systemd say we are not on active console */ if (!LOGIND_RUNNING() && !egg_console_kit_is_active (manager->priv->console)) { - egg_debug ("ignoring as not on active console"); + g_debug ("ignoring as not on active console"); return; } @@ -958,20 +957,20 @@ gpm_manager_client_changed_cb (UpClient *client, GParamSpec *pspec, GpmManager * "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); } @@ -980,11 +979,11 @@ gpm_manager_client_changed_cb (UpClient *client, GParamSpec *pspec, GpmManager * /* ConsoleKit/systemd say we are not on active console */ if (!LOGIND_RUNNING() && !egg_console_kit_is_active (manager->priv->console)) { - 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); gpm_manager_sync_policy_sleep (manager); @@ -1089,7 +1088,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; } @@ -1129,13 +1128,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; } @@ -1183,7 +1182,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; } @@ -1290,7 +1289,7 @@ gpm_manager_engine_charge_low_cb (GpmEngine *engine, UpDevice *device, GpmManage /* 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; } } @@ -1409,7 +1408,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; } } @@ -1537,7 +1536,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, @@ -1573,7 +1572,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; } } @@ -1673,16 +1672,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); } @@ -1741,7 +1740,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) { const char* arg_why = "Mate power manager handles these events"; const char* arg_mode = "block"; - egg_debug ("Inhibiting systemd sleep"); + g_debug ("Inhibiting systemd sleep"); proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL, @@ -1752,7 +1751,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) { &error ); //append all our arguments if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", error->message); + g_error ("Error connecting to dbus - %s", error->message); g_error_free (error); return -1; } @@ -1771,7 +1770,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) { &error ); if (error != NULL) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); return -EIO; } @@ -1779,18 +1778,18 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) { return -EIO; g_variant_get(res, "(h)", &r); - egg_debug ("Inhibiting systemd sleep res = %i", r); + g_debug ("Inhibiting systemd sleep res = %i", r); fd = g_unix_fd_list_get (fd_list, r, &error); if (fd == -1) { - egg_debug("Failed to get systemd inhibitor"); + g_debug("Failed to get systemd inhibitor"); return r; } - egg_debug ("System inhibitor fd is %d", fd); + g_debug ("System inhibitor fd is %d", fd); g_object_unref (fd_list); g_variant_unref (res); - egg_debug ("Inhibiting systemd sleep - success"); + g_debug ("Inhibiting systemd sleep - success"); return r; } @@ -1887,7 +1886,7 @@ gpm_manager_init (GpmManager *manager) &dbus_glib_gpm_kbd_backlight_object_info); dbus_g_connection_register_g_object (connection, GPM_DBUS_PATH_KBD_BACKLIGHT, G_OBJECT (manager->priv->kbd_backlight)); - + } manager->priv->idle = gpm_idle_new (); @@ -1903,12 +1902,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-networkmanager.c b/src/gpm-networkmanager.c index add8fc0..e882b54 100644 --- a/src/gpm-networkmanager.c +++ b/src/gpm-networkmanager.c @@ -27,7 +27,6 @@ #include <dbus/dbus-glib.h> #include "gpm-networkmanager.h" -#include "egg-debug.h" #define NM_LISTENER_SERVICE "org.freedesktop.NetworkManager" #define NM_LISTENER_PATH "/org/freedesktop/NetworkManager" @@ -49,7 +48,7 @@ gpm_networkmanager_sleep (void) connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (error) { - egg_warning ("%s", error->message); + g_warning ("%s", error->message); g_error_free (error); return FALSE; } @@ -59,7 +58,7 @@ gpm_networkmanager_sleep (void) NM_LISTENER_PATH, NM_LISTENER_INTERFACE); if (!nm_proxy) { - egg_warning ("Failed to get name owner"); + g_warning ("Failed to get name owner"); return FALSE; } dbus_g_proxy_call_no_reply (nm_proxy, "sleep", G_TYPE_INVALID); @@ -83,7 +82,7 @@ gpm_networkmanager_wake (void) connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (error) { - egg_warning ("%s", error->message); + g_warning ("%s", error->message); g_error_free (error); return FALSE; } @@ -93,7 +92,7 @@ gpm_networkmanager_wake (void) NM_LISTENER_PATH, NM_LISTENER_INTERFACE); if (!nm_proxy) { - egg_warning ("Failed to get name owner"); + g_warning ("Failed to get name owner"); return FALSE; } dbus_g_proxy_call_no_reply (nm_proxy, "wake", G_TYPE_INVALID); diff --git a/src/gpm-phone.c b/src/gpm-phone.c index c73008d..ac97dce 100644 --- a/src/gpm-phone.c +++ b/src/gpm-phone.c @@ -28,7 +28,6 @@ #include <dbus/dbus-glib.h> #include "gpm-phone.h" -#include "egg-debug.h" #include "gpm-marshal.h" static void gpm_phone_finalize (GObject *object); @@ -40,7 +39,7 @@ struct GpmPhonePrivate guint watch_id; gboolean present; guint percentage; - gboolean onac; + gboolean onac; }; enum { @@ -69,14 +68,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; } ret = dbus_g_proxy_call (phone->priv->proxy, "Coldplug", &error, G_TYPE_INVALID, G_TYPE_INVALID); if (error != NULL) { - egg_warning ("DEBUG: ERROR: %s", error->message); + g_warning ("DEBUG: ERROR: %s", error->message); g_error_free (error); } @@ -141,11 +140,11 @@ gpm_phone_battery_state_changed (DBusGProxy *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); } @@ -156,9 +155,9 @@ gpm_phone_num_batteries_changed (DBusGProxy *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; } @@ -167,13 +166,13 @@ gpm_phone_num_batteries_changed (DBusGProxy *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; } @@ -181,7 +180,7 @@ gpm_phone_num_batteries_changed (DBusGProxy *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); } @@ -233,18 +232,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 = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (error != 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 = dbus_g_proxy_new_for_name_owner (phone->priv->connection, MATE_PHONE_MANAGER_DBUS_SERVICE, @@ -252,7 +251,7 @@ gpm_phone_service_appeared_cb (GDBusConnection *connection, MATE_PHONE_MANAGER_DBUS_INTERFACE, &error); if (error != 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; @@ -291,13 +290,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-prefs-core.c b/src/gpm-prefs-core.c index 44467ff..93177b6 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -32,7 +32,6 @@ #define UPOWER_ENABLE_DEPRECATED #include <libupower-glib/upower.h> -#include "egg-debug.h" #include "egg-console-kit.h" #include "gpm-tray-icon.h" @@ -126,7 +125,7 @@ gpm_prefs_activate_window (GtkApplication *app, GpmPrefs *prefs) static void gpm_prefs_help_cb (GtkWidget *widget, GpmPrefs *prefs) { - egg_debug ("emitting action-help"); + g_debug ("emitting action-help"); g_signal_emit (prefs, signals [ACTION_HELP], 0); } @@ -190,7 +189,7 @@ gpm_prefs_action_time_changed_cb (GtkWidget *widget, GpmPrefs *prefs) active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); value = values[active]; - egg_debug ("Changing %s to %i", gpm_pref_key, value); + g_debug ("Changing %s to %i", gpm_pref_key, value); g_settings_set_int (prefs->priv->settings, gpm_pref_key, value); } @@ -237,14 +236,14 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, for (i=0; actions[i] != -1; i++) { policy = actions[i]; if (policy == GPM_ACTION_POLICY_SHUTDOWN && !prefs->priv->can_shutdown) { - egg_debug ("Cannot add option, as cannot shutdown."); + g_debug ("Cannot add option, as cannot shutdown."); } else if (policy == GPM_ACTION_POLICY_SHUTDOWN && prefs->priv->can_shutdown) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Shutdown")); g_ptr_array_add(array, GINT_TO_POINTER (policy)); } else if (policy == GPM_ACTION_POLICY_SUSPEND && !prefs->priv->can_suspend) { - egg_debug ("Cannot add option, as cannot suspend."); + g_debug ("Cannot add option, as cannot suspend."); } else if (policy == GPM_ACTION_POLICY_HIBERNATE && !prefs->priv->can_hibernate) { - egg_debug ("Cannot add option, as cannot hibernate."); + g_debug ("Cannot add option, as cannot hibernate."); } else if (policy == GPM_ACTION_POLICY_SUSPEND && prefs->priv->can_suspend) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Suspend")); g_ptr_array_add (array, GINT_TO_POINTER (policy)); @@ -261,7 +260,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Do nothing")); g_ptr_array_add(array, GINT_TO_POINTER (policy)); } else { - egg_warning ("Unknown action read from settings: %i", policy); + g_warning ("Unknown action read from settings: %i", policy); } } @@ -339,7 +338,7 @@ gpm_prefs_setup_time_combo (GpmPrefs *prefs, const gchar *widget_name, static void gpm_prefs_close_cb (GtkWidget *widget, GpmPrefs *prefs) { - egg_debug ("emitting action-close"); + g_debug ("emitting action-close"); g_signal_emit (prefs, signals [ACTION_CLOSE], 0); } @@ -613,7 +612,7 @@ gpm_prefs_init (GpmPrefs *prefs) NULL, &error ); if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", error->message); + g_error ("Error connecting to dbus - %s", error->message); g_error_free (error); return; } @@ -630,7 +629,7 @@ gpm_prefs_init (GpmPrefs *prefs) prefs->priv->can_shutdown = g_strcmp0(r,"yes")==0?TRUE:FALSE; g_variant_unref (res); } else if (error != NULL ) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); } @@ -646,7 +645,7 @@ gpm_prefs_init (GpmPrefs *prefs) prefs->priv->can_suspend = g_strcmp0(r,"yes")==0?TRUE:FALSE; g_variant_unref (res); } else if (error != NULL ) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); } @@ -662,7 +661,7 @@ gpm_prefs_init (GpmPrefs *prefs) prefs->priv->can_hibernate = g_strcmp0(r,"yes")==0?TRUE:FALSE; g_variant_unref (res); } else if (error != NULL ) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); } g_object_unref(proxy); @@ -684,7 +683,7 @@ gpm_prefs_init (GpmPrefs *prefs) NULL, &error ); if (proxy == NULL) { - egg_error("Error connecting to dbus - %s", error->message); + g_error ("Error connecting to dbus - %s", error->message); g_error_free (error); return; } @@ -704,7 +703,7 @@ gpm_prefs_init (GpmPrefs *prefs) g_variant_unref (inner); g_variant_unref (res); } else if (error != NULL ) { - egg_error ("Error in dbus - %s", error->message); + g_error ("Error in dbus - %s", error->message); g_error_free (error); } g_object_unref(proxy); @@ -737,7 +736,7 @@ gpm_prefs_init (GpmPrefs *prefs) (void) gtk_builder_add_from_resource (prefs->priv->builder, "/org/mate/powermanager/preferences/gpm-prefs.ui", &error); if (error) { - egg_error ("failed to load ui: %s", error->message); + g_error ("failed to load ui: %s", error->message); } /* Hide window first so that the dialogue resizes itself without redrawing */ diff --git a/src/gpm-prefs.c b/src/gpm-prefs.c index 096660f..4d39aa1 100644 --- a/src/gpm-prefs.c +++ b/src/gpm-prefs.c @@ -31,7 +31,6 @@ #include <gtk/gtk.h> #include "gpm-common.h" -#include "egg-debug.h" #include "gpm-prefs-core.h" /** @@ -64,7 +63,6 @@ gpm_prefs_activated_cb (GtkApplication *app, GpmPrefs *prefs) int main (int argc, char **argv) { - gboolean verbose = FALSE; GOptionContext *context; GpmPrefs *prefs = NULL; GtkApplication *app; @@ -72,8 +70,6 @@ main (int argc, char **argv) gint status; const GOptionEntry options[] = { - { "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose, - N_("Show extra debugging information"), NULL }, { NULL} }; @@ -88,8 +84,6 @@ main (int argc, char **argv) g_option_context_add_group (context, gtk_get_option_group (FALSE)); g_option_context_parse (context, &argc, &argv, NULL); - egg_debug_init (verbose); - gdk_init (&argc, &argv); app = gtk_application_new("org.mate.PowerManager.Preferences", 0); diff --git a/src/gpm-screensaver.c b/src/gpm-screensaver.c index 9e90359..b59a381 100644 --- a/src/gpm-screensaver.c +++ b/src/gpm-screensaver.c @@ -28,7 +28,6 @@ #include "gpm-screensaver.h" #include "gpm-common.h" -#include "egg-debug.h" static void gpm_screensaver_finalize (GObject *object); @@ -59,11 +58,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 mate-screensaver lock"); + g_debug ("doing mate-screensaver lock"); dbus_g_proxy_call_no_reply (screensaver->priv->proxy, "Lock", G_TYPE_INVALID); @@ -79,7 +78,7 @@ gpm_screensaver_lock (GpmScreensaver *screensaver) /* Sleep for 1/10s */ g_usleep (1000 * 100); if (sleepcount++ > 50) { - egg_debug ("timeout waiting for mate-screensaver"); + g_debug ("timeout waiting for mate-screensaver"); break; } } @@ -105,7 +104,7 @@ gpm_screensaver_add_throttle (GpmScreensaver *screensaver, g_return_val_if_fail (reason != NULL, 0); if (screensaver->priv->proxy == NULL) { - egg_warning ("not connected"); + g_warning ("not connected"); return 0; } @@ -117,16 +116,16 @@ gpm_screensaver_add_throttle (GpmScreensaver *screensaver, G_TYPE_UINT, &cookie, G_TYPE_INVALID); if (error) { - egg_debug ("ERROR: %s", error->message); + g_debug ("ERROR: %s", error->message); g_error_free (error); } if (!ret) { /* abort as the DBUS method failed */ - egg_warning ("Throttle failed!"); + g_warning ("Throttle failed!"); return 0; } - egg_debug ("adding throttle reason: '%s': id %u", reason, cookie); + g_debug ("adding throttle reason: '%s': id %u", reason, cookie); return cookie; } @@ -142,23 +141,23 @@ 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"); + g_warning ("not connected"); return FALSE; } - egg_debug ("removing throttle: id %u", cookie); + g_debug ("removing throttle: id %u", cookie); ret = dbus_g_proxy_call (screensaver->priv->proxy, "UnThrottle", &error, G_TYPE_UINT, cookie, G_TYPE_INVALID, G_TYPE_INVALID); if (error) { - egg_debug ("ERROR: %s", error->message); + g_debug ("ERROR: %s", error->message); g_error_free (error); } if (!ret) { /* abort as the DBUS method failed */ - egg_warning ("UnThrottle failed!"); + g_warning ("UnThrottle failed!"); return FALSE; } @@ -180,7 +179,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"); + g_warning ("not connected"); return FALSE; } @@ -190,7 +189,7 @@ gpm_screensaver_check_running (GpmScreensaver *screensaver) G_TYPE_BOOLEAN, &temp, G_TYPE_INVALID); if (error) { - egg_debug ("ERROR: %s", error->message); + g_debug ("ERROR: %s", error->message); g_error_free (error); } @@ -211,11 +210,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"); dbus_g_proxy_call_no_reply (screensaver->priv->proxy, "SimulateUserActivity", G_TYPE_INVALID); diff --git a/src/gpm-self-test.c b/src/gpm-self-test.c index 8f2acf8..898323e 100644 --- a/src/gpm-self-test.c +++ b/src/gpm-self-test.c @@ -25,7 +25,6 @@ #include <glib-object.h> #include <gtk/gtk.h> #include "egg-test.h" -#include "egg-debug.h" #include "gpm-screensaver.h" @@ -52,7 +51,6 @@ main (int argc, char **argv) EggTest *test; test = egg_test_init (); - egg_debug_init (TRUE); /* needed for DPMS checks */ gtk_init (&argc, &argv); diff --git a/src/gpm-session.c b/src/gpm-session.c index 38cee94..48cc64a 100644 --- a/src/gpm-session.c +++ b/src/gpm-session.c @@ -28,7 +28,6 @@ #include "gpm-session.h" #include "gpm-common.h" -#include "egg-debug.h" #include "gpm-marshal.h" static void gpm_session_finalize (GObject *object); @@ -92,7 +91,7 @@ gpm_session_logout (GpmSession *session) /* no mate-session */ if (session->priv->proxy == NULL) { - egg_warning ("no mate-session"); + g_warning ("no mate-session"); return FALSE; } @@ -140,7 +139,7 @@ gpm_session_presence_status_changed_cb (DBusGProxy *proxy, guint status, GpmSess gboolean is_idle; is_idle = (status == GPM_SESSION_STATUS_ENUM_IDLE); if (is_idle != session->priv->is_idle_old) { - egg_debug ("emitting idle-changed : (%i)", is_idle); + g_debug ("emitting idle-changed : (%i)", is_idle); session->priv->is_idle_old = is_idle; g_signal_emit (session, signals [IDLE_CHANGED], 0, is_idle); } @@ -159,7 +158,7 @@ gpm_session_is_idle (GpmSession *session) /* no mate-session */ if (session->priv->proxy_prop == NULL) { - egg_warning ("no mate-session"); + g_warning ("no mate-session"); goto out; } @@ -172,7 +171,7 @@ gpm_session_is_idle (GpmSession *session) G_TYPE_VALUE, value, G_TYPE_INVALID); if (!ret) { - egg_warning ("failed to get idle status: %s", error->message); + g_warning ("failed to get idle status: %s", error->message); g_error_free (error); is_idle = FALSE; goto out; @@ -195,7 +194,7 @@ gpm_session_is_idle_inhibited (GpmSession *session) /* no mate-session */ if (session->priv->proxy == NULL) { - egg_warning ("no mate-session"); + g_warning ("no mate-session"); goto out; } @@ -206,7 +205,7 @@ gpm_session_is_idle_inhibited (GpmSession *session) G_TYPE_BOOLEAN, &is_inhibited, G_TYPE_INVALID); if (!ret) { - egg_warning ("failed to get inhibit status: %s", error->message); + g_warning ("failed to get inhibit status: %s", error->message); g_error_free (error); is_inhibited = FALSE; } @@ -226,7 +225,7 @@ gpm_session_is_suspend_inhibited (GpmSession *session) /* no mate-session */ if (session->priv->proxy == NULL) { - egg_warning ("no mate-session"); + g_warning ("no mate-session"); goto out; } @@ -237,7 +236,7 @@ gpm_session_is_suspend_inhibited (GpmSession *session) G_TYPE_BOOLEAN, &is_inhibited, G_TYPE_INVALID); if (!ret) { - egg_warning ("failed to get inhibit status: %s", error->message); + g_warning ("failed to get inhibit status: %s", error->message); g_error_free (error); is_inhibited = FALSE; } @@ -251,7 +250,7 @@ out: static void gpm_session_stop_cb (DBusGProxy *proxy, GpmSession *session) { - egg_debug ("emitting ::stop()"); + g_debug ("emitting ::stop()"); g_signal_emit (session, signals [STOP], 0); } @@ -261,7 +260,7 @@ gpm_session_stop_cb (DBusGProxy *proxy, GpmSession *session) static void gpm_session_query_end_session_cb (DBusGProxy *proxy, guint flags, GpmSession *session) { - egg_debug ("emitting ::query-end-session(%i)", flags); + g_debug ("emitting ::query-end-session(%i)", flags); g_signal_emit (session, signals [QUERY_END_SESSION], 0, flags); } @@ -271,7 +270,7 @@ gpm_session_query_end_session_cb (DBusGProxy *proxy, guint flags, GpmSession *se static void gpm_session_end_session_cb (DBusGProxy *proxy, guint flags, GpmSession *session) { - egg_debug ("emitting ::end-session(%i)", flags); + g_debug ("emitting ::end-session(%i)", flags); g_signal_emit (session, signals [END_SESSION], 0, flags); } @@ -289,7 +288,7 @@ gpm_session_end_session_response (GpmSession *session, gboolean is_okay, const g /* no mate-session */ if (session->priv->proxy_client_private == NULL) { - egg_warning ("no mate-session proxy"); + g_warning ("no mate-session proxy"); goto out; } @@ -300,7 +299,7 @@ gpm_session_end_session_response (GpmSession *session, gboolean is_okay, const g G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("failed to send session response: %s", error->message); + g_warning ("failed to send session response: %s", error->message); g_error_free (error); goto out; } @@ -323,7 +322,7 @@ gpm_session_register_client (GpmSession *session, const gchar *app_id, const gch /* no mate-session */ if (session->priv->proxy == NULL) { - egg_warning ("no mate-session"); + g_warning ("no mate-session"); goto out; } @@ -335,7 +334,7 @@ gpm_session_register_client (GpmSession *session, const gchar *app_id, const gch DBUS_TYPE_G_OBJECT_PATH, &client_id, G_TYPE_INVALID); if (!ret) { - 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; } @@ -345,7 +344,7 @@ gpm_session_register_client (GpmSession *session, const gchar *app_id, const gch session->priv->proxy_client_private = dbus_g_proxy_new_for_name_owner (connection, GPM_SESSION_MANAGER_SERVICE, client_id, GPM_SESSION_MANAGER_CLIENT_PRIVATE_INTERFACE, &error); if (session->priv->proxy_client_private == NULL) { - egg_warning ("DBUS error: %s", error->message); + g_warning ("DBUS error: %s", error->message); g_error_free (error); goto out; } @@ -362,7 +361,7 @@ gpm_session_register_client (GpmSession *session, const gchar *app_id, const gch dbus_g_proxy_add_signal (session->priv->proxy_client_private, "EndSession", G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "EndSession", G_CALLBACK (gpm_session_end_session_cb), session, NULL); - 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: g_free (client_id); return ret; @@ -380,7 +379,7 @@ gpm_session_inhibit_changed_cb (DBusGProxy *proxy, const gchar *id, GpmSession * is_idle_inhibited = gpm_session_is_idle_inhibited (session); is_suspend_inhibited = gpm_session_is_suspend_inhibited (session); if (is_idle_inhibited != session->priv->is_idle_inhibited_old || is_suspend_inhibited != session->priv->is_suspend_inhibited_old) { - egg_debug ("emitting inhibited-changed : idle=(%i), suspend=(%i)", is_idle_inhibited, is_suspend_inhibited); + g_debug ("emitting inhibited-changed : idle=(%i), suspend=(%i)", is_idle_inhibited, is_suspend_inhibited); session->priv->is_idle_inhibited_old = is_idle_inhibited; session->priv->is_suspend_inhibited_old = is_suspend_inhibited; g_signal_emit (session, signals [INHIBITED_CHANGED], 0, is_idle_inhibited, is_suspend_inhibited); @@ -464,7 +463,7 @@ gpm_session_init (GpmSession *session) GPM_SESSION_MANAGER_PATH, GPM_SESSION_MANAGER_INTERFACE, &error); if (session->priv->proxy == NULL) { - egg_warning ("DBUS error: %s", error->message); + g_warning ("DBUS error: %s", error->message); g_error_free (error); return; } @@ -474,7 +473,7 @@ gpm_session_init (GpmSession *session) GPM_SESSION_MANAGER_PRESENCE_PATH, GPM_SESSION_MANAGER_PRESENCE_INTERFACE, &error); if (session->priv->proxy_presence == NULL) { - egg_warning ("DBUS error: %s", error->message); + g_warning ("DBUS error: %s", error->message); g_error_free (error); return; } @@ -484,7 +483,7 @@ gpm_session_init (GpmSession *session) GPM_SESSION_MANAGER_PRESENCE_PATH, GPM_DBUS_PROPERTIES_INTERFACE, &error); if (session->priv->proxy_prop == NULL) { - egg_warning ("DBUS error: %s", error->message); + g_warning ("DBUS error: %s", error->message); g_error_free (error); return; } @@ -505,7 +504,7 @@ gpm_session_init (GpmSession *session) session->priv->is_idle_inhibited_old = gpm_session_is_idle_inhibited (session); session->priv->is_suspend_inhibited_old = gpm_session_is_suspend_inhibited (session); session->priv->is_idle_old = gpm_session_is_idle (session); - egg_debug ("idle: %i, idle_inhibited: %i, suspend_inhibited: %i", session->priv->is_idle_old, session->priv->is_idle_inhibited_old, session->priv->is_suspend_inhibited_old); + g_debug ("idle: %i, idle_inhibited: %i, suspend_inhibited: %i", session->priv->is_idle_old, session->priv->is_idle_inhibited_old, session->priv->is_suspend_inhibited_old); } /** diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index 4c3da96..049035a 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -30,7 +30,6 @@ #include <dbus/dbus-glib.h> #include <libupower-glib/upower.h> -#include "egg-debug.h" #include "egg-color.h" #include "egg-array-float.h" @@ -828,7 +827,7 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gboolean dat 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 */ device = up_device_new (); @@ -837,7 +836,7 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gboolean dat g_object_unref (device); } else { - egg_debug ("no row selected"); + g_debug ("no row selected"); } } @@ -863,7 +862,7 @@ gpm_stats_device_changed_cb (UpDevice *device, GParamSpec *pspec, gpointer user_ 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); } @@ -920,7 +919,7 @@ gpm_stats_device_added_cb (UpClient *client, UpDevice *device, GPtrArray *device { 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, devices); } @@ -945,7 +944,7 @@ gpm_stats_device_removed_cb (UpClient *client, const gchar *object_path, GPtrArr break; } } - 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); } @@ -1191,7 +1190,6 @@ gpm_stats_highlight_device (const gchar *object_path) int main (int argc, char *argv[]) { - gboolean verbose = FALSE; GOptionContext *context; GtkBox *box; GtkWidget *widget, *window; @@ -1210,9 +1208,6 @@ main (int argc, char *argv[]) GError *error = NULL; const GOptionEntry options[] = { - { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, - /* TRANSLATORS: show verbose debugging */ - N_("Show extra debugging information"), NULL }, { "device", '\0', 0, G_OPTION_ARG_STRING, &last_device, /* TRANSLATORS: show a device by default */ N_("Select this device at startup"), NULL }, @@ -1234,7 +1229,6 @@ main (int argc, char *argv[]) g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); - egg_debug_init (verbose); gtk_init (&argc, &argv); app = gtk_application_new ("org.mate.PowerManager.Statistics", 0); @@ -1254,7 +1248,7 @@ main (int argc, char *argv[]) retval = gtk_builder_add_from_resource (builder, "/org/mate/powermanager/statistics/gpm-statistics.ui", &error); if (error) { - egg_error ("failed to load ui: %s", error->message); + g_error ("failed to load ui: %s", error->message); } /* add history graph */ diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index 56e87b4..694d925 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" @@ -120,7 +118,7 @@ gpm_tray_icon_set_icon (GpmTrayIcon *icon, const gchar *icon_name) g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), FALSE); if (icon_name != NULL) { - egg_debug ("Setting icon to %s", icon_name); + g_debug ("Setting icon to %s", icon_name); gtk_status_icon_set_from_icon_name (icon->priv->status_icon, icon_name); @@ -128,7 +126,7 @@ gpm_tray_icon_set_icon (GpmTrayIcon *icon, const gchar *icon_name) 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); @@ -148,7 +146,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/mate-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); } @@ -162,7 +160,7 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data) const gchar *command = "mate-power-preferences"; 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); } #define ABOUT_GROUP "About" @@ -263,7 +261,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 label */ @@ -409,7 +407,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); } @@ -444,7 +442,7 @@ 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); } @@ -458,7 +456,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 5b25e63..9048630 100644 --- a/src/gpm-upower.c +++ b/src/gpm-upower.c @@ -24,7 +24,6 @@ #include <glib/gi18n.h> #include <libupower-glib/upower.h> -#include "egg-debug.h" #include "egg-precision.h" #include "gpm-upower.h" @@ -166,11 +165,11 @@ gpm_upower_get_device_icon (UpDevice *device) /* nothing matched */ if (filename == NULL) { - egg_warning ("nothing matched, falling back to default icon"); + g_warning ("nothing matched, falling back to default icon"); filename = g_strdup ("dialog-warning"); } - egg_debug ("got filename: %s", filename); + g_debug ("got filename: %s", filename); return filename; } @@ -306,7 +305,7 @@ gpm_upower_get_device_summary (UpDevice *device) description = g_strdup_printf (_("%s empty"), kind_desc); } else { - 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"); description = g_strdup_printf ("%s (%.1f%%)", kind_desc, percentage); } @@ -527,7 +526,7 @@ gpm_device_kind_to_localised_string (UpDeviceKind kind, guint number) text = ngettext ("Computer", "Computers", number); break; default: - egg_warning ("enum unrecognised: %i", kind); + g_warning ("enum unrecognised: %i", kind); text = up_device_kind_to_string (kind); } return text; @@ -575,7 +574,7 @@ gpm_device_kind_to_icon (UpDeviceKind kind) icon = "computer-apple-ipad"; break; default: - egg_warning ("enum unrecognised: %i", kind); + g_warning ("enum unrecognised: %i", kind); icon = "gtk-help"; } return icon; |