2017-08-02 15:29:55 +00:00
|
|
|
using Gtk;
|
|
|
|
|
|
|
|
using Dino.Entities;
|
|
|
|
|
|
|
|
namespace Dino.Ui {
|
|
|
|
|
2017-05-04 20:05:48 +00:00
|
|
|
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
|
|
|
|
2022-12-25 17:04:26 +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;
|
2019-01-27 14:24:58 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2019-09-30 00:11:23 +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;
|
2019-09-30 00:11:23 +00:00
|
|
|
}
|
2017-08-02 15:29:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|