file_data_unregister_notify_func(bar_pane_comment_notify_cb, pcd);
#if HAVE_SPELL
- g_object_unref(pcd->gspell_view);
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(pcd->comment_view)), pcd->comment_view);
#endif
file_data_unref(pcd->fd);
g_free(pcd->key);
gboolean horizontal = !ee->editable;
gboolean editable = ee->editable;
- if (ee->box) g_object_unref(ee->box);
+ if (ee->box)
+ {
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(ee->box)), ee->box);
+ }
ee->box = horizontal ? gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gq_gtk_container_add(GTK_WIDGET(ee->ebox), ee->box);
static void bar_pane_exif_delete_entry_cb(GtkWidget *, gpointer data)
{
auto entry = static_cast<GtkWidget *>(data);
- g_object_unref(entry);
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(entry)), entry);
}
#if HAVE_GTK4
#include "ui-menu.h"
#include "ui-misc.h"
+
+namespace
+{
+
+void remove_child_from_parent(gpointer data)
+{
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(GTK_WIDGET(data))), GTK_WIDGET(data));
+}
+
+}
+
struct KnownPanes
{
PaneType type;
{
if ((keyval == GDK_KEY_Return || keyval == GDK_KEY_Escape))
{
- g_object_unref(GTK_WIDGET(data));
+ gq_gtk_widget_destroy(GTK_WIDGET(data));
}
}
static void bar_expander_delete_cb(GtkWidget *, gpointer data)
{
auto expander = static_cast<GtkWidget *>(data);
- g_object_unref(expander);
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(expander)), expander);
}
static void bar_expander_add_cb(GtkWidget *widget, gpointer)
list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
- g_list_free_full(list, reinterpret_cast<GDestroyNotify>(g_object_unref));
+ g_list_free_full(list, reinterpret_cast<GDestroyNotify>(remove_child_from_parent));
}
void bar_write_config(GtkWidget *bar, GString *outstr, gint indent)
{
g_signal_handlers_disconnect_matched(G_OBJECT(ct->popup), G_SIGNAL_MATCH_DATA,
0, 0, nullptr, nullptr, ct);
- g_object_unref(ct->popup);
+ gq_gtk_widget_destroy(ct->popup);
}
if (ct->sync_idle_id) g_source_remove(ct->sync_idle_id);
if (imd->frame)
{
gtk_container_remove(GTK_CONTAINER(imd->frame), imd->pr);
- g_object_unref(imd->frame);
+ gtk_container_remove(GTK_CONTAINER(imd->widget), imd->frame);
imd->frame = nullptr;
}
gq_gtk_box_pack_start(GTK_BOX(imd->widget), imd->pr, TRUE, TRUE, 0);
/** @todo (xsdg): Fix filter element pointed object memory leak. */
ui->filter_elements = g_list_delete_link(ui->filter_elements, cb_state->filter_element);
- g_object_unref(GTK_WIDGET(widget));
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(GTK_WIDGET(widget))), GTK_WIDGET(widget));
g_free(cb_state);
pan_filter_status(pw, _("Removed keyword…"));
parent = gtk_widget_get_parent(ui->filter_button_arrow);
- g_object_unref(ui->filter_button_arrow);
+ gtk_container_remove(GTK_CONTAINER(parent), ui->filter_button_arrow);
ui->filter_button_arrow = gtk_image_new_from_icon_name(GQ_ICON_PAN_UP, GTK_ICON_SIZE_BUTTON);
gq_gtk_box_pack_start(GTK_BOX(parent), ui->filter_button_arrow, FALSE, FALSE, 0);
parent = gtk_widget_get_parent(ui->filter_button_arrow);
- g_object_unref(ui->filter_button_arrow);
+ gtk_container_remove(GTK_CONTAINER(parent), ui->filter_button_arrow);
ui->filter_button_arrow = gtk_image_new_from_icon_name(GQ_ICON_PAN_DOWN, GTK_ICON_SIZE_BUTTON);
gq_gtk_box_pack_start(GTK_BOX(parent), ui->filter_button_arrow, FALSE, FALSE, 0);
parent = gtk_widget_get_parent(ui->search_button_arrow);
- g_object_unref(ui->search_button_arrow);
+ gtk_container_remove(GTK_CONTAINER(parent), ui->search_button_arrow);
ui->search_button_arrow = gtk_image_new_from_icon_name(GQ_ICON_PAN_UP, GTK_ICON_SIZE_BUTTON);
gq_gtk_box_pack_start(GTK_BOX(parent), ui->search_button_arrow, FALSE, FALSE, 0);
parent = gtk_widget_get_parent(ui->search_button_arrow);
- g_object_unref(ui->search_button_arrow);
+ gtk_container_remove(GTK_CONTAINER(parent), ui->search_button_arrow);
ui->search_button_arrow = gtk_image_new_from_icon_name(GQ_ICON_PAN_DOWN, GTK_ICON_SIZE_BUTTON);
gq_gtk_box_pack_start(GTK_BOX(parent), ui->search_button_arrow, FALSE, FALSE, 0);
g_free(font);
}
- g_object_unref(dialog);
+ gq_gtk_widget_destroy(GTK_WIDGET(dialog));
}
static void image_overlay_set_font_cb(GtkWidget *widget, gpointer)
c_options->image_overlay.text_alpha = color.alpha * 255;
}
- g_object_unref(dialog);
+ gq_gtk_widget_destroy(GTK_WIDGET(dialog));
}
static void image_overlay_set_text_color_cb(GtkWidget *widget, gpointer)
gtk_widget_hide(ds->window);
- g_object_unref(ds->window);
+ gq_gtk_widget_destroy(ds->window);
ds->window = nullptr;
ds->calendar = nullptr;
if (appimage_data->window)
{
- g_object_unref(appimage_data->window);
+ gq_gtk_widget_destroy(appimage_data->window);
}
g_thread_pool_free(appimage_data->thread_pool, TRUE, TRUE);
static void file_util_details_dialog_close_cb(GtkWidget *, gpointer data)
{
- g_object_unref(GTK_WIDGET(data));
-
+ gq_gtk_widget_destroy(GTK_WIDGET(data));
}
static void file_util_details_dialog_destroy_cb(GtkWidget *widget, gpointer data)
{
g_signal_handlers_disconnect_matched(G_OBJECT(vd->popup), G_SIGNAL_MATCH_DATA,
0, 0, nullptr, nullptr, vd);
- g_object_unref(vd->popup);
+ gq_gtk_widget_destroy(vd->popup);
}
switch (vd->type)
static void tip_hide(ViewFile *vf)
{
- if (VFICON(vf)->tip_window) g_object_unref(VFICON(vf)->tip_window);
+ if (VFICON(vf)->tip_window) gq_gtk_widget_destroy(VFICON(vf)->tip_window);
VFICON(vf)->tip_window = nullptr;
}
{
g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA,
0, 0, nullptr, nullptr, vf);
- g_object_unref(vf->popup);
+ gq_gtk_widget_destroy(vf->popup);
}
if (vf->read_metadata_in_idle_id)