Re: [gpm] little chance in 50-no-critical-on-ac.patch (ubuntu)
- From: "Michaël Arnauts" <michael arnauts gmail com>
- To: "Richard Hughes" <hughsient gmail com>
- Cc: gnome-power-manager-list gnome org
- Subject: Re: [gpm] little chance in 50-no-critical-on-ac.patch (ubuntu)
- Date: Mon, 20 Feb 2006 20:52:14 +0100
This is what is in CVS:
(in battery_status_changed_primary)
if (warning_type == GPM_WARNING_ACTION) {
gpm_tray_icon_notify (GPM_TRAY_ICON (manager->priv->tray_icon),
5000,
_("Critical action"),
NULL,
_("The battery is below the critical level and "
"this computer is about to shutdown."));
/* wait 10 seconds for user-panic */
g_usleep (1000 * 1000 * 10);
manager_policy_do (manager, GPM_PREF_BATTERY_CRITICAL);
}
this is what ubuntu's 50-no-critical-on-ac.patch patch does:
if (warning_type == GPM_WARNING_ACTION) {
+ gboolean on_ac;
+
gpm_tray_icon_notify (GPM_TRAY_ICON (manager->priv->tray_icon),
5000,
_("Critical action"),
NULL,
_("The battery is below the critical level and "
"this computer is about to shutdown."));
- /* wait 10 seconds for user-panic */
- g_usleep (1000 * 1000 * 10);
- manager_policy_do (manager, GPM_PREF_BATTERY_CRITICAL);
+ gpm_power_get_on_ac (manager->priv->power, &on_ac, NULL);
+ if (!on_ac) {
+ /* wait 10 seconds for user-panic */
+ g_usleep (1000 * 1000 * 10);
+ manager_policy_do (manager, GPM_PREF_BATTERY_CRITICAL);
+ }
}
isn't this better?
gpm_power_get_on_ac (manager->priv->power, &on_ac, NULL);
/* wait 10 seconds for user-panic */
g_usleep (1000 * 1000 * 10);
if (!on_ac) {
manager_policy_do (manager, GPM_PREF_BATTERY_CRITICAL);
}
if we do it like in the ubuntupatch (or like in cvs), the user won't
have a chance to do something about it in those last 10 seconds...
making them useless (again, i can be wrong!)
Michaël
On 2/20/06, Richard Hughes <hughsient gmail com> wrote:
> On Mon, 2006-02-20 at 20:23 +0100, Michaël Arnauts wrote:
> > This is how i think gnome-power-manager works... I haven't studied
> > the whole source, so I can be incorrect, but the scenario above is a
> > common one (I forgot to plug in the other end of the power cable a lot
> > )
>
> That bit of code has changed considerably from the version you are
> working with.
>
> Can you look at the code in CVS, and tell me if you think the current
> logic needs to be changed :
> http://cvs.gnome.org/viewcvs/gnome-power-manager/
>
> Many thanks, Richard.
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]