dino/main/src/ui/conversation_titlebar/occupants_entry.vala

46 lines
1.3 KiB
Vala
Raw Normal View History

2017-08-02 15:29:55 +00:00
using Gtk;
using Dino.Entities;
namespace Dino.Ui {
class OccupantsEntry : Plugins.ConversationTitlebarEntry, Object {
public string id { get { return "occupants"; } }
2022-02-14 13:55:59 +00:00
public double order { get { return 3; } }
2017-08-02 15:29:55 +00:00
StreamInteractor stream_interactor;
2022-02-14 13:55:59 +00:00
private Conversation? conversation;
2017-08-02 15:29:55 +00:00
private MenuButton button = new MenuButton() { icon_name="system-users-symbolic", tooltip_text=Util.string_if_tooltips_active(_("Members")), visible=false };
2017-08-02 15:29:55 +00:00
2017-11-22 20:09:39 +00:00
private OccupantMenu.View menu = null;
2017-08-02 15:29:55 +00:00
2022-02-14 13:55:59 +00:00
public OccupantsEntry(StreamInteractor stream_interactor) {
2017-08-02 15:29:55 +00:00
this.stream_interactor = stream_interactor;
}
public new void set_conversation(Conversation conversation) {
this.conversation = conversation;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
2022-02-14 13:55:59 +00:00
button.visible = true;
OccupantMenu.View new_menu = new OccupantMenu.View(stream_interactor, conversation);
2022-02-14 13:55:59 +00:00
button.set_popover(new_menu);
2017-11-22 20:09:39 +00:00
menu = new_menu;
2022-02-14 13:55:59 +00:00
} else {
button.visible = false;
2017-08-02 15:29:55 +00:00
}
}
public new void unset_conversation() {
2022-02-14 13:55:59 +00:00
button.visible = false;
}
public Object? get_widget(Plugins.WidgetType type) {
if (type != Plugins.WidgetType.GTK4) return null;
return button;
}
2017-08-02 15:29:55 +00:00
}
}