Commit 56553840 authored by Nico Alt's avatar Nico Alt

Add main menu entry "About Briar GTK"

Closes #15.
parent 9eb41863
......@@ -8,7 +8,7 @@
from gi.repository import Gio, GLib
from briar_gtk.containers.main import MainContainer
from briar_gtk.containers.main_window import MainWindowContainer
from briar_gtk.define import APP
......@@ -31,6 +31,11 @@ class WindowActions:
open_add_contact_action.connect("activate", self._open_add_contact)
self.add_action(open_add_contact_action)
open_about_page_action = Gio.SimpleAction.new(
"open-about-page", None)
open_about_page_action.connect("activate", self._open_about_page)
self.add_action(open_about_page_action)
open_private_chat_action = Gio.SimpleAction.new(
"open-private-chat", GLib.VariantType.new("i"))
open_private_chat_action.connect("activate", self._open_private_chat)
......@@ -38,9 +43,13 @@ class WindowActions:
# pylint: disable=unused-argument
def _back_to_sidebar(self, action, parameter):
if isinstance(self.current_container, MainContainer):
if isinstance(self.current_container, MainWindowContainer):
self.current_container.show_sidebar()
# pylint: disable=unused-argument
def _open_about_page(self, action, parameter):
self.current_container.open_about_page()
# pylint: disable=unused-argument
def _open_add_contact(self, action, parameter):
self.show_add_contact_container()
......
......@@ -5,6 +5,8 @@
# Initial version based on GNOME Fractal
# https://gitlab.gnome.org/GNOME/fractal/-/tags/4.2.2
from gettext import gettext as _
from gi.repository import GLib
from briar_wrapper.models.contacts import Contacts
......@@ -15,9 +17,11 @@ from briar_gtk.containers.private_chat import PrivateChatContainer
from briar_gtk.define import APP
class MainContainer(Container):
class MainWindowContainer(Container):
CONTAINER_UI = "/app/briar/gtk/ui/main.ui"
CONTAINER_UI = "/app/briar/gtk/main_window.ui"
MENU_UI = "/app/briar/gtk/main_menu.ui"
ABOUT_UI = "/app/briar/gtk/about_dialog.ui"
def __init__(self):
super().__init__()
......@@ -60,6 +64,38 @@ class MainContainer(Container):
def chat_entry(self):
return self.builder.get_object("chat_entry")
# pylint: disable=line-too-long
def open_about_page(self):
self.builder.add_from_resource(self.ABOUT_UI)
about_dialog = self.builder.get_object("about_dialog")
about_dialog.set_transient_for(APP().window)
code_use_title = _("Using code by")
code_use_list = [
"GNOME Fractal https://wiki.gnome.org/Apps/Fractal",
"GNOME Lollypop https://wiki.gnome.org/Apps/Lollypop",
]
about_dialog.add_credit_section(
code_use_title, code_use_list
)
briar_functionality_title = _("Briar functionality by")
briar_functionality_list = [
"Briar REST API https://code.briarproject.org/briar/briar/tree/master/briar-headless", # noqa
"Briar Python Wrapper https://code.briarproject.org/briar/python-briar-wrapper", # noqa
]
about_dialog.add_credit_section(
briar_functionality_title, briar_functionality_list
)
about_dialog.connect("response", self._on_about_response)
about_dialog.show()
@staticmethod
# pylint: disable=unused-argument
def _on_about_response(dialog, response_id):
dialog.destroy()
def open_private_chat(self, contact_id):
contact_name = self._get_contact_name(contact_id)
self._prepare_chat_view(contact_name)
......@@ -101,6 +137,7 @@ class MainContainer(Container):
self.history_container.remove(child)
def _setup_view(self):
self.builder.add_from_resource(self.MENU_UI)
self.builder.add_from_resource(self.CONTAINER_UI)
self.builder.connect_signals(self)
......
......@@ -6,7 +6,7 @@ from gi.repository import Gtk
from briar_gtk.actions.window import WindowActions
from briar_gtk.containers.add_contact import AddContactContainer
from briar_gtk.containers.main import MainContainer
from briar_gtk.containers.main_window import MainWindowContainer
from briar_gtk.containers.startup import StartupContainer
from briar_gtk.define import APP, APPLICATION_ID, APPLICATION_NAME
......@@ -57,7 +57,7 @@ class Window(Gtk.ApplicationWindow, WindowActions):
self._setup_container(StartupContainer(self))
def _setup_main_container(self):
self._setup_container(MainContainer())
self._setup_container(MainWindowContainer())
def _setup_add_contact_container(self):
self._setup_container(AddContactContainer())
......@@ -52,6 +52,12 @@ gnome.compile_resources('briar-gtk',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
dependencies: configure_file(
input: 'ui/about_dialog.ui.in',
output: 'about_dialog.ui',
configuration: conf
)
)
subdir('icons')
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019 Nico Alt
SPDX-License-Identifier: AGPL-3.0-only
License-Filename: LICENSE.md
Based on parts of GNOME Lollypop
https://gitlab.gnome.org/World/lollypop/raw/1.2.16/data/AboutDialog.ui.in
-->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkAboutDialog" id="about_dialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
<property name="program_name">Briar GTK</property>
<property name="version">@VERSION@</property>
<property name="copyright">Copyright © 2019-2020 Nico Alt, et al.</property>
<property name="comments" translatable="yes">A Briar client for GTK desktop and mobile devices</property>
<property name="website">@PACKAGE_URL@</property>
<property name="website_label" translatable="yes">Visit Briar GTK website</property>
<property name="authors"> Nico Alt https://nico.dorfbrunnen.eu</property>
<property name="translator_credits" translatable="yes" context="Translation credits here, put your name here!" comments="Replace me with your names">Nico Alt https://nico.dorfbrunnen.eu</property>
<property name="logo_icon_name">app.briar.gtk</property>
<property name="license_type">agpl-3-0-only</property>
</object>
</interface>
......@@ -4,7 +4,7 @@
<file compressed="true">ui/application.css</file>
<file compressed="true" preprocess="xml-stripblanks">ui/add_contact.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/login.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/main.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/main_window.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/private_chat.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/registration.ui</file>
</gresource>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020 Nico Alt
SPDX-License-Identifier: AGPL-3.0-only
License-Filename: LICENSE.md
Based on parts of GNOME Fractal
https://gitlab.gnome.org/GNOME/fractal/-/blob/4.2.2/fractal-gtk/res/ui/main_menu.ui
-->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkPopoverMenu" id="main_menu_popover">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="orientation">vertical</property>
<property name="width_request">200</property>
<child>
<object class="GtkModelButton" id="about-menu-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="action_name">win.open-about-page</property>
<property name="text" translatable="yes">About Briar GTK</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>
......@@ -228,7 +228,7 @@
<property name="halign">fill</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkMenuButton" id="add_room_menu">
<object class="GtkMenuButton" id="add_contact_menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -244,14 +244,41 @@
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-add_room_menu">
<property name="AtkObject::accessible_name" translatable="yes">Add</property>
<object class="AtkObject" id="a11y-add_contact_menu">
<property name="AtkObject::accessible_name" translatable="yes">Add contact</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">start</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="main_menu_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">main_menu_popover</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
<accessibility>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-main_menu_button">
<property name="AtkObject::accessible_name" translatable="yes">Main menu</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
......
......@@ -4,17 +4,18 @@
PACKAGE_DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
subdir('data')
subdir('po')
python3 = import('python3')
conf = configuration_data()
conf.set('PACKAGE_URL', 'https://code.briarproject.org/briar/briar-gtk/blob/master/README.md')
conf.set('PYTHON', python3.find_python().path())
conf.set('VERSION', meson.project_version())
conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('PACKAGE_DATA_DIR', PACKAGE_DATA_DIR)
subdir('data')
subdir('po')
configure_file(
input: 'briar-gtk.in',
output: 'briar-gtk',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment