Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix duplication of codebox toolbar callbacks (#2635)
The `update_toolbar_buttons` function, which is called whenever a codebox is reconfigured or when codebox toolbars are en-/disabled, works by removing all the toolbar buttons and readding them as necessary. It was using the `_toolbar.append()` function which sets up the buttons' callback at the same time. Because the ToolbarButton objects are persistent, an extra copy of the callback was being connected each time the button was removed and readded, so Gtk thought we wanted to run it multiple times. Now, the buttons' callbacks are setup once using `signal_clicked().connect()` in the codebox constructor and the `update_toolbar_buttons` function uses `_toolbar.insert()` which doesn't affect the callbacks at all. Fixes #2628
- Loading branch information