aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_titlebar/menu_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/menu_entry.vala
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/conversation_titlebar/menu_entry.vala')
-rw-r--r--main/src/ui/conversation_titlebar/menu_entry.vala44
1 files changed, 14 insertions, 30 deletions
diff --git a/main/src/ui/conversation_titlebar/menu_entry.vala b/main/src/ui/conversation_titlebar/menu_entry.vala
index 9b3b6ee2..28a06c24 100644
--- a/main/src/ui/conversation_titlebar/menu_entry.vala
+++ b/main/src/ui/conversation_titlebar/menu_entry.vala
@@ -6,58 +6,42 @@ namespace Dino.Ui {
class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
public string id { get { return "menu"; } }
-
- StreamInteractor stream_interactor;
- MenuWidget widget;
-
- public MenuEntry(StreamInteractor stream_interactor) {
- this.stream_interactor = stream_interactor;
- }
-
public double order { get { return 0; } }
- public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) {
- if (type == Plugins.WidgetType.GTK) {
- if (widget == null) {
- widget = new MenuWidget(stream_interactor) { visible=true, sensitive=false };
- }
- return widget;
- }
- return null;
- }
-}
-class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
-
- private StreamInteractor stream_interactor;
+ StreamInteractor stream_interactor;
private Conversation? conversation;
- public MenuWidget(StreamInteractor stream_interactor) {
+ Button button = new Button() { icon_name="open-menu-symbolic" };
+
+ public MenuEntry(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
- image = new Image.from_icon_name("open-menu-symbolic", IconSize.MENU);
- clicked.connect(on_clicked);
+ button.clicked.connect(on_clicked);
}
public new void set_conversation(Conversation conversation) {
- this.sensitive = true;
+ button.sensitive = true;
this.conversation = conversation;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
- tooltip_text = "Channel details";
+ button.tooltip_text = "Channel details";
} else {
- tooltip_text = "Conversation details";
+ button.tooltip_text = "Conversation details";
}
}
public new void unset_conversation() {
- this.sensitive = false;
+ button.sensitive = false;
}
private void on_clicked() {
ContactDetails.Dialog contact_details_dialog = new ContactDetails.Dialog(stream_interactor, conversation);
- contact_details_dialog.set_transient_for((Window) get_toplevel());
+ contact_details_dialog.set_transient_for((Window) button.get_root());
contact_details_dialog.present();
}
+ public Object? get_widget(Plugins.WidgetType type) {
+ if (type != Plugins.WidgetType.GTK4) return null;
+ return button;
+ }
}
-
}