After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623963 - [PATCH] Support arbitrary time combo values
[PATCH] Support arbitrary time combo values
Status: RESOLVED FIXED
Product: gnome-power-manager
Classification: Deprecated
Component: gnome-power-preferences
2.30.x
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-07-09 16:15 UTC by Michael Terry
Modified: 2010-07-16 17:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.74 KB, patch)
2010-07-09 16:15 UTC, Michael Terry
none Details | Review

Description Michael Terry 2010-07-09 16:15:13 UTC
Created attachment 165565 [details] [review]
Proposed patch

When I have changed the gconf value for keys like /apps/gnome-power-manager/timeout/sleep_computer_ac to an unusual setting (15m, 5h), the combo boxes in the preference dialog show nothing instead of the time I entered.

Here's a patch to notice when that happens and to add an entry to the combo for the current gconf value.

A couple notes:

1) This works because the dialog doesn't dynamically notice when gconf changes.  If support for that was added, we would have to also adjust the combo if the new gconf value was also not in the list.

2) If the gconf value is only slightly off (try entering 61 seconds), you'll see two "1 minute" entries.  Not sure how to do this better besides increasing the granularity of the user-friendly strings, and it's a bit of a corner case anyway.
Comment 1 Richard Hughes 2010-07-13 09:45:51 UTC
Looks good to me. Please commit.
Comment 2 Michael Terry 2010-07-16 17:10:59 UTC
I had to fix one more thing that came up with further testing (use GArray when writing back to gsettings, not just when reading from it).  Made sure it still works in new gnome-control-center plugin mode too.

commit 8fa1a0769956e61f0978fa62870af6f808a93a99
Author: Michael Terry <mike@mterry.name>
Date:   Fri Jul 16 13:05:48 2010 -0400

    Support arbitrary time combo values
    
    Allow time combo preference widgets to use a value they didn't expect
    from GSettings.  This avoids getting a blank combo when a user has
    edited the value themselves.  Closes: bgo#623963