Changeset d1a41d2b9e8293b7310d616fd8ccd24ddf38d9be
- Timestamp:
- 11/01/09 20:26:43 (2 years ago)
- Author:
- Leo Antunes <leo@…>
- Children:
- 1aef8415e1cd98c88d3980e0d949c832c3ddd7e8
- Parents:
- e3cc7b23a6aba21796577ff44a9a3f9d855080cb
- git-committer:
- Leo Antunes <leo@…> (11/01/09 20:26:43)
- Message:
-
- store changed status as pref and restore at startup if it exists:
avoid awayonlock messing with the last-online status if you quit
while idle.
- minor tweaks and fixes to the test script
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
re3cc7b2
|
rd1a41d2
|
|
| | 1 | Version 0.5 (2009-11-01): |
| | 2 | |
| | 3 | - store changed status as pref and restore at startup if it exists: |
| | 4 | avoid awayonlock messing with the last-online status if you quit |
| | 5 | while idle. |
| | 6 | - minor tweaks and fixes to the test script |
| | 7 | |
| 1 | 8 | Version 0.4 (2009-07-22): |
| 2 | 9 | |
-
|
re3cc7b2
|
rd1a41d2
|
|
| 56 | 56 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("plugin_load called\n")); |
| 57 | 57 | |
| | 58 | if(purple_prefs_get_int(AWAYONLOCK_PREF_OLD_STATUS) != 0) { |
| | 59 | PurpleSavedStatus *status_saved = purple_savedstatus_find_by_creation_time((time_t)purple_prefs_get_int(AWAYONLOCK_PREF_OLD_STATUS)); |
| | 60 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("stale status '%s' located, restoring and clearing\n"), purple_savedstatus_get_title(status_saved)); |
| | 61 | purple_savedstatus_activate(status_saved); |
| | 62 | purple_prefs_set_int(AWAYONLOCK_PREF_OLD_STATUS, 0); |
| | 63 | } |
| | 64 | |
| 58 | 65 | dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
| 59 | 66 | |
| … |
… |
|
| 195 | 202 | purple_prefs_add_none(AWAYONLOCK_PREF_ROOT); |
| 196 | 203 | purple_prefs_add_string(AWAYONLOCK_PREF_STATUS, NULL); |
| | 204 | purple_prefs_add_int(AWAYONLOCK_PREF_OLD_STATUS, 0); |
| 197 | 205 | purple_prefs_add_bool(AWAYONLOCK_PREF_AVAILABLE_ONLY, 0); |
| 198 | 206 | } |
-
|
reac542b
|
rd1a41d2
|
|
| 29 | 29 | #include "prefs.h" |
| 30 | 30 | |
| 31 | | static PurpleSavedStatus *status_saved = NULL; |
| 32 | | |
| 33 | 31 | void awayonlock_idle_changed_callback(DBusGProxy *proxy, gboolean screensaver_status, gpointer data) { |
| 34 | 32 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("got message from screensaver: active=%u\n"), screensaver_status); |
| 35 | 33 | |
| 36 | | PurpleSavedStatus *status_idle; |
| | 34 | PurpleSavedStatus *status_idle, *status_saved; |
| 37 | 35 | |
| 38 | 36 | const char *awayonlock_savedstatus = purple_prefs_get_string(AWAYONLOCK_PREF_STATUS); |
| … |
… |
|
| 49 | 47 | |
| 50 | 48 | if(screensaver_status && ! purple_savedstatus_is_idleaway() && ((!available_only && purple_savedstatus_get_type(status_current) != PURPLE_STATUS_OFFLINE && purple_savedstatus_get_type(status_current) != PURPLE_STATUS_INVISIBLE) || purple_savedstatus_get_type(status_current) == PURPLE_STATUS_AVAILABLE)) { |
| 51 | | status_saved = status_current; |
| 52 | | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("setting status as '%s' and storing '%s'\n"), purple_savedstatus_get_title(status_idle), purple_savedstatus_get_title(status_saved)); |
| | 49 | purple_prefs_set_int(AWAYONLOCK_PREF_OLD_STATUS, (int)purple_savedstatus_get_creation_time(status_current)); |
| | 50 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("setting status as '%s' and storing '%s'\n"), purple_savedstatus_get_title(status_idle), purple_savedstatus_get_title(status_current)); |
| 53 | 51 | purple_savedstatus_activate(status_idle); |
| 54 | 52 | } |
| 55 | 53 | else if (!screensaver_status && status_saved != NULL && status_saved != status_idle) { |
| | 54 | status_saved = purple_savedstatus_find_by_creation_time((time_t)purple_prefs_get_int(AWAYONLOCK_PREF_OLD_STATUS)); |
| 56 | 55 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("restoring status '%s'\n"), purple_savedstatus_get_title(status_saved)); |
| 57 | 56 | purple_savedstatus_activate(status_saved); |
| 58 | | status_saved = NULL; |
| | 57 | purple_prefs_set_int(AWAYONLOCK_PREF_OLD_STATUS, 0); |
| 59 | 58 | } |
| 60 | 59 | else { |
-
|
reac542b
|
rd1a41d2
|
|
| 28 | 28 | #define AWAYONLOCK_PREF_ROOT "/plugins/core/awayonlock" |
| 29 | 29 | #define AWAYONLOCK_PREF_STATUS "/plugins/core/awayonlock/status" |
| | 30 | #define AWAYONLOCK_PREF_OLD_STATUS "/plugins/core/awayonlock/old_status" |
| 30 | 31 | #define AWAYONLOCK_PREF_AVAILABLE_ONLY "/plugins/core/awayonlock/available_only" |
| 31 | 32 | |
-
|
rebf9132
|
rd1a41d2
|
|
| 3 | 3 | """ |
| 4 | 4 | incredibly dirty hack to test away-on-lock |
| | 5 | if gnome-screensaver is already running this wont work (it wont be able |
| | 6 | to pretend to be gnome-screensaver) |
| 5 | 7 | """ |
| 6 | 8 | |
| … |
… |
|
| 18 | 20 | |
| 19 | 21 | @dbus.service.signal(dbus_interface='org.gnome.ScreenSaver', signature='b') |
| 20 | | def SessionIdleChanged(self, y): |
| | 22 | def ActiveChanged(self, y): |
| 21 | 23 | print "emmitting...", repr(y) |
| 22 | 24 | return True |
| … |
… |
|
| 28 | 30 | t = Test('/org/gnome/ScreenSaver') |
| 29 | 31 | gobject.timeout_add( 1, t.ActiveChanged, dbus.Boolean(1)) |
| 30 | | gobject.timeout_add(2000, t.ActiveChanged, dbus.Boolean(0)) |
| 31 | | gobject.timeout_add(2001, app.quit) |
| | 32 | gobject.timeout_add(5000, t.ActiveChanged, dbus.Boolean(0)) |
| | 33 | gobject.timeout_add(5001, app.quit) |
| 32 | 34 | |
| 33 | 35 | app.run() |