aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-02-10 18:32:39 -0600
committerfiaxh <git@lightrise.org>2021-02-10 18:32:39 -0600
commit0626bad8e9c2f7dfd4d8eccc86ec1e8bec6c7308 (patch)
tree8d0d550dc8b07ae05c30dce279243b00dd77b4b6
parentad031ee33366aefc003ed3cac3a74079d963bfe9 (diff)
downloaddino-0626bad8e9c2f7dfd4d8eccc86ec1e8bec6c7308.tar.gz
dino-0626bad8e9c2f7dfd4d8eccc86ec1e8bec6c7308.zip
Reduce use of Widget.destroy()
On non-toplevel windows, use Container.remove() instead of Widget.destroy() Needed for migration to GTK4 https://developer.gnome.org/gtk4/unstable/gtk-migrating-3-to-4.html#id-1.7.4.3.17
-rw-r--r--main/src/ui/add_conversation/conference_list.vala2
-rw-r--r--main/src/ui/add_conversation/select_jid_fragment.vala2
-rw-r--r--main/src/ui/conversation_content_view/conversation_item_skeleton.vala2
-rw-r--r--main/src/ui/conversation_content_view/conversation_view.vala9
-rw-r--r--main/src/ui/conversation_titlebar/occupants_entry.vala1
-rw-r--r--main/src/ui/conversation_view.vala2
-rw-r--r--main/src/ui/global_search.vala2
-rw-r--r--main/src/ui/manage_accounts/add_account_dialog.vala2
-rw-r--r--main/src/ui/manage_accounts/dialog.vala2
-rw-r--r--main/src/ui/occupant_menu/view.vala2
10 files changed, 12 insertions, 14 deletions
diff --git a/main/src/ui/add_conversation/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala
index f18a89d5..fa71f98f 100644
--- a/main/src/ui/add_conversation/conference_list.vala
+++ b/main/src/ui/add_conversation/conference_list.vala
@@ -49,7 +49,7 @@ protected class ConferenceList : FilterableList {
private void remove_conference(Account account, Jid jid) {
if (widgets.has_key(account) && widgets[account].has_key(jid)) {
- widgets[account][jid].destroy();
+ remove(widgets[account][jid]);
widgets[account].unset(jid);
}
}
diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala
index f0170cfb..2035b14b 100644
--- a/main/src/ui/add_conversation/select_jid_fragment.vala
+++ b/main/src/ui/add_conversation/select_jid_fragment.vala
@@ -48,7 +48,7 @@ public class SelectJidFragment : Gtk.Box {
public void set_filter(string str) {
if (entry.text != str) entry.text = str;
- foreach (AddListRow row in added_rows) row.destroy();
+ foreach (AddListRow row in added_rows) filterable_list.remove(row);
added_rows.clear();
string[] ? values = str == "" ? null : str.split(" ");
diff --git a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
index c3db09e0..96a2368a 100644
--- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
+++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
@@ -164,7 +164,7 @@ public class ItemMetaDataHeader : Box {
this.reorder_child(unencrypted_image, 3);
Util.force_error_color(unencrypted_image);
} else if (conversation.encryption == Encryption.NONE && unencrypted_image != null) {
- unencrypted_image.destroy();
+ this.remove(unencrypted_image);
unencrypted_image = null;
}
}
diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala
index 70b16bd9..9eb18cfd 100644
--- a/main/src/ui/conversation_content_view/conversation_view.vala
+++ b/main/src/ui/conversation_content_view/conversation_view.vala
@@ -318,9 +318,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
private void remove_item(Plugins.MetaConversationItem item) {
ConversationItemSkeleton? skeleton = item_item_skeletons[item];
if (skeleton != null) {
- widgets[item].destroy();
+ main.remove(skeleton);
widgets.unset(item);
- skeleton.destroy();
item_skeletons.remove(skeleton);
item_item_skeletons.unset(item);
@@ -356,7 +355,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
public void remove_notification(Widget widget) {
notification_revealer.reveal_child = false;
- widget.destroy();
+ notifications.remove(widget);
}
private Widget insert_new(Plugins.MetaConversationItem item) {
@@ -484,11 +483,11 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
item_skeletons.clear();
item_item_skeletons.clear();
widgets.clear();
- main.@foreach((widget) => { widget.destroy(); });
+ main.@foreach((widget) => { main.remove(widget); });
}
private void clear_notifications() {
- notifications.@foreach((widget) => { widget.destroy(); });
+ notifications.@foreach((widget) => { notifications.remove(widget); });
notification_revealer.transition_duration = 0;
notification_revealer.set_reveal_child(false);
}
diff --git a/main/src/ui/conversation_titlebar/occupants_entry.vala b/main/src/ui/conversation_titlebar/occupants_entry.vala
index facaa50f..a316be20 100644
--- a/main/src/ui/conversation_titlebar/occupants_entry.vala
+++ b/main/src/ui/conversation_titlebar/occupants_entry.vala
@@ -47,7 +47,6 @@ class OccupantsWidget : MenuButton, Plugins.ConversationTitlebarWidget {
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
OccupantMenu.View new_menu = new OccupantMenu.View(stream_interactor, conversation);
set_popover(new_menu);
- if (menu != null) menu.destroy();
menu = new_menu;
}
}
diff --git a/main/src/ui/conversation_view.vala b/main/src/ui/conversation_view.vala
index 2b93e36d..53f1c4c8 100644
--- a/main/src/ui/conversation_view.vala
+++ b/main/src/ui/conversation_view.vala
@@ -29,7 +29,7 @@ public class ConversationView : Gtk.Overlay {
white_revealer.visible = true;
white_revealer.reveal_child = true;
widget.destroy.connect(() => {
- revealer.destroy();
+ revealer.destroy(); // GTK4: this.remove_overlay(revealer);
white_revealer.reveal_child = false;
chat_input.do_focus();
});
diff --git a/main/src/ui/global_search.vala b/main/src/ui/global_search.vala
index 27ffb9d9..c64845e4 100644
--- a/main/src/ui/global_search.vala
+++ b/main/src/ui/global_search.vala
@@ -118,7 +118,7 @@ public class GlobalSearch : Overlay {
}
private void clear_search() {
- results_box.@foreach((widget) => { widget.destroy(); });
+ results_box.@foreach((widget) => { results_box.remove(widget); });
loaded_results = 0;
}
diff --git a/main/src/ui/manage_accounts/add_account_dialog.vala b/main/src/ui/manage_accounts/add_account_dialog.vala
index 57c624ad..339b880f 100644
--- a/main/src/ui/manage_accounts/add_account_dialog.vala
+++ b/main/src/ui/manage_accounts/add_account_dialog.vala
@@ -329,7 +329,7 @@ public class AddAccountDialog : Gtk.Dialog {
}
private void set_register_form(Jid server, Xep.InBandRegistration.Form form) {
- form_box.foreach((widget) => { widget.destroy(); });
+ form_box.foreach((widget) => { form_box.remove(widget); });
register_title.label = _("Register on %s").printf(server.to_string());
if (form.oob != null) {
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
index 568b7ff4..f7af5159 100644
--- a/main/src/ui/manage_accounts/dialog.vala
+++ b/main/src/ui/manage_accounts/dialog.vala
@@ -128,7 +128,7 @@ public class Dialog : Gtk.Dialog {
ok_button.label = _("Remove");
ok_button.get_style_context().add_class("destructive-action");
if (msg.run() == Gtk.ResponseType.OK) {
- account_item.destroy();
+ account_list.remove(account_item);
if (account_item.account.enabled) account_disabled(account_item.account);
account_item.account.remove();
if (account_list.get_row_at_index(0) != null) {
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index 14955416..4675dca4 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -119,7 +119,7 @@ public class View : Popover {
}
- if (jid_menu != null) jid_menu.destroy();
+ if (jid_menu != null) stack.remove(jid_menu);
stack.add_named(outer_box, "menu");
stack.visible_child_name = "menu";
jid_menu = outer_box;