fixes for latest gtk4, workaround dark theme issue, fix old gtk api calls with new working ones

parent ef3ba612
Pipeline #247505 failed with stage
in 38 seconds
......@@ -9,6 +9,8 @@ class AppWindow(Handy.ApplicationWindow):
super().__init__(**kwargs)
self.confman = ConfManager()
self.workaround_dark_theme_issue()
self.set_title('What IP')
self.set_icon_name('org.gabmus.whatip')
......@@ -35,7 +37,7 @@ class AppWindow(Handy.ApplicationWindow):
self.set_child(self.main_box)
self.resize(
self.set_default_size(
self.confman.conf['windowsize']['width'],
self.confman.conf['windowsize']['height']
)
......@@ -52,6 +54,16 @@ class AppWindow(Handy.ApplicationWindow):
self.add_accelerator(s['combo'], s['cb'])
self.add_controller(self.shortcut_controller)
def workaround_dark_theme_issue(self):
settings = Gtk.Settings.get_default()
theme = settings.get_property('gtk-theme-name')
if theme.lower() == 'adwaita-dark':
settings.set_property('gtk-theme-name', 'Adwaita')
settings.set_property(
'gtk-application-prefer-dark-theme',
True
)
def toggle_menu(self, *args):
popover = self.headerbar.menu_btn.get_popover()
if popover.get_visible():
......
from gi.repository import Gtk, Gdk, Gio, GLib
from gi.repository import Gtk, Gio, GLib
from whatip.clipboard_helper import clipboard_copy
......@@ -54,8 +54,8 @@ class LanListboxRow(Gtk.ListBoxRow):
clipboard_copy(self.address)
def on_go_http_btn_clicked(self, *args):
Gtk.show_uri_on_window(
None, f'http://{self.address}', Gdk.CURRENT_TIME
Gio.AppInfo.launch_default_for_uri(
f'http://{self.address}'
)
def on_go_ftp_btn_clicked(self, *args):
......
......@@ -108,8 +108,7 @@ class PortListboxRow(Gtk.ListBoxRow):
def set_status(self, reachable):
self.status_icon.set_from_icon_name(
'emblem-ok-symbolic' if reachable
else 'window-close-symbolic',
Gtk.IconSize.LARGE
else 'window-close-symbolic'
)
self.status_icon.set_tooltip_text(
_('Port reachable') if reachable
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment