r32655 - in /packages/unstable/gnome-tweak-tool/debian: changelog patches/02_dont-crash-on-missing-schemas.patch patches/series
biebl at users.alioth.debian.org
biebl at users.alioth.debian.org
Thu Feb 23 00:06:09 UTC 2012
Author: biebl
Date: Thu Feb 23 00:06:08 2012
New Revision: 32655
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=32655
Log:
* debian/patches/02_dont-crash-on-missing-schemas.patch:
- Don't crash on missing gsettings schemas. Closes: #655535
Patch cherry-picked and rebased from upstream Git.
Added:
packages/unstable/gnome-tweak-tool/debian/patches/02_dont-crash-on-missing-schemas.patch
Modified:
packages/unstable/gnome-tweak-tool/debian/changelog
packages/unstable/gnome-tweak-tool/debian/patches/series
Modified: packages/unstable/gnome-tweak-tool/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/gnome-tweak-tool/debian/changelog?rev=32655&op=diff
==============================================================================
--- packages/unstable/gnome-tweak-tool/debian/changelog [utf-8] (original)
+++ packages/unstable/gnome-tweak-tool/debian/changelog [utf-8] Thu Feb 23 00:06:08 2012
@@ -1,3 +1,11 @@
+gnome-tweak-tool (3.2.2-3) UNRELEASED; urgency=low
+
+ * debian/patches/02_dont-crash-on-missing-schemas.patch:
+ - Don't crash on missing gsettings schemas. Closes: #655535
+ Patch cherry-picked and rebased from upstream Git.
+
+ -- Michael Biebl <biebl at debian.org> Thu, 23 Feb 2012 01:04:39 +0100
+
gnome-tweak-tool (3.2.2-2) unstable; urgency=low
[ Josselin Mouette ]
Added: packages/unstable/gnome-tweak-tool/debian/patches/02_dont-crash-on-missing-schemas.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/gnome-tweak-tool/debian/patches/02_dont-crash-on-missing-schemas.patch?rev=32655&op=file
==============================================================================
--- packages/unstable/gnome-tweak-tool/debian/patches/02_dont-crash-on-missing-schemas.patch (added)
+++ packages/unstable/gnome-tweak-tool/debian/patches/02_dont-crash-on-missing-schemas.patch [utf-8] Thu Feb 23 00:06:08 2012
@@ -1,0 +1,150 @@
+From 81ee17f1b0352347b1bf5f2bdad25e0fc2c7c3eb Mon Sep 17 00:00:00 2001
+From: John Stowers <john.stowers at gmail.com>
+Date: Wed, 18 Jan 2012 08:10:45 +0000
+Subject: Dont crash on missing schemas
+
+--- a/gtweak/gsettings.py
++++ b/gtweak/gsettings.py
+@@ -23,6 +23,12 @@
+
+ from gi.repository import Gio, GLib
+
++_SCHEMA_CACHE = {}
++_GSETTINGS_SCHEMAS = set(Gio.Settings.list_schemas())
++
++class GSettingsMissingError(Exception):
++ pass
++
+ class _GSettingsSchema:
+ def __init__(self, schema_name, schema_dir=None, schema_filename=None, **options):
+ if not schema_dir:
+@@ -62,10 +68,25 @@
+ def __repr__(self):
+ return "<gtweak.gsettings._GSettingsSchema: %s>" % self._schema_name
+
+-_SCHEMA_CACHE = {}
++class GSettingsFakeSetting:
++ def __init__(self):
++ pass
++
++ def get_range(self, *args, **kwargs):
++ return False, []
++
++ def get_string(self, *args, **kwargs):
++ return ""
++
++ def __getattr__(self, name):
++ def noop(*args, **kwargs):
++ pass
++ return noop
+
+ class GSettingsSetting(Gio.Settings):
+ def __init__(self, schema_name, **options):
++ if schema_name not in _GSETTINGS_SCHEMAS:
++ raise GSettingsMissingError(schema_name)
+ Gio.Settings.__init__(self, schema_name)
+ if schema_name not in _SCHEMA_CACHE:
+ _SCHEMA_CACHE[schema_name] = _GSettingsSchema(schema_name, **options)
+--- a/gtweak/tweakmodel.py
++++ b/gtweak/tweakmodel.py
+@@ -35,6 +35,7 @@
+ self.name = name
+ self.description = description
+ self.group_name = options.get("group_name",_("Miscellaneous"))
++ self.loaded = True
+
+ self._search_cache = None
+
+@@ -148,6 +149,8 @@
+ self._tweak_group_names[tweakgroup.name] = tweakgroup
+
+ def add_tweak_auto_to_group(self, tweak):
++ if not tweak.loaded:
++ return
+ name = tweak.group_name
+ try:
+ group = self._tweak_group_names[name]
+--- a/gtweak/widgets.py
++++ b/gtweak/widgets.py
+@@ -15,10 +15,12 @@
+ # You should have received a copy of the GNU General Public License
+ # along with gnome-tweak-tool. If not, see <http://www.gnu.org/licenses/>.
+
++import logging
++
+ from gi.repository import Gtk, Gdk, Gio, Pango
+
+ from gtweak.tweakmodel import Tweak
+-from gtweak.gsettings import GSettingsSetting
++from gtweak.gsettings import GSettingsSetting, GSettingsFakeSetting, GSettingsMissingError
+ from gtweak.gconf import GConfSetting
+
+ def build_label_beside_widget(txt, *widget, **kwargs):
+@@ -97,11 +99,17 @@
+ def __init__(self, schema_name, key_name, **options):
+ self.schema_name = schema_name
+ self.key_name = key_name
+- self.settings = GSettingsSetting(schema_name, **options)
+- Tweak.__init__(self,
+- options.get("summary",self.settings.schema_get_summary(key_name)),
+- options.get("description",self.settings.schema_get_description(key_name)),
+- **options)
++ try:
++ self.settings = GSettingsSetting(schema_name, **options)
++ Tweak.__init__(self,
++ options.get("summary",self.settings.schema_get_summary(key_name)),
++ options.get("description",self.settings.schema_get_description(key_name)),
++ **options)
++ except GSettingsMissingError, e:
++ self.settings = GSettingsFakeSetting()
++ Tweak.__init__(self,"","")
++ self.loaded = False
++ logging.info("Missing gsettings %s (key %s)" % (e.message, key_name))
+
+ class GSettingsSwitchTweak(_GSettingsTweak):
+ def __init__(self, schema_name, key_name, **options):
+@@ -109,7 +117,7 @@
+
+ w = Gtk.Switch()
+ self.settings.bind(key_name, w, "active", Gio.SettingsBindFlags.DEFAULT)
+- self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
++ self.widget = build_label_beside_widget(self.name, w)
+ # never change the size of a switch
+ self.widget_for_size_group = None
+
+@@ -119,7 +127,7 @@
+
+ w = Gtk.FontButton()
+ self.settings.bind(key_name, w, "font-name", Gio.SettingsBindFlags.DEFAULT)
+- self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
++ self.widget = build_label_beside_widget(self.name, w)
+ self.widget_for_size_group = w
+
+ class GSettingsRangeTweak(_GSettingsTweak):
+@@ -131,7 +139,7 @@
+
+ w = Gtk.HScale.new_with_range(_min, _max, options.get('adjustment_step', 1))
+ self.settings.bind(key_name, w.get_adjustment(), "value", Gio.SettingsBindFlags.DEFAULT)
+- self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
++ self.widget = build_label_beside_widget(self.name, w)
+ self.widget_for_size_group = w
+
+ class GSettingsComboEnumTweak(_GSettingsTweak):
+@@ -146,7 +154,7 @@
+ w.connect('changed', self._on_combo_changed)
+ self.combo = w
+
+- self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
++ self.widget = build_label_beside_widget(self.name, w)
+ self.widget_for_size_group = w
+
+
+@@ -231,7 +239,7 @@
+ 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 = build_label_beside_widget(self.name, w)
+ self.widget_for_size_group = w
+
+ def _on_fontbutton_changed(self, btn, param):
Modified: packages/unstable/gnome-tweak-tool/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/gnome-tweak-tool/debian/patches/series?rev=32655&op=diff
==============================================================================
--- packages/unstable/gnome-tweak-tool/debian/patches/series [utf-8] (original)
+++ packages/unstable/gnome-tweak-tool/debian/patches/series [utf-8] Thu Feb 23 00:06:08 2012
@@ -1,1 +1,2 @@
01_menu_category.patch
+02_dont-crash-on-missing-schemas.patch
More information about the pkg-gnome-commits
mailing list