diff options
author | fiaxh <git@lightrise.org> | 2022-02-14 14:55:59 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-07-27 20:34:20 +0200 |
commit | 7e7dcedaf31ee35499875491c9f569c575d28435 (patch) | |
tree | 0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/contact_details | |
parent | f25bfb00969a7e09996da2d5500e6718f4cc0148 (diff) | |
download | dino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip |
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/contact_details')
5 files changed, 27 insertions, 26 deletions
diff --git a/main/src/ui/contact_details/blocking_provider.vala b/main/src/ui/contact_details/blocking_provider.vala index bf59a083..76e5d000 100644 --- a/main/src/ui/contact_details/blocking_provider.vala +++ b/main/src/ui/contact_details/blocking_provider.vala @@ -14,7 +14,7 @@ public class BlockingProvider : Plugins.ContactDetailsProvider, Object { } public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) { - if (type != Plugins.WidgetType.GTK) return; + if (type != Plugins.WidgetType.GTK4) return; if (conversation.type_ != Conversation.Type.CHAT) return; if (stream_interactor.get_module(BlockingManager.IDENTITY).is_supported(conversation.account)) { diff --git a/main/src/ui/contact_details/dialog.vala b/main/src/ui/contact_details/dialog.vala index f29d068e..b07ab9c9 100644 --- a/main/src/ui/contact_details/dialog.vala +++ b/main/src/ui/contact_details/dialog.vala @@ -37,7 +37,7 @@ public class Dialog : Gtk.Dialog { title = conversation.type_ == Conversation.Type.GROUPCHAT ? _("Conference Details") : _("Contact Details"); if (Util.use_csd()) { // TODO get_header_bar directly returns a HeaderBar in vala > 0.48 - ((HeaderBar) get_header_bar()).set_subtitle(Util.get_conversation_display_name(stream_interactor, conversation)); +// ((HeaderBar) get_header_bar()).set_subtitle(Util.get_conversation_display_name(stream_interactor, conversation)); } setup_top(); @@ -50,23 +50,24 @@ public class Dialog : Gtk.Dialog { app.plugin_registry.register_contact_details_entry(new PermissionsProvider(stream_interactor)); foreach (Plugins.ContactDetailsProvider provider in app.plugin_registry.contact_details_entries) { - provider.populate(conversation, contact_details, Plugins.WidgetType.GTK); + provider.populate(conversation, contact_details, Plugins.WidgetType.GTK4); } - destroy.connect(() => { - contact_details.save(); - }); +// destroy.connect(() => { +// contact_details.save(); +// }); } private void setup_top() { if (conversation.type_ == Conversation.Type.CHAT) { name_label.visible = false; - jid_label.margin_start = new Button().get_style_context().get_padding(StateFlags.NORMAL).left + 1; + jid_label.margin_start = new Button().get_style_context().get_padding().left + 1; name_hybrid.text = Util.get_conversation_display_name(stream_interactor, conversation); - destroy.connect(() => { + close_request.connect(() => { if (name_hybrid.text != Util.get_conversation_display_name(stream_interactor, conversation)) { stream_interactor.get_module(RosterManager.IDENTITY).set_jid_handle(conversation.account, conversation.counterpart, name_hybrid.text); } + return false; }); } else { name_hybrid.visible = false; @@ -84,18 +85,18 @@ public class Dialog : Gtk.Dialog { ListBoxRow list_row = new ListBoxRow() { activatable=false, visible=true }; Box row = new Box(Orientation.HORIZONTAL, 20) { margin_start=15, margin_end=15, margin_top=3, margin_bottom=3, visible=true }; - list_row.add(row); + list_row.set_child(row); Label label_label = new Label(label) { xalign=0, yalign=0.5f, hexpand=true, visible=true }; if (description != null && description != "") { Box box = new Box(Orientation.VERTICAL, 0) { visible=true }; - box.add(label_label); + box.append(label_label); Label desc_label = new Label("") { xalign=0, yalign=0.5f, hexpand=true, visible=true }; desc_label.set_markup("<span size='small'>%s</span>".printf(Markup.escape_text(description))); desc_label.get_style_context().add_class("dim-label"); - box.add(desc_label); - row.add(box); + box.append(desc_label); + row.append(box); } else { - row.add(label_label); + row.append(label_label); } Widget widget = w; @@ -112,13 +113,13 @@ public class Dialog : Gtk.Dialog { widget.margin_top = 5; - row.add(widget); - categories[category].add(list_row); + row.append(widget); + categories[category].append(list_row); int pref_height, pref_width; - get_content_area().get_preferred_height(null, out pref_height); - get_preferred_width(out pref_width, null); - resize(pref_width, int.min(500, pref_height)); +// get_content_area().get_preferred_height(null, out pref_height); +// get_preferred_width(out pref_width, null); +// resize(pref_width, int.min(500, pref_height)); } private void add_category(string category) { @@ -133,11 +134,11 @@ public class Dialog : Gtk.Dialog { Box box = new Box(Orientation.VERTICAL, 5) { margin_top=12, margin_bottom=12, visible=true }; Label category_label = new Label("") { xalign=0, visible=true }; category_label.set_markup(@"<b>$(Markup.escape_text(category))</b>"); - box.add(category_label); + box.append(category_label); Frame frame = new Frame(null) { visible=true }; - frame.add(list_box); - box.add(frame); - main_box.add(box); + frame.set_child(list_box); + box.append(frame); + main_box.append(box); } } } diff --git a/main/src/ui/contact_details/muc_config_form_provider.vala b/main/src/ui/contact_details/muc_config_form_provider.vala index 5b4184c5..1244a759 100644 --- a/main/src/ui/contact_details/muc_config_form_provider.vala +++ b/main/src/ui/contact_details/muc_config_form_provider.vala @@ -15,7 +15,7 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider, Object { } public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) { - if (type != Plugins.WidgetType.GTK) return; + if (type != Plugins.WidgetType.GTK4) return; if (conversation.type_ == Conversation.Type.GROUPCHAT) { Xmpp.XmppStream? stream = stream_interactor.get_stream(conversation.account); if (stream == null) return; diff --git a/main/src/ui/contact_details/permissions_provider.vala b/main/src/ui/contact_details/permissions_provider.vala index 1fd460ad..d87658ff 100644 --- a/main/src/ui/contact_details/permissions_provider.vala +++ b/main/src/ui/contact_details/permissions_provider.vala @@ -14,13 +14,13 @@ public class PermissionsProvider : Plugins.ContactDetailsProvider, Object { } public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) { - if (type != Plugins.WidgetType.GTK) return; + if (type != Plugins.WidgetType.GTK4) return; Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); if (own_jid == null) return; if (stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account) == Xmpp.Xep.Muc.Role.VISITOR){ - Button voice_request = new Button() {visible=true, label=_("Request")}; + Button voice_request = new Button.with_label(_("Request")) { visible=true }; voice_request.clicked.connect(()=>stream_interactor.get_module(MucManager.IDENTITY).request_voice(conversation.account, conversation.counterpart)); contact_details.add(_("Permissions"), _("Request permission to send messages"), "", voice_request); } diff --git a/main/src/ui/contact_details/settings_provider.vala b/main/src/ui/contact_details/settings_provider.vala index 262029a2..42c690e5 100644 --- a/main/src/ui/contact_details/settings_provider.vala +++ b/main/src/ui/contact_details/settings_provider.vala @@ -17,7 +17,7 @@ public class SettingsProvider : Plugins.ContactDetailsProvider, Object { } public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) { - if (type != Plugins.WidgetType.GTK) return; + if (type != Plugins.WidgetType.GTK4) return; if (!stream_interactor.get<MucManager>().is_public_room(conversation.account, conversation.counterpart)) { string details_headline = conversation.type_ == Conversation.Type.GROUPCHAT ? DETAILS_HEADLINE_ROOM : DETAILS_HEADLINE_CHAT; |