gnome-power-manager r3387 - in trunk: . src



Author: rhughes
Date: Mon Apr  6 08:59:59 2009
New Revision: 3387
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3387&view=rev

Log:
2009-04-06  Richard Hughes  <richard hughsie com>

* src/gpm-backlight.c: (gpm_backlight_button_pressed_cb),
(idle_changed_cb), (control_resume_cb):
* src/gpm-button.c: (coldplug_buttons):
* src/gpm-manager.c: (gpm_manager_unblank_screen):
* src/gpm-notify.c: (notify_general_clicked_cb):
* src/gpm-prefs-core.c: (gpm_dbus_method_bool),
(gpm_dbus_method_int), (pk_prefs_set_defaults_cb):
Verify that all GError's are initialised to NULL before they are
used. Should fix #576169


Modified:
   trunk/ChangeLog
   trunk/src/gpm-backlight.c
   trunk/src/gpm-button.c
   trunk/src/gpm-manager.c
   trunk/src/gpm-notify.c
   trunk/src/gpm-prefs-core.c

Modified: trunk/src/gpm-backlight.c
==============================================================================
--- trunk/src/gpm-backlight.c	(original)
+++ trunk/src/gpm-backlight.c	Mon Apr  6 08:59:59 2009
@@ -398,7 +398,7 @@
 gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBacklight *backlight)
 {
 	gboolean ret;
-	GError *error;
+	GError *error = NULL;
 	guint percentage;
 	gboolean hw_changed;
 	egg_debug ("Button press event type=%s", type);
@@ -512,7 +512,7 @@
 idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)
 {
 	gboolean ret;
-	GError *error;
+	GError *error = NULL;
 	gboolean on_ac;
 	gchar *dpms_method;
 	GpmDpmsMode dpms_mode;
@@ -643,7 +643,7 @@
 control_resume_cb (GpmControl *control, GpmControlAction action, GpmBacklight *backlight)
 {
 	gboolean ret;
-	GError *error;
+	GError *error = NULL;
 
 	/* ensure backlight is on */
 	ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);

Modified: trunk/src/gpm-button.c
==============================================================================
--- trunk/src/gpm-button.c	(original)
+++ trunk/src/gpm-button.c	Mon Apr  6 08:59:59 2009
@@ -444,10 +444,9 @@
 	int i;
 	char **device_names = NULL;
 	gboolean ret;
-	GError *error;
+	GError *error = NULL;
 
 	/* devices of type button */
-	error = NULL;
 	ret = hal_manager_find_capability (button->priv->hal_manager, "button", &device_names, &error);
 	if (!ret) {
 		egg_warning ("Couldn't obtain list of buttons: %s", error->message);

Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c	(original)
+++ trunk/src/gpm-manager.c	Mon Apr  6 08:59:59 2009
@@ -329,7 +329,7 @@
 {
 	gboolean do_lock;
 	gboolean ret = TRUE;
-	GError  *error = NULL;
+	GError *error = NULL;
 
 	do_lock = gpm_control_get_lock_policy (manager->priv->control,
 					       GPM_CONF_LOCK_ON_BLANK_SCREEN);
@@ -357,11 +357,10 @@
 static gboolean
 gpm_manager_unblank_screen (GpmManager *manager, GError **noerror)
 {
-	gboolean  do_lock;
-	gboolean  ret = TRUE;
-	GError   *error;
+	gboolean do_lock;
+	gboolean ret = TRUE;
+	GError *error = NULL;
 
-	error = NULL;
 	gpm_dpms_set_mode (manager->priv->dpms, GPM_DPMS_MODE_ON, &error);
 	if (error) {
 		egg_debug ("Unable to set DPMS mode: %s", error->message);

Modified: trunk/src/gpm-notify.c
==============================================================================
--- trunk/src/gpm-notify.c	(original)
+++ trunk/src/gpm-notify.c	Mon Apr  6 08:59:59 2009
@@ -215,7 +215,7 @@
                            gchar *action, GpmNotify *notify)
 {
 	gboolean ret;
-	GError *error;
+	GError *error = NULL;
  	char *cmdline;
 	GdkScreen *gscreen;
 	GtkWidget *error_dialog;

Modified: trunk/src/gpm-prefs-core.c
==============================================================================
--- trunk/src/gpm-prefs-core.c	(original)
+++ trunk/src/gpm-prefs-core.c	Mon Apr  6 08:59:59 2009
@@ -148,10 +148,10 @@
 {
 	DBusGConnection *connection;
 	DBusGProxy *proxy;
-	GError *error;
+	GError *error = NULL;
 	gboolean ret;
 	gboolean value = FALSE;
-	error = NULL;
+
 	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 	if (connection == NULL) {
 		if (error) {
@@ -192,10 +192,10 @@
 {
 	DBusGConnection *connection;
 	DBusGProxy *proxy;
-	GError *error;
+	GError *error = NULL;
 	gboolean ret;
 	gint value = 0;
-	error = NULL;
+
 	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 	if (connection == NULL) {
 		if (error) {
@@ -955,7 +955,7 @@
 	GConfClient *client;
 	DBusGProxy *proxy;
 	DBusGConnection *connection;
-	GError *error;
+	GError *error = NULL;
 	const gchar *keys[5] = {
 		"/apps/gnome-power-manager/actions",
 		"/apps/gnome-power-manager/ui",
@@ -964,7 +964,6 @@
 		"/apps/gnome-power-manager/timeout"
 	};
 
-	error = NULL;
 	connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
 	if (error != NULL) {
 		g_warning ("failed to get system bus connection: %s", error->message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]