make GSettingsSpinButton aware of ranges defined in the schema #1173

Merged
merged 5 commits into from Jan 30, 2013

Conversation

Projects
None yet
4 participants
Member

Cobinja commented Sep 21, 2012

This makes GSettingsSpinButton aware of ranges defined in the schema.

It takes the min and max arguments passed to the constructor and compares them to the range, if and only if a range was defined. It then takes the more restrictive values as min and max for the button (bigger min, smaller max).

Contributor

autarkper commented Sep 21, 2012

I have tested Cobinja's branch and found that is works beautifully. Since we don't have any ranges yet in our schema, I had to invent a few arbitrary ones:

<key type="i" name="panel-hide-delay">
  <default>20</default>
  <range min="15" />
  <summary>Duration of the delay before a shown panel is hidden</summary>
  <description>Duration of the delay (in milliseconds)</description>
</key>

<key name="panel-top-height" type="i">
  <default>25</default>
  <range min="15" max="100" />
  <_summary>Panel size</_summary>
  <_description>
    User-defined panel-height for top panel
  </_description>
</key>

<key name="panel-bottom-height" type="i">
  <default>25</default>
  <range max="100" />
  <_summary>Panel size</_summary>
  <_description>
    User-defined panel-height for bottom panel
  </_description>
</key>
Member

mtwebster commented Sep 21, 2012

Why not add those updated keys in this request also? And anymore that may be needed.

Looks like there should be a min also in the panel-bottom-height key.

Contributor

autarkper commented Sep 21, 2012

Actually, those were only my test values. On Cobinja's suggestion I made
some of the ranges incomplete, so that could be tested too.

Member

Cobinja commented Sep 21, 2012

@mtwebster: For two reasons: 1. We haven't agreed yet on a suitable minimum height for panels. 2. I wanted to keep the functionality separated from schema changes.

Member

mtwebster commented Sep 21, 2012

I was working on something else in cinnamon-settings.py, and came across a GSettingsRangeSpin class - it's only used once, for font scaling, but essentially accomplishes the same thing I think.

Member

Cobinja commented Sep 21, 2012

@mtwebster : Essentially it does, except for the fact that it does not take into account keys without a schema-defined range. For those keys, it will fail and probably make cinnamon-settings crash. Gladly, the one it's used for does have a range.
I asked Clem about it and GSettingsRange, another class for the same use case, which is not used at all. He said "just leave it in, like all the unused GConf classes."

Member

Cobinja commented Sep 24, 2012

This fixes #1165

Contributor

autarkper commented Sep 24, 2012

@Cobinja: or rather, "makes it unlikely to happen by mistake"? :)

Member

Cobinja commented Sep 24, 2012

@autarkper: That's a "yes", if someone changes the panel height with an application that doesn't care about schema defined ranges.

Contributor

autarkper commented Oct 30, 2012

I have merged this to my master branch.

Contributor

autarkper commented Dec 8, 2012

This one needs to be rebased, after the modularization of cinnamon-settings.py.

Member

Cobinja commented Dec 8, 2012

Rebased to current master

@clefebvre clefebvre added a commit that referenced this pull request Jan 30, 2013

@clefebvre clefebvre Merge pull request #1173 from Cobinja/cobidev-gsettings-range
make GSettingsSpinButton aware of ranges defined in the schema
bf8a48c

@clefebvre clefebvre merged commit bf8a48c into linuxmint:master Jan 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment