aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_titlebar/occupants_entry.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-14 14:55:59 +0100
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commit7e7dcedaf31ee35499875491c9f569c575d28435 (patch)
tree0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/conversation_titlebar/occupants_entry.vala
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/conversation_titlebar/occupants_entry.vala')
-rw-r--r--main/src/ui/conversation_titlebar/occupants_entry.vala42
1 files changed, 14 insertions, 28 deletions
diff --git a/main/src/ui/conversation_titlebar/occupants_entry.vala b/main/src/ui/conversation_titlebar/occupants_entry.vala
index a316be20..5c0da99b 100644
--- a/main/src/ui/conversation_titlebar/occupants_entry.vala
+++ b/main/src/ui/conversation_titlebar/occupants_entry.vala
@@ -6,53 +6,39 @@ namespace Dino.Ui {
class OccupantsEntry : Plugins.ConversationTitlebarEntry, Object {
public string id { get { return "occupants"; } }
+ public double order { get { return 3; } }
StreamInteractor stream_interactor;
- OccupantsWidget widget;
-
- public OccupantsEntry(StreamInteractor stream_interactor) {
- this.stream_interactor = stream_interactor;
- }
-
- public double order { get { return 3; } }
- public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) {
- if (type == Plugins.WidgetType.GTK) {
- if (widget == null) {
- widget = new OccupantsWidget(stream_interactor);
- }
- return widget;
- }
- return null;
- }
-}
+ private Conversation? conversation;
-class OccupantsWidget : MenuButton, Plugins.ConversationTitlebarWidget {
+ private MenuButton button = new MenuButton() { icon_name="system-users-symbolic", tooltip_text=_("Members") };
- private Conversation? conversation;
- private StreamInteractor stream_interactor;
private OccupantMenu.View menu = null;
- public OccupantsWidget(StreamInteractor stream_interactor) {
- image = new Image.from_icon_name("system-users-symbolic", IconSize.MENU);
- tooltip_text = _("Members");
-
+ public OccupantsEntry(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
- set_use_popover(true);
}
public new void set_conversation(Conversation conversation) {
this.conversation = conversation;
- visible = conversation.type_ == Conversation.Type.GROUPCHAT;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
+ button.visible = true;
OccupantMenu.View new_menu = new OccupantMenu.View(stream_interactor, conversation);
- set_popover(new_menu);
+ button.set_popover(new_menu);
menu = new_menu;
+ } else {
+ button.visible = false;
}
}
public new void unset_conversation() {
- visible = false;
+ button.visible = false;
+ }
+
+ public Object? get_widget(Plugins.WidgetType type) {
+ if (type != Plugins.WidgetType.GTK4) return null;
+ return button;
}
}