[meld/deprecation-cleanup: 40/48] patchdialog: Migrate to template construction and resource loading
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/deprecation-cleanup: 40/48] patchdialog: Migrate to template construction and resource loading
- Date: Sun, 2 Dec 2018 02:45:29 +0000 (UTC)
commit b9051a29e44b6105de5747e0767d600eb6f7144d
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Dec 2 09:41:39 2018 +1000
patchdialog: Migrate to template construction and resource loading
meld/patchdialog.py | 25 ++++++++++++++++++-------
{data => meld/resources}/ui/patch-dialog.ui | 4 ++--
2 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/meld/patchdialog.py b/meld/patchdialog.py
index 67dbb1c9..f14c018b 100644
--- a/meld/patchdialog.py
+++ b/meld/patchdialog.py
@@ -28,15 +28,26 @@ from meld.iohelpers import prompt_save_filename
from meld.misc import error_dialog
from meld.settings import meldsettings
from meld.sourceview import LanguageManager
-from meld.ui.gnomeglade import Component
+from meld.ui._gtktemplate import Template
-class PatchDialog(Component):
+@Template(resource_path='/org/gnome/meld/ui/patch-dialog.ui')
+class PatchDialog(Gtk.Dialog):
+
+ __gtype_name__ = "PatchDialog"
+
+ left_radiobutton = Template.Child("left_radiobutton")
+ reverse_checkbutton = Template.Child("reverse_checkbutton")
+ right_radiobutton = Template.Child("right_radiobutton")
+ side_selection_box = Template.Child("side_selection_box")
+ side_selection_label = Template.Child("side_selection_label")
+ textview = Template.Child("textview")
def __init__(self, filediff):
- super().__init__("patch-dialog.ui", "patchdialog")
+ super().__init__()
+ self.init_template()
- self.widget.set_transient_for(filediff.widget.get_toplevel())
+ self.set_transient_for(filediff.widget.get_toplevel())
self.filediff = filediff
buf = GtkSource.Buffer()
@@ -135,9 +146,9 @@ class PatchDialog(Component):
def run(self):
self.update_patch()
- result = self.widget.run()
+ result = super().run()
if result < 0:
- self.widget.hide()
+ self.hide()
return
# Copy patch to clipboard
@@ -153,4 +164,4 @@ class PatchDialog(Component):
if gfile:
self.save_patch(gfile)
- self.widget.hide()
+ self.hide()
diff --git a/data/ui/patch-dialog.ui b/meld/resources/ui/patch-dialog.ui
similarity index 99%
rename from data/ui/patch-dialog.ui
rename to meld/resources/ui/patch-dialog.ui
index 9696c29d..e8dd3e83 100644
--- a/data/ui/patch-dialog.ui
+++ b/meld/resources/ui/patch-dialog.ui
@@ -2,7 +2,7 @@
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.6"/>
- <object class="GtkDialog" id="patchdialog">
+ <template class="PatchDialog" parent="GtkDialog">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
@@ -197,5 +197,5 @@
<action-widget response="-6">button9</action-widget>
<action-widget response="0">button7</action-widget>
</action-widgets>
- </object>
+ </template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]