2222from gi .repository import GLib
2323from gi .repository import Gtk
2424
25+ # Import support module to get all builder-constructed widgets in the namespace
26+ import meld .ui .gladesupport # noqa: F401
2527import meld .ui .util
26- from meld .conf import _ , ui_file
28+ from meld .conf import _
2729from meld .const import FILE_FILTER_ACTION_FORMAT
2830from meld .dirdiff import DirDiff
2931from meld .filediff import FileDiff
@@ -59,22 +61,6 @@ def __init__(self):
5961
6062 self .init_template ()
6163
62- actions = (
63- ("ChangesMenu" , None , _ ("_Changes" )),
64- )
65- self .actiongroup = Gtk .ActionGroup (name = 'MainActions' )
66- self .actiongroup .set_translation_domain ("meld" )
67- self .actiongroup .add_actions (actions )
68-
69- self .ui = Gtk .UIManager ()
70- self .ui .insert_action_group (self .actiongroup , 0 )
71- self .ui .add_ui_from_file (ui_file ("meldapp-ui.xml" ))
72-
73- self .add_accel_group (self .ui .get_accel_group ())
74- self .menubar = self .ui .get_widget ('/Menubar' )
75-
76- self .appvbox .pack_start (self .menubar , False , True , 0 )
77-
7864 # Manually handle GAction additions
7965 actions = (
8066 ("close" , self .action_close ),
@@ -121,8 +107,6 @@ def __init__(self):
121107 self .scheduler = LifoScheduler ()
122108 self .scheduler .connect ("runnable" , self .on_scheduler_runnable )
123109
124- self .ui .ensure_update ()
125-
126110 def do_realize (self ):
127111 Gtk .ApplicationWindow .do_realize (self )
128112
@@ -207,7 +191,7 @@ def has_pages(self):
207191 return self .notebook .get_n_pages () > 0
208192
209193 def handle_current_doc_switch (self , page ):
210- page .on_container_switch_out_event (self . ui , self )
194+ page .on_container_switch_out_event (self )
211195
212196 @Template .Callback ()
213197 def on_switch_page (self , notebook , page , which ):
@@ -232,7 +216,7 @@ def on_switch_page(self, notebook, page, which):
232216 @Template .Callback ()
233217 def after_switch_page (self , notebook , page , which ):
234218 newdoc = notebook .get_nth_page (which )
235- newdoc .on_container_switch_in_event (self . ui , self )
219+ newdoc .on_container_switch_in_event (self )
236220
237221 @Template .Callback ()
238222 def on_page_label_changed (self , notebook , label_text ):
@@ -279,9 +263,6 @@ def page_removed(self, page, status):
279263 # last page from a notebook.
280264 if not self .has_pages ():
281265 self .on_switch_page (self .notebook , page , - 1 )
282- # Synchronise UIManager state; this shouldn't be necessary,
283- # but upstream aren't touching UIManager bugs.
284- self .ui .ensure_update ()
285266 if self .should_close :
286267 cancelled = self .emit (
287268 'delete-event' , Gdk .Event .new (Gdk .EventType .DELETE ))
0 commit comments