Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2023-01-08 20:04:25 +0300
committerwurstsalat <mailtrash@posteo.de>2023-01-08 20:09:18 +0300
commitdddfbac32f9055247f1f9045b07a86d8f9cbc4c8 (patch)
treebf9176ab4dfbd098ea7bce8ec7833eff8e0c1ba3
parentb3d1d8cbb9346b252c501283e6096356e40f34e5 (diff)
imprv: AccountPage: Make all account menu items available
Fixes #11329
-rw-r--r--gajim/data/gui/account_page.ui167
-rw-r--r--gajim/gtk/account_page.py33
-rw-r--r--gajim/gtk/builder.pyi7
3 files changed, 85 insertions, 122 deletions
diff --git a/gajim/data/gui/account_page.ui b/gajim/data/gui/account_page.ui
index 4187d4ce4..a06752bd9 100644
--- a/gajim/data/gui/account_page.ui
+++ b/gajim/data/gui/account_page.ui
@@ -138,38 +138,11 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkOverlay">
+ <object class="GtkImage" id="avatar_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="halign">center</property>
- <child>
- <object class="GtkImage" id="avatar_image">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">missging-image</property>
- <property name="icon_size">6</property>
- </object>
- <packing>
- <property name="index">-1</property>
- </packing>
- </child>
- <child type="overlay">
- <object class="GtkButton" id='edit_profile_button'>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="tooltip-text" translatable="yes">Edit Profile…</property>
- <property name="halign">end</property>
- <property name="valign">start</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">document-edit-symbolic</property>
- </object>
- </child>
- </object>
- </child>
+ <property name="icon-name">missging-image</property>
+ <property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
@@ -178,69 +151,81 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="account_label">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="label">&lt;name&gt;</property>
- <style>
- <class name="large-header"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="account_action_box">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">center</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="tooltip-text" translatable="yes">Account Settings…</property>
- <property name="halign">end</property>
- <signal name="clicked" handler="_on_account_settings" swapped="no"/>
- <child>
- <object class="GtkImage">
+ <property name="spacing">18</property>
+ <child type="center">
+ <object class="GtkLabel" id="account_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="icon-name">preferences-other-symbolic</property>
+ <property name="label">&lt;name&gt;</property>
+ <style>
+ <class name="large-header"/>
+ </style>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="adhoc_commands_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="tooltip-text" translatable="yes">Execute Command…</property>
- <signal name="clicked" handler="_on_adhoc_commands" swapped="no"/>
<child>
- <object class="GtkImage">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="icon-name">utilities-terminal-symbolic</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="tooltip-text" translatable="yes">Account Settings…</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="_on_account_settings" swapped="no"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">preferences-other-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="account_page_menu_button">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">view-more-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>
@@ -249,21 +234,23 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="status_message_box">
+ <object class="GtkBox" id="status_box">
<property name="visible">True</property>
<property name="can-focus">False</property>
+ <property name="halign">center</property>
<property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <placeholder/>
+ </child>
<child>
<placeholder/>
</child>
@@ -271,7 +258,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -287,7 +274,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
diff --git a/gajim/gtk/account_page.py b/gajim/gtk/account_page.py
index 0b6eb709e..2bf1e557e 100644
--- a/gajim/gtk/account_page.py
+++ b/gajim/gtk/account_page.py
@@ -15,24 +15,20 @@
from __future__ import annotations
from typing import Any
-from typing import Union
from gi.repository import Gdk
-from gi.repository import GLib
from gi.repository import Gtk
-from nbxmpp.protocol import JID
from gajim.common import app
from gajim.common import ged
from gajim.common.const import AvatarSize
-from gajim.common.events import AccountConnected
-from gajim.common.events import AccountDisconnected
from gajim.common.events import MucDecline
from gajim.common.events import MucInvitation
from gajim.common.events import SubscribePresenceReceived
from gajim.common.events import UnsubscribedPresenceReceived
from gajim.gtk.builder import get_builder
+from gajim.gtk.menus import get_account_menu
from gajim.gtk.menus import get_roster_view_menu
from gajim.gtk.notification_manager import NotificationManager
from gajim.gtk.roster import Roster
@@ -58,11 +54,11 @@ class AccountPage(Gtk.Box, EventHelper):
self._status_selector = StatusSelector(account=account)
self._status_selector.set_halign(Gtk.Align.CENTER)
- self._ui.account_action_box.add(self._status_selector)
+ self._ui.status_box.add(self._status_selector)
self._status_message_selector = StatusMessageSelector(account=account)
self._status_message_selector.set_halign(Gtk.Align.CENTER)
- self._ui.status_message_box.add(self._status_message_selector)
+ self._ui.status_box.add(self._status_message_selector)
self._notification_manager = NotificationManager(account)
self._ui.account_box.add(self._notification_manager)
@@ -74,11 +70,8 @@ class AccountPage(Gtk.Box, EventHelper):
self._ui.paned.connect('button-release-event', self._on_button_release)
self._ui.roster_menu_button.set_menu_model(get_roster_view_menu())
-
- self._ui.edit_profile_button.set_action_name(
- f'app.{self._account}-profile')
- self._ui.edit_profile_button.set_action_target_value(
- GLib.Variant('s', self._account))
+ self._ui.account_page_menu_button.set_menu_model(
+ get_account_menu(account))
self._ui.connect_signals(self)
@@ -94,8 +87,6 @@ class AccountPage(Gtk.Box, EventHelper):
ged.GUI1, self._unsubscribed_received),
('muc-invitation', ged.GUI1, self._muc_invitation_received),
('muc-decline', ged.GUI1, self._muc_invitation_declined),
- ('account-connected', ged.GUI2, self._on_account_state),
- ('account-disconnected', ged.GUI2, self._on_account_state),
])
# pylint: enable=line-too-long
@@ -116,20 +107,6 @@ class AccountPage(Gtk.Box, EventHelper):
window = open_window('AccountsWindow')
window.select_account(self._account)
- def _on_adhoc_commands(self, _button: Gtk.Button) -> None:
- server_jid = JID.from_string(self._jid).domain
- open_window('AdHocCommands', account=self._account, jid=server_jid)
-
- def _on_account_state(self,
- event: Union[AccountConnected, AccountDisconnected]
- ) -> None:
-
- if event.account != self._account:
- return
-
- self._ui.adhoc_commands_button.set_sensitive(
- app.account_is_connected(event.account))
-
def _on_search_changed(self, widget: Gtk.SearchEntry) -> None:
text = widget.get_text().lower()
self._roster.set_search_string(text)
diff --git a/gajim/gtk/builder.pyi b/gajim/gtk/builder.pyi
index cb7a78f72..e0ec82ecf 100644
--- a/gajim/gtk/builder.pyi
+++ b/gajim/gtk/builder.pyi
@@ -6,6 +6,7 @@ from gi.repository import Atk
from gi.repository import Gtk
from gi.repository import GtkSource
+
class Builder(Gtk.Builder):
...
@@ -17,11 +18,9 @@ class AccountPageBuilder(Builder):
roster_search_entry: Gtk.SearchEntry
account_box: Gtk.Box
avatar_image: Gtk.Image
- edit_profile_button: Gtk.Button
account_label: Gtk.Label
- account_action_box: Gtk.Box
- adhoc_commands_button: Gtk.Button
- status_message_box: Gtk.Box
+ account_page_menu_button: Gtk.MenuButton
+ status_box: Gtk.Box
class AccountWizardBuilder(Builder):