2424from meld .filters import FilterEntry
2525from meld .settings import settings
2626from meld .ui ._gtktemplate import Template
27- from meld .ui .gnomeglade import Component
2827from meld .ui .listwidget import EditableListWidget
2928
3029
@@ -255,17 +254,42 @@ class GSettingsStringComboBox(GSettingsComboBox):
255254 gsettings_value = GObject .Property (type = str , default = "" )
256255
257256
258- class PreferencesDialog (Component ):
257+ @Template (resource_path = '/org/gnome/meld/ui/preferences.ui' )
258+ class PreferencesDialog (Gtk .Dialog ):
259+
260+ __gtype_name__ = "PreferencesDialog"
261+
262+ checkbutton_break_commit_lines = Template .Child ("checkbutton_break_commit_lines" ) # noqa: E501
263+ checkbutton_default_font = Template .Child ("checkbutton_default_font" )
264+ checkbutton_folder_filter_text = Template .Child ("checkbutton_folder_filter_text" ) # noqa: E501
265+ checkbutton_highlight_current_line = Template .Child ("checkbutton_highlight_current_line" ) # noqa: E501
266+ checkbutton_ignore_blank_lines = Template .Child ("checkbutton_ignore_blank_lines" ) # noqa: E501
267+ checkbutton_ignore_symlinks = Template .Child ("checkbutton_ignore_symlinks" )
268+ checkbutton_shallow_compare = Template .Child ("checkbutton_shallow_compare" )
269+ checkbutton_show_commit_margin = Template .Child ("checkbutton_show_commit_margin" ) # noqa: E501
270+ checkbutton_show_line_numbers = Template .Child ("checkbutton_show_line_numbers" ) # noqa: E501
271+ checkbutton_show_whitespace = Template .Child ("checkbutton_show_whitespace" )
272+ checkbutton_spaces_instead_of_tabs = Template .Child ("checkbutton_spaces_instead_of_tabs" ) # noqa: E501
273+ checkbutton_use_syntax_highlighting = Template .Child ("checkbutton_use_syntax_highlighting" ) # noqa: E501
274+ checkbutton_wrap_text = Template .Child ("checkbutton_wrap_text" )
275+ checkbutton_wrap_word = Template .Child ("checkbutton_wrap_word" )
276+ column_list_vbox = Template .Child ("column_list_vbox" )
277+ combo_file_order = Template .Child ("combo_file_order" )
278+ combo_merge_order = Template .Child ("combo_merge_order" )
279+ combo_timestamp = Template .Child ("combo_timestamp" )
280+ combobox_style_scheme = Template .Child ("combobox_style_scheme" )
281+ custom_edit_command_entry = Template .Child ("custom_edit_command_entry" )
282+ file_filters_vbox = Template .Child ("file_filters_vbox" )
283+ fontpicker = Template .Child ("fontpicker" )
284+ spinbutton_commit_margin = Template .Child ("spinbutton_commit_margin" )
285+ spinbutton_tabsize = Template .Child ("spinbutton_tabsize" )
286+ syntaxschemestore = Template .Child ("syntaxschemestore" )
287+ system_editor_checkbutton = Template .Child ("system_editor_checkbutton" )
288+ text_filters_vbox = Template .Child ("text_filters_vbox" )
259289
260- def __init__ (self , parent ):
261- super ().__init__ (
262- "preferences.ui" , "preferencesdialog" , [
263- "adjustment1" , "adjustment2" , "fileorderstore" ,
264- "sizegroup_editor" , "timestampstore" , "mergeorderstore" ,
265- "sizegroup_file_order_labels" , "sizegroup_file_order_combos" ,
266- "syntaxschemestore"
267- ])
268- self .widget .set_transient_for (parent )
290+ def __init__ (self , ** kwargs ):
291+ super ().__init__ (** kwargs )
292+ self .init_template ()
269293
270294 bindings = [
271295 ('use-system-font' , self .checkbutton_default_font , 'active' ),
@@ -340,8 +364,9 @@ def __init__(self, parent):
340364 self .syntaxschemestore .append ([scheme_id , scheme .get_name ()])
341365 self .combobox_style_scheme .bind_to ('style-scheme' )
342366
343- self .widget . show ()
367+ self .show ()
344368
369+ @Template .Callback ()
345370 def on_checkbutton_wrap_text_toggled (self , button ):
346371 if not self .checkbutton_wrap_text .get_active ():
347372 wrap_mode = Gtk .WrapMode .NONE
@@ -351,9 +376,11 @@ def on_checkbutton_wrap_text_toggled(self, button):
351376 wrap_mode = Gtk .WrapMode .CHAR
352377 settings .set_enum ('wrap-mode' , wrap_mode )
353378
379+ @Template .Callback ()
354380 def on_checkbutton_show_whitespace_toggled (self , widget ):
355381 value = GtkSource .DrawSpacesFlags .ALL if widget .get_active () else 0
356382 settings .set_flags ('draw-spaces' , value )
357383
384+ @Template .Callback ()
358385 def on_response (self , dialog , response_id ):
359- self .widget . destroy ()
386+ self .destroy ()
0 commit comments