gnome-power-manager r2847 - in trunk: . applets/brightness applets/inhibit libdbus-glib libhal-glib libidletime src test
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2847 - in trunk: . applets/brightness applets/inhibit libdbus-glib libhal-glib libidletime src test
- Date: Sun, 27 Jul 2008 09:57:52 +0000 (UTC)
Author: rhughes
Date: Sun Jul 27 09:57:52 2008
New Revision: 2847
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2847&view=rev
Log:
2008-07-27 Richard Hughes <richard hughsie com>
* applets/brightness/brightness-applet.c:
(gpm_applet_get_brightness), (gpm_applet_set_brightness):
* applets/inhibit/inhibit-applet.c: (gpm_applet_inhibit),
(gpm_applet_uninhibit), (gpm_applet_has_inhibit):
* libdbus-glib/libdbus-proxy.c: (dbus_noc_session_cb),
(dbus_noc_system_cb), (dbus_proxy_assign):
* libdbus-glib/libdbus-watch.c: (dbus_noc_session_cb),
(dbus_noc_system_cb), (dbus_watch_assign):
* libhal-glib/libhal-gdevice.c: (hal_gdevice_get_bool),
(hal_gdevice_get_string), (hal_gdevice_get_int),
(hal_gdevice_query_capability),
(hal_gdevice_watch_property_modified),
(hal_gdevice_watch_condition), (proxy_status_cb),
(hal_gdevice_finalize):
* libhal-glib/libhal-gdevicestore.c: (hal_gdevicestore_insert):
* libhal-glib/libhal-gmanager.c: (hal_gmanager_find_capability),
(hal_gmanager_find_device_string_match),
(hal_gmanager_num_devices_of_capability),
(hal_gmanager_num_devices_of_capability_with_value),
(proxy_status_cb), (hal_gmanager_init):
* libhal-glib/libhal-gpower.c: (hal_gpower_suspend),
(hal_gpower_pm_method_void):
* libidletime/libidletime.c: (idletime_xsync_alarm_set):
* src/gpm-ac-adapter.c: (gpm_ac_adapter_is_present),
(gpm_ac_adapter_init):
* src/gpm-array.c: (gpm_array_append),
(gpm_array_append_from_file), (gpm_array_save_to_file),
(gpm_array_add), (gpm_st_array):
* src/gpm-backlight.c: (gpm_backlight_sync_policy),
(gpm_backlight_get_mode), (gpm_backlight_get_brightness),
(gpm_backlight_set_brightness),
(gpm_backlight_brightness_evaluate_and_set), (idle_changed_cb),
(gpm_backlight_init):
* src/gpm-brightness-hal.c: (gpm_brightness_hal_get_hw),
(gpm_brightness_hal_set_hw), (gpm_brightness_hal_dim_hw_step):
* src/gpm-brightness-kbd.c: (gpm_brightness_kbd_get_hw),
(gpm_brightness_kbd_set_hw), (gpm_brightness_kbd_set_dim),
(gpm_brightness_kbd_dim),
(adjust_kbd_brightness_according_to_ambient_light):
* src/gpm-brightness-xrandr.c:
* src/gpm-button.c: (gpm_button_xevent_key), (emit_button_pressed),
(hal_device_property_modified_cb), (coldplug_buttons),
(gpm_button_init):
* src/gpm-cell-array.c: (gpm_cell_array_get_time_until_action),
(gpm_cell_array_update), (gpm_cell_array_percent_changed),
(gpm_cell_charging_changed_cb), (gpm_cell_discharging_changed_cb),
(gpm_check_device_key), (gpm_cell_array_add_hal_udi),
(gpm_cell_array_coldplug), (gpm_cell_array_get_description),
(hal_device_added_cb), (gpm_st_cell_array):
* src/gpm-cell-unit.c: (gpm_cell_unit_get_icon),
(gpm_cell_unit_get_kind_localised), (gpm_st_cell_unit):
* src/gpm-cell.c: (gpm_cell_refresh_hal_all),
(hal_device_property_modified_cb), (gpm_cell_set_hal_udi),
(gpm_cell_get_description), (gpm_cell_get_battery), (gpm_st_cell):
* src/gpm-control.c: (gpm_control_check_foreground_console),
(gpm_control_allowed_suspend), (gpm_control_allowed_hibernate),
(gpm_control_shutdown), (gpm_control_reboot),
(gpm_control_suspend), (gpm_control_hibernate):
* src/gpm-debug.h:
* src/gpm-engine.c: (gpm_engine_get_summary),
(gpm_engine_get_icon), (gpm_cell_array_perhaps_recall_cb),
(gpm_cell_array_low_capacity_cb),
(gpm_engine_recalculate_state_icon),
(gpm_engine_recalculate_state_summary),
(gpm_engine_recalculate_state),
(gpm_cell_array_discharging_changed_cb),
(gpm_cell_array_fully_charged_cb):
* src/gpm-graph-widget.c: (gpm_graph_widget_draw_graph),
(gpm_st_graph_widget):
* src/gpm-idle.c: (session_idle_changed_cb),
(powersave_idle_changed_cb):
* src/gpm-info.c: (gpm_info_log_do_poll), (ac_adapter_changed_cb),
(gpm_info_init):
* src/gpm-inhibit.c: (gpm_inhibit_has_inhibit), (inhibit),
(has_inhibit), (gpm_st_inhibit):
* src/gpm-light-sensor.c: (gpm_light_sensor_get_hw),
(gpm_light_sensor_poll_cb), (gpm_light_sensor_init):
* src/gpm-load.c: (gpm_load_get_current):
* src/gpm-main.c: (gpm_object_register), (main):
* src/gpm-manager.c: (gpm_manager_is_inhibit_valid),
(gpm_manager_sync_policy_sleep), (gpm_manager_blank_screen),
(gpm_manager_unblank_screen), (gpm_manager_get_on_battery),
(idle_do_sleep), (idle_changed_cb), (lid_button_pressed),
(ac_adapter_changed_cb), (gpm_manager_check_sleep_errors),
(screensaver_auth_request_cb), (control_sleep_failure_cb),
(gpm_manager_init):
* src/gpm-notify.c: (gpm_notify_create), (gpm_notify_show),
(ac_adapter_changed_cb), (notify_general_clicked_cb),
(gpm_notify_sleep_failed):
* src/gpm-phone.c: (gpm_phone_get_num_batteries),
(gpm_phone_num_batteries_changed), (gpm_phone_dbus_disconnect),
(gpm_st_phone):
* src/gpm-polkit.c: (gpm_polkit_is_user_privileged):
* src/gpm-prefs-core.c: (gpm_dbus_method_bool),
(gpm_dbus_method_int), (prefs_setup_notification):
* src/gpm-profile.c: (gpm_profile_get_data_file),
(gpm_profile_print), (gpm_profile_get_data_time_percent),
(gpm_profile_get_accuracy_average),
(gpm_profile_get_data_accuracy_percent), (gpm_profile_get_time),
(gpm_profile_set_average_no_accuracy),
(gpm_profile_save_percentage), (gpm_profile_register_percentage),
(gpm_profile_register_charging), (ac_adaptor_changed_cb),
(gpm_profile_load_data), (gpm_profile_set_config_id),
(gpm_profile_get_accuracy), (gpm_profile_init), (gpm_st_profile):
* src/gpm-screensaver.c: (gpm_screensaver_add_throttle),
(gpm_screensaver_remove_throttle), (gpm_screensaver_get_idle):
* src/gpm-self-test.c: (gpm_st_start):
* src/gpm-srv-brightness-kbd.c: (conf_key_changed_cb),
(ac_adapter_changed_cb), (gpm_srv_brightness_kbd_new):
* src/gpm-srv-screensaver.c: (screensaver_auth_request_cb),
(update_ac_throttle):
* src/gpm-statistics-core.c: (gpm_statistics_get_events),
(gpm_statistics_find_types), (gpm_statistics_get_data_dbus),
(gpm_statistics_get_parameters_dbus),
(gpm_statistics_refresh_data),
(gpm_statistics_populate_graph_types):
* src/gpm-tray-icon.c: (gpm_tray_icon_activate_cb):
* src/gpm-warnings.c: (gpm_warnings_get_state),
(gpm_warnings_init):
* test/gpm-st-hal-device.c: (gpm_st_hal_device):
* test/gpm-st-hal-devicestore.c: (gpm_st_hal_devicestore):
* test/gpm-st-hal-manager.c: (gpm_st_hal_manager):
* test/gpm-st-hal-power.c: (gpm_st_hal_power):
* test/gpm-st-idletime.c: (gpm_st_idletime):
Trivial coding style changes to bring us up to 2008.
Modified:
trunk/ChangeLog
trunk/applets/brightness/brightness-applet.c
trunk/applets/inhibit/inhibit-applet.c
trunk/libdbus-glib/libdbus-proxy.c
trunk/libdbus-glib/libdbus-watch.c
trunk/libhal-glib/libhal-gdevice.c
trunk/libhal-glib/libhal-gdevicestore.c
trunk/libhal-glib/libhal-gmanager.c
trunk/libhal-glib/libhal-gpower.c
trunk/libidletime/libidletime.c
trunk/src/gpm-ac-adapter.c
trunk/src/gpm-array.c
trunk/src/gpm-backlight.c
trunk/src/gpm-brightness-hal.c
trunk/src/gpm-brightness-kbd.c
trunk/src/gpm-brightness-xrandr.c
trunk/src/gpm-button.c
trunk/src/gpm-cell-array.c
trunk/src/gpm-cell-unit.c
trunk/src/gpm-cell.c
trunk/src/gpm-control.c
trunk/src/gpm-debug.h
trunk/src/gpm-engine.c
trunk/src/gpm-graph-widget.c
trunk/src/gpm-idle.c
trunk/src/gpm-info.c
trunk/src/gpm-inhibit.c
trunk/src/gpm-light-sensor.c
trunk/src/gpm-load.c
trunk/src/gpm-main.c
trunk/src/gpm-manager.c
trunk/src/gpm-notify.c
trunk/src/gpm-phone.c
trunk/src/gpm-polkit.c
trunk/src/gpm-prefs-core.c
trunk/src/gpm-profile.c
trunk/src/gpm-screensaver.c
trunk/src/gpm-self-test.c
trunk/src/gpm-srv-brightness-kbd.c
trunk/src/gpm-srv-screensaver.c
trunk/src/gpm-statistics-core.c
trunk/src/gpm-tray-icon.c
trunk/src/gpm-warnings.c
trunk/test/gpm-st-hal-device.c
trunk/test/gpm-st-hal-devicestore.c
trunk/test/gpm-st-hal-manager.c
trunk/test/gpm-st-hal-power.c
trunk/test/gpm-st-idletime.c
Modified: trunk/applets/brightness/brightness-applet.c
==============================================================================
--- trunk/applets/brightness/brightness-applet.c (original)
+++ trunk/applets/brightness/brightness-applet.c Sun Jul 27 09:57:52 2008
@@ -132,7 +132,7 @@
printf ("DEBUG: ERROR: %s\n", error->message);
g_error_free (error);
}
- if (ret == TRUE) {
+ if (ret) {
applet->level = policy_brightness;
} else {
/* abort as the DBUS method failed */
@@ -165,7 +165,7 @@
printf ("DEBUG: ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
printf ("WARNING: SetBrightness failed!");
}
Modified: trunk/applets/inhibit/inhibit-applet.c
==============================================================================
--- trunk/applets/inhibit/inhibit-applet.c (original)
+++ trunk/applets/inhibit/inhibit-applet.c Sun Jul 27 09:57:52 2008
@@ -120,7 +120,7 @@
g_error_free (error);
*cookie = 0;
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
g_warning ("Inhibit failed!");
}
@@ -148,7 +148,7 @@
g_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
g_warning ("UnInhibit failed!");
}
@@ -178,7 +178,7 @@
g_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
g_warning ("HasInhibit failed!");
}
Modified: trunk/libdbus-glib/libdbus-proxy.c
==============================================================================
--- trunk/libdbus-glib/libdbus-proxy.c (original)
+++ trunk/libdbus-glib/libdbus-proxy.c Sun Jul 27 09:57:52 2008
@@ -157,10 +157,10 @@
}
if (strcmp (name, dbus_proxy->priv->service) == 0) {
- if (strlen (prev) != 0 && strlen (new) == 0 ) {
+ if (strlen (prev) != 0 && strlen (new) == 0) {
dbus_proxy_disconnect (dbus_proxy);
}
- if (strlen (prev) == 0 && strlen (new) != 0 ) {
+ if (strlen (prev) == 0 && strlen (new) != 0) {
dbus_proxy_connect (dbus_proxy);
}
}
@@ -192,10 +192,10 @@
}
if (strcmp (name, dbus_proxy->priv->service) == 0) {
- if (strlen (prev) != 0 && strlen (new) == 0 ) {
+ if (strlen (prev) != 0 && strlen (new) == 0) {
dbus_proxy_disconnect (dbus_proxy);
}
- if (strlen (prev) == 0 && strlen (new) != 0 ) {
+ if (strlen (prev) == 0 && strlen (new) != 0) {
dbus_proxy_connect (dbus_proxy);
}
}
@@ -224,7 +224,7 @@
g_return_val_if_fail (interface != NULL, NULL);
g_return_val_if_fail (path != NULL, NULL);
- if (dbus_proxy->priv->assigned == TRUE) {
+ if (dbus_proxy->priv->assigned) {
g_warning ("already assigned proxy!");
return NULL;
}
Modified: trunk/libdbus-glib/libdbus-watch.c
==============================================================================
--- trunk/libdbus-glib/libdbus-watch.c (original)
+++ trunk/libdbus-glib/libdbus-watch.c Sun Jul 27 09:57:52 2008
@@ -83,11 +83,11 @@
}
if (strcmp (name, dbus_watch->priv->service) == 0) {
- if (strlen (prev) != 0 && strlen (new) == 0 ) {
+ if (strlen (prev) != 0 && strlen (new) == 0) {
g_debug ("emitting connection-changed FALSE: %s", dbus_watch->priv->service);
g_signal_emit (dbus_watch, signals [CONNECTION_CHANGED], 0, FALSE);
}
- if (strlen (prev) == 0 && strlen (new) != 0 ) {
+ if (strlen (prev) == 0 && strlen (new) != 0) {
g_debug ("emitting connection-changed TRUE: %s", dbus_watch->priv->service);
g_signal_emit (dbus_watch, signals [CONNECTION_CHANGED], 0, TRUE);
}
@@ -120,11 +120,11 @@
}
if (strcmp (name, dbus_watch->priv->service) == 0) {
- if (strlen (prev) != 0 && strlen (new) == 0 ) {
+ if (strlen (prev) != 0 && strlen (new) == 0) {
g_debug ("emitting connection-changed FALSE: %s", dbus_watch->priv->service);
g_signal_emit (dbus_watch, signals [CONNECTION_CHANGED], 0, FALSE);
}
- if (strlen (prev) == 0 && strlen (new) != 0 ) {
+ if (strlen (prev) == 0 && strlen (new) != 0) {
g_debug ("emitting connection-changed TRUE: %s", dbus_watch->priv->service);
g_signal_emit (dbus_watch, signals [CONNECTION_CHANGED], 0, TRUE);
}
@@ -146,7 +146,7 @@
g_return_val_if_fail (DBUS_IS_WATCH (dbus_watch), FALSE);
g_return_val_if_fail (service != NULL, FALSE);
- if (dbus_watch->priv->assigned == TRUE) {
+ if (dbus_watch->priv->assigned) {
g_warning ("already assigned watch!");
return FALSE;
}
Modified: trunk/libhal-glib/libhal-gdevice.c
==============================================================================
--- trunk/libhal-glib/libhal-gdevice.c (original)
+++ trunk/libhal-glib/libhal-gdevice.c Sun Jul 27 09:57:52 2008
@@ -148,7 +148,7 @@
G_TYPE_INVALID,
G_TYPE_BOOLEAN, value,
G_TYPE_INVALID);
- if (ret == FALSE) {
+ if (!ret) {
*value = FALSE;
}
return ret;
@@ -188,7 +188,7 @@
G_TYPE_INVALID,
G_TYPE_STRING, value,
G_TYPE_INVALID);
- if (ret == FALSE) {
+ if (!ret) {
*value = NULL;
}
return ret;
@@ -226,7 +226,7 @@
G_TYPE_INVALID,
G_TYPE_INT, value,
G_TYPE_INVALID);
- if (ret == FALSE) {
+ if (!ret) {
*value = 0;
}
return ret;
@@ -284,7 +284,7 @@
G_TYPE_INVALID,
G_TYPE_BOOLEAN, has_capability,
G_TYPE_INVALID);
- if (ret == FALSE) {
+ if (!ret) {
*has_capability = FALSE;
}
return ret;
@@ -375,7 +375,7 @@
g_return_val_if_fail (LIBHAL_IS_GDEVICE (device), FALSE);
g_return_val_if_fail (device->priv->udi != NULL, FALSE);
- if (device->priv->use_property_modified == TRUE) {
+ if (device->priv->use_property_modified) {
/* already watched */
return FALSE;
}
@@ -438,7 +438,7 @@
g_return_val_if_fail (LIBHAL_IS_GDEVICE (device), FALSE);
g_return_val_if_fail (device->priv->udi != NULL, FALSE);
- if (device->priv->use_condition == TRUE) {
+ if (device->priv->use_condition) {
/* already watched */
return FALSE;
}
@@ -531,7 +531,7 @@
HalGDevice *device)
{
g_return_if_fail (LIBHAL_IS_GDEVICE (device));
- if (status == TRUE) {
+ if (status) {
/* should join */
} else {
/* should unjoin */
@@ -611,10 +611,10 @@
device = LIBHAL_GDEVICE (object);
device->priv = LIBHAL_GDEVICE_GET_PRIVATE (device);
- if (device->priv->use_property_modified == TRUE) {
+ if (device->priv->use_property_modified) {
hal_gdevice_remove_property_modified (device);
}
- if (device->priv->use_condition == TRUE) {
+ if (device->priv->use_condition) {
hal_gdevice_remove_condition (device);
}
Modified: trunk/libhal-glib/libhal-gdevicestore.c
==============================================================================
--- trunk/libhal-glib/libhal-gdevicestore.c (original)
+++ trunk/libhal-glib/libhal-gdevicestore.c Sun Jul 27 09:57:52 2008
@@ -166,7 +166,7 @@
g_return_val_if_fail (LIBHAL_IS_GDEVICESTORE (devicestore), FALSE);
g_return_val_if_fail (LIBHAL_IS_GDEVICE (device), FALSE);
- if (hal_gdevicestore_present (devicestore, device) == TRUE) {
+ if (hal_gdevicestore_present (devicestore, device)) {
return FALSE;
}
Modified: trunk/libhal-glib/libhal-gmanager.c
==============================================================================
--- trunk/libhal-glib/libhal-gmanager.c (original)
+++ trunk/libhal-glib/libhal-gmanager.c Sun Jul 27 09:57:52 2008
@@ -123,7 +123,7 @@
G_TYPE_INVALID,
G_TYPE_STRV, value,
G_TYPE_INVALID);
- if (ret == FALSE) {
+ if (!ret) {
*value = NULL;
}
return ret;
@@ -163,7 +163,7 @@
G_TYPE_INVALID,
G_TYPE_STRV, devices,
G_TYPE_INVALID);
- if (ret == FALSE) {
+ if (!ret) {
*devices = NULL;
}
return ret;
@@ -211,7 +211,7 @@
g_return_val_if_fail (capability != NULL, 0);
ret = hal_gmanager_find_capability (manager, capability, &names, NULL);
- if (ret == FALSE) {
+ if (!ret) {
return 0;
}
/* iterate to find number of items */
@@ -249,7 +249,7 @@
g_return_val_if_fail (value != NULL, 0);
ret = hal_gmanager_find_capability (manager, capability, &names, NULL);
- if (ret == FALSE) {
+ if (!ret) {
return 0;
}
for (i = 0; names[i]; i++) {
@@ -478,7 +478,7 @@
HalGManager *manager)
{
g_return_if_fail (LIBHAL_IS_GMANAGER (manager));
- if (status == TRUE) {
+ if (status) {
g_signal_emit (manager, signals [DAEMON_START], 0);
hal_gmanager_proxy_connect_more (manager);
} else {
@@ -525,7 +525,7 @@
/* use the computer object */
manager->priv->computer = hal_gdevice_new();
ret = hal_gdevice_set_udi (manager->priv->computer, HAL_ROOT_COMPUTER);
- if (ret == FALSE) {
+ if (!ret) {
g_warning ("failed to get Computer root object");
}
Modified: trunk/libhal-glib/libhal-gpower.c
==============================================================================
--- trunk/libhal-glib/libhal-gpower.c (original)
+++ trunk/libhal-glib/libhal-gpower.c Sun Jul 27 09:57:52 2008
@@ -250,7 +250,7 @@
G_TYPE_INT, &retval,
G_TYPE_INVALID);
/* we might have to ignore the error */
- if (error != NULL && hal_gpower_filter_error (error) == TRUE) {
+ if (error != NULL && hal_gpower_filter_error (error)) {
return TRUE;
}
if (retval != 0) {
@@ -294,7 +294,7 @@
G_TYPE_INT, &retval,
G_TYPE_INVALID);
/* we might have to ignore the error */
- if (error != NULL && hal_gpower_filter_error (error) == TRUE) {
+ if (error != NULL && hal_gpower_filter_error (error)) {
return TRUE;
}
if (retval != 0) {
Modified: trunk/libidletime/libidletime.c
==============================================================================
--- trunk/libidletime/libidletime.c (original)
+++ trunk/libidletime/libidletime.c Sun Jul 27 09:57:52 2008
@@ -83,7 +83,7 @@
XSyncTestType test;
/* which way do we do the test? */
- if (positive == TRUE) {
+ if (positive) {
test = XSyncPositiveComparison;
} else {
test = XSyncNegativeComparison;
Modified: trunk/src/gpm-ac-adapter.c
==============================================================================
--- trunk/src/gpm-ac-adapter.c (original)
+++ trunk/src/gpm-ac-adapter.c Sun Jul 27 09:57:52 2008
@@ -91,7 +91,7 @@
g_error_free (error);
}
- if (is_on_ac == TRUE) {
+ if (is_on_ac) {
return TRUE;
}
return FALSE;
@@ -205,7 +205,7 @@
/* save udi of lcd adapter */
error = NULL;
ret = hal_gmanager_find_capability (hal_manager, "ac_adapter", &device_names, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("Couldn't obtain list of AC adapters: %s", error->message);
g_error_free (error);
return;
Modified: trunk/src/gpm-array.c
==============================================================================
--- trunk/src/gpm-array.c (original)
+++ trunk/src/gpm-array.c Sun Jul 27 09:57:52 2008
@@ -125,7 +125,7 @@
g_return_val_if_fail (array != NULL, FALSE);
- if (array->priv->fixed_size == TRUE) {
+ if (array->priv->fixed_size) {
/* not valid as array is fixed size */
return FALSE;
}
@@ -211,7 +211,7 @@
guint y;
guint data;
- if (array->priv->fixed_size == TRUE) {
+ if (array->priv->fixed_size) {
/* not valid as array is fixed size */
return FALSE;
}
@@ -316,7 +316,7 @@
contents = g_string_free (string, FALSE);
ret = g_file_set_contents (filename, contents, -1, NULL);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("cannot write file %s", filename);
return FALSE;
}
@@ -814,7 +814,7 @@
g_return_val_if_fail (array != NULL, FALSE);
g_return_val_if_fail (GPM_IS_ARRAY (array), FALSE);
- if (array->priv->fixed_size == TRUE) {
+ if (array->priv->fixed_size) {
/* not valid as array is fixed size */
return FALSE;
}
@@ -953,7 +953,7 @@
/************** FIXED SIZE TESTS ****************************/
gpm_st_title (test, "set fixed size of 10");
ret = gpm_array_set_fixed_size (array, 10);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set size");
} else {
gpm_st_failed (test, "set size failed");
@@ -971,7 +971,7 @@
/************************************************************/
gpm_st_title (test, "add some data (should fail as fixed size)");
ret = gpm_array_add (array, 1, 2, 3);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "could not append to fixed size");
} else {
gpm_st_failed (test, "appended to fixed size array");
@@ -1001,7 +1001,7 @@
/************* VARIABLE SIZED TESTS *************************/
gpm_st_title (test, "add some data (should pass as variable size)");
ret = gpm_array_add (array, 1, 2, 3);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "appended to variable size");
} else {
gpm_st_failed (test, "did not append to variable size array");
@@ -1028,7 +1028,7 @@
/************************************************************/
gpm_st_title (test, "clear array");
ret = gpm_array_clear (array);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "cleared");
} else {
gpm_st_failed (test, "did not clear");
@@ -1049,7 +1049,7 @@
gpm_array_add (array, i, i, i);
}
ret = gpm_array_save_to_file (array, "/tmp/gpm-self-test.txt");
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "saved to disk");
} else {
gpm_st_failed (test, "could not save to disk");
@@ -1059,7 +1059,7 @@
gpm_st_title (test, "load from disk");
gpm_array_clear (array);
ret = gpm_array_append_from_file (array, "/tmp/gpm-self-test.txt");
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "loaded from disk");
} else {
gpm_st_failed (test, "could not load from disk");
Modified: trunk/src/gpm-backlight.c
==============================================================================
--- trunk/src/gpm-backlight.c (original)
+++ trunk/src/gpm-backlight.c Sun Jul 27 09:57:52 2008
@@ -137,7 +137,7 @@
error = NULL;
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC, &timeout);
gpm_conf_get_string (backlight->priv->conf, GPM_CONF_BACKLIGHT_DPMS_METHOD_AC, &dpms_method);
} else {
@@ -158,7 +158,7 @@
/* choose a sensible default */
if (method == GPM_DPMS_METHOD_DEFAULT) {
gpm_debug ("choosing sensible default");
- if (backlight->priv->is_laptop == TRUE) {
+ if (backlight->priv->is_laptop) {
gpm_debug ("laptop, so use GPM_DPMS_METHOD_OFF");
method = GPM_DPMS_METHOD_OFF;
} else {
@@ -257,7 +257,7 @@
}
ret = gpm_dpms_get_mode_enum (backlight->priv->dpms, &mode, error);
- if (ret == TRUE) {
+ if (ret) {
*mode_str = g_strdup (gpm_dpms_mode_to_string (mode));
}
return ret;
@@ -285,7 +285,7 @@
/* gets the current brightness */
ret = gpm_brightness_get (backlight->priv->brightness, &level);
- if (ret == TRUE) {
+ if (ret) {
*brightness = level;
} else {
*error = g_error_new (gpm_backlight_error_quark (),
@@ -320,7 +320,7 @@
/* sets the current policy brightness */
ret = gpm_brightness_set (backlight->priv->brightness, percentage, &hw_changed);
- if (ret == FALSE) {
+ if (!ret) {
*error = g_error_new (gpm_backlight_error_quark (),
GPM_BACKLIGHT_ERROR_GENERAL,
"Cannot set policy brightness");
@@ -383,7 +383,7 @@
/* reduce if on battery power if we should */
gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_BATTERY_REDUCE, &battery_reduce);
- if (on_ac == FALSE && battery_reduce == TRUE) {
+ if (on_ac == FALSE && battery_reduce) {
gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_DIM_BATT, &value);
if (value > 100) {
gpm_warning ("cannot use battery brightness value %i, correcting to 50", value);
@@ -397,12 +397,12 @@
gpm_debug ("2. battery scale %f, brightness %f", scale, brightness);
/* reduce if system is momentarily idle */
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_AC, &enable_action);
} else {
gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_BATT, &enable_action);
}
- if (enable_action == TRUE && backlight->priv->system_is_idle == TRUE) {
+ if (enable_action && backlight->priv->system_is_idle == TRUE) {
gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_BRIGHTNESS, &value);
if (value > 100) {
gpm_warning ("cannot use idle brightness value %i, correcting to 50", value);
@@ -417,7 +417,7 @@
/* reduce if ambient is low */
gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_AMBIENT_ENABLE, &enable_action);
- if (backlight->priv->can_sense == TRUE && enable_action == TRUE) {
+ if (backlight->priv->can_sense && enable_action == TRUE) {
gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_AMBIENT_SCALE, &value);
scale = backlight->priv->ambient_sensor_value * (value / 100.0f);
gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_AMBIENT_FACTOR, &value);
@@ -446,7 +446,7 @@
}
/* only show dialog if interactive */
- if (interactive == TRUE) {
+ if (interactive) {
gpm_feedback_display_value (backlight->priv->feedback, (float) brightness);
}
@@ -648,13 +648,13 @@
GError *error;
/* don't dim or undim the screen when the lid is closed */
- if (gpm_button_is_lid_closed (backlight->priv->button) == TRUE) {
+ if (gpm_button_is_lid_closed (backlight->priv->button)) {
return;
}
if (mode == GPM_IDLE_MODE_NORMAL) {
/* deactivate display power management */
- if (backlight->priv->can_dpms == TRUE) {
+ if (backlight->priv->can_dpms) {
error = NULL;
gpm_dpms_set_active (backlight->priv->dpms, FALSE, &error);
if (error) {
@@ -672,7 +672,7 @@
} else if (mode == GPM_IDLE_MODE_SESSION) {
/* activate display power management */
- if (backlight->priv->can_dpms == TRUE) {
+ if (backlight->priv->can_dpms) {
error = NULL;
gpm_dpms_set_active (backlight->priv->dpms, TRUE, &error);
if (error) {
@@ -884,13 +884,13 @@
/* expose ui in prefs program */
prefs_server = gpm_prefs_server_new ();
- if (backlight->priv->is_laptop == TRUE) {
+ if (backlight->priv->is_laptop) {
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_LID);
}
- if (backlight->priv->can_dim == TRUE) {
+ if (backlight->priv->can_dim) {
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_BACKLIGHT);
}
- if (backlight->priv->can_sense == TRUE) {
+ if (backlight->priv->can_sense) {
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_AMBIENT);
}
g_object_unref (prefs_server);
@@ -938,7 +938,7 @@
gpm_feedback_set_icon_name (backlight->priv->feedback,
GPM_STOCK_BRIGHTNESS_LCD);
- if (backlight->priv->can_dpms == TRUE) {
+ if (backlight->priv->can_dpms) {
/* DPMS mode poll class */
backlight->priv->dpms = gpm_dpms_new ();
g_signal_connect (backlight->priv->dpms, "mode-changed",
Modified: trunk/src/gpm-brightness-hal.c
==============================================================================
--- trunk/src/gpm-brightness-hal.c (original)
+++ trunk/src/gpm-brightness-hal.c Sun Jul 27 09:57:52 2008
@@ -109,7 +109,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetBrightness failed!");
return FALSE;
@@ -164,7 +164,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("SetBrightness failed!");
return FALSE;
@@ -208,7 +208,7 @@
for (a=last_set_hw; a <= new_level_hw; a+=step_interval) {
ret = gpm_brightness_hal_set_hw (brightness, a);
/* we failed the last brightness set command, don't keep trying */
- if (ret == FALSE) {
+ if (!ret) {
break;
}
g_usleep (1000 * GPM_BRIGHTNESS_DIM_INTERVAL);
@@ -218,7 +218,7 @@
for (a=last_set_hw; (gint) (a + 1) > (gint) new_level_hw; a-=step_interval) {
ret = gpm_brightness_hal_set_hw (brightness, a);
/* we failed the last brightness set command, don't keep trying */
- if (ret == FALSE) {
+ if (!ret) {
break;
}
g_usleep (1000 * GPM_BRIGHTNESS_DIM_INTERVAL);
Modified: trunk/src/gpm-brightness-kbd.c
==============================================================================
--- trunk/src/gpm-brightness-kbd.c (original)
+++ trunk/src/gpm-brightness-kbd.c Sun Jul 27 09:57:52 2008
@@ -112,7 +112,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetBrightness failed!");
return FALSE;
@@ -165,7 +165,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("SetBrightness failed!");
return FALSE;
@@ -296,7 +296,7 @@
brightness->priv->level_dim_hw = brightness->priv->level_std_hw;
}
/* if in this state, then update */
- if (brightness->priv->is_dimmed == TRUE) {
+ if (brightness->priv->is_dimmed) {
gpm_brightness_kbd_dim_hw (brightness, brightness->priv->level_dim_hw);
}
return TRUE;
@@ -340,7 +340,7 @@
g_return_val_if_fail (GPM_IS_BRIGHTNESS_KBD (brightness), FALSE);
/* check to see if we are already dimmed */
- if (brightness->priv->is_dimmed == TRUE) {
+ if (brightness->priv->is_dimmed) {
gpm_warning ("already dim'ed");
return FALSE;
}
@@ -584,7 +584,7 @@
if (state == STATE_FORCED_UNKNOWN) {
/* if this is the first time we're launched with ambient light data... */
- if (ambient_light < 50 ) {
+ if (ambient_light < 50) {
gpm_brightness_kbd_set_std (brightness, 100);
state = STATE_FORCED_ON;
} else {
@@ -592,7 +592,7 @@
state = STATE_FORCED_OFF;
}
} else {
- if (ambient_light < 30 && state != STATE_FORCED_ON ) {
+ if (ambient_light < 30 && state != STATE_FORCED_ON) {
/* if it's dark.. and we haven't already turned light on...
* => turn it on.. full blast! */
gpm_brightness_kbd_set_std (brightness, 100);
Modified: trunk/src/gpm-brightness-xrandr.c
==============================================================================
--- trunk/src/gpm-brightness-xrandr.c (original)
+++ trunk/src/gpm-brightness-xrandr.c Sun Jul 27 09:57:52 2008
@@ -59,6 +59,7 @@
guint shared_value;
gboolean has_extension;
gboolean hw_changed;
+ /* An cache of XRRScreenResources is used as XRRGetScreenResources is expensive */
GPtrArray *resources;
};
Modified: trunk/src/gpm-button.c
==============================================================================
--- trunk/src/gpm-button.c (original)
+++ trunk/src/gpm-button.c Sun Jul 27 09:57:52 2008
@@ -183,7 +183,7 @@
/* try to register X event */
ret = gpm_button_grab_keystring (button, keycode);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("Failed to grab %p", keycode);
g_free (keycode_str);
return FALSE;
@@ -281,13 +281,13 @@
/* abstact away that HAL has an extra parameter */
if (strcmp (type, GPM_BUTTON_LID_DEP) == 0 && state == FALSE) {
atype = GPM_BUTTON_LID_OPEN;
- } else if (strcmp (type, GPM_BUTTON_LID_DEP) == 0 && state == TRUE) {
+ } else if (strcmp (type, GPM_BUTTON_LID_DEP) == 0 && state) {
atype = GPM_BUTTON_LID_CLOSED;
}
/* filter out duplicate lid events */
if (strcmp (atype, GPM_BUTTON_LID_CLOSED) == 0) {
- if (button->priv->lid_is_closed == TRUE) {
+ if (button->priv->lid_is_closed) {
gpm_debug ("ignoring duplicate lid event");
return;
}
@@ -338,7 +338,7 @@
key, is_added, is_removed, finally);
/* do not process keys that have been removed */
- if (is_removed == TRUE) {
+ if (is_removed) {
return;
}
@@ -411,7 +411,7 @@
/* devices of type button */
error = NULL;
ret = hal_gmanager_find_capability (button->priv->hal_manager, "button", &device_names, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("Couldn't obtain list of buttons: %s", error->message);
g_error_free (error);
return;
@@ -479,7 +479,7 @@
have_xevents = TRUE;
#endif
- if (have_xevents == TRUE) {
+ if (have_xevents) {
/* register the brightness keys */
// gpm_button_xevent_key (button, XF86XK_Execute, GPM_BUTTON_POWER);
gpm_button_xevent_key (button, XF86XK_PowerOff, GPM_BUTTON_POWER);
Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c (original)
+++ trunk/src/gpm-cell-array.c Sun Jul 27 09:57:52 2008
@@ -183,7 +183,7 @@
gpm_cell_unit_init (unit);
/* not valid */
- if (unit->is_charging == TRUE || unit->is_discharging == FALSE) {
+ if (unit->is_charging || unit->is_discharging == FALSE) {
return 0;
}
@@ -194,7 +194,7 @@
/* calculate! */
gpm_conf_get_bool (cell_array->priv->conf, GPM_CONF_USE_TIME_POLICY, &use_time_primary);
- if (use_time_primary == TRUE) {
+ if (use_time_primary) {
/* simple subtraction */
gpm_conf_get_uint (cell_array->priv->conf, GPM_CONF_THRESH_TIME_ACTION, &action_time);
difference = (gint) unit->time_discharge - (gint) action_time;
@@ -296,11 +296,11 @@
* be present. */
unit->is_present = TRUE;
- if (unit_temp->is_charging == TRUE) {
+ if (unit_temp->is_charging) {
unit->is_charging = TRUE;
}
- if (unit_temp->is_discharging == TRUE) {
+ if (unit_temp->is_discharging) {
unit->is_discharging = TRUE;
num_discharging++;
}
@@ -341,7 +341,7 @@
}
/* sanity check */
- if (unit->is_discharging == TRUE && unit->is_charging == TRUE) {
+ if (unit->is_discharging && unit->is_charging == TRUE) {
gpm_warning ("Sanity check kicked in! "
"Multiple device object cannot be charging and discharging simultaneously!");
unit->is_charging = FALSE;
@@ -381,7 +381,7 @@
on_ac = gpm_ac_adapter_is_present (cell_array->priv->ac_adapter);
gpm_debug ("Battery is neither charging nor discharging, "
"using ac_adaptor value %i", on_ac);
- if (on_ac == TRUE) {
+ if (on_ac) {
unit->is_charging = TRUE;
unit->is_discharging = FALSE;
} else {
@@ -392,7 +392,7 @@
/* We may want to use the old time remaining code.
* Hopefully we can remove this in 2.19.x sometime. */
- if (cell_array->priv->use_profile_calc == TRUE &&
+ if (cell_array->priv->use_profile_calc &&
unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
gpm_debug ("unit->percentage = %i", unit->percentage);
unit->time_discharge = gpm_profile_get_time (cell_array->priv->profile, unit->percentage, TRUE);
@@ -401,10 +401,10 @@
/* We only do the "better" remaining time algorithm if the battery has rate,
* i.e not a UPS, which gives it's own battery.time_charge but has no rate */
if (unit->rate > 0) {
- if (unit->is_discharging == TRUE) {
+ if (unit->is_discharging) {
unit->time_discharge = 3600 * ((float)unit->charge_current /
(float)unit->rate);
- } else if (unit->is_charging == TRUE) {
+ } else if (unit->is_charging) {
unit->time_charge = 3600 *
((float)(unit->charge_last_full - unit->charge_current) /
(float)unit->rate);
@@ -532,7 +532,7 @@
/* only emit if all devices are fully charged */
if (cell_array->priv->done_fully_charged == FALSE &&
- gpm_cell_unit_is_charged (unit) == TRUE) {
+ gpm_cell_unit_is_charged (unit)) {
gpm_debug ("** EMIT: fully-charged");
g_signal_emit (cell_array, signals [FULLY_CHARGED], 0);
cell_array->priv->done_fully_charged = TRUE;
@@ -541,7 +541,7 @@
/* We only re-enable the fully charged notification when the battery
drops down to 95% as some batteries charge to 100% and then fluctuate
from ~98% to 100%. See #338281 for details */
- if (cell_array->priv->done_fully_charged == TRUE &&
+ if (cell_array->priv->done_fully_charged &&
unit->percentage < GPM_CELL_UNIT_MIN_CHARGED_PERCENTAGE &&
gpm_cell_unit_is_charged (unit) == FALSE) {
gpm_debug ("enabled fully charged");
@@ -549,7 +549,7 @@
}
/* only get a warning state if we are discharging */
- if (unit->is_discharging == TRUE) {
+ if (unit->is_discharging) {
warnings_state = gpm_warnings_get_state (cell_array->priv->warnings, unit);
} else {
warnings_state = GPM_WARNINGS_NONE;
@@ -626,7 +626,7 @@
gpm_cell_unit_print (unit);
/* invalidate warning */
- if (unit->is_discharging == FALSE || unit->is_charging == TRUE) {
+ if (unit->is_discharging == FALSE || unit->is_charging) {
gpm_debug ("warning state invalidated");
cell_array->priv->warnings_state = GPM_WARNINGS_NONE;
}
@@ -658,7 +658,7 @@
gpm_cell_unit_print (unit);
/* invalidate warning */
- if (unit->is_discharging == FALSE || unit->is_charging == TRUE) {
+ if (unit->is_discharging == FALSE || unit->is_charging) {
cell_array->priv->warnings_state = GPM_WARNINGS_NONE;
}
@@ -706,14 +706,14 @@
device = hal_gdevice_new ();
ret = hal_gdevice_set_udi (device, udi);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("failed to set UDI %s", udi);
return FALSE;
}
/* check type */
ret = hal_gdevice_get_string (device, key, &rettype, NULL);
- if (ret == FALSE || rettype == NULL) {
+ if (!ret || rettype == NULL) {
gpm_warning ("failed to get %s", key);
return FALSE;
}
@@ -784,7 +784,7 @@
/* check type */
kind_string = gpm_cell_unit_get_kind_string (unit);
ret = gpm_check_device_key (cell_array, udi, "battery.type", kind_string);
- if (ret == FALSE) {
+ if (!ret) {
gpm_debug ("not adding %s for %s", udi, kind_string);
return FALSE;
}
@@ -844,7 +844,7 @@
/* get all the hal devices of this type */
error = NULL;
ret = hal_gmanager_find_capability (cell_array->priv->hal_manager, "battery", &device_names, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("Couldn't obtain list of batteries: %s", error->message);
g_error_free (error);
return FALSE;
@@ -963,7 +963,7 @@
/* we care if we are on AC */
if (unit->kind == GPM_CELL_UNIT_KIND_PHONE) {
- if (unit->is_charging == TRUE || unit->is_discharging == FALSE) {
+ if (unit->is_charging || unit->is_discharging == FALSE) {
return g_strdup_printf ("%s charging (%i%%)\n", type_desc, unit->percentage);
}
return g_strdup_printf ("%s (%i%%)\n", type_desc, unit->percentage);
@@ -980,7 +980,7 @@
/* We always display "Laptop battery 16 minutes remaining" as we need
to clarify what device we are refering to. For details see :
http://bugzilla.gnome.org/show_bug.cgi?id=329027 */
- if (gpm_cell_unit_is_charged (unit) == TRUE) {
+ if (gpm_cell_unit_is_charged (unit)) {
if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
accuracy > GPM_CELL_ARRAY_TEXT_MIN_ACCURACY) {
@@ -995,7 +995,7 @@
type_desc, unit->percentage);
}
- } else if (unit->is_discharging == TRUE) {
+ } else if (unit->is_discharging) {
if (discharge_time_round > GPM_CELL_ARRAY_TEXT_MIN_TIME) {
discharge_timestring = gpm_get_timestring (discharge_time_round);
@@ -1008,7 +1008,7 @@
type_desc, unit->percentage);
}
- } else if (unit->is_charging == TRUE) {
+ } else if (unit->is_charging) {
if (charge_time_round > GPM_CELL_ARRAY_TEXT_MIN_TIME &&
discharge_time_round > GPM_CELL_ARRAY_TEXT_MIN_TIME &&
@@ -1126,7 +1126,7 @@
}
/* if a battery, then add */
- if (is_battery == TRUE) {
+ if (is_battery) {
gpm_cell_array_add_hal_udi (cell_array, udi);
}
g_object_unref (device);
@@ -1495,7 +1495,7 @@
/************************************************************/
gpm_st_title (test, "make sure we get set type");
ret = gpm_cell_array_set_type (cell_array, GPM_CELL_UNIT_KIND_PRIMARY);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set type");
} else {
gpm_st_failed (test, "could not set type");
Modified: trunk/src/gpm-cell-unit.c
==============================================================================
--- trunk/src/gpm-cell-unit.c (original)
+++ trunk/src/gpm-cell-unit.c Sun Jul 27 09:57:52 2008
@@ -172,10 +172,10 @@
/* battery missing */
filename = g_strdup_printf ("gpm-%s-missing", prefix);
- } else if (gpm_cell_unit_is_charged (unit) == TRUE) {
+ } else if (gpm_cell_unit_is_charged (unit)) {
filename = g_strdup_printf ("gpm-%s-charged", prefix);
- } else if (unit->is_charging == TRUE) {
+ } else if (unit->is_charging) {
index_str = gpm_cell_unit_get_icon_index (unit);
filename = g_strdup_printf ("gpm-%s-%s-charging", prefix, index_str);
@@ -242,7 +242,7 @@
g_return_val_if_fail (unit != NULL, NULL);
- if (plural == TRUE) {
+ if (plural) {
if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
str = _("Laptop batteries");
} else if (unit->kind == GPM_CELL_UNIT_KIND_UPS) {
@@ -374,7 +374,7 @@
unit->is_charging = FALSE;
unit->is_discharging = TRUE;
ret = gpm_cell_unit_is_charged (unit);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "not charged");
} else {
gpm_st_failed (test, "declaring charged");
@@ -413,7 +413,7 @@
unit->is_charging = TRUE;
unit->is_discharging = FALSE;
ret = gpm_cell_unit_is_charged (unit);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "not charged");
} else {
gpm_st_failed (test, "declaring charged");
@@ -425,7 +425,7 @@
unit->is_charging = FALSE;
unit->is_discharging = FALSE;
ret = gpm_cell_unit_is_charged (unit);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "charged");
} else {
gpm_st_failed (test, "declaring non-charged");
@@ -437,7 +437,7 @@
unit->is_charging = FALSE;
unit->is_discharging = FALSE;
ret = gpm_cell_unit_is_charged (unit);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "not charged");
} else {
gpm_st_failed (test, "declaring charged");
Modified: trunk/src/gpm-cell.c
==============================================================================
--- trunk/src/gpm-cell.c (original)
+++ trunk/src/gpm-cell.c Sun Jul 27 09:57:52 2008
@@ -136,7 +136,7 @@
if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
exists = hal_gdevice_get_uint (device, "battery.charge_level.rate",
&unit->rate, NULL);
- if (exists == FALSE && (unit->is_discharging == TRUE || unit->is_charging == TRUE)) {
+ if (exists == FALSE && (unit->is_discharging || unit->is_charging == TRUE)) {
gpm_warning ("could not read your battery's charge rate");
}
/* sanity check to less than 100W */
@@ -158,13 +158,13 @@
unit->kind == GPM_CELL_UNIT_KIND_UPS) {
exists = hal_gdevice_get_uint (device,"battery.remaining_time",
&unit->time_charge, NULL);
- if (exists == FALSE && (unit->is_discharging == TRUE || unit->is_charging == TRUE)) {
+ if (exists == FALSE && (unit->is_discharging || unit->is_charging == TRUE)) {
gpm_warning ("could not read your battery's remaining time");
}
}
/* calculate the batteries capacity if it is primary and present */
- if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY && unit->is_present == TRUE) {
+ if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY && unit->is_present) {
if (unit->charge_design > 0 && unit->charge_last_full > 0) {
if (unit->charge_design != unit->charge_last_full) {
float capacity;
@@ -199,7 +199,7 @@
/* this is more common than you might expect: hardware that might blow up */
hal_gdevice_get_bool (device, "info.is_recalled", &is_recalled, NULL);
- if (is_recalled == TRUE) {
+ if (is_recalled) {
gchar *oem_vendor;
gchar *website;
hal_gdevice_get_string (device, "info.recall.vendor", &oem_vendor, NULL);
@@ -278,7 +278,7 @@
gpm_debug ("** EMIT: charging-changed: %i", unit->is_charging);
g_signal_emit (cell, signals [CHARGING_CHANGED], 0, unit->is_charging);
/* reset the time, as we really can't guess this without profiling */
- if (unit->is_charging == TRUE) {
+ if (unit->is_charging) {
unit->time_discharge = 0;
}
@@ -287,7 +287,7 @@
gpm_debug ("** EMIT: discharging-changed: %i", unit->is_discharging);
g_signal_emit (cell, signals [DISCHARGING_CHANGED], 0, unit->is_discharging);
/* reset the time, as we really can't guess this without profiling */
- if (unit->is_discharging == TRUE) {
+ if (unit->is_discharging) {
unit->time_charge = 0;
}
@@ -316,10 +316,10 @@
} else if (strcmp (key, "battery.remaining_time") == 0) {
hal_gdevice_get_uint (device, key, &time_hal, NULL);
/* Gahh. We have to multiplex the time as HAL shares a key. */
- if (unit->is_charging == TRUE) {
+ if (unit->is_charging) {
unit->time_charge = time_hal;
}
- if (unit->is_discharging == TRUE) {
+ if (unit->is_discharging) {
unit->time_discharge = time_hal;
}
@@ -374,7 +374,7 @@
device = cell->priv->hal_device;
ret = hal_gdevice_set_udi (device, udi);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("cannot set udi");
return FALSE;
}
@@ -391,7 +391,7 @@
}
ret = gpm_cell_unit_set_kind (unit, battery_kind_str);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("battery type %s unknown", battery_kind_str);
g_free (battery_kind_str);
return FALSE;
@@ -532,7 +532,7 @@
}
if (unit->is_present == FALSE) {
g_string_append (details, _("<b>Status:</b> Missing\n"));
- } else if (gpm_cell_unit_is_charged (unit) == TRUE) {
+ } else if (gpm_cell_unit_is_charged (unit)) {
g_string_append (details, _("<b>Status:</b> Charged\n"));
} else if (unit->is_charging) {
g_string_append (details, _("<b>Status:</b> Charging\n"));
@@ -829,7 +829,7 @@
manager = hal_gmanager_new ();
ret = hal_gmanager_find_capability (manager, "battery", &value, NULL);
- if (ret == TRUE && value != NULL && value[0] != NULL) {
+ if (ret && value != NULL && value[0] != NULL) {
udi = g_strdup (value[0]);
}
hal_gmanager_free_capability (value);
@@ -892,7 +892,7 @@
/************************************************************/
gpm_st_title (test, "can we assign device");
ret = gpm_cell_set_hal_udi (cell, udi);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set type okay");
} else {
gpm_st_failed (test, "could not set type");
Modified: trunk/src/gpm-control.c
==============================================================================
--- trunk/src/gpm-control.c (original)
+++ trunk/src/gpm-control.c Sun Jul 27 09:57:52 2008
@@ -109,7 +109,7 @@
int retcode;
if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
- NULL, NULL, &retcode, NULL) || ! WIFEXITED (retcode) ) {
+ NULL, NULL, &retcode, NULL) || ! WIFEXITED (retcode)) {
/* if check-foreground-console could not be executed,
* assume active console */
gpm_debug ("could not execute check-foreground-console");
@@ -148,7 +148,7 @@
polkit_ok = gpm_polkit_is_user_privileged (control->priv->polkit, "hal-power-suspend");
}
fg = gpm_control_check_foreground_console (control);
- if ( conf_ok && hal_ok && polkit_ok && fg ) {
+ if (conf_ok && hal_ok && polkit_ok && fg) {
*can = TRUE;
}
@@ -181,7 +181,7 @@
if (control->priv->polkit) {
polkit_ok = gpm_polkit_is_user_privileged (control->priv->polkit, "hal-power-hibernate");
}
- if ( conf_ok && hal_ok && polkit_ok && fg ) {
+ if (conf_ok && hal_ok && polkit_ok && fg) {
*can = TRUE;
}
return TRUE;
@@ -296,14 +296,14 @@
gpm_conf_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, &save_session);
/* We can set g-p-m to not save the session to avoid confusing new
users. By default we save the session to preserve data. */
- if (save_session == TRUE) {
+ if (save_session) {
gnome_client_request_save (gnome_master_client (),
GNOME_SAVE_GLOBAL,
FALSE, GNOME_INTERACT_NONE, FALSE, TRUE);
}
ret = hal_gpower_shutdown (control->priv->hal_power, error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_control_convert_hal_error (control, error);
}
@@ -336,7 +336,7 @@
gpm_conf_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, &save_session);
/* We can set g-p-m to not save the session to avoid confusing new
users. By default we save the session to preserve data. */
- if (save_session == TRUE) {
+ if (save_session) {
gnome_client_request_save (gnome_master_client (),
GNOME_SAVE_GLOBAL,
FALSE, GNOME_INTERACT_NONE, FALSE, TRUE);
@@ -403,7 +403,7 @@
/* we should perhaps lock keyrings when sleeping #375681 */
gpm_conf_get_bool (control->priv->conf, GPM_CONF_LOCK_GNOME_KEYRING_SUSPEND, &lock_gnome_keyring);
- if (lock_gnome_keyring == TRUE) {
+ if (lock_gnome_keyring) {
keyres = gnome_keyring_lock_all_sync ();
if (keyres != GNOME_KEYRING_RESULT_OK) {
gpm_warning ("could not lock keyring");
@@ -411,12 +411,12 @@
}
do_lock = gpm_control_get_lock_policy (control, GPM_CONF_LOCK_ON_SUSPEND);
- if (do_lock == TRUE) {
+ if (do_lock) {
gpm_screensaver_lock (screensaver);
}
gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep == TRUE) {
+ if (nm_sleep) {
gpm_networkmanager_sleep ();
}
@@ -425,24 +425,24 @@
g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_SUSPEND);
ret = hal_gpower_suspend (control->priv->hal_power, 0, error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_control_convert_hal_error (control, error);
}
gpm_debug ("emitting resume");
g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_SUSPEND);
- if (ret == FALSE) {
+ if (!ret) {
gpm_debug ("emitting sleep-failure");
g_signal_emit (control, signals [SLEEP_FAILURE], 0, GPM_CONTROL_ACTION_SUSPEND);
}
- if (do_lock == TRUE) {
+ if (do_lock) {
gpm_screensaver_poke (screensaver);
}
gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep == TRUE) {
+ if (nm_sleep) {
gpm_networkmanager_wake ();
}
@@ -479,7 +479,7 @@
/* we should perhaps lock keyrings when sleeping #375681 */
gpm_conf_get_bool (control->priv->conf, GPM_CONF_LOCK_GNOME_KEYRING_HIBERNATE, &lock_gnome_keyring);
- if (lock_gnome_keyring == TRUE) {
+ if (lock_gnome_keyring) {
keyres = gnome_keyring_lock_all_sync ();
if (keyres != GNOME_KEYRING_RESULT_OK) {
gpm_warning ("could not lock keyring");
@@ -487,12 +487,12 @@
}
do_lock = gpm_control_get_lock_policy (control, GPM_CONF_LOCK_ON_HIBERNATE);
- if (do_lock == TRUE) {
+ if (do_lock) {
gpm_screensaver_lock (screensaver);
}
gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep == TRUE) {
+ if (nm_sleep) {
gpm_networkmanager_sleep ();
}
@@ -500,24 +500,24 @@
g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_HIBERNATE);
ret = hal_gpower_hibernate (control->priv->hal_power, error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_control_convert_hal_error (control, error);
}
gpm_debug ("emitting resume");
g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_HIBERNATE);
- if (ret == FALSE) {
+ if (!ret) {
gpm_debug ("emitting sleep-failure");
g_signal_emit (control, signals [SLEEP_FAILURE], 0, GPM_CONTROL_ACTION_HIBERNATE);
}
- if (do_lock == TRUE) {
+ if (do_lock) {
gpm_screensaver_poke (screensaver);
}
gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep == TRUE) {
+ if (nm_sleep) {
gpm_networkmanager_wake ();
}
Modified: trunk/src/gpm-debug.h
==============================================================================
--- trunk/src/gpm-debug.h (original)
+++ trunk/src/gpm-debug.h Sun Jul 27 09:57:52 2008
@@ -61,7 +61,6 @@
int line,
const gchar *format, ...);
void gpm_syslog (const gchar *format, ...);
-void gpm_debug_add_option (const gchar *option);
G_END_DECLS
Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c (original)
+++ trunk/src/gpm-engine.c Sun Jul 27 09:57:52 2008
@@ -278,11 +278,11 @@
unit = gpm_cell_array_get_unit (collection->ups);
- if (unit->is_present == TRUE && unit->is_discharging == TRUE) {
+ if (unit->is_present && unit->is_discharging == TRUE) {
/* only enable this if discharging on UPS */
tooltip = g_string_new (_("Computer is running on backup power\n"));
- } else if (on_ac == TRUE) {
+ } else if (on_ac) {
tooltip = g_string_new (_("Computer is running on AC power\n"));
} else {
@@ -301,7 +301,7 @@
accuracy = gpm_profile_get_accuracy_average (engine->priv->profile,
unit->is_discharging);
- if (unit->is_present == TRUE) {
+ if (unit->is_present) {
if (accuracy == 0) {
if (unit->is_discharging) {
tooltip = g_string_append (tooltip, _("Battery discharge time is currently unknown\n"));
@@ -389,37 +389,37 @@
/* we try CRITICAL: PRIMARY, UPS, MOUSE, KEYBOARD */
gpm_debug ("Trying CRITICAL icon: primary, ups, mouse, keyboard");
- if (unit_primary->is_present == TRUE) {
+ if (unit_primary->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_primary);
if (state == GPM_WARNINGS_CRITICAL) {
return gpm_cell_array_get_icon (collection->primary);
}
}
- if (unit_ups->is_present == TRUE) {
+ if (unit_ups->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_ups);
if (state == GPM_WARNINGS_CRITICAL) {
return gpm_cell_array_get_icon (collection->ups);
}
}
- if (unit_keyboard->is_present == TRUE) {
+ if (unit_keyboard->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_phone);
if (state == GPM_WARNINGS_CRITICAL) {
return gpm_cell_array_get_icon (collection->phone);
}
}
- if (unit_mouse->is_present == TRUE) {
+ if (unit_mouse->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_mouse);
if (state == GPM_WARNINGS_CRITICAL) {
return gpm_cell_array_get_icon (collection->mouse);
}
}
- if (unit_keyboard->is_present == TRUE) {
+ if (unit_keyboard->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_keyboard);
if (state == GPM_WARNINGS_CRITICAL) {
return gpm_cell_array_get_icon (collection->keyboard);
}
}
- if (unit_keyboard->is_present == TRUE) {
+ if (unit_keyboard->is_present) {
state = gpm_warnings_get_state (engine->priv->warnings, unit_pda);
if (state == GPM_WARNINGS_CRITICAL) {
return gpm_cell_array_get_icon (collection->pda);
@@ -433,12 +433,12 @@
/* we try (DIS)CHARGING: PRIMARY, UPS */
gpm_debug ("Trying CHARGING icon: primary, ups");
- if (unit_primary->is_present == TRUE &&
- (unit_primary->is_charging == TRUE || unit_primary->is_discharging == TRUE) ) {
+ if (unit_primary->is_present &&
+ (unit_primary->is_charging || unit_primary->is_discharging == TRUE)) {
return gpm_cell_array_get_icon (collection->primary);
- } else if (unit_ups->is_present == TRUE &&
- (unit_ups->is_charging == TRUE || unit_ups->is_discharging == TRUE) ) {
+ } else if (unit_ups->is_present &&
+ (unit_ups->is_charging || unit_ups->is_discharging == TRUE)) {
return gpm_cell_array_get_icon (collection->ups);
}
@@ -450,10 +450,10 @@
/* we try PRESENT: PRIMARY, UPS */
gpm_debug ("Trying PRESENT icon: primary, ups");
- if (unit_primary->is_present == TRUE) {
+ if (unit_primary->is_present) {
return gpm_cell_array_get_icon (collection->primary);
- } else if (unit_ups->is_present == TRUE) {
+ } else if (unit_ups->is_present) {
return gpm_cell_array_get_icon (collection->ups);
}
@@ -486,7 +486,7 @@
/* only emit this if specified in gconf */
gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_PERHAPS_RECALL, &show_recall);
- if (show_recall == TRUE) {
+ if (show_recall) {
/* just proxy it to the GUI layer */
gpm_debug ("** EMIT: perhaps-recall");
g_signal_emit (engine, signals [PERHAPS_RECALL], 0, kind, oem_vendor, website);
@@ -512,7 +512,7 @@
gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_LOW_CAPACITY, &show_capacity);
/* only emit this once per startup */
- if (show_capacity == TRUE) {
+ if (show_capacity) {
/* just proxy it to the GUI layer */
gpm_debug ("** EMIT: low-capacity");
g_signal_emit (engine, signals [LOW_CAPACITY], 0, kind, capacity);
@@ -546,7 +546,7 @@
g_return_val_if_fail (GPM_IS_ENGINE (engine), FALSE);
/* show a different icon if we are disconnected */
- if (engine->priv->hal_connected == TRUE) {
+ if (engine->priv->hal_connected) {
/* check the icon */
icon = gpm_engine_get_icon (engine);
} else {
@@ -602,7 +602,7 @@
gchar *summary;
/* show a different icon if we are disconnected */
- if (engine->priv->hal_connected == TRUE) {
+ if (engine->priv->hal_connected) {
/* check the summary */
summary = gpm_engine_get_summary (engine);
} else {
@@ -640,7 +640,7 @@
g_return_if_fail (GPM_IS_ENGINE (engine));
/* we want to make this quicker */
- if (engine->priv->during_coldplug == TRUE) {
+ if (engine->priv->during_coldplug) {
gpm_debug ("ignoring due to coldplug");
return;
}
@@ -706,7 +706,7 @@
gpm_engine_recalculate_state (engine);
/* do we need to send discharging warning? */
- if (discharging == TRUE) {
+ if (discharging) {
/* only emit this if specified in gconf */
gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_DISCHARGING, &show_discharging);
@@ -774,7 +774,7 @@
gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_FULLY_CHARGED, &show_fully_charged);
/* only emit if in GConf */
- if (show_fully_charged == TRUE) {
+ if (show_fully_charged) {
/* find the kind for easy multiplexing */
kind = gpm_cell_array_get_kind (cell_array);
Modified: trunk/src/gpm-graph-widget.c
==============================================================================
--- trunk/src/gpm-graph-widget.c (original)
+++ trunk/src/gpm-graph-widget.c Sun Jul 27 09:57:52 2008
@@ -1254,11 +1254,11 @@
gpm_graph_widget_draw_labels (graph, cr);
gpm_graph_widget_draw_line (graph, cr);
- if (graph->priv->use_events == TRUE) {
+ if (graph->priv->use_events) {
gpm_graph_widget_draw_event_dots (graph, cr);
}
- if (graph->priv->use_legend == TRUE && legend_height > 0) {
+ if (graph->priv->use_legend && legend_height > 0) {
gpm_graph_widget_draw_legend (graph, legend_x, legend_y, legend_width, legend_height);
}
@@ -1456,7 +1456,7 @@
GPM_COLOUR_WHITE,
GPM_GRAPH_WIDGET_SHAPE_DIAMOND,
"white diamond");
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "refused duplicate id");
} else {
gpm_st_failed (test, "added duplicate ID!");
@@ -1484,7 +1484,7 @@
gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (graph));
gpm_st_title (test, "add invalid data");
ret = gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "ignored");
} else {
gpm_st_failed (test, "failed to ignore invalid data");
@@ -1496,7 +1496,7 @@
gpm_st_title (test, "add zero data");
gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (graph));
ret = gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "ignored");
} else {
gpm_st_failed (test, "failed to ignore zero data");
@@ -1509,7 +1509,7 @@
gpm_array_append (data, 100, 100, GPM_COLOUR_RED);
gpm_st_title (test, "add valid data");
ret = gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, NULL);
} else {
gpm_st_failed (test, "failed to add valid data");
Modified: trunk/src/gpm-idle.c
==============================================================================
--- trunk/src/gpm-idle.c (original)
+++ trunk/src/gpm-idle.c Sun Jul 27 09:57:52 2008
@@ -309,7 +309,7 @@
gpm_debug ("Received GS session idle changed: %d", is_idle);
- if (is_idle == TRUE) {
+ if (is_idle) {
mode = GPM_IDLE_MODE_SESSION;
} else {
mode = GPM_IDLE_MODE_NORMAL;
@@ -334,7 +334,7 @@
gpm_debug ("Received GS powesave idle changed: %d", is_idle);
- if (is_idle == TRUE) {
+ if (is_idle) {
mode = GPM_IDLE_MODE_POWERSAVE;
} else {
mode = GPM_IDLE_MODE_NORMAL;
Modified: trunk/src/gpm-info.c
==============================================================================
--- trunk/src/gpm-info.c (original)
+++ trunk/src/gpm-info.c Sun Jul 27 09:57:52 2008
@@ -616,7 +616,7 @@
array = info->priv->collection->primary;
unit = gpm_cell_array_get_unit (array);
- if (info->priv->is_laptop == TRUE) {
+ if (info->priv->is_laptop) {
/* work out seconds elapsed */
value_x = g_timer_elapsed (info->priv->timer, NULL) - GPM_INFO_DATA_POLL;
@@ -655,7 +655,7 @@
gboolean on_ac,
GpmInfo *info)
{
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_info_event_log (info, GPM_EVENT_ON_AC,
_("AC adapter inserted"));
} else {
@@ -837,7 +837,7 @@
/* set to a blank list */
info->priv->events = gpm_array_new ();
- if (info->priv->is_laptop == TRUE) {
+ if (info->priv->is_laptop) {
info->priv->percentage_data = gpm_array_new ();
info->priv->rate_data = gpm_array_new ();
info->priv->time_data = gpm_array_new ();
@@ -853,7 +853,7 @@
info->priv->voltage_data = NULL;
}
- if (info->priv->is_laptop == TRUE) {
+ if (info->priv->is_laptop) {
/* get the maximum x-axis size from gconf */
GpmConf *conf = gpm_conf_new ();
guint max_time;
Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c (original)
+++ trunk/src/gpm-inhibit.c Sun Jul 27 09:57:52 2008
@@ -326,7 +326,7 @@
length = g_slist_length (inhibit->priv->list);
- if (inhibit->priv->ignore_inhibits == TRUE) {
+ if (inhibit->priv->ignore_inhibits) {
gpm_debug ("Inhibit ignored through gconf policy!");
*has_inihibit = FALSE;
}
@@ -553,7 +553,7 @@
g_error_free (error);
*cookie = 0;
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
g_warning ("Inhibit failed!");
}
@@ -608,7 +608,7 @@
g_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
g_warning ("HasInhibit failed!");
}
@@ -643,9 +643,9 @@
/************************************************************/
gpm_st_title (test, "make sure we are not inhibited");
ret = has_inhibit (gproxy, &valid);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "Unable to test validity");
- } else if (valid == TRUE) {
+ } else if (valid) {
gpm_st_failed (test, "Already inhibited");
} else {
gpm_st_success (test, NULL);
@@ -654,7 +654,7 @@
/************************************************************/
gpm_st_title (test, "clear an invalid cookie");
ret = uninhibit (gproxy, 123456);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "invalid cookie failed as expected");
} else {
gpm_st_failed (test, "should have rejected invalid cookie");
@@ -666,7 +666,7 @@
"gnome-power-self-test",
"test inhibit",
&cookie1);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "Unable to inhibit");
} else if (cookie1 == 0) {
gpm_st_failed (test, "Cookie invalid (cookie: %u)", cookie1);
@@ -677,9 +677,9 @@
/************************************************************/
gpm_st_title (test, "make sure we are auto inhibited");
ret = has_inhibit (gproxy, &valid);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "Unable to test validity");
- } else if (valid == TRUE) {
+ } else if (valid) {
gpm_st_success (test, "inhibited");
} else {
gpm_st_failed (test, "inhibit failed");
@@ -691,7 +691,7 @@
"gnome-power-self-test",
"test inhibit",
&cookie2);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "Unable to inhibit");
} else if (cookie2 == 0) {
gpm_st_failed (test, "Cookie invalid (cookie: %u)", cookie2);
@@ -702,7 +702,7 @@
/************************************************************/
gpm_st_title (test, "clear cookie 1");
ret = uninhibit (gproxy, cookie1);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "cookie failed to clear");
} else {
gpm_st_success (test, NULL);
@@ -711,9 +711,9 @@
/************************************************************/
gpm_st_title (test, "make sure we are still inhibited");
ret = has_inhibit (gproxy, &valid);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "Unable to test validity");
- } else if (valid == TRUE) {
+ } else if (valid) {
gpm_st_success (test, "inhibited");
} else {
gpm_st_failed (test, "inhibit failed");
@@ -722,7 +722,7 @@
/************************************************************/
gpm_st_title (test, "clear cookie 2");
ret = uninhibit (gproxy, cookie2);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_failed (test, "cookie failed to clear");
} else {
gpm_st_success (test, NULL);
Modified: trunk/src/gpm-light-sensor.c
==============================================================================
--- trunk/src/gpm-light-sensor.c (original)
+++ trunk/src/gpm-light-sensor.c Sun Jul 27 09:57:52 2008
@@ -106,7 +106,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetBrightness failed!");
return FALSE;
@@ -114,7 +114,7 @@
/* work out average */
sensor_level_hw = 0;
- for (i = 0; i < levels->len; i++ ) {
+ for (i = 0; i < levels->len; i++) {
sensor_level_hw += g_array_index (levels, gint, i);
}
sensor_level_hw /= levels->len;
@@ -304,12 +304,12 @@
return TRUE;
}
- if (sensor->priv->has_sensor == TRUE) {
+ if (sensor->priv->has_sensor) {
/* fairly slow */
ret = gpm_light_sensor_get_hw (sensor);
/* this could fail if hal refuses us */
- if (ret == TRUE) {
+ if (ret) {
gpm_light_sensor_get_absolute (sensor, &new);
gpm_debug ("brightness = %i, %i", sensor->priv->current_hw, new);
g_signal_emit (sensor, signals [SENSOR_CHANGED], 0, new);
@@ -372,7 +372,7 @@
hal_gmanager_free_capability (names);
/* connect to the devices */
- if (sensor->priv->has_sensor == TRUE) {
+ if (sensor->priv->has_sensor) {
gpm_debug ("Using proper brightness sensor");
/* get a managed proxy */
sensor->priv->gproxy = dbus_proxy_new ();
@@ -394,7 +394,7 @@
}
/* do we have a info source? */
- if (sensor->priv->has_sensor == TRUE) {
+ if (sensor->priv->has_sensor) {
gpm_debug ("current brightness is %i%%", sensor->priv->current_hw);
/* get poll timeout */
Modified: trunk/src/gpm-load.c
==============================================================================
--- trunk/src/gpm-load.c (original)
+++ trunk/src/gpm-load.c Sun Jul 27 09:57:52 2008
@@ -213,7 +213,7 @@
/* work out the differences */
ret = gpm_load_get_cpu_values (&cpu_idle, &cpu_total);
- if (ret == FALSE) {
+ if (!ret) {
return 0.0;
}
Modified: trunk/src/gpm-main.c
==============================================================================
--- trunk/src/gpm-main.c (original)
+++ trunk/src/gpm-main.c Sun Jul 27 09:57:52 2008
@@ -78,7 +78,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("RequestName failed!");
return FALSE;
@@ -180,7 +180,7 @@
master = gnome_master_client ();
flags = gnome_client_get_flags (master);
- if (version == TRUE) {
+ if (version) {
g_print ("Version %s\n", VERSION);
goto unref_program;
}
@@ -246,7 +246,7 @@
/* Only timeout and close the mainloop if we have specified it
* on the command line */
- if (timed_exit == TRUE) {
+ if (timed_exit) {
g_timeout_add (1000 * 20, (GSourceFunc) timed_exit_cb, loop);
}
Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c (original)
+++ trunk/src/gpm-manager.c Sun Jul 27 09:57:52 2008
@@ -174,7 +174,7 @@
/* We have to decide on whether this is a idle action or a user keypress */
gpm_inhibit_has_inhibit (manager->priv->inhibit, &has_inhibit, NULL);
- if (has_inhibit == TRUE) {
+ if (has_inhibit) {
GString *message = g_string_new ("");
const char *msg;
@@ -233,7 +233,7 @@
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_uint (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC, &sleep_computer);
gpm_conf_get_uint (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC, &sleep_display);
gpm_conf_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_AC, &power_save);
@@ -270,7 +270,7 @@
do_lock = gpm_control_get_lock_policy (manager->priv->control,
GPM_CONF_LOCK_ON_BLANK_SCREEN);
- if (do_lock == TRUE) {
+ if (do_lock) {
if (!gpm_screensaver_lock (manager->priv->screensaver))
gpm_debug ("Could not lock screen via gnome-screensaver");
}
@@ -308,7 +308,7 @@
}
do_lock = gpm_control_get_lock_policy (manager->priv->control, GPM_CONF_LOCK_ON_BLANK_SCREEN);
- if (do_lock == TRUE) {
+ if (do_lock) {
gpm_screensaver_poke (manager->priv->screensaver);
}
return ret;
@@ -694,7 +694,7 @@
g_return_val_if_fail (manager != NULL, FALSE);
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- if (on_ac == TRUE) {
+ if (on_ac) {
*on_battery = FALSE;
} else {
*on_battery = TRUE;
@@ -736,7 +736,7 @@
/* find if we are on AC power */
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_string (manager->priv->conf, GPM_CONF_ACTIONS_SLEEP_TYPE_AC, &action);
} else {
gpm_conf_get_string (manager->priv->conf, GPM_CONF_ACTIONS_SLEEP_TYPE_BATT, &action);
@@ -754,12 +754,12 @@
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_SUSPEND,
_("Suspending computer."), _("System idle."));
ret = gpm_control_suspend (manager->priv->control, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_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 == FALSE) {
+ if (!ret) {
gpm_warning ("cannot suspend or hibernate: %s", error->message);
g_error_free (error);
}
@@ -769,12 +769,12 @@
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_HIBERNATE,
_("Hibernating computer."), _("System idle."));
ret = gpm_control_hibernate (manager->priv->control, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_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 == FALSE) {
+ if (!ret) {
gpm_warning ("cannot suspend or hibernate: %s", error->message);
g_error_free (error);
}
@@ -804,7 +804,7 @@
* the screen when the user moves the mouse on systems that do not
* support hardware blanking.
* Details are here: https://launchpad.net/malone/bugs/22522 */
- if (gpm_button_is_lid_closed (manager->priv->button) == TRUE) {
+ if (gpm_button_is_lid_closed (manager->priv->button)) {
gpm_debug ("lid is closed, so we are ignoring idle state changes");
return;
}
@@ -910,7 +910,7 @@
return;
}
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_debug ("Performing AC policy");
manager_policy_do (manager, GPM_CONF_BUTTON_LID_AC,
_("The lid has been closed on ac power."));
@@ -924,7 +924,7 @@
gpm_inhibit_has_inhibit (manager->priv->inhibit, &has_inhibit, NULL);
/* do not do lid close action if suspend (or hibernate) */
- if (has_inhibit == TRUE) {
+ if (has_inhibit) {
/* get the policy action for battery */
gpm_conf_get_string (manager->priv->conf, GPM_CONF_BUTTON_LID_BATT, &action);
@@ -1004,14 +1004,14 @@
gpm_manager_sync_policy_sleep (manager);
gpm_debug ("emitting on-ac-changed : %i", on_ac);
- if (on_ac == TRUE) {
+ if (on_ac) {
g_signal_emit (manager, signals [ON_BATTERY_CHANGED], 0, FALSE);
} else {
g_signal_emit (manager, signals [ON_BATTERY_CHANGED], 0, TRUE);
}
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_AC, &power_save);
} else {
gpm_conf_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, &power_save);
@@ -1028,7 +1028,7 @@
/* We keep track of the lid state so we can do the
lid close on battery action if the ac_adapter is removed when the laptop
is closed. Fixes #331655 */
- if (event_when_closed == TRUE &&
+ if (event_when_closed &&
on_ac == FALSE &&
gpm_button_is_lid_closed (manager->priv->button)) {
manager_policy_do (manager, GPM_CONF_BUTTON_LID_BATT,
@@ -1174,10 +1174,10 @@
hal_gpower_has_suspend_error (manager->priv->hal_power, &suspend_error);
hal_gpower_has_hibernate_error (manager->priv->hal_power, &hibernate_error);
- if (suspend_error == TRUE) {
+ if (suspend_error) {
gpm_notify_sleep_failed (manager->priv->notify, FALSE);
}
- if (hibernate_error == TRUE) {
+ if (hibernate_error) {
gpm_notify_sleep_failed (manager->priv->notify, TRUE);
}
}
@@ -1200,13 +1200,13 @@
if (auth_begin == FALSE) {
error = NULL;
ret = hal_gpower_clear_suspend_error (manager->priv->hal_power, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_debug ("Failed to clear suspend error; %s", error->message);
g_error_free (error);
}
error = NULL;
ret = hal_gpower_clear_hibernate_error (manager->priv->hal_power, &error);
- if (ret == FALSE) {
+ if (!ret) {
gpm_debug ("Failed to clear hibernate error; %s", error->message);
g_error_free (error);
}
@@ -1340,7 +1340,7 @@
gpm_conf_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_SLEEP_FAILED, &show_sleep_failed);
/* only emit if in GConf */
- if (show_sleep_failed == TRUE) {
+ if (show_sleep_failed) {
if (action == GPM_CONTROL_ACTION_SUSPEND) {
gpm_syslog ("suspend failed");
gpm_notify_sleep_failed (manager->priv->notify, FALSE);
@@ -1674,7 +1674,7 @@
/* check to see if the user has installed the schema properly */
ret = gpm_conf_get_uint (manager->priv->conf, GPM_CONF_SCHEMA_VERSION, &version);
- if (ret == FALSE || version != GPM_CONF_SCHEMA_ID) {
+ if (!ret || version != GPM_CONF_SCHEMA_ID) {
gpm_notify_display (manager->priv->notify,
_("Install problem!"),
_("The configuration defaults for GNOME Power Manager have not been installed correctly.\n"
@@ -1692,7 +1692,7 @@
/* coldplug so we are in the correct state at startup */
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_AC, &manager->priv->low_power);
} else {
gpm_conf_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, &manager->priv->low_power);
Modified: trunk/src/gpm-notify.c
==============================================================================
--- trunk/src/gpm-notify.c (original)
+++ trunk/src/gpm-notify.c Sun Jul 27 09:57:52 2008
@@ -104,7 +104,7 @@
}
if (notify->priv->status_icon != NULL &&
- gtk_status_icon_get_visible (notify->priv->status_icon) == TRUE) {
+ gtk_status_icon_get_visible (notify->priv->status_icon)) {
notify->priv->libnotify = notify_notification_new_with_status_icon (title, content,
msgicon,
notify->priv->status_icon);
@@ -135,7 +135,7 @@
{
gboolean ret;
ret = notify_notification_show (notify->priv->libnotify, NULL);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("failed to send notification");
}
return ret;
@@ -280,7 +280,7 @@
{
/* for where we add back the ac_adapter before the "AC Power unplugged"
* message times out. */
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_debug ("clearing notify due ac being present");
gpm_notify_cancel (notify);
}
@@ -324,7 +324,7 @@
ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
g_free (cmdline);
- if (ret == TRUE)
+ if (ret)
return;
g_error_free (error);
@@ -334,7 +334,7 @@
ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
g_free (cmdline);
- if (ret == FALSE) {
+ if (!ret) {
error_dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Failed to show url %s", error->message);
gtk_dialog_run (GTK_DIALOG (error_dialog));
g_error_free (error);
@@ -580,7 +580,7 @@
const gchar *icon;
title = _("Sleep Problem");
- if (hibernate == TRUE) {
+ if (hibernate) {
msg = _("Your computer failed to hibernate.\nCheck the help file for common problems.");
icon = GPM_STOCK_HIBERNATE;
} else {
Modified: trunk/src/gpm-phone.c
==============================================================================
--- trunk/src/gpm-phone.c (original)
+++ trunk/src/gpm-phone.c Sun Jul 27 09:57:52 2008
@@ -135,7 +135,7 @@
{
g_return_val_if_fail (phone != NULL, 0);
g_return_val_if_fail (GPM_IS_PHONE (phone), 0);
- if (phone->priv->present == TRUE) {
+ if (phone->priv->present) {
return 1;
}
return 0;
@@ -187,7 +187,7 @@
return;
}
- if (phone->priv->present == TRUE) {
+ if (phone->priv->present) {
gpm_warning ("duplicate NumberBatteriesChanged with no change");
return;
}
@@ -325,7 +325,7 @@
gpm_debug ("removing proxy\n");
g_object_unref (phone->priv->proxy);
phone->priv->proxy = NULL;
- if (phone->priv->present == TRUE) {
+ if (phone->priv->present) {
phone->priv->present = FALSE;
phone->priv->percentage = 0;
gpm_debug ("emitting device-removed : (%i)", 0);
@@ -476,7 +476,7 @@
/************************************************************/
gpm_st_title (test, "coldplug the data");
ret = gpm_phone_coldplug (phone);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "coldplug okay");
} else {
gpm_st_failed (test, "could not coldplug");
@@ -486,7 +486,7 @@
/************************************************************/
gpm_st_title (test, "got refresh");
- if (test_got_refresh == TRUE) {
+ if (test_got_refresh) {
gpm_st_success (test, NULL);
} else {
gpm_st_failed (test, "did not get refresh");
@@ -504,7 +504,7 @@
/************************************************************/
gpm_st_title (test, "check the present value");
ret = gpm_phone_get_present (phone, 0);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "we are here!");
} else {
gpm_st_failed (test, "not here...");
@@ -522,7 +522,7 @@
/************************************************************/
gpm_st_title (test, "check the ac value");
ret = gpm_phone_get_on_ac (phone, 0);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "not charging, correct");
} else {
gpm_st_failed (test, "charging?");
Modified: trunk/src/gpm-polkit.c
==============================================================================
--- trunk/src/gpm-polkit.c (original)
+++ trunk/src/gpm-polkit.c Sun Jul 27 09:57:52 2008
@@ -90,7 +90,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("IsUserPrivileged failed!");
return FALSE;
Modified: trunk/src/gpm-prefs-core.c
==============================================================================
--- trunk/src/gpm-prefs-core.c (original)
+++ trunk/src/gpm-prefs-core.c Sun Jul 27 09:57:52 2008
@@ -175,7 +175,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("%s failed!", method);
return FALSE;
@@ -219,7 +219,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("%s failed!", method);
return FALSE;
@@ -771,7 +771,7 @@
gpm_prefs_setup_checkbox (prefs, "checkbutton_notification_sound",
GPM_CONF_UI_ENABLE_BEEPING);
- if (prefs->priv->has_batteries == TRUE) {
+ if (prefs->priv->has_batteries) {
/* there's no use case for displaying this option */
gtk_widget_hide_all (radiobutton_icon_never);
}
Modified: trunk/src/gpm-profile.c
==============================================================================
--- trunk/src/gpm-profile.c (original)
+++ trunk/src/gpm-profile.c Sun Jul 27 09:57:52 2008
@@ -122,7 +122,7 @@
}
/* use home directory */
- if (discharge == TRUE) {
+ if (discharge) {
suffix = "discharging.csv";
} else {
suffix = "charging.csv";
@@ -150,7 +150,7 @@
g_return_if_fail (GPM_IS_PROFILE (profile));
/* get the correct data */
- if (profile->priv->discharging == TRUE) {
+ if (profile->priv->discharging) {
array_data = profile->priv->float_data_discharge;
array_accuracy = profile->priv->float_accuracy_discharge;
} else {
@@ -184,7 +184,7 @@
g_return_val_if_fail (GPM_IS_PROFILE (profile), NULL);
/* get the correct data */
- if (discharge == TRUE) {
+ if (discharge) {
array_data = profile->priv->float_data_discharge;
array_accuracy = profile->priv->float_accuracy_discharge;
} else {
@@ -228,7 +228,7 @@
GArray *array;
/* get the correct data */
- if (discharge == TRUE) {
+ if (discharge) {
array = profile->priv->float_accuracy_discharge;
} else {
array = profile->priv->float_accuracy_charge;
@@ -263,7 +263,7 @@
}
/* get the correct data */
- if (discharge == TRUE) {
+ if (discharge) {
array = profile->priv->float_accuracy_discharge;
} else {
array = profile->priv->float_accuracy_charge;
@@ -312,7 +312,7 @@
}
/* compute correct area of integral */
- if (discharge == TRUE) {
+ if (discharge) {
time = gpm_array_float_compute_integral (profile->priv->float_data_discharge, 0, percentage);
} else {
time = gpm_array_float_compute_integral (profile->priv->float_data_charge, percentage, 99);
@@ -405,7 +405,7 @@
gfloat average;
/* get the correct data */
- if (profile->priv->discharging == TRUE) {
+ if (profile->priv->discharging) {
array_data = profile->priv->float_data_discharge;
array_accuracy = profile->priv->float_accuracy_discharge;
} else {
@@ -444,7 +444,7 @@
gfloat accuracy;
/* get the correct data */
- if (profile->priv->discharging == TRUE) {
+ if (profile->priv->discharging) {
array_data = profile->priv->float_data_discharge;
array_accuracy = profile->priv->float_accuracy_discharge;
} else {
@@ -474,7 +474,7 @@
gpm_array_float_set (array_accuracy, percentage, accuracy);
/* guess missing data between 5 and 95 */
- if (profile->priv->use_guessing == TRUE) {
+ if (profile->priv->use_guessing) {
gpm_profile_set_average_no_accuracy (profile);
}
@@ -548,7 +548,7 @@
/* If we are discharging, 99-0 is valid, but when we are charging,
* 1-100 is valid. Be careful how we index the arrays in this case */
- if (profile->priv->discharging == TRUE) {
+ if (profile->priv->discharging) {
array_percentage = percentage;
} else {
if (percentage == 0) {
@@ -591,11 +591,11 @@
g_return_val_if_fail (profile != NULL, FALSE);
g_return_val_if_fail (GPM_IS_PROFILE (profile), FALSE);
- if (is_charging == TRUE) {
+ if (is_charging) {
/* uninteresting case */
return FALSE;
}
- if (profile->priv->discharging == TRUE) {
+ if (profile->priv->discharging) {
/* normal case, the ac_adapter has been removed half way
through charging, and we really don't care */
return FALSE;
@@ -627,7 +627,7 @@
profile->priv->data_valid = FALSE;
/* check AC state */
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_debug ("on AC");
profile->priv->discharging = FALSE;
} else {
@@ -720,7 +720,7 @@
gpm_array_set_fixed_size (array, 100);
/* get the correct data */
- if (discharge == TRUE) {
+ if (discharge) {
array_data = profile->priv->float_data_discharge;
array_accuracy = profile->priv->float_accuracy_discharge;
} else {
@@ -734,7 +734,7 @@
ret = gpm_array_load_from_file (array, filename);
/* if not found, then generate a new one with a low propability */
- if (ret == FALSE) {
+ if (!ret) {
/* directory might not exist */
path = g_build_filename (g_get_home_dir (), ".gnome2", "gnome-power-manager", NULL);
@@ -748,7 +748,7 @@
}
ret = gpm_array_save_to_file (array, filename);
- if (ret == FALSE) {
+ if (!ret) {
gpm_warning ("saving state failed. You will not get accurate time remaining calculations");
}
}
@@ -790,14 +790,14 @@
profile->priv->config_id = g_strdup (config_id);
reload = TRUE;
}
- if (reload == TRUE) {
+ if (reload) {
/* get initial data */
gpm_profile_load_data (profile, TRUE);
gpm_profile_load_data (profile, FALSE);
}
/* do debugging self tests only if verbose */
- if (gpm_debug_is_verbose () == TRUE) {
+ if (gpm_debug_is_verbose ()) {
gpm_debug ("Reference times");
time = gpm_profile_get_time (profile, 99, TRUE);
gpm_debug ("99-0\t%i minutes", time / 60);
@@ -848,7 +848,7 @@
}
/* get the correct data */
- if (profile->priv->discharging == TRUE) {
+ if (profile->priv->discharging) {
array = profile->priv->float_accuracy_discharge;
} else {
array = profile->priv->float_accuracy_charge;
@@ -926,7 +926,7 @@
on_ac = gpm_ac_adapter_is_present (profile->priv->ac_adapter);
/* check AC state */
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_debug ("on AC");
profile->priv->discharging = FALSE;
} else {
@@ -1038,7 +1038,7 @@
/************************************************************/
gpm_st_title (test, "set config id");
ret = gpm_profile_set_config_id (profile, "test123");
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set type");
} else {
gpm_st_failed (test, "could not set type");
@@ -1102,7 +1102,7 @@
/************************************************************/
gpm_st_title (test, "ignore first point");
ret = gpm_profile_register_percentage (profile, 99);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "ignored first");
} else {
gpm_st_failed (test, "ignored second");
Modified: trunk/src/gpm-screensaver.c
==============================================================================
--- trunk/src/gpm-screensaver.c (original)
+++ trunk/src/gpm-screensaver.c Sun Jul 27 09:57:52 2008
@@ -309,7 +309,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("Throttle failed!");
return 0;
@@ -344,7 +344,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("UnThrottle failed!");
return FALSE;
@@ -444,7 +444,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetActiveTime failed!");
return FALSE;
Modified: trunk/src/gpm-self-test.c
==============================================================================
--- trunk/src/gpm-self-test.c (original)
+++ trunk/src/gpm-self-test.c Sun Jul 27 09:57:52 2008
@@ -38,7 +38,7 @@
if (class == CLASS_MANUAL && test->class == CLASS_AUTO) {
return FALSE;
}
- if (test->started == TRUE) {
+ if (test->started) {
g_print ("Not ended test! Cannot start!\n");
exit (1);
}
Modified: trunk/src/gpm-srv-brightness-kbd.c
==============================================================================
--- trunk/src/gpm-srv-brightness-kbd.c (original)
+++ trunk/src/gpm-srv-brightness-kbd.c Sun Jul 27 09:57:52 2008
@@ -86,7 +86,7 @@
if (strcmp (key, GPM_CONF_KEYBOARD_BRIGHTNESS_AC) == 0) {
gpm_conf_get_int (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, &value);
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_brightness_kbd_set_std (srv_brightness->priv->brightness, value);
}
@@ -115,7 +115,7 @@
{
guint value;
- if (on_ac == TRUE) {
+ if (on_ac) {
gpm_conf_get_uint (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, &value);
} else {
gpm_conf_get_uint (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_BATT, &value);
@@ -315,7 +315,7 @@
GpmSrvBrightnessKbd *srv_brightness = NULL;
/* only load an instance of this module if we have the hardware */
- if (gpm_brightness_kbd_has_hw () == TRUE) {
+ if (gpm_brightness_kbd_has_hw ()) {
srv_brightness = g_object_new (GPM_TYPE_SRV_BRIGHTNESS_KBD, NULL);
}
Modified: trunk/src/gpm-srv-screensaver.c
==============================================================================
--- trunk/src/gpm-srv-screensaver.c (original)
+++ trunk/src/gpm-srv-screensaver.c Sun Jul 27 09:57:52 2008
@@ -69,7 +69,7 @@
GpmSrvScreensaver *srv_screensaver)
{
/* only clear errors if we have finished the authentication */
- if (auth_begin == TRUE) {
+ if (auth_begin) {
GError *error;
/* TODO: This may be a bid of a bodge, as we will have multiple
@@ -118,7 +118,7 @@
{
/* Throttle the srv_screensaver when we are not on AC power so we don't
waste the battery */
- if (on_ac == TRUE) {
+ if (on_ac) {
if (srv_screensaver->priv->ac_throttle_id != 0) {
gpm_screensaver_remove_throttle (srv_screensaver->priv->screensaver, srv_screensaver->priv->ac_throttle_id);
srv_screensaver->priv->ac_throttle_id = 0;
Modified: trunk/src/gpm-statistics-core.c
==============================================================================
--- trunk/src/gpm-statistics-core.c (original)
+++ trunk/src/gpm-statistics-core.c Sun Jul 27 09:57:52 2008
@@ -250,7 +250,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetEventLog failed!");
return FALSE;
@@ -387,7 +387,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetTypes failed!");
return FALSE;
@@ -457,7 +457,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetData failed!");
return FALSE;
@@ -539,7 +539,7 @@
gpm_debug ("ERROR: %s", error->message);
g_error_free (error);
}
- if (ret == FALSE) {
+ if (!ret) {
/* abort as the DBUS method failed */
gpm_warning ("GetAxisTypes failed!");
return FALSE;
@@ -618,7 +618,7 @@
}
gpm_conf_get_bool (statistics->priv->conf, GPM_CONF_STATS_SMOOTH_DATA, &smooth);
- if (smooth == TRUE) {
+ if (smooth) {
GArray *arrayfloat;
GArray *kernel;
GArray *result;
@@ -705,7 +705,7 @@
guint count, pos;
ret = gpm_statistics_find_types (statistics, &list);
- if (ret == FALSE) {
+ if (!ret) {
return;
}
Modified: trunk/src/gpm-tray-icon.c
==============================================================================
--- trunk/src/gpm-tray-icon.c (original)
+++ trunk/src/gpm-tray-icon.c Sun Jul 27 09:57:52 2008
@@ -590,13 +590,13 @@
}
/* only do the seporator if we have at least one device and can do an action */
- if (dev_cnt != 0 && (icon->priv->show_suspend == TRUE || icon->priv->show_hibernate == TRUE)) {
+ if (dev_cnt != 0 && (icon->priv->show_suspend || icon->priv->show_hibernate == TRUE)) {
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
}
/* Suspend if available */
- if (icon->priv->show_suspend == TRUE) {
+ if (icon->priv->show_suspend) {
item = gtk_image_menu_item_new_with_mnemonic (_("_Suspend"));
image = gtk_image_new_from_icon_name (GPM_STOCK_SUSPEND, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
@@ -606,7 +606,7 @@
}
/* Hibernate if available */
- if (icon->priv->show_hibernate == TRUE) {
+ if (icon->priv->show_hibernate) {
item = gtk_image_menu_item_new_with_mnemonic (_("Hi_bernate"));
image = gtk_image_new_from_icon_name (GPM_STOCK_HIBERNATE, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
Modified: trunk/src/gpm-warnings.c
==============================================================================
--- trunk/src/gpm-warnings.c (original)
+++ trunk/src/gpm-warnings.c Sun Jul 27 09:57:52 2008
@@ -151,7 +151,7 @@
type = gpm_warnings_get_state_percentage (warnings, unit);
} else if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
- warnings->priv->use_time_primary == TRUE) {
+ warnings->priv->use_time_primary) {
type = gpm_warnings_get_state_time (warnings, unit);
@@ -262,7 +262,7 @@
/* We can disable this if the ACPI BIOS is broken, and the
time_remaining is therefore inaccurate or just plain wrong. */
gpm_conf_get_bool (warnings->priv->conf, GPM_CONF_USE_TIME_POLICY, &warnings->priv->use_time_primary);
- if (warnings->priv->use_time_primary == TRUE) {
+ if (warnings->priv->use_time_primary) {
gpm_debug ("Using per-time notification policy");
} else {
gpm_debug ("Using percentage notification policy");
Modified: trunk/test/gpm-st-hal-device.c
==============================================================================
--- trunk/test/gpm-st-hal-device.c (original)
+++ trunk/test/gpm-st-hal-device.c Sun Jul 27 09:57:52 2008
@@ -59,7 +59,7 @@
/************************************************************/
gpm_st_title (test, "make sure we can set a UDI");
ret = hal_gdevice_set_udi (device, HAL_ROOT_COMPUTER);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set UDI");
} else {
gpm_st_failed (test, "could not set UDI");
@@ -77,7 +77,7 @@
/************************************************************/
gpm_st_title (test, "make sure we cannot set another UDI");
ret = hal_gdevice_set_udi (device, "foo");
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "Cannot set another UDI");
} else {
gpm_st_failed (test, "Able to overwrite UDI");
@@ -86,7 +86,7 @@
/************************************************************/
gpm_st_title (test, "make sure we can get a string key");
ret = hal_gdevice_get_string (device, "info.product", &retstr, NULL);
- if (ret == TRUE && retstr && strcmp (retstr, "Computer") == 0) {
+ if (ret && retstr && strcmp (retstr, "Computer") == 0) {
gpm_st_success (test, "got correct key");
} else {
gpm_st_failed (test, "got invalid key");
@@ -96,7 +96,7 @@
/************************************************************/
gpm_st_title (test, "try to get property modified events");
ret = hal_gdevice_watch_property_modified (device);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "got notification");
} else {
gpm_st_failed (test, "could not get notification");
@@ -105,7 +105,7 @@
/************************************************************/
gpm_st_title (test, "try to get duplicate property modified events");
ret = hal_gdevice_watch_property_modified (device);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "duplicate notification refused");
} else {
gpm_st_failed (test, "got duplicate notification");
@@ -114,7 +114,7 @@
/************************************************************/
gpm_st_title (test, "try to cancel property modified events");
ret = hal_gdevice_remove_property_modified (device);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "cancel notification");
} else {
gpm_st_failed (test, "could not cancel notification");
@@ -123,7 +123,7 @@
/************************************************************/
gpm_st_title (test, "try to get duplicate property modified cancel");
ret = hal_gdevice_remove_property_modified (device);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "duplicate cancel refused");
} else {
gpm_st_failed (test, "did duplicate cancel");
Modified: trunk/test/gpm-st-hal-devicestore.c
==============================================================================
--- trunk/test/gpm-st-hal-devicestore.c (original)
+++ trunk/test/gpm-st-hal-devicestore.c Sun Jul 27 09:57:52 2008
@@ -53,7 +53,7 @@
device = hal_gdevice_new ();
hal_gdevice_set_udi (device, HAL_ROOT_COMPUTER);
ret = hal_gdevicestore_present (devicestore, device);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "could not get different device");
} else {
gpm_st_failed (test, "got computer in empty store");
@@ -62,7 +62,7 @@
/************************************************************/
gpm_st_title (test, "insert device");
ret = hal_gdevicestore_insert (devicestore, device);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "inserted device");
} else {
gpm_st_failed (test, "could not insert device");
@@ -71,7 +71,7 @@
/************************************************************/
gpm_st_title (test, "insert duplicate device");
ret = hal_gdevicestore_insert (devicestore, device);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "cannot insert duplicate device");
} else {
gpm_st_failed (test, "inserted duplicate device");
@@ -80,7 +80,7 @@
/************************************************************/
gpm_st_title (test, "make sure device in store");
ret = hal_gdevicestore_present (devicestore, device);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "found device");
} else {
gpm_st_failed (test, "could not find device");
@@ -109,7 +109,7 @@
device2 = hal_gdevice_new ();
hal_gdevice_set_udi (device2, HAL_ROOT_COMPUTER);
ret = hal_gdevicestore_present (devicestore, device2);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "found device");
} else {
gpm_st_failed (test, "could not find device");
@@ -119,7 +119,7 @@
gpm_st_title (test, "remove device");
g_object_ref (device); /* so we can test it in a minute */
ret = hal_gdevicestore_remove (devicestore, device);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "removed device");
} else {
gpm_st_failed (test, "could not remove device");
@@ -128,7 +128,7 @@
/************************************************************/
gpm_st_title (test, "make sure device not in devicestore");
ret = hal_gdevicestore_present (devicestore, device);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "could not get device from empty devicestore");
} else {
gpm_st_failed (test, "got computer in empty store");
Modified: trunk/test/gpm-st-hal-manager.c
==============================================================================
--- trunk/test/gpm-st-hal-manager.c (original)
+++ trunk/test/gpm-st-hal-manager.c Sun Jul 27 09:57:52 2008
@@ -46,7 +46,7 @@
/************************************************************/
gpm_st_title (test, "check if we are a laptop");
ret = hal_gmanager_is_laptop (manager);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "identified as a laptop");
} else {
gpm_st_failed (test, "not identified as a laptop");
@@ -57,7 +57,7 @@
gchar **value;
gpm_st_title (test, "search for battery devices");
ret = hal_gmanager_find_capability (manager, "battery", &value, NULL);
- if (ret == TRUE && value != NULL && value[0] != NULL) {
+ if (ret && value != NULL && value[0] != NULL) {
gpm_st_success (test, "found battery device");
} else {
gpm_st_failed (test, "did not find battery device");
Modified: trunk/test/gpm-st-hal-power.c
==============================================================================
--- trunk/test/gpm-st-hal-power.c (original)
+++ trunk/test/gpm-st-hal-power.c Sun Jul 27 09:57:52 2008
@@ -46,7 +46,7 @@
/************************************************************/
gpm_st_title (test, "make sure we have pm support");
ret = hal_gpower_has_support (power);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "has pm support");
} else {
gpm_st_failed (test, "does not have pm support");
Modified: trunk/test/gpm-st-idletime.c
==============================================================================
--- trunk/test/gpm-st-idletime.c (original)
+++ trunk/test/gpm-st-idletime.c Sun Jul 27 09:57:52 2008
@@ -122,7 +122,7 @@
/************************************************************/
gpm_st_title (test, "check if we can set an reset alarm");
ret = idletime_alarm_set (idletime, 0, 100);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "ignored reset alarm");
} else {
gpm_st_failed (test, "did not ignore reset alarm");
@@ -131,7 +131,7 @@
/************************************************************/
gpm_st_title (test, "check if we can set an alarm timeout of zero");
ret = idletime_alarm_set (idletime, 999, 0);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "ignored invalid alarm");
} else {
gpm_st_failed (test, "did not ignore invalid alarm");
@@ -141,7 +141,7 @@
g_timer_start (timer);
gpm_st_title (test, "check if we can set an alarm");
ret = idletime_alarm_set (idletime, 101, 5000);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set alarm okay");
} else {
gpm_st_failed (test, "could not set alarm");
@@ -160,7 +160,7 @@
g_timer_start (timer);
gpm_st_title (test, "check if we can set an alarm");
ret = idletime_alarm_set (idletime, 101, 5000);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set alarm 5000ms okay");
} else {
gpm_st_failed (test, "could not set alarm 5000ms");
@@ -197,7 +197,7 @@
g_timer_start (timer);
gpm_st_title (test, "check if we can set an existing alarm");
ret = idletime_alarm_set (idletime, 101, 10000);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "set alarm 10000ms okay");
} else {
gpm_st_failed (test, "could not set alarm 10000ms");
@@ -219,7 +219,7 @@
/************************************************************/
gpm_st_title (test, "check if we can remove an invalid alarm");
ret = idletime_alarm_remove (idletime, 202);
- if (ret == FALSE) {
+ if (!ret) {
gpm_st_success (test, "ignored invalid alarm");
} else {
gpm_st_failed (test, "removed invalid alarm");
@@ -228,7 +228,7 @@
/************************************************************/
gpm_st_title (test, "check if we can remove an valid alarm");
ret = idletime_alarm_remove (idletime, 101);
- if (ret == TRUE) {
+ if (ret) {
gpm_st_success (test, "removed valid alarm");
} else {
gpm_st_failed (test, "failed to remove valid alarm");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]