From 34a7651f44c387eeb293072195e0c774ff2a5335 Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Wed, 13 Dec 2023 16:05:27 -0800 Subject: [PATCH] treewide: Replace hide/show with set_visible Part-of: --- plugins/provider/sip/calls-sip-account-widget.c | 8 ++++---- src/calls-account-overview.c | 16 +++++++++++++--- src/calls-call-selector-item.c | 2 +- src/calls-contacts-row.c | 4 ++-- src/calls-main-window.c | 8 ++++---- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/plugins/provider/sip/calls-sip-account-widget.c b/plugins/provider/sip/calls-sip-account-widget.c index 667fa97..c54ab4d 100644 --- a/plugins/provider/sip/calls-sip-account-widget.c +++ b/plugins/provider/sip/calls-sip-account-widget.c @@ -306,12 +306,12 @@ update_header (CallsSipAccountWidget *self) g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self)); if (self->origin) { - gtk_widget_show (self->header_edit); - gtk_widget_hide (self->header_add); + gtk_widget_set_visible (self->header_edit, TRUE); + gtk_widget_set_visible (self->header_add, FALSE); } else { - gtk_widget_show (self->header_add); - gtk_widget_hide (self->header_edit); + gtk_widget_set_visible (self->header_add, TRUE); + gtk_widget_set_visible (self->header_edit, FALSE); } if (self->connecting) { diff --git a/src/calls-account-overview.c b/src/calls-account-overview.c index 7f8634b..110f3b1 100644 --- a/src/calls-account-overview.c +++ b/src/calls-account-overview.c @@ -285,6 +285,16 @@ on_accounts_changed (GListModel *accounts, } +/* + * Helper for `on_providers_changed` signal callback + */ +static void +hide_widget (GtkWidget *widget) +{ + gtk_widget_set_visible (widget, FALSE); +} + + static void on_providers_changed (GListModel *providers, guint position, @@ -297,12 +307,12 @@ on_providers_changed (GListModel *providers, g_list_model_get_item (providers, position + i); g_signal_connect_swapped (provider, "widget-edit-done", - G_CALLBACK (gtk_widget_hide), self->account_window); + G_CALLBACK (hide_widget), self->account_window); } /* Clear any acccount widgets, because they might've gone stale */ attach_account_widget (self, NULL); - gtk_widget_hide (GTK_WIDGET (self->account_window)); + gtk_widget_set_visible (GTK_WIDGET (self->account_window), FALSE); } @@ -314,7 +324,7 @@ on_key_pressed (GtkEventControllerKey *controller, GtkWidget *widget) { if (keyval == GDK_KEY_Escape) { - gtk_widget_hide (widget); + gtk_widget_set_visible (widget, FALSE); return GDK_EVENT_STOP; } diff --git a/src/calls-call-selector-item.c b/src/calls-call-selector-item.c index 6151d87..8456b45 100644 --- a/src/calls-call-selector-item.c +++ b/src/calls-call-selector-item.c @@ -70,7 +70,7 @@ set_party (CallsCallSelectorItem *self) GtkWidget *image = gtk_image_new_from_icon_name ("avatar-default-symbolic"); gtk_box_pack_start (self->main_box, image, TRUE, TRUE, 0); - gtk_widget_show (image); + gtk_widget_set_visible (image, TRUE); call = cui_call_display_get_call (self->display); diff --git a/src/calls-contacts-row.c b/src/calls-contacts-row.c index 8eeb7c7..96fdb30 100644 --- a/src/calls-contacts-row.c +++ b/src/calls-contacts-row.c @@ -41,13 +41,13 @@ insert_phonenumber (CallsContactsRow *self, gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label"); - gtk_widget_show (label); + gtk_widget_set_visible (label, TRUE); gtk_grid_attach (GTK_GRID (self->grid), label, 1, self->n_phonenumbers, 1, 1); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.dial"); gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "s", number, NULL); - gtk_widget_show (button); + gtk_widget_set_visible (button, TRUE); gtk_grid_attach_next_to (GTK_GRID (self->grid), button, label, diff --git a/src/calls-main-window.c b/src/calls-main-window.c index a99e567..fe19abb 100644 --- a/src/calls-main-window.c +++ b/src/calls-main-window.c @@ -157,9 +157,9 @@ window_update_ussd_state (CallsMainWindow *self, if (state == CALLS_USSD_STATE_USER_RESPONSE || state == CALLS_USSD_STATE_ACTIVE) - gtk_widget_show (GTK_WIDGET (self->ussd_cancel_button)); + gtk_widget_set_visible (GTK_WIDGET (self->ussd_cancel_button), TRUE); else - gtk_widget_show (GTK_WIDGET (self->ussd_close_button)); + gtk_widget_set_visible (GTK_WIDGET (self->ussd_close_button), TRUE); } static void @@ -506,8 +506,8 @@ calls_main_window_dial (CallsMainWindow *self, const gchar *target) { if (calls_number_is_ussd (target)) { - gtk_widget_hide (GTK_WIDGET (self->ussd_cancel_button)); - gtk_widget_hide (GTK_WIDGET (self->ussd_reply_button)); + gtk_widget_set_visible (GTK_WIDGET (self->ussd_cancel_button), FALSE); + gtk_widget_set_visible (GTK_WIDGET (self->ussd_reply_button), FALSE); gtk_stack_set_visible_child (self->ussd_stack, GTK_WIDGET (self->ussd_spinner)); gtk_spinner_start (self->ussd_spinner);