From ee3abc009af26889951a990b23681de8f694fe14 Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Wed, 13 Dec 2023 12:56:46 -0800 Subject: [PATCH] treewide: Replace libhandy with libadwaita Part-of: --- HACKING.md | 6 +- debian/control | 2 +- .../provider/sip/calls-sip-account-widget.c | 56 +++++++++---------- .../provider/sip/calls-sip-account-widget.h | 2 +- plugins/provider/sip/meson.build | 2 +- plugins/provider/sip/sip-account-widget.ui | 36 ++++++------ src/calls-account-overview.c | 8 +-- src/calls-account-overview.h | 4 +- src/calls-account-row.c | 10 ++-- src/calls-account-row.h | 4 +- src/calls-application.c | 14 ++--- src/calls-call-record-row.c | 2 +- src/calls-call-selector-item.c | 2 +- src/calls-call-window.c | 2 +- src/calls-contacts-box.c | 3 +- src/calls-contacts-row.c | 4 +- src/calls-main-window.c | 10 ++-- src/calls-main-window.h | 4 +- src/calls-new-call-box.c | 12 ++-- src/meson.build | 2 +- src/ui/account-overview.ui | 10 ++-- src/ui/account-row.ui | 6 +- src/ui/call-record-row.ui | 2 +- src/ui/contacts-box.ui | 4 +- src/ui/contacts-row.ui | 2 +- src/ui/history-box.ui | 4 +- src/ui/main-window.ui | 12 ++-- src/ui/new-call-box.ui | 10 ++-- 28 files changed, 117 insertions(+), 118 deletions(-) diff --git a/HACKING.md b/HACKING.md index 196995d..24427a1 100644 --- a/HACKING.md +++ b/HACKING.md @@ -26,7 +26,7 @@ While much of the original codebase was written using [GNU's Coding Style][1], please try to follow this document for newly written code. For existing code you should probably try to not mix different code styles too much. This coding style is heavily inspired/copied from [phosh's Coding Style][2] -which itself is mostly using [libhandy's Coding Style][3]. +which itself is mostly using [libadwaita's Coding Style][3]. These are the differences: @@ -124,8 +124,8 @@ individual C files should be structured as (top to bottom of file): The reason public methods go at the bottom is that they have declarations in the header file and can thus be referenced from anywhere else in the source file. - + Try to avoid forward declarations where possible. [1]: https://www.gnu.org/prep/standards/standards.html#Formatting [2]: https://gitlab.gnome.org/World/Phosh/phosh/-/blob/main/HACKING.md#coding-style -[3]: https://gitlab.gnome.org/GNOME/libhandy/-/blob/main/HACKING.md#coding-style +[3]: https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/HACKING.md#coding-style diff --git a/debian/control b/debian/control index 4fff875..64c861b 100644 --- a/debian/control +++ b/debian/control @@ -11,6 +11,7 @@ Build-Depends: gstreamer1.0-plugins-bad, gstreamer1.0-plugins-good, gtk-doc-tools , + libadwaita-1-dev (>= 1.2), libcallaudio-dev (>= 0.0.5), libebook-contacts1.2-dev, libfeedback-dev (>= 0.0.1), @@ -19,7 +20,6 @@ Build-Depends: libgstreamer1.0-dev, libgtk-3-dev, libgtk-3-doc , - libhandy-1-dev (>= 1.1.90), libmm-glib-dev (>= 1.12.0), libpeas-dev, librsvg2-common, diff --git a/plugins/provider/sip/calls-sip-account-widget.c b/plugins/provider/sip/calls-sip-account-widget.c index b71fcf2..3c882f8 100644 --- a/plugins/provider/sip/calls-sip-account-widget.c +++ b/plugins/provider/sip/calls-sip-account-widget.c @@ -69,9 +69,9 @@ struct _CallsSipAccountWidget { GtkEntry *password; GtkEntry *port; char *last_port; - HdyComboRow *protocol; - GListStore *protocols_store; /* bound model for protocol HdyComboRow */ - HdyComboRow *media_encryption; + AdwComboRow *protocol; + GListStore *protocols_store; /* bound model for protocol AdwComboRow */ + AdwComboRow *media_encryption; GListStore *media_encryption_store; GtkSwitch *tel_switch; GtkSwitch *auto_connect_switch; @@ -114,13 +114,13 @@ is_form_filled (CallsSipAccountWidget *self) static const char * get_selected_protocol (CallsSipAccountWidget *self) { - g_autoptr (HdyValueObject) obj = NULL; + g_autoptr (AdwValueObject) obj = NULL; const char *protocol = NULL; gint i; - if ((i = hdy_combo_row_get_selected_index (self->protocol)) != -1) { + if ((i = adw_combo_row_get_selected_index (self->protocol)) != -1) { obj = g_list_model_get_item (G_LIST_MODEL (self->protocols_store), i); - protocol = hdy_value_object_get_string (obj); + protocol = adw_value_object_get_string (obj); } return protocol; } @@ -129,11 +129,11 @@ get_selected_protocol (CallsSipAccountWidget *self) static SipMediaEncryption get_selected_media_encryption (CallsSipAccountWidget *self) { - g_autoptr (HdyValueObject) obj = NULL; + g_autoptr (AdwValueObject) obj = NULL; SipMediaEncryption media_encryption = SIP_MEDIA_ENCRYPTION_NONE; gint i; - if ((i = hdy_combo_row_get_selected_index (self->media_encryption)) != -1) { + if ((i = adw_combo_row_get_selected_index (self->media_encryption)) != -1) { obj = g_list_model_get_item (G_LIST_MODEL (self->media_encryption_store), i); media_encryption = (SipMediaEncryption) GPOINTER_TO_INT (g_object_get_data (G_OBJECT (obj), "value")); } @@ -158,7 +158,7 @@ update_media_encryption (CallsSipAccountWidget *self) transport_is_tls | sdes_always_allowed); if (!transport_is_tls && !sdes_always_allowed) - hdy_combo_row_set_selected_index (self->media_encryption, 0); + adw_combo_row_set_selected_index (self->media_encryption, 0); } @@ -335,9 +335,9 @@ find_protocol (CallsSipAccountWidget *self, len = g_list_model_get_n_items (G_LIST_MODEL (self->protocols_store)); for (guint i = 0; i < len; i++) { - g_autoptr (HdyValueObject) obj = + g_autoptr (AdwValueObject) obj = g_list_model_get_item (G_LIST_MODEL (self->protocols_store), i); - const char *prot = hdy_value_object_get_string (obj); + const char *prot = adw_value_object_get_string (obj); if (g_strcmp0 (protocol, prot) == 0) { if (index) @@ -363,7 +363,7 @@ find_media_encryption (CallsSipAccountWidget *self, len = g_list_model_get_n_items (G_LIST_MODEL (self->media_encryption_store)); for (guint i = 0; i < len; i++) { - g_autoptr (HdyValueObject) obj = + g_autoptr (AdwValueObject) obj = g_list_model_get_item (G_LIST_MODEL (self->media_encryption_store), i); SipMediaEncryption obj_enc = (SipMediaEncryption) GPOINTER_TO_INT (g_object_get_data (G_OBJECT (obj), "value")); @@ -390,9 +390,9 @@ clear_form (CallsSipAccountWidget *self) gtk_entry_set_text (self->user, ""); gtk_entry_set_text (self->password, ""); gtk_entry_set_text (self->port, "0"); - hdy_combo_row_set_selected_index (self->protocol, 0); + adw_combo_row_set_selected_index (self->protocol, 0); gtk_widget_set_sensitive (GTK_WIDGET (self->media_encryption), FALSE); - hdy_combo_row_set_selected_index (self->media_encryption, 0); + adw_combo_row_set_selected_index (self->media_encryption, 0); gtk_switch_set_state (self->tel_switch, FALSE); gtk_switch_set_state (self->auto_connect_switch, TRUE); @@ -464,8 +464,8 @@ edit_form (CallsSipAccountWidget *self, gtk_entry_set_text (self->password, password); set_password_visibility (self, FALSE); gtk_entry_set_text (self->port, port_str); - hdy_combo_row_set_selected_index (self->protocol, protocol_index); - hdy_combo_row_set_selected_index (self->media_encryption, encryption_index); + adw_combo_row_set_selected_index (self->protocol, protocol_index); + adw_combo_row_set_selected_index (self->media_encryption, encryption_index); gtk_switch_set_state (self->tel_switch, can_tel); gtk_switch_set_state (self->auto_connect_switch, auto_connect); @@ -652,7 +652,7 @@ calls_sip_account_widget_class_init (CallsSipAccountWidgetClass *klass) static void calls_sip_account_widget_init (CallsSipAccountWidget *self) { - HdyValueObject *obj; + AdwValueObject *obj; self->settings = calls_settings_get_default (); @@ -663,43 +663,43 @@ calls_sip_account_widget_init (CallsSipAccountWidget *self) gtk_widget_init_template (GTK_WIDGET (self)); - self->media_encryption_store = g_list_store_new (HDY_TYPE_VALUE_OBJECT); + self->media_encryption_store = g_list_store_new (ADW_TYPE_VALUE_OBJECT); - obj = hdy_value_object_new_string (_("No encryption")); + obj = adw_value_object_new_string (_("No encryption")); g_object_set_data (G_OBJECT (obj), "value", GINT_TO_POINTER (SIP_MEDIA_ENCRYPTION_NONE)); g_list_store_insert (self->media_encryption_store, 0, obj); g_clear_object (&obj); /* TODO Optional encryption */ - obj = hdy_value_object_new_string (_("Force encryption")); + obj = adw_value_object_new_string (_("Force encryption")); g_object_set_data (G_OBJECT (obj), "value", GINT_TO_POINTER (SIP_MEDIA_ENCRYPTION_FORCED)); g_list_store_insert (self->media_encryption_store, 1, obj); g_clear_object (&obj); - hdy_combo_row_bind_name_model (self->media_encryption, + adw_combo_row_bind_name_model (self->media_encryption, G_LIST_MODEL (self->media_encryption_store), - (HdyComboRowGetNameFunc) hdy_value_object_dup_string, + (AdwComboRowGetNameFunc) adw_value_object_dup_string, NULL, NULL); - self->protocols_store = g_list_store_new (HDY_TYPE_VALUE_OBJECT); + self->protocols_store = g_list_store_new (ADW_TYPE_VALUE_OBJECT); - obj = hdy_value_object_new_string ("UDP"); + obj = adw_value_object_new_string ("UDP"); g_list_store_insert (self->protocols_store, 0, obj); g_clear_object (&obj); - obj = hdy_value_object_new_string ("TCP"); + obj = adw_value_object_new_string ("TCP"); g_list_store_insert (self->protocols_store, 1, obj); g_clear_object (&obj); - obj = hdy_value_object_new_string ("TLS"); + obj = adw_value_object_new_string ("TLS"); g_list_store_insert (self->protocols_store, 2, obj); g_clear_object (&obj); - hdy_combo_row_bind_name_model (self->protocol, + adw_combo_row_bind_name_model (self->protocol, G_LIST_MODEL (self->protocols_store), - (HdyComboRowGetNameFunc) hdy_value_object_dup_string, + (AdwComboRowGetNameFunc) adw_value_object_dup_string, NULL, NULL); } diff --git a/plugins/provider/sip/calls-sip-account-widget.h b/plugins/provider/sip/calls-sip-account-widget.h index f96945c..799995d 100644 --- a/plugins/provider/sip/calls-sip-account-widget.h +++ b/plugins/provider/sip/calls-sip-account-widget.h @@ -26,7 +26,7 @@ #include "calls-sip-provider.h" -#include +#include G_BEGIN_DECLS diff --git a/plugins/provider/sip/meson.build b/plugins/provider/sip/meson.build index e288031..3a02489 100644 --- a/plugins/provider/sip/meson.build +++ b/plugins/provider/sip/meson.build @@ -46,7 +46,7 @@ sip_deps = [ dependency('gobject-2.0'), dependency('gstreamer-1.0'), dependency('gtk4'), - dependency('libhandy-1', version: '>= 1.1.90'), + dependency('libadwaita-1', version: '>= 1.2'), dependency('libpeas-1.0'), dependency('sofia-sip-ua-glib'), dependency('libsecret-1'), diff --git a/plugins/provider/sip/sip-account-widget.ui b/plugins/provider/sip/sip-account-widget.ui index ef457f1..62489b2 100644 --- a/plugins/provider/sip/sip-account-widget.ui +++ b/plugins/provider/sip/sip-account-widget.ui @@ -1,7 +1,7 @@ - +