treewide: Dispose and layout manager implementations
https://docs.gtk.org/gtk4/migrating-3to4.html#adapt-to-gtkcontainer-removal Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
struct _CallsContactsBox {
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *child;
|
||||
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *contacts_frame;
|
||||
GtkWidget *contacts_listbox;
|
||||
@@ -160,16 +162,33 @@ contacts_sort_func (CallsContactsRow *a,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_contacts_box_dispose (GObject *object)
|
||||
{
|
||||
CallsContactsBox *self = CALLS_CONTACTS_BOX (object);
|
||||
|
||||
GtkWidget *child = self->child;
|
||||
|
||||
g_clear_pointer (&child, gtk_widget_unparent);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_contacts_box_class_init (CallsContactsBoxClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = calls_contacts_box_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/contacts-box.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsContactsBox, child);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsContactsBox, contacts_listbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsContactsBox, contacts_frame);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsContactsBox, search_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsContactsBox, placeholder_empty);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type(widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -226,11 +226,14 @@ static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
CallsHistoryBox *self = CALLS_HISTORY_BOX (object);
|
||||
GtkWidget *stack = GTK_WIDGET (self->stack);
|
||||
|
||||
g_clear_signal_handler (&self->model_changed_handler_id, self->model);
|
||||
g_clear_object (&self->slice_model);
|
||||
g_clear_object (&self->model);
|
||||
|
||||
g_clear_pointer (&stack, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (calls_history_box_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -259,6 +262,8 @@ calls_history_box_class_init (CallsHistoryBoxClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, history);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, scrolled_window);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type(widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -95,6 +95,19 @@ calls_in_app_notification_set_property (GObject *object,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_in_app_notification_dispose (GObject *object)
|
||||
{
|
||||
CallsInAppNotification *self = CALLS_IN_APP_NOTIFICATION (object);
|
||||
|
||||
GtkWidget *revealer = GTK_WIDGET (self->revealer);
|
||||
|
||||
g_clear_pointer (&revealer, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (calls_in_app_notification_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_in_app_notification_finalize (GObject *object)
|
||||
{
|
||||
@@ -114,6 +127,7 @@ calls_in_app_notification_class_init (CallsInAppNotificationClass *klass)
|
||||
|
||||
object_class->get_property = calls_in_app_notification_get_property;
|
||||
object_class->set_property = calls_in_app_notification_set_property;
|
||||
object_class->dispose = calls_in_app_notification_dispose;
|
||||
object_class->finalize = calls_in_app_notification_finalize;
|
||||
|
||||
props[PROP_TIMEOUT] = g_param_spec_uint ("timeout",
|
||||
@@ -132,6 +146,8 @@ calls_in_app_notification_class_init (CallsInAppNotificationClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsInAppNotification, revealer);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsInAppNotification, label);
|
||||
gtk_widget_class_bind_template_callback (widget_class, calls_in_app_notification_hide);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type(widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -46,6 +46,8 @@ static GParamSpec *props[PROP_LAST_PROP];
|
||||
struct _CallsNewCallBox {
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *child;
|
||||
|
||||
GtkListBox *origin_list_box;
|
||||
AdwComboRow *origin_list;
|
||||
CuiDialpad *dialpad;
|
||||
@@ -337,8 +339,12 @@ calls_new_call_box_dispose (GObject *object)
|
||||
{
|
||||
CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
|
||||
|
||||
GtkWidget *child = self->child;
|
||||
|
||||
clear_dial_queue (self);
|
||||
|
||||
g_clear_pointer (&child, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (calls_new_call_box_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -353,6 +359,7 @@ calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
|
||||
object_class->dispose = calls_new_call_box_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/new-call-box.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, child);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_list_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_list);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, dialpad);
|
||||
@@ -372,6 +379,8 @@ calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type(widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<requires lib="libadwaita" version="0.0"/>
|
||||
<template class="CallsContactsBox" parent="GtkWidget">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkScrolledWindow" id="child">
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<child>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<template class="CallsNewCallBox" parent="GtkWidget">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="child">
|
||||
<property name="margin-start">24</property>
|
||||
<property name="margin-end">24</property>
|
||||
<property name="margin_top">6</property>
|
||||
|
Reference in New Issue
Block a user