[gpm] little chance in 50-no-critical-on-ac.patch (ubuntu)



I was looking trough some code, and noticed this in
50-no-critical-on-ac.patch from ubuntu

		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);
		}


now, isn't it better to do this:


		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);
		}

I will explain why: The user saw the low battery message, and plugged
in the adapter, but he forgot the plug in the adapter in the laptop
itself... A few minutes later, the battery level gets critical, and
the user notices (because of the notification) that he forgot to plug
in the adapter in his laptop, and he does so quickly (he has 10
seconds to do so before the GPM_PREF_BATTERY_CRITICAL is reached).

 If we check for on_ac AFTER the 10 seconds sleep, the
GPM_PREF_BATTERY_CRITICAL won't be reached, and the laptop will stay
on...

  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
)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]