Commit be339041 authored by Colomban Wendling's avatar Colomban Wendling
Browse files

Avoid creating undo entries when setting the same value

Simply don't set the value if it's the same, so it avoids creating an
undo entry and also avoids refreshing the theme.
parent 221dd11c
......@@ -57,6 +57,10 @@ class RGBA(Gdk.RGBA): * 0xff, * 0xff)
# for some reason the __ne__ operator of Gdk.RGBA is broken
def __ne__(self, other):
return not (self == other)
class CellRendererColor(Gtk.CellRenderer):
__gproperties__ = {
......@@ -247,8 +251,11 @@ class AppWindow(Gtk.ApplicationWindow):
column.pack_start(renderer, True)
column.add_attribute(renderer, 'color', self.ROW_COLOR)
def on_key_cell_edited(cell, path, text, data=None):, self.ROW_KEY, text)
def on_key_cell_edited(cell, path, new_text, data=None):
iter =
old_text =, self.ROW_KEY)[0]
if old_text != new_text:, self.ROW_KEY, new_text)
cell = builder.get_object('cellrenderertext1')
cell.connect('edited', on_key_cell_edited)
......@@ -270,10 +277,11 @@ class AppWindow(Gtk.ApplicationWindow):
def on_row_activated(self, view, path, column, data=None):
iter =
old_rgba = RGBA(, self.ROW_COLOR)[0])
dialog = Gtk.ColorChooserDialog()
dialog.set_rgba(RGBA(, self.ROW_COLOR)[0]))
answer =
if answer == Gtk.ResponseType.ACCEPT or \
answer == Gtk.ResponseType.APPLY or \
......@@ -285,7 +293,8 @@ class AppWindow(Gtk.ApplicationWindow):
# Apparently old GI was broken...
rgba = RGBA()
dialog.get_rgba(rgba), self.ROW_COLOR, rgba.to_string())
if old_rgba != rgba:, self.ROW_COLOR, rgba.to_string())
def on_add_activate(self, action, data=None):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment