gnome-power-manager r3196 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3196 - in trunk: . src
- Date: Wed, 28 Jan 2009 08:58:36 +0000 (UTC)
Author: rhughes
Date: Wed Jan 28 08:58:36 2009
New Revision: 3196
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3196&view=rev
Log:
2009-01-28 Richard Hughes <richard hughsie com>
* src/gpm-common.h:
* src/gpm-prefs-core.c: (gpm_prefs_sleep_slider_changed_cb),
(gpm_prefs_setup_sleep_slider), (set_idle_hscale_stops),
(prefs_setup_ac), (prefs_setup_battery), (prefs_setup_ups),
(gpm_prefs_init), (gpm_prefs_finalize):
* src/gpm-screensaver.c: (gpm_screensaver_init):
* src/gpm-screensaver.h:
Don't rely on the gnome-screensaver idle key now we are using
gnome-session.
Modified:
trunk/ChangeLog
trunk/src/gpm-common.h
trunk/src/gpm-prefs-core.c
trunk/src/gpm-screensaver.c
trunk/src/gpm-screensaver.h
Modified: trunk/src/gpm-common.h
==============================================================================
--- trunk/src/gpm-common.h (original)
+++ trunk/src/gpm-common.h Wed Jan 28 08:58:36 2009
@@ -173,7 +173,9 @@
/* 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"
+
+/* gnome-session */
+#define GPM_CONF_IDLE_DELAY "/desktop/gnome/session/idle_delay"
typedef enum {
GPM_ICON_POLICY_ALWAYS,
Modified: trunk/src/gpm-prefs-core.c
==============================================================================
--- trunk/src/gpm-prefs-core.c (original)
+++ trunk/src/gpm-prefs-core.c Wed Jan 28 08:58:36 2009
@@ -41,7 +41,6 @@
#include "gpm-prefs-core.h"
#include "egg-debug.h"
#include "gpm-stock-icons.h"
-#include "gpm-screensaver.h"
#include "gpm-prefs-server.h"
#ifdef HAVE_GCONF_DEFAULTS
@@ -64,8 +63,8 @@
gboolean can_shutdown;
gboolean can_suspend;
gboolean can_hibernate;
- GConfClient *conf;
- GpmScreensaver *screensaver;
+ guint idle_delay;
+ GConfClient *conf;
#ifdef HAVE_GCONF_DEFAULTS
PolKitGnomeAction *default_action;
#endif
@@ -297,7 +296,6 @@
GpmPrefs *prefs)
{
int value;
- int gs_idle_time;
char *gpm_pref_key;
value = (int) gtk_range_get_value (range);
@@ -307,10 +305,9 @@
value = 0;
} else {
/* We take away the g-s idle time as the slider represents
- * global time but we only do our timeout from when g-s
+ * global time but we only do our timeout from when gnome-session
* declares the session idle */
- gs_idle_time = gpm_screensaver_get_delay (prefs->priv->screensaver);
- value -= gs_idle_time;
+ value -= prefs->priv->idle_delay;
/* policy is in seconds, slider is in minutes */
value *= 60;
@@ -328,14 +325,11 @@
* @gpm_pref_key: The GConf key for this preference setting.
**/
static GtkWidget *
-gpm_prefs_setup_sleep_slider (GpmPrefs *prefs,
- const gchar *widget_name,
- const gchar *gpm_pref_key)
+gpm_prefs_setup_sleep_slider (GpmPrefs *prefs, const gchar *widget_name, const gchar *gpm_pref_key)
{
GtkWidget *widget;
gint value;
gboolean is_writable;
- guint gs_idle_time;
widget = glade_xml_get_widget (prefs->priv->glade_xml, widget_name);
g_signal_connect (G_OBJECT (widget), "format-value",
@@ -351,8 +345,7 @@
} else {
/* policy is in seconds, slider is in minutes */
value /= 60;
- gs_idle_time = gpm_screensaver_get_delay (prefs->priv->screensaver);
- value += gs_idle_time;
+ value += prefs->priv->idle_delay;
}
gtk_range_set_value (GTK_RANGE (widget), value);
@@ -626,7 +619,7 @@
* @widget_name: The widget name
*
* Here we make sure that the start of the hscale is set to the
- * gnome-screensaver idle time to avoid confusion.
+ * gnome-session idle time to avoid confusion.
**/
static void
set_idle_hscale_stops (GpmPrefs *prefs,
@@ -636,31 +629,13 @@
GtkWidget *widget;
widget = glade_xml_get_widget (prefs->priv->glade_xml, widget_name);
if (gs_idle_time + 1 > NEVER_TIME_ON_SLIDER) {
- egg_warning ("gnome-screensaver timeout is really big. "
- "Not sure what to do");
+ egg_warning ("gnome-session timeout is really big");
return;
}
gtk_range_set_range (GTK_RANGE (widget), gs_idle_time + 1, NEVER_TIME_ON_SLIDER);
}
/**
- * gs_delay_changed_cb:
- * @key: The conf key
- * @prefs: This prefs class instance
- **/
-static void
-gs_delay_changed_cb (GpmScreensaver *screensaver,
- gint delay,
- GpmPrefs *prefs)
-{
- /* update the start and stop points on the hscales */
- set_idle_hscale_stops (prefs, "hscale_battery_computer", delay);
- set_idle_hscale_stops (prefs, "hscale_battery_display", delay);
- set_idle_hscale_stops (prefs, "hscale_ac_computer", delay);
- set_idle_hscale_stops (prefs, "hscale_ac_display", delay);
-}
-
-/**
* gpm_conf_gconf_key_changed_cb:
*
* We might have to do things when the gconf keys change; do them here.
@@ -790,7 +765,6 @@
prefs_setup_ac (GpmPrefs *prefs)
{
GtkWidget *widget;
- gint delay;
const gchar *button_lid_actions[] =
{ACTION_NOTHING,
ACTION_BLANK,
@@ -812,9 +786,8 @@
gpm_prefs_setup_checkbox (prefs, "checkbutton_ac_display_dim",
GPM_CONF_BACKLIGHT_IDLE_DIM_AC);
- delay = gpm_screensaver_get_delay (prefs->priv->screensaver);
- set_idle_hscale_stops (prefs, "hscale_ac_computer", delay);
- set_idle_hscale_stops (prefs, "hscale_ac_display", delay);
+ set_idle_hscale_stops (prefs, "hscale_ac_computer", prefs->priv->idle_delay);
+ set_idle_hscale_stops (prefs, "hscale_ac_display", prefs->priv->idle_delay);
if (prefs->priv->has_button_lid == FALSE) {
widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_lid");
@@ -833,7 +806,6 @@
{
GtkWidget *widget;
GtkWidget *notebook;
- gint delay;
gint page;
const gchar *button_lid_actions[] =
@@ -881,9 +853,8 @@
gtk_widget_hide_all (widget);
}
- delay = gpm_screensaver_get_delay (prefs->priv->screensaver);
- set_idle_hscale_stops (prefs, "hscale_battery_computer", delay);
- set_idle_hscale_stops (prefs, "hscale_battery_display", delay);
+ set_idle_hscale_stops (prefs, "hscale_battery_computer", prefs->priv->idle_delay);
+ set_idle_hscale_stops (prefs, "hscale_battery_display", prefs->priv->idle_delay);
if (prefs->priv->has_button_lid == FALSE) {
widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_battery_lid");
@@ -900,7 +871,6 @@
{
GtkWidget *widget;
GtkWidget *notebook;
- gint delay;
gint page;
const gchar *ups_low_actions[] =
@@ -925,8 +895,7 @@
ups_low_actions);
gpm_prefs_setup_sleep_slider (prefs, "hscale_ups_computer",
GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT);
- delay = gpm_screensaver_get_delay (prefs->priv->screensaver);
- set_idle_hscale_stops (prefs, "hscale_ups_computer", delay);
+ set_idle_hscale_stops (prefs, "hscale_ups_computer", prefs->priv->idle_delay);
}
static void
@@ -1068,10 +1037,6 @@
prefs->priv = GPM_PREFS_GET_PRIVATE (prefs);
- prefs->priv->screensaver = gpm_screensaver_new ();
- g_signal_connect (prefs->priv->screensaver, "gs-delay-changed",
- G_CALLBACK (gs_delay_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,
@@ -1080,6 +1045,9 @@
(GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb,
prefs, NULL, NULL);
+ /* get value of delay in gnome-session */
+ prefs->priv->idle_delay = gconf_client_get_int (prefs->priv->conf, GPM_CONF_IDLE_DELAY, NULL);
+
caps = gpm_dbus_method_int ("GetPreferencesOptions");
prefs->priv->has_batteries = ((caps & GPM_PREFS_SERVER_BATTERY) > 0);
prefs->priv->has_ups = ((caps & GPM_PREFS_SERVER_UPS) > 0);
@@ -1152,9 +1120,6 @@
prefs->priv = GPM_PREFS_GET_PRIVATE (prefs);
g_object_unref (prefs->priv->conf);
- if (prefs->priv->screensaver) {
- g_object_unref (prefs->priv->screensaver);
- }
G_OBJECT_CLASS (gpm_prefs_parent_class)->finalize (object);
}
Modified: trunk/src/gpm-screensaver.c
==============================================================================
--- trunk/src/gpm-screensaver.c (original)
+++ trunk/src/gpm-screensaver.c Wed Jan 28 08:58:36 2009
@@ -44,7 +44,6 @@
{
EggDbusProxy *gproxy;
GConfClient *conf;
- guint idle_delay; /* the setting in g-s-p, cached */
};
enum {
@@ -132,27 +131,6 @@
}
/**
- * gpm_conf_gconf_key_changed_cb:
- *
- * We might have to do things when the gconf keys change; do them here.
- **/
-static void
-gpm_conf_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpmScreensaver *screensaver)
-{
- GConfValue *value;
-
- value = gconf_entry_get_value (entry);
- if (value == NULL)
- return;
-
- 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);
- }
-}
-
-/**
* gpm_screensaver_lock_enabled:
* @screensaver: This class instance
* Return value: If gnome-screensaver is set to lock the screen on screensave
@@ -182,18 +160,6 @@
}
/**
- * gpm_screensaver_get_delay:
- * @screensaver: This class instance
- * Return value: The delay for the idle time set in gnome-screesaver-properties.
- **/
-gint
-gpm_screensaver_get_delay (GpmScreensaver *screensaver)
-{
- g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), 0);
- return screensaver->priv->idle_delay;
-}
-
-/**
* gpm_screensaver_lock
* @screensaver: This class instance
* Return value: Success value
@@ -465,16 +431,6 @@
gpm_screensaver_proxy_connect_more (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 */
- screensaver->priv->idle_delay = gconf_client_get_int (screensaver->priv->conf, GS_PREF_IDLE_DELAY, NULL);
}
/**
Modified: trunk/src/gpm-screensaver.h
==============================================================================
--- trunk/src/gpm-screensaver.h (original)
+++ trunk/src/gpm-screensaver.h Wed Jan 28 08:58:36 2009
@@ -55,7 +55,6 @@
GType gpm_screensaver_get_type (void);
GpmScreensaver *gpm_screensaver_new (void);
-int gpm_screensaver_get_delay (GpmScreensaver *screensaver);
gboolean gpm_screensaver_lock (GpmScreensaver *screensaver);
gboolean gpm_screensaver_lock_enabled (GpmScreensaver *screensaver);
gboolean gpm_screensaver_lock_set (GpmScreensaver *screensaver,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]