aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/occupant_menu/view.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/occupant_menu/view.vala
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/occupant_menu/view.vala')
-rw-r--r--main/src/ui/occupant_menu/view.vala44
1 files changed, 21 insertions, 23 deletions
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index 428d2c99..35aa95f4 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -22,15 +22,14 @@ public class View : Popover {
this.stream_interactor = stream_interactor;
this.conversation = conversation;
-
this.show.connect(initialize_list);
- invite_list.add(new ListRow.label("+", _("Invite")) {visible=true});
- list_box.add(invite_list);
+ invite_list.append(new ListRow.label("+", _("Invite")).get_widget());
+ list_box.append(invite_list);
invite_list.row_activated.connect(on_invite_clicked);
stack.add_named(list_box, "list");
- add(stack);
+ set_child(stack);
stack.visible_child_name = "list";
hide.connect(reset);
@@ -46,12 +45,11 @@ public class View : Popover {
private void initialize_list() {
if (list == null) {
list = new List(stream_interactor, conversation) { visible=true };
- list_box.add(list);
- list_box.reorder_child(list, 0);
+ list_box.prepend(list);
list.list_box.row_activated.connect((row) => {
- ListRow list_row = row as ListRow;
- show_menu(list_row.jid, list_row.name_label.label);
+ ListRow row_wrapper = list.row_wrappers[row.get_child()];
+ show_menu(row_wrapper.jid, row_wrapper.name_label.label);
});
}
}
@@ -71,37 +69,37 @@ public class View : Popover {
if (real_jid != null) name += "\n<span font=\'8\'>%s</span>".printf(Markup.escape_text(real_jid.bare_jid.to_string()));
Box header_box = new Box(Orientation.HORIZONTAL, 5) { visible=true };
- header_box.add(new Image.from_icon_name("pan-start-symbolic", IconSize.SMALL_TOOLBAR) { visible=true });
- header_box.add(new Label(name) { xalign=0, use_markup=true, hexpand=true, visible=true });
- Button header_button = new Button() { relief=ReliefStyle.NONE, visible=true };
- header_button.add(header_box);
+ header_box.append(new Image.from_icon_name("pan-start-symbolic") { visible=true });
+ header_box.append(new Label(name) { xalign=0, use_markup=true, hexpand=true, visible=true });
+ Button header_button = new Button() { has_frame=false, visible=true };
+ header_button.child = header_box;
- Box outer_box = new Box(Orientation.VERTICAL, 5) { margin=10, visible=true };
- outer_box.add(header_button);
+ Box outer_box = new Box(Orientation.VERTICAL, 5) { visible=true };
+ outer_box.append(header_button);
header_button.clicked.connect(show_list);
- ModelButton private_button = new ModelButton() { active=true, text=_("Start private conversation"), visible=true };
- outer_box.add(private_button);
+ Button private_button = new Button.with_label(_("Start private conversation")) { visible=true };
+ outer_box.append(private_button);
private_button.clicked.connect(private_conversation_button_clicked);
Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
Xmpp.Xep.Muc.Role? role = stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account);
if (role == Xmpp.Xep.Muc.Role.MODERATOR && stream_interactor.get_module(MucManager.IDENTITY).kick_possible(conversation.account, jid)) {
- ModelButton kick_button = new ModelButton() { active=true, text=_("Kick"), visible=true };
- outer_box.add(kick_button);
+ Button kick_button = new Button.with_label(_("Kick")) { visible=true };
+ outer_box.append(kick_button);
kick_button.clicked.connect(kick_button_clicked);
}
if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) && role == Xmpp.Xep.Muc.Role.MODERATOR){
if (stream_interactor.get_module(MucManager.IDENTITY).get_role(selected_jid, conversation.account) == Xmpp.Xep.Muc.Role.VISITOR) {
- ModelButton voice_button = new ModelButton() { active=true, text=_("Grant write permission"), visible=true };
- outer_box.add(voice_button);
+ Button voice_button = new Button.with_label(_("Grant write permission")) { visible=true };
+ outer_box.append(voice_button);
voice_button.clicked.connect(() =>
voice_button_clicked("participant"));
}
else if (stream_interactor.get_module(MucManager.IDENTITY).get_role(selected_jid, conversation.account) == Xmpp.Xep.Muc.Role.PARTICIPANT){
- ModelButton voice_button = new ModelButton() { active=true, text=_("Revoke write permission"), visible=true };
- outer_box.add(voice_button);
+ Button voice_button = new Button.with_label(_("Revoke write permission")) { visible=true };
+ outer_box.append(voice_button);
voice_button.clicked.connect(() =>
voice_button_clicked("visitor"));
}
@@ -141,7 +139,7 @@ public class View : Popover {
Gee.List<Account> acc_list = new ArrayList<Account>(Account.equals_func);
acc_list.add(conversation.account);
SelectContactDialog add_chat_dialog = new SelectContactDialog(stream_interactor, acc_list);
- add_chat_dialog.set_transient_for((Window) get_toplevel());
+ add_chat_dialog.set_transient_for((Window) get_root());
add_chat_dialog.title = _("Invite to Conference");
add_chat_dialog.ok_button.label = _("Invite");
add_chat_dialog.selected.connect((account, jid) => {