Skip to content

Commit

Permalink
remove other pre-3.12 workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferyto committed Nov 2, 2023
1 parent 4b849b7 commit b97d07d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 228 deletions.
44 changes: 3 additions & 41 deletions controlyourtabs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from functools import wraps
from gi.repository import GObject, GLib, Gtk, Gdk, GdkPixbuf, Gio, Gedit, PeasGtk
from .utils import connect_handlers, disconnect_handlers
from . import keyinfo, log, tabinfo, tabinfo_pre312
from . import keyinfo, log, tabinfo

BASE_PATH = os.path.dirname(os.path.realpath(__file__))
LOCALE_PATH = os.path.join(BASE_PATH, 'locale')
Expand Down Expand Up @@ -109,16 +109,6 @@ def do_activate(self):
# hack to ensure tabwin is correctly positioned/sized on first show
view.realize()

try:
GtkStack = Gtk.Stack
except AttributeError:
is_side_panel_stack = False
else:
is_side_panel_stack = isinstance(window.get_side_panel(), GtkStack) # since gedit 3.12

if log.query(log.DEBUG):
Gedit.debug_plugin_message(log.format("using %s tab names/icons", "current" if is_side_panel_stack else "pre-3.12"))

self._is_switching = False
self._is_tabwin_visible = False
self._is_control_held = keyinfo.default_control_held()
Expand All @@ -132,7 +122,7 @@ def do_activate(self):
self._space_cell = space_cell
self._tabwin_resize_id = None
self._settings = get_settings()
self._tabinfo = tabinfo if is_side_panel_stack else tabinfo_pre312
self._tabinfo = tabinfo

tab = window.get_active_tab()

Expand Down Expand Up @@ -209,13 +199,7 @@ def setup(self, window, tab, tab_models):
self._icon_cell.set_fixed_size(icon_size, icon_size)
self._space_cell.set_fixed_size(icon_size, icon_size)

multi = get_multi_notebook(tab)

if not multi:
if log.query(log.ERROR):
Gedit.debug_plugin_message(log.format("cannot find multi notebook from %s", tab))

return
multi = window.get_template_child(Gedit.Window, 'multi_notebook')

connect_handlers(
self, multi,
Expand Down Expand Up @@ -990,22 +974,6 @@ def do_create_configure_widget(self):
return box


# this is a /hack/
# can do window.get_template_child(Gedit.Window, 'multi_notebook') since gedit 3.12
def get_multi_notebook(tab):
if log.query(log.INFO):
Gedit.debug_plugin_message(log.format("%s", tab))

widget = tab.get_parent()

while widget:
if widget.__gtype__.name == 'GeditMultiNotebook':
break

widget = widget.get_parent()

return widget

def get_settings():
if log.query(log.INFO):
Gedit.debug_plugin_message(log.format(""))
Expand All @@ -1019,12 +987,6 @@ def get_settings():
False
)

except AttributeError: # before gedit 3.4
if log.query(log.DEBUG):
Gedit.debug_plugin_message(log.format("relocatable schemas not supported"))

schema_source = None

except:
if log.query(log.WARNING):
Gedit.debug_plugin_message(log.format("could not load settings schema source from %s", schemas_path))
Expand Down
187 changes: 0 additions & 187 deletions controlyourtabs/tabinfo_pre312.py

This file was deleted.

0 comments on commit b97d07d

Please sign in to comment.