[meld] preferences: Move to non-vendored Template usage
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] preferences: Move to non-vendored Template usage
- Date: Sat, 31 Aug 2019 02:05:54 +0000 (UTC)
commit 6923a64679f38a784e6057ff5b9ab6edaef4a4c0
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Aug 31 08:50:58 2019 +1000
preferences: Move to non-vendored Template usage
This also cleans up Template.Child() instantiation to use the shorter
syntax for matching names.
meld/preferences.py | 109 ++++++++++++++++++++++++++--------------------------
1 file changed, 54 insertions(+), 55 deletions(-)
---
diff --git a/meld/preferences.py b/meld/preferences.py
index ee6e3411..fe99c1d9 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -23,21 +23,20 @@ from gi.repository import GtkSource
from meld.conf import _
from meld.filters import FilterEntry
from meld.settings import settings
-from meld.ui._gtktemplate import Template
from meld.ui.listwidget import EditableListWidget
-@Template(resource_path='/org/gnome/meld/ui/filter-list.ui')
+@Gtk.Template(resource_path='/org/gnome/meld/ui/filter-list.ui')
class FilterList(Gtk.Box, EditableListWidget):
__gtype_name__ = "FilterList"
- treeview = Template.Child("treeview")
- remove = Template.Child("remove")
- move_up = Template.Child("move_up")
- move_down = Template.Child("move_down")
- pattern_column = Template.Child("pattern_column")
- validity_renderer = Template.Child("validity_renderer")
+ treeview = Gtk.Template.Child()
+ remove = Gtk.Template.Child()
+ move_up = Gtk.Template.Child()
+ move_down = Gtk.Template.Child()
+ pattern_column = Gtk.Template.Child()
+ validity_renderer = Gtk.Template.Child()
default_entry = [_("label"), False, _("pattern"), True]
@@ -86,31 +85,31 @@ class FilterList(Gtk.Box, EditableListWidget):
icon_name = "gtk-dialog-warning" if not is_valid else None
cell.set_property("stock-id", icon_name)
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_add_clicked(self, button):
self.add_entry()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_remove_clicked(self, button):
self.remove_selected_entry()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_move_up_clicked(self, button):
self.move_up_selected_entry()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_move_down_clicked(self, button):
self.move_down_selected_entry()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_name_edited(self, ren, path, text):
self.model[path][0] = text
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_cellrenderertoggle_toggled(self, ren, path):
self.model[path][1] = not ren.get_active()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_pattern_edited(self, ren, path, text):
valid = FilterEntry.check_filter(text, self.filter_type)
self.model[path][2] = text
@@ -121,15 +120,15 @@ class FilterList(Gtk.Box, EditableListWidget):
settings.set_value(self.settings_key, GLib.Variant('a(sbs)', value))
-@Template(resource_path='/org/gnome/meld/ui/column-list.ui')
+@Gtk.Template(resource_path='/org/gnome/meld/ui/column-list.ui')
class ColumnList(Gtk.VBox, EditableListWidget):
__gtype_name__ = "ColumnList"
- treeview = Template.Child("treeview")
- remove = Template.Child("remove")
- move_up = Template.Child("move_up")
- move_down = Template.Child("move_down")
+ treeview = Gtk.Template.Child()
+ remove = Gtk.Template.Child()
+ move_up = Gtk.Template.Child()
+ move_down = Gtk.Template.Child()
default_entry = [_("label"), False, _("pattern"), True]
@@ -177,15 +176,15 @@ class ColumnList(Gtk.VBox, EditableListWidget):
self.setup_sensitivity_handling()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_move_up_clicked(self, button):
self.move_up_selected_entry()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_move_down_clicked(self, button):
self.move_down_selected_entry()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_cellrenderertoggle_toggled(self, ren, path):
self.model[path][0] = not ren.get_active()
@@ -252,40 +251,40 @@ class GSettingsStringComboBox(GSettingsComboBox):
gsettings_value = GObject.Property(type=str, default="")
-@Template(resource_path='/org/gnome/meld/ui/preferences.ui')
+@Gtk.Template(resource_path='/org/gnome/meld/ui/preferences.ui')
class PreferencesDialog(Gtk.Dialog):
__gtype_name__ = "PreferencesDialog"
- checkbutton_break_commit_lines = Template.Child()
- checkbutton_default_font = Template.Child()
- checkbutton_folder_filter_text = Template.Child()
- checkbutton_highlight_current_line = Template.Child()
- checkbutton_ignore_blank_lines = Template.Child()
- checkbutton_ignore_symlinks = Template.Child()
- checkbutton_shallow_compare = Template.Child()
- checkbutton_show_commit_margin = Template.Child()
- checkbutton_show_line_numbers = Template.Child()
- checkbutton_show_overview_map = Template.Child()
- checkbutton_show_whitespace = Template.Child()
- checkbutton_spaces_instead_of_tabs = Template.Child()
- checkbutton_use_syntax_highlighting = Template.Child()
- checkbutton_wrap_text = Template.Child()
- checkbutton_wrap_word = Template.Child()
- column_list_vbox = Template.Child()
- combo_file_order = Template.Child()
- combo_merge_order = Template.Child()
- combo_overview_map = Template.Child()
- combo_timestamp = Template.Child()
- combobox_style_scheme = Template.Child()
- custom_edit_command_entry = Template.Child()
- file_filters_vbox = Template.Child()
- fontpicker = Template.Child()
- spinbutton_commit_margin = Template.Child()
- spinbutton_tabsize = Template.Child()
- syntaxschemestore = Template.Child()
- system_editor_checkbutton = Template.Child()
- text_filters_vbox = Template.Child()
+ checkbutton_break_commit_lines = Gtk.Template.Child()
+ checkbutton_default_font = Gtk.Template.Child()
+ checkbutton_folder_filter_text = Gtk.Template.Child()
+ checkbutton_highlight_current_line = Gtk.Template.Child()
+ checkbutton_ignore_blank_lines = Gtk.Template.Child()
+ checkbutton_ignore_symlinks = Gtk.Template.Child()
+ checkbutton_shallow_compare = Gtk.Template.Child()
+ checkbutton_show_commit_margin = Gtk.Template.Child()
+ checkbutton_show_line_numbers = Gtk.Template.Child()
+ checkbutton_show_overview_map = Gtk.Template.Child()
+ checkbutton_show_whitespace = Gtk.Template.Child()
+ checkbutton_spaces_instead_of_tabs = Gtk.Template.Child()
+ checkbutton_use_syntax_highlighting = Gtk.Template.Child()
+ checkbutton_wrap_text = Gtk.Template.Child()
+ checkbutton_wrap_word = Gtk.Template.Child()
+ column_list_vbox = Gtk.Template.Child()
+ combo_file_order = Gtk.Template.Child()
+ combo_merge_order = Gtk.Template.Child()
+ combo_overview_map = Gtk.Template.Child()
+ combo_timestamp = Gtk.Template.Child()
+ combobox_style_scheme = Gtk.Template.Child()
+ custom_edit_command_entry = Gtk.Template.Child()
+ file_filters_vbox = Gtk.Template.Child()
+ fontpicker = Gtk.Template.Child()
+ spinbutton_commit_margin = Gtk.Template.Child()
+ spinbutton_tabsize = Gtk.Template.Child()
+ syntaxschemestore = Gtk.Template.Child()
+ system_editor_checkbutton = Gtk.Template.Child()
+ text_filters_vbox = Gtk.Template.Child()
def __init__(self, **kwargs):
super().__init__(**kwargs)
@@ -364,7 +363,7 @@ class PreferencesDialog(Gtk.Dialog):
self.show()
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_checkbutton_wrap_text_toggled(self, button):
if not self.checkbutton_wrap_text.get_active():
wrap_mode = Gtk.WrapMode.NONE
@@ -374,6 +373,6 @@ class PreferencesDialog(Gtk.Dialog):
wrap_mode = Gtk.WrapMode.CHAR
settings.set_enum('wrap-mode', wrap_mode)
- @Template.Callback()
+ @Gtk.Template.Callback()
def on_response(self, dialog, response_id):
self.destroy()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]