Skip to content
Snippets Groups Projects
Commit 9a3df9d8 authored by Nico's avatar Nico
Browse files

[WIP] Support deleting contacts

Related to #12
parent 584de0d0
No related branches found
No related tags found
No related merge requests found
Pipeline #4751 failed
......@@ -23,6 +23,7 @@ class WindowActions(Actions):
def _setup_actions(self):
self._setup_back_to_sidebar_action()
self._setup_delete_contact_action()
self._setup_open_about_page_action()
self._setup_open_add_contact_action()
self._setup_open_main_window_action()
......@@ -34,6 +35,9 @@ class WindowActions(Actions):
f"{WINDOW_PREFIX}.back-to-sidebar", ["<Ctrl>w"]
)
def _setup_delete_contact_action(self):
self._setup_action("delete-contact", None, self._delete_contact)
def _setup_open_about_page_action(self):
self._setup_action("open-about-dialog", None, self._open_about_page)
......@@ -52,6 +56,10 @@ class WindowActions(Actions):
if isinstance(self.widget.current_container, MainWindowContainer):
self.widget.current_container.show_sidebar()
# pylint: disable=unused-argument
def _delete_contact(self, action, parameter):
print("I should delete that contact now...")
# pylint: disable=unused-argument
def _open_about_page(self, action, parameter):
self.widget.current_container.open_about_page()
......
......@@ -19,7 +19,8 @@ from briar_gtk.widgets.contact_row import ContactRowWidget
class MainWindowContainer(Container):
CONTAINER_UI = "main_window.ui"
MENU_UI = "main_menu.ui"
MAIN_MENU_UI = "main_menu.ui"
CHAT_MENU_UI = "chat_menu.ui"
def __init__(self):
super().__init__()
......@@ -131,7 +132,8 @@ class MainWindowContainer(Container):
del self._selected_contact
def _setup_view(self):
self._add_from_resource(self.MENU_UI)
self._add_from_resource(self.MAIN_MENU_UI)
self._add_from_resource(self.CHAT_MENU_UI)
self._add_from_resource(self.CONTAINER_UI)
self.builder.connect_signals(self)
......
......@@ -3,6 +3,7 @@
<gresource prefix="/app/briar/gtk">
<file compressed="true">application.css</file>
<file compressed="true" preprocess="xml-stripblanks">add_contact.ui</file>
<file compressed="true" preprocess="xml-stripblanks">chat_menu.ui</file>
<file compressed="true" preprocess="xml-stripblanks">login.ui</file>
<file compressed="true" preprocess="xml-stripblanks">main_menu.ui</file>
<file compressed="true" preprocess="xml-stripblanks">main_window.ui</file>
......
<?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="chat_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="delete-menu-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="action_name">win.delete-contact</property>
<property name="text" translatable="yes">Delete contact</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>
......@@ -362,6 +362,33 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuButton" id="chat_menu_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">chat_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-chat_menu_button">
<property name="AtkObject::accessible_name" translatable="yes">Chat menu</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="name">main_content</property>
......
......@@ -91,6 +91,9 @@ msgstr "إضافة جهة إتصال"
msgid "Next"
msgstr "التالي"
msgid "Delete contact"
msgstr ""
msgid "Password"
msgstr "كلمة السّر"
......@@ -122,6 +125,9 @@ msgstr ""
msgid "Back"
msgstr ""
msgid "Chat menu"
msgstr ""
msgid "Welcome to Briar"
msgstr "مرحبًا بك في Briar (براير)"
......
......@@ -101,6 +101,9 @@ msgstr ""
msgid "Next"
msgstr ""
msgid "Delete contact"
msgstr ""
msgid "Password"
msgstr ""
......@@ -132,6 +135,9 @@ msgstr ""
msgid "Back"
msgstr ""
msgid "Chat menu"
msgstr ""
msgid "Welcome to Briar"
msgstr ""
......
......@@ -91,6 +91,9 @@ msgstr "Kontak hinzufügen"
msgid "Next"
msgstr "Weiter"
msgid "Delete contact"
msgstr "Kontakt entfernen"
msgid "Password"
msgstr "Passwort"
......@@ -122,6 +125,9 @@ msgstr "Hauptmenü"
msgid "Back"
msgstr "Zurück"
msgid "Chat menu"
msgstr "Chat-Menü"
msgid "Welcome to Briar"
msgstr "Willkommen bei Briar"
......
......@@ -91,6 +91,9 @@ msgstr "Añadir el contacto"
msgid "Next"
msgstr "Seguir"
msgid "Delete contact"
msgstr "Eliminar contacto"
msgid "Password"
msgstr "Contraseña"
......@@ -122,6 +125,9 @@ msgstr "Menú principal"
msgid "Back"
msgstr "Regresar"
msgid "Chat menu"
msgstr "Menú chat"
msgid "Welcome to Briar"
msgstr "Bienvenida a Briar"
......
Subproject commit e851a46c77350ddce4d21d1112c931438579f131
Subproject commit df60279f98a3d954ebcaaca92192c5078304b666
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment