/** * plugin_notify: * @plugin: This class instance * * Notify the plugin that a key marked with ohm_plugin_conf_interested () * has it's value changed. * An enumerated numeric id rather than the key is returned for processing speed. */ static void plugin_notify (OhmPlugin *plugin, gint id, gint value) { switch (id) { case CONF_BRIGHTNESS_AC_CHANGED: case CONF_BRIGHTNESS_BATTERY_CHANGED: case CONF_BRIGHTNESS_IDLE_CHANGED: reset_brightness (plugin); break; case CONF_TIMEOUTS_POWERSAVE_CHANGED: backlight_powersave (plugin, (value == 1)); break; case CONF_LID_STATE_CHANGED: lid_closed (plugin, (value == 1)); break; case CONF_TABLET_STATE_CHANGED: if (value == 0) { ohm_plugin_conf_set_key (plugin, "xrandr.position", 0); } else { ohm_plugin_conf_set_key (plugin, "xrandr.position", 1); } break; case CONF_AC_STATE_CHANGED: case CONF_BACKLIGHT_STATE_CHANGED: reset_brightness (plugin); break; case CONF_TIMEOUTS_MOMENTARY_CHANGED: brightness_momentary (plugin, (value == 1)); break; } }
/** * plugin_notify: * @plugin: This class instance * * Notify the plugin that a key marked with ohm_plugin_conf_interested () * has it's value changed. * An enumerated numeric id rather than the key is returned for processing speed. */ static void plugin_notify (OhmPlugin *plugin, gint id, gint value) { if (id == CONF_BUTTON_LID_CHANGED) { if (value == 1) { lid_closed (plugin, TRUE); } else { lid_closed (plugin, FALSE); } } else if (id == CONF_BUTTON_POWER_CHANGED) { /* only match on button press, not release */ if (value == 1) { power_button_pressed (plugin); } } else if (id == CONF_TIMEOUTS_POWERDOWN_CHANGED) { /* only match on idle, not reset */ if (value == 1) { g_debug ("powerdown is 1, suspending"); system_is_idle (plugin); } } }
/** * toi_check_resleep: See whether to powerdown again after waking. * * After waking, check whether we should powerdown again in a (usually * different) way. We only do this if the lid switch is still closed. */ void toi_check_resleep(void) { /* We only return if we suspended to ram and woke. */ if (lid_closed() && post_wake_state >= 0) __toi_power_down(post_wake_state); }