[gnome-tweak-tool/gnome-3-16] Window: Fix unpacking of the decoration layout gtk setting



commit 6480b9ef846c2ade8ed922e55d55f0b9ad12f40c
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]