[gnome-control-center] wwan: Port to GTK4
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wwan: Port to GTK4
- Date: Thu, 6 Jan 2022 15:10:42 +0000 (UTC)
commit fbb2f98c44548a6158cbdaa3c10aafdacd8247d6
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Sun Dec 19 19:57:26 2021 +0530
wwan: Port to GTK4
panels/meson.build | 2 +-
panels/wwan/cc-wwan-apn-dialog.c | 51 ++---
panels/wwan/cc-wwan-apn-dialog.h | 2 +-
panels/wwan/cc-wwan-apn-dialog.ui | 172 ++++++--------
panels/wwan/cc-wwan-details-dialog.c | 3 +-
panels/wwan/cc-wwan-details-dialog.h | 2 +-
panels/wwan/cc-wwan-details-dialog.ui | 203 ++++++++---------
panels/wwan/cc-wwan-device-page.c | 31 +--
panels/wwan/cc-wwan-device-page.ui | 402 ++++++++++++++++-----------------
panels/wwan/cc-wwan-mode-dialog.c | 37 +--
panels/wwan/cc-wwan-mode-dialog.h | 2 +-
panels/wwan/cc-wwan-mode-dialog.ui | 36 ++-
panels/wwan/cc-wwan-network-dialog.c | 60 +++--
panels/wwan/cc-wwan-network-dialog.h | 2 +-
panels/wwan/cc-wwan-network-dialog.ui | 107 ++++-----
panels/wwan/cc-wwan-panel.c | 188 +++++++--------
panels/wwan/cc-wwan-panel.ui | 376 +++++++++++-------------------
panels/wwan/cc-wwan-sim-lock-dialog.c | 23 +-
panels/wwan/cc-wwan-sim-lock-dialog.h | 2 +-
panels/wwan/cc-wwan-sim-lock-dialog.ui | 369 ++++++++++++++----------------
panels/wwan/meson.build | 3 +-
shell/cc-panel-loader.c | 6 +-
22 files changed, 920 insertions(+), 1159 deletions(-)
---
diff --git a/panels/meson.build b/panels/meson.build
index 3fec950e3..d379a9fb1 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -28,7 +28,7 @@ panels = [
'universal-access',
'usage',
# 'user-accounts',
-# 'wwan',
+ 'wwan',
]
if host_is_linux
diff --git a/panels/wwan/cc-wwan-apn-dialog.c b/panels/wwan/cc-wwan-apn-dialog.c
index bc5fde283..681f26e51 100644
--- a/panels/wwan/cc-wwan-apn-dialog.c
+++ b/panels/wwan/cc-wwan-apn-dialog.c
@@ -31,7 +31,6 @@
#include "cc-wwan-device.h"
#include "cc-wwan-data.h"
-#include "list-box-helper.h"
#include "cc-wwan-apn-dialog.h"
#include "cc-wwan-resources.h"
@@ -52,7 +51,7 @@ struct _CcWwanApnDialog
GtkEntry *username_entry;
GtkGrid *apn_edit_view;
GtkListBox *apn_list;
- GtkRadioButton *apn_radio_button;
+ GtkCheckButton *apn_radio_button;
GtkScrolledWindow *apn_list_view;
GtkStack *apn_settings_stack;
@@ -81,7 +80,7 @@ G_DECLARE_FINAL_TYPE (CcWwanApnRow, cc_wwan_apn_row, CC, WWAN_APN_ROW, GtkListBo
struct _CcWwanApnRow
{
GtkListBoxRow parent_instance;
- GtkRadioButton *radio_button;
+ GtkCheckButton *radio_button;
CcWwanDataApn *apn;
};
@@ -133,10 +132,10 @@ cc_wwan_apn_back_clicked_cb (CcWwanApnDialog *self)
static void
cc_wwan_apn_add_clicked_cb (CcWwanApnDialog *self)
{
- gtk_entry_set_text (self->name_entry, "");
- gtk_entry_set_text (self->apn_entry, "");
- gtk_entry_set_text (self->username_entry, "");
- gtk_entry_set_text (self->password_entry, "");
+ gtk_editable_set_text (GTK_EDITABLE (self->name_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (self->apn_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (self->username_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (self->password_entry), "");
gtk_widget_hide (GTK_WIDGET (self->add_button));
gtk_widget_show (GTK_WIDGET (self->save_button));
@@ -154,16 +153,16 @@ cc_wwan_apn_save_clicked_cb (CcWwanApnDialog *self)
apn = self->apn_to_save;
self->apn_to_save = NULL;
- name = gtk_entry_get_text (self->name_entry);
- apn_name = gtk_entry_get_text (self->apn_entry);
+ name = gtk_editable_get_text (GTK_EDITABLE (self->name_entry));
+ apn_name = gtk_editable_get_text (GTK_EDITABLE (self->apn_entry));
if (!apn)
apn = cc_wwan_data_apn_new ();
cc_wwan_data_apn_set_name (apn, name);
cc_wwan_data_apn_set_apn (apn, apn_name);
- cc_wwan_data_apn_set_username (apn, gtk_entry_get_text (self->username_entry));
- cc_wwan_data_apn_set_password (apn, gtk_entry_get_text (self->password_entry));
+ cc_wwan_data_apn_set_username (apn, gtk_editable_get_text (GTK_EDITABLE (self->username_entry)));
+ cc_wwan_data_apn_set_password (apn, gtk_editable_get_text (GTK_EDITABLE (self->password_entry)));
cc_wwan_data_save_apn (self->wwan_data, apn, NULL, NULL, NULL);
@@ -180,7 +179,7 @@ cc_wwan_apn_entry_changed_cb (CcWwanApnDialog *self)
gboolean valid_name, valid_apn;
widget = GTK_WIDGET (self->name_entry);
- str = gtk_entry_get_text (self->name_entry);
+ str = gtk_editable_get_text (GTK_EDITABLE (self->name_entry));
valid_name = str && *str;
if (valid_name)
@@ -189,7 +188,7 @@ cc_wwan_apn_entry_changed_cb (CcWwanApnDialog *self)
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "error");
widget = GTK_WIDGET (self->apn_entry);
- str = gtk_entry_get_text (self->apn_entry);
+ str = gtk_editable_get_text (GTK_EDITABLE (self->apn_entry));
valid_apn = str && *str;
if (valid_apn)
@@ -204,7 +203,7 @@ static void
cc_wwan_apn_activated_cb (CcWwanApnDialog *self,
CcWwanApnRow *row)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (row->radio_button), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (row->radio_button), TRUE);
}
static void
@@ -213,7 +212,7 @@ cc_wwan_apn_changed_cb (CcWwanApnDialog *self,
{
CcWwanApnRow *row;
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
return;
widget = gtk_widget_get_ancestor (widget, CC_TYPE_WWAN_APN_ROW);
@@ -239,10 +238,10 @@ cc_wwan_apn_edit_clicked_cb (CcWwanApnDialog *self,
gtk_widget_show (GTK_WIDGET (self->save_button));
gtk_widget_hide (GTK_WIDGET (self->add_button));
- gtk_entry_set_text (self->name_entry, cc_wwan_data_apn_get_name (apn));
- gtk_entry_set_text (self->apn_entry, cc_wwan_data_apn_get_apn (apn));
- gtk_entry_set_text (self->username_entry, cc_wwan_data_apn_get_username (apn));
- gtk_entry_set_text (self->password_entry, cc_wwan_data_apn_get_password (apn));
+ gtk_editable_set_text (GTK_EDITABLE (self->name_entry), cc_wwan_data_apn_get_name (apn));
+ gtk_editable_set_text (GTK_EDITABLE (self->apn_entry), cc_wwan_data_apn_get_apn (apn));
+ gtk_editable_set_text (GTK_EDITABLE (self->username_entry), cc_wwan_data_apn_get_username (apn));
+ gtk_editable_set_text (GTK_EDITABLE (self->password_entry), cc_wwan_data_apn_get_password (apn));
gtk_stack_set_visible_child (self->apn_settings_stack,
GTK_WIDGET (self->apn_edit_view));
@@ -265,14 +264,15 @@ cc_wwan_apn_dialog_row_new (CcWwanDataApn *apn,
"margin-end", 6,
NULL);
- radio = gtk_radio_button_new_from_widget (self->apn_radio_button);
- row->radio_button = GTK_RADIO_BUTTON (radio);
+ radio = gtk_check_button_new ();
+ row->radio_button = GTK_CHECK_BUTTON (radio);
+ gtk_check_button_set_group (row->radio_button, self->apn_radio_button);
gtk_widget_set_margin_end (radio, 12);
gtk_grid_attach (GTK_GRID (grid), radio, 0, 0, 1, 2);
row->apn = g_object_ref (apn);
if (cc_wwan_data_get_default_apn (self->wwan_data) == apn)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (radio), TRUE);
g_signal_connect_object (radio, "toggled",
G_CALLBACK (cc_wwan_apn_changed_cb),
self, G_CONNECT_SWAPPED);
@@ -288,15 +288,13 @@ cc_wwan_apn_dialog_row_new (CcWwanDataApn *apn,
gtk_style_context_add_class (context, "dim-label");
gtk_grid_attach (GTK_GRID (grid), apn_label, 1, 1, 1, 1);
- edit_button = gtk_button_new_from_icon_name ("emblem-system-symbolic",
- GTK_ICON_SIZE_BUTTON);
+ edit_button = gtk_button_new_from_icon_name ("emblem-system-symbolic");
g_signal_connect_object (edit_button, "clicked",
G_CALLBACK (cc_wwan_apn_edit_clicked_cb),
self, G_CONNECT_SWAPPED);
gtk_grid_attach (GTK_GRID (grid), edit_button, 2, 0, 1, 2);
- gtk_container_add (GTK_CONTAINER (row), grid);
- gtk_widget_show_all (GTK_WIDGET (row));
+ gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid);
return GTK_WIDGET (row);
}
@@ -351,6 +349,7 @@ cc_wwan_apn_dialog_show (GtkWidget *widget)
{
CcWwanApnDialog *self = (CcWwanApnDialog *)widget;
+ gtk_widget_set_sensitive (GTK_WIDGET (self->save_button), FALSE);
gtk_widget_show (GTK_WIDGET (self->add_button));
gtk_widget_hide (GTK_WIDGET (self->save_button));
gtk_stack_set_visible_child (self->apn_settings_stack,
diff --git a/panels/wwan/cc-wwan-apn-dialog.h b/panels/wwan/cc-wwan-apn-dialog.h
index 0e9885836..37e905ec3 100644
--- a/panels/wwan/cc-wwan-apn-dialog.h
+++ b/panels/wwan/cc-wwan-apn-dialog.h
@@ -24,7 +24,7 @@
#pragma once
-#include <handy.h>
+#include <adwaita.h>
#include <shell/cc-panel.h>
#include "cc-wwan-device.h"
diff --git a/panels/wwan/cc-wwan-apn-dialog.ui b/panels/wwan/cc-wwan-apn-dialog.ui
index 59216d9fb..e06786c88 100644
--- a/panels/wwan/cc-wwan-apn-dialog.ui
+++ b/panels/wwan/cc-wwan-apn-dialog.ui
@@ -1,123 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanApnDialog" parent="GtkDialog">
<property name="default-height">480</property>
<property name="default-width">360</property>
- <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+ <property name="hide-on-close">True</property>
+ <property name="title" translatable="yes">Access Points</property>
+ <property name="modal">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
- <property name="visible">1</property>
- <property name="title" translatable="yes">Access Points</property>
<!-- Back button -->
- <child>
+ <child type="start">
<object class="GtkButton" id="back_button">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <signal name="clicked" handler="cc_wwan_apn_back_clicked_cb" swapped="yes" />
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Back</property>
- </object>
- </child>
+ <property name="use-underline">True</property>
+ <property name="icon-name">go-previous-symbolic</property>
+ <signal name="clicked" handler="cc_wwan_apn_back_clicked_cb" swapped="yes"/>
+ <accessibility>
+ <property name="label" translatable="yes">Back</property>
+ </accessibility>
<child>
<object class="GtkImage">
- <property name="visible">1</property>
<property name="icon-name">go-previous-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="pack-type">start</property>
- </packing>
</child>
<!-- Add button -->
- <child>
+ <child type="end">
<object class="GtkButton" id="add_button">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <signal name="clicked" handler="cc_wwan_apn_add_clicked_cb" swapped="yes" />
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Add</property>
- </object>
- </child>
+ <property name="use-underline">True</property>
+ <property name="icon-name">list-add-symbolic</property>
+ <signal name="clicked" handler="cc_wwan_apn_add_clicked_cb" swapped="yes"/>
+ <accessibility>
+ <property name="label" translatable="yes">Add</property>
+ </accessibility>
<child>
<object class="GtkImage">
- <property name="visible">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
<!-- Save button -->
- <child>
+ <child type="end">
<object class="GtkButton" id="save_button">
- <property name="visible">0</property>
- <property name="use-underline">1</property>
+ <property name="visible">False</property>
+ <property name="use-underline">True</property>
<property name="label" translatable="yes">_Save</property>
- <signal name="clicked" handler="cc_wwan_apn_save_clicked_cb" swapped="yes" />
+ <signal name="clicked" handler="cc_wwan_apn_save_clicked_cb" swapped="yes"/>
<style>
- <class name="default" />
+ <class name="default"/>
</style>
</object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
- <property name="visible">1</property>
- <property name="border-width">0</property>
<property name="width-request">340</property>
<property name="height-request">360</property>
<child>
- <object class="HdyClamp">
- <property name="visible">1</property>
+ <object class="AdwClamp">
<property name="margin-top">32</property>
<property name="margin-bottom">32</property>
<child>
<object class="GtkStack" id="apn_settings_stack">
- <property name="visible">1</property>
<property name="transition-type">slide-left-right</property>
<!-- Access Point List -->
<child>
<object class="GtkScrolledWindow" id="apn_list_view">
- <property name="visible">1</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
- <child>
+ <property name="child">
<object class="GtkListBox" id="apn_list">
- <property name="visible">1</property>
<property name="valign">start</property>
<property name="selection-mode">none</property>
- <signal name="row-activated" handler="cc_wwan_apn_activated_cb" swapped="yes" />
+ <signal name="row-activated" handler="cc_wwan_apn_activated_cb" swapped="yes"/>
<style>
- <class name="boxed-list" />
+ <class name="boxed-list"/>
</style>
</object>
- </child>
+ </property>
</object>
</child>
<child>
<object class="GtkGrid" id="apn_edit_view">
- <property name="visible">1</property>
<property name="orientation">vertical</property>
- <property name="expand">1</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="row-spacing">6</property>
@@ -126,110 +106,102 @@
<!-- Name -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Name</property>
<style>
- <class name="dim-label" />
+ <class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
- <property name="visible">1</property>
- <property name="hexpand">1</property>
- <signal name="changed" handler="cc_wwan_apn_entry_changed_cb" swapped="yes" />
+ <property name="hexpand">True</property>
+ <signal name="changed" handler="cc_wwan_apn_entry_changed_cb" swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<!-- APN -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="label" translatable="yes">APN</property>
<style>
- <class name="dim-label" />
+ <class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="apn_entry">
- <property name="visible">1</property>
<property name="margin-bottom">12</property>
- <signal name="changed" handler="cc_wwan_apn_entry_changed_cb" swapped="yes" />
+ <signal name="changed" handler="cc_wwan_apn_entry_changed_cb" swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<!-- Username -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Username</property>
<style>
- <class name="dim-label" />
+ <class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="username_entry">
- <property name="visible">1</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<!-- Password -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Password</property>
<style>
- <class name="dim-label" />
+ <class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="password_entry">
- <property name="visible">1</property>
<property name="margin-bottom">12</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">3</property>
- </packing>
</child>
</object>
@@ -240,10 +212,10 @@
</object>
</child>
</object>
- </child> <!-- ./internal-child -->
+ </child>
</template>
<!-- A simple hack to create a radio button group -->
- <object class="GtkRadioButton" id="apn_radio_button" />
+ <object class="GtkCheckButton" id="apn_radio_button"/>
</interface>
diff --git a/panels/wwan/cc-wwan-details-dialog.c b/panels/wwan/cc-wwan-details-dialog.c
index 59e8dc361..8f2f27d2a 100644
--- a/panels/wwan/cc-wwan-details-dialog.c
+++ b/panels/wwan/cc-wwan-details-dialog.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* cc-wwan-network-dialog.c
*
- * Copyright 2019 Purism SPC
+ * Copyright 2019,2022 Purism SPC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
#include <glib/gi18n.h>
#include <libmm-glib.h>
-#include "list-box-helper.h"
#include "cc-wwan-details-dialog.h"
#include "cc-wwan-resources.h"
diff --git a/panels/wwan/cc-wwan-details-dialog.h b/panels/wwan/cc-wwan-details-dialog.h
index 7e7812cde..3144eee31 100644
--- a/panels/wwan/cc-wwan-details-dialog.h
+++ b/panels/wwan/cc-wwan-details-dialog.h
@@ -24,7 +24,7 @@
#pragma once
-#include <handy.h>
+#include <adwaita.h>
#include <shell/cc-panel.h>
#include "cc-wwan-device.h"
diff --git a/panels/wwan/cc-wwan-details-dialog.ui b/panels/wwan/cc-wwan-details-dialog.ui
index 042d3ee33..1deac26b0 100644
--- a/panels/wwan/cc-wwan-details-dialog.ui
+++ b/panels/wwan/cc-wwan-details-dialog.ui
@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanDetailsDialog" parent="GtkDialog">
<property name="title" translatable="yes">Modem Details</property>
<property name="default-height">480</property>
<property name="default-width">360</property>
- <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+ <property name="hide-on-close">True</property>
+ <property name="modal">True</property>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
- <property name="visible">1</property>
- <property name="border-width">0</property>
<property name="width-request">340</property>
<property name="height-request">360</property>
<child>
- <object class="HdyClamp">
- <property name="visible">1</property>
+ <object class="AdwClamp">
<property name="margin-top">32</property>
<property name="margin-bottom">32</property>
<property name="margin-start">18</property>
@@ -22,13 +21,11 @@
<child>
<object class="GtkBox">
- <property name="visible">1</property>
<property name="orientation">vertical</property>
<!-- Modem Status Title -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="margin-bottom">12</property>
<property name="label" translatable="yes">Modem Status</property>
<property name="xalign">0.0</property>
@@ -41,7 +38,6 @@
<!-- Modem Status Content -->
<child>
<object class="GtkGrid">
- <property name="visible">1</property>
<property name="row-spacing">9</property>
<property name="column-spacing">6</property>
<property name="margin-bottom">24</property>
@@ -49,261 +45,242 @@
<!-- Carrier -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Carrier</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="operator_name">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<!-- Network Type -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Network Type</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="network_type">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<!-- Signal Strength -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Signal Strength</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="signal_strength">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<!-- Network Status -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Network Status</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="network_status">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">3</property>
- </packing>
</child>
<!-- Own Numbers -->
<child>
<object class="GtkLabel">
- <property name="visible" bind-source="own_numbers"
- bind-property="visible" bind-flags="sync-create"/>
+ <property name="visible" bind-source="own_numbers" bind-flags="sync-create"/>
<property name="label" translatable="yes">Own Number</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">4</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="own_numbers">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">4</property>
- </packing>
</child>
- <!-- Device Details Title -->
+ <!-- Device Details Title -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="margin-bottom">12</property>
<property name="label" translatable="yes">Device Details</property>
<property name="xalign">0.0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">5</property>
+ <property name="column-span">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">5</property>
- <property name="width">2</property>
- </packing>
</child>
<!-- Device Details Content -->
<!-- Manufacturer -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Manufacturer</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">6</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">6</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="manufacturer">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">6</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">6</property>
- </packing>
</child>
<!-- Model -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Model</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">7</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">7</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="device_model">
- <property name="visible">1</property>
<property name="xalign">0.0</property>
- <property name="selectable">1</property>
+ <property name="selectable">True</property>
<property name="ellipsize">end</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">7</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">7</property>
- </packing>
</child>
<!-- Firmware version -->
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Firmware Version</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">8</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">8</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="firmware_version">
- <property name="visible">1</property>
- <property name="selectable">1</property>
+ <property name="selectable">True</property>
<property name="xalign">0.0</property>
<property name="ellipsize">end</property>
- <property name="wrap">1</property>
+ <property name="wrap">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">8</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">8</property>
- </packing>
</child>
<!-- IMEI/ICCID -->
<child>
<object class="GtkLabel" id="identifier_label">
- <property name="visible">1</property>
<property name="label" translatable="yes">IMEI</property>
<property name="xalign">1.0</property>
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">9</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">9</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="device_identifier">
- <property name="visible">1</property>
- <property name="selectable">1</property>
+ <property name="selectable">True</property>
<property name="xalign">0.0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">9</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">9</property>
- </packing>
</child>
</object>
@@ -311,10 +288,10 @@
</object>
</child>
- </object> <!-- ./HdyClamp -->
+ </object> <!-- ./AdwClamp -->
</child>
</object>
- </child> <!-- ./internal-child -->
+ </child>
</template>
</interface>
diff --git a/panels/wwan/cc-wwan-device-page.c b/panels/wwan/cc-wwan-device-page.c
index 41379742b..b5dae5f9b 100644
--- a/panels/wwan/cc-wwan-device-page.c
+++ b/panels/wwan/cc-wwan-device-page.c
@@ -29,9 +29,8 @@
#include <glib/gi18n.h>
#include <libmm-glib.h>
#define GCR_API_SUBJECT_TO_CHANGE
-#include <gcr/gcr.h>
+#include <gcr/gcr-base.h>
-#include "list-box-helper.h"
#include "cc-list-row.h"
#include "cc-wwan-data.h"
#include "cc-wwan-mode-dialog.h"
@@ -153,7 +152,7 @@ wwan_data_show_apn_dialog (CcWwanDevicePage *self)
{
GtkWindow *top_level;
- top_level = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
+ top_level = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self)));
if (!self->apn_dialog)
{
@@ -364,7 +363,7 @@ wwan_network_settings_activated_cb (CcWwanDevicePage *self,
GtkWidget *dialog;
GtkWindow *top_level;
- top_level = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
+ top_level = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self)));
if (row == self->network_mode_row)
{
@@ -394,7 +393,7 @@ wwan_advanced_settings_activated_cb (CcWwanDevicePage *self,
{
GtkWindow *top_level;
- top_level = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
+ top_level = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self)));
if (row == self->sim_lock_row)
{
@@ -535,11 +534,11 @@ cc_wwan_device_page_dispose (GObject *object)
{
CcWwanDevicePage *self = (CcWwanDevicePage *)object;
- g_clear_pointer ((GtkWidget **)&self->apn_dialog, gtk_widget_destroy);
- g_clear_pointer ((GtkWidget **)&self->details_dialog, gtk_widget_destroy);
- g_clear_pointer ((GtkWidget **)&self->network_mode_dialog, gtk_widget_destroy);
- g_clear_pointer ((GtkWidget **)&self->network_dialog, gtk_widget_destroy);
- g_clear_pointer ((GtkWidget **)&self->sim_lock_dialog, gtk_widget_destroy);
+ g_clear_pointer ((GtkWindow **)&self->apn_dialog, gtk_window_destroy);
+ g_clear_pointer ((GtkWindow **)&self->details_dialog, gtk_window_destroy);
+ g_clear_pointer ((GtkWindow **)&self->network_mode_dialog, gtk_window_destroy);
+ g_clear_pointer ((GtkWindow **)&self->network_dialog, gtk_window_destroy);
+ g_clear_pointer ((GtkWindow **)&self->sim_lock_dialog, gtk_window_destroy);
g_clear_object (&self->wwan_proxy);
g_clear_object (&self->device);
@@ -594,18 +593,6 @@ static void
cc_wwan_device_page_init (CcWwanDevicePage *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
-
- gtk_list_box_set_header_func (self->data_settings_list,
- cc_list_box_update_header_func,
- NULL, NULL);
-
- gtk_list_box_set_header_func (self->network_settings_list,
- cc_list_box_update_header_func,
- NULL, NULL);
-
- gtk_list_box_set_header_func (self->advanced_settings_list,
- cc_list_box_update_header_func,
- NULL, NULL);
}
static void
diff --git a/panels/wwan/cc-wwan-device-page.ui b/panels/wwan/cc-wwan-device-page.ui
index f77bd707d..141775b18 100644
--- a/panels/wwan/cc-wwan-device-page.ui
+++ b/panels/wwan/cc-wwan-device-page.ui
@@ -1,259 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanDevicePage" parent="GtkBox">
- <property name="visible">1</property>
<child>
<object class="GtkStack" id="main_stack">
- <property name="visible">1</property>
- <property name="homogeneous">0</property>
+ <property name="vhomogeneous">False</property>
+ <property name="hhomogeneous">False</property>
<!-- SIM not inserted view -->
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="expand">1</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="orientation">vertical</property>
- <property name="margin-bottom">64</property>
- <child>
- <object class="GtkImage">
- <property name="visible">1</property>
- <property name="icon-name">auth-sim-missing</property>
- <property name="pixel-size">192</property>
- <property name="margin-bottom">18</property>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">No SIM</property>
- <attributes>
- <attribute name="weight" value="bold" />
- <attribute name="scale" value="1.2" />
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">Insert a SIM card to use this modem</property>
+ <object class="GtkStackPage">
+ <property name="name">no-sim-view</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="margin-bottom">64</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">auth-sim-missing</property>
+ <property name="pixel-size">192</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">No SIM</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ <attribute name="scale" value="1.2"></attribute>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Insert a SIM card to use this modem</property>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">no-sim-view</property>
- </packing>
</child>
<!-- SIM locked view -->
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="expand">1</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="orientation">vertical</property>
- <property name="margin-bottom">64</property>
- <child>
- <object class="GtkImage">
- <property name="visible">1</property>
- <property name="icon-name">auth-sim-locked</property>
- <property name="pixel-size">192</property>
- <property name="margin-bottom">18</property>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">SIM Locked</property>
- <property name="margin-bottom">32</property>
- <attributes>
- <attribute name="weight" value="bold" />
- <attribute name="scale" value="1.2" />
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="unlock_button">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="label" translatable="yes">_Unlock</property>
- <signal name="clicked" handler="wwan_device_unlock_clicked_cb" swapped="yes" />
- <style>
- <class name="suggested-action" />
- </style>
- </object>
- </child>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">sim-lock-view</property>
- </packing>
- </child> <!-- -->
-
- <!-- Network Settings -->
- <child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="margin-top">18</property>
- <property name="orientation">vertical</property>
-
- <!-- Network Settings Title -->
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="label" translatable="yes">Network</property>
- <property name="xalign">0.0</property>
- <property name="margin-bottom">12</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
-
- <!-- Internet settings -->
- <child>
- <object class="GtkListBox" id="data_settings_list">
- <property name="visible">1</property>
- <property name="margin-bottom">32</property>
- <property name="selection-mode">none</property>
- <style>
- <class name="frame" />
- </style>
-
- <!-- Enable/Disable Data -->
+ <property name="child">
+ <object class="GtkBox">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="margin-bottom">64</property>
<child>
- <object class="CcListRow" id="data_enable_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="show-switch">1</property>
- <property name="title" translatable="yes">_Mobile Data</property>
- <property name="subtitle" translatable="yes">Access data using mobile network</property>
- <signal name="notify::active" handler="wwan_data_settings_changed_cb" swapped="yes" />
+ <object class="GtkImage">
+ <property name="icon-name">auth-sim-locked</property>
+ <property name="pixel-size">192</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
</child>
-
- <!-- Data Roaming -->
<child>
- <object class="CcListRow" id="data_roaming_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="show-switch">1</property>
- <property name="title" translatable="yes">_Data Roaming</property>
- <property name="subtitle" translatable="yes">Use mobile data when roaming</property>
- <signal name="notify::active" handler="wwan_data_settings_changed_cb" swapped="yes" />
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">SIM Locked</property>
+ <property name="margin-bottom">32</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ <attribute name="scale" value="1.2"></attribute>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="unlock_button">
+ <property name="use-underline">True</property>
+ <property name="label" translatable="yes">_Unlock</property>
+ <signal name="clicked" handler="wwan_device_unlock_clicked_cb" swapped="yes"/>
+ <style>
+ <class name="suggested-action"/>
+ </style>
</object>
</child>
-
</object>
- </child>
+ </property>
+ </object>
+ </child>
- <!-- Network Settings -->
- <child>
- <object class="GtkListBox" id="network_settings_list" >
- <property name="visible">1</property>
- <property name="margin-bottom">32</property>
- <property name="selection-mode">none</property>
- <style>
- <class name="frame" />
- </style>
- <signal name="row-activated" handler="wwan_network_settings_activated_cb" swapped="yes" />
+ <!-- Network Settings -->
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">settings-view</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="margin-top">18</property>
+ <property name="orientation">vertical</property>
- <!-- Network Mode -->
+ <!-- Network Settings Title -->
<child>
- <object class="CcListRow" id="network_mode_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="icon-name">go-next-symbolic</property>
- <property name="title" translatable="yes">_Network Mode</property>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Network</property>
+ <property name="xalign">0.0</property>
+ <property name="margin-bottom">12</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ </attributes>
</object>
</child>
- <!-- Network -->
+ <!-- Internet settings -->
<child>
- <object class="CcListRow" id="network_name_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="icon-name">go-next-symbolic</property>
- <property name="title" translatable="yes">N_etwork</property>
+ <object class="GtkListBox" id="data_settings_list">
+ <property name="margin-bottom">32</property>
+ <property name="selection-mode">none</property>
+ <style>
+ <class name="boxed-list"/>
+ </style>
+
+ <!-- Enable/Disable Data -->
+ <child>
+ <object class="CcListRow" id="data_enable_row">
+ <property name="use-underline">True</property>
+ <property name="show-switch">True</property>
+ <property name="title" translatable="yes">_Mobile Data</property>
+ <property name="subtitle" translatable="yes">Access data using mobile
network</property>
+ <signal name="notify::active" handler="wwan_data_settings_changed_cb" swapped="yes"/>
+ </object>
+ </child>
+
+ <!-- Data Roaming -->
+ <child>
+ <object class="CcListRow" id="data_roaming_row">
+ <property name="use-underline">True</property>
+ <property name="show-switch">True</property>
+ <property name="title" translatable="yes">_Data Roaming</property>
+ <property name="subtitle" translatable="yes">Use mobile data when roaming</property>
+ <signal name="notify::active" handler="wwan_data_settings_changed_cb" swapped="yes"/>
+ </object>
+ </child>
+
</object>
</child>
- </object>
- </child>
-
-
- <!-- Advanced Settings Title -->
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="label" translatable="yes">Advanced</property>
- <property name="xalign">0.0</property>
- <property name="margin-bottom">12</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
-
- <!-- Advanced settings -->
- <child>
- <object class="GtkListBox" id="advanced_settings_list" >
- <property name="visible">1</property>
- <property name="margin-bottom">32</property>
- <property name="selection-mode">none</property>
- <style>
- <class name="frame" />
- </style>
- <signal name="row-activated" handler="wwan_advanced_settings_activated_cb" swapped="yes" />
-
- <!-- Accesss Point Settings -->
+ <!-- Network Settings -->
<child>
- <object class="CcListRow" id="apn_settings_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="icon-name">go-next-symbolic</property>
- <property name="title" translatable="yes">_Access Point Names</property>
+ <object class="GtkListBox" id="network_settings_list">
+ <property name="margin-bottom">32</property>
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="wwan_network_settings_activated_cb" swapped="yes"/>
+ <style>
+ <class name="boxed-list"/>
+ </style>
+ <child>
+ <object class="CcListRow" id="network_mode_row">
+ <property name="use-underline">True</property>
+ <property name="icon-name">go-next-symbolic</property>
+ <property name="title" translatable="yes">_Network Mode</property>
+ </object>
+ </child>
+ <child>
+ <object class="CcListRow" id="network_name_row">
+ <property name="use-underline">True</property>
+ <property name="icon-name">go-next-symbolic</property>
+ <property name="title" translatable="yes">N_etwork</property>
+ </object>
+ </child>
+
</object>
</child>
- <!-- SIM Lock -->
+ <!-- Advanced Settings Title -->
<child>
- <object class="CcListRow" id="sim_lock_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="icon-name">go-next-symbolic</property>
- <property name="title" translatable="yes">_SIM Lock</property>
- <property name="subtitle" translatable="yes">Lock SIM with PIN</property>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Advanced</property>
+ <property name="xalign">0.0</property>
+ <property name="margin-bottom">12</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ </attributes>
</object>
</child>
-
- <!-- Modem Details -->
<child>
- <object class="CcListRow" id="details_row">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <property name="icon-name">go-next-symbolic</property>
- <property name="title" translatable="yes">M_odem Details</property>
+ <object class="GtkListBox" id="advanced_settings_list">
+ <property name="margin-bottom">32</property>
+ <property name="selection-mode">none</property>
+ <style>
+ <class name="boxed-list"/>
+ </style>
+ <signal name="row-activated" handler="wwan_advanced_settings_activated_cb"
swapped="yes"/>
+
+ <!-- Accesss Point Settings -->
+ <child>
+ <object class="CcListRow" id="apn_settings_row">
+ <property name="use-underline">True</property>
+ <property name="icon-name">go-next-symbolic</property>
+ <property name="title" translatable="yes">_Access Point Names</property>
+ </object>
+ </child>
+
+ <!-- SIM Lock -->
+ <child>
+ <object class="CcListRow" id="sim_lock_row">
+ <property name="use-underline">True</property>
+ <property name="icon-name">go-next-symbolic</property>
+ <property name="title" translatable="yes">_SIM Lock</property>
+ <property name="subtitle" translatable="yes">Lock SIM with PIN</property>
+ </object>
+ </child>
+
+ <!-- Modem Details -->
+ <child>
+ <object class="CcListRow" id="details_row">
+ <property name="use-underline">True</property>
+ <property name="icon-name">go-next-symbolic</property>
+ <property name="title" translatable="yes">M_odem Details</property>
+ </object>
+ </child>
</object>
</child>
-
</object>
- </child>
-
+ </property>
</object>
- <packing>
- <property name="name">settings-view</property>
- </packing>
</child>
</object> <!-- ./GtkStack main_stack -->
diff --git a/panels/wwan/cc-wwan-mode-dialog.c b/panels/wwan/cc-wwan-mode-dialog.c
index e5917a41c..88067ff2b 100644
--- a/panels/wwan/cc-wwan-mode-dialog.c
+++ b/panels/wwan/cc-wwan-mode-dialog.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* cc-wwan-mode-dialog.c
*
- * Copyright 2019 Purism SPC
+ * Copyright 2019,2022 Purism SPC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
#include <glib/gi18n.h>
#include <libmm-glib.h>
-#include "list-box-helper.h"
#include "cc-wwan-mode-dialog.h"
#include "cc-wwan-resources.h"
@@ -140,20 +139,25 @@ cc_wwan_mode_dialog_row_new (CcWwanModeDialog *self,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_show (box);
- g_object_set (box, "margin", 18, NULL);
- gtk_container_add (GTK_CONTAINER (row), box);
+ g_object_set (box,
+ "margin-top", 18,
+ "margin-bottom", 18,
+ "margin-start", 18,
+ "margin-end", 18,
+ NULL);
+ gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
mode = cc_wwan_device_get_string_from_mode (self->device, allowed, preferred);
label = gtk_label_new (mode);
- gtk_widget_show (label);
gtk_widget_set_hexpand (label, TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_container_add (GTK_CONTAINER (box), label);
+ gtk_box_append (GTK_BOX (box), label);
/* image should be hidden by default */
- image = gtk_image_new_from_icon_name ("emblem-ok-symbolic", GTK_ICON_SIZE_BUTTON);
- gtk_container_add (GTK_CONTAINER (box), image);
+ image = gtk_image_new_from_icon_name ("emblem-ok-symbolic");
+ gtk_widget_hide (image);
row->ok_emblem = GTK_IMAGE (image);
+ gtk_box_append (GTK_BOX (box), image);
return GTK_WIDGET (row);
}
@@ -194,8 +198,7 @@ cc_wwan_mode_dialog_update (CcWwanModeDialog *self)
continue;
row = cc_wwan_mode_dialog_row_new (self, modes[i][0], modes[i][1]);
- gtk_widget_show (row);
- gtk_container_add (GTK_CONTAINER (self->network_mode_list), row);
+ gtk_list_box_append (GTK_LIST_BOX (self->network_mode_list), row);
}
}
@@ -265,9 +268,13 @@ cc_wwan_mode_dialog_show (GtkWidget *widget)
goto end;
}
- gtk_container_foreach (GTK_CONTAINER (self->network_mode_list),
- (GtkCallback)cc_wwan_mode_dialog_update_mode,
- self);
+ self->selected_row = NULL;
+
+ for (GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (self->network_mode_list));
+ child;
+ child = gtk_widget_get_next_sibling (child))
+ cc_wwan_mode_dialog_update_mode (CC_WWAN_MODE_ROW (child), self);
+
end:
GTK_WIDGET_CLASS (cc_wwan_mode_dialog_parent_class)->show (widget);
}
@@ -306,10 +313,6 @@ static void
cc_wwan_mode_dialog_init (CcWwanModeDialog *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
-
- gtk_list_box_set_header_func (self->network_mode_list,
- cc_list_box_update_header_func,
- NULL, NULL);
}
CcWwanModeDialog *
diff --git a/panels/wwan/cc-wwan-mode-dialog.h b/panels/wwan/cc-wwan-mode-dialog.h
index 2399f0b7b..0916ddf54 100644
--- a/panels/wwan/cc-wwan-mode-dialog.h
+++ b/panels/wwan/cc-wwan-mode-dialog.h
@@ -24,7 +24,7 @@
#pragma once
-#include <handy.h>
+#include <adwaita.h>
#include <shell/cc-panel.h>
#include "cc-wwan-device.h"
diff --git a/panels/wwan/cc-wwan-mode-dialog.ui b/panels/wwan/cc-wwan-mode-dialog.ui
index e0a924a39..e03b5697f 100644
--- a/panels/wwan/cc-wwan-mode-dialog.ui
+++ b/panels/wwan/cc-wwan-mode-dialog.ui
@@ -1,46 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanModeDialog" parent="GtkDialog">
<property name="title" translatable="yes">Network Mode</property>
<property name="default-height">480</property>
<property name="default-width">360</property>
- <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+ <property name="hide-on-close">True</property>
+ <property name="modal">True</property>
- <child internal-child="vbox">
- <object class="GtkBox">
- <property name="visible">1</property>
+ <child>
+ <object class="GtkListBox" id="network_mode_list">
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
- <child>
- <object class="GtkFrame">
- <property name="visible">1</property>
- <child>
- <object class="GtkListBox" id="network_mode_list">
- <property name="visible">1</property>
- <property name="selection-mode">none</property>
- <signal name="row-activated" handler="cc_wwan_mode_changed_cb" swapped="yes" />
- </object>
- </child>
- </object>
- </child>
+ <property name="selection-mode">none</property>
+ <property name="hexpand">True</property>
+ <signal name="row-activated" handler="cc_wwan_mode_changed_cb" swapped="yes"/>
+ <style>
+ <class name="boxed-list"/>
+ </style>
</object>
</child>
<child type="action">
<object class="GtkButton" id="button_cancel">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
+ <property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<signal name="clicked" handler="gtk_widget_hide" swapped="yes"/>
</object>
</child>
<child type="action">
<object class="GtkButton" id="button_ok">
- <property name="visible">1</property>
- <property name="can-default">1</property>
- <property name="use-underline">1</property>
+ <property name="use-underline">True</property>
<property name="label" translatable="yes">_Set</property>
<signal name="clicked" handler="cc_wwan_mode_dialog_ok_clicked_cb" swapped="yes"/>
<style>
@@ -51,7 +43,7 @@
<action-widgets>
<action-widget response="cancel">button_cancel</action-widget>
- <action-widget response="apply" default="true">button_ok</action-widget>
+ <action-widget response="apply" default="True">button_ok</action-widget>
</action-widgets>
</template>
</interface>
diff --git a/panels/wwan/cc-wwan-network-dialog.c b/panels/wwan/cc-wwan-network-dialog.c
index 1c8883b88..4a16b49c3 100644
--- a/panels/wwan/cc-wwan-network-dialog.c
+++ b/panels/wwan/cc-wwan-network-dialog.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* cc-wwan-network-dialog.c
*
- * Copyright 2019 Purism SPC
+ * Copyright 2019,2022 Purism SPC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
#include <glib/gi18n.h>
#include <libmm-glib.h>
-#include "list-box-helper.h"
#include "cc-list-row.h"
#include "cc-wwan-errors-private.h"
#include "cc-wwan-network-dialog.h"
@@ -165,18 +164,23 @@ cc_wwan_network_dialog_row_new (CcWwanNetworkDialog *self,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_show (box);
- g_object_set (box, "margin", 18, NULL);
- gtk_container_add (GTK_CONTAINER (row), box);
+ g_object_set (box,
+ "margin-top", 18,
+ "margin-bottom", 18,
+ "margin-start", 18,
+ "margin-end", 18,
+ NULL);
+ gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
label = gtk_label_new (operator_name);
- gtk_widget_show (label);
gtk_widget_set_hexpand (label, TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_container_add (GTK_CONTAINER (box), label);
+ gtk_box_append (GTK_BOX (box), label);
- image = gtk_image_new_from_icon_name ("emblem-ok-symbolic", GTK_ICON_SIZE_BUTTON);
+ image = gtk_image_new_from_icon_name ("emblem-ok-symbolic");
+ gtk_widget_hide (image);
row->ok_emblem = GTK_IMAGE (image);
- gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (row->ok_emblem));
+ gtk_box_append (GTK_BOX (box), image);
row->operator_code = g_strdup (operator_code);
@@ -187,6 +191,7 @@ static void
cc_wwan_network_dialog_update_current_network (CcWwanNetworkDialog *self)
{
CcWwanNetworkRow *row;
+ GtkWidget *child;
const gchar *operator_name;
operator_name = cc_wwan_device_get_operator_name (self->device);
@@ -194,24 +199,43 @@ cc_wwan_network_dialog_update_current_network (CcWwanNetworkDialog *self)
if (!operator_name || operator_name[0] == '\0')
return;
- gtk_container_foreach (GTK_CONTAINER (self->operator_list_box),
- (GtkCallback)gtk_widget_destroy, NULL);
+ child = gtk_widget_get_first_child (GTK_WIDGET (self->operator_list_box));
+
+ while (child)
+ {
+ GtkWidget *next;
+
+ next = gtk_widget_get_next_sibling (child);
+ gtk_list_box_remove (GTK_LIST_BOX (self->operator_list_box), child);
+
+ child = next;
+ }
row = cc_wwan_network_dialog_row_new (self, operator_name, "");
self->selected_row = row;
- gtk_container_add (GTK_CONTAINER (self->operator_list_box), GTK_WIDGET (row));
- gtk_widget_show_all (GTK_WIDGET (self->operator_list_box));
+ gtk_widget_show (GTK_WIDGET (row->ok_emblem));
+ gtk_list_box_append (GTK_LIST_BOX (self->operator_list_box), GTK_WIDGET (row));
}
static void
cc_wwan_network_dialog_update (CcWwanNetworkDialog *self)
{
CcWwanNetworkRow *row;
+ GtkWidget *child;
GList *item;
const gchar *operator_code, *operator_name;
- gtk_container_foreach (GTK_CONTAINER (self->operator_list_box),
- (GtkCallback)gtk_widget_destroy, NULL);
+ child = gtk_widget_get_first_child (GTK_WIDGET (self->operator_list_box));
+
+ while (child)
+ {
+ GtkWidget *next;
+
+ next = gtk_widget_get_next_sibling (child);
+ gtk_list_box_remove (GTK_LIST_BOX (self->operator_list_box), child);
+
+ child = next;
+ }
for (item = self->operator_list; item; item = item->next)
{
@@ -219,8 +243,7 @@ cc_wwan_network_dialog_update (CcWwanNetworkDialog *self)
operator_name = mm_modem_3gpp_network_get_operator_long (item->data);
row = cc_wwan_network_dialog_row_new (self, operator_name, operator_code);
- gtk_widget_show (GTK_WIDGET (row));
- gtk_container_add (GTK_CONTAINER (self->operator_list_box), GTK_WIDGET (row));
+ gtk_list_box_append (GTK_LIST_BOX (self->operator_list_box), GTK_WIDGET (row));
}
}
@@ -333,6 +356,7 @@ cc_wwan_network_dialog_show (GtkWidget *widget)
is_auto = cc_wwan_device_is_auto_network (self->device);
+ self->no_update_network = TRUE;
g_object_set (self->automatic_row, "active", is_auto, NULL);
cc_wwan_network_dialog_update_current_network (self);
@@ -422,10 +446,6 @@ cc_wwan_network_dialog_init (CcWwanNetworkDialog *self)
gtk_widget_init_template (GTK_WIDGET (self));
self->search_cancellable = g_cancellable_new ();
-
- gtk_list_box_set_header_func (self->operator_list_box,
- cc_list_box_update_header_func,
- NULL, NULL);
}
CcWwanNetworkDialog *
diff --git a/panels/wwan/cc-wwan-network-dialog.h b/panels/wwan/cc-wwan-network-dialog.h
index 1818a0876..bd7091ea6 100644
--- a/panels/wwan/cc-wwan-network-dialog.h
+++ b/panels/wwan/cc-wwan-network-dialog.h
@@ -24,7 +24,7 @@
#pragma once
-#include <handy.h>
+#include <adwaita.h>
#include <shell/cc-panel.h>
#include "cc-wwan-device.h"
diff --git a/panels/wwan/cc-wwan-network-dialog.ui b/panels/wwan/cc-wwan-network-dialog.ui
index 03223b333..029c3b696 100644
--- a/panels/wwan/cc-wwan-network-dialog.ui
+++ b/panels/wwan/cc-wwan-network-dialog.ui
@@ -1,66 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanNetworkDialog" parent="GtkDialog">
<property name="title" translatable="yes">Network</property>
<property name="default-height">480</property>
<property name="default-width">360</property>
- <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+ <property name="hide-on-close">True</property>
+ <property name="modal">True</property>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
- <property name="visible">1</property>
- <property name="border-width">0</property>
<property name="width-request">340</property>
<property name="height-request">360</property>
<child>
<object class="GtkOverlay">
- <property name="visible">1</property>
+ <property name="hexpand">True</property>
<child type="overlay">
<object class="GtkRevealer" id="notification_revealer">
- <property name="visible">1</property>
<property name="halign">center</property>
<property name="valign">start</property>
- <child>
+ <property name="child">
<object class="GtkBox">
- <property name="visible">1</property>
<property name="spacing">12</property>
<style>
- <class name="frame" />
- <class name="app-notification" />
+ <class name="frame"/>
+ <class name="app-notification"/>
</style>
<child>
<object class="GtkLabel" id="notification_label">
- <property name="visible">1</property>
- <property name="wrap">1</property>
+ <property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
- <property name="use-markup">1</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkButton">
- <property name="visible">1</property>
- <property name="relief">none</property>
- <signal name="clicked" handler="cc_wwan_on_notification_closed" swapped="yes" />
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Close</property>
- </object>
- </child>
+ <signal name="clicked" handler="cc_wwan_on_notification_closed" swapped="yes"/>
+ <accessibility>
+ <property name="label" translatable="yes">Close</property>
+ </accessibility>
<child>
<object class="GtkImage">
- <property name="visible">1</property>
<property name="icon-name">window-close-symbolic</property>
</object>
</child>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
- <child>
+ <property name="child">
<object class="GtkBox">
- <property name="visible">1</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">18</property>
@@ -70,19 +61,17 @@
<!-- Automatic Network Selection Switch -->
<child>
<object class="GtkListBox">
- <property name="visible">1</property>
<property name="selection-mode">none</property>
<property name="margin-bottom">18</property>
<style>
- <class name="frame" />
+ <class name="boxed-list"/>
</style>
<child>
<object class="CcListRow" id="automatic_row">
- <property name="visible">1</property>
- <property name="show-switch">1</property>
- <property name="use-underline">1</property>
+ <property name="show-switch">True</property>
+ <property name="use-underline">True</property>
<property name="title" translatable="yes">_Automatic</property>
- <signal name="notify::active" handler="cc_wwan_auto_network_changed_cb"
swapped="yes" />
+ <signal name="notify::active" handler="cc_wwan_auto_network_changed_cb"
swapped="yes"/>
</object>
</child>
</object>
@@ -90,13 +79,12 @@
<!-- Network Selection List Title and Spinner -->
<child>
- <object class="GtkBox" id="network_search_title" >
- <property name="visible">1</property>
+ <object class="GtkBox" id="network_search_title">
+ <property name="visible" bind-source="automatic_row" bind-property="active"
bind-flags="sync-create|invert-boolean"/>
<property name="margin-bottom">9</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
- <property name="visible">1</property>
<property name="label" translatable="yes">Choose Network</property>
<property name="xalign">0.0</property>
<attributes>
@@ -105,29 +93,20 @@
</object>
</child>
<child>
- <object class="GtkSpinner" id="loading_spinner">
- <property name="visible">1</property>
- </object>
+ <object class="GtkSpinner" id="loading_spinner"/>
</child>
<child>
<object class="GtkButton" id="refresh_button">
- <property name="visible">1</property>
- <signal name="clicked" handler="cc_wwan_network_dialog_refresh_networks"
swapped="yes" />
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Refresh Network
Providers</property>
- </object>
- </child>
+ <signal name="clicked" handler="cc_wwan_network_dialog_refresh_networks"
swapped="yes"/>
+ <accessibility>
+ <property name="label" translatable="yes">Refresh Network Providers</property>
+ </accessibility>
<child>
<object class="GtkImage">
- <property name="visible">1</property>
<property name="icon-name">view-refresh-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
</object>
</child>
@@ -135,43 +114,43 @@
<!-- Network Selection List -->
<child>
<object class="GtkScrolledWindow">
- <property name="visible">1</property>
<property name="hscrollbar-policy">never</property>
- <property name="propagate-natural-height">1</property>
- <child>
+ <property name="propagate-natural-height">True</property>
+ <property name="visible" bind-source="operator_list_box" bind-flags="sync-create"/>
+ <style>
+ <class name="frame"/>
+ </style>
+ <property name="child">
<object class="GtkListBox" id="operator_list_box">
- <property name="visible">0</property>
- <property name="sensitive">0</property>
+ <property name="visible">False</property>
+ <property name="sensitive">False</property>
<property name="selection-mode">none</property>
- <signal name="row-activated" handler="cc_wwan_network_changed_cb" swapped="yes" />
+ <signal name="row-activated" handler="cc_wwan_network_changed_cb" swapped="yes"/>
<style>
- <class name="frame" />
+ <class name="boxed-list"/>
</style>
</object>
- </child>
+ </property>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
</object>
- </child> <!-- ./internal-child -->
+ </child>
<child type="action">
<object class="GtkButton" id="button_cancel">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
+ <property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<signal name="clicked" handler="gtk_widget_hide" swapped="yes"/>
</object>
</child>
<child type="action">
<object class="GtkButton" id="button_apply">
- <property name="visible">1</property>
- <property name="can-default">1</property>
- <property name="use-underline">1</property>
+ <property name="use-underline">True</property>
<property name="label" translatable="yes">_Set</property>
<signal name="clicked" handler="cc_wwan_network_dialog_apply_clicked_cb" swapped="yes"/>
<style>
@@ -182,7 +161,7 @@
<action-widgets>
<action-widget response="cancel">button_cancel</action-widget>
- <action-widget response="apply" default="true">button_apply</action-widget>
+ <action-widget response="apply" default="True">button_apply</action-widget>
</action-widgets>
</template>
</interface>
diff --git a/panels/wwan/cc-wwan-panel.c b/panels/wwan/cc-wwan-panel.c
index 963c46900..1070a9e52 100644
--- a/panels/wwan/cc-wwan-panel.c
+++ b/panels/wwan/cc-wwan-panel.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* cc-wwan-panel.c
*
- * Copyright 2019 Purism SPC
+ * Copyright 2019,2022 Purism SPC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -48,9 +48,7 @@ struct _CcWwanPanel
{
CcPanel parent_instance;
- GtkListBox *data_select_listbox;
- GtkPopover *data_select_popover;
- GtkLabel *data_sim_label;
+ AdwComboRow *data_list_row;
GtkListBox *data_sim_select_listbox;
GtkStack *devices_stack;
GtkStackSwitcher *devices_switcher;
@@ -68,6 +66,7 @@ struct _CcWwanPanel
CcWwanDevice *data_device;
GListStore *devices;
GListStore *data_devices;
+ GListStore *data_devices_name_list;
GCancellable *cancellable;
CmdlineOperation arg_operation;
@@ -147,19 +146,17 @@ handle_argv (CcWwanPanel *self)
if (self->arg_operation == OPERATION_SHOW_DEVICE &&
self->arg_operation)
{
- g_autoptr(GList) pages = NULL;
-
- pages = gtk_container_get_children (GTK_CONTAINER (self->devices_stack));
-
- for (GList *page = pages; page; page = page->next)
+ for (GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (self->devices_stack));
+ child;
+ child = gtk_widget_get_next_sibling (child))
{
CcWwanDevice *device;
- device = cc_wwan_device_page_get_device (page->data);
+ device = cc_wwan_device_page_get_device (CC_WWAN_DEVICE_PAGE (child));
if (g_strcmp0 (cc_wwan_device_get_path (device), self->arg_device) == 0)
{
- gtk_stack_set_visible_child (GTK_STACK (self->devices_stack), page->data);
+ gtk_stack_set_visible_child (GTK_STACK (self->devices_stack), child);
g_debug ("Opening device %s", self->arg_device);
reset_command_line_args (self);
return;
@@ -238,36 +235,6 @@ wwan_model_get_item_from_mm_object (GListModel *model,
return NULL;
}
-static CcDataDeviceRow *
-cc_data_device_row_new (CcWwanDevice *device,
- CcWwanPanel *self)
-{
- CcDataDeviceRow *row;
- GtkWidget *box, *label, *image;
- g_autofree gchar *operator = NULL;
- gint index;
-
- row = g_object_new (CC_TYPE_DATA_DEVICE_ROW, NULL);
- row->device = device;
-
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_widget_show (box);
- g_object_set (box, "margin", 12, NULL);
- gtk_container_add (GTK_CONTAINER (row), box);
-
- index = wwan_model_get_item_index (G_LIST_MODEL (self->devices), device);
- operator = g_strdup_printf ("SIM %d", index + 1);
- label = gtk_label_new (operator);
- gtk_widget_show (label);
- gtk_container_add (GTK_CONTAINER (box), label);
-
- image = gtk_image_new_from_icon_name ("emblem-ok-symbolic", GTK_ICON_SIZE_BUTTON);
- row->ok_emblem = GTK_IMAGE (image);
- gtk_container_add (GTK_CONTAINER (box), image);
-
- return row;
-}
-
static void
wwan_notification_close_clicked_cb (CcWwanPanel *self)
{
@@ -280,47 +247,29 @@ wwan_notification_close_clicked_cb (CcWwanPanel *self)
}
static void
-wwan_data_selector_clicked_cb (CcWwanPanel *self)
+cc_wwan_panel_update_data_selection (CcWwanPanel *self)
{
- if (gtk_widget_is_visible (GTK_WIDGET (self->data_select_popover)))
- gtk_popover_popdown (self->data_select_popover);
- else
- gtk_popover_popup (self->data_select_popover);
-}
-
-static void
-cc_wwan_panel_update_data_selection (CcDataDeviceRow *row,
- CcWwanPanel *self)
-{
- if (self->data_device == row->device)
- {
- g_autofree gchar *str = NULL;
- gint i;
+ int i;
- i = wwan_model_get_item_index (G_LIST_MODEL (self->devices), row->device);
- g_assert (i >= 0);
+ if (!self->data_device)
+ return;
- /* Human index starts from 1 */
- str = g_strdup_printf ("SIM %d", i + 1);
- gtk_label_set_label (self->data_sim_label, str);
+ i = wwan_model_get_item_index (G_LIST_MODEL (self->data_devices), self->data_device);
- gtk_widget_show (GTK_WIDGET (row->ok_emblem));
- }
- else
- {
- gtk_widget_hide (GTK_WIDGET (row->ok_emblem));
- }
+ if (i != -1)
+ adw_combo_row_set_selected (self->data_list_row, i);
}
static void
-cc_wwan_data_item_activate_cb (CcWwanPanel *self,
- CcDataDeviceRow *row)
+cc_wwan_data_item_activate_cb (CcWwanPanel *self,
+ CcWwanDevice *device)
{
CcWwanData *data;
- gtk_popover_popdown (self->data_select_popover);
+ if (device == self->data_device)
+ return;
- if (row->device == self->data_device)
+ if (!self->data_device)
return;
/* Set lower priority for previously selected APN */
@@ -329,13 +278,12 @@ cc_wwan_data_item_activate_cb (CcWwanPanel *self,
cc_wwan_data_save_settings (data, NULL, NULL, NULL);
/* Set high priority for currently selected APN */
- data = cc_wwan_device_get_data (row->device);
+ data = cc_wwan_device_get_data (device);
cc_wwan_data_set_priority (data, CC_WWAN_APN_PRIORITY_HIGH);
cc_wwan_data_save_settings (data, NULL, NULL, NULL);
- self->data_device = row->device;
- gtk_container_foreach (GTK_CONTAINER (self->data_select_listbox),
- (GtkCallback) cc_wwan_panel_update_data_selection, self);
+ self->data_device = device;
+ cc_wwan_panel_update_data_selection (self);
}
static void
@@ -354,6 +302,22 @@ wwan_on_airplane_off_clicked_cb (CcWwanPanel *self)
NULL);
}
+static void
+wwan_data_list_selected_sim_changed_cb (CcWwanPanel *self)
+{
+ CcWwanDevice *device;
+ GObject *selected;
+
+ g_assert (CC_IS_WWAN_PANEL (self));
+
+ selected = adw_combo_row_get_selected_item (self->data_list_row);
+ if (!selected)
+ return;
+
+ device = g_object_get_data (selected, "device");
+ cc_wwan_data_item_activate_cb (self, device);
+}
+
static gboolean
cc_wwan_panel_get_cached_dbus_property (GDBusProxy *proxy,
const gchar *property)
@@ -466,12 +430,14 @@ cc_wwan_panel_update_page_title (CcWwanDevicePage *device_page,
g_autofree gchar *title = NULL;
g_autofree gchar *name = NULL;
CcWwanDevice *device;
- GtkWidget *parent;
+ GtkStackPage *page;
gint index;
+ g_assert (CC_IS_WWAN_DEVICE_PAGE (device_page));
+
device = cc_wwan_device_page_get_device (device_page);
- parent = gtk_widget_get_parent (GTK_WIDGET (device_page));
+ page = gtk_stack_get_page (GTK_STACK (self->devices_stack), GTK_WIDGET (device_page));
index = wwan_model_get_item_index (G_LIST_MODEL (self->devices), device);
if (index == -1)
@@ -481,11 +447,8 @@ cc_wwan_panel_update_page_title (CcWwanDevicePage *device_page,
cc_wwan_device_page_set_sim_index (device_page, index + 1);
title = g_strdup_printf (_("SIM %d"), index + 1);
name = g_strdup_printf ("sim-%d", index + 1);
- gtk_container_child_set (GTK_CONTAINER (parent),
- GTK_WIDGET (device_page),
- "title", title,
- "name", name,
- NULL);
+ gtk_stack_page_set_title (page, title);
+ gtk_stack_page_set_name (page, name);
}
static void
@@ -504,8 +467,10 @@ cc_wwan_panel_remove_mm_object (CcWwanPanel *self,
return;
index = wwan_model_get_item_index (G_LIST_MODEL (self->data_devices), device);
- if (index != -1)
+ if (index != -1) {
g_list_store_remove (self->data_devices, index);
+ g_list_store_remove (self->data_devices_name_list, index);
+ }
index = wwan_model_get_item_index (G_LIST_MODEL (self->devices), device);
if (index == -1)
@@ -514,13 +479,36 @@ cc_wwan_panel_remove_mm_object (CcWwanPanel *self,
g_list_store_remove (self->devices, index);
stack_name = g_strdup_printf ("sim-%d", index + 1);
device_page = gtk_stack_get_child_by_name (self->devices_stack, stack_name);
- gtk_container_remove (GTK_CONTAINER (self->devices_stack), device_page);
+ gtk_stack_remove (GTK_STACK (self->devices_stack), device_page);
n_items = g_list_model_get_n_items (G_LIST_MODEL (self->data_devices));
g_list_model_items_changed (G_LIST_MODEL (self->data_devices), 0, n_items, n_items);
- gtk_container_foreach (GTK_CONTAINER (self->devices_stack),
- (GtkCallback)cc_wwan_panel_update_page_title,
- self);
+
+ for (GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (self->devices_stack));
+ child;
+ child = gtk_widget_get_next_sibling (child))
+ cc_wwan_panel_update_page_title (CC_WWAN_DEVICE_PAGE (child), self);
+}
+
+static void
+wwan_panel_add_data_device_to_list (CcWwanPanel *self,
+ CcWwanDevice *device)
+{
+ g_autoptr(GtkStringObject) str = NULL;
+ g_autofree char *operator = NULL;
+ int index;
+
+ index = wwan_model_get_item_index (G_LIST_MODEL (self->data_devices), device);
+ if (index != -1)
+ return;
+
+ g_list_store_append (self->data_devices, device);
+
+ index = wwan_model_get_item_index (G_LIST_MODEL (self->devices), device);
+ operator = g_strdup_printf ("SIM %d", index + 1);
+ str = gtk_string_object_new (operator);
+ g_object_set_data_full (G_OBJECT (str), "device", g_object_ref (device), g_object_unref);
+ g_list_store_append (self->data_devices_name_list, str);
}
static void
@@ -536,6 +524,7 @@ cc_wwan_panel_update_data_connections (CcWwanPanel *self)
* So let’s remove every data device and re-add.
*/
g_list_store_remove_all (self->data_devices);
+ g_list_store_remove_all (self->data_devices_name_list);
n_items = g_list_model_get_n_items (G_LIST_MODEL (self->devices));
for (i = 0; i < n_items; i++)
@@ -557,16 +546,11 @@ cc_wwan_panel_update_data_connections (CcWwanPanel *self)
}
if (cc_wwan_data_get_enabled (device_data))
- g_list_store_append (self->data_devices, device);
+ wwan_panel_add_data_device_to_list (self, device);
}
- gtk_widget_set_sensitive (GTK_WIDGET (self->data_sim_select_listbox),
- g_list_model_get_n_items (G_LIST_MODEL (self->data_devices)) > 1);
if (active_data)
- gtk_container_foreach (GTK_CONTAINER (self->data_select_listbox),
- (GtkCallback)cc_wwan_panel_update_data_selection, self);
- else
- gtk_label_set_label (self->data_sim_label, "");
+ cc_wwan_panel_update_data_selection (self);
}
static void
@@ -591,7 +575,7 @@ cc_wwan_panel_update_devices (CcWwanPanel *self)
self, G_CONNECT_SWAPPED);
if (cc_wwan_device_get_data (device))
- g_list_store_append (self->data_devices, device);
+ wwan_panel_add_data_device_to_list (self, device);
}
cc_wwan_panel_update_data_connections (self);
@@ -729,6 +713,7 @@ cc_wwan_panel_dispose (GObject *object)
g_clear_object (&self->devices);
g_clear_object (&self->data_devices);
+ g_clear_object (&self->data_devices_name_list);
g_clear_object (&self->mm_manager);
g_clear_object (&self->nm_client);
g_clear_object (&self->cancellable);
@@ -753,9 +738,7 @@ cc_wwan_panel_class_init (CcWwanPanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/wwan/cc-wwan-panel.ui");
- gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, data_select_listbox);
- gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, data_select_popover);
- gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, data_sim_label);
+ gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, data_list_row);
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, data_sim_select_listbox);
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, devices_stack);
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, devices_switcher);
@@ -765,9 +748,9 @@ cc_wwan_panel_class_init (CcWwanPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, notification_label);
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, notification_revealer);
+ gtk_widget_class_bind_template_callback (widget_class, wwan_data_list_selected_sim_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, wwan_on_airplane_off_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, wwan_notification_close_clicked_cb);
- gtk_widget_class_bind_template_callback (widget_class, wwan_data_selector_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, cc_wwan_data_item_activate_cb);
}
@@ -783,10 +766,9 @@ cc_wwan_panel_init (CcWwanPanel *self)
self->cancellable = g_cancellable_new ();
self->devices = g_list_store_new (CC_TYPE_WWAN_DEVICE);
self->data_devices = g_list_store_new (CC_TYPE_WWAN_DEVICE);
- gtk_list_box_bind_model (GTK_LIST_BOX (self->data_select_listbox),
- G_LIST_MODEL (self->data_devices),
- (GtkListBoxCreateWidgetFunc) cc_data_device_row_new,
- self, NULL);
+ self->data_devices_name_list = g_list_store_new (GTK_TYPE_STRING_OBJECT);
+ adw_combo_row_set_model (ADW_COMBO_ROW (self->data_list_row),
+ G_LIST_MODEL (self->data_devices_name_list));
g_signal_connect_object (self->notification_label, "notify::label",
G_CALLBACK (cc_wwan_panel_notification_changed_cb),
diff --git a/panels/wwan/cc-wwan-panel.ui b/panels/wwan/cc-wwan-panel.ui
index 5258c42c3..151b35ed9 100644
--- a/panels/wwan/cc-wwan-panel.ui
+++ b/panels/wwan/cc-wwan-panel.ui
@@ -1,65 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanPanel" parent="CcPanel">
- <property name="visible">1</property>
<child>
<object class="GtkOverlay">
- <property name="visible">1</property>
<!-- Notification Revealer -->
<child type="overlay">
<object class="GtkRevealer" id="notification_revealer">
- <property name="visible">1</property>
<property name="halign">center</property>
<property name="valign">start</property>
- <child>
+ <property name="child">
<object class="GtkBox">
- <property name="visible">1</property>
<property name="spacing">12</property>
<style>
- <class name="frame" />
- <class name="app-notification" />
+ <class name="frame"/>
+ <class name="app-notification"/>
</style>
<child>
<object class="GtkLabel" id="notification_label">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="wrap-mode">word</property>
- <property name="use-markup">1</property>
+ <property name="wrap">True</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkButton">
- <property name="visible">1</property>
- <property name="relief">none</property>
- <signal name="clicked" handler="wwan_notification_close_clicked_cb" swapped="yes" />
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Close</property>
- </object>
- </child>
+ <signal name="clicked" handler="wwan_notification_close_clicked_cb" swapped="yes"/>
+ <accessibility>
+ <property name="label" translatable="yes">Close</property>
+ </accessibility>
<child>
<object class="GtkImage">
- <property name="visible">1</property>
<property name="icon-name">window-close-symbolic</property>
</object>
</child>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
- <child>
+ <property name="child">
<object class="GtkScrolledWindow">
- <property name="visible">1</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">500</property>
<child>
- <object class="HdyClamp">
- <property name="visible">1</property>
+ <object class="AdwClamp">
<property name="margin-top">0</property>
<property name="margin-bottom">32</property>
<property name="margin-start">18</property>
@@ -67,270 +55,180 @@
<child>
<object class="GtkBox">
- <property name="visible">1</property>
- <property name="hexpand">1</property>
+ <property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="main_stack">
- <property name="visible">1</property>
- <property name="homogeneous">0</property>
+ <property name="vhomogeneous">False</property>
+ <property name="hhomogeneous">False</property>
<property name="transition-type">crossfade</property>
<!-- "No WWAN Adapter" page -->
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="expand">1</property>
- <property name="valign">center</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkImage">
- <property name="visible">1</property>
- <property name="icon-name">network-cellular-offline-symbolic</property>
- <property name="pixel-size">192</property>
- <property name="margin-bottom">18</property>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">No WWAN Adapter Found</property>
- <attributes>
- <attribute name="weight" value="bold" />
- <attribute name="scale" value="1.2" />
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">Make sure you have a Wireless
Wan/Cellular device</property>
+ <object class="GtkStackPage">
+ <property name="name">no-wwan-devices</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">network-cellular-offline-symbolic</property>
+ <property name="pixel-size">192</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">No WWAN Adapter
Found</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ <attribute name="scale" value="1.2"></attribute>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Make sure you have a Wireless
Wan/Cellular device</property>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">no-wwan-devices</property>
- </packing>
</child>
<!-- "Airplane Mode" page -->
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="expand">1</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkImage">
- <property name="visible">1</property>
- <property name="icon-name">airplane-mode-symbolic</property>
- <property name="pixel-size">192</property>
- <property name="margin-bottom">18</property>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">Airplane Mode On</property>
- <attributes>
- <attribute name="weight" value="bold" />
- <attribute name="scale" value="1.2" />
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="wrap">1</property>
- <property name="label" translatable="yes">Wireless Wan is disabled when
airplane mode is on</property>
- </object>
- </child>
- <child>
- <object class="GtkButton">
- <property name="visible">1</property>
- <property name="halign">center</property>
- <property name="use-underline">1</property>
- <property name="margin-top">24</property>
- <property name="label" translatable="yes">_Turn off Airplane Mode</property>
- <signal name="clicked" handler="wwan_on_airplane_off_clicked_cb"
swapped="yes" />
+ <object class="GtkStackPage">
+ <property name="name">airplane-mode</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">airplane-mode-symbolic</property>
+ <property name="pixel-size">192</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Airplane Mode On</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ <attribute name="scale" value="1.2"></attribute>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Wireless Wan is disabled when
airplane mode is on</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="halign">center</property>
+ <property name="use-underline">True</property>
+ <property name="margin-top">24</property>
+ <property name="label" translatable="yes">_Turn off Airplane
Mode</property>
+ <signal name="clicked" handler="wwan_on_airplane_off_clicked_cb"
swapped="yes"/>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">airplane-mode</property>
- </packing>
</child>
-
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="orientation">vertical</property>
+ <object class="GtkStackPage">
+ <property name="name">device-settings</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
- <child>
- <object class="GtkRevealer" id="multi_device_revealer">
- <property name="visible">1</property>
- <property name="margin-top">18</property>
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="orientation">vertical</property>
+ <object class="GtkRevealer" id="multi_device_revealer">
+ <property name="margin-top">18</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
- <!-- Data SIM selector -->
- <child>
- <object class="GtkListBox" id="data_sim_select_listbox">
- <property name="visible">1</property>
- <property name="selection-mode">none</property>
- <property name="margin-bottom">32</property>
- <signal name="row-activated" handler="wwan_data_selector_clicked_cb"
swapped="yes" />
- <style>
- <class name="frame" />
- </style>
+ <!-- Data SIM selector -->
<child>
- <object class="GtkGrid">
- <property name="visible">1</property>
- <property name="border-width">9</property>
- <property name="margin-start">9</property>
- <property name="margin-end">9</property>
- <property name="column-spacing">12</property>
-
- <!-- Title -->
+ <object class="GtkListBox" id="data_sim_select_listbox">
+ <property name="margin-bottom">32</property>
+ <style>
+ <class name="boxed-list"/>
+ </style>
<child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="hexpand">1</property>
- <property name="label" translatable="yes">Data
Connection</property>
- <property name="xalign">0.0</property>
+ <object class="AdwComboRow" id="data_list_row">
+ <property name="title" translatable="yes">Data
Connection</property>
+ <property name="subtitle" translatable="yes">SIM card used
for internet</property>
+ <signal name="notify::selected-item"
handler="wwan_data_list_selected_sim_changed_cb" swapped="1"/>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
-
- <!-- SubTitle -->
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="hexpand">1</property>
- <property name="label" translatable="yes">SIM card used for
internet</property>
- <property name="xalign">0.0</property>
- <attributes>
- <attribute name="scale" value="0.88" />
- </attributes>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
-
- <!-- Network Name -->
- <child>
- <object class="GtkLabel" id="data_sim_label">
- <property name="visible">1</property>
- <property name="valign">center</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- <property name="height">2</property>
- </packing>
- </child>
-
- <!-- Popover Arrow -->
- <child>
- <object class="GtkImage" id="popover_arrow">
- <property name="visible">1</property>
- <property name="valign">center</property>
- <property name="icon-name">pan-down-symbolic</property>
- </object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">0</property>
- <property name="height">2</property>
- </packing>
</child>
+ </object>
+ </child>
+ <!-- Device (SIM) Name -->
+ <child>
+ <object class="GtkStackSwitcher" id="devices_switcher">
+ <property name="stack">devices_stack</property>
+ <property name="hexpand">True</property>
+ <property name="halign">center</property>
</object>
</child>
- </object>
- </child>
- <!-- Device (SIM) Name -->
- <child>
- <object class="GtkStackSwitcher" id="devices_switcher">
- <property name="stack">devices_stack</property>
- <property name="visible">1</property>
- <property name="hexpand">1</property>
- <property name="halign">center</property>
</object>
- </child>
+ </property>
+ </object>
+ </child>
+ <!-- Device (SIM) settings page -->
+ <child>
+ <object class="GtkStack" id="devices_stack">
+ <property name="vhomogeneous">False</property>
+ <property name="hhomogeneous">False</property>
</object>
</child>
- </object>
- </child>
- <!-- Device (SIM) settings page -->
- <child>
- <object class="GtkStack" id="devices_stack">
- <property name="visible">1</property>
- <property name="homogeneous">0</property>
</object>
- </child>
-
+ </property>
</object>
- <packing>
- <property name="name">device-settings</property>
- </packing>
</child>
-
</object> <!-- ./GtkStack main_stack -->
</child>
</object>
</child>
- </object> <!-- ./HdyClamp -->
+ </object> <!-- ./AdwClamp -->
</child>
</object> <!-- ./GtkScrolledWindow -->
- </child>
+ </property>
</object>
</child>
</template>
- <object class="GtkPopover" id="data_select_popover">
- <property name="position">bottom</property>
- <property name="relative-to">popover_arrow</property>
- <child>
- <object class="GtkListBox" id="data_select_listbox">
- <property name="visible">1</property>
- <property name="selection-mode">none</property>
- <signal name="row-activated" handler="cc_wwan_data_item_activate_cb" swapped="yes" />
- </object>
- </child>
- </object>
-
<!-- Cellular panel on/off switch -->
<object class="GtkSwitch" id="enable_switch">
- <property name="visible">1</property>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Enable Mobile Network</property>
- </object>
- </child>
+ <accessibility>
+ <property name="label" translatable="yes">Enable Mobile Network</property>
+ </accessibility>
</object>
</interface>
diff --git a/panels/wwan/cc-wwan-sim-lock-dialog.c b/panels/wwan/cc-wwan-sim-lock-dialog.c
index 14adbf415..09c6773d5 100644
--- a/panels/wwan/cc-wwan-sim-lock-dialog.c
+++ b/panels/wwan/cc-wwan-sim-lock-dialog.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* cc-wwan-network-dialog.c
*
- * Copyright 2019 Purism SPC
+ * Copyright 2019,2022 Purism SPC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
#include <glib/gi18n.h>
#include <libmm-glib.h>
-#include "list-box-helper.h"
#include "cc-list-row.h"
#include "cc-wwan-sim-lock-dialog.h"
#include "cc-wwan-resources.h"
@@ -85,7 +84,7 @@ static void
cc_wwan_pin_next_clicked_cb (CcWwanSimLockDialog *self)
{
gtk_stack_set_visible_child_name (self->pin_settings_stack, "pin-entry");
- gtk_entry_set_text (self->pin_entry, "");
+ gtk_editable_set_text (GTK_EDITABLE (self->pin_entry), "");
gtk_widget_set_sensitive (GTK_WIDGET (self->apply_button), FALSE);
gtk_stack_set_visible_child (self->button_stack,
@@ -102,8 +101,8 @@ cc_wwan_pin_apply_clicked_cb (CcWwanSimLockDialog *self)
lock_enabled = cc_wwan_device_get_sim_lock (self->device);
row_enabled = cc_list_row_get_active (self->lock_row);
- pin = gtk_entry_get_text (self->pin_entry);
- new_pin = gtk_entry_get_text (self->new_pin_entry);
+ pin = gtk_editable_get_text (GTK_EDITABLE (self->pin_entry));
+ new_pin = gtk_editable_get_text (GTK_EDITABLE (self->new_pin_entry));
if (lock_enabled != row_enabled)
{
@@ -157,8 +156,8 @@ cc_wwan_pin_entry_changed_cb (CcWwanSimLockDialog *self)
{
const gchar *new_pin, *confirm_pin;
- new_pin = gtk_entry_get_text (self->new_pin_entry);
- confirm_pin = gtk_entry_get_text (self->pin_confirm_entry);
+ new_pin = gtk_editable_get_text (GTK_EDITABLE (self->new_pin_entry));
+ confirm_pin = gtk_editable_get_text (GTK_EDITABLE (self->pin_confirm_entry));
gtk_widget_set_sensitive (GTK_WIDGET (self->next_button), FALSE);
/* A PIN should have a minimum length of 4 */
@@ -177,7 +176,7 @@ cc_wwan_pin_entered_cb (CcWwanSimLockDialog *self)
gsize len;
gboolean enable_apply;
- pin = gtk_entry_get_text (self->pin_entry);
+ pin = gtk_editable_get_text (GTK_EDITABLE (self->pin_entry));
if (!pin || !*pin)
{
@@ -216,7 +215,7 @@ cc_wwan_sim_lock_dialog_show (GtkWidget *widget)
CcWwanSimLockDialog *self = (CcWwanSimLockDialog *)widget;
gboolean lock_enabled;
- gtk_entry_set_text (self->pin_entry, "");
+ gtk_editable_set_text (GTK_EDITABLE (self->pin_entry), "");
gtk_widget_set_sensitive (GTK_WIDGET (self->next_button), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (self->apply_button), FALSE);
@@ -231,9 +230,9 @@ cc_wwan_sim_lock_dialog_show (GtkWidget *widget)
gtk_stack_set_visible_child_name (self->pin_settings_stack, "pin-settings");
- gtk_entry_set_text (self->pin_entry, "");
- gtk_entry_set_text (self->new_pin_entry, "");
- gtk_entry_set_text (self->pin_confirm_entry, "");
+ gtk_editable_set_text (GTK_EDITABLE (self->pin_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (self->new_pin_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (self->pin_confirm_entry), "");
GTK_WIDGET_CLASS (cc_wwan_sim_lock_dialog_parent_class)->show (widget);
}
diff --git a/panels/wwan/cc-wwan-sim-lock-dialog.h b/panels/wwan/cc-wwan-sim-lock-dialog.h
index b6d1d5a9e..f59d04868 100644
--- a/panels/wwan/cc-wwan-sim-lock-dialog.h
+++ b/panels/wwan/cc-wwan-sim-lock-dialog.h
@@ -24,7 +24,7 @@
#pragma once
-#include <handy.h>
+#include <adwaita.h>
#include <shell/cc-panel.h>
#include "cc-wwan-device.h"
diff --git a/panels/wwan/cc-wwan-sim-lock-dialog.ui b/panels/wwan/cc-wwan-sim-lock-dialog.ui
index 48a946be4..221db81d7 100644
--- a/panels/wwan/cc-wwan-sim-lock-dialog.ui
+++ b/panels/wwan/cc-wwan-sim-lock-dialog.ui
@@ -1,288 +1,264 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <requires lib="gtk" version="4.0"/>
<template class="CcWwanSimLockDialog" parent="GtkDialog">
<property name="default-height">480</property>
<property name="default-width">360</property>
- <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+ <property name="hide-on-close">True</property>
+ <property name="modal">True</property>
+ <property name="title" translatable="yes">SIM Lock</property>
<child type="titlebar">
<object class="GtkHeaderBar">
- <property name="visible">1</property>
- <property name="title" translatable="yes">SIM Lock</property>
- <child>
+ <child type="end">
<object class="GtkStack" id="button_stack">
- <property name="visible">1</property>
- <!-- Next Buttoon -->
<child>
- <object class="GtkButton" id="next_button">
- <property name="visible">1</property>
- <property name="sensitive">0</property>
- <property name="use-underline">1</property>
- <property name="label" translatable="yes">_Next</property>
- <signal name="clicked" handler="cc_wwan_pin_next_clicked_cb" swapped="yes" />
- <style>
- <class name="suggested-action" />
- </style>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">next</property>
- </packing>
+ <!-- Next Button -->
+ <property name="child">
+ <object class="GtkButton" id="next_button">
+ <property name="sensitive">False</property>
+ <property name="use-underline">True</property>
+ <property name="label" translatable="yes">_Next</property>
+ <signal name="clicked" handler="cc_wwan_pin_next_clicked_cb" swapped="yes"/>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </property>
+ </object>
</child>
- <!-- Apply button -->
<child>
- <object class="GtkButton" id="apply_button">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
- <signal name="clicked" handler="cc_wwan_pin_apply_clicked_cb" swapped="yes" />
- <style>
- <class name="suggested-action" />
- </style>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">apply</property>
- </packing>
+ <!-- Apply button -->
+ <property name="child">
+ <object class="GtkButton" id="apply_button">
+ <property name="use-underline">True</property>
+ <signal name="clicked" handler="cc_wwan_pin_apply_clicked_cb" swapped="yes"/>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </property>
+ </object>
</child>
</object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
- <property name="visible">1</property>
- <property name="border-width">0</property>
<property name="width-request">340</property>
<property name="height-request">360</property>
<child>
- <object class="HdyClamp">
- <property name="visible">1</property>
+ <object class="AdwClamp">
<property name="margin-top">32</property>
<property name="margin-bottom">32</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<child>
<object class="GtkOverlay">
- <property name="visible">1</property>
<child type="overlay">
<object class="GtkRevealer" id="notification_revealer">
- <property name="visible">1</property>
<property name="halign">center</property>
<property name="valign">start</property>
- <child>
+ <property name="child">
<object class="GtkBox">
- <property name="visible">1</property>
<property name="spacing">12</property>
<style>
- <class name="frame" />
- <class name="app-notification" />
+ <class name="frame"/>
+ <class name="app-notification"/>
</style>
<child>
<object class="GtkLabel" id="notification_label">
- <property name="visible">1</property>
- <property name="wrap">1</property>
+ <property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
- <property name="use-markup">1</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkButton">
- <property name="visible">1</property>
- <property name="relief">none</property>
- <!-- <signal name="clicked" handler="cc_wwan_on_notification_closed"
object="CcWwanSimLockDialog" swapped="yes" /> -->
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Close</property>
- </object>
- </child>
+ <accessibility>
+ <property name="label" translatable="yes">Close</property>
+ </accessibility>
<child>
<object class="GtkImage">
- <property name="visible">1</property>
<property name="icon-name">window-close-symbolic</property>
</object>
</child>
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
- <child>
+ <property name="child">
<object class="GtkStack" id="pin_settings_stack">
- <property name="visible">1</property>
<property name="transition-type">slide-left</property>
<child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="orientation">vertical</property>
+ <object class="GtkStackPage">
+ <property name="name">pin-settings</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
- <!-- SIM Lock Switch -->
- <child>
- <object class="GtkListBox">
- <property name="visible">1</property>
- <property name="selection-mode">none</property>
- <property name="margin-bottom">18</property>
- <style>
- <class name="frame" />
- </style>
+ <!-- SIM Lock Switch -->
<child>
- <object class="CcListRow" id="lock_row">
- <property name="visible">1</property>
- <property name="show-switch">1</property>
- <property name="use-underline">1</property>
- <property name="title" translatable="yes">_Lock SIM with PIN</property>
- <signal name="notify::active" handler="cc_wwan_sim_lock_changed_cb"
swapped="yes" />
+ <object class="GtkListBox">
+ <property name="selection-mode">none</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="frame"/>
+ </style>
+ <child>
+ <object class="CcListRow" id="lock_row">
+ <property name="show-switch">True</property>
+ <property name="use-underline">True</property>
+ <property name="title" translatable="yes">_Lock SIM with PIN</property>
+ <signal name="notify::active" handler="cc_wwan_sim_lock_changed_cb"
swapped="yes"/>
+ </object>
+ </child>
</object>
</child>
- </object>
- </child>
-
- <child>
- <object class="GtkGrid" id="lock_change_grid">
- <property name="visible">0</property>
- <property name="row-spacing">18</property>
- <property name="column-spacing">12</property>
- <!-- SIM Lock Change Title -->
<child>
- <object class="GtkLabel" id="lock_change_title">
- <property name="visible">1</property>
- <property name="label" translatable="yes">Change PIN</property>
- <property name="margin-bottom">9</property>
- <property name="xalign">0.0</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">2</property>
- </packing>
- </child>
+ <object class="GtkGrid" id="lock_change_grid">
+ <property name="visible">False</property>
+ <property name="row-spacing">18</property>
+ <property name="column-spacing">12</property>
- <!-- PIN Entry -->
- <child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="label">New PIN</property>
- <property name="halign">end</property>
+ <!-- SIM Lock Change Title -->
+ <child>
+ <object class="GtkLabel" id="lock_change_title">
+ <property name="label" translatable="yes">Change PIN</property>
+ <property name="margin-bottom">9</property>
+ <property name="xalign">0.0</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ </attributes>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ <property name="column-span">2</property>
+ </layout>
+ </object>
+ </child>
+
+ <!-- PIN Entry -->
+ <child>
+ <object class="GtkLabel">
+ <property name="label">New PIN</property>
+ <property name="halign">end</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEntry" id="new_pin_entry">
+ <property name="visibility">False</property>
+ <property name="input-purpose">password</property>
+ <property name="input-hints">no-emoji</property>
+ <property name="max-length">8</property>
+ <property name="max-width-chars">32</property>
+ <signal name="notify::text" handler="cc_wwan_pin_entry_changed_cb"
swapped="yes"/>
+ <signal name="insert-text" handler="cc_wwan_pin_entry_text_inserted_cb"
swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label">Confirm</property>
+ <property name="halign">end</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
+ </object>
+ </child>
+
+ <!-- Confirm PIN Entry -->
+ <child>
+ <object class="GtkEntry" id="pin_confirm_entry">
+ <property name="visibility">False</property>
+ <property name="input-purpose">password</property>
+ <property name="input-hints">no-emoji</property>
+ <property name="max-length">8</property>
+ <property name="max-width-chars">32</property>
+ <signal name="notify::text" handler="cc_wwan_pin_entry_changed_cb"
swapped="yes"/>
+ <signal name="insert-text" handler="cc_wwan_pin_entry_changed_cb"
swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
+ </object>
+ </child>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
</child>
+
+ </object>
+ </property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">pin-entry</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="valign">center</property>
+ <property name="halign">center</property>
<child>
- <object class="GtkEntry" id="new_pin_entry">
- <property name="visible">1</property>
- <property name="visibility">0</property>
- <property name="input-purpose">password</property>
- <property name="input-hints">no-emoji</property>
- <property name="max-length">8</property>
- <property name="max-width-chars">32</property>
- <signal name="notify::text" handler="cc_wwan_pin_entry_changed_cb"
swapped="yes" />
- <signal name="insert-text" handler="cc_wwan_pin_entry_text_inserted_cb"
swapped="yes" />
+ <object class="GtkImage">
+ <property name="pixel-size">128</property>
+ <property name="icon-name">dialog-password-symbolic</property>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
</child>
-
- <!-- Confirm PIN Entry -->
<child>
- <object class="GtkLabel">
- <property name="visible">1</property>
- <property name="label">Confirm</property>
- <property name="halign">end</property>
+ <object class="GtkLabel" id="">
+ <property name="label" translatable="yes">Enter current PIN to change SIM
lock settings</property>
+ <property name="margin-bottom">24</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
- <object class="GtkEntry" id="pin_confirm_entry">
- <property name="visible">1</property>
- <property name="visibility">0</property>
+ <object class="GtkEntry" id="pin_entry">
+ <property name="visibility">False</property>
<property name="input-purpose">password</property>
<property name="input-hints">no-emoji</property>
<property name="max-length">8</property>
<property name="max-width-chars">32</property>
- <signal name="notify::text" handler="cc_wwan_pin_entry_changed_cb"
swapped="yes" />
- <signal name="insert-text" handler="cc_wwan_pin_entry_changed_cb"
swapped="yes" />
+ <signal name="notify::text" handler="cc_wwan_pin_entered_cb" swapped="yes"/>
+ <signal name="insert-text" handler="cc_wwan_pin_entry_text_inserted_cb"
swapped="yes"/>
+ <signal name="activate" handler="cc_wwan_pin_apply_clicked_cb"
swapped="yes"/>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
</child>
-
</object>
- </child>
-
+ </property>
</object>
- <packing>
- <property name="name">pin-settings</property>
- </packing>
- </child>
-
- <child>
- <object class="GtkBox">
- <property name="visible">1</property>
- <property name="orientation">vertical</property>
- <property name="expand">1</property>
- <property name="valign">center</property>
- <property name="halign">center</property>
- <child>
- <object class="GtkImage">
- <property name="visible">1</property>
- <property name="pixel-size">128</property>
- <property name="icon-name">dialog-password-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="">
- <property name="visible">1</property>
- <property name="label" translatable="yes">Enter current PIN to change SIM lock
settings</property>
- <property name="margin-bottom">24</property>
- <property name="halign">center</property>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
- <child>
- <object class="GtkEntry" id="pin_entry">
- <property name="visible">1</property>
- <property name="visibility">0</property>
- <property name="input-purpose">password</property>
- <property name="input-hints">no-emoji</property>
- <property name="max-length">8</property>
- <property name="max-width-chars">32</property>
- <signal name="notify::text" handler="cc_wwan_pin_entered_cb" swapped="yes" />
- <signal name="insert-text" handler="cc_wwan_pin_entry_text_inserted_cb"
swapped="yes" />
- <!-- We have custom widgets and no actions, so "activates-default" won't work -->
- <signal name="activate" handler="cc_wwan_pin_apply_clicked_cb" swapped="yes" />
- </object>
- </child>
- </object>
- <packing>
- <property name="name">pin-entry</property>
- </packing>
</child>
+ </object>
+ </property>
- </object> <!-- ./GtkStack pin_settings_stack -->
- </child>
</object>
</child>
</object>
@@ -292,8 +268,7 @@
<child type="action">
<object class="GtkButton" id="cancel_button">
- <property name="visible">1</property>
- <property name="use-underline">1</property>
+ <property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<signal name="clicked" handler="gtk_widget_hide" swapped="yes"/>
</object>
diff --git a/panels/wwan/meson.build b/panels/wwan/meson.build
index 8c1b02f26..7a33ac5c8 100644
--- a/panels/wwan/meson.build
+++ b/panels/wwan/meson.build
@@ -1,4 +1,5 @@
-gcr_dep = [dependency('gcr-3')]
+
+gcr_dep = [dependency('gcr-base-3')]
deps = common_deps + network_manager_deps + gcr_dep + [polkit_gobject_dep]
panels_list += cappletname
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 371ccac30..403a44267 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -66,7 +66,7 @@ extern GType cc_ua_panel_get_type (void);
extern GType cc_wacom_panel_get_type (void);
#endif /* BUILD_WACOM */
#ifdef BUILD_WWAN
-//extern GType cc_wwan_panel_get_type (void);
+extern GType cc_wwan_panel_get_type (void);
#endif /* BUILD_WWAN */
extern GType cc_location_panel_get_type (void);
extern GType cc_camera_panel_get_type (void);
@@ -84,7 +84,7 @@ extern void cc_wifi_panel_static_init_func (void);
extern void cc_wacom_panel_static_init_func (void);
#endif /* BUILD_WACOM */
#ifdef BUILD_WWAN
-//extern void cc_wwan_panel_static_init_func (void);
+extern void cc_wwan_panel_static_init_func (void);
#endif /* BUILD_WWAN */
#define PANEL_TYPE(name, get_type, init_func) { name, get_type, init_func }
@@ -138,7 +138,7 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("wacom", cc_wacom_panel_get_type, cc_wacom_panel_static_init_func),
#endif
#ifdef BUILD_WWAN
- //PANEL_TYPE("wwan", cc_wwan_panel_get_type, cc_wwan_panel_static_init_func),
+ PANEL_TYPE("wwan", cc_wwan_panel_get_type, cc_wwan_panel_static_init_func),
#endif
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]