- Add PreferencesDialog with settings for TLS verification and request timeout - Update HttpClient to respect TLS verification setting - Add GSettings schema keys for force-tls-verification and request-timeout - Wire up preferences action to show dialog - Settings changes apply immediately to HTTP session
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
# preferences_dialog.py
|
|
#
|
|
# Copyright 2025 Pavel Baksy
|
|
#
|
|
# 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
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from gi.repository import Adw, Gtk, Gio
|
|
|
|
|
|
@Gtk.Template(resource_path='/cz/vesp/roster/preferences-dialog.ui')
|
|
class PreferencesDialog(Adw.PreferencesWindow):
|
|
__gtype_name__ = 'PreferencesDialog'
|
|
|
|
tls_verification_row = Gtk.Template.Child()
|
|
timeout_row = Gtk.Template.Child()
|
|
|
|
def __init__(self, **kwargs):
|
|
super().__init__(**kwargs)
|
|
|
|
# Get settings
|
|
self.settings = Gio.Settings.new('cz.vesp.roster')
|
|
|
|
# Bind settings to UI
|
|
self.settings.bind(
|
|
'force-tls-verification',
|
|
self.tls_verification_row,
|
|
'active',
|
|
Gio.SettingsBindFlags.DEFAULT
|
|
)
|
|
|
|
self.settings.bind(
|
|
'request-timeout',
|
|
self.timeout_row,
|
|
'value',
|
|
Gio.SettingsBindFlags.DEFAULT
|
|
)
|