Skip to content

Commit e1ddb74

Browse files
authored
Merge pull request slgobinath#746 from deltragon/gtk4-template
refactor: switch from Gtk.Builder to Gtk.Template, add types
2 parents dd473be + b885db0 commit e1ddb74

18 files changed

+464
-394
lines changed

safeeyes/glade/about_dialog.glade

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ GNU General Public License for more details.
3535
You should have received a copy of the GNU General Public License
3636
along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</property>
3737
</object>
38-
<object class="GtkWindow" id="window_about">
38+
<template parent="GtkApplicationWindow" class="AboutDialog">
3939
<property name="title">Safe Eyes</property>
4040
<property name="resizable">0</property>
4141
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
42+
<signal name="close-request" handler="on_window_delete" swapped="no" />
4243
<child>
4344
<object class="GtkBox" id="layout_box">
4445
<property name="visible">1</property>
@@ -144,6 +145,7 @@ along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</pr
144145
</child>
145146
<child>
146147
<object class="GtkButton" id="btn_close">
148+
<signal name="clicked" handler="on_close_clicked" swapped="no" />
147149
<property name="label" translatable="yes">Close</property>
148150
<property name="visible">1</property>
149151
<property name="can-focus">1</property>
@@ -168,5 +170,5 @@ along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</pr
168170
</child>
169171
</object>
170172
</child>
171-
</object>
173+
</template>
172174
</interface>

safeeyes/glade/break_screen.glade

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
~ You should have received a copy of the GNU General Public License
1919
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
-->
21-
<interface>
21+
<interface domain="safeyees">
2222
<requires lib="gtk" version="4.0"/>
23-
<object class="GtkWindow" id="window_main">
23+
<template parent="GtkWindow" class="BreakScreenWindow">
2424
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
2525
<property name="decorated">0</property>
2626
<property name="deletable">0</property>
27+
<signal name="close-request" handler="on_window_delete" swapped="no"/>
2728
<child>
2829
<object class="GtkGrid" id="grid1">
2930
<property name="row_homogeneous">1</property>
@@ -174,5 +175,5 @@
174175
<style>
175176
<class name="window_main"/>
176177
</style>
177-
</object>
178+
</template>
178179
</interface>

safeeyes/glade/item_bool.glade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
24-
<object class="GtkBox" id="box">
24+
<template parent="GtkBox" class="BoolItem">
2525
<property name="visible">1</property>
2626
<property name="margin-start">5</property>
2727
<property name="margin-end">5</property>
@@ -46,5 +46,5 @@
4646
<property name="valign">center</property>
4747
</object>
4848
</child>
49-
</object>
49+
</template>
5050
</interface>

safeeyes/glade/item_break.glade

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
24-
<object class="GtkBox" id="box">
24+
<template parent="GtkBox" class="BreakItem">
2525
<property name="visible">1</property>
2626
<property name="margin-start">5</property>
2727
<property name="margin-end">5</property>
@@ -47,6 +47,7 @@
4747
<property name="halign">center</property>
4848
<property name="valign">center</property>
4949
<property name="icon-name">gtk-properties</property>
50+
<signal name="clicked" handler="on_properties_clicked" swapped="no"/>
5051
<style>
5152
<class name="btn_circle"/>
5253
</style>
@@ -59,10 +60,11 @@
5960
<property name="halign">center</property>
6061
<property name="valign">center</property>
6162
<property name="icon-name">edit-delete</property>
63+
<signal name="clicked" handler="on_delete_clicked" swapped="no"/>
6264
<style>
6365
<class name="btn_circle"/>
6466
</style>
6567
</object>
6668
</child>
67-
</object>
69+
</template>
6870
</interface>

safeeyes/glade/item_int.glade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
2424
<object class="GtkAdjustment" id="adjustment_value">
2525
<property name="upper">100</property>
2626
<property name="step-increment">1</property>
2727
<property name="page-increment">10</property>
2828
</object>
29-
<object class="GtkBox" id="box">
29+
<template parent="GtkBox" class="IntItem">
3030
<property name="visible">1</property>
3131
<property name="margin-start">5</property>
3232
<property name="margin-end">5</property>
@@ -52,5 +52,5 @@
5252
<property name="adjustment">adjustment_value</property>
5353
</object>
5454
</child>
55-
</object>
55+
</template>
5656
</interface>

safeeyes/glade/item_plugin.glade

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
24-
<object class="GtkBox" id="box">
24+
<template parent="GtkBox" class="PluginItem">
2525
<property name="visible">1</property>
2626
<property name="margin-start">5</property>
2727
<property name="margin-end">5</property>
@@ -108,6 +108,7 @@
108108
<property name="valign">center</property>
109109
<property name="icon-name">gtk-cancel</property>
110110
<property name="tooltip-text" translatable="yes">Disable permanently</property>
111+
<signal name="clicked" handler="on_disable_errored" swapped="no"/>
111112
<style>
112113
<class name="btn_circle"/>
113114
</style>
@@ -121,12 +122,13 @@
121122
<property name="halign">center</property>
122123
<property name="valign">center</property>
123124
<property name="icon-name">gtk-properties</property>
125+
<signal name="clicked" handler="on_properties_clicked" swapped="no"/>
124126
<style>
125127
<class name="btn_circle"/>
126128
</style>
127129
</object>
128130
</child>
129131
</object>
130132
</child>
131-
</object>
133+
</template>
132134
</interface>

safeeyes/glade/item_text.glade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
24-
<object class="GtkBox" id="box">
24+
<template parent="GtkBox" class="TextItem">
2525
<property name="visible">1</property>
2626
<property name="margin-start">5</property>
2727
<property name="margin-end">5</property>
@@ -46,5 +46,5 @@
4646
<property name="valign">center</property>
4747
</object>
4848
</child>
49-
</object>
49+
</template>
5050
</interface>

safeeyes/glade/new_break.glade

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
2424
<object class="GtkAdjustment" id="adjustment_duration">
2525
<property name="upper">100</property>
@@ -40,14 +40,15 @@
4040
</row>
4141
</data>
4242
</object>
43-
<object class="GtkWindow" id="dialog_new_break">
43+
<template parent="GtkWindow" class="NewBreakDialog">
4444
<property name="title" translatable="yes">New Break</property>
4545
<property name="resizable">0</property>
4646
<property name="modal">1</property>
4747
<property name="default-width">500</property>
4848
<property name="default-height">50</property>
4949
<property name="destroy-with-parent">1</property>
5050
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
51+
<signal name="close-request" handler="on_window_delete" swapped="no" />
5152
<child>
5253
<object class="GtkBox" id="box_settings">
5354
<property name="visible">1</property>
@@ -130,6 +131,7 @@
130131
<property name="visible">1</property>
131132
<property name="can-focus">1</property>
132133
<property name="receives-default">1</property>
134+
<signal name="clicked" handler="discard" swapped="no"/>
133135
</object>
134136
</child>
135137
<child>
@@ -138,11 +140,12 @@
138140
<property name="visible">1</property>
139141
<property name="can-focus">1</property>
140142
<property name="receives-default">1</property>
143+
<signal name="clicked" handler="save" swapped="no"/>
141144
</object>
142145
</child>
143146
</object>
144147
</child>
145148
</object>
146149
</child>
147-
</object>
150+
</template>
148151
</interface>

safeeyes/glade/required_plugin_dialog.glade

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
24-
<object class="GtkWindow" id="window_required_plugin">
24+
<template parent="GtkApplicationWindow" class="RequiredPluginDialog">
2525
<property name="title" translatable="1">Safe Eyes - Error</property>
2626
<property name="resizable">0</property>
2727
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
28+
<signal name="close-request" handler="on_window_delete" swapped="no"/>
2829
<child>
2930
<object class="GtkBox" id="layout_box">
3031
<property name="margin-start">5</property>
@@ -105,16 +106,18 @@
105106
<property name="label" translatable="1">Quit</property>
106107
<property name="receives-default">1</property>
107108
<property name="vexpand">1</property>
109+
<signal name="clicked" handler="on_close_clicked" swapped="no"/>
108110
</object>
109111
</child>
110112
<child>
111113
<object class="GtkButton" id="btn_disable_plugin">
112114
<property name="label" translatable="1">Disable plugin temporarily</property>
115+
<signal name="clicked" handler="on_disable_plugin_clicked" swapped="no"/>
113116
</object>
114117
</child>
115118
</object>
116119
</child>
117120
</object>
118121
</child>
119-
</object>
122+
</template>
120123
</interface>

safeeyes/glade/settings_break.glade

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
~ You should have received a copy of the GNU General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<interface>
22+
<interface domain="safeeyes">
2323
<requires lib="gtk" version="4.0"/>
2424
<object class="GtkAdjustment" id="adjustment_duration">
2525
<property name="lower">1</property>
@@ -47,14 +47,15 @@
4747
</row>
4848
</data>
4949
</object>
50-
<object class="GtkWindow" id="dialog_settings_break">
50+
<template parent="GtkWindow" class="BreakSettingsDialog">
5151
<property name="title" translatable="yes">Break Settings</property>
5252
<property name="resizable">0</property>
5353
<property name="modal">1</property>
5454
<property name="default-width">500</property>
5555
<property name="default-height">50</property>
5656
<property name="destroy-with-parent">1</property>
5757
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
58+
<signal name="close-request" handler="on_window_delete" swapped="no" />
5859
<child>
5960
<object class="GtkBox" id="box_settings">
6061
<property name="visible">1</property>
@@ -134,6 +135,7 @@
134135
<property name="can-focus">1</property>
135136
<property name="receives-default">1</property>
136137
<property name="icon-name">gtk-missing-image</property>
138+
<signal name="clicked" handler="select_image" swapped="no"/>
137139
</object>
138140
</child>
139141
</object>
@@ -179,6 +181,7 @@
179181
<property name="can-focus">1</property>
180182
<property name="halign">end</property>
181183
<property name="valign">center</property>
184+
<signal name="state-set" handler="on_switch_override_interval_activate" swapped="no"/>
182185
</object>
183186
</child>
184187
</object>
@@ -250,6 +253,7 @@
250253
<property name="can-focus">1</property>
251254
<property name="halign">end</property>
252255
<property name="valign">center</property>
256+
<signal name="state-set" handler="on_switch_override_duration_activate" swapped="no"/>
253257
</object>
254258
</child>
255259
</object>
@@ -322,6 +326,7 @@
322326
<property name="can-focus">1</property>
323327
<property name="halign">end</property>
324328
<property name="valign">center</property>
329+
<signal name="state-set" handler="on_switch_override_plugins_activate" swapped="no"/>
325330
</object>
326331
</child>
327332
</object>
@@ -347,5 +352,5 @@
347352
</child>
348353
</object>
349354
</child>
350-
</object>
355+
</template>
351356
</interface>

0 commit comments

Comments
 (0)