From 259d430f3e48fa830a8ce92f11ea72cfb865b6e7 Mon Sep 17 00:00:00 2001 From: Arun Mani J Date: Fri, 14 Nov 2025 17:15:24 +0530 Subject: [PATCH 1/5] wifi-manager: Allow to get active connection Signed-off-by: Arun Mani J Part-of: --- src/wifi-manager.c | 9 +++++++++ src/wifi-manager.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/wifi-manager.c b/src/wifi-manager.c index a2b9f87a2..c3d5203dc 100644 --- a/src/wifi-manager.c +++ b/src/wifi-manager.c @@ -1404,3 +1404,12 @@ phosh_wifi_manager_get_state (PhoshWifiManager *self) return self->state; } + + +NMActiveConnection * +phosh_wifi_manager_get_active_connection (PhoshWifiManager *self) +{ + g_return_val_if_fail (PHOSH_IS_WIFI_MANAGER (self), NULL); + + return self->active; +} diff --git a/src/wifi-manager.h b/src/wifi-manager.h index 6b6c2d4a2..a3c42e224 100644 --- a/src/wifi-manager.h +++ b/src/wifi-manager.h @@ -32,5 +32,6 @@ void phosh_wifi_manager_connect_network (PhoshWifiManager *self, void phosh_wifi_manager_request_scan (PhoshWifiManager *self); gboolean phosh_wifi_manager_get_scanning (PhoshWifiManager *self); NMActiveConnectionState phosh_wifi_manager_get_state (PhoshWifiManager *self); +NMActiveConnection *phosh_wifi_manager_get_active_connection (PhoshWifiManager *self); G_END_DECLS -- GitLab From 86474b8425e821fc2f4d3a356cb5c575d4447637 Mon Sep 17 00:00:00 2001 From: Arun Mani J Date: Fri, 14 Nov 2025 17:15:43 +0530 Subject: [PATCH 2/5] tree: Export few symbols of Wi-Fi manager Signed-off-by: Arun Mani J Part-of: --- src/phosh-exported-symbols.txt.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/phosh-exported-symbols.txt.in b/src/phosh-exported-symbols.txt.in index 9ba715e2d..7dd1bb69e 100644 --- a/src/phosh-exported-symbols.txt.in +++ b/src/phosh-exported-symbols.txt.in @@ -41,9 +41,13 @@ # Wi-Fi Hotspot plugin wants Wi-Fi Manager phosh_shell_get_wifi_manager; + phosh_wifi_manager_get_type; + phosh_wifi_manager_get_active_connection; phosh_wifi_manager_get_enabled; + phosh_wifi_manager_get_present; phosh_wifi_manager_get_state; phosh_wifi_manager_is_hotspot_master; + phosh_wifi_manager_set_enabled; phosh_wifi_manager_set_hotspot_master; # Mobile Data wants WWan Manager -- GitLab From 92aede497eed10f245a0df3f4094055fcdac1527 Mon Sep 17 00:00:00 2001 From: Arun Mani J Date: Mon, 17 Nov 2025 13:19:38 +0530 Subject: [PATCH 3/5] wifi-hotspot-quick-setting: Load `style.css` Will be used by status-page in subsequent commits. Signed-off-by: Arun Mani J Part-of: --- ...phosh-plugin-wifi-hotspot-quick-setting.gresources.xml | 1 + plugins/wifi-hotspot-quick-setting/style.css | 0 .../wifi-hotspot-quick-setting.c | 8 ++++++++ 3 files changed, 9 insertions(+) create mode 100644 plugins/wifi-hotspot-quick-setting/style.css diff --git a/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml b/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml index 67e1eadc8..41b44b6e4 100644 --- a/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml +++ b/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml @@ -4,5 +4,6 @@ qs.ui icons/network-wireless-hotspot-disabled-symbolic.svg icons/network-wireless-hotspot-acquiring-symbolic.svg + style.css diff --git a/plugins/wifi-hotspot-quick-setting/style.css b/plugins/wifi-hotspot-quick-setting/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c index 356195814..c65f395e6 100644 --- a/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c +++ b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c @@ -112,10 +112,18 @@ phosh_wifi_hotspot_quick_setting_class_init (PhoshWifiHotspotQuickSettingClass * static void phosh_wifi_hotspot_quick_setting_init (PhoshWifiHotspotQuickSetting *self) { + g_autoptr (GtkCssProvider) css_provider = NULL; PhoshShell *shell = phosh_shell_get_default (); gtk_widget_init_template (GTK_WIDGET (self)); + css_provider = gtk_css_provider_new (); + gtk_css_provider_load_from_resource (css_provider, + "/mobi/phosh/plugins/wifi-hotspot-quick-setting/style.css"); + gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), + GTK_STYLE_PROVIDER (css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + gtk_icon_theme_add_resource_path (gtk_icon_theme_get_default (), "/mobi/phosh/plugins/wifi-hotspot-quick-setting/icons"); -- GitLab From ab8dcd4128805974e3398c5b0121750bc271ce0c Mon Sep 17 00:00:00 2001 From: Arun Mani J Date: Fri, 14 Nov 2025 17:18:42 +0530 Subject: [PATCH 4/5] wifi-hotspot-quick-setting: Add `PhoshWifiHotspotStatusPage` Signed-off-by: Arun Mani J Part-of: --- debian/control | 2 + .../wifi-hotspot-quick-setting/meson.build | 5 +- ...-wifi-hotspot-quick-setting.gresources.xml | 1 + .../wifi-hotspot-quick-setting/status-page.ui | 77 ++++ plugins/wifi-hotspot-quick-setting/style.css | 4 + .../wifi-hotspot-status-page.c | 418 ++++++++++++++++++ .../wifi-hotspot-status-page.h | 20 + po/POTFILES.in | 1 + 8 files changed, 527 insertions(+), 1 deletion(-) create mode 100644 plugins/wifi-hotspot-quick-setting/status-page.ui create mode 100644 plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.c create mode 100644 plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.h diff --git a/debian/control b/debian/control index ee4da77bf..b07eb9063 100644 --- a/debian/control +++ b/debian/control @@ -39,6 +39,7 @@ Build-Depends: valac, # for the plugins libecal2.0-dev, + libqrcodegen-dev, evolution-data-server-dev, universal-ctags, # to run the tests @@ -75,6 +76,7 @@ Depends: gnome-shell-common, gsettings-desktop-schemas (>= 47), libcap2-bin, + libqrcodegen1, phoc (>= 0.45.0), phosh-common (= ${source:Version}), Recommends: diff --git a/plugins/wifi-hotspot-quick-setting/meson.build b/plugins/wifi-hotspot-quick-setting/meson.build index af9d0d741..2b7f556cf 100644 --- a/plugins/wifi-hotspot-quick-setting/meson.build +++ b/plugins/wifi-hotspot-quick-setting/meson.build @@ -1,5 +1,7 @@ name = 'wifi-hotspot-quick-setting' +qrcodegen_dep = dependency('qrcodegen') + wifi_hotspot_quick_setting_resources = gnome.compile_resources( 'phosh-plugin-wifi-hotspot-quick-setting-resources', 'phosh-plugin-wifi-hotspot-quick-setting.gresources.xml', @@ -9,6 +11,7 @@ wifi_hotspot_quick_setting_resources = gnome.compile_resources( wifi_hotspot_quick_setting_plugin_sources = files( 'phosh-plugin-wifi-hotspot-quick-setting.c', 'wifi-hotspot-quick-setting.c', + 'wifi-hotspot-status-page.c', ) phosh_wifi_hotspot_quick_setting_plugin = shared_module( @@ -16,7 +19,7 @@ phosh_wifi_hotspot_quick_setting_plugin = shared_module( wifi_hotspot_quick_setting_plugin_sources, wifi_hotspot_quick_setting_resources, c_args: ['-DG_LOG_DOMAIN="phosh-plugin-@0@"'.format(name), '-DPLUGIN_NAME="@0@"'.format(name)], - dependencies: plugin_dep, + dependencies: [plugin_dep, qrcodegen_dep], install: true, install_dir: plugins_dir, ) diff --git a/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml b/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml index 41b44b6e4..17c1e5787 100644 --- a/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml +++ b/plugins/wifi-hotspot-quick-setting/phosh-plugin-wifi-hotspot-quick-setting.gresources.xml @@ -1,6 +1,7 @@ + status-page.ui qs.ui icons/network-wireless-hotspot-disabled-symbolic.svg icons/network-wireless-hotspot-acquiring-symbolic.svg diff --git a/plugins/wifi-hotspot-quick-setting/status-page.ui b/plugins/wifi-hotspot-quick-setting/status-page.ui new file mode 100644 index 000000000..28de75ce6 --- /dev/null +++ b/plugins/wifi-hotspot-quick-setting/status-page.ui @@ -0,0 +1,77 @@ + + + + + + 1 + crossfade + 0 + + + 1 + turn_on_btn + + + empty_state + + + + + 1 + vertical + 6 + + + 1 + 128 + + + + + 1 + entry + center + 0.5 + 0 + password + 0 + view-reveal-symbolic + + + + + + + hotspot_enabled + + + + + 1 + center + Turn On + 0 + + + + 1 + 1 + 0 + panel.launch-panel + "wifi" + + + 1 + end + Wi-Fi Settings + + + + diff --git a/plugins/wifi-hotspot-quick-setting/style.css b/plugins/wifi-hotspot-quick-setting/style.css index e69de29bb..71b0459d7 100644 --- a/plugins/wifi-hotspot-quick-setting/style.css +++ b/plugins/wifi-hotspot-quick-setting/style.css @@ -0,0 +1,4 @@ +phosh-wifi-hotspot-status-page #entry { + font-size: 1.25rem; + font-weight: bold; +} diff --git a/plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.c b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.c new file mode 100644 index 000000000..675b5e274 --- /dev/null +++ b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.c @@ -0,0 +1,418 @@ +/* + * Copyright (C) 2025 Phosh.mobi e.V. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Author: Arun Mani J + */ + +#include "plugin-shell.h" +#include "status-page-placeholder.h" +#include "wifi-hotspot-status-page.h" + +#include + +#define QR_CODE_SIZE 128 + +G_DEFINE_AUTOPTR_CLEANUP_FUNC (cairo_t, cairo_destroy) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (cairo_surface_t, cairo_surface_destroy) + +/** + * PhoshWifiHotspotStatusPage: + * + * A status-page to show password of Wi-Fi hotspot. + * + * The code to display QR is taken from GNOME Control Center. + */ + +struct _PhoshWifiHotspotStatusPage { + PhoshStatusPage parent; + + GtkEntry *entry; + GtkImage *image; + PhoshStatusPagePlaceholder *placeholder; + GtkStack *stack; + GtkButton *turn_on_btn; + + GCancellable *cancel; + PhoshWifiManager *wifi; +}; + +G_DEFINE_TYPE (PhoshWifiHotspotStatusPage, phosh_wifi_hotspot_status_page, PHOSH_TYPE_STATUS_PAGE); + + +static cairo_surface_t * +qr_from_text (const char *text, int size, int scale) +{ + uint8_t qr_code[qrcodegen_BUFFER_LEN_FOR_VERSION (qrcodegen_VERSION_MAX)]; + uint8_t temp_buf[qrcodegen_BUFFER_LEN_FOR_VERSION (qrcodegen_VERSION_MAX)]; + g_autoptr (cairo_t) cr = NULL; + cairo_surface_t *surface; + int pixel_size, qr_size, padding; + gboolean success = FALSE; + + g_return_val_if_fail (size > 0, NULL); + g_return_val_if_fail (scale > 0, NULL); + + success = qrcodegen_encodeText (text, + temp_buf, + qr_code, + qrcodegen_Ecc_LOW, + qrcodegen_VERSION_MIN, + qrcodegen_VERSION_MAX, + qrcodegen_Mask_AUTO, + FALSE); + + if (!success) + return NULL; + + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, size * scale, size * scale); + cairo_surface_set_device_scale (surface, scale, scale); + cr = cairo_create (surface); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + + /* Draw white background */ + cairo_set_source_rgba (cr, 1, 1, 1, 1); + cairo_rectangle (cr, 0, 0, size * scale, size * scale); + cairo_fill (cr); + + qr_size = qrcodegen_getSize (qr_code); + pixel_size = MAX (1, size / (qr_size)); + padding = (size - qr_size * pixel_size) / 2; + + /* If subpixel size is big and margin is pretty small, + * increase the margin */ + if (pixel_size > 4 && padding < 12) { + pixel_size--; + padding = (size - qr_size * pixel_size) / 2; + } + + /* Now draw the black QR code pixels */ + cairo_set_source_rgba (cr, 0, 0, 0, 1); + for (int row = 0; row < qr_size; row++) { + for (int column = 0; column < qr_size; column++) { + if (qrcodegen_getModule (qr_code, row, column)) { + cairo_rectangle (cr, + column * pixel_size + padding, + row * pixel_size + padding, + pixel_size, pixel_size); + cairo_fill (cr); + } + } + } + + return surface; +} + + +static char * +escape_string (const char *str, gboolean quote) +{ + GString *string; + const char *next; + + if (!str) + return NULL; + + string = g_string_new (""); + if (quote) + g_string_append_c (string, '"'); + + while ((next = strpbrk (str, "\\;,:\""))) { + g_string_append_len (string, str, next - str); + g_string_append_c (string, '\\'); + g_string_append_c (string, *next); + str = next + 1; + } + + g_string_append (string, str); + if (quote) + g_string_append_c (string, '"'); + + return g_string_free (string, FALSE); +} + + +static const char * +get_connection_security_type (NMConnection *c) +{ + NMSettingWirelessSecurity *setting; + const char *key_mgmt; + + g_return_val_if_fail (c, "nopass"); + + setting = nm_connection_get_setting_wireless_security (c); + + if (!setting) + return "nopass"; + + key_mgmt = nm_setting_wireless_security_get_key_mgmt (setting); + + /* No IEEE 802.1x */ + if (g_strcmp0 (key_mgmt, "none") == 0) + return "WEP"; + + if (g_strcmp0 (key_mgmt, "wpa-psk") == 0) + return "WPA"; + + if (g_strcmp0 (key_mgmt, "sae") == 0) + return "SAE"; + + return "nopass"; +} + + +static char * +get_wifi_password (NMConnection *c) +{ + NMSettingWirelessSecurity *setting; + const char *sec_type, *password; + int wep_index; + + sec_type = get_connection_security_type (c); + setting = nm_connection_get_setting_wireless_security (c); + + if (g_str_equal (sec_type, "nopass")) + return NULL; + + if (g_str_equal (sec_type, "WEP")) { + wep_index = nm_setting_wireless_security_get_wep_tx_keyidx (setting); + password = nm_setting_wireless_security_get_wep_key (setting, wep_index); + } else { + password = nm_setting_wireless_security_get_psk (setting); + } + + return g_strdup (password); +} + + +/* Generate a string representing the connection + * An example generated text: + * WIFI:S:ssid;T:WPA;P:my-valid-pass;H:true; + * Where, + * S = ssid, T = security, P = password, H = hidden (Optional) + * + * See https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11 + */ +static char * +get_qr_string_for_connection (NMConnection *c) +{ + NMSettingWireless *setting; + g_autofree char *ssid_text = NULL; + g_autofree char *escaped_ssid = NULL; + g_autofree char *password_str = NULL; + g_autofree char *escaped_password = NULL; + GString *string; + GBytes *ssid; + gboolean hidden; + + setting = nm_connection_get_setting_wireless (c); + ssid = nm_setting_wireless_get_ssid (setting); + + if (!ssid) + return NULL; + + string = g_string_new ("WIFI:S:"); + + /* SSID */ + ssid_text = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), + g_bytes_get_size (ssid)); + escaped_ssid = escape_string (ssid_text, FALSE); + g_string_append (string, escaped_ssid); + g_string_append_c (string, ';'); + + /* Security type */ + g_string_append (string, "T:"); + g_string_append (string, get_connection_security_type (c)); + g_string_append_c (string, ';'); + + /* Password */ + g_string_append (string, "P:"); + password_str = get_wifi_password (c); + escaped_password = escape_string (password_str, FALSE); + if (escaped_password) + g_string_append (string, escaped_password); + g_string_append_c (string, ';'); + + /* WiFi Hidden */ + hidden = nm_setting_wireless_get_hidden (setting); + if (hidden) + g_string_append (string, "H:true"); + g_string_append_c (string, ';'); + + return g_string_free (string, FALSE); +} + + +static void +on_secrets_ready (GObject *object, GAsyncResult *result, gpointer data) +{ + PhoshWifiHotspotStatusPage *self = data; + NMConnection *conn = NM_CONNECTION (object); + g_autoptr (GError) error = NULL; + g_autoptr (GVariant) variant = NULL; + g_autofree char *cnx_str = NULL; + g_autofree char *password = NULL; + g_autoptr (cairo_surface_t) surface = NULL; + int scale; + + variant = nm_remote_connection_get_secrets_finish (NM_REMOTE_CONNECTION (conn), result, &error); + if (variant == NULL) { + g_warning ("Unable to fetch secrets: %s", error->message); + gtk_image_set_from_icon_name (self->image, "face-sad-symbolic", -1); + gtk_entry_set_text (self->entry, ""); + return; + } + if (!nm_connection_update_secrets (conn, + NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, + variant, + &error)) { + g_warning ("Unable to set secrets: %s", error->message); + gtk_image_set_from_icon_name (self->image, "face-sad-symbolic", -1); + gtk_entry_set_text (self->entry, ""); + return; + } + + cnx_str = get_qr_string_for_connection (conn); + scale = gtk_widget_get_scale_factor (GTK_WIDGET (self->image)); + surface = qr_from_text (cnx_str, QR_CODE_SIZE, scale); + password = get_wifi_password (conn); + gtk_image_set_from_surface (self->image, surface); + gtk_entry_set_text (self->entry, password); + nm_connection_clear_secrets (conn); +} + + +static void +setup_hotspot_page (PhoshWifiHotspotStatusPage *self) +{ + NMActiveConnection *conn = phosh_wifi_manager_get_active_connection (self->wifi); + NMRemoteConnection *remote = nm_active_connection_get_connection (conn); + + nm_remote_connection_get_secrets_async (NM_REMOTE_CONNECTION (remote), + NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, + self->cancel, + on_secrets_ready, + self); +} + + +static void +on_wifi_notify (PhoshWifiHotspotStatusPage *self) +{ + gboolean wifi_absent = !phosh_wifi_manager_get_present (self->wifi); + gboolean wifi_disabled = !phosh_wifi_manager_get_enabled (self->wifi); + gboolean hotspot_disabled = !phosh_wifi_manager_is_hotspot_master (self->wifi); + const char *icon_name; + + if (wifi_absent) + icon_name = "network-wireless-hardware-disabled-symbolic"; + else if (wifi_disabled) + icon_name = "network-wireless-disabled-symbolic"; + else + icon_name = "network-wireless-hotspot-disabled-symbolic"; + + phosh_status_page_placeholder_set_icon_name (self->placeholder, icon_name); + gtk_widget_set_visible (GTK_WIDGET (self->turn_on_btn), !wifi_absent); + + if (hotspot_disabled) { + gtk_stack_set_visible_child_name (self->stack, "empty_state"); + } else { + gtk_stack_set_visible_child_name (self->stack, "hotspot_enabled"); + setup_hotspot_page (self); + } +} + + +static void +on_icon_press (PhoshWifiHotspotStatusPage *self) +{ + gboolean visibility = gtk_entry_get_visibility (self->entry); + const char *icon_name; + + if (visibility) + icon_name = "view-reveal-symbolic"; + else + icon_name = "view-conceal-symbolic"; + + gtk_entry_set_visibility (self->entry, !visibility); + gtk_entry_set_icon_from_icon_name (self->entry, GTK_ENTRY_ICON_SECONDARY, icon_name); +} + + +static void +on_turn_on_clicked (PhoshWifiHotspotStatusPage *self) +{ + gboolean wifi_disabled = !phosh_wifi_manager_get_enabled (self->wifi); + + if (wifi_disabled) + phosh_wifi_manager_set_enabled (self->wifi, TRUE); + else + phosh_wifi_manager_set_hotspot_master (self->wifi, TRUE); +} + + +static void +phosh_wifi_hotspot_status_page_dispose (GObject *object) +{ + PhoshWifiHotspotStatusPage *self = PHOSH_WIFI_HOTSPOT_STATUS_PAGE (object); + + g_cancellable_cancel (self->cancel); + g_clear_object (&self->cancel); + + if (self->wifi) + g_signal_handlers_disconnect_by_data (self->wifi, self); + + G_OBJECT_CLASS (phosh_wifi_hotspot_status_page_parent_class)->dispose (object); +} + + +static void +phosh_wifi_hotspot_status_page_class_init (PhoshWifiHotspotStatusPageClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = phosh_wifi_hotspot_status_page_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, + "/mobi/phosh/plugins/wifi-hotspot-quick-setting/status-page.ui"); + + gtk_widget_class_bind_template_child (widget_class, PhoshWifiHotspotStatusPage, entry); + gtk_widget_class_bind_template_child (widget_class, PhoshWifiHotspotStatusPage, image); + gtk_widget_class_bind_template_child (widget_class, PhoshWifiHotspotStatusPage, placeholder); + gtk_widget_class_bind_template_child (widget_class, PhoshWifiHotspotStatusPage, stack); + gtk_widget_class_bind_template_child (widget_class, PhoshWifiHotspotStatusPage, turn_on_btn); + gtk_widget_class_bind_template_callback (widget_class, on_turn_on_clicked); + gtk_widget_class_bind_template_callback (widget_class, on_icon_press); + + gtk_widget_class_set_css_name (widget_class, "phosh-wifi-hotspot-status-page"); +} + + +static void +phosh_wifi_hotspot_status_page_init (PhoshWifiHotspotStatusPage *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->cancel = g_cancellable_new (); + self->wifi = phosh_shell_get_wifi_manager (phosh_shell_get_default ()); + + g_return_if_fail (PHOSH_IS_WIFI_MANAGER (self->wifi)); + + g_object_connect (self->wifi, + "swapped-object-signal::notify::present", + G_CALLBACK (on_wifi_notify), self, + "swapped-object-signal::notify::enabled", + G_CALLBACK (on_wifi_notify), self, + "swapped-object-signal::notify::is-hotspot-master", + G_CALLBACK (on_wifi_notify), self, + NULL); +} + + +GtkWidget * +phosh_wifi_hotspot_status_page_new (void) +{ + return g_object_new (PHOSH_TYPE_WIFI_HOTSPOT_STATUS_PAGE, NULL); +} diff --git a/plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.h b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.h new file mode 100644 index 000000000..21fadc497 --- /dev/null +++ b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-status-page.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2025 Phosh.mobi e.V. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "status-page.h" + +G_BEGIN_DECLS + +#define PHOSH_TYPE_WIFI_HOTSPOT_STATUS_PAGE phosh_wifi_hotspot_status_page_get_type () + +G_DECLARE_FINAL_TYPE (PhoshWifiHotspotStatusPage, phosh_wifi_hotspot_status_page, PHOSH, + WIFI_HOTSPOT_STATUS_PAGE, PhoshStatusPage) + +GtkWidget *phosh_wifi_hotspot_status_page_new (void); + +G_END_DECLS diff --git a/po/POTFILES.in b/po/POTFILES.in index ff029886b..5c2da3133 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -141,4 +141,5 @@ plugins/upcoming-events/prefs/upcoming-events-prefs.ui plugins/scaling-quick-setting/qs.ui plugins/scaling-quick-setting/scale-row.c plugins/scaling-quick-setting/scaling-quick-setting.c +plugins/wifi-hotspot-quick-setting/status-page.ui plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c -- GitLab From 2010f5af725687b08eb25d6b011f139071e3a9fc Mon Sep 17 00:00:00 2001 From: Arun Mani J Date: Fri, 14 Nov 2025 17:19:36 +0530 Subject: [PATCH 5/5] wifi-hotspot-quick-setting: Add status-page Closes: https://gitlab.gnome.org/World/Phosh/phosh/-/issues/1259 Signed-off-by: Arun Mani J Part-of: --- plugins/wifi-hotspot-quick-setting/qs.ui | 2 ++ .../wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/plugins/wifi-hotspot-quick-setting/qs.ui b/plugins/wifi-hotspot-quick-setting/qs.ui index 8e677cab1..039c27254 100644 --- a/plugins/wifi-hotspot-quick-setting/qs.ui +++ b/plugins/wifi-hotspot-quick-setting/qs.ui @@ -3,10 +3,12 @@ 1 16 + diff --git a/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c index c65f395e6..f11a99fef 100644 --- a/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c +++ b/plugins/wifi-hotspot-quick-setting/wifi-hotspot-quick-setting.c @@ -7,6 +7,7 @@ */ #include "wifi-hotspot-quick-setting.h" +#include "wifi-hotspot-status-page.h" #include "plugin-shell.h" #include @@ -100,6 +101,8 @@ phosh_wifi_hotspot_quick_setting_class_init (PhoshWifiHotspotQuickSettingClass * { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + g_type_ensure (PHOSH_TYPE_WIFI_HOTSPOT_STATUS_PAGE); + gtk_widget_class_set_template_from_resource (widget_class, "/mobi/phosh/plugins/wifi-hotspot-quick-setting/qs.ui"); -- GitLab