Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert About button to a Menu Bar entry #2351

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/solaar/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from solaar.ui.window import find_device

from . import common, diversion_rules, notify, tray, window
from .about import show_window as _show_about_window

gi.require_version("Gtk", "3.0")
from gi.repository import Gio, GLib, Gtk # NOQA: E402
Expand Down Expand Up @@ -100,6 +101,17 @@ def run_loop(startup_hook, shutdown_hook, use_tray, show_window):
application.connect("activate", _activate)
application.connect("shutdown", _shutdown, shutdown_hook)

# Add the menu bar to the application menu
app_menu = Gio.Menu()

about_action = Gio.SimpleAction.new("about", None)
about_action.connect("activate", _show_about_window)
application.add_action(about_action)

app_menu.append("About", "app.about")

application.set_app_menu(app_menu)

application.register()
if application.get_is_remote():
print(_("Another Solaar process is already running so just expose its window"))
Expand Down
2 changes: 1 addition & 1 deletion lib/solaar/ui/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _hide(dialog, event):
return about


def show_window(trigger=None):
def show_window(trigger=None, *args, **kwargs):
global _dialog
if _dialog is None:
_dialog = _create()
Expand Down
3 changes: 0 additions & 3 deletions lib/solaar/ui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from . import action as _action
from . import config_panel as _config_panel
from . import icons as _icons
from .about import show_window as _show_about_window
from .common import ui_async as _ui_async
from .diversion_rules import show_window as _show_diversion_window

Expand Down Expand Up @@ -317,8 +316,6 @@ def _create_window_layout():
bottom_buttons_box.set_spacing(20)
quit_button = _new_button(_("Quit %s") % NAME, "application-exit", _SMALL_BUTTON_ICON_SIZE, clicked=destroy)
bottom_buttons_box.add(quit_button)
about_button = _new_button(_("About %s") % NAME, "help-about", _SMALL_BUTTON_ICON_SIZE, clicked=_show_about_window)
bottom_buttons_box.add(about_button)
diversion_button = _new_button(
_("Rule Editor"), "", _SMALL_BUTTON_ICON_SIZE, clicked=lambda *_trigger: _show_diversion_window(_model)
)
Expand Down
Loading