1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 20:07:36 +00:00

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:
Anton Lazarev 2023-12-16 14:08:56 -08:00
parent e2a5f04fa0
commit a656776b19
8 changed files with 62 additions and 3 deletions

View file

@ -53,6 +53,8 @@ static GParamSpec *props[PROP_LAST_PROP];
struct _CallsSipAccountWidget {
GtkWidget parent;
GtkWidget *child;
/* Header bar */
GtkWidget *header_add;
GtkSpinner *spinner_add;
@ -582,6 +584,10 @@ calls_sip_account_widget_dispose (GObject *object)
{
CallsSipAccountWidget *self = CALLS_SIP_ACCOUNT_WIDGET (object);
GtkWidget *child = GTK_WIDGET (self->child);
g_clear_pointer (&child, gtk_widget_unparent);
g_clear_pointer (&self->last_port, g_free);
g_clear_object (&self->protocols_store);
g_clear_object (&self->media_encryption_store);
@ -617,6 +623,8 @@ calls_sip_account_widget_class_init (CallsSipAccountWidgetClass *klass)
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/sip-account-widget.ui");
gtk_widget_class_bind_template_child (widget_class, CallsSipAccountWidget, child);
gtk_widget_class_bind_template_child (widget_class, CallsSipAccountWidget, header_add);
gtk_widget_class_bind_template_child (widget_class, CallsSipAccountWidget, spinner_add);
gtk_widget_class_bind_template_child (widget_class, CallsSipAccountWidget, header_edit);
@ -642,6 +650,8 @@ calls_sip_account_widget_class_init (CallsSipAccountWidgetClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_password_visibility_changed);
gtk_widget_class_bind_template_callback (widget_class, on_port_entry_insert_text);
gtk_widget_class_bind_template_callback (widget_class, on_port_entry_after_insert_text);
gtk_widget_class_set_layout_manager_type(widget_class, GTK_TYPE_BOX_LAYOUT);
}

View file

@ -4,7 +4,7 @@
<requires lib="libadwaita" version="1.0"/>
<template class="CallsSipAccountWidget" parent="GtkWidget">
<child>
<object class="GtkBox">
<object class="GtkBox" id="child">
<property name="orientation">vertical</property>
<child>
<object class="AdwHeaderBar" id="header_add">

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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>

View file

@ -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>