Skip to content

Commit

Permalink
power-icon: Remove the power-related code
Browse files Browse the repository at this point in the history
This part is now handled by a gnome-settings-daemon plugin. This code is
interfering with the gsd one.
  • Loading branch information
Damien Lespiau committed Apr 17, 2012
1 parent 018f0cf commit 88a4a3a
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 1,286 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ fi
AM_CONDITIONAL([USE_PENGE_MAILME],
[test "$dawati_use_myzone_panel" = "yes" || test "$dawati_use_datetime_panel" = "yes"])

if test x$dawati_use_devices_panel = xyes || test x$dawati_use_power_icon_panel = xyes; then
if test x$dawati_use_devices_panel = xyes; then
#
# Gnome Power Manager
#
Expand All @@ -473,7 +473,7 @@ if test x$dawati_use_devices_panel = xyes || test x$dawati_use_power_icon_panel
fi

AM_CONDITIONAL([USE_GPM_GVC],
[test "$dawati_use_devices_panel" = "yes" || test "$dawati_use_power_icon_panel" = "yes"])
[test "$dawati_use_devices_panel" = "yes"])

if test x$dawati_use_people_panel = xyes || test x$dawati_use_status_panel = xyes; then
AC_MSG_CHECKING([how to detect we are online])
Expand Down
22 changes: 0 additions & 22 deletions panels/devices/data/dawati-panel-devices.schemas.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,5 @@
<short/>
</locale>
</schema>
<schema>
<key>/schemas/desktop/dawati/panel-devices/buttons/lid</key>
<applyto>/desktop/dawati/panel-devices/buttons/lid</applyto>
<owner>dawati-panel-devices</owner>
<type>string</type>
<default>suspend</default>
<locale name="C">
<short/>
</locale>
</schema>
<schema>
<key>/schemas/desktop/dawati/panel-devices/timeout/sleep_computer</key>
<applyto>/desktop/dawati/panel-devices/timeout/sleep_computer</applyto>
<owner>dawati-panel-devices</owner>
<type>int</type>
<default>300</default>
<locale name="C">
<short>Sleep timeout</short>
<long>Value of -1 means never sleep, other values are seconds
of continuous idle state before sleeping.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
101 changes: 1 addition & 100 deletions panels/devices/src/mpd-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ enum

PROP_BRIGHTNESS_ENABLED,
PROP_BRIGHTNESS_VALUE,
PROP_BRIGHTNESS_VALUE_BATTERY,
PROP_LID_ACTION,
PROP_SUSPEND_IDLE_TIME
PROP_BRIGHTNESS_VALUE_BATTERY
};

typedef struct
Expand All @@ -52,8 +50,6 @@ typedef struct
#define MPD_CONF_BRIGHTNESS_ENABLED MPD_CONF_DIR"/panel-devices/brightness_enabled"
#define MPD_CONF_BRIGHTNESS_VALUE MPD_CONF_DIR"/panel-devices/brightness_value"
#define MPD_CONF_BRIGHTNESS_VALUE_BATTERY MPD_CONF_DIR"/panel-devices/brightness_value_battery"
#define MPD_CONF_LID_ACTION MPD_CONF_DIR"/panel-devices/buttons/lid"
#define MPD_CONF_SUSPEND_IDLE_TIME MPD_CONF_DIR"/panel-devices/timeout/sleep_computer"

#define MPD_CONF_MIN_SUSPEND_DELAY 15

Expand All @@ -67,11 +63,6 @@ _gconf_mpd_notify_cb (GConfClient *client,

key = gconf_entry_get_key (entry);

if (0 == g_strcmp0 (key, MPD_CONF_SUSPEND_IDLE_TIME))
{
g_object_notify (G_OBJECT (self), "suspend-idle-time");
}

if (0 == g_strcmp0 (key, MPD_CONF_BRIGHTNESS_ENABLED))
{
g_object_notify (G_OBJECT (self), "brightness-enabled");
Expand All @@ -86,11 +77,6 @@ _gconf_mpd_notify_cb (GConfClient *client,
{
g_object_notify (G_OBJECT (self), "brightness-value-battery");
}

if (0 == g_strcmp0 (key, MPD_CONF_LID_ACTION))
{
g_object_notify (G_OBJECT (self), "lid-action");
}
}

static void
Expand All @@ -109,14 +95,6 @@ _get_property (GObject *object,
g_value_set_float (value,
mpd_conf_get_brightness_value (MPD_CONF (object)));
break;
case PROP_LID_ACTION:
g_value_set_uint (value,
mpd_conf_get_lid_action (MPD_CONF (object)));
break;
case PROP_SUSPEND_IDLE_TIME:
g_value_set_int (value,
mpd_conf_get_suspend_idle_time (MPD_CONF (object)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
Expand Down Expand Up @@ -214,26 +192,6 @@ mpd_conf_class_init (MpdConfClass *klass)
"Display brightness value on battery",
0.0, 1.0, 1.0,
param_flags | G_PARAM_WRITABLE));

g_object_class_install_property (object_class,
PROP_LID_ACTION,
g_param_spec_uint ("lid-action",
"Lid action",
"Action when lid is closed",
MPD_CONF_LID_ACTION_NONE,
MPD_CONF_LID_ACTION_SUSPEND,
MPD_CONF_LID_ACTION_SUSPEND,
param_flags));

g_object_class_install_property (object_class,
PROP_SUSPEND_IDLE_TIME,
g_param_spec_int ("suspend-idle-time",
"Suspend idle time",
"Time to suspend when idle",
-1,
3600, /* whatever */
30,
param_flags));
}

static void
Expand Down Expand Up @@ -387,60 +345,3 @@ mpd_conf_set_brightness_value_battery (MpdConf *self,
}
}
}

int
mpd_conf_get_suspend_idle_time (MpdConf *self)
{
MpdConfPrivate *priv = GET_PRIVATE (self);
GError *error = NULL;
int suspend_idle_time;

g_return_val_if_fail (MPD_IS_CONF (self), -1);

suspend_idle_time = gconf_client_get_int (priv->client,
MPD_CONF_SUSPEND_IDLE_TIME,
&error);
if (error)
{
g_warning ("%s : %s", G_STRLOC, error->message);
g_clear_error (&error);
}

/* Suspend now but leave a few seconds for gnome-screensaver:
* otherwise may get a screensave _after_ resuming. This
* also lets screensaver finish any fading it wants to do,
* not to mention giving the user a few seconds to break idle */
if (suspend_idle_time > 0 && suspend_idle_time < MPD_CONF_MIN_SUSPEND_DELAY)
suspend_idle_time = MPD_CONF_MIN_SUSPEND_DELAY;

return suspend_idle_time;
}

MpdConfLidAction
mpd_conf_get_lid_action (MpdConf *self)
{
MpdConfPrivate *priv = GET_PRIVATE (self);
char *action;
MpdConfLidAction lid_action = MPD_CONF_LID_ACTION_SUSPEND;
GError *error = NULL;

g_return_val_if_fail (MPD_IS_CONF (self), MPD_CONF_LID_ACTION_SUSPEND);

action = gconf_client_get_string (priv->client,
MPD_CONF_LID_ACTION,
&error);
if (error)
{
g_warning ("%s : %s", G_STRLOC, error->message);
g_clear_error (&error);
} else {
if (0 == g_strcmp0 ("suspend", action))
lid_action = MPD_CONF_LID_ACTION_SUSPEND;
else if (0 == g_strcmp0 ("none", action))
lid_action = MPD_CONF_LID_ACTION_NONE;
}

/* FIXME: maybe clamp to property boundaries? */
return lid_action;
}

12 changes: 0 additions & 12 deletions panels/devices/src/mpd-conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ void
mpd_conf_set_brightness_value_battery (MpdConf *self,
float value);

int
mpd_conf_get_suspend_idle_time (MpdConf *self);

typedef enum
{
MPD_CONF_LID_ACTION_NONE, /* Must be first. */
MPD_CONF_LID_ACTION_SUSPEND /* Must be last. */
} MpdConfLidAction;

MpdConfLidAction
mpd_conf_get_lid_action (MpdConf *self);

G_END_DECLS

#endif /* MPD_CONF_H */
Expand Down
36 changes: 0 additions & 36 deletions panels/devices/tests/test-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,6 @@ print_brightness_value (MpdConf *conf)
printf ("%s: %.2f\n", name, brightness_value);
}

static void
print_lid_action (MpdConf *conf)
{
char const *name = "lid-action";
MpdConfLidAction lid_action;

g_object_get (conf, name, &lid_action, NULL);

printf ("%s: %s\n", name,
lid_action == MPD_CONF_LID_ACTION_SUSPEND ?
"suspend" : "none");
}

static void
print_suspend_idle_time (MpdConf *conf)
{
char const *name = "suspend-idle-time";
int suspend_idle_time;

g_object_get (conf, name, &suspend_idle_time, NULL);

printf ("%s: %i\n", name, suspend_idle_time);
}

static void
_conf_property_notify_cb (GObject *object,
GParamSpec *pspec,
Expand All @@ -81,10 +57,6 @@ _conf_property_notify_cb (GObject *object,
print_brightness_enabled (conf);
else if (0 == g_strcmp0 (name, "brightness-value"))
print_brightness_value (conf);
else if (0 == g_strcmp0 (name, "lid-action"))
print_lid_action (conf);
else if (0 == g_strcmp0 (name, "suspend-idle-time"))
print_suspend_idle_time (conf);
else
g_warning ("%s : Unknown property \"%s\"", G_STRLOC, name);
}
Expand All @@ -111,14 +83,6 @@ main (int argc,
g_signal_connect (conf, "notify::brightness-value",
G_CALLBACK (_conf_property_notify_cb), conf);

print_lid_action (conf);
g_signal_connect (conf, "notify::lid-action",
G_CALLBACK (_conf_property_notify_cb), conf);

print_suspend_idle_time (conf);
g_signal_connect (conf, "notify::suspend-idle-time",
G_CALLBACK (_conf_property_notify_cb), conf);

clutter_main ();
g_object_unref (conf);
return EXIT_SUCCESS;
Expand Down
7 changes: 0 additions & 7 deletions panels/power-icon/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,14 @@ libexec_PROGRAMS = \

dawati_power_icon_LDADD = \
$(PANEL_POWER_ICON_LIBS) \
$(top_builddir)/gpm/libgpm.la \
$(NULL)

dawati_power_icon_SOURCES = \
$(top_srcdir)/panels/devices/src/mpd-conf.c \
$(top_srcdir)/panels/devices/src/mpd-battery-device.c \
$(top_srcdir)/panels/devices/src/mpd-display-device.c \
$(top_srcdir)/panels/devices/src/mpd-gobject.c \
dawati-power-icon.c \
mpd-global-key.c \
mpd-global-key.h \
mpd-idle-manager.c \
mpd-idle-manager.h \
mpd-lid-device.c \
mpd-lid-device.h \
mpd-power-icon.c \
mpd-power-icon.h \
mpd-shutdown-notification.c \
Expand Down
Loading

0 comments on commit 88a4a3a

Please sign in to comment.