aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-03-21 13:21:05 +0100
committerfiaxh <git@lightrise.org>2024-03-21 13:52:39 +0100
commit2f1b806dfe43a6323d8331a70172f01da88034d7 (patch)
tree23bde7521f0819c7c24f3f4b9c248e31d80df32d /main/src
parent37e81a86dc3f1f10827195c6b3ec275074f0552e (diff)
downloaddino-2f1b806dfe43a6323d8331a70172f01da88034d7.tar.gz
dino-2f1b806dfe43a6323d8331a70172f01da88034d7.zip
Introduce conversation menu, add close option
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_titlebar/menu_entry.vala28
1 files changed, 20 insertions, 8 deletions
diff --git a/main/src/ui/conversation_titlebar/menu_entry.vala b/main/src/ui/conversation_titlebar/menu_entry.vala
index 479a228c..8a3d525f 100644
--- a/main/src/ui/conversation_titlebar/menu_entry.vala
+++ b/main/src/ui/conversation_titlebar/menu_entry.vala
@@ -11,29 +11,41 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
StreamInteractor stream_interactor;
private Conversation? conversation;
- Button button = new Button() { icon_name="view-more-symbolic" };
+ MenuButton button = new MenuButton() { icon_name="view-more-symbolic" };
public MenuEntry(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
- button.clicked.connect(on_clicked);
+ Menu menu_model = new Menu();
+ menu_model.append(_("Conversation Details"), "conversation.details");
+ menu_model.append(_("Close Conversation"), "conversation.close");
+ Gtk.PopoverMenu popover_menu = new Gtk.PopoverMenu.from_model(menu_model);
+ button.popover = popover_menu;
+
+ SimpleActionGroup action_group = new SimpleActionGroup();
+ SimpleAction details_action = new SimpleAction("details", null);
+ details_action.activate.connect((parameter) => {
+ open_conversation_details();
+ });
+ action_group.insert(details_action);
+ SimpleAction close_action = new SimpleAction("close", null);
+ close_action.activate.connect((parameter) => {
+ stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation);
+ });
+ action_group.insert(close_action);
+ button.insert_action_group("conversation", action_group);
}
public new void set_conversation(Conversation conversation) {
button.sensitive = true;
this.conversation = conversation;
- if (conversation.type_ == Conversation.Type.GROUPCHAT) {
- button.tooltip_text = Util.string_if_tooltips_active("Channel details");
- } else {
- button.tooltip_text = Util.string_if_tooltips_active("Conversation details");
- }
}
public new void unset_conversation() {
button.sensitive = false;
}
- private void on_clicked() {
+ private void open_conversation_details() {
var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor, (Window)button.get_root());
conversation_details.present();
}