[gnome-tweak-tool] Factor out a GConfFontButtonTweak
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Factor out a GConfFontButtonTweak
- Date: Fri, 18 Mar 2011 05:30:12 +0000 (UTC)
commit 648adeb0c8562a15566dd1bba19147d62757680f
Author: John Stowers <john stowers gmail com>
Date: Fri Mar 18 14:51:23 2011 +1300
Factor out a GConfFontButtonTweak
gtweak/tweaks/tweak_font.py | 19 ++-----------------
gtweak/widgets.py | 13 +++++++++++++
2 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_font.py b/gtweak/tweaks/tweak_font.py
index fa34ed3..8c872c4 100644
--- a/gtweak/tweaks/tweak_font.py
+++ b/gtweak/tweaks/tweak_font.py
@@ -1,22 +1,7 @@
from gi.repository import Gtk
from gtweak.tweakmodel import Tweak, TweakGroup
-from gtweak.gconf import GConfSetting
-from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, build_horizontal_sizegroup, build_label_beside_widget
-
-class MetacityTitleFont(Tweak):
- def __init__(self, **options):
- self._gconf = GConfSetting("/apps/metacity/general/titlebar_font", str)
- Tweak.__init__(self, self._gconf.schema_get_summary(), self._gconf.schema_get_description(), **options)
-
- w = Gtk.FontButton()
- w.props.font_name = self._gconf.get_value()
- w.connect("notify::font-name", self._on_fontbutton_changed)
- self.widget = build_label_beside_widget(self._gconf.schema_get_summary(), w)
- self.widget_for_size_group = w
-
- def _on_fontbutton_changed(self, btn, param):
- self._gconf.set_value(btn.props.font_name)
+from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, GConfFontButtonTweak, build_horizontal_sizegroup
sg = build_horizontal_sizegroup()
@@ -27,5 +12,5 @@ TWEAK_GROUPS = (
GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", size_group=sg),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name", size_group=sg),
- MetacityTitleFont(size_group=sg)),
+ GConfFontButtonTweak("/apps/metacity/general/titlebar_font", str, size_group=sg)),
)
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index 9765f3c..67d0e2d 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -140,3 +140,16 @@ class GConfComboTweak(_GConfTweak):
value = combo.get_model().get_value(_iter, 0)
self.gconf.set_value(value)
+class GConfFontButtonTweak(_GConfTweak):
+ def __init__(self, key_name, key_type, **options):
+ _GConfTweak.__init__(self, key_name, key_type, **options)
+
+ w = Gtk.FontButton()
+ w.props.font_name = self.gconf.get_value()
+ w.connect("notify::font-name", self._on_fontbutton_changed)
+ self.widget = build_label_beside_widget(self.gconf.schema_get_summary(), w)
+ self.widget_for_size_group = w
+
+ def _on_fontbutton_changed(self, btn, param):
+ self.gconf.set_value(btn.props.font_name)
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]