[gnome-tweak-tool] Window: Fix unpacking of the decoration layout gtk setting
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Window: Fix unpacking of the decoration layout gtk setting
- Date: Tue, 29 Sep 2015 14:56:30 +0000 (UTC)
commit 3f409991c8e2836065cd1ccc36732e606ab8eafa
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Sep 29 16:45:29 2015 +0200
Window: Fix unpacking of the decoration layout gtk setting
Python's string.split() method's maxsplit argument specifies the
number of splits so we only want one here and if the string doesn't
contain the separator, the resulting list has only one element which
means that tokens[1] results in an IndexError.
https://bugzilla.gnome.org/show_bug.cgi?id=755794
gtweak/tweakview.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index bdfdd2b..274047d 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -195,10 +195,12 @@ class Window(Gtk.ApplicationWindow):
def _update_decorations(self, settings, pspec):
layout_desc = settings.props.gtk_decoration_layout;
- tokens = layout_desc.split(":", 2)
- if tokens != None:
- self._right_header.props.decoration_layout = ":" + tokens[1]
- self._left_header.props.decoration_layout = tokens[0]
+ tokens = layout_desc.split(":", 1)
+ if len(tokens) > 1:
+ self._right_header.props.decoration_layout = ":" + tokens[1]
+ else:
+ self._right_header.props.decoration_layout = ""
+ self._left_header.props.decoration_layout = tokens[0]
def _after_key_press(self, widget, event):
if not self.button.get_active() or not self.entry.is_focus():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]