gnome-power-manager r3027 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3027 - in trunk: . src
- Date: Wed, 22 Oct 2008 08:39:02 +0000 (UTC)
Author: rhughes
Date: Wed Oct 22 08:39:02 2008
New Revision: 3027
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3027&view=rev
Log:
2008-10-22 Richard Hughes <richard hughsie com>
* src/Makefile.am:
* src/gpm-backlight.c: (gpm_backlight_sync_policy),
(gpm_backlight_brightness_evaluate_and_set),
(gpm_conf_gconf_key_changed_cb),
(gpm_backlight_notify_system_idle_changed), (gpm_backlight_init):
* src/gpm-brightness-kbd.c: (gpm_brightness_kbd_finalize),
(gpm_brightness_kbd_init):
* src/gpm-cell-array.c: (gpm_cell_array_get_time_until_action),
(conf_key_changed_cb), (gpm_cell_array_init):
* src/gpm-common.h:
* src/gpm-conf.c:
* src/gpm-conf.h:
* src/gpm-control.c: (gpm_control_error_quark),
(gpm_control_allowed_suspend), (gpm_control_allowed_hibernate),
(gpm_control_allowed_shutdown), (gpm_control_allowed_reboot),
(gpm_control_shutdown), (gpm_control_reboot),
(gpm_control_get_lock_policy), (gpm_control_suspend),
(gpm_control_hibernate), (gpm_control_init):
* src/gpm-dpms.c:
* src/gpm-engine.c: (gpm_cell_array_perhaps_recall_cb),
(gpm_cell_array_low_capacity_cb),
(gpm_cell_array_discharging_changed_cb),
(gpm_cell_array_fully_charged_cb), (conf_key_changed_cb),
(gpm_engine_init):
* src/gpm-info.c: (control_sleep_failure_cb), (gpm_info_init):
* src/gpm-inhibit.c: (gpm_inhibit_get_message),
(gpm_conf_gconf_key_changed_cb), (gpm_inhibit_init):
* src/gpm-light-sensor.c: (gpm_light_sensor_class_init),
(gpm_light_sensor_has_hw), (gpm_light_sensor_poll_cb),
(gpm_light_sensor_init):
* src/gpm-manager.c: (gpm_manager_play),
(gpm_manager_sync_policy_sleep), (gpm_manager_action_suspend),
(gpm_manager_action_hibernate), (manager_policy_do),
(gpm_manager_suspend), (gpm_manager_hibernate), (idle_do_sleep),
(lid_button_pressed), (ac_adapter_changed_cb),
(gpm_conf_gconf_key_changed_cb), (gpm_manager_tray_icon_hibernate),
(control_sleep_failure_cb), (gpm_engine_charge_critical_cb),
(gpm_engine_charge_action_cb), (has_inhibit_changed_cb),
(gpm_manager_init), (gpm_manager_finalize):
* src/gpm-notify.c: (notify_general_clicked_cb), (gpm_notify_init):
* src/gpm-phone.c:
* src/gpm-prefs-core.c: (gpm_prefs_icon_radio_cb),
(gpm_prefs_sleep_slider_changed_cb),
(gpm_prefs_setup_sleep_slider),
(gpm_prefs_brightness_slider_changed_cb),
(gpm_prefs_setup_brightness_slider),
(gpm_prefs_action_combo_changed_cb),
(gpm_prefs_setup_action_combo), (gpm_prefs_checkbox_lock_cb),
(gpm_prefs_setup_checkbox), (gpm_conf_gconf_key_changed_cb),
(prefs_setup_notification), (gpm_prefs_init):
* src/gpm-screensaver.c: (gpm_conf_gconf_key_changed_cb),
(gpm_screensaver_lock_enabled), (gpm_screensaver_lock_set),
(gpm_screensaver_init):
* src/gpm-srv-brightness-kbd.c: (conf_key_changed_cb),
(ac_adapter_changed_cb), (gpm_srv_brightness_kbd_init):
* src/gpm-srv-screensaver.c: (gpm_srv_screensaver_init):
* src/gpm-statistics-core.c: (gpm_statistics_delete_event_cb),
(gpm_conf_gconf_key_changed_cb),
(gpm_statistics_checkbox_events_cb),
(gpm_statistics_refresh_axis_labels),
(gpm_statistics_refresh_data),
(gpm_statistics_type_combo_changed_cb),
(gpm_statistics_populate_graph_types), (gpm_statistics_init):
* src/gpm-statistics.c:
* src/gpm-tray-icon.c: (gpm_conf_gconf_key_changed_cb),
(gpm_tray_icon_init), (gpm_tray_icon_finalize):
* src/gpm-warnings.c: (gconf_key_changed_cb), (gpm_warnings_init):
Remove GpmConf and use gconf_client directly.
Removed:
trunk/src/gpm-conf.c
trunk/src/gpm-conf.h
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/gpm-backlight.c
trunk/src/gpm-brightness-kbd.c
trunk/src/gpm-cell-array.c
trunk/src/gpm-common.h
trunk/src/gpm-control.c
trunk/src/gpm-dpms.c
trunk/src/gpm-engine.c
trunk/src/gpm-info.c
trunk/src/gpm-inhibit.c
trunk/src/gpm-light-sensor.c
trunk/src/gpm-manager.c
trunk/src/gpm-notify.c
trunk/src/gpm-phone.c
trunk/src/gpm-prefs-core.c
trunk/src/gpm-screensaver.c
trunk/src/gpm-srv-brightness-kbd.c
trunk/src/gpm-srv-screensaver.c
trunk/src/gpm-statistics-core.c
trunk/src/gpm-statistics.c
trunk/src/gpm-tray-icon.c
trunk/src/gpm-warnings.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Oct 22 08:39:02 2008
@@ -73,8 +73,6 @@
gpm-graph-widget.c \
gpm-marshal.h \
gpm-marshal.c \
- gpm-conf.h \
- gpm-conf.c \
gpm-common.h \
gpm-common.c \
$(NULL)
@@ -101,8 +99,6 @@
egg-dbus-monitor.c \
gpm-dpms.h \
gpm-dpms.c \
- gpm-conf.h \
- gpm-conf.c \
gpm-idle.h \
gpm-idle.c \
gpm-load.h \
@@ -171,8 +167,6 @@
gpm-srv-brightness-kbd.c \
gpm-srv-screensaver.h \
gpm-srv-screensaver.c \
- gpm-conf.h \
- gpm-conf.c \
gpm-idle.h \
gpm-idle.c \
gpm-load.h \
@@ -288,8 +282,6 @@
gpm-cell-array.c \
gpm-warnings.h \
gpm-warnings.c \
- gpm-conf.h \
- gpm-conf.c \
gpm-idle.h \
gpm-idle.c \
gpm-load.h \
Modified: trunk/src/gpm-backlight.c
==============================================================================
--- trunk/src/gpm-backlight.c (original)
+++ trunk/src/gpm-backlight.c Wed Oct 22 08:39:02 2008
@@ -39,6 +39,7 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
+#include <gconf/gconf-client.h>
#include <hal-manager.h>
@@ -46,7 +47,6 @@
#include "gpm-button.h"
#include "gpm-backlight.h"
#include "gpm-brightness.h"
-#include "gpm-conf.h"
#include "gpm-control.h"
#include "gpm-common.h"
#include "egg-debug.h"
@@ -67,7 +67,7 @@
GpmAcAdapter *ac_adapter;
GpmBrightness *brightness;
GpmButton *button;
- GpmConf *conf;
+ GConfClient *conf;
GpmFeedback *feedback;
GpmControl *control;
GpmDpms *dpms;
@@ -138,11 +138,11 @@
error = NULL;
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);
+ timeout = gconf_client_get_int (backlight->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC, NULL);
+ dpms_method = gconf_client_get_string (backlight->priv->conf, GPM_CONF_BACKLIGHT_DPMS_METHOD_AC, NULL);
} else {
- gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT, &timeout);
- gpm_conf_get_string (backlight->priv->conf, GPM_CONF_BACKLIGHT_DPMS_METHOD_BATT, &dpms_method);
+ timeout = gconf_client_get_int (backlight->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT, NULL);
+ dpms_method = gconf_client_get_string (backlight->priv->conf, GPM_CONF_BACKLIGHT_DPMS_METHOD_BATT, NULL);
}
/* convert the string types to standard types */
@@ -368,7 +368,7 @@
return FALSE;
}
- gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_ENABLE, &do_laptop_lcd);
+ do_laptop_lcd = gconf_client_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_ENABLE, NULL);
if (do_laptop_lcd == FALSE) {
egg_warning ("policy is no dimming");
return FALSE;
@@ -382,9 +382,9 @@
on_ac = gpm_ac_adapter_is_present (backlight->priv->ac_adapter);
/* reduce if on battery power if we should */
- gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_BATTERY_REDUCE, &battery_reduce);
+ battery_reduce = gconf_client_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_BATTERY_REDUCE, NULL);
if (on_ac == FALSE && battery_reduce) {
- gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_DIM_BATT, &value);
+ value = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_DIM_BATT, NULL);
if (value > 100) {
egg_warning ("cannot use battery brightness value %i, correcting to 50", value);
value = 50;
@@ -398,12 +398,12 @@
/* reduce if system is momentarily idle */
if (on_ac) {
- gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_AC, &enable_action);
+ enable_action = gconf_client_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_AC, NULL);
} else {
- gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_BATT, &enable_action);
+ enable_action = gconf_client_get_bool (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_BATT, NULL);
}
if (enable_action && backlight->priv->system_is_idle == TRUE) {
- gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_BRIGHTNESS, &value);
+ value = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_BRIGHTNESS, NULL);
if (value > 100) {
egg_warning ("cannot use idle brightness value %i, correcting to 50", value);
value = 50;
@@ -416,11 +416,11 @@
egg_debug ("3. idle scale %f, brightness %f", scale, brightness);
/* reduce if ambient is low */
- gpm_conf_get_bool (backlight->priv->conf, GPM_CONF_AMBIENT_ENABLE, &enable_action);
+ enable_action = gconf_client_get_bool (backlight->priv->conf, GPM_CONF_AMBIENT_ENABLE, NULL);
if (backlight->priv->can_sense && enable_action == TRUE) {
- gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_AMBIENT_SCALE, &value);
+ value = gconf_client_get_int (backlight->priv->conf, GPM_CONF_AMBIENT_SCALE, NULL);
scale = backlight->priv->ambient_sensor_value * (value / 100.0f);
- gpm_conf_get_uint (backlight->priv->conf, GPM_CONF_AMBIENT_FACTOR, &value);
+ value = gconf_client_get_int (backlight->priv->conf, GPM_CONF_AMBIENT_FACTOR, NULL);
scale = gpm_common_sum_scale (brightness, scale, value / 100.0f);
if (scale > 1.0f) {
scale = 1.0f;
@@ -460,47 +460,48 @@
}
/**
- * conf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
* We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf, const gchar *key, GpmBacklight *backlight)
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmBacklight *backlight)
{
+ GConfValue *value;
gboolean on_ac;
+
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
+
on_ac = gpm_ac_adapter_is_present (backlight->priv->ac_adapter);
- if (on_ac && strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC) == 0) {
- gpm_conf_get_uint (backlight->priv->conf,
- GPM_CONF_BACKLIGHT_BRIGHTNESS_AC,
- &backlight->priv->master_percentage);
+ if (on_ac && strcmp (entry->key, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC) == 0) {
+ backlight->priv->master_percentage = gconf_value_get_int (value);
gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
- } else if (!on_ac && strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_DIM_BATT) == 0) {
+ } else if (!on_ac && strcmp (entry->key, GPM_CONF_BACKLIGHT_BRIGHTNESS_DIM_BATT) == 0) {
gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
- }
- else if (strcmp (key, GPM_CONF_BACKLIGHT_IDLE_DIM_AC) == 0 ||
- strcmp (key, GPM_CONF_AMBIENT_ENABLE) == 0 ||
- strcmp (key, GPM_CONF_AMBIENT_FACTOR) == 0 ||
- strcmp (key, GPM_CONF_AMBIENT_SCALE) == 0 ||
- strcmp (key, GPM_CONF_BACKLIGHT_ENABLE) == 0 ||
- strcmp (key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT) == 0 ||
- strcmp (key, GPM_CONF_BACKLIGHT_BATTERY_REDUCE) == 0 ||
- strcmp (key, GPM_CONF_BACKLIGHT_IDLE_BRIGHTNESS) == 0) {
+ } else if (strcmp (entry->key, GPM_CONF_BACKLIGHT_IDLE_DIM_AC) == 0 ||
+ strcmp (entry->key, GPM_CONF_AMBIENT_ENABLE) == 0 ||
+ strcmp (entry->key, GPM_CONF_AMBIENT_FACTOR) == 0 ||
+ strcmp (entry->key, GPM_CONF_AMBIENT_SCALE) == 0 ||
+ strcmp (entry->key, GPM_CONF_BACKLIGHT_ENABLE) == 0 ||
+ strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT) == 0 ||
+ strcmp (entry->key, GPM_CONF_BACKLIGHT_BATTERY_REDUCE) == 0 ||
+ strcmp (entry->key, GPM_CONF_BACKLIGHT_IDLE_BRIGHTNESS) == 0) {
gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
- } else if (strcmp (key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT) == 0 ||
- strcmp (key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC) == 0 ||
- strcmp (key, GPM_CONF_BACKLIGHT_DPMS_METHOD_AC) == 0 ||
- strcmp (key, GPM_CONF_BACKLIGHT_DPMS_METHOD_BATT) == 0) {
+ } else if (strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT) == 0 ||
+ strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC) == 0 ||
+ strcmp (entry->key, GPM_CONF_BACKLIGHT_DPMS_METHOD_AC) == 0 ||
+ strcmp (entry->key, GPM_CONF_BACKLIGHT_DPMS_METHOD_BATT) == 0) {
gpm_backlight_sync_policy (backlight);
- } else if (strcmp (key, GPM_CONF_BACKLIGHT_IDLE_DIM_TIME) == 0) {
- gpm_conf_get_uint (backlight->priv->conf,
- GPM_CONF_BACKLIGHT_IDLE_DIM_TIME,
- &backlight->priv->idle_dim_timeout);
+ } else if (strcmp (entry->key, GPM_CONF_BACKLIGHT_IDLE_DIM_TIME) == 0) {
+ backlight->priv->idle_dim_timeout = gconf_value_get_int (value);
} else {
- egg_debug ("unknown key %s", key);
+ egg_debug ("unknown key %s", entry->key);
}
}
@@ -600,9 +601,9 @@
if (elapsed < 10) {
/* double the event time */
backlight->priv->idle_dim_timeout *= 2.0;
- gpm_conf_set_uint (backlight->priv->conf,
+ gconf_client_set_int (backlight->priv->conf,
GPM_CONF_GNOME_SS_PM_DELAY,
- backlight->priv->idle_dim_timeout);
+ backlight->priv->idle_dim_timeout, NULL);
egg_debug ("increasing idle dim time to %is",
backlight->priv->idle_dim_timeout);
}
@@ -611,12 +612,12 @@
* as the user will have changed tasks */
if (elapsed > 2*60) {
/* reset back to our default dimming */
- gpm_conf_get_uint (backlight->priv->conf,
- GPM_CONF_BACKLIGHT_IDLE_DIM_TIME,
- &backlight->priv->idle_dim_timeout);
- gpm_conf_set_uint (backlight->priv->conf,
+ backlight->priv->idle_dim_timeout =
+ gconf_client_get_int (backlight->priv->conf,
+ GPM_CONF_BACKLIGHT_IDLE_DIM_TIME, NULL);
+ gconf_client_set_int (backlight->priv->conf,
GPM_CONF_GNOME_SS_PM_DELAY,
- backlight->priv->idle_dim_timeout);
+ backlight->priv->idle_dim_timeout, NULL);
egg_debug ("resetting idle dim time to %is",
backlight->priv->idle_dim_timeout);
}
@@ -884,35 +885,30 @@
/* expose ui in prefs program */
prefs_server = gpm_prefs_server_new ();
- if (backlight->priv->is_laptop) {
+ if (backlight->priv->is_laptop)
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_LID);
- }
- if (backlight->priv->can_dim) {
+ if (backlight->priv->can_dim)
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_BACKLIGHT);
- }
- if (backlight->priv->can_sense) {
+ if (backlight->priv->can_sense)
gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_AMBIENT);
- }
g_object_unref (prefs_server);
/* watch for dim value changes */
- backlight->priv->conf = gpm_conf_new ();
- g_signal_connect (backlight->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), backlight);
+ backlight->priv->conf = gconf_client_get_default ();
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (backlight->priv->conf, GPM_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (backlight->priv->conf, GPM_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ backlight, NULL, NULL);
/* get and set the default idle dim timeout */
- gpm_conf_get_uint (backlight->priv->conf,
- GPM_CONF_BACKLIGHT_IDLE_DIM_TIME,
- &backlight->priv->idle_dim_timeout);
- gpm_conf_set_uint (backlight->priv->conf,
- GPM_CONF_GNOME_SS_PM_DELAY,
- backlight->priv->idle_dim_timeout);
+ backlight->priv->idle_dim_timeout = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_TIME, NULL);
+ gconf_client_set_int (backlight->priv->conf, GPM_CONF_GNOME_SS_PM_DELAY, backlight->priv->idle_dim_timeout, NULL);
/* set the main brightness, this is designed to be updated if the user changes the
* brightness so we can undim to the 'correct' value */
- gpm_conf_get_uint (backlight->priv->conf,
- GPM_CONF_BACKLIGHT_BRIGHTNESS_AC,
- &backlight->priv->master_percentage);
+ backlight->priv->master_percentage = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC, NULL);
/* watch for brightness up and down buttons and also check lid state */
backlight->priv->button = gpm_button_new ();
@@ -926,12 +922,8 @@
/* assumption */
backlight->priv->system_is_idle = FALSE;
- gpm_conf_get_uint (backlight->priv->conf,
- GPM_CONF_BACKLIGHT_IDLE_DIM_TIME,
- &backlight->priv->idle_dim_timeout);
- gpm_conf_set_uint (backlight->priv->conf,
- GPM_CONF_GNOME_SS_PM_DELAY,
- backlight->priv->idle_dim_timeout);
+ backlight->priv->idle_dim_timeout = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_TIME, NULL);
+ gconf_client_set_int (backlight->priv->conf, GPM_CONF_GNOME_SS_PM_DELAY, backlight->priv->idle_dim_timeout, NULL);
/* use a visual widget */
backlight->priv->feedback = gpm_feedback_new ();
Modified: trunk/src/gpm-brightness-kbd.c
==============================================================================
--- trunk/src/gpm-brightness-kbd.c (original)
+++ trunk/src/gpm-brightness-kbd.c Wed Oct 22 08:39:02 2008
@@ -38,6 +38,7 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
+#include <gconf/gconf-client.h>
#include <hal-device.h>
#include <hal-manager.h>
@@ -47,7 +48,6 @@
#include "egg-discrete.h"
#include "gpm-brightness-kbd.h"
-#include "gpm-conf.h"
#include "gpm-common.h"
#include "gpm-light-sensor.h"
#include "gpm-marshal.h"
@@ -67,7 +67,7 @@
guint level_std_hw;
guint levels;
gchar *udi;
- GpmConf *conf;
+ GConfClient *conf;
GpmLightSensor *sensor;
EggDbusProxy *gproxy;
};
@@ -479,18 +479,12 @@
g_return_if_fail (GPM_IS_BRIGHTNESS_KBD (object));
brightness = GPM_BRIGHTNESS_KBD (object);
- if (brightness->priv->udi != NULL) {
+ if (brightness->priv->udi != NULL)
g_free (brightness->priv->udi);
- }
- if (brightness->priv->gproxy != NULL) {
+ if (brightness->priv->gproxy != NULL)
g_object_unref (brightness->priv->gproxy);
- }
- if (brightness->priv->conf != NULL) {
- g_object_unref (brightness->priv->conf);
- }
- if (brightness->priv->sensor != NULL) {
+ if (brightness->priv->sensor != NULL)
g_object_unref (brightness->priv->sensor);
- }
g_return_if_fail (brightness->priv != NULL);
G_OBJECT_CLASS (gpm_brightness_kbd_parent_class)->finalize (object);
@@ -681,8 +675,6 @@
brightness->priv = GPM_BRIGHTNESS_KBD_GET_PRIVATE (brightness);
- brightness->priv->conf = gpm_conf_new ();
-
/* listen for ambient light changes.. if we have an ambient light sensor */
brightness->priv->sensor = gpm_light_sensor_new ();
if (brightness->priv->sensor != NULL) {
Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c (original)
+++ trunk/src/gpm-cell-array.c Wed Oct 22 08:39:02 2008
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <glib.h>
#include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
#include <hal-device.h>
#include <hal-manager.h>
@@ -36,7 +37,6 @@
#include "gpm-ac-adapter.h"
#include "gpm-common.h"
#include "gpm-cell-array.h"
-#include "gpm-conf.h"
#include "gpm-cell-unit.h"
#include "gpm-cell.h"
#include "gpm-phone.h"
@@ -59,7 +59,7 @@
GpmCellUnit unit;
GpmAcAdapter *ac_adapter;
GpmProfile *profile;
- GpmConf *conf;
+ GConfClient *conf;
GpmPhone *phone;
GpmControl *control;
GpmWarnings *warnings;
@@ -191,14 +191,14 @@
}
/* calculate! */
- gpm_conf_get_bool (cell_array->priv->conf, GPM_CONF_USE_TIME_POLICY, &use_time_primary);
+ use_time_primary = gconf_client_get_bool (cell_array->priv->conf, GPM_CONF_USE_TIME_POLICY, NULL);
if (use_time_primary) {
/* simple subtraction */
- gpm_conf_get_uint (cell_array->priv->conf, GPM_CONF_THRESH_TIME_ACTION, &action_time);
+ action_time = gconf_client_get_int (cell_array->priv->conf, GPM_CONF_THRESH_TIME_ACTION, NULL);
difference = (gint) unit->time_discharge - (gint) action_time;
} else {
/* we have to work out the time for this percentage */
- gpm_conf_get_uint (cell_array->priv->conf, GPM_CONF_THRESH_PERCENTAGE_ACTION, &action_percentage);
+ action_percentage = gconf_client_get_int (cell_array->priv->conf, GPM_CONF_THRESH_PERCENTAGE_ACTION, NULL);
action_time = gpm_profile_get_time (cell_array->priv->profile, action_percentage, TRUE);
if (action_time == 0) {
return 0;
@@ -1161,14 +1161,14 @@
* conf_key_changed_cb:
**/
static void
-conf_key_changed_cb (GpmConf *conf,
+conf_key_changed_cb (GConfClient *conf,
const gchar *key,
GpmCellArray *cell_array)
{
GpmCellUnit *unit;
if (strcmp (key, GPM_CONF_USE_PROFILE_TIME) == 0) {
- gpm_conf_get_bool (conf, GPM_CONF_USE_PROFILE_TIME, &cell_array->priv->use_profile_calc);
+ cell_array->priv->use_profile_calc = gconf_client_get_bool (conf, GPM_CONF_USE_PROFILE_TIME, NULL);
/* recalculate */
gpm_cell_array_update (cell_array);
@@ -1399,10 +1399,10 @@
cell_array->priv->array = g_ptr_array_new ();
cell_array->priv->profile = gpm_profile_new ();
- cell_array->priv->conf = gpm_conf_new ();
+ cell_array->priv->conf = gconf_client_get_default ();
g_signal_connect (cell_array->priv->conf, "value-changed",
G_CALLBACK (conf_key_changed_cb), cell_array);
- gpm_conf_get_bool (cell_array->priv->conf, GPM_CONF_USE_PROFILE_TIME, &cell_array->priv->use_profile_calc);
+ cell_array->priv->use_profile_calc = gconf_client_get_bool (cell_array->priv->conf, GPM_CONF_USE_PROFILE_TIME, NULL);
cell_array->priv->done_recall = FALSE;
cell_array->priv->done_capacity = FALSE;
Modified: trunk/src/gpm-common.h
==============================================================================
--- trunk/src/gpm-common.h (original)
+++ trunk/src/gpm-common.h Wed Oct 22 08:39:02 2008
@@ -48,6 +48,125 @@
#define GPM_BUGZILLA_URL "http://bugzilla.gnome.org/buglist.cgi?product=gnome-power-manager"
#define GPM_FAQ_URL "http://live.gnome.org/GnomePowerManager/Faq"
+/* change general/installed_schema whenever adding or moving keys */
+#define GPM_CONF_SCHEMA_ID 3
+
+#define GPM_CONF_DIR "/apps/gnome-power-manager"
+
+/* ambient */
+#define GPM_CONF_AMBIENT_ENABLE GPM_CONF_DIR "/ambient/enable"
+#define GPM_CONF_AMBIENT_POLL GPM_CONF_DIR "/ambient/poll_timeout"
+#define GPM_CONF_AMBIENT_FACTOR GPM_CONF_DIR "/ambient/correction_factor"
+#define GPM_CONF_AMBIENT_SCALE GPM_CONF_DIR "/ambient/correction_scale"
+#define GPM_CONF_AMBIENT_DIM_POLICY GPM_CONF_DIR "/ambient/dim_policy"
+
+/* actions */
+#define GPM_CONF_ACTIONS_CRITICAL_UPS GPM_CONF_DIR "/actions/critical_ups"
+#define GPM_CONF_ACTIONS_CRITICAL_BATT GPM_CONF_DIR "/actions/critical_battery"
+#define GPM_CONF_ACTIONS_LOW_UPS GPM_CONF_DIR "/actions/low_ups"
+#define GPM_CONF_ACTIONS_SLEEP_TYPE_AC GPM_CONF_DIR "/actions/sleep_type_ac"
+#define GPM_CONF_ACTIONS_SLEEP_TYPE_BATT GPM_CONF_DIR "/actions/sleep_type_battery"
+#define GPM_CONF_ACTIONS_SLEEP_WHEN_CLOSED GPM_CONF_DIR "/actions/event_when_closed_battery"
+
+/* backlight stuff */
+#define GPM_CONF_BACKLIGHT_ENABLE GPM_CONF_DIR "/backlight/enable"
+#define GPM_CONF_BACKLIGHT_BATTERY_REDUCE GPM_CONF_DIR "/backlight/battery_reduce"
+#define GPM_CONF_BACKLIGHT_DPMS_METHOD_AC GPM_CONF_DIR "/backlight/dpms_method_ac"
+#define GPM_CONF_BACKLIGHT_DPMS_METHOD_BATT GPM_CONF_DIR "/backlight/dpms_method_battery"
+#define GPM_CONF_BACKLIGHT_IDLE_BRIGHTNESS GPM_CONF_DIR "/backlight/idle_brightness"
+#define GPM_CONF_BACKLIGHT_IDLE_DIM_AC GPM_CONF_DIR "/backlight/idle_dim_ac"
+#define GPM_CONF_BACKLIGHT_IDLE_DIM_BATT GPM_CONF_DIR "/backlight/idle_dim_battery"
+#define GPM_CONF_BACKLIGHT_IDLE_DIM_TIME GPM_CONF_DIR "/backlight/idle_dim_time"
+#define GPM_CONF_BACKLIGHT_BRIGHTNESS_AC GPM_CONF_DIR "/backlight/brightness_ac"
+#define GPM_CONF_BACKLIGHT_BRIGHTNESS_DIM_BATT GPM_CONF_DIR "/backlight/brightness_dim_battery"
+
+/* buttons */
+#define GPM_CONF_BUTTON_LID_AC GPM_CONF_DIR "/buttons/lid_ac"
+#define GPM_CONF_BUTTON_LID_BATT GPM_CONF_DIR "/buttons/lid_battery"
+#define GPM_CONF_BUTTON_SUSPEND GPM_CONF_DIR "/buttons/suspend"
+#define GPM_CONF_BUTTON_HIBERNATE GPM_CONF_DIR "/buttons/hibernate"
+#define GPM_CONF_BUTTON_POWER GPM_CONF_DIR "/buttons/power"
+
+/* general */
+#define GPM_CONF_DEBUG GPM_CONF_DIR "/general/debug"
+#define GPM_CONF_SCHEMA_VERSION GPM_CONF_DIR "/general/installed_schema"
+#define GPM_CONF_CAN_SUSPEND GPM_CONF_DIR "/general/can_suspend"
+#define GPM_CONF_CAN_HIBERNATE GPM_CONF_DIR "/general/can_hibernate"
+#define GPM_CONF_USE_TIME_POLICY GPM_CONF_DIR "/general/use_time_for_policy"
+#define GPM_CONF_USE_PROFILE_TIME GPM_CONF_DIR "/general/use_profile_time"
+#define GPM_CONF_NETWORKMANAGER_SLEEP GPM_CONF_DIR "/general/network_sleep"
+#define GPM_CONF_IDLE_CHECK_CPU GPM_CONF_DIR "/general/check_type_cpu"
+#define GPM_CONF_INVALID_TIMEOUT GPM_CONF_DIR "/general/invalid_timeout"
+#define GPM_CONF_LAPTOP_USES_EXT_MON GPM_CONF_DIR "/general/using_external_monitor"
+#define GPM_CONF_POLICY_TIMEOUT GPM_CONF_DIR "/general/policy_suppression_timeout"
+#define GPM_CONF_IGNORE_INHIBITS GPM_CONF_DIR "/general/ignore_inhibit_requests"
+
+/* keyboard */
+#define GPM_CONF_KEYBOARD_BRIGHTNESS_AC GPM_CONF_DIR "/keyboard/brightness_ac"
+#define GPM_CONF_KEYBOARD_BRIGHTNESS_BATT GPM_CONF_DIR "/keyboard/brightness_battery"
+
+/* lock */
+#define GPM_CONF_LOCK_USE_SCREENSAVER GPM_CONF_DIR "/lock/use_screensaver_settings"
+#define GPM_CONF_LOCK_ON_BLANK_SCREEN GPM_CONF_DIR "/lock/blank_screen"
+#define GPM_CONF_LOCK_ON_SUSPEND GPM_CONF_DIR "/lock/suspend"
+#define GPM_CONF_LOCK_ON_HIBERNATE GPM_CONF_DIR "/lock/hibernate"
+#define GPM_CONF_LOCK_GNOME_KEYRING_SUSPEND GPM_CONF_DIR "/lock/gnome_keyring_suspend"
+#define GPM_CONF_LOCK_GNOME_KEYRING_HIBERNATE GPM_CONF_DIR "/lock/gnome_keyring_hibernate"
+
+/* low power */
+#define GPM_CONF_LOWPOWER_AC GPM_CONF_DIR "/lowpower/on_ac"
+#define GPM_CONF_LOWPOWER_BATT GPM_CONF_DIR "/lowpower/on_battery"
+#define GPM_CONF_LOWPOWER_UPS GPM_CONF_DIR "/lowpower/on_ups"
+
+/* notify */
+#define GPM_CONF_NOTIFY_PERHAPS_RECALL GPM_CONF_DIR "/notify/perhaps_recall"
+#define GPM_CONF_NOTIFY_LOW_CAPACITY GPM_CONF_DIR "/notify/low_capacity"
+#define GPM_CONF_NOTIFY_DISCHARGING GPM_CONF_DIR "/notify/discharging"
+#define GPM_CONF_NOTIFY_FULLY_CHARGED GPM_CONF_DIR "/notify/fully_charged"
+#define GPM_CONF_NOTIFY_SLEEP_FAILED GPM_CONF_DIR "/notify/sleep_failed"
+#define GPM_CONF_NOTIFY_LOW_POWER GPM_CONF_DIR "/notify/low_power"
+#define GPM_CONF_NOTIFY_ESTIMATED_DATA GPM_CONF_DIR "/notify/estimated_data"
+#define GPM_CONF_NOTIFY_INHIBIT_LID GPM_CONF_DIR "/notify/inhibit_lid"
+
+/* statistics */
+#define GPM_CONF_STATS_SHOW_AXIS_LABELS GPM_CONF_DIR "/statistics/show_axis_labels"
+#define GPM_CONF_STATS_SHOW_EVENTS GPM_CONF_DIR "/statistics/show_events"
+#define GPM_CONF_STATS_SMOOTH_DATA GPM_CONF_DIR "/statistics/smooth_data"
+#define GPM_CONF_STATS_GRAPH_TYPE GPM_CONF_DIR "/statistics/graph_type"
+#define GPM_CONF_STATS_MAX_TIME GPM_CONF_DIR "/statistics/data_max_time"
+
+/* thresholds */
+#define GPM_CONF_THRESH_PERCENTAGE_LOW GPM_CONF_DIR "/thresholds/percentage_low"
+#define GPM_CONF_THRESH_PERCENTAGE_CRITICAL GPM_CONF_DIR "/thresholds/percentage_critical"
+#define GPM_CONF_THRESH_PERCENTAGE_ACTION GPM_CONF_DIR "/thresholds/percentage_action"
+#define GPM_CONF_THRESH_TIME_LOW GPM_CONF_DIR "/thresholds/time_low"
+#define GPM_CONF_THRESH_TIME_CRITICAL GPM_CONF_DIR "/thresholds/time_critical"
+#define GPM_CONF_THRESH_TIME_ACTION GPM_CONF_DIR "/thresholds/time_action"
+
+/* timeout */
+#define GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC GPM_CONF_DIR "/timeout/sleep_computer_ac"
+#define GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT GPM_CONF_DIR "/timeout/sleep_computer_battery"
+#define GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC GPM_CONF_DIR "/timeout/sleep_display_ac"
+#define GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT GPM_CONF_DIR "/timeout/sleep_display_battery"
+
+/* ui */
+#define GPM_CONF_UI_ICON_POLICY GPM_CONF_DIR "/ui/icon_policy"
+#define GPM_CONF_UI_SHOW_CPUFREQ GPM_CONF_DIR "/ui/cpufreq_show"
+#define GPM_CONF_UI_SHOW_ACTIONS_IN_MENU GPM_CONF_DIR "/ui/show_actions_in_menu"
+#define GPM_CONF_UI_ENABLE_BEEPING GPM_CONF_DIR "/ui/enable_sound"
+#define GPM_CONF_UI_SHOW_CONTEXT_MENU GPM_CONF_DIR "/ui/show_context_menu"
+
+/* we use the gnome-session key now */
+#define GPM_CONF_SESSION_REQUEST_SAVE "/apps/gnome-session/options/auto_save_session"
+
+/* okay to change at runtime */
+#define GPM_CONF_GNOME_SS_PM_DELAY "/apps/gnome-screensaver/power_management_delay"
+
+/* gnome-screensaver */
+#define GS_CONF_DIR "/apps/gnome-screensaver"
+#define GS_PREF_LOCK_ENABLED GS_CONF_DIR "/lock_enabled"
+#define GS_PREF_IDLE_DELAY GS_CONF_DIR "/idle_delay"
+
typedef enum {
GPM_ICON_POLICY_ALWAYS,
GPM_ICON_POLICY_PRESENT,
Modified: trunk/src/gpm-control.c
==============================================================================
--- trunk/src/gpm-control.c (original)
+++ trunk/src/gpm-control.c Wed Oct 22 08:39:02 2008
@@ -41,6 +41,7 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <gnome-keyring.h>
+#include <gconf/gconf-client.h>
#include <hal-device-power.h>
@@ -49,7 +50,6 @@
#include <polkit-dbus/polkit-dbus.h>
#endif
-#include "gpm-conf.h"
#include "gpm-screensaver.h"
#include "gpm-common.h"
#include "egg-debug.h"
@@ -60,7 +60,7 @@
struct GpmControlPrivate
{
- GpmConf *conf;
+ GConfClient *conf;
HalDevicePower *hal_device_power;
};
@@ -85,9 +85,8 @@
gpm_control_error_quark (void)
{
static GQuark quark = 0;
- if (!quark) {
+ if (!quark)
quark = g_quark_from_static_string ("gpm_control_error");
- }
return quark;
}
@@ -168,14 +167,12 @@
g_return_val_if_fail (can, FALSE);
*can = FALSE;
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_CAN_SUSPEND, &conf_ok);
+ conf_ok = gconf_client_get_bool (control->priv->conf, GPM_CONF_CAN_SUSPEND, NULL);
hal_ok = hal_device_power_can_suspend (control->priv->hal_device_power);
polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.hal.power-management.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;
- }
-
return TRUE;
}
@@ -199,13 +196,12 @@
g_return_val_if_fail (can, FALSE);
*can = FALSE;
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_CAN_HIBERNATE, &conf_ok);
+ conf_ok = gconf_client_get_bool (control->priv->conf, GPM_CONF_CAN_HIBERNATE, NULL);
hal_ok = hal_device_power_can_hibernate (control->priv->hal_device_power);
fg = gpm_control_check_foreground_console (control);
polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.hal.power-management.hibernate");
- if (conf_ok && hal_ok && polkit_ok && fg) {
+ if (conf_ok && hal_ok && polkit_ok && fg)
*can = TRUE;
- }
return TRUE;
}
@@ -226,9 +222,8 @@
*can = FALSE;
fg = gpm_control_check_foreground_console (control);
polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.hal.power-management.shutdown");
- if (polkit_ok && fg) {
+ if (polkit_ok && fg)
*can = TRUE;
- }
return TRUE;
}
@@ -250,9 +245,8 @@
*can = FALSE;
fg = gpm_control_check_foreground_console (control);
polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.hal.power-management.reboot");
- if (polkit_ok && fg) {
+ if (polkit_ok && fg)
*can = TRUE;
- }
return TRUE;
}
@@ -311,7 +305,7 @@
return FALSE;
}
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, &save_session);
+ save_session = gconf_client_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, NULL);
/* 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) {
@@ -321,9 +315,8 @@
}
ret = hal_device_power_shutdown (control->priv->hal_device_power, error);
- if (!ret) {
+ if (!ret)
gpm_control_convert_hal_error (control, error);
- }
return ret;
}
@@ -351,7 +344,7 @@
return FALSE;
}
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, &save_session);
+ save_session = gconf_client_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, NULL);
/* 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) {
@@ -383,12 +376,12 @@
/* This allows us to over-ride the custom lock settings set in gconf
with a system default set in gnome-screensaver.
See bug #331164 for all the juicy details. :-) */
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_LOCK_USE_SCREENSAVER, &use_ss_setting);
+ use_ss_setting = gconf_client_get_bool (control->priv->conf, GPM_CONF_LOCK_USE_SCREENSAVER, NULL);
if (use_ss_setting) {
- gpm_conf_get_bool (control->priv->conf, GS_PREF_LOCK_ENABLED, &do_lock);
+ do_lock = gconf_client_get_bool (control->priv->conf, GS_PREF_LOCK_ENABLED, NULL);
egg_debug ("Using ScreenSaver settings (%i)", do_lock);
} else {
- gpm_conf_get_bool (control->priv->conf, policy, &do_lock);
+ do_lock = gconf_client_get_bool (control->priv->conf, policy, NULL);
egg_debug ("Using custom locking settings (%i)", do_lock);
}
return do_lock;
@@ -420,32 +413,28 @@
}
/* we should perhaps lock keyrings when sleeping #375681 */
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_LOCK_GNOME_KEYRING_SUSPEND, &lock_gnome_keyring);
+ lock_gnome_keyring = gconf_client_get_bool (control->priv->conf, GPM_CONF_LOCK_GNOME_KEYRING_SUSPEND, NULL);
if (lock_gnome_keyring) {
keyres = gnome_keyring_lock_all_sync ();
- if (keyres != GNOME_KEYRING_RESULT_OK) {
+ if (keyres != GNOME_KEYRING_RESULT_OK)
egg_warning ("could not lock keyring");
- }
}
do_lock = gpm_control_get_lock_policy (control, GPM_CONF_LOCK_ON_SUSPEND);
- if (do_lock) {
+ if (do_lock)
gpm_screensaver_lock (screensaver);
- }
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep) {
+ nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
+ if (nm_sleep)
gpm_networkmanager_sleep ();
- }
/* Do the suspend */
egg_debug ("emitting sleep");
g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_SUSPEND);
ret = hal_device_power_suspend (control->priv->hal_device_power, 0, error);
- if (!ret) {
+ if (!ret)
gpm_control_convert_hal_error (control, error);
- }
egg_debug ("emitting resume");
g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_SUSPEND);
@@ -455,14 +444,12 @@
g_signal_emit (control, signals [SLEEP_FAILURE], 0, GPM_CONTROL_ACTION_SUSPEND);
}
- if (do_lock) {
+ if (do_lock)
gpm_screensaver_poke (screensaver);
- }
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep) {
+ nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
+ if (nm_sleep)
gpm_networkmanager_wake ();
- }
g_object_unref (screensaver);
@@ -496,7 +483,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);
+ lock_gnome_keyring = gconf_client_get_bool (control->priv->conf, GPM_CONF_LOCK_GNOME_KEYRING_HIBERNATE, NULL);
if (lock_gnome_keyring) {
keyres = gnome_keyring_lock_all_sync ();
if (keyres != GNOME_KEYRING_RESULT_OK) {
@@ -505,22 +492,19 @@
}
do_lock = gpm_control_get_lock_policy (control, GPM_CONF_LOCK_ON_HIBERNATE);
- if (do_lock) {
+ if (do_lock)
gpm_screensaver_lock (screensaver);
- }
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep) {
+ nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
+ if (nm_sleep)
gpm_networkmanager_sleep ();
- }
egg_debug ("emitting sleep");
g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_HIBERNATE);
ret = hal_device_power_hibernate (control->priv->hal_device_power, error);
- if (!ret) {
+ if (!ret)
gpm_control_convert_hal_error (control, error);
- }
egg_debug ("emitting resume");
g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_HIBERNATE);
@@ -530,14 +514,12 @@
g_signal_emit (control, signals [SLEEP_FAILURE], 0, GPM_CONTROL_ACTION_HIBERNATE);
}
- if (do_lock) {
+ if (do_lock)
gpm_screensaver_poke (screensaver);
- }
- gpm_conf_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, &nm_sleep);
- if (nm_sleep) {
+ nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
+ if (nm_sleep)
gpm_networkmanager_wake ();
- }
g_object_unref (screensaver);
@@ -622,7 +604,7 @@
control->priv = GPM_CONTROL_GET_PRIVATE (control);
control->priv->hal_device_power = hal_device_power_new ();
- control->priv->conf = gpm_conf_new ();
+ control->priv->conf = gconf_client_get_default ();
}
/**
Modified: trunk/src/gpm-dpms.c
==============================================================================
--- trunk/src/gpm-dpms.c (original)
+++ trunk/src/gpm-dpms.c Wed Oct 22 08:39:02 2008
@@ -42,7 +42,7 @@
#include <X11/extensions/dpmsstr.h>
#endif
-#include "gpm-conf.h"
+#include <gconf/gconf-client.h>
#include "egg-debug.h"
#include "gpm-dpms.h"
@@ -65,7 +65,7 @@
guint suspend_timeout;
guint off_timeout;
- GpmConf *conf;
+ GConfClient *conf;
GpmDpmsMode mode;
guint timer_id;
Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c (original)
+++ trunk/src/gpm-engine.c Wed Oct 22 08:39:02 2008
@@ -24,13 +24,13 @@
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
#include <hal-device.h>
#include <hal-manager.h>
#include "gpm-ac-adapter.h"
#include "gpm-common.h"
-#include "gpm-conf.h"
#include "gpm-control.h"
#include "gpm-profile.h"
#include "gpm-marshal.h"
@@ -54,7 +54,7 @@
struct GpmEnginePrivate
{
- GpmConf *conf;
+ GConfClient *conf;
GpmWarnings *warnings;
GpmIconPolicy icon_policy;
GpmProfile *profile;
@@ -484,7 +484,7 @@
kind = gpm_cell_array_get_kind (cell_array);
/* only emit this if specified in gconf */
- gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_PERHAPS_RECALL, &show_recall);
+ show_recall = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_PERHAPS_RECALL, NULL);
if (show_recall) {
/* just proxy it to the GUI layer */
@@ -509,7 +509,7 @@
kind = gpm_cell_array_get_kind (cell_array);
/* only emit this if specified in gconf */
- gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_LOW_CAPACITY, &show_capacity);
+ show_capacity = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_LOW_CAPACITY, NULL);
/* only emit this once per startup */
if (show_capacity) {
@@ -709,7 +709,7 @@
if (discharging) {
/* only emit this if specified in gconf */
- gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_DISCHARGING, &show_discharging);
+ show_discharging = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_DISCHARGING, NULL);
/* don't show warning */
if (show_discharging == FALSE) {
@@ -771,7 +771,7 @@
gpm_engine_recalculate_state (engine);
/* only emit this if specified in gconf */
- gpm_conf_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_FULLY_CHARGED, &show_fully_charged);
+ show_fully_charged = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_FULLY_CHARGED, NULL);
/* only emit if in GConf */
if (show_fully_charged) {
@@ -866,7 +866,7 @@
* conf_key_changed_cb:
**/
static void
-conf_key_changed_cb (GpmConf *conf,
+conf_key_changed_cb (GConfClient *conf,
const gchar *key,
GpmEngine *engine)
{
@@ -874,7 +874,7 @@
if (strcmp (key, GPM_CONF_UI_ICON_POLICY) == 0) {
/* do we want to display the icon in the tray */
- gpm_conf_get_string (conf, GPM_CONF_UI_ICON_POLICY, &icon_policy);
+ icon_policy = gconf_client_get_string (conf, GPM_CONF_UI_ICON_POLICY, NULL);
engine->priv->icon_policy = gpm_tray_icon_mode_from_string (icon_policy);
g_free (icon_policy);
@@ -895,7 +895,7 @@
engine->priv = GPM_ENGINE_GET_PRIVATE (engine);
- engine->priv->conf = gpm_conf_new ();
+ engine->priv->conf = gconf_client_get_default ();
g_signal_connect (engine->priv->conf, "value-changed",
G_CALLBACK (conf_key_changed_cb), engine);
@@ -908,7 +908,7 @@
engine->priv->during_coldplug = TRUE;
/* do we want to display the icon in the tray */
- gpm_conf_get_string (engine->priv->conf, GPM_CONF_UI_ICON_POLICY, &icon_policy);
+ icon_policy = gconf_client_get_string (engine->priv->conf, GPM_CONF_UI_ICON_POLICY, NULL);
engine->priv->icon_policy = gpm_tray_icon_mode_from_string (icon_policy);
g_free (icon_policy);
Modified: trunk/src/gpm-info.c
==============================================================================
--- trunk/src/gpm-info.c (original)
+++ trunk/src/gpm-info.c Wed Oct 22 08:39:02 2008
@@ -27,13 +27,13 @@
#include <string.h>
#include <dbus/dbus-gtype-specialized.h>
+#include <gconf/gconf-client.h>
#include <hal-manager.h>
#include "egg-color.h"
#include "gpm-ac-adapter.h"
#include "gpm-button.h"
-#include "gpm-conf.h"
#include "gpm-control.h"
#include "gpm-common.h"
#include "egg-debug.h"
@@ -770,11 +770,10 @@
GpmControlAction action,
GpmInfo *info)
{
- if (action == GPM_CONTROL_ACTION_HIBERNATE) {
+ if (action == GPM_CONTROL_ACTION_HIBERNATE)
gpm_info_event_log (info, GPM_EVENT_NOTIFICATION, _("Hibernate Problem"));
- } else {
+ else
gpm_info_event_log (info, GPM_EVENT_NOTIFICATION, _("Suspend Problem"));
- }
}
/**
@@ -856,9 +855,9 @@
if (info->priv->is_laptop) {
/* get the maximum x-axis size from gconf */
- GpmConf *conf = gpm_conf_new ();
+ GConfClient *conf = gconf_client_get_default ();
guint max_time;
- gpm_conf_get_uint (conf, GPM_CONF_STATS_MAX_TIME, &max_time);
+ max_time = gconf_client_get_int (conf, GPM_CONF_STATS_MAX_TIME, NULL);
g_object_unref (conf);
gpm_array_set_max_width (info->priv->events, max_time);
Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c (original)
+++ trunk/src/gpm-inhibit.c Wed Oct 22 08:39:02 2008
@@ -26,10 +26,11 @@
#include <dbus/dbus-glib-lowlevel.h>
#include <glib/gi18n.h>
#include <string.h>
+#include <gconf/gconf-client.h>
#include "egg-debug.h"
+#include "gpm-common.h"
#include "gpm-inhibit.h"
-#include "gpm-conf.h"
static void gpm_inhibit_class_init (GpmInhibitClass *klass);
static void gpm_inhibit_init (GpmInhibit *inhibit);
@@ -49,7 +50,7 @@
{
GSList *list;
DBusGProxy *proxy;
- GpmConf *conf;
+ GConfClient *conf;
gboolean ignore_inhibits;
};
@@ -345,9 +346,7 @@
*
**/
void
-gpm_inhibit_get_message (GpmInhibit *inhibit,
- GString *message,
- const gchar *action)
+gpm_inhibit_get_message (GpmInhibit *inhibit, GString *message, const gchar *action)
{
guint a;
GpmInhibitData *data;
@@ -421,19 +420,21 @@
}
/**
- * conf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
* We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmInhibit *inhibit)
-{
- if (strcmp (key, GPM_CONF_IGNORE_INHIBITS) == 0) {
- gpm_conf_get_bool (inhibit->priv->conf, GPM_CONF_IGNORE_INHIBITS,
- &inhibit->priv->ignore_inhibits);
- }
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmInhibit *inhibit)
+{
+ GConfValue *value;
+
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
+
+ if (strcmp (entry->key, GPM_CONF_IGNORE_INHIBITS) == 0)
+ inhibit->priv->ignore_inhibits = gconf_value_get_bool (value);
}
/** intialise the class */
@@ -461,9 +462,14 @@
inhibit->priv = GPM_INHIBIT_GET_PRIVATE (inhibit);
inhibit->priv->list = NULL;
- inhibit->priv->conf = gpm_conf_new ();
- g_signal_connect (inhibit->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), inhibit);
+ inhibit->priv->conf = gconf_client_get_default ();
+
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (inhibit->priv->conf, GPM_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (inhibit->priv->conf, GPM_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ inhibit, NULL, NULL);
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (error != NULL) {
@@ -480,7 +486,7 @@
inhibit, NULL);
/* Do we ignore inhibit requests? */
- gpm_conf_get_bool (inhibit->priv->conf, GPM_CONF_IGNORE_INHIBITS, &inhibit->priv->ignore_inhibits);
+ inhibit->priv->ignore_inhibits = gconf_client_get_bool (inhibit->priv->conf, GPM_CONF_IGNORE_INHIBITS, NULL);
}
/** finalise the object */
Modified: trunk/src/gpm-light-sensor.c
==============================================================================
--- trunk/src/gpm-light-sensor.c (original)
+++ trunk/src/gpm-light-sensor.c Wed Oct 22 08:39:02 2008
@@ -47,14 +47,14 @@
#include "gpm-common.h"
#include "gpm-light-sensor.h"
-#include "gpm-conf.h"
+#include <gconf/gconf-client.h>
#include "gpm-marshal.h"
#define GPM_LIGHT_SENSOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_LIGHT_SENSOR, GpmLightSensorPrivate))
struct GpmLightSensorPrivate
{
- GpmConf *conf;
+ GConfClient *conf;
guint current_hw; /* hardware */
guint levels;
gfloat calibration_abs;
@@ -243,8 +243,7 @@
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GpmLightSensorClass, sensor_changed),
- NULL,
- NULL,
+ NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE,
1,
@@ -260,9 +259,8 @@
gpm_light_sensor_has_hw (GpmLightSensor *sensor)
{
g_return_val_if_fail (sensor != NULL, FALSE);
- if (sensor->priv->has_sensor) {
+ if (sensor->priv->has_sensor)
return TRUE;
- }
return FALSE;
}
@@ -283,11 +281,9 @@
sensor = GPM_LIGHT_SENSOR (userdata);
/* check if we should poll the h/w */
- gpm_conf_get_bool (sensor->priv->conf, GPM_CONF_AMBIENT_ENABLE, &enable);
- if (enable == FALSE) {
- /* don't bother polling */
+ enable = gconf_client_get_bool (sensor->priv->conf, GPM_CONF_AMBIENT_ENABLE, NULL);
+ if (enable == FALSE)
return TRUE;
- }
if (sensor->priv->has_sensor) {
/* fairly slow */
@@ -305,19 +301,6 @@
}
/**
- * conf_key_changed_cb:
- *
- * We might have to do things when the gconf keys change; do them here.
- **/
-static void
-conf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmLightSensor *sensor)
-{
- //
-}
-
-/**
* gpm_light_sensor_init:
* @sensor: This sensor class instance
*
@@ -339,10 +322,7 @@
sensor->priv->gproxy = NULL;
sensor->priv->udi = NULL;
sensor->priv->calibration_abs = 0.0f;
-
- sensor->priv->conf = gpm_conf_new ();
- g_signal_connect (sensor->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), sensor);
+ sensor->priv->conf = gconf_client_get_default ();
/* see if we can find */
manager = hal_manager_new ();
@@ -383,7 +363,7 @@
egg_debug ("current brightness is %i%%", sensor->priv->current_hw);
/* get poll timeout */
- gpm_conf_get_uint (sensor->priv->conf, GPM_CONF_AMBIENT_POLL, &timeout);
+ timeout = gconf_client_get_int (sensor->priv->conf, GPM_CONF_AMBIENT_POLL, NULL);
g_timeout_add (timeout * 1000, gpm_light_sensor_poll_cb, sensor);
}
}
Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c (original)
+++ trunk/src/gpm-manager.c Wed Oct 22 08:39:02 2008
@@ -47,7 +47,6 @@
#include "gpm-ac-adapter.h"
#include "gpm-button.h"
-#include "gpm-conf.h"
#include "gpm-control.h"
#include "gpm-common.h"
#include "egg-debug.h"
@@ -82,7 +81,7 @@
{
GpmAcAdapter *ac_adapter;
GpmButton *button;
- GpmConf *conf;
+ GConfClient *conf;
GpmDpms *dpms;
GpmIdle *idle;
GpmInfo *info;
@@ -95,7 +94,6 @@
GpmEngine *engine;
HalDevicePower *hal_device_power;
gboolean low_power;
- GConfClient *gconf_client;
/* interactive services */
GpmBacklight *backlight;
@@ -177,7 +175,7 @@
const gchar *desc = NULL;
gboolean ret;
- ret = gconf_client_get_bool (manager->priv->gconf_client, GPM_CONF_UI_ENABLE_BEEPING, NULL);
+ ret = gconf_client_get_bool (manager->priv->conf, GPM_CONF_UI_ENABLE_BEEPING, NULL);
if (!ret && !force) {
egg_debug ("ignoring sound due to policy");
return FALSE;
@@ -320,13 +318,13 @@
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
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);
+ sleep_computer = gconf_client_get_int (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC, NULL);
+ sleep_display = gconf_client_get_int (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_AC, NULL);
+ power_save = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_AC, NULL);
} else {
- gpm_conf_get_uint (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT, &sleep_computer);
- gpm_conf_get_uint (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT, &sleep_display);
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, &power_save);
+ sleep_computer = gconf_client_get_int (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT, NULL);
+ sleep_display = gconf_client_get_int (manager->priv->conf, GPM_CONF_TIMEOUT_SLEEP_DISPLAY_BATT, NULL);
+ power_save = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, NULL);
}
hal_device_power_enable_power_save (manager->priv->hal_device_power, power_save);
@@ -410,7 +408,7 @@
GError *error = NULL;
/* check if the admin has disabled */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_CAN_SUSPEND, &allowed);
+ allowed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_CAN_SUSPEND, NULL);
if (allowed == FALSE) {
/* error msg as disabled in gconf */
gpm_notify_display (manager->priv->notify,
@@ -459,7 +457,7 @@
GError *error = NULL;
/* check if the admin has disabled */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_CAN_HIBERNATE, &allowed);
+ allowed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_CAN_HIBERNATE, NULL);
if (allowed == FALSE) {
/* error msg as disabled in gconf */
gpm_notify_display (manager->priv->notify,
@@ -519,7 +517,7 @@
}
egg_debug ("policy: %s", policy);
- gpm_conf_get_string (manager->priv->conf, policy, &action);
+ action = gconf_client_get_string (manager->priv->conf, policy, NULL);
if (action == NULL) {
return FALSE;
@@ -572,7 +570,7 @@
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
/* check if the admin has disabled */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_CAN_SUSPEND, &allowed);
+ allowed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_CAN_SUSPEND, NULL);
if (allowed == FALSE) {
g_set_error (error, GPM_MANAGER_ERROR, GPM_MANAGER_ERROR_DENIED, "Suspend denied by gconf policy");
return FALSE;
@@ -608,7 +606,7 @@
g_return_val_if_fail (GPM_IS_MANAGER (manager), FALSE);
/* check if the admin has disabled */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_CAN_HIBERNATE, &allowed);
+ allowed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_CAN_HIBERNATE, NULL);
if (allowed == FALSE) {
g_set_error (error, GPM_MANAGER_ERROR, GPM_MANAGER_ERROR_DENIED, "Hibernate denied by gconf policy");
return FALSE;
@@ -822,11 +820,10 @@
/* find if we are on AC power */
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- 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);
- }
+ if (on_ac)
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_ACTIONS_SLEEP_TYPE_AC, NULL);
+ else
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_ACTIONS_SLEEP_TYPE_BATT, NULL);
if (action == NULL) {
egg_warning ("action NULL, gconf error");
@@ -1012,7 +1009,7 @@
/* do not do lid close action if suspend (or hibernate) */
if (has_inhibit) {
/* get the policy action for battery */
- gpm_conf_get_string (manager->priv->conf, GPM_CONF_BUTTON_LID_BATT, &action);
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_BUTTON_LID_BATT, NULL);
/* if we are trying to suspend or hibernate then don't do action */
if ((strcmp (action, ACTION_SUSPEND) == 0) ||
@@ -1100,19 +1097,17 @@
}
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- 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);
- }
- if (manager->priv->low_power != power_save) {
+ if (on_ac)
+ power_save = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_AC, NULL);
+ else
+ power_save = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, NULL);
+ if (manager->priv->low_power != power_save)
g_signal_emit (manager, signals [POWER_SAVE_STATUS_CHANGED], 0, power_save);
- }
manager->priv->low_power = power_save;
/* We do the lid close on battery action if the ac_adapter is removed
when the laptop is closed and on battery. Fixes #331655 */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_ACTIONS_SLEEP_WHEN_CLOSED, &event_when_closed);
+ event_when_closed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_ACTIONS_SLEEP_WHEN_CLOSED, NULL);
/* 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
@@ -1202,20 +1197,22 @@
}
/**
- * conf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
* We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmManager *manager)
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmManager *manager)
{
- if (strcmp (key, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT) == 0 ||
- strcmp (key, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC) == 0) {
+ GConfValue *value;
+
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
+ if (strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT) == 0 ||
+ strcmp (entry->key, GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC) == 0)
gpm_manager_sync_policy_sleep (manager);
- }
}
/**
@@ -1227,8 +1224,7 @@
* the inhibit states are valid.
**/
static void
-gpm_manager_tray_icon_hibernate (GpmManager *manager,
- GpmTrayIcon *tray)
+gpm_manager_tray_icon_hibernate (GpmManager *manager, GpmTrayIcon *tray)
{
gpm_manager_action_hibernate (manager, _("User clicked on tray"));
}
@@ -1426,7 +1422,7 @@
gboolean show_sleep_failed;
/* only show this if specified in gconf */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_SLEEP_FAILED, &show_sleep_failed);
+ show_sleep_failed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_SLEEP_FAILED, NULL);
gpm_manager_play (manager, GPM_MANAGER_SOUND_SUSPEND_ERROR, TRUE);
@@ -1532,7 +1528,7 @@
time_text = gpm_manager_get_time_until_action_text (manager);
/* we have to do different warnings depending on the policy */
- gpm_conf_get_string (manager->priv->conf, GPM_CONF_ACTIONS_CRITICAL_BATT, &action);
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_ACTIONS_CRITICAL_BATT, NULL);
if (action == NULL) {
egg_warning ("schema invalid!");
action = g_strdup (ACTION_NOTHING);
@@ -1616,7 +1612,7 @@
title = _("Laptop battery critically low");
/* we have to do different warnings depending on the policy */
- gpm_conf_get_string (manager->priv->conf, GPM_CONF_ACTIONS_CRITICAL_BATT, &action);
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_ACTIONS_CRITICAL_BATT, NULL);
/* use different text for different actions */
if (strcmp (action, ACTION_NOTHING) == 0) {
@@ -1648,7 +1644,7 @@
title = _("UPS critically low");
/* we have to do different warnings depending on the policy */
- gpm_conf_get_string (manager->priv->conf, GPM_CONF_ACTIONS_CRITICAL_UPS, &action);
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_ACTIONS_CRITICAL_UPS, NULL);
/* use different text for different actions */
if (strcmp (action, ACTION_NOTHING) == 0) {
@@ -1697,39 +1693,34 @@
gchar *action = NULL;
/* we don't care about uninhibits */
- if (has_inhibit == FALSE) {
+ if (has_inhibit == FALSE)
return;
- }
/* only show this if specified in gconf */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_INHIBIT_LID, &show_inhibit_lid);
+ show_inhibit_lid = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_INHIBIT_LID, NULL);
/* we've already shown the UI and been clicked */
- if (show_inhibit_lid == FALSE) {
+ if (show_inhibit_lid == FALSE)
return;
- }
hal_manager = hal_manager_new ();
is_laptop = hal_manager_is_laptop (hal_manager);
g_object_unref (hal_manager);
/* we don't warn for desktops, as they do not have a lid... */
- if (is_laptop == FALSE) {
+ if (is_laptop == FALSE)
return;
- }
/* get the policy action for battery */
- gpm_conf_get_string (manager->priv->conf, GPM_CONF_BUTTON_LID_BATT, &action);
+ action = gconf_client_get_string (manager->priv->conf, GPM_CONF_BUTTON_LID_BATT, NULL);
- if (action == NULL) {
+ if (action == NULL)
return;
- }
/* if the policy on lid close is sleep then show a warning */
if ((strcmp (action, ACTION_SUSPEND) == 0) ||
- (strcmp (action, ACTION_HIBERNATE) == 0)) {
+ (strcmp (action, ACTION_HIBERNATE) == 0))
gpm_notify_inhibit_lid (manager->priv->notify);
- }
g_free (action);
}
@@ -1746,7 +1737,6 @@
GpmEngineCollection *collection;
GError *error = NULL;
gboolean on_ac;
- gboolean ret;
guint version;
manager->priv = GPM_MANAGER_GET_PRIVATE (manager);
@@ -1759,14 +1749,18 @@
manager->priv->prefs_server = gpm_prefs_server_new ();
manager->priv->notify = gpm_notify_new ();
- manager->priv->gconf_client = gconf_client_get_default ();
- manager->priv->conf = gpm_conf_new ();
- g_signal_connect (manager->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), manager);
+ manager->priv->conf = gconf_client_get_default ();
+
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (manager->priv->conf, GPM_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (manager->priv->conf, GPM_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ manager, NULL, NULL);
/* 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 || version != GPM_CONF_SCHEMA_ID) {
+ version = gconf_client_get_int (manager->priv->conf, GPM_CONF_SCHEMA_VERSION, NULL);
+ if (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"
@@ -1784,11 +1778,10 @@
/* coldplug so we are in the correct state at startup */
on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
- 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);
- }
+ if (on_ac)
+ manager->priv->low_power = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_AC, NULL);
+ else
+ manager->priv->low_power = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, NULL);
manager->priv->button = gpm_button_new ();
g_signal_connect (manager->priv->button, "button-pressed",
@@ -1819,7 +1812,7 @@
G_CALLBACK (idle_changed_cb), manager);
/* set up the check_type_cpu, so we can disable the CPU load check */
- gpm_conf_get_bool (manager->priv->conf, GPM_CONF_IDLE_CHECK_CPU, &check_type_cpu);
+ check_type_cpu = gconf_client_get_bool (manager->priv->conf, GPM_CONF_IDLE_CHECK_CPU, NULL);
gpm_idle_set_check_cpu (manager->priv->idle, check_type_cpu);
manager->priv->dpms = gpm_dpms_new ();
@@ -1921,18 +1914,14 @@
g_object_unref (manager->priv->srv_screensaver);
g_object_unref (manager->priv->prefs_server);
g_object_unref (manager->priv->control);
- g_object_unref (manager->priv->gconf_client);
/* optional gobjects */
- if (manager->priv->button) {
+ if (manager->priv->button)
g_object_unref (manager->priv->button);
- }
- if (manager->priv->backlight) {
+ if (manager->priv->backlight)
g_object_unref (manager->priv->backlight);
- }
- if (manager->priv->srv_brightness_kbd) {
+ if (manager->priv->srv_brightness_kbd)
g_object_unref (manager->priv->srv_brightness_kbd);
- }
G_OBJECT_CLASS (gpm_manager_parent_class)->finalize (object);
}
Modified: trunk/src/gpm-notify.c
==============================================================================
--- trunk/src/gpm-notify.c (original)
+++ trunk/src/gpm-notify.c Wed Oct 22 08:39:02 2008
@@ -38,10 +38,10 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
#include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
#include "gpm-ac-adapter.h"
#include "gpm-common.h"
-#include "gpm-conf.h"
#include "egg-debug.h"
#include "gpm-notify.h"
#include "gpm-stock-icons.h"
@@ -56,7 +56,7 @@
struct GpmNotifyPrivate
{
GpmAcAdapter *ac_adapter;
- GpmConf *conf;
+ GConfClient *conf;
GtkStatusIcon *status_icon;
gchar *internet_url;
const gchar *do_not_show_gconf;
@@ -312,7 +312,7 @@
if (strcmp (action, "dont-show-again") == 0) {
egg_debug ("not showing warning anymore for %s!", notify->priv->do_not_show_gconf);
- gpm_conf_set_bool (notify->priv->conf, notify->priv->do_not_show_gconf, FALSE);
+ gconf_client_set_bool (notify->priv->conf, notify->priv->do_not_show_gconf, FALSE, NULL);
notify->priv->do_not_show_gconf = NULL;
return;
}
@@ -668,7 +668,7 @@
{
notify->priv = GPM_NOTIFY_GET_PRIVATE (notify);
- notify->priv->conf = gpm_conf_new ();
+ notify->priv->conf = gconf_client_get_default ();
notify->priv->do_not_show_gconf = NULL;
/* we use ac_adapter so we can log the event */
Modified: trunk/src/gpm-phone.c
==============================================================================
--- trunk/src/gpm-phone.c (original)
+++ trunk/src/gpm-phone.c Wed Oct 22 08:39:02 2008
@@ -26,7 +26,7 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
-#include "gpm-conf.h"
+#include <gconf/gconf-client.h>
#include "gpm-phone.h"
#include "egg-debug.h"
#include "gpm-marshal.h"
Modified: trunk/src/gpm-prefs-core.c
==============================================================================
--- trunk/src/gpm-prefs-core.c (original)
+++ trunk/src/gpm-prefs-core.c Wed Oct 22 08:39:02 2008
@@ -38,7 +38,6 @@
#include "gpm-tray-icon.h"
#include "gpm-common.h"
#include "gpm-prefs.h"
-#include "gpm-conf.h"
#include "gpm-prefs-core.h"
#include "egg-debug.h"
#include "gpm-stock-icons.h"
@@ -67,7 +66,7 @@
gboolean can_shutdown;
gboolean can_suspend;
gboolean can_hibernate;
- GpmConf *conf;
+ GConfClient *conf;
GpmScreensaver *screensaver;
#ifdef HAVE_GCONF_DEFAULTS
PolKitGnomeAction *default_action;
@@ -255,7 +254,7 @@
policy = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "policy"));
str = gpm_tray_icon_mode_to_string (policy);
egg_debug ("Changing %s to %s", GPM_CONF_UI_ICON_POLICY, str);
- gpm_conf_set_string (prefs->priv->conf, GPM_CONF_UI_ICON_POLICY, str);
+ gconf_client_set_string (prefs->priv->conf, GPM_CONF_UI_ICON_POLICY, str, NULL);
}
/**
@@ -321,7 +320,7 @@
gpm_pref_key = (char *) g_object_get_data (G_OBJECT (range), "conf_key");
egg_debug ("Changing %s to %i", gpm_pref_key, value);
- gpm_conf_set_int (prefs->priv->conf, gpm_pref_key, value);
+ gconf_client_set_int (prefs->priv->conf, gpm_pref_key, value, NULL);
}
/**
@@ -344,8 +343,8 @@
g_signal_connect (G_OBJECT (widget), "format-value",
G_CALLBACK (gpm_prefs_format_time_cb), prefs);
- gpm_conf_get_int (prefs->priv->conf, gpm_pref_key, &value);
- gpm_conf_is_writable (prefs->priv->conf, gpm_pref_key, &is_writable);
+ value = gconf_client_get_int (prefs->priv->conf, gpm_pref_key, NULL);
+ is_writable = gconf_client_key_is_writable (prefs->priv->conf, gpm_pref_key, NULL);
gtk_widget_set_sensitive (widget, is_writable);
@@ -386,7 +385,7 @@
g_object_set_data (G_OBJECT (range), "conf_key", (gpointer) gpm_pref_key);
egg_debug ("Changing %s to %i", gpm_pref_key, (int) value);
- gpm_conf_set_int (prefs->priv->conf, gpm_pref_key, (gint) value);
+ gconf_client_set_int (prefs->priv->conf, gpm_pref_key, (gint) value, NULL);
}
/**
@@ -410,8 +409,8 @@
g_signal_connect (G_OBJECT (widget), "format-value",
G_CALLBACK (gpm_prefs_format_percentage_cb), NULL);
- gpm_conf_get_int (prefs->priv->conf, gpm_pref_key, &value);
- gpm_conf_is_writable (prefs->priv->conf, gpm_pref_key, &is_writable);
+ value = gconf_client_get_int (prefs->priv->conf, gpm_pref_key, NULL);
+ is_writable = gconf_client_key_is_writable (prefs->priv->conf, gpm_pref_key, NULL);
gtk_widget_set_sensitive (widget, is_writable);
@@ -459,7 +458,7 @@
g_free (value);
gpm_pref_key = (char *) g_object_get_data (G_OBJECT (widget), "conf_key");
egg_debug ("Changing %s to %s", gpm_pref_key, action);
- gpm_conf_set_string (prefs->priv->conf, gpm_pref_key, action);
+ gconf_client_set_string (prefs->priv->conf, gpm_pref_key, action, NULL);
}
/**
@@ -484,8 +483,8 @@
widget = glade_xml_get_widget (xml, widget_name);
- gpm_conf_get_string (prefs->priv->conf, gpm_pref_key, &value);
- gpm_conf_is_writable (prefs->priv->conf, gpm_pref_key, &is_writable);
+ value = gconf_client_get_string (prefs->priv->conf, gpm_pref_key, NULL);
+ is_writable = gconf_client_key_is_writable (prefs->priv->conf, gpm_pref_key, NULL);
gtk_widget_set_sensitive (widget, is_writable);
@@ -559,7 +558,7 @@
widget_name = gtk_widget_get_name (widget);
gpm_pref_key = (char *) g_object_get_data (G_OBJECT (widget), "conf_key");
egg_debug ("Changing %s to %i", gpm_pref_key, checked);
- gpm_conf_set_bool (prefs->priv->conf, gpm_pref_key, checked);
+ gconf_client_set_bool (prefs->priv->conf, gpm_pref_key, checked, NULL);
}
/**
@@ -582,7 +581,7 @@
widget = glade_xml_get_widget (xml, widget_name);
- gpm_conf_get_bool (prefs->priv->conf, gpm_pref_key, &checked);
+ checked = gconf_client_get_bool (prefs->priv->conf, gpm_pref_key, NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked);
g_object_set_data (G_OBJECT (widget), "conf_key", (gpointer) gpm_pref_key);
@@ -664,35 +663,38 @@
}
/**
- * conf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
- * We might have to do things when the conf keys change; do them here.
+ * We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmPrefs *prefs)
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmPrefs *prefs)
{
- int value;
+ GConfValue *value;
+ gint brightness;
GtkWidget *widget;
- gboolean enabled;
+ gboolean enabled;
+
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
- if (strcmp (key, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC) == 0) {
+ if (strcmp (entry->key, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC) == 0) {
widget = glade_xml_get_widget (prefs->priv->glade_xml, "hscale_ac_brightness");
- gpm_conf_get_int (conf, key, &value);
- gtk_range_set_value (GTK_RANGE (widget), value);
+ brightness = gconf_value_get_int (value);
+ gtk_range_set_value (GTK_RANGE (widget), brightness);
}
- if (strcmp (key, GPM_CONF_LOWPOWER_AC) == 0) {
- gpm_conf_get_bool (prefs->priv->conf, GPM_CONF_LOWPOWER_AC, &enabled);
+ if (strcmp (entry->key, GPM_CONF_LOWPOWER_AC) == 0) {
+ enabled = gconf_value_get_bool (value);
egg_debug ("need to enable checkbox");
- } else if (strcmp (key, GPM_CONF_LOWPOWER_UPS) == 0) {
- gpm_conf_get_bool (prefs->priv->conf, GPM_CONF_LOWPOWER_UPS, &enabled);
+ } else if (strcmp (entry->key, GPM_CONF_LOWPOWER_UPS) == 0) {
+ enabled = gconf_value_get_bool (value);
egg_debug ("need to enable checkbox");
- } else if (strcmp (key, GPM_CONF_LOWPOWER_BATT) == 0) {
- gpm_conf_get_bool (prefs->priv->conf, GPM_CONF_LOWPOWER_BATT, &enabled);
+ } else if (strcmp (entry->key, GPM_CONF_LOWPOWER_BATT) == 0) {
+ enabled = gconf_value_get_bool (value);
egg_debug ("need to enable checkbox");
}
}
@@ -710,7 +712,7 @@
GtkWidget *radiobutton_icon_never;
gboolean is_writable;
- gpm_conf_get_string (prefs->priv->conf, GPM_CONF_UI_ICON_POLICY, &icon_policy_str);
+ icon_policy_str = gconf_client_get_string (prefs->priv->conf, GPM_CONF_UI_ICON_POLICY, NULL);
icon_policy = gpm_tray_icon_mode_from_string (icon_policy_str);
g_free (icon_policy_str);
@@ -725,7 +727,7 @@
radiobutton_icon_never = glade_xml_get_widget (prefs->priv->glade_xml,
"radiobutton_notification_never");
- gpm_conf_is_writable (prefs->priv->conf, GPM_CONF_UI_ICON_POLICY, &is_writable);
+ is_writable = gconf_client_key_is_writable (prefs->priv->conf, GPM_CONF_UI_ICON_POLICY, NULL);
gtk_widget_set_sensitive (radiobutton_icon_always, is_writable);
gtk_widget_set_sensitive (radiobutton_icon_present, is_writable);
gtk_widget_set_sensitive (radiobutton_icon_charge, is_writable);
@@ -1072,9 +1074,13 @@
g_signal_connect (prefs->priv->screensaver, "gs-delay-changed",
G_CALLBACK (gs_delay_changed_cb), prefs);
- prefs->priv->conf = gpm_conf_new ();
- g_signal_connect (prefs->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), prefs);
+ prefs->priv->conf = gconf_client_get_default ();
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (prefs->priv->conf, GPM_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (prefs->priv->conf, GPM_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ prefs, NULL, NULL);
caps = gpm_dbus_method_int ("GetPreferencesOptions");
prefs->priv->has_batteries = ((caps & GPM_PREFS_SERVER_BATTERY) > 0);
Modified: trunk/src/gpm-screensaver.c
==============================================================================
--- trunk/src/gpm-screensaver.c (original)
+++ trunk/src/gpm-screensaver.c Wed Oct 22 08:39:02 2008
@@ -25,9 +25,10 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
+#include <gconf/gconf-client.h>
-#include "gpm-conf.h"
#include "gpm-screensaver.h"
+#include "gpm-common.h"
#include "egg-debug.h"
#include "egg-dbus-proxy.h"
@@ -40,7 +41,7 @@
struct GpmScreensaverPrivate
{
EggDbusProxy *gproxy;
- GpmConf *conf;
+ GConfClient *conf;
guint idle_delay; /* the setting in g-s-p, cached */
};
@@ -168,20 +169,21 @@
}
/**
- * gconf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
- * Turn a gconf key change into a signal
+ * We might have to do things when the gconf keys change; do them here.
**/
static void
-gconf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmScreensaver *screensaver)
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmScreensaver *screensaver)
{
- g_return_if_fail (GPM_IS_SCREENSAVER (screensaver));
- egg_debug ("key : %s", key);
+ GConfValue *value;
+
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
- if (strcmp (key, GS_PREF_IDLE_DELAY) == 0) {
- gpm_conf_get_uint (screensaver->priv->conf, key, &screensaver->priv->idle_delay);
+ if (strcmp (entry->key, GS_PREF_IDLE_DELAY) == 0) {
+ screensaver->priv->idle_delay = gconf_value_get_int (value);
egg_debug ("emitting gs-delay-changed : %i", screensaver->priv->idle_delay);
g_signal_emit (screensaver, signals [GS_DELAY_CHANGED], 0, screensaver->priv->idle_delay);
}
@@ -198,7 +200,7 @@
gboolean enabled;
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
- gpm_conf_get_bool (screensaver->priv->conf, GS_PREF_LOCK_ENABLED, &enabled);
+ enabled = gconf_client_get_bool (screensaver->priv->conf, GS_PREF_LOCK_ENABLED, NULL);
return enabled;
}
@@ -212,7 +214,7 @@
gpm_screensaver_lock_set (GpmScreensaver *screensaver, gboolean lock)
{
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
- gpm_conf_set_bool (screensaver->priv->conf, GS_PREF_LOCK_ENABLED, lock);
+ gconf_client_set_bool (screensaver->priv->conf, GS_PREF_LOCK_ENABLED, lock, NULL);
return TRUE;
}
@@ -557,13 +559,17 @@
gpm_screensaver_proxy_connect_more (screensaver);
- screensaver->priv->conf = gpm_conf_new ();
- g_signal_connect (screensaver->priv->conf, "value-changed",
- G_CALLBACK (gconf_key_changed_cb), screensaver);
+ screensaver->priv->conf = gconf_client_get_default ();
+
+ /* watch gnome-screensaver keys */
+ gconf_client_add_dir (screensaver->priv->conf, GS_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (screensaver->priv->conf, GS_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ screensaver, NULL, NULL);
/* get value of delay in g-s-p */
- gpm_conf_get_uint (screensaver->priv->conf, GS_PREF_IDLE_DELAY,
- &screensaver->priv->idle_delay);
+ screensaver->priv->idle_delay = gconf_client_get_int (screensaver->priv->conf, GS_PREF_IDLE_DELAY, NULL);
}
/**
Modified: trunk/src/gpm-srv-brightness-kbd.c
==============================================================================
--- trunk/src/gpm-srv-brightness-kbd.c (original)
+++ trunk/src/gpm-srv-brightness-kbd.c Wed Oct 22 08:39:02 2008
@@ -38,12 +38,12 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
+#include <gconf/gconf-client.h>
#include "gpm-ac-adapter.h"
#include "gpm-button.h"
#include "gpm-brightness-kbd.h"
#include "gpm-srv-brightness-kbd.h"
-#include "gpm-conf.h"
#include "gpm-common.h"
#include "egg-debug.h"
#include "gpm-feedback-widget.h"
@@ -60,7 +60,7 @@
GpmAcAdapter *ac_adapter;
GpmButton *button;
GpmBrightnessKbd *brightness;
- GpmConf *conf;
+ GConfClient *conf;
GpmFeedback *feedback;
GpmIdle *idle;
GpmLightSensor *sensor;
@@ -74,7 +74,7 @@
* We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf,
+conf_key_changed_cb (GConfClient *conf,
const gchar *key,
GpmSrvBrightnessKbd *srv_brightness)
{
@@ -85,17 +85,15 @@
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) {
+ value = gconf_client_get_int (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, NULL);
+ if (on_ac)
gpm_brightness_kbd_set_std (srv_brightness->priv->brightness, value);
- }
} else if (strcmp (key, GPM_CONF_KEYBOARD_BRIGHTNESS_BATT) == 0) {
- gpm_conf_get_int (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, &value);
- if (on_ac == FALSE) {
+ value = gconf_client_get_int (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, NULL);
+ if (on_ac == FALSE)
gpm_brightness_kbd_set_std (srv_brightness->priv->brightness, value);
- }
}
}
@@ -115,11 +113,10 @@
{
guint value;
- 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);
- }
+ if (on_ac)
+ value = gconf_client_get_int (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, NULL);
+ else
+ value = gconf_client_get_int (srv_brightness->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_BATT, NULL);
gpm_brightness_kbd_set_std (srv_brightness->priv->brightness, value);
}
@@ -256,7 +253,7 @@
{
srv_brightness->priv = GPM_SRV_BRIGHTNESS_KBD_GET_PRIVATE (srv_brightness);
- srv_brightness->priv->conf = gpm_conf_new ();
+ srv_brightness->priv->conf = gconf_client_get_default ();
/* watch for dim value changes */
g_signal_connect (srv_brightness->priv->conf, "value-changed",
Modified: trunk/src/gpm-srv-screensaver.c
==============================================================================
--- trunk/src/gpm-srv-screensaver.c (original)
+++ trunk/src/gpm-srv-screensaver.c Wed Oct 22 08:39:02 2008
@@ -26,7 +26,7 @@
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
-#include "gpm-conf.h"
+#include <gconf/gconf-client.h>
#include "gpm-screensaver.h"
#include "gpm-srv-screensaver.h"
#include "egg-debug.h"
@@ -46,7 +46,7 @@
GpmAcAdapter *ac_adapter;
GpmButton *button;
GpmBrightness *brightness;
- GpmConf *conf;
+ GConfClient *conf;
GpmDpms *dpms;
GpmScreensaver *screensaver;
guint32 ac_throttle_id;
@@ -243,7 +243,7 @@
srv_screensaver->priv = GPM_SRV_SCREENSAVER_GET_PRIVATE (srv_screensaver);
- srv_screensaver->priv->conf = gpm_conf_new ();
+ srv_screensaver->priv->conf = gconf_client_get_default ();
/* we use screensaver as the master class */
srv_screensaver->priv->screensaver = gpm_screensaver_new ();
Modified: trunk/src/gpm-statistics-core.c
==============================================================================
--- trunk/src/gpm-statistics-core.c (original)
+++ trunk/src/gpm-statistics-core.c Wed Oct 22 08:39:02 2008
@@ -29,12 +29,12 @@
#include <dbus/dbus-glib.h>
#include <math.h>
#include <string.h>
+#include <gconf/gconf-client.h>
#include "gpm-array.h"
#include "gpm-array-float.h"
#include "gpm-common.h"
#include "gpm-prefs.h"
-#include "gpm-conf.h"
#include "gpm-statistics-core.h"
#include "egg-debug.h"
#include "gpm-stock-icons.h"
@@ -72,7 +72,7 @@
{
GladeXML *glade_xml;
GtkWidget *graph_widget;
- GpmConf *conf;
+ GConfClient *conf;
EggDbusProxy *gproxy;
GpmArray *events;
GpmArray *data;
@@ -163,28 +163,29 @@
* @graph: This graph class instance
**/
static gboolean
-gpm_statistics_delete_event_cb (GtkWidget *widget,
- GdkEvent *event,
- GpmStatistics *statistics)
+gpm_statistics_delete_event_cb (GtkWidget *widget, GdkEvent *event, GpmStatistics *statistics)
{
gpm_statistics_close_cb (widget, statistics);
return FALSE;
}
/**
- * conf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
* We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmStatistics *statistics)
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmStatistics *statistics)
{
- gboolean enabled;
+ GConfValue *value;
+ gboolean enabled;
- if (strcmp (key, GPM_CONF_LOWPOWER_AC) == 0) {
- gpm_conf_get_bool (statistics->priv->conf, GPM_CONF_LOWPOWER_AC, &enabled);
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
+
+ if (strcmp (entry->key, GPM_CONF_LOWPOWER_AC) == 0) {
+ enabled = gconf_value_get_bool (value);
egg_debug ("need to enable checkbox");
}
}
@@ -299,7 +300,7 @@
egg_debug ("Events enable %i", checked);
/* save to gconf so we open next time with the correct setting */
- gpm_conf_set_bool (statistics->priv->conf, GPM_CONF_STATS_SHOW_EVENTS, checked);
+ gconf_client_set_bool (statistics->priv->conf, GPM_CONF_STATS_SHOW_EVENTS, checked, NULL);
if (checked == FALSE) {
/* remove the dots from the graph */
@@ -330,7 +331,7 @@
GtkWidget *widget2;
/* save to gconf so we open next time with the correct setting */
- gpm_conf_get_bool (statistics->priv->conf, GPM_CONF_STATS_SHOW_AXIS_LABELS, &show);
+ show = gconf_client_get_bool (statistics->priv->conf, GPM_CONF_STATS_SHOW_AXIS_LABELS, NULL);
widget1 = glade_xml_get_widget (statistics->priv->glade_xml, "label_x_axis");
widget2 = glade_xml_get_widget (statistics->priv->glade_xml, "label_y_axis");
@@ -617,7 +618,7 @@
gpm_statistics_get_data_dbus (statistics, statistics->priv->graph_type);
}
- gpm_conf_get_bool (statistics->priv->conf, GPM_CONF_STATS_SMOOTH_DATA, &smooth);
+ smooth = gconf_client_get_bool (statistics->priv->conf, GPM_CONF_STATS_SMOOTH_DATA, NULL);
if (smooth) {
GArray *arrayfloat;
GArray *kernel;
@@ -683,7 +684,7 @@
statistics->priv->graph_type = type;
/* save in gconf so we choose the correct graph type on next startup */
- gpm_conf_set_string (statistics->priv->conf, GPM_CONF_STATS_GRAPH_TYPE, type);
+ gconf_client_set_string (statistics->priv->conf, GPM_CONF_STATS_GRAPH_TYPE, type, NULL);
/* refresh data automatically */
gpm_statistics_refresh_data (statistics);
@@ -709,11 +710,10 @@
return;
}
- gpm_conf_get_string (statistics->priv->conf, GPM_CONF_STATS_GRAPH_TYPE, &saved);
+ saved = gconf_client_get_string (statistics->priv->conf, GPM_CONF_STATS_GRAPH_TYPE, NULL);
/* gconf error, bahh */
- if (saved == NULL) {
+ if (saved == NULL)
saved = g_strdup ("power");
- }
count = 0;
pos = 0;
@@ -739,9 +739,8 @@
type_localized = _("Unknown");
}
/* is this the same value as we have stored in gconf? */
- if (strcmp (type, saved) == 0) {
+ if (strcmp (type, saved) == 0)
pos = count;
- }
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), type_localized);
count++;
}
@@ -796,9 +795,13 @@
statistics->priv = GPM_STATISTICS_GET_PRIVATE (statistics);
- statistics->priv->conf = gpm_conf_new ();
- g_signal_connect (statistics->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), statistics);
+ statistics->priv->conf = gconf_client_get_default ();
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (statistics->priv->conf, GPM_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (statistics->priv->conf, GPM_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ statistics, NULL, NULL);
glade_set_custom_handler (gpm_graph_widget_custom_handler, statistics);
@@ -851,7 +854,7 @@
gpm_statistics_populate_graph_types (statistics, widget);
widget = glade_xml_get_widget (statistics->priv->glade_xml, "checkbutton_events");
- gpm_conf_get_bool (statistics->priv->conf, GPM_CONF_STATS_SHOW_EVENTS, &checked);
+ checked = gconf_client_get_bool (statistics->priv->conf, GPM_CONF_STATS_SHOW_EVENTS, NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked);
g_signal_connect (widget, "clicked",
G_CALLBACK (gpm_statistics_checkbox_events_cb), statistics);
Modified: trunk/src/gpm-statistics.c
==============================================================================
--- trunk/src/gpm-statistics.c (original)
+++ trunk/src/gpm-statistics.c Wed Oct 22 08:39:02 2008
@@ -34,7 +34,7 @@
#include <egg-unique.h>
#include "gpm-common.h"
-#include "gpm-conf.h"
+#include <gconf/gconf-client.h>
#include "egg-debug.h"
#include "gpm-statistics-core.h"
Modified: trunk/src/gpm-tray-icon.c
==============================================================================
--- trunk/src/gpm-tray-icon.c (original)
+++ trunk/src/gpm-tray-icon.c Wed Oct 22 08:39:02 2008
@@ -39,8 +39,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gtk/gtkstatusicon.h>
+#include <gconf/gconf-client.h>
-#include "gpm-conf.h"
#include "gpm-control.h"
#include "gpm-common.h"
#include "egg-debug.h"
@@ -59,7 +59,7 @@
struct GpmTrayIconPrivate
{
- GpmConf *conf;
+ GConfClient *conf;
GpmControl *control;
GpmNotify *notify;
GpmEngineCollection *collection;
@@ -603,36 +603,39 @@
}
/**
- * conf_key_changed_cb:
+ * gpm_conf_gconf_key_changed_cb:
*
* We might have to do things when the gconf keys change; do them here.
**/
static void
-conf_key_changed_cb (GpmConf *conf,
- const gchar *key,
- GpmTrayIcon *icon)
+gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmTrayIcon *icon)
{
- gboolean enabled;
- gboolean allowed_in_menu;
+ GConfValue *value;
+ gboolean enabled;
+ gboolean allowed_in_menu;
- if (strcmp (key, GPM_CONF_CAN_SUSPEND) == 0) {
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
+
+ if (strcmp (entry->key, GPM_CONF_CAN_SUSPEND) == 0) {
gpm_control_allowed_suspend (icon->priv->control, &enabled, NULL);
- gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, &allowed_in_menu);
+ allowed_in_menu = gconf_client_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, NULL);
gpm_tray_icon_enable_suspend (icon, allowed_in_menu && enabled);
- } else if (strcmp (key, GPM_CONF_CAN_HIBERNATE) == 0) {
+ } else if (strcmp (entry->key, GPM_CONF_CAN_HIBERNATE) == 0) {
gpm_control_allowed_hibernate (icon->priv->control, &enabled, NULL);
- gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, &allowed_in_menu);
+ allowed_in_menu = gconf_client_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, NULL);
gpm_tray_icon_enable_hibernate (icon, allowed_in_menu && enabled);
- } else if (strcmp (key, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU) == 0) {
- gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, &allowed_in_menu);
+ } else if (strcmp (entry->key, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU) == 0) {
+ allowed_in_menu = gconf_value_get_bool (value);
gpm_control_allowed_suspend (icon->priv->control, &enabled, NULL);
gpm_tray_icon_enable_suspend (icon, allowed_in_menu && enabled);
gpm_control_allowed_hibernate (icon->priv->control, &enabled, NULL);
gpm_tray_icon_enable_hibernate (icon, allowed_in_menu && enabled);
- } else if (strcmp (key, GPM_CONF_UI_SHOW_CONTEXT_MENU) == 0) {
- gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_CONTEXT_MENU, &allowed_in_menu);
+ } else if (strcmp (entry->key, GPM_CONF_UI_SHOW_CONTEXT_MENU) == 0) {
+ allowed_in_menu = gconf_value_get_bool (value);
gpm_tray_icon_enable_context_menu (icon, allowed_in_menu);
}
}
@@ -659,9 +662,13 @@
/* use the policy object */
icon->priv->control = gpm_control_new ();
- icon->priv->conf = gpm_conf_new ();
- g_signal_connect (icon->priv->conf, "value-changed",
- G_CALLBACK (conf_key_changed_cb), icon);
+ icon->priv->conf = gconf_client_get_default ();
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (icon->priv->conf, GPM_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (icon->priv->conf, GPM_CONF_DIR,
+ (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
+ icon, NULL, NULL);
icon->priv->status_icon = gtk_status_icon_new ();
g_signal_connect_object (G_OBJECT (icon->priv->status_icon),
@@ -676,13 +683,13 @@
/* only show the suspend and hibernate icons if we can do the action,
and the policy allows the actions in the menu */
- gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, &allowed_in_menu);
+ allowed_in_menu = gconf_client_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_ACTIONS_IN_MENU, NULL);
gpm_control_allowed_suspend (icon->priv->control, &enabled, NULL);
gpm_tray_icon_enable_suspend (icon, enabled && allowed_in_menu);
gpm_control_allowed_hibernate (icon->priv->control, &enabled, NULL);
gpm_tray_icon_enable_hibernate (icon, enabled && allowed_in_menu);
- gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_CONTEXT_MENU, &allowed_in_menu);
+ allowed_in_menu = gconf_client_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_CONTEXT_MENU, NULL);
gpm_tray_icon_enable_context_menu (icon, allowed_in_menu);
gpm_tray_icon_show (GPM_TRAY_ICON (icon), FALSE);
@@ -702,9 +709,8 @@
tray_icon = GPM_TRAY_ICON (object);
- if (tray_icon->priv->notify != NULL) {
+ if (tray_icon->priv->notify != NULL)
g_object_unref (tray_icon->priv->notify);
- }
g_object_unref (tray_icon->priv->control);
g_object_unref (tray_icon->priv->status_icon);
Modified: trunk/src/gpm-warnings.c
==============================================================================
--- trunk/src/gpm-warnings.c (original)
+++ trunk/src/gpm-warnings.c Wed Oct 22 08:39:02 2008
@@ -39,7 +39,7 @@
#include <dbus/dbus-glib.h>
#include "gpm-common.h"
-#include "gpm-conf.h"
+#include <gconf/gconf-client.h>
#include "egg-debug.h"
#include "gpm-cell-unit.h"
#include "gpm-warnings.h"
@@ -48,7 +48,7 @@
struct GpmWarningsPrivate
{
- GpmConf *conf;
+ GConfClient *conf;
gboolean use_time_primary;
gboolean time_is_accurate;
@@ -204,16 +204,16 @@
* gconf_key_changed_cb:
**/
static void
-gconf_key_changed_cb (GpmConf *conf,
+gconf_key_changed_cb (GConfClient *conf,
const gchar *key,
GpmWarnings *warnings)
{
g_return_if_fail (GPM_IS_WARNINGS (warnings));
if (strcmp (key, GPM_CONF_USE_TIME_POLICY) == 0) {
- gpm_conf_get_bool (warnings->priv->conf,
- GPM_CONF_USE_TIME_POLICY,
- &warnings->priv->use_time_primary);
+ warnings->priv->use_time_primary =
+ gconf_client_get_bool (warnings->priv->conf,
+ GPM_CONF_USE_TIME_POLICY, NULL);
}
}
@@ -243,23 +243,23 @@
warnings->priv = GPM_WARNINGS_GET_PRIVATE (warnings);
warnings->priv->time_is_accurate = TRUE;
- warnings->priv->conf = gpm_conf_new ();
+ warnings->priv->conf = gconf_client_get_default ();
g_signal_connect (warnings->priv->conf, "value-changed",
G_CALLBACK (gconf_key_changed_cb), warnings);
/* get percentage policy */
- gpm_conf_get_uint (warnings->priv->conf, GPM_CONF_THRESH_PERCENTAGE_LOW, &warnings->priv->low_percentage);
- gpm_conf_get_uint (warnings->priv->conf, GPM_CONF_THRESH_PERCENTAGE_CRITICAL, &warnings->priv->critical_percentage);
- gpm_conf_get_uint (warnings->priv->conf, GPM_CONF_THRESH_PERCENTAGE_ACTION, &warnings->priv->action_percentage);
+ warnings->priv->low_percentage = gconf_client_get_int (warnings->priv->conf, GPM_CONF_THRESH_PERCENTAGE_LOW, NULL);
+ warnings->priv->critical_percentage = gconf_client_get_int (warnings->priv->conf, GPM_CONF_THRESH_PERCENTAGE_CRITICAL, NULL);
+ warnings->priv->action_percentage = gconf_client_get_int (warnings->priv->conf, GPM_CONF_THRESH_PERCENTAGE_ACTION, NULL);
/* get time policy */
- gpm_conf_get_uint (warnings->priv->conf, GPM_CONF_THRESH_TIME_LOW, &warnings->priv->low_time);
- gpm_conf_get_uint (warnings->priv->conf, GPM_CONF_THRESH_TIME_CRITICAL, &warnings->priv->critical_time);
- gpm_conf_get_uint (warnings->priv->conf, GPM_CONF_THRESH_TIME_ACTION, &warnings->priv->action_time);
+ warnings->priv->low_time = gconf_client_get_int (warnings->priv->conf, GPM_CONF_THRESH_TIME_LOW, NULL);
+ warnings->priv->critical_time = gconf_client_get_int (warnings->priv->conf, GPM_CONF_THRESH_TIME_CRITICAL, NULL);
+ warnings->priv->action_time = gconf_client_get_int (warnings->priv->conf, GPM_CONF_THRESH_TIME_ACTION, NULL);
/* 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);
+ warnings->priv->use_time_primary = gconf_client_get_bool (warnings->priv->conf, GPM_CONF_USE_TIME_POLICY, NULL);
if (warnings->priv->use_time_primary) {
egg_debug ("Using per-time notification policy");
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]