Compare commits

...

13 Commits

Author SHA1 Message Date
deltragon b72fddd7d0
Merge c4c172ab5e into 00c33908a3 2024-02-25 20:59:20 +00:00
aerowolf 00c33908a3
Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (116 of 116 strings)

Translation: Safe Eyes/Translations
Translate-URL: https://hosted.weblate.org/projects/safe-eyes/translations/zh_Hans/
2024-02-21 11:01:57 +01:00
deltragon c4c172ab5e
lock keyboard on wayland 2024-01-24 18:56:16 +01:00
deltragon 394028c14c
dont call x11 methods on wayland 2024-01-24 18:55:44 +01:00
deltragon 0cc4b127d1
gtk4: plugin settings 2024-01-02 13:36:47 +01:00
deltragon fdbc6a39c5
gtk4: new break 2024-01-02 13:36:46 +01:00
deltragon ca98ec90f3
gtk4: break settings 2024-01-02 13:36:45 +01:00
deltragon d234876123
gtk4: settings dialog 2024-01-02 13:36:45 +01:00
deltragon 09c4326120
gtk4: about dialog 2024-01-02 13:36:44 +01:00
deltragon b2b5344224
gtk4: get break screen ui running 2024-01-02 13:36:43 +01:00
deltragon eb027f7c06
gtk4: simple changes 2024-01-02 13:36:41 +01:00
deltragon 1ebcfa2bb8
port to Gtk.Application
Gtk.main() and Gtk.main_quit() are dropped in gtk4 in favor of
subclassing Gtk.Application.

This commit also moves argument handling from a separate thread to
GtkApplication.do_startup().
2024-01-02 13:19:53 +01:00
deltragon f45b83cfe6
fix deprecations 2024-01-02 13:19:40 +01:00
24 changed files with 874 additions and 1795 deletions

View File

@ -25,9 +25,7 @@ import locale
import logging import logging
import signal import signal
import sys import sys
from threading import Timer
import gi
import psutil import psutil
from safeeyes import utility from safeeyes import utility
from safeeyes.model import Config from safeeyes.model import Config
@ -35,9 +33,6 @@ from safeeyes.safeeyes import SafeEyes
from safeeyes.safeeyes import SAFE_EYES_VERSION from safeeyes.safeeyes import SAFE_EYES_VERSION
from safeeyes.rpc import RPCClient from safeeyes.rpc import RPCClient
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
gettext.install('safeeyes', utility.LOCALE_PATH) gettext.install('safeeyes', utility.LOCALE_PATH)
@ -68,22 +63,6 @@ def __running():
return False return False
def __evaluate_arguments(args, safe_eyes):
"""
Evaluate the arguments and execute the operations.
"""
if args.about:
utility.execute_main_thread(safe_eyes.show_about)
elif args.disable:
utility.execute_main_thread(safe_eyes.disable_safeeyes)
elif args.enable:
utility.execute_main_thread(safe_eyes.enable_safeeyes)
elif args.settings:
utility.execute_main_thread(safe_eyes.show_settings)
elif args.take_break:
utility.execute_main_thread(safe_eyes.take_break)
def main(): def main():
""" """
Start the Safe Eyes. Start the Safe Eyes.
@ -147,10 +126,8 @@ def main():
sys.exit(0) sys.exit(0)
elif not args.quit: elif not args.quit:
logging.info("Starting Safe Eyes") logging.info("Starting Safe Eyes")
safe_eyes = SafeEyes(system_locale, config) safe_eyes = SafeEyes(system_locale, config, args)
safe_eyes.start() safe_eyes.start()
Timer(1.0, lambda: __evaluate_arguments(args, safe_eyes)).start()
Gtk.main()
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: \n" "POT-Creation-Date: \n"
"PO-Revision-Date: 2021-10-10 05:05+0000\n" "PO-Revision-Date: 2024-02-21 10:01+0000\n"
"Last-Translator: Frank.wu <me@wuzhiping.top>\n" "Last-Translator: aerowolf <aerowolf@tom.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/" "Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"safe-eyes/translations/zh_Hans/>\n" "safe-eyes/translations/zh_Hans/>\n"
"Language: zh_CN\n" "Language: zh_CN\n"
@ -15,23 +15,23 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.9-dev\n" "X-Generator: Weblate 5.5-dev\n"
# Short break # Short break
msgid "Tightly close your eyes" msgid "Tightly close your eyes"
msgstr "闭上您的眼睛休息一会" msgstr "闭上眼睛休息一下"
# Short break # Short break
msgid "Roll your eyes a few times to each side" msgid "Roll your eyes a few times to each side"
msgstr "向两边各翻几下眼睛" msgstr "左右转动眼球"
# Short break # Short break
msgid "Rotate your eyes in clockwise direction" msgid "Rotate your eyes in clockwise direction"
msgstr "按顺时针方向旋转你的眼球" msgstr "顺时针方向转动眼球"
# Short break # Short break
msgid "Rotate your eyes in counterclockwise direction" msgid "Rotate your eyes in counterclockwise direction"
msgstr "按逆时针方向旋转你的眼球" msgstr "逆时针方向转动眼球"
# Short break # Short break
msgid "Blink your eyes" msgid "Blink your eyes"
@ -39,11 +39,11 @@ msgstr "眨眨眼"
# Short break # Short break
msgid "Focus on a point in the far distance" msgid "Focus on a point in the far distance"
msgstr "望远:将视线聚焦到远处物体上" msgstr "远眺:看看尽可能远的远处"
# Short break # Short break
msgid "Have some water" msgid "Have some water"
msgstr "喝点水" msgstr "喝点水"
# Long break # Long break
msgid "Walk for a while" msgid "Walk for a while"
@ -51,7 +51,7 @@ msgstr "站起来走走"
# Long break # Long break
msgid "Lean back at your seat and relax" msgid "Lean back at your seat and relax"
msgstr "靠在椅背上休息一" msgstr "靠在椅背上休息一"
# Commandline arg description # Commandline arg description
msgid "show the about dialog" msgid "show the about dialog"
@ -59,15 +59,15 @@ msgstr "显示“关于”对话框"
# Commandline arg description # Commandline arg description
msgid "disable the currently running safeeyes instance" msgid "disable the currently running safeeyes instance"
msgstr "禁用当前正在运行的Safe Eyes" msgstr "暂停当前正在运行的Safe Eyes"
# Commandline arg description # Commandline arg description
msgid "enable the currently running safeeyes instance" msgid "enable the currently running safeeyes instance"
msgstr "启用当前正在运行的Safe Eyes" msgstr "恢复当前正在运行的Safe Eyes"
# Commandline arg description # Commandline arg description
msgid "quit the running safeeyes instance and exit" msgid "quit the running safeeyes instance and exit"
msgstr "退出正在运行的Safe Eeyes" msgstr "退出Safe Eeyes"
# Commandline arg description # Commandline arg description
msgid "show the settings dialog" msgid "show the settings dialog"
@ -79,17 +79,17 @@ msgstr "以调试模式运行Safe Eyes"
# Commandline arg description # Commandline arg description
msgid "print the status of running safeeyes instance and exit" msgid "print the status of running safeeyes instance and exit"
msgstr "打印Safe Eyes运行状态后退出" msgstr "显示Safe Eyes运行状态后退出"
# Status message # Status message
msgid "Safe Eyes is not running" msgid "Safe Eyes is not running"
msgstr "Safe Eyes 尚未运行" msgstr "Safe Eyes 没有运行"
# RPC not enabled message # RPC not enabled message
msgid "" msgid ""
"Safe Eyes is running without an RPC server. Turn it on to use command-line " "Safe Eyes is running without an RPC server. Turn it on to use command-line "
"arguments." "arguments."
msgstr "Safe Eyes 正在没有RPC服务器的情况下运行。打开以使用命令行参数。" msgstr "Safe Eyes 正在没有RPC服务器的情况下运行。打开RPC服务器可以使用命令行参数。"
# About dialog # About dialog
msgid "Close" msgid "Close"
@ -106,7 +106,7 @@ msgstr ""
# About dialog # About dialog
msgid "License" msgid "License"
msgstr "许可" msgstr "许可"
# Break screen # Break screen
msgid "Skip" msgid "Skip"
@ -142,7 +142,7 @@ msgstr "以随机顺序显示休息"
# Settings dialog # Settings dialog
msgid "Strict break (No way to skip breaks)" msgid "Strict break (No way to skip breaks)"
msgstr "坚持休息(无法跳过)" msgstr "坚持休息(不允许跳过)"
# Settings dialog # Settings dialog
msgid "Allow postponing breaks" msgid "Allow postponing breaks"
@ -150,7 +150,7 @@ msgstr "允许推迟休息"
# Settings dialog # Settings dialog
msgid "Persist the internal state" msgid "Persist the internal state"
msgstr "持内部状态" msgstr "持内部状态"
# Settings dialog # Settings dialog
msgid "Use RPC server to receive runtime commands" msgid "Use RPC server to receive runtime commands"
@ -414,11 +414,11 @@ msgstr "在通知区域显示托盘图标"
#: plugins/trayicon #: plugins/trayicon
msgid "Show next break time in tray icon" msgid "Show next break time in tray icon"
msgstr "在托盘图标显示下次休息时间" msgstr "在托盘图标显示下次休息时间"
#: plugins/trayicon #: plugins/trayicon
msgid "Allow disabling Safe Eyes" msgid "Allow disabling Safe Eyes"
msgstr "允许禁用Safe Eyes" msgstr "允许暂停Safe Eyes"
#: plugins/trayicon #: plugins/trayicon
msgid "About" msgid "About"
@ -426,19 +426,19 @@ msgstr "关于"
#: plugins/trayicon #: plugins/trayicon
msgid "Disable Safe Eyes" msgid "Disable Safe Eyes"
msgstr "禁用 Safe Eyes" msgstr "暂停 Safe Eyes"
#: plugins/trayicon #: plugins/trayicon
msgid "Disabled until %s" msgid "Disabled until %s"
msgstr "禁用软件直到 %s" msgstr "暂停,直到 %s"
#: plugins/trayicon #: plugins/trayicon
msgid "Disabled until restart" msgid "Disabled until restart"
msgstr "禁用软件直到重启" msgstr "暂停,直到重启"
#: plugins/trayicon #: plugins/trayicon
msgid "Enable Safe Eyes" msgid "Enable Safe Eyes"
msgstr "启用 Safe Eyes" msgstr "恢复 Safe Eyes"
#: plugins/trayicon #: plugins/trayicon
msgid "For %d Hour" msgid "For %d Hour"
@ -457,7 +457,7 @@ msgstr[0] "%d 秒"
#: plugins/trayicon #: plugins/trayicon
msgid "Next break at %s" msgid "Next break at %s"
msgstr "下次休息在 %s" msgstr "下次休息在 %s"
#: plugins/trayicon #: plugins/trayicon
msgid "No Breaks Available" msgid "No Breaks Available"

View File

@ -20,7 +20,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkTextBuffer" id="text_buffer_license"> <object class="GtkTextBuffer" id="text_buffer_license">
<property name="text" translatable="yes">This program is free software: you can redistribute it and/or modify <property name="text" translatable="yes">This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -36,167 +36,113 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</property> along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</property>
</object> </object>
<object class="GtkWindow" id="window_about"> <object class="GtkWindow" id="window_about">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Safe Eyes</property> <property name="title" translatable="yes">Safe Eyes</property>
<property name="resizable">False</property> <property name="resizable">0</property>
<property name="window_position">center-always</property> <property name="icon-name">safeeyes</property>
<property name="icon_name">safeeyes</property>
<property name="type_hint">dialog</property>
<property name="gravity">center</property>
<signal name="delete-event" handler="on_window_delete" swapped="no"/>
<child> <child>
<object class="GtkBox" id="layout_box"> <object class="GtkBox" id="layout_box">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property> <property name="margin-end">5</property>
<property name="margin_right">5</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property> <property name="hexpand">1</property>
<property name="hexpand">True</property> <property name="vexpand">1</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="baseline_position">top</property> <property name="baseline-position">top</property>
<child> <child>
<object class="GtkBox" id="box1"> <object class="GtkBox" id="box1">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="hexpand">True</property> <property name="hexpand">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel" id="lbl_app_name"> <object class="GtkLabel" id="lbl_app_name">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="margin_top">10</property> <property name="margin-top">10</property>
<property name="margin_bottom">10</property> <property name="margin-bottom">10</property>
<property name="label" translatable="yes">Safe Eyes 2.1.5</property> <property name="label" translatable="yes">Safe Eyes 2.1.5</property>
<property name="justify">center</property> <property name="justify">center</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<attributes> <attributes>
<attribute name="style" value="normal"/> <attribute name="style" value="normal"/>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_decription"> <object class="GtkLabel" id="lbl_decription">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-top">4</property>
<property name="margin_top">4</property> <property name="label" translatable="yes">Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you&apos;re working long hours at the computer</property>
<property name="label" translatable="yes">Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer</property>
<property name="justify">fill</property> <property name="justify">fill</property>
<property name="wrap">True</property> <property name="wrap">1</property>
<property name="width_chars">60</property> <property name="width-chars">60</property>
<property name="max_width_chars">60</property> <property name="max-width-chars">60</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_license"> <object class="GtkLabel" id="lbl_license">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="margin_top">10</property> <property name="margin-top">10</property>
<property name="label" translatable="yes">License:</property> <property name="label" translatable="yes">License:</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkTextView" id="txt_license"> <object class="GtkTextView" id="txt_license">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="hexpand">True</property> <property name="hexpand">1</property>
<property name="vexpand">True</property> <property name="vexpand">1</property>
<property name="editable">False</property> <property name="editable">0</property>
<property name="wrap_mode">word</property> <property name="wrap-mode">word</property>
<property name="buffer">text_buffer_license</property> <property name="buffer">text_buffer_license</property>
<property name="accepts_tab">False</property> <property name="accepts-tab">0</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLinkButton" id="btn_url"> <object class="GtkLinkButton" id="btn_url">
<property name="label" translatable="yes">https://slgobinath.github.io/SafeEyes</property> <property name="label" translatable="yes">https://slgobinath.github.io/SafeEyes</property>
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="focus_on_click">False</property> <property name="focus-on-click">0</property>
<property name="receives_default">True</property> <property name="receives-default">1</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="relief">none</property> <property name="has-frame">0</property>
<property name="uri">https://slgobinath.github.io/SafeEyes</property> <property name="uri">https://slgobinath.github.io/SafeEyes</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSeparator" id="separator"> <object class="GtkSeparator" id="separator">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButtonBox" id="buttonbox"> <object class="GtkBox" id="buttonbox">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="margin_right">5</property> <property name="margin-end">5</property>
<property name="layout_style">end</property> <property name="halign">end</property>
<child> <child>
<object class="GtkButton" id="btn_close"> <object class="GtkButton" id="btn_close">
<property name="label" translatable="yes">Close</property> <property name="label" translatable="yes">Close</property>
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="receives_default">True</property> <property name="receives-default">1</property>
<signal name="clicked" handler="on_close_clicked" swapped="no"/> <property name="hexpand">1</property>
<property name="vexpand">1</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- <!--
~ Safe Eyes is a utility to remind you to take break frequently ~ Safe Eyes is a utility to remind you to take break frequently
~ to protect your eyes from eye strain. ~ to protect your eyes from eye strain.
@ -20,115 +19,84 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkWindow" id="window_main"> <object class="GtkWindow" id="window_main">
<property name="can_focus">False</property>
<property name="window_position">center</property>
<property name="hide_titlebar_when_maximized">True</property>
<property name="icon_name">safeeyes</property> <property name="icon_name">safeeyes</property>
<property name="skip_taskbar_hint">True</property> <property name="decorated">0</property>
<property name="urgency_hint">True</property> <property name="deletable">0</property>
<property name="focus_on_map">False</property>
<property name="decorated">False</property>
<property name="deletable">False</property>
<property name="gravity">center</property>
<signal name="delete-event" handler="on_window_delete" swapped="no"/>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child> <property name="child">
<object class="GtkGrid" id="grid1"> <object class="GtkGrid" id="grid1">
<property name="visible">True</property> <property name="row_homogeneous">1</property>
<property name="can_focus">False</property> <property name="column_homogeneous">1</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child> <child>
<object class="GtkBox" id="box_center_parent"> <object class="GtkBox" id="box_center_parent">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<child> <child>
<object class="GtkGrid" id="grid_central"> <object class="GtkGrid" id="grid_central">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="row_spacing">10</property> <property name="row_spacing">10</property>
<child> <child>
<object class="GtkImage" id="img_break"> <object class="GtkImage" id="img_break">
<property name="visible">True</property> <layout>
<property name="can_focus">False</property> <property name="column">0</property>
<property name="row">0</property>
</layout>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkGrid" id="grid_parent"> <object class="GtkGrid" id="grid_parent">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="hexpand">True</property> <property name="hexpand">1</property>
<property name="row_spacing">15</property> <property name="row_spacing">15</property>
<child> <child>
<object class="GtkLabel" id="lbl_message"> <object class="GtkLabel" id="lbl_message">
<property name="visible">True</property> <property name="label" translatable="1">Hello World</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Hello World</property>
<property name="justify">center</property> <property name="justify">center</property>
<style> <style>
<class name="lbl_message"/> <class name="lbl_message"/>
</style> </style>
<layout>
<property name="column">0</property>
<property name="row">0</property>
<property name="column-span">3</property>
</layout>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">3</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkAlignment" id="alignment_button"> <object class="GtkLabel" id="lbl_count">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="yscale">0.20000000298023224</property> <property name="label" translatable="1">00</property>
<child> <style>
<object class="GtkLabel" id="lbl_count"> <class name="lbl_count"/>
<property name="visible">True</property> </style>
<property name="can_focus">False</property> <layout>
<property name="label" translatable="yes">00</property> <property name="column">1</property>
<style> <property name="row">2</property>
<class name="lbl_count"/> </layout>
</style>
</object>
</child>
</object> </object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box_buttons"> <object class="GtkBox" id="box_buttons">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="spacing">50</property> <property name="spacing">50</property>
<property name="homogeneous">True</property> <property name="homogeneous">1</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<layout>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object> </object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child> </child>
<child> <child>
<placeholder/> <placeholder/>
@ -151,89 +119,62 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<layout>
<property name="column">0</property>
<property name="row">1</property>
<property name="row-span">3</property>
</layout>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="height">3</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_widget"> <object class="GtkLabel" id="lbl_widget">
<property name="visible">True</property> <property name="vexpand">1</property>
<property name="can_focus">False</property> <property name="label" translatable="1">Widget</property>
<property name="label" translatable="yes">Widget</property>
<property name="yalign">0.25</property> <property name="yalign">0.25</property>
<style> <style>
<class name="lbl_widget"/> <class name="lbl_widget"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
<layout>
<property name="column">0</property>
<property name="row">1</property>
<property name="row-span">2</property>
</layout>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="height">2</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box_top_panel"> <object class="GtkBox" id="box_top_panel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkToolbar" id="toolbar"> <object class="GtkBox" id="toolbar">
<property name="visible">True</property> <property name="css-classes">toolbar</property>
<property name="can_focus">False</property> <property name="can_focus">0</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">2</property>
<style> <style>
<class name="toolbar"/> <class name="toolbar"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_top"> <object class="GtkLabel" id="lbl_top">
<property name="visible">True</property> <property name="vexpand">1</property>
<property name="can_focus">False</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
<style> <style>
<class name="box_top_panel"/> <class name="box_top_panel"/>
</style> </style>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child> </child>
</object> </object>
</child> </property>
<style> <style>
<class name="window_main"/> <class name="window_main"/>
</style> </style>

View File

@ -20,42 +20,31 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property> <property name="margin-end">5</property>
<property name="margin_right">5</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_name"> <object class="GtkLabel" id="lbl_name">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property> <property name="label" translatable="yes">label</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="switch_value"> <object class="GtkSwitch" id="switch_value">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</interface> </interface>

View File

@ -20,76 +20,49 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkImage" id="img_properties">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-properties</property>
</object>
<object class="GtkImage" id="img_delete">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-delete</property>
</object>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property> <property name="margin-end">5</property>
<property name="margin_right">5</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<property name="vexpand">0</property>
<child> <child>
<object class="GtkLabel" id="lbl_name"> <object class="GtkLabel" id="lbl_name">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">label</property> <property name="label" translatable="yes">label</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btn_properties"> <object class="GtkButton" id="btn_properties">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="receives_default">True</property> <property name="receives-default">1</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="image">img_properties</property> <property name="icon-name">gtk-properties</property>
<property name="always_show_image">True</property>
<style> <style>
<class name="btn_circle"/> <class name="btn_circle"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btn_delete"> <object class="GtkButton" id="btn_delete">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="receives_default">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="image">img_delete</property> <property name="icon-name">edit-delete</property>
<property name="always_show_image">True</property>
<style> <style>
<class name="btn_circle"/> <class name="btn_circle"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</interface> </interface>

View File

@ -20,47 +20,37 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkAdjustment" id="adjustment_value"> <object class="GtkAdjustment" id="adjustment_value">
<property name="upper">100</property> <property name="upper">100</property>
<property name="step_increment">1</property> <property name="step-increment">1</property>
<property name="page_increment">10</property> <property name="page-increment">10</property>
</object> </object>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property> <property name="margin-end">5</property>
<property name="margin_right">5</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_name"> <object class="GtkLabel" id="lbl_name">
<property name="visible">True</property> <property name="halign">start</property>
<property name="can_focus">False</property> <property name="visible">1</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">label</property> <property name="label" translatable="yes">label</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="spin_value"> <object class="GtkSpinButton" id="spin_value">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="adjustment">adjustment_value</property> <property name="adjustment">adjustment_value</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</interface> </interface>

View File

@ -20,127 +20,88 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkImage" id="img_properties">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-properties</property>
</object>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property> <property name="margin-end">5</property>
<property name="margin_right">5</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property> <property name="vexpand">0</property>
<child> <child>
<object class="GtkImage" id="img_plugin_icon"> <object class="GtkImage" id="img_plugin_icon">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="stock">gtk-about</property> <property name="icon-name">gtk-about</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box2"> <object class="GtkBox" id="box2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_plugin_name"> <object class="GtkLabel" id="lbl_plugin_name">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">end</property> <property name="valign">end</property>
<property name="label" translatable="yes">Plugin Name</property> <property name="label" translatable="yes">Plugin Name</property>
<property name="xalign">0.05000000074505806</property> <property name="xalign">0.05000000074505806</property>
<property name="yalign">1</property> <property name="yalign">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<style> <style>
<class name="lbl_plugin_name"/> <class name="lbl_plugin_name"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="lbl_plugin_description"> <object class="GtkLabel" id="lbl_plugin_description">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="label" translatable="yes">Plugin Description</property> <property name="label" translatable="yes">Plugin Description</property>
<property name="xalign">0.05000000074505806</property> <property name="xalign">0.05000000074505806</property>
<property name="yalign">0</property> <property name="yalign">0</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<style> <style>
<class name="lbl_plugin_description"/> <class name="lbl_plugin_description"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box3"> <object class="GtkBox" id="box3">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkSwitch" id="switch_enable"> <object class="GtkSwitch" id="switch_enable">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btn_properties"> <object class="GtkButton" id="btn_properties">
<property name="visible">True</property> <!-- TODO: check that this is right, had packing:fill 0 -->
<property name="can_focus">True</property> <property name="visible">1</property>
<property name="receives_default">True</property> <property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="image">img_properties</property> <property name="icon-name">gtk-properties</property>
<property name="always_show_image">True</property>
<style> <style>
<class name="btn_circle"/> <class name="btn_circle"/>
</style> </style>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</interface> </interface>

View File

@ -20,41 +20,31 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">5</property>
<property name="margin_left">5</property> <property name="margin-end">5</property>
<property name="margin_right">5</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">5</property>
<property name="margin_bottom">5</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_name"> <object class="GtkLabel" id="lbl_name">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property> <property name="label" translatable="yes">label</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="txt_value"> <object class="GtkEntry" id="txt_value">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</interface> </interface>

View File

@ -20,11 +20,11 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkAdjustment" id="adjustment_duration"> <object class="GtkAdjustment" id="adjustment_duration">
<property name="upper">100</property> <property name="upper">100</property>
<property name="step_increment">1</property> <property name="step-increment">1</property>
<property name="page_increment">10</property> <property name="page-increment">10</property>
</object> </object>
<object class="GtkListStore" id="lst_break_types"> <object class="GtkListStore" id="lst_break_types">
<columns> <columns>
@ -41,110 +41,69 @@
</data> </data>
</object> </object>
<object class="GtkWindow" id="dialog_new_break"> <object class="GtkWindow" id="dialog_new_break">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Properties</property> <property name="title" translatable="yes">Properties</property>
<property name="resizable">False</property> <property name="resizable">0</property>
<property name="modal">True</property> <property name="modal">1</property>
<property name="window_position">center-on-parent</property> <property name="default-width">500</property>
<property name="default_width">500</property> <property name="default-height">50</property>
<property name="default_height">50</property> <property name="destroy-with-parent">1</property>
<property name="destroy_with_parent">True</property> <property name="icon-name">safeeyes</property>
<property name="icon_name">safeeyes</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="gravity">center</property>
<signal name="delete-event" handler="on_window_delete" swapped="no"/>
<child> <child>
<object class="GtkBox" id="box_settings"> <object class="GtkBox" id="box_settings">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">10</property>
<property name="margin_left">10</property> <property name="margin-end">10</property>
<property name="margin_right">10</property> <property name="margin-top">10</property>
<property name="margin_top">10</property> <property name="margin-bottom">10</property>
<property name="margin_bottom">10</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkFrame" id="frame2"> <object class="GtkFrame" id="frame2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child> <child>
<object class="GtkAlignment" id="alignment2"> <object class="GtkBox" id="box6">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">12</property>
<property name="left_padding">12</property> <property name="margin-end">10</property>
<property name="margin-top">5</property>
<property name="margin-bottom">10</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child> <child>
<object class="GtkBox" id="box6"> <object class="GtkEntry" id="txt_break">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="can-focus">1</property>
<property name="margin_right">10</property> <property name="valign">center</property>
<property name="margin_top">5</property> <property name="width-chars">64</property>
<property name="margin_bottom">10</property> </object>
<property name="orientation">vertical</property> </child>
<property name="spacing">3</property> <child>
<object class="GtkBox" id="box7">
<property name="visible">1</property>
<property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkEntry" id="txt_break"> <object class="GtkLabel" id="lbl_duration3">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="width_chars">64</property> <property name="label" translatable="yes">Type</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box7"> <object class="GtkComboBox" id="cmb_type">
<property name="visible">True</property> <property name="halign">end</property>
<property name="can_focus">False</property> <property name="visible">1</property>
<property name="spacing">10</property> <property name="model">lst_break_types</property>
<property name="active">0</property>
<property name="id-column">0</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration3"> <object class="GtkCellRendererText" id="cellrenderertext1"/>
<property name="visible">True</property> <attributes>
<property name="can_focus">False</property> <attribute name="text">0</attribute>
<property name="halign">start</property> </attributes>
<property name="valign">center</property>
<property name="label" translatable="yes">Type</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">lst_break_types</property>
<property name="active">0</property>
<property name="id_column">0</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child> </child>
</object> </object>
</child> </child>
@ -152,61 +111,36 @@
</child> </child>
<child type="label"> <child type="label">
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Break</property> <property name="label" translatable="yes">Break</property>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButtonBox" id="buttonbox1"> <object class="GtkBox" id="buttonbox1">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">True</property> <property name="homogeneous">1</property>
<property name="baseline_position">top</property> <property name="baseline-position">top</property>
<property name="layout_style">end</property> <property name="halign">end</property>
<child> <child>
<object class="GtkButton" id="btn_discard"> <object class="GtkButton" id="btn_discard">
<property name="label">Discard</property> <property name="label">Discard</property>
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="receives_default">True</property> <property name="receives-default">1</property>
<signal name="clicked" handler="discard" swapped="no"/>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="btn_save"> <object class="GtkButton" id="btn_save">
<property name="label" translatable="yes">Save</property> <property name="label" translatable="yes">Save</property>
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="has_focus">True</property> <property name="receives-default">1</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="save" swapped="no"/>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View File

@ -20,23 +20,18 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkAdjustment" id="adjustment_duration"> <object class="GtkAdjustment" id="adjustment_duration">
<property name="lower">1</property> <property name="lower">1</property>
<property name="upper">3600</property> <property name="upper">3600</property>
<property name="step_increment">1</property> <property name="step-increment">1</property>
<property name="page_increment">10</property> <property name="page-increment">10</property>
</object> </object>
<object class="GtkAdjustment" id="adjustment_interval"> <object class="GtkAdjustment" id="adjustment_interval">
<property name="lower">1</property> <property name="lower">1</property>
<property name="upper">120</property> <property name="upper">120</property>
<property name="step_increment">1</property> <property name="step-increment">1</property>
<property name="page_increment">10</property> <property name="page-increment">10</property>
</object>
<object class="GtkImage" id="img_break">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
</object> </object>
<object class="GtkListStore" id="lst_break_types"> <object class="GtkListStore" id="lst_break_types">
<columns> <columns>
@ -53,152 +48,93 @@
</data> </data>
</object> </object>
<object class="GtkWindow" id="dialog_settings_break"> <object class="GtkWindow" id="dialog_settings_break">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Properties</property> <property name="title" translatable="yes">Properties</property>
<property name="resizable">False</property> <property name="resizable">0</property>
<property name="modal">True</property> <property name="modal">1</property>
<property name="window_position">center-on-parent</property> <property name="default-width">500</property>
<property name="default_width">500</property> <property name="default-height">50</property>
<property name="default_height">50</property> <property name="destroy-with-parent">1</property>
<property name="destroy_with_parent">True</property> <property name="icon-name">safeeyes</property>
<property name="icon_name">safeeyes</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="gravity">center</property>
<signal name="delete-event" handler="on_window_delete" swapped="no"/>
<child>
<placeholder/>
</child>
<child> <child>
<object class="GtkBox" id="box_settings"> <object class="GtkBox" id="box_settings">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">10</property>
<property name="margin_left">10</property> <property name="margin-end">10</property>
<property name="margin_right">10</property> <property name="margin-top">10</property>
<property name="margin_top">10</property> <property name="margin-bottom">10</property>
<property name="margin_bottom">10</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkFrame" id="frame2"> <object class="GtkFrame" id="frame2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child> <child>
<object class="GtkAlignment" id="alignment2"> <object class="GtkBox" id="box6">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">12</property>
<property name="left_padding">12</property> <property name="margin-end">10</property>
<property name="margin-top">5</property>
<property name="margin-bottom">10</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child> <child>
<object class="GtkBox" id="box6"> <object class="GtkEntry" id="txt_break">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="can-focus">1</property>
<property name="margin_right">10</property> <property name="valign">center</property>
<property name="margin_top">5</property> </object>
<property name="margin_bottom">10</property> </child>
<property name="orientation">vertical</property> <child>
<property name="spacing">3</property> <object class="GtkBox" id="box7">
<property name="visible">1</property>
<property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkEntry" id="txt_break"> <object class="GtkLabel" id="lbl_duration3">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Type</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box7"> <object class="GtkComboBox" id="cmb_type">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="model">lst_break_types</property>
<property name="spacing">10</property> <property name="active">0</property>
<property name="id-column">0</property>
<property name="halign">end</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration3"> <object class="GtkCellRendererText" id="cellrenderertext1"/>
<property name="visible">True</property> <attributes>
<property name="can_focus">False</property> <attribute name="text">0</attribute>
<property name="halign">start</property> </attributes>
<property name="valign">center</property>
<property name="label" translatable="yes">Type</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cmb_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">lst_break_types</property>
<property name="active">0</property>
<property name="id_column">0</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing> </child>
<property name="expand">False</property> </object>
<property name="fill">True</property> </child>
<property name="position">1</property> <child>
</packing> <object class="GtkBox" id="box8">
<property name="visible">1</property>
<property name="spacing">10</property>
<property name="homogeneous">1</property>
<child>
<object class="GtkLabel" id="lbl_duration4">
<property name="visible">1</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Image</property>
</object>
</child> </child>
<child> <child>
<object class="GtkBox" id="box8"> <object class="GtkButton" id="btn_image">
<property name="visible">True</property> <property name="halign">end</property>
<property name="can_focus">False</property> <property name="label" translatable="yes">Select</property>
<property name="spacing">10</property> <property name="visible">1</property>
<child> <property name="can-focus">1</property>
<object class="GtkLabel" id="lbl_duration4"> <property name="receives-default">1</property>
<property name="visible">True</property> <property name="icon-name">gtk-missing-image</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Image</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_image">
<property name="label" translatable="yes">Select</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">img_break</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="select_image" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</child> </child>
@ -206,377 +142,208 @@
</child> </child>
<child type="label"> <child type="label">
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Break</property> <property name="label" translatable="yes">Break</property>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkFrame" id="frame4"> <object class="GtkFrame" id="frame4">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child> <child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box9"> <object class="GtkBox" id="box9">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">12</property>
<property name="margin_right">10</property> <property name="margin-end">10</property>
<property name="margin_top">5</property> <property name="margin-top">5</property>
<property name="margin_bottom">10</property> <property name="margin-bottom">10</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<child> <child>
<object class="GtkBox" id="box10"> <object class="GtkBox" id="box10">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration5"> <object class="GtkLabel" id="lbl_duration5">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Override</property> <property name="label" translatable="yes">Override</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="switch_override_interval"> <object class="GtkSwitch" id="switch_override_interval">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box11"> <object class="GtkBox" id="box11">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="spacing">100</property> <property name="spacing">100</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration6"> <object class="GtkLabel" id="lbl_duration6">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Time (in minutes)</property> <property name="label" translatable="yes">Time (in minutes)</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="spin_interval"> <object class="GtkSpinButton" id="spin_interval">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="text" translatable="yes">0</property> <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment_interval</property> <property name="adjustment">adjustment_interval</property>
<property name="numeric">True</property> <property name="numeric">1</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</child>
</object>
</child> </child>
<child type="label"> <child type="label">
<object class="GtkLabel" id="label4"> <object class="GtkLabel" id="label4">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Time to wait</property> <property name="label" translatable="yes">Time to wait</property>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkFrame" id="frame1"> <object class="GtkFrame" id="frame1">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child> <child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box2"> <object class="GtkBox" id="box2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">12</property>
<property name="margin_right">10</property> <property name="margin-end">10</property>
<property name="margin_top">5</property> <property name="margin-top">5</property>
<property name="margin_bottom">10</property> <property name="margin-bottom">10</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<child> <child>
<object class="GtkBox" id="box4"> <object class="GtkBox" id="box4">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration1"> <object class="GtkLabel" id="lbl_duration1">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Override</property> <property name="label" translatable="yes">Override</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="switch_override_duration"> <object class="GtkSwitch" id="switch_override_duration">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box3"> <object class="GtkBox" id="box3">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="spacing">100</property> <property name="spacing">100</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration"> <object class="GtkLabel" id="lbl_duration">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Time (in seconds)</property> <property name="label" translatable="yes">Time (in seconds)</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="spin_duration"> <object class="GtkSpinButton" id="spin_duration">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="adjustment">adjustment_duration</property> <property name="adjustment">adjustment_duration</property>
<property name="numeric">True</property> <property name="numeric">1</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</child>
</object>
</child> </child>
<child type="label"> <child type="label">
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Duration</property> <property name="label" translatable="yes">Duration</property>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkFrame" id="frame3"> <object class="GtkFrame" id="frame3">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child> <child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box1"> <object class="GtkBox" id="box1">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-start">12</property>
<property name="margin_top">5</property> <property name="margin-top">5</property>
<property name="margin_bottom">10</property> <property name="margin-bottom">10</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<child> <child>
<object class="GtkBox" id="box5"> <object class="GtkBox" id="box5">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-end">10</property>
<property name="margin_right">10</property> <property name="margin-top">5</property>
<property name="margin_top">5</property> <property name="margin-bottom">10</property>
<property name="margin_bottom">10</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="homogeneous">1</property>
<child> <child>
<object class="GtkLabel" id="lbl_duration2"> <object class="GtkLabel" id="lbl_duration2">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Override</property> <property name="label" translatable="yes">Override</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="switch_override_plugins"> <object class="GtkSwitch" id="switch_override_plugins">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">True</property> <property name="can-focus">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkGrid" id="grid_plugins"> <object class="GtkGrid" id="grid_plugins">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-end">10</property>
<property name="margin_right">10</property> <property name="margin-bottom">10</property>
<property name="margin_bottom">10</property> <property name="row-homogeneous">1</property>
<property name="row_homogeneous">True</property> <property name="column-homogeneous">1</property>
<property name="column_homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</child>
</object>
</child> </child>
<child type="label"> <child type="label">
<object class="GtkLabel" id="label3"> <object class="GtkLabel" id="label3">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Plugins</property> <property name="label" translatable="yes">Plugins</property>
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

File diff suppressed because it is too large Load Diff

View File

@ -20,39 +20,23 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk" version="4.0"/>
<object class="GtkWindow" id="dialog_settings_plugin"> <object class="GtkWindow" id="dialog_settings_plugin">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Properties</property> <property name="title" translatable="yes">Properties</property>
<property name="resizable">False</property> <property name="resizable">0</property>
<property name="modal">True</property> <property name="modal">1</property>
<property name="window_position">center-on-parent</property> <property name="default-width">400</property>
<property name="default_width">400</property> <property name="default-height">10</property>
<property name="default_height">10</property> <property name="destroy-with-parent">1</property>
<property name="destroy_with_parent">True</property> <property name="icon-name">safeeyes</property>
<property name="icon_name">safeeyes</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="gravity">center</property>
<signal name="delete-event" handler="on_window_delete" swapped="no"/>
<child> <child>
<object class="GtkBox" id="box_settings"> <object class="GtkBox" id="box_settings">
<property name="visible">True</property> <property name="visible">1</property>
<property name="can_focus">False</property> <property name="margin-top">10</property>
<property name="margin_top">10</property> <property name="margin-bottom">10</property>
<property name="margin_bottom">10</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">15</property> <property name="spacing">15</property>
<property name="homogeneous">True</property> <property name="homogeneous">1</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
</child> </child>
</object> </object>

View File

@ -25,6 +25,10 @@ import random
from distutils.version import LooseVersion from distutils.version import LooseVersion
from enum import Enum from enum import Enum
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
from safeeyes import utility from safeeyes import utility
@ -397,7 +401,8 @@ class TrayAction:
def get_icon(self): def get_icon(self):
if self.system_icon: if self.system_icon:
return self.__icon image = Gtk.Image.new_from_icon_name(self.__icon)
return image
else: else:
image = utility.load_and_scale_image(self.__icon, 16, 16) image = utility.load_and_scale_image(self.__icon, 16, 16)
image.show() image.show()

View File

@ -24,7 +24,7 @@ Comment[ta]=உங்கள் கண்களை சோர்வடையாத
Comment[tr]=Gözünüzü yorgunluğa karşı koruyun Comment[tr]=Gözünüzü yorgunluğa karşı koruyun
Comment[uk]=Захистіть свої очі від втоми Comment[uk]=Захистіть свої очі від втоми
Comment[vi]=Bảo vệ đôi mắt của bạn khỏi sự mệt mỏi Comment[vi]=Bảo vệ đôi mắt của bạn khỏi sự mệt mỏi
Exec=env GDK_BACKEND=x11 safeeyes Exec=safeeyes
Icon=io.github.slgobinath.SafeEyes Icon=io.github.slgobinath.SafeEyes
Terminal=false Terminal=false
Type=Application Type=Application

View File

@ -27,7 +27,7 @@ import re
import subprocess import subprocess
import gi import gi
gi.require_version('Gdk', '3.0') gi.require_version('Gdk', '4.0')
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GdkX11 # noqa F401 from gi.repository import GdkX11 # noqa F401
from safeeyes import utility from safeeyes import utility

View File

@ -26,7 +26,7 @@ import dbus
import re import re
import gi import gi
from safeeyes.model import TrayAction from safeeyes.model import TrayAction
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
from gi.repository import Gtk from gi.repository import Gtk
tray_icon_path = None tray_icon_path = None
@ -74,5 +74,5 @@ def get_tray_action(break_obj):
if players: if players:
return TrayAction.build("Pause media", return TrayAction.build("Pause media",
tray_icon_path, tray_icon_path,
Gtk.STOCK_MEDIA_PAUSE, "media-playback-pause",
lambda: __pause_players(players)) lambda: __pause_players(players))

View File

@ -26,7 +26,7 @@ import os
from safeeyes import utility from safeeyes import utility
from safeeyes.model import TrayAction from safeeyes.model import TrayAction
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
from gi.repository import Gtk from gi.repository import Gtk
context = None context = None
@ -131,5 +131,5 @@ def on_stop_break():
def get_tray_action(break_obj): def get_tray_action(break_obj):
return TrayAction.build("Lock screen", return TrayAction.build("Lock screen",
tray_icon_path, tray_icon_path,
Gtk.STOCK_DIALOG_AUTHENTICATION, "dialog-password",
__lock_screen) __lock_screen)

View File

@ -19,7 +19,7 @@
import datetime import datetime
from safeeyes.model import BreakType from safeeyes.model import BreakType
import gi import gi
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
try: try:
gi.require_version('AppIndicator3', '0.1') gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator from gi.repository import AppIndicator3 as appindicator

View File

@ -37,18 +37,22 @@ from safeeyes.plugin_manager import PluginManager
from safeeyes.core import SafeEyesCore from safeeyes.core import SafeEyesCore
from safeeyes.ui.settings_dialog import SettingsDialog from safeeyes.ui.settings_dialog import SettingsDialog
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
from gi.repository import Gtk from gi.repository import Gtk, Gio
SAFE_EYES_VERSION = "2.1.6" SAFE_EYES_VERSION = "2.1.6"
class SafeEyes: class SafeEyes(Gtk.Application):
""" """
This class represents a runnable Safe Eyes instance. This class represents a runnable Safe Eyes instance.
""" """
def __init__(self, system_locale, config): def __init__(self, system_locale, config, cli_args):
super().__init__(
application_id="io.github.slgobinath.SafeEyes",
flags=Gio.ApplicationFlags.IS_SERVICE
)
self.active = False self.active = False
self.break_screen = None self.break_screen = None
self.safe_eyes_core = None self.safe_eyes_core = None
@ -58,6 +62,7 @@ class SafeEyes:
self.settings_dialog_active = False self.settings_dialog_active = False
self.rpc_server = None self.rpc_server = None
self._status = '' self._status = ''
self.cli_args = cli_args
# Initialize the Safe Eyes Context # Initialize the Safe Eyes Context
self.context['version'] = SAFE_EYES_VERSION self.context['version'] = SAFE_EYES_VERSION
@ -98,6 +103,9 @@ class SafeEyes:
self.context['api']['postpone'] = self.safe_eyes_core.postpone self.context['api']['postpone'] = self.safe_eyes_core.postpone
self.context['api']['get_break_time'] = self.safe_eyes_core.get_break_time self.context['api']['get_break_time'] = self.safe_eyes_core.get_break_time
self.plugins_manager.init(self.context, self.config) self.plugins_manager.init(self.context, self.config)
self.hold()
atexit.register(self.persist_session) atexit.register(self.persist_session)
def start(self): def start(self):
@ -114,6 +122,22 @@ class SafeEyes:
self.safe_eyes_core.start() self.safe_eyes_core.start()
self.handle_system_suspend() self.handle_system_suspend()
self.run()
def do_startup(self):
Gtk.Application.do_startup(self)
if self.cli_args.about:
self.show_about()
elif self.cli_args.disable:
self.disable_safeeyes()
elif self.cli_args.enable:
self.enable_safeeyes()
elif self.cli_args.settings:
self.show_settings()
elif self.cli_args.take_break:
self.take_break()
def show_settings(self): def show_settings(self):
""" """
Listen to tray icon Settings action and send the signal to Settings dialog. Listen to tray icon Settings action and send the signal to Settings dialog.
@ -144,9 +168,8 @@ class SafeEyes:
self.plugins_manager.exit() self.plugins_manager.exit()
self.__stop_rpc_server() self.__stop_rpc_server()
self.persist_session() self.persist_session()
Gtk.main_quit()
# Exit all threads super().quit()
os._exit(0)
def handle_suspend_callback(self, sleeping): def handle_suspend_callback(self, sleeping):
""" """

View File

@ -35,8 +35,11 @@ class AboutDialog:
def __init__(self, version): def __init__(self, version):
builder = utility.create_gtk_builder(ABOUT_DIALOG_GLADE) builder = utility.create_gtk_builder(ABOUT_DIALOG_GLADE)
builder.connect_signals(self)
self.window = builder.get_object('window_about') self.window = builder.get_object('window_about')
self.window.connect("close-request", self.on_window_delete)
builder.get_object('btn_close').connect('clicked', self.on_close_clicked)
builder.get_object('lbl_decription').set_label(_("Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer")) builder.get_object('lbl_decription').set_label(_("Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer"))
builder.get_object('lbl_license').set_label(_('License') + ':') builder.get_object('lbl_license').set_label(_('License') + ':')
@ -47,7 +50,7 @@ class AboutDialog:
""" """
Show the About dialog. Show the About dialog.
""" """
self.window.show_all() self.window.present()
def on_window_delete(self, *args): def on_window_delete(self, *args):
""" """

View File

@ -27,7 +27,7 @@ from safeeyes import utility
from Xlib.display import Display from Xlib.display import Display
from Xlib.display import X from Xlib.display import X
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gtk from gi.repository import Gtk
@ -44,7 +44,10 @@ class BreakScreen:
def __init__(self, context, on_skipped, on_postponed, style_sheet_path): def __init__(self, context, on_skipped, on_postponed, style_sheet_path):
self.context = context self.context = context
self.count_labels = [] self.count_labels = []
self.display = Display()
if not self.context['is_wayland']:
self.x11_display = Display()
self.enable_postpone = False self.enable_postpone = False
self.enable_shortcut = False self.enable_shortcut = False
self.is_pretified = False self.is_pretified = False
@ -59,7 +62,9 @@ class BreakScreen:
# Initialize the theme # Initialize the theme
css_provider = Gtk.CssProvider() css_provider = Gtk.CssProvider()
css_provider.load_from_path(style_sheet_path) css_provider.load_from_path(style_sheet_path)
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
display = Gdk.Display.get_default()
Gtk.StyleContext.add_provider_for_display(display, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def initialize(self, config): def initialize(self, config):
""" """
@ -131,7 +136,9 @@ class BreakScreen:
Hide the break screen from active window and destroy all other windows Hide the break screen from active window and destroy all other windows
""" """
logging.info("Close the break screen(s)") logging.info("Close the break screen(s)")
self.__release_keyboard()
if not self.context['is_wayland']:
self.__release_keyboard()
# Destroy other windows if exists # Destroy other windows if exists
GLib.idle_add(lambda: self.__destroy_all_screens()) GLib.idle_add(lambda: self.__destroy_all_screens())
@ -149,23 +156,26 @@ class BreakScreen:
Show an empty break screen on all screens. Show an empty break screen on all screens.
""" """
# Lock the keyboard # Lock the keyboard
utility.start_thread(self.__lock_keyboard) if not self.context['is_wayland']:
utility.start_thread(self.__lock_keyboard_x11)
screen = Gtk.Window().get_screen() display = Gdk.Display.get_default()
no_of_monitors = screen.get_n_monitors() monitors = display.get_monitors()
logging.info("Show break screens in %d display(s)", no_of_monitors) logging.info("Show break screens in %d display(s)", len(monitors))
for monitor in range(no_of_monitors): i = 0
monitor_gemoetry = screen.get_monitor_geometry(monitor)
for monitor in monitors:
monitor_gemoetry = monitor.get_geometry()
x = monitor_gemoetry.x x = monitor_gemoetry.x
y = monitor_gemoetry.y y = monitor_gemoetry.y
builder = Gtk.Builder() builder = Gtk.Builder()
builder.add_from_file(BREAK_SCREEN_GLADE) builder.add_from_file(BREAK_SCREEN_GLADE)
builder.connect_signals(self)
window = builder.get_object("window_main") window = builder.get_object("window_main")
window.set_title("SafeEyes-" + str(monitor)) window.connect("close-request", self.on_window_delete)
window.set_title("SafeEyes-" + str(i))
lbl_message = builder.get_object("lbl_message") lbl_message = builder.get_object("lbl_message")
lbl_count = builder.get_object("lbl_count") lbl_count = builder.get_object("lbl_count")
lbl_widget = builder.get_object("lbl_widget") lbl_widget = builder.get_object("lbl_widget")
@ -174,33 +184,32 @@ class BreakScreen:
toolbar = builder.get_object("toolbar") toolbar = builder.get_object("toolbar")
for tray_action in tray_actions: for tray_action in tray_actions:
toolbar_button = None # TODO: apparently, this would be better served with an icon theme + Gtk.button.new_from_icon_name
if tray_action.system_icon: icon = tray_action.get_icon()
toolbar_button = Gtk.ToolButton.new_from_stock(tray_action.get_icon()) toolbar_button = Gtk.Button()
else: toolbar_button.set_child(icon)
toolbar_button = Gtk.ToolButton.new(tray_action.get_icon(), tray_action.name)
tray_action.add_toolbar_button(toolbar_button) tray_action.add_toolbar_button(toolbar_button)
toolbar_button.connect("clicked", lambda button, action: self.__tray_action(button, action), tray_action) toolbar_button.connect("clicked", lambda button, action: self.__tray_action(button, action), tray_action)
toolbar_button.set_tooltip_text(_(tray_action.name)) toolbar_button.set_tooltip_text(_(tray_action.name))
toolbar.add(toolbar_button) toolbar.append(toolbar_button)
toolbar_button.show() toolbar_button.show()
# Add the buttons # Add the buttons
if self.enable_postpone: if self.enable_postpone:
# Add postpone button # Add postpone button
btn_postpone = Gtk.Button(_('Postpone')) btn_postpone = Gtk.Button.new_with_label(_('Postpone'))
btn_postpone.get_style_context().add_class('btn_postpone') btn_postpone.get_style_context().add_class('btn_postpone')
btn_postpone.connect('clicked', self.on_postpone_clicked) btn_postpone.connect('clicked', self.on_postpone_clicked)
btn_postpone.set_visible(True) btn_postpone.set_visible(True)
box_buttons.pack_start(btn_postpone, True, True, 0) box_buttons.append(btn_postpone)
if not self.strict_break: if not self.strict_break:
# Add the skip button # Add the skip button
btn_skip = Gtk.Button(_('Skip')) btn_skip = Gtk.Button.new_with_label(_('Skip'))
btn_skip.get_style_context().add_class('btn_skip') btn_skip.get_style_context().add_class('btn_skip')
btn_skip.connect('clicked', self.on_skip_clicked) btn_skip.connect('clicked', self.on_skip_clicked)
btn_skip.set_visible(True) btn_skip.set_visible(True)
box_buttons.pack_start(btn_skip, True, True, 0) box_buttons.append(btn_skip)
# Set values # Set values
if image_path: if image_path:
@ -211,23 +220,18 @@ class BreakScreen:
self.windows.append(window) self.windows.append(window)
self.count_labels.append(lbl_count) self.count_labels.append(lbl_count)
# Set visual to apply css theme. It should be called before show method.
window.set_visual(window.get_screen().get_rgba_visual())
if self.context['desktop'] == 'kde': if self.context['desktop'] == 'kde':
# Fix flickering screen in KDE by setting opacity to 1 # Fix flickering screen in KDE by setting opacity to 1
window.set_opacity(0.9) window.set_opacity(0.9)
# In Unity, move the window before present window.fullscreen_on_monitor(monitor)
window.move(x, y)
window.resize(monitor_gemoetry.width, monitor_gemoetry.height)
window.stick()
window.set_keep_above(True)
window.fullscreen()
window.present() window.present()
# In other desktop environments, move the window after present
window.move(x, y) if self.context['is_wayland']:
window.resize(monitor_gemoetry.width, monitor_gemoetry.height) # this may or may not be granted by the window system
logging.info("Moved break screen to Display[%d, %d]", x, y) window.get_surface().inhibit_system_shortcuts(None)
i = i + 1
def __update_count_down(self, count): def __update_count_down(self, count):
""" """
@ -236,7 +240,7 @@ class BreakScreen:
for label in self.count_labels: for label in self.count_labels:
label.set_text(count) label.set_text(count)
def __lock_keyboard(self): def __lock_keyboard_x11(self):
""" """
Lock the keyboard to prevent the user from using keyboard shortcuts Lock the keyboard to prevent the user from using keyboard shortcuts
""" """
@ -244,15 +248,15 @@ class BreakScreen:
self.lock_keyboard = True self.lock_keyboard = True
# Grab the keyboard # Grab the keyboard
root = self.display.screen().root root = self.x11_display.screen().root
root.change_attributes(event_mask=X.KeyPressMask | X.KeyReleaseMask) root.change_attributes(event_mask=X.KeyPressMask | X.KeyReleaseMask)
root.grab_keyboard(True, X.GrabModeAsync, X.GrabModeAsync, X.CurrentTime) root.grab_keyboard(True, X.GrabModeAsync, X.GrabModeAsync, X.CurrentTime)
# Consume keyboard events # Consume keyboard events
while self.lock_keyboard: while self.lock_keyboard:
if self.display.pending_events() > 0: if self.x11_display.pending_events() > 0:
# Avoid waiting for next event by checking pending events # Avoid waiting for next event by checking pending events
event = self.display.next_event() event = self.x11_display.next_event()
if self.enable_shortcut and event.type == X.KeyPress: if self.enable_shortcut and event.type == X.KeyPress:
if event.detail == self.keycode_shortcut_skip and not self.strict_break: if event.detail == self.keycode_shortcut_skip and not self.strict_break:
self.skip_break() self.skip_break()
@ -264,14 +268,14 @@ class BreakScreen:
# Reduce the CPU usage by sleeping for a second # Reduce the CPU usage by sleeping for a second
time.sleep(1) time.sleep(1)
def __release_keyboard(self): def __release_keyboard_x11(self):
""" """
Release the locked keyboard. Release the locked keyboard.
""" """
logging.info("Unlock the keyboard") logging.info("Unlock the keyboard")
self.lock_keyboard = False self.lock_keyboard = False
self.display.ungrab_keyboard(X.CurrentTime) self.x11_display.ungrab_keyboard(X.CurrentTime)
self.display.flush() self.x11_display.flush()
def __destroy_all_screens(self): def __destroy_all_screens(self):
""" """

View File

@ -23,9 +23,9 @@ import gi
from safeeyes import utility from safeeyes import utility
from safeeyes.model import Config from safeeyes.model import Config
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
from gi.repository import Gtk from gi.repository import Gtk, Gio
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf, Gdk
SETTINGS_DIALOG_GLADE = os.path.join(utility.BIN_DIRECTORY, "glade/settings_dialog.glade") SETTINGS_DIALOG_GLADE = os.path.join(utility.BIN_DIRECTORY, "glade/settings_dialog.glade")
@ -55,7 +55,6 @@ class SettingsDialog:
self.warn_bar_rpc_server_shown = False self.warn_bar_rpc_server_shown = False
builder = utility.create_gtk_builder(SETTINGS_DIALOG_GLADE) builder = utility.create_gtk_builder(SETTINGS_DIALOG_GLADE)
builder.connect_signals(self)
self.window = builder.get_object('window_settings') self.window = builder.get_object('window_settings')
self.box_short_breaks = builder.get_object('box_short_breaks') self.box_short_breaks = builder.get_object('box_short_breaks')
@ -80,18 +79,26 @@ class SettingsDialog:
self.info_bar_long_break.hide() self.info_bar_long_break.hide()
self.warn_bar_rpc_server.hide() self.warn_bar_rpc_server.hide()
self.window.connect("close-request", self.on_window_delete)
builder.get_object('reset_menu').connect('clicked', self.on_reset_menu_clicked)
self.spin_short_break_interval.connect('value-changed', self.on_spin_short_break_interval_change)
self.info_bar_long_break.connect('close', self.on_info_bar_long_break_close)
self.info_bar_long_break.connect('response', self.on_info_bar_long_break_close)
self.spin_long_break_interval.connect('value-changed', self.on_spin_long_break_interval_change)
self.warn_bar_rpc_server.connect('close', self.on_warn_bar_rpc_server_close)
self.warn_bar_rpc_server.connect('response', self.on_warn_bar_rpc_server_close)
builder.get_object('btn_add_break').connect('clicked', self.add_break)
# Set the current values of input fields # Set the current values of input fields
self.__initialize(config) self.__initialize(config)
# Update relative states # Add event listener to postpone switch
# GtkSwitch state-set signal is available only from 3.14 self.switch_postpone.connect('state-set', self.on_switch_postpone_activate)
if Gtk.get_minor_version() >= 14: self.on_switch_postpone_activate(self.switch_postpone, self.switch_postpone.get_active())
# Add event listener to postpone switch # Add event listener to RPC server switch
self.switch_postpone.connect('state-set', self.on_switch_postpone_activate) self.switch_rpc_server.connect('state-set', self.on_switch_rpc_server_activate)
self.on_switch_postpone_activate(self.switch_postpone, self.switch_postpone.get_active()) self.on_switch_rpc_server_activate(self.switch_rpc_server, self.switch_rpc_server.get_active())
# Add event listener to RPC server switch
self.switch_rpc_server.connect('state-set', self.on_switch_rpc_server_activate)
self.on_switch_rpc_server_activate(self.switch_rpc_server, self.switch_rpc_server.get_active())
self.initializing = False self.initializing = False
def __initialize(self, config): def __initialize(self, config):
@ -103,7 +110,7 @@ class SettingsDialog:
self.__create_break_item(long_break, False) self.__create_break_item(long_break, False)
for plugin_config in utility.load_plugins_config(config): for plugin_config in utility.load_plugins_config(config):
self.box_plugins.pack_start(self.__create_plugin_item(plugin_config), False, False, 0) self.box_plugins.append(self.__create_plugin_item(plugin_config))
self.spin_short_break_duration.set_value(config.get('short_break_duration')) self.spin_short_break_duration.set_value(config.get('short_break_duration'))
self.spin_long_break_duration.set_value(config.get('long_break_duration')) self.spin_long_break_duration.set_value(config.get('long_break_duration'))
@ -152,7 +159,7 @@ class SettingsDialog:
) )
) )
box.set_visible(True) box.set_visible(True)
parent_box.pack_start(box, False, False, 0) parent_box.append(box)
return box return box
def on_reset_menu_clicked(self, button): def on_reset_menu_clicked(self, button):
@ -254,7 +261,7 @@ class SettingsDialog:
""" """
Show the SettingsDialog. Show the SettingsDialog.
""" """
self.window.show_all() self.window.present()
def on_switch_postpone_activate(self, switch, state): def on_switch_postpone_activate(self, switch, state):
""" """
@ -349,17 +356,18 @@ class PluginSettingsDialog:
self.property_controls = [] self.property_controls = []
builder = utility.create_gtk_builder(SETTINGS_DIALOG_PLUGIN_GLADE) builder = utility.create_gtk_builder(SETTINGS_DIALOG_PLUGIN_GLADE)
builder.connect_signals(self)
self.window = builder.get_object('dialog_settings_plugin') self.window = builder.get_object('dialog_settings_plugin')
box_settings = builder.get_object('box_settings') box_settings = builder.get_object('box_settings')
self.window.set_title(_('Plugin Settings')) self.window.set_title(_('Plugin Settings'))
for setting in config.get('settings'): for setting in config.get('settings'):
if setting['type'].upper() == 'INT': if setting['type'].upper() == 'INT':
box_settings.pack_start(self.__load_int_item(setting['label'], setting['id'], setting['safeeyes_config'], setting.get('min', 0), setting.get('max', 120)), False, False, 0) box_settings.append(self.__load_int_item(setting['label'], setting['id'], setting['safeeyes_config'], setting.get('min', 0), setting.get('max', 120)))
elif setting['type'].upper() == 'TEXT': elif setting['type'].upper() == 'TEXT':
box_settings.pack_start(self.__load_text_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0) box_settings.append(self.__load_text_item(setting['label'], setting['id'], setting['safeeyes_config']))
elif setting['type'].upper() == 'BOOL': elif setting['type'].upper() == 'BOOL':
box_settings.pack_start(self.__load_bool_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0) box_settings.append(self.__load_bool_item(setting['label'], setting['id'], setting['safeeyes_config']))
self.window.connect("close-request", self.on_window_delete)
def __load_int_item(self, name, key, settings, min_value, max_value): def __load_int_item(self, name, key, settings, min_value, max_value):
""" """
@ -413,7 +421,7 @@ class PluginSettingsDialog:
""" """
Show the Properties dialog. Show the Properties dialog.
""" """
self.window.show_all() self.window.present()
class BreakSettingsDialog: class BreakSettingsDialog:
@ -431,7 +439,6 @@ class BreakSettingsDialog:
self.on_remove = on_remove self.on_remove = on_remove
builder = utility.create_gtk_builder(SETTINGS_DIALOG_BREAK_GLADE) builder = utility.create_gtk_builder(SETTINGS_DIALOG_BREAK_GLADE)
builder.connect_signals(self)
self.window = builder.get_object('dialog_settings_break') self.window = builder.get_object('dialog_settings_break')
self.txt_break = builder.get_object('txt_break') self.txt_break = builder.get_object('txt_break')
self.switch_override_interval = builder.get_object('switch_override_interval') self.switch_override_interval = builder.get_object('switch_override_interval')
@ -439,7 +446,7 @@ class BreakSettingsDialog:
self.switch_override_plugins = builder.get_object('switch_override_plugins') self.switch_override_plugins = builder.get_object('switch_override_plugins')
self.spin_interval = builder.get_object('spin_interval') self.spin_interval = builder.get_object('spin_interval')
self.spin_duration = builder.get_object('spin_duration') self.spin_duration = builder.get_object('spin_duration')
self.img_break = builder.get_object('img_break') self.btn_image = builder.get_object('btn_image')
self.cmb_type = builder.get_object('cmb_type') self.cmb_type = builder.get_object('cmb_type')
grid_plugins = builder.get_object('grid_plugins') grid_plugins = builder.get_object('grid_plugins')
@ -477,7 +484,7 @@ class BreakSettingsDialog:
row = 0 row = 0
col = 0 col = 0
for plugin_id in plugin_map.keys(): for plugin_id in plugin_map.keys():
chk_button = Gtk.CheckButton(_(plugin_map[plugin_id])) chk_button = Gtk.CheckButton.new_with_label(_(plugin_map[plugin_id]))
self.plugin_check_buttons[plugin_id] = chk_button self.plugin_check_buttons[plugin_id] = chk_button
grid_plugins.attach(chk_button, row, col, 1, 1) grid_plugins.attach(chk_button, row, col, 1, 1)
if plugins_overriden: if plugins_overriden:
@ -488,14 +495,21 @@ class BreakSettingsDialog:
if row > 2: if row > 2:
col += 1 col += 1
row = 0 row = 0
# GtkSwitch state-set signal is available only from 3.14
if Gtk.get_minor_version() >= 14: if 'image' in self.break_config:
self.switch_override_interval.connect('state-set', self.on_switch_override_interval_activate) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.break_config['image'], 16, 16, True)
self.switch_override_duration.connect('state-set', self.on_switch_override_duration_activate) image = Gtk.Image.new_from_pixbuf(pixbuf)
self.switch_override_plugins.connect('state-set', self.on_switch_override_plugins_activate) self.btn_image.set_child(image)
self.on_switch_override_interval_activate(self.switch_override_interval, self.switch_override_interval.get_active())
self.on_switch_override_duration_activate(self.switch_override_duration, self.switch_override_duration.get_active()) self.window.connect("close-request", self.on_window_delete)
self.on_switch_override_plugins_activate(self.switch_override_plugins, self.switch_override_plugins.get_active()) self.btn_image.connect('clicked', self.select_image)
self.switch_override_interval.connect('state-set', self.on_switch_override_interval_activate)
self.switch_override_duration.connect('state-set', self.on_switch_override_duration_activate)
self.switch_override_plugins.connect('state-set', self.on_switch_override_plugins_activate)
self.on_switch_override_interval_activate(self.switch_override_interval, self.switch_override_interval.get_active())
self.on_switch_override_duration_activate(self.switch_override_duration, self.switch_override_duration.get_active())
self.on_switch_override_plugins_activate(self.switch_override_plugins, self.switch_override_plugins.get_active())
def on_switch_override_interval_activate(self, switch_button, state): def on_switch_override_interval_activate(self, switch_button, state):
""" """
@ -520,24 +534,36 @@ class BreakSettingsDialog:
""" """
Show a file chooser dialog and let the user to select an image. Show a file chooser dialog and let the user to select an image.
""" """
dialog = Gtk.FileChooserDialog(_('Please select an image'), self.window, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) dialog = Gtk.FileDialog()
dialog.set_title(_('Please select an image'))
png_filter = Gtk.FileFilter() png_filter = Gtk.FileFilter()
png_filter.set_name("PNG files") png_filter.set_name("PNG files")
png_filter.add_mime_type("image/png") png_filter.add_mime_type("image/png")
png_filter.add_pattern("*.png") png_filter.add_pattern("*.png")
dialog.add_filter(png_filter) filters = Gio.ListStore.new(Gtk.FileFilter)
filters.append(png_filter)
dialog.set_filters(filters)
response = dialog.run() dialog.open(self.window, None, self.select_image_callback)
if response == Gtk.ResponseType.OK:
self.break_config['image'] = dialog.get_filename() def select_image_callback(self, dialog, result):
response = None
try:
response = dialog.open_finish(result)
except Exception:
# user pressing "Cancel" throws a generic exception here
pass
if response is not None:
self.break_config['image'] = response.get_path()
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.break_config['image'], 16, 16, True) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.break_config['image'], 16, 16, True)
self.img_break.set_from_pixbuf(pixbuf) image = Gtk.Image.new_from_pixbuf(pixbuf)
elif response == Gtk.ResponseType.CANCEL: self.btn_image.set_child(image)
else:
self.break_config.pop('image', None) self.break_config.pop('image', None)
self.img_break.set_from_stock('gtk-missing-image', Gtk.IconSize.BUTTON) self.btn_image.set_icon_name('gtk-missing-image')
dialog.destroy()
def on_window_delete(self, *args): def on_window_delete(self, *args):
""" """
@ -583,7 +609,7 @@ class BreakSettingsDialog:
""" """
Show the Properties dialog. Show the Properties dialog.
""" """
self.window.show_all() self.window.present()
class NewBreakDialog: class NewBreakDialog:
@ -596,7 +622,6 @@ class NewBreakDialog:
self.on_add = on_add self.on_add = on_add
builder = utility.create_gtk_builder(SETTINGS_DIALOG_NEW_BREAK_GLADE) builder = utility.create_gtk_builder(SETTINGS_DIALOG_NEW_BREAK_GLADE)
builder.connect_signals(self)
self.window = builder.get_object('dialog_new_break') self.window = builder.get_object('dialog_new_break')
self.txt_break = builder.get_object('txt_break') self.txt_break = builder.get_object('txt_break')
self.cmb_type = builder.get_object('cmb_type') self.cmb_type = builder.get_object('cmb_type')
@ -605,6 +630,10 @@ class NewBreakDialog:
list_types[0][0] = _(list_types[0][0]) list_types[0][0] = _(list_types[0][0])
list_types[1][0] = _(list_types[1][0]) list_types[1][0] = _(list_types[1][0])
self.window.connect("close-request", self.on_window_delete)
builder.get_object('btn_discard').connect('clicked', self.discard)
builder.get_object('btn_save').connect('clicked', self.save)
# Set the values # Set the values
self.window.set_title(_('New Break')) self.window.set_title(_('New Break'))
@ -638,4 +667,4 @@ class NewBreakDialog:
""" """
Show the Properties dialog. Show the Properties dialog.
""" """
self.window.show_all() self.window.present()

View File

@ -39,12 +39,12 @@ from pathlib import Path
import babel.core import babel.core
import babel.dates import babel.dates
import gi import gi
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '4.0')
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GLib from gi.repository import GLib
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
gi.require_version('Gdk', '3.0') gi.require_version('Gdk', '4.0')
BIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) BIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
HOME_DIRECTORY = os.environ.get('HOME') or os.path.expanduser('~') HOME_DIRECTORY = os.environ.get('HOME') or os.path.expanduser('~')
@ -660,7 +660,7 @@ def create_gtk_builder(glade_file):
builder.add_from_file(glade_file) builder.add_from_file(glade_file)
# Tranlslate all sub components # Tranlslate all sub components
for obj in builder.get_objects(): for obj in builder.get_objects():
if (not isinstance(obj, Gtk.SeparatorMenuItem)) and hasattr(obj, "get_label"): if hasattr(obj, "get_label"):
label = obj.get_label() label = obj.get_label()
if label is not None: if label is not None:
obj.set_label(_(label)) obj.set_label(_(label))