Remove redundant code since Gtk 3.24 required

This commit is contained in:
Nick Hall 2023-07-01 22:30:10 +01:00
parent c3a0b330cc
commit 53bfeb66ca
8 changed files with 9 additions and 51 deletions

View File

@ -298,12 +298,7 @@ class EditPrimary(ManagedWindow, DbGUIElement, metaclass=abc.ABCMeta):
menu = Gtk.Menu.new_from_model(menu_model)
menu.attach_to_widget(obj, None)
menu.show_all()
if Gtk.MINOR_VERSION < 22:
# ToDo The following is reported to work poorly with Wayland
menu.popup(None, None, None, None,
event.button, event.time)
else:
menu.popup_at_pointer(event)
menu.popup_at_pointer(event)
return True
return False

View File

@ -35,10 +35,7 @@ _RETURN = Gdk.keyval_from_name("Return")
_KP_ENTER = Gdk.keyval_from_name("KP_Enter")
class SidebarFilter(DbGUIElement):
if Gtk.get_minor_version() > 17:
_FILTER_WIDTH = -1
else:
_FILTER_WIDTH = 20
_FILTER_WIDTH = -1
_FILTER_ELLIPSIZE = Pango.EllipsizeMode.END
def __init__(self, dbstate, uistate, namespace):

View File

@ -574,15 +574,7 @@ def get_link_color(context):
"""
Find the link color for the current theme.
"""
from gi.repository import Gtk
if Gtk.get_minor_version() > 11:
col = context.get_color(Gtk.StateFlags.LINK)
else:
found, col = context.lookup_color('link_color')
if not found:
col.parse('blue')
col = context.get_color(Gtk.StateFlags.LINK)
return rgb_to_hex((col.red, col.green, col.blue))

View File

@ -1000,12 +1000,7 @@ class ListView(NavigationView):
popup_menu = Gtk.Menu.new_from_model(menu)
popup_menu.attach_to_widget(obj, None)
popup_menu.show_all()
if Gtk.MINOR_VERSION < 22:
# ToDo The following is reported to work poorly with Wayland
popup_menu.popup(None, None, None, None,
event.button, event.time)
else:
popup_menu.popup_at_pointer(event)
popup_menu.popup_at_pointer(event)
return True
return False

View File

@ -276,12 +276,8 @@ class Tags(DbGUIElement):
popup_menu = Gtk.Menu.new_from_model(menu)
popup_menu.attach_to_widget(button, None)
popup_menu.show_all()
if Gtk.MINOR_VERSION < 22:
# ToDo The following is reported to work poorly with Wayland
popup_menu.popup(None, None, cb_menu_position, button, 0, 0)
else:
popup_menu.popup_at_widget(button, Gdk.Gravity.SOUTH,
Gdk.Gravity.NORTH_WEST, None)
popup_menu.popup_at_widget(button, Gdk.Gravity.SOUTH,
Gdk.Gravity.NORTH_WEST, None)
def cb_organize_tags(self, *action):
"""

View File

@ -1510,13 +1510,8 @@ class GrampletPane(Gtk.ScrolledWindow):
popup_menu = Gtk.Menu.new_from_model(menu)
popup_menu.attach_to_widget(obj, None)
popup_menu.show_all()
if Gtk.MINOR_VERSION < 22:
# ToDo The following is reported to work poorly with Wayland
popup_menu.popup(None, None, None, None,
event.button, event.time)
else:
popup_menu.popup_at_pointer(event)
return True
popup_menu.popup_at_pointer(event)
return True
return False
def set_inactive(self):

View File

@ -72,11 +72,7 @@ class ValidatedComboEntry(Gtk.ComboBox):
self._entry.set_width_chars(width)
# <hack description="set the GTK_ENTRY(self._entry)->is_cell_renderer
# flag to TRUE in order to tell the entry to fill its allocation.">
if Gtk.get_minor_version() < 13:
dummy_event = Gdk.Event()
dummy_event.type = Gdk.EventType.NOTHING
else:
dummy_event = Gdk.Event()
dummy_event = Gdk.Event()
self._entry.start_editing(dummy_event)
# </hack>
self.add(self._entry)

View File

@ -873,14 +873,6 @@ class GeoGraphyView(OsmGps, NavigationView):
Print or save the view that is currently shown
"""
dummy_obj = obj
if Gtk.MAJOR_VERSION == 3 and Gtk.MINOR_VERSION < 11:
from gramps.gui.dialog import WarningDialog
WarningDialog(
_("You can't use the print functionality"),
_("Your Gtk version is too old."),
parent=self.uistate.window)
return
req = self.osm.get_allocation()
widthpx = req.width
heightpx = req.height