From 1659b7ab4011db119bfa515aee792ad9c4745389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Thu, 24 Oct 2024 13:35:56 +0200 Subject: [PATCH 1/2] network: make the hotstop view adaptive on non-English locales The labels are remarkably longer when translated to Spanish or German, and otherwise the dialog does not fit a mobile screen size --- panels/network/cc-wifi-panel.c | 8 ++++++++ panels/network/cc-wifi-panel.ui | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c index 67d491233e..a83942d9e9 100644 --- a/panels/network/cc-wifi-panel.c +++ b/panels/network/cc-wifi-panel.c @@ -55,6 +55,7 @@ struct _CcWifiPanel GtkStack *center_stack; GtkStack *device_stack; GtkBox *hotspot_box; + GtkButton *hotspot_off_button; GtkLabel *list_label; GtkStack *main_stack; GtkWidget *spinner; @@ -837,6 +838,7 @@ cc_wifi_panel_class_init (CcWifiPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, center_stack); gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, device_stack); gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, hotspot_box); + gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, hotspot_off_button); gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, list_label); gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, main_stack); gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, rfkill_row); @@ -857,6 +859,7 @@ static void cc_wifi_panel_init (CcWifiPanel *self) { g_autoptr(GtkCssProvider) provider = NULL; + GtkLabel *hotspot_off_label; g_resources_register (cc_network_get_resource ()); @@ -914,4 +917,9 @@ cc_wifi_panel_init (CcWifiPanel *self) gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + /* Customize some properties that would lose styling if done in UI */ + hotspot_off_label = GTK_LABEL (gtk_button_get_child (self->hotspot_off_button)); + gtk_label_set_wrap (hotspot_off_label, TRUE); + gtk_label_set_justify (hotspot_off_label, GTK_JUSTIFY_CENTER); } diff --git a/panels/network/cc-wifi-panel.ui b/panels/network/cc-wifi-panel.ui index 7fabf10562..dd5f7916b9 100644 --- a/panels/network/cc-wifi-panel.ui +++ b/panels/network/cc-wifi-panel.ui @@ -134,6 +134,9 @@ Wi-Fi Hotspot Active 12 + center + True + word-char