blob: 8a3d525fe550b5c58064ca78b710ed13cde9d4d9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
using Gtk;
using Dino.Entities;
namespace Dino.Ui {
class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
public string id { get { return "menu"; } }
public double order { get { return 0; } }
StreamInteractor stream_interactor;
private Conversation? conversation;
MenuButton button = new MenuButton() { icon_name="view-more-symbolic" };
public MenuEntry(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
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;
}
public new void unset_conversation() {
button.sensitive = false;
}
private void open_conversation_details() {
var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor, (Window)button.get_root());
conversation_details.present();
}
public Object? get_widget(Plugins.WidgetType type) {
if (type != Plugins.WidgetType.GTK4) return null;
return button;
}
}
}
|