GNOME Bugzilla – Bug 325911
respond to gnome-screensaver signals instead of polling
Last modified: 2006-01-08 17:21:43 UTC
g-p-m should respond to gnome-screensaver signals instead of polling. It might even be nice to have gnome-power-manager watch for the death of gnome-screensaver. I think a nice way to do this would be to create a singleton class that monitors the idleness. You could get the initial session-idle state from g-s getSessionIdle and thereafter watch for the changed signal or g-s death. When you get the SessionIdleChanged (true) signal over DBUS start counting down. Think of the session idle as the baseline before which the user doesn't want anything done. I think the two relevent states are session-idle and system-idle. You could emit signals from the GpmIdleMonitor for those (session-idle-changed) and add or remove timeout functions for doing things. What do you think?
Sounds good to me. If you want to send me code, send to the m/l the interim patches and i'll merge them. The configure stuff for the X headers scares me the most.
Created attachment 56895 [details] [review] patch This does a number of things: * Adds user data to the HAL callbacks * Splits gpm-main into two classes: GpmHalMonitor, GpmManager * Adds a GpmIdle class The idea of the GpmHalMonitor class is to abstract as much of the HAL listening stuff as possible. The GpmManager is essentially a shell around most of the functionality. This important in that it lays the groundwork for making HAL optional and adding DPMS support. There are a few things that still need work. gpm-notifications should be turned into an object so that it can emit signals for suspend actions, etc. Also, we probably also need to check the initial state of the session idleness. And also make sure that we reconnect to g-s if we lose it. Despite that I think it is good enough to commit if you think it is ok. What do you think?
Wow, quite a patch, thanks. I like what you did abstracting out gpm-manager -- this is good. I'm not quite sure why you need userdata for the hal callbacks, but I'll assume you know more than me and go with the flow. :-) Minor nitpicks, DISABLE_SHUTDOWN_FOR_TESTING should probably be DISABLE_ACTIONS_FOR_TESTING, and po/POTFILES.in needs updating -- plus you need one hell of a ChangeLog entry if you want to commit that yourself :-) I've not tested the idle stuff yet, but I'll do that this evening. Otherwise, looks good to commit. You can commit directly for this if you like -- you have my blessing :-) You probably want to add yourself to AUTHORS too if you're planning on adding more big stuff. Thanks again for helping with this, it's very appreciated. Richard
I've made changes per your comments and committed to CVS. I'll fix the notification stuff that I broke now. I also hope to have the DPMS stuff done by tomorrow too. Sooner the better since we'll have to test the heck out of it after all these changes :) Thanks. 2006-01-08 William Jon McCann <mccann@jhu.edu> * src/gpm-manager.[ch]: New class to act as a management shell. * src/gpm-hal-monitor.[ch]: New class to encapsulate all the HAL monitoring. * src/gpm-screensaver.h: Add G_BEGIN_DECLS and glib includes. * src/gpm-notification.c (callback_actions_activated): Disable the actions temporarily until we can use signals to do this cleanly. * src/gpm-marshal.list: Add new signal for battery status changed. * src/gpm-main.c: Move functionality out of here and split into GpmManager and GpmHalMonitor. * src/gpm-idle.[ch]: Turn into a class for monitoring the session and system idle. * src/gpm-hal.h: Add G_BEGIN_DECLS and glib includes. * src/gpm-hal-callback.[ch] (signal_handler_PropertyModified) (signal_handler_DeviceRemoved, signal_handler_NewCapability) (signal_handler_Condition, gpm_hal_callback_init): Add user data to be returned to callbacks. * src/gpm-dbus-server.[ch]: Don't use gnome.h. Don't export signal enum. * src/Makefile.am: Add new files. * AUTHORS: Updated. Refactored to support handling signals from gnome-screensaver, laying groundwork for DPMS management, and making HAL optional. Fixes #325911.
Brilliant, thanks for doing this. I look forward to new patches!