Compare commits
7 Commits
main
...
network-an
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38b85255b3 | ||
|
|
3aea5cf696 | ||
|
|
e7c56fac12 | ||
|
|
54320c40ac | ||
|
|
73715004ad | ||
|
|
fa28ed1ad0 | ||
|
|
7b3cfa606a |
@@ -18,7 +18,6 @@ panels = [
|
||||
'sound',
|
||||
'system',
|
||||
'universal-access',
|
||||
'wwan',
|
||||
]
|
||||
|
||||
if host_is_linux
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "cc-list-row.h"
|
||||
#include "cc-net-proxy-page.h"
|
||||
#include "cc-wifi-page.h"
|
||||
#include "wwan/cc-wwan-page.h"
|
||||
#include "net-device-bluetooth.h"
|
||||
#include "net-device-ethernet.h"
|
||||
#include "net-device-mobile.h"
|
||||
@@ -68,12 +70,10 @@ struct _CcNetworkPanel
|
||||
/* widgets */
|
||||
GtkWidget *box_bluetooth;
|
||||
GtkWidget *box_vpn;
|
||||
GtkWidget *box_wired;
|
||||
AdwPreferencesGroup *net_devices_group;
|
||||
GtkWidget *container_bluetooth;
|
||||
GtkWidget *empty_listbox;
|
||||
GtkWidget *proxy_row;
|
||||
GtkWidget *save_button;
|
||||
GtkWidget *vpn_stack;
|
||||
GtkWidget *toolbar_view;
|
||||
|
||||
/* wireless dialog stuff */
|
||||
@@ -81,6 +81,11 @@ struct _CcNetworkPanel
|
||||
gchar *arg_device;
|
||||
gchar *arg_access_point;
|
||||
gboolean operation_done;
|
||||
|
||||
/* RFKill (Airplane Mode) */
|
||||
GDBusProxy *rfkill_proxy;
|
||||
AdwSwitchRow *rfkill_row;
|
||||
GtkWidget *rfkill_widget;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -224,6 +229,7 @@ cc_network_panel_finalize (GObject *object)
|
||||
{
|
||||
CcNetworkPanel *self = CC_NETWORK_PANEL (object);
|
||||
|
||||
g_clear_object (&self->rfkill_proxy);
|
||||
reset_command_line_args (self);
|
||||
|
||||
G_OBJECT_CLASS (cc_network_panel_parent_class)->finalize (object);
|
||||
@@ -275,7 +281,7 @@ panel_refresh_device_titles (CcNetworkPanel *self)
|
||||
if (NM_IS_DEVICE_BT (nm_devices[i]))
|
||||
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (devices[i]), nm_device_bt_get_name (NM_DEVICE_BT (nm_devices[i])));
|
||||
else if (NET_IS_DEVICE_ETHERNET (devices[i]))
|
||||
adw_preferences_group_set_title (ADW_PREFERENCES_GROUP (devices[i]), titles[i]);
|
||||
net_device_ethernet_set_title (NET_DEVICE_ETHERNET (devices[i]), titles[i]);
|
||||
else if (NET_IS_DEVICE_MOBILE (devices[i]))
|
||||
net_device_mobile_set_title (NET_DEVICE_MOBILE (devices[i]), titles[i]);
|
||||
}
|
||||
@@ -355,13 +361,6 @@ handle_argv (CcNetworkPanel *self)
|
||||
g_debug ("Could not handle argv operation, no matching device yet?");
|
||||
}
|
||||
|
||||
static void
|
||||
update_vpn_section (CcNetworkPanel *self)
|
||||
{
|
||||
gtk_stack_set_visible_child (GTK_STACK (self->vpn_stack),
|
||||
self->vpns->len == 0 ? self->empty_listbox : self->box_vpn);
|
||||
}
|
||||
|
||||
static void
|
||||
update_bluetooth_section (CcNetworkPanel *self)
|
||||
{
|
||||
@@ -412,7 +411,7 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
|
||||
case NM_DEVICE_TYPE_ETHERNET:
|
||||
case NM_DEVICE_TYPE_INFINIBAND:
|
||||
device_ethernet = net_device_ethernet_new (self->client, device);
|
||||
gtk_box_append (GTK_BOX (self->box_wired), GTK_WIDGET (device_ethernet));
|
||||
adw_preferences_group_add (self->net_devices_group, GTK_WIDGET (device_ethernet));
|
||||
g_ptr_array_add (self->ethernet_devices, device_ethernet);
|
||||
g_hash_table_insert (self->nm_device_to_device, device, device_ethernet);
|
||||
break;
|
||||
@@ -438,7 +437,7 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
|
||||
}
|
||||
|
||||
device_mobile = net_device_mobile_new (self->client, device, modem_object);
|
||||
gtk_box_append (GTK_BOX (self->box_wired), GTK_WIDGET (device_mobile));
|
||||
adw_preferences_group_add (self->net_devices_group, GTK_WIDGET (device_mobile));
|
||||
g_ptr_array_add (self->mobile_devices, device_mobile);
|
||||
g_hash_table_insert (self->nm_device_to_device, device, device_mobile);
|
||||
break;
|
||||
@@ -481,9 +480,6 @@ panel_remove_device (CcNetworkPanel *self, NMDevice *device)
|
||||
|
||||
gtk_box_remove (GTK_BOX (gtk_widget_get_parent (net_device)), net_device);
|
||||
|
||||
/* update vpn widgets */
|
||||
update_vpn_section (self);
|
||||
|
||||
/* update device_bluetooth widgets */
|
||||
update_bluetooth_section (self);
|
||||
}
|
||||
@@ -601,13 +597,10 @@ panel_add_vpn_device (CcNetworkPanel *self, NMConnection *connection)
|
||||
}
|
||||
|
||||
net_vpn = net_vpn_new (self->client, connection);
|
||||
gtk_list_box_append (GTK_LIST_BOX (self->box_vpn), GTK_WIDGET (net_vpn));
|
||||
adw_preferences_group_add (ADW_PREFERENCES_GROUP (self->box_vpn), GTK_WIDGET (net_vpn));
|
||||
|
||||
/* store in the devices array */
|
||||
g_ptr_array_add (self->vpns, net_vpn);
|
||||
|
||||
/* update vpn widgets */
|
||||
update_vpn_section (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -643,8 +636,7 @@ client_connection_removed_cb (CcNetworkPanel *self, NMConnection *connection)
|
||||
NetVpn *vpn = g_ptr_array_index (self->vpns, i);
|
||||
if (net_vpn_get_connection (vpn) == connection) {
|
||||
g_ptr_array_remove (self->vpns, vpn);
|
||||
gtk_list_box_remove (GTK_LIST_BOX (self->box_vpn), GTK_WIDGET (vpn));
|
||||
update_vpn_section (self);
|
||||
adw_preferences_group_remove (ADW_PREFERENCES_GROUP (self->box_vpn), GTK_WIDGET (vpn));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -695,6 +687,103 @@ cc_network_panel_map (GtkWidget *widget)
|
||||
panel_check_network_manager_version (CC_NETWORK_PANEL (widget));
|
||||
}
|
||||
|
||||
/* Airplane Mode */
|
||||
static inline gboolean
|
||||
get_cached_rfkill_property (CcNetworkPanel *self,
|
||||
const gchar *property)
|
||||
{
|
||||
g_autoptr(GVariant) result = NULL;
|
||||
|
||||
result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, property);
|
||||
return result ? g_variant_get_boolean (result) : FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
rfkill_switch_notify_activate_cb (CcNetworkPanel *self)
|
||||
{
|
||||
gboolean enable;
|
||||
|
||||
enable = adw_switch_row_get_active (self->rfkill_row);
|
||||
g_dbus_proxy_call (self->rfkill_proxy,
|
||||
"org.freedesktop.DBus.Properties.Set",
|
||||
g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill',"
|
||||
"'AirplaneMode', %v)",
|
||||
g_variant_new_boolean (enable)),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cc_panel_get_cancellable (CC_PANEL (self)),
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
sync_airplane_mode_switch (CcNetworkPanel *self)
|
||||
{
|
||||
gboolean enabled, should_show, hw_enabled;
|
||||
|
||||
enabled = get_cached_rfkill_property (self, "HasAirplaneMode");
|
||||
should_show = get_cached_rfkill_property (self, "ShouldShowAirplaneMode");
|
||||
|
||||
//gtk_widget_set_visible (GTK_WIDGET (self->rfkill_widget), enabled && should_show);
|
||||
if (!enabled || !should_show)
|
||||
return;
|
||||
|
||||
enabled = get_cached_rfkill_property (self, "AirplaneMode");
|
||||
hw_enabled = get_cached_rfkill_property (self, "HardwareAirplaneMode");
|
||||
|
||||
enabled |= hw_enabled;
|
||||
if (enabled != adw_switch_row_get_active (self->rfkill_row)) {
|
||||
g_signal_handlers_block_by_func (self->rfkill_row,
|
||||
rfkill_switch_notify_activate_cb,
|
||||
self);
|
||||
g_object_set (self->rfkill_row, "active", enabled, NULL);
|
||||
//check_main_stack_page (self);
|
||||
g_signal_handlers_unblock_by_func (self->rfkill_row,
|
||||
rfkill_switch_notify_activate_cb,
|
||||
self);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (self->rfkill_row), !hw_enabled);
|
||||
//check_main_stack_page (self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_rfkill_proxy_properties_changed_cb (CcNetworkPanel *self)
|
||||
{
|
||||
g_debug ("Rfkill properties changed");
|
||||
|
||||
sync_airplane_mode_switch (self);
|
||||
}
|
||||
|
||||
static void
|
||||
rfkill_proxy_acquired_cb (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
CcNetworkPanel *self;
|
||||
GDBusProxy *proxy;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
|
||||
|
||||
if (error) {
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
g_printerr ("Error creating rfkill proxy: %s\n", error->message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self = CC_NETWORK_PANEL (user_data);
|
||||
self->rfkill_proxy = proxy;
|
||||
|
||||
g_signal_connect_object (proxy,
|
||||
"g-properties-changed",
|
||||
G_CALLBACK (on_rfkill_proxy_properties_changed_cb),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
sync_airplane_mode_switch (self);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_network_panel_class_init (CcNetworkPanelClass *klass)
|
||||
@@ -718,17 +807,20 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass)
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_bluetooth);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_vpn);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_wired);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, net_devices_group);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, container_bluetooth);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, empty_listbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, proxy_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, vpn_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, rfkill_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, rfkill_widget);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, toolbar_view);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, create_connection_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, rfkill_switch_notify_activate_cb);
|
||||
|
||||
g_type_ensure (CC_TYPE_WIFI_PAGE);
|
||||
g_type_ensure (CC_TYPE_LIST_ROW);
|
||||
g_type_ensure (CC_TYPE_NET_PROXY_PAGE);
|
||||
g_type_ensure (CC_TYPE_WWAN_PAGE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -797,4 +889,14 @@ cc_network_panel_init (CcNetworkPanel *self)
|
||||
|
||||
g_debug ("Calling handle_argv() after cold-plugging connections");
|
||||
handle_argv (self);
|
||||
|
||||
/* Acquire Airplane Mode proxy */
|
||||
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
"org.gnome.SettingsDaemon.Rfkill",
|
||||
"/org/gnome/SettingsDaemon/Rfkill",
|
||||
"org.gnome.SettingsDaemon.Rfkill",
|
||||
cc_panel_get_cancellable (CC_PANEL (self)),
|
||||
rfkill_proxy_acquired_cb,
|
||||
self);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<object class="AdwNavigationView" id="main_nav">
|
||||
<child>
|
||||
<object class="AdwNavigationPage">
|
||||
<property name="title" translatable="yes">Network</property>
|
||||
<property name="title" translatable="yes">Network & Internet</property>
|
||||
<child>
|
||||
<object class="AdwToolbarView" id="toolbar_view">
|
||||
<child type="top">
|
||||
@@ -13,17 +13,55 @@
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="AdwPreferencesPage">
|
||||
<!-- Each group below will contain GtkStacks from the NetDevices -->
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<child>
|
||||
<object class="GtkBox" id="box_wired">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">24</property>
|
||||
<object class="CcListRow" id="wifi_row">
|
||||
<property name="title" translatable="yes">_Wi-Fi</property>
|
||||
<property name="show-arrow">True</property>
|
||||
<property name="icon-name">network-wireless-symbolic</property>
|
||||
<property name="subtitle" bind-source="wifi_page" bind-property="state-text" bind-flags="sync-create"/>
|
||||
<property name="action-name">navigation.push</property>
|
||||
<property name="action-target">'wifi'</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="CcListRow" id="wwan_row">
|
||||
<property name="title" translatable="yes">Cellular</property>
|
||||
<property name="show-arrow">True</property>
|
||||
<property name="icon-name">network-cellular-signal-excellent-symbolic</property>
|
||||
<property name="action-name">navigation.push</property>
|
||||
<property name="action-target">'wwan'</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="CcListRow">
|
||||
<property name="title" translatable="yes">VPN</property>
|
||||
<property name="subtitle" translatable="yes">Not Set Up</property>
|
||||
<property name="show-arrow">True</property>
|
||||
<property name="icon-name">preferences-system-network-proxy-symbolic</property>
|
||||
<property name="subtitle" bind-source="proxy_page" bind-property="state-text" bind-flags="sync-create"/>
|
||||
<property name="action-name">navigation.push</property>
|
||||
<property name="action-target">'vpn'</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="CcListRow" id="proxy_row">
|
||||
<property name="title" translatable="yes">Network _Proxy</property>
|
||||
<property name="show-arrow">True</property>
|
||||
<property name="icon-name">preferences-system-network-proxy-symbolic</property>
|
||||
<property name="subtitle" bind-source="proxy_page" bind-property="state-text" bind-flags="sync-create"/>
|
||||
<property name="action-name">navigation.push</property>
|
||||
<property name="action-target">'proxy'</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<!-- Each group below will contain GtkStacks from the NetDevices -->
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="net_devices_group"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="container_bluetooth">
|
||||
<property name="visible">False</property>
|
||||
@@ -41,67 +79,14 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<!-- Airplane Mode -->
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<property name="title" translatable="yes">VPN</property>
|
||||
<property name="header-suffix">
|
||||
<object class="GtkButton">
|
||||
<property name="tooltip-text" translatable="yes">Add VPN</property>
|
||||
<property name="icon_name">list-add-symbolic</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Add connection</property>
|
||||
</accessibility>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
<signal name="clicked" handler="create_connection_cb" object="CcNetworkPanel" swapped="yes" />
|
||||
</object>
|
||||
</property>
|
||||
<object class="AdwPreferencesGroup" id="rfkill_widget">
|
||||
<child>
|
||||
<object class="GtkStack" id="vpn_stack">
|
||||
<child>
|
||||
<!-- "Not set up" row -->
|
||||
<object class="GtkListBox" id="empty_listbox">
|
||||
<property name="selection_mode">none</property>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="activatable">False</property>
|
||||
<property name="title" translatable="yes">Not set up</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="box_vpn">
|
||||
<property name="selection_mode">none</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">VPN</property>
|
||||
</accessibility>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<!-- xxx: Added to avoid confusion with the preceding VPN row -->
|
||||
<property name="title" translatable="yes">Proxy</property>
|
||||
<child>
|
||||
<object class="CcListRow" id="proxy_row">
|
||||
<property name="title" translatable="yes">_Proxy</property>
|
||||
<property name="show-arrow">True</property>
|
||||
<property name="icon-name">preferences-system-network-proxy-symbolic</property>
|
||||
<property name="subtitle" bind-source="proxy_page" bind-property="state-text" bind-flags="sync-create"/>
|
||||
<property name="action-name">navigation.push</property>
|
||||
<property name="action-target">'proxy'</property>
|
||||
<object class="AdwSwitchRow" id="rfkill_row">
|
||||
<property name="title" translatable="yes">Airplane Mode</property>
|
||||
<property name="subtitle" translatable="yes">Disables Wi-Fi, Bluetooth and mobile broadband</property>
|
||||
<signal name="notify::active" handler="rfkill_switch_notify_activate_cb" object="CcNetworkPanel" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -112,9 +97,58 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="CcNetProxyPage" id="proxy_page"/>
|
||||
</child>
|
||||
|
||||
<!-- VPN Page -->
|
||||
<child>
|
||||
<object class="AdwNavigationPage">
|
||||
<property name="tag">vpn</property>
|
||||
<property name="title" translatable="yes">VPN</property>
|
||||
<child>
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar"/>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="AdwPreferencesPage" id="prefs_vpn_page">
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="activatable">True</property>
|
||||
<property name="title" translatable="yes">Add VPN Connection…</property>
|
||||
<signal name="activated" handler="create_connection_cb" object="CcNetworkPanel" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="box_vpn">
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">VPN</property>
|
||||
</accessibility>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="CcWifiPage" id="wifi_page"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="CcWwanPage" id="wwan_page"/>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "cc-network-resources.h"
|
||||
#include "cc-wifi-panel.h"
|
||||
#include "cc-wifi-page.h"
|
||||
#include "cc-qr-code.h"
|
||||
#include "net-device-wifi.h"
|
||||
#include "network-dialogs.h"
|
||||
@@ -42,15 +42,10 @@ typedef enum
|
||||
OPERATION_CONNECT_8021X
|
||||
} CmdlineOperation;
|
||||
|
||||
struct _CcWifiPanel
|
||||
struct _CcWifiPage
|
||||
{
|
||||
CcPanel parent;
|
||||
|
||||
/* RFKill (Airplane Mode) */
|
||||
GDBusProxy *rfkill_proxy;
|
||||
AdwSwitchRow *rfkill_row;
|
||||
GtkWidget *rfkill_widget;
|
||||
|
||||
/* Main widgets */
|
||||
GtkStack *center_stack;
|
||||
GtkStack *device_stack;
|
||||
@@ -74,11 +69,9 @@ struct _CcWifiPanel
|
||||
gchar *arg_access_point;
|
||||
};
|
||||
|
||||
static void rfkill_switch_notify_activate_cb (CcWifiPanel *self);
|
||||
static void update_devices_names (CcWifiPage *self);
|
||||
|
||||
static void update_devices_names (CcWifiPanel *self);
|
||||
|
||||
G_DEFINE_TYPE (CcWifiPanel, cc_wifi_panel, CC_TYPE_PANEL)
|
||||
G_DEFINE_TYPE (CcWifiPage, cc_wifi_page, CC_TYPE_PANEL)
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -93,7 +86,6 @@ static void
|
||||
update_panel_visibility (NMClient *client)
|
||||
{
|
||||
const GPtrArray *devices;
|
||||
CcApplication *application;
|
||||
gboolean visible;
|
||||
guint i;
|
||||
|
||||
@@ -113,16 +105,12 @@ update_panel_visibility (NMClient *client)
|
||||
}
|
||||
|
||||
/* Set the new visibility */
|
||||
application = CC_APPLICATION (g_application_get_default ());
|
||||
cc_shell_model_set_panel_visibility (cc_application_get_model (application),
|
||||
"wifi",
|
||||
visible ? CC_PANEL_VISIBLE : CC_PANEL_VISIBLE_IN_SEARCH);
|
||||
|
||||
// FIXME
|
||||
g_debug ("Wi-Fi panel visible: %s", visible ? "yes" : "no");
|
||||
}
|
||||
|
||||
void
|
||||
cc_wifi_panel_static_init_func (void)
|
||||
cc_wifi_page_static_init_func (void)
|
||||
{
|
||||
g_autoptr(NMClient) client = NULL;
|
||||
|
||||
@@ -148,13 +136,13 @@ cc_wifi_panel_static_init_func (void)
|
||||
/* Auxiliary methods */
|
||||
|
||||
static NMConnection *
|
||||
wifi_device_get_hotspot (CcWifiPanel *self,
|
||||
wifi_device_get_hotspot (CcWifiPage *self,
|
||||
NMDevice *device)
|
||||
{
|
||||
NMSettingIPConfig *ip4_setting;
|
||||
NMConnection *c;
|
||||
|
||||
g_assert (CC_IS_WIFI_PANEL (self));
|
||||
g_assert (CC_IS_WIFI_PAGE (self));
|
||||
g_assert (NM_IS_DEVICE (device));
|
||||
|
||||
if (nm_device_get_active_connection (device) == NULL)
|
||||
@@ -173,13 +161,13 @@ wifi_device_get_hotspot (CcWifiPanel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
wifi_panel_update_qr_image_cb (CcWifiPanel *self)
|
||||
wifi_page_update_qr_image_cb (CcWifiPage *self)
|
||||
{
|
||||
NetDeviceWifi *child;
|
||||
NMConnection *hotspot;
|
||||
NMDevice *device;
|
||||
|
||||
g_assert (CC_IS_WIFI_PANEL (self));
|
||||
g_assert (CC_IS_WIFI_PAGE (self));
|
||||
|
||||
child = NET_DEVICE_WIFI (gtk_stack_get_visible_child (self->stack));
|
||||
device = net_device_wifi_get_device (child);
|
||||
@@ -225,7 +213,7 @@ wifi_panel_update_qr_image_cb (CcWifiPanel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
add_wifi_device (CcWifiPanel *self,
|
||||
add_wifi_device (CcWifiPage *self,
|
||||
NMDevice *device)
|
||||
{
|
||||
GtkWidget *header_widget;
|
||||
@@ -251,13 +239,13 @@ add_wifi_device (CcWifiPanel *self,
|
||||
nm_device_get_udi (device),
|
||||
nm_device_get_description (device));
|
||||
g_signal_connect_object (device, "state-changed",
|
||||
G_CALLBACK (wifi_panel_update_qr_image_cb),
|
||||
G_CALLBACK (wifi_page_update_qr_image_cb),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_wifi_device (CcWifiPanel *self,
|
||||
remove_wifi_device (CcWifiPage *self,
|
||||
NMDevice *device)
|
||||
{
|
||||
GtkWidget *child;
|
||||
@@ -280,7 +268,7 @@ remove_wifi_device (CcWifiPanel *self,
|
||||
|
||||
/* Disconnect the signal to prevent assertion crash */
|
||||
g_signal_handlers_disconnect_by_func (device,
|
||||
G_CALLBACK (wifi_panel_update_qr_image_cb),
|
||||
G_CALLBACK (wifi_page_update_qr_image_cb),
|
||||
self);
|
||||
|
||||
/* Destroy all stack pages related to this device */
|
||||
@@ -295,20 +283,19 @@ remove_wifi_device (CcWifiPanel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
check_main_stack_page (CcWifiPanel *self)
|
||||
check_main_stack_page (CcWifiPage *self)
|
||||
{
|
||||
const gchar *nm_version;
|
||||
gboolean airplane_mode_active;
|
||||
gboolean wireless_enabled;
|
||||
|
||||
nm_version = nm_client_get_version (self->client);
|
||||
wireless_enabled = nm_client_wireless_get_enabled (self->client);
|
||||
airplane_mode_active = adw_switch_row_get_active (self->rfkill_row);
|
||||
//airplane_mode_active = adw_switch_row_get_active (self->rfkill_row);
|
||||
|
||||
if (!nm_version)
|
||||
gtk_stack_set_visible_child_name (self->main_stack, "nm-not-running");
|
||||
else if (!wireless_enabled && airplane_mode_active)
|
||||
gtk_stack_set_visible_child_name (self->main_stack, "airplane-mode");
|
||||
//else if (!wireless_enabled && airplane_mode_active)
|
||||
// gtk_stack_set_visible_child_name (self->main_stack, "airplane-mode");
|
||||
else if (!wireless_enabled || self->devices->len == 0)
|
||||
gtk_stack_set_visible_child_name (self->main_stack, "no-wifi-devices");
|
||||
else
|
||||
@@ -316,7 +303,7 @@ check_main_stack_page (CcWifiPanel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
load_wifi_devices (CcWifiPanel *self)
|
||||
load_wifi_devices (CcWifiPage *self)
|
||||
{
|
||||
const GPtrArray *devices;
|
||||
guint i;
|
||||
@@ -340,52 +327,8 @@ load_wifi_devices (CcWifiPanel *self)
|
||||
check_main_stack_page (self);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
get_cached_rfkill_property (CcWifiPanel *self,
|
||||
const gchar *property)
|
||||
{
|
||||
g_autoptr(GVariant) result = NULL;
|
||||
|
||||
result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, property);
|
||||
return result ? g_variant_get_boolean (result) : FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
sync_airplane_mode_switch (CcWifiPanel *self)
|
||||
{
|
||||
gboolean enabled, should_show, hw_enabled;
|
||||
|
||||
enabled = get_cached_rfkill_property (self, "HasAirplaneMode");
|
||||
should_show = get_cached_rfkill_property (self, "ShouldShowAirplaneMode");
|
||||
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->rfkill_widget), enabled && should_show);
|
||||
if (!enabled || !should_show)
|
||||
return;
|
||||
|
||||
enabled = get_cached_rfkill_property (self, "AirplaneMode");
|
||||
hw_enabled = get_cached_rfkill_property (self, "HardwareAirplaneMode");
|
||||
|
||||
enabled |= hw_enabled;
|
||||
|
||||
if (enabled != adw_switch_row_get_active (self->rfkill_row))
|
||||
{
|
||||
g_signal_handlers_block_by_func (self->rfkill_row,
|
||||
rfkill_switch_notify_activate_cb,
|
||||
self);
|
||||
g_object_set (self->rfkill_row, "active", enabled, NULL);
|
||||
check_main_stack_page (self);
|
||||
g_signal_handlers_unblock_by_func (self->rfkill_row,
|
||||
rfkill_switch_notify_activate_cb,
|
||||
self);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (self->rfkill_row), !hw_enabled);
|
||||
|
||||
check_main_stack_page (self);
|
||||
}
|
||||
|
||||
static void
|
||||
update_devices_names (CcWifiPanel *self)
|
||||
update_devices_names (CcWifiPage *self)
|
||||
{
|
||||
guint number_of_devices = self->devices->len;
|
||||
|
||||
@@ -436,7 +379,7 @@ update_devices_names (CcWifiPanel *self)
|
||||
/* Command-line arguments */
|
||||
|
||||
static void
|
||||
reset_command_line_args (CcWifiPanel *self)
|
||||
reset_command_line_args (CcWifiPage *self)
|
||||
{
|
||||
self->arg_operation = OPERATION_NULL;
|
||||
g_clear_pointer (&self->arg_device, g_free);
|
||||
@@ -444,7 +387,7 @@ reset_command_line_args (CcWifiPanel *self)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_argv_for_device (CcWifiPanel *self, NetDeviceWifi *net_device)
|
||||
handle_argv_for_device (CcWifiPage *self, NetDeviceWifi *net_device)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
NMDevice *device;
|
||||
@@ -488,7 +431,7 @@ handle_argv_for_device (CcWifiPanel *self, NetDeviceWifi *net_device)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_argv (CcWifiPanel *self)
|
||||
handle_argv (CcWifiPage *self)
|
||||
{
|
||||
guint i;
|
||||
|
||||
@@ -524,7 +467,7 @@ variant_av_to_string_array (GVariant *array)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_argv (CcWifiPanel *self,
|
||||
verify_argv (CcWifiPage *self,
|
||||
const char **args)
|
||||
{
|
||||
switch (self->arg_operation)
|
||||
@@ -544,7 +487,7 @@ verify_argv (CcWifiPanel *self,
|
||||
/* Callbacks */
|
||||
|
||||
static void
|
||||
device_state_changed_cb (CcWifiPanel *self, GParamSpec *pspec, NMDevice *device)
|
||||
device_state_changed_cb (CcWifiPage *self, GParamSpec *pspec, NMDevice *device)
|
||||
{
|
||||
const gchar *id;
|
||||
|
||||
@@ -570,7 +513,7 @@ device_state_changed_cb (CcWifiPanel *self, GParamSpec *pspec, NMDevice *device)
|
||||
}
|
||||
|
||||
static void
|
||||
device_added_cb (CcWifiPanel *self, NMDevice *device)
|
||||
device_added_cb (CcWifiPage *self, NMDevice *device)
|
||||
{
|
||||
if (!NM_IS_DEVICE_WIFI (device))
|
||||
return;
|
||||
@@ -589,7 +532,7 @@ device_added_cb (CcWifiPanel *self, NMDevice *device)
|
||||
}
|
||||
|
||||
static void
|
||||
device_removed_cb (CcWifiPanel *self, NMDevice *device)
|
||||
device_removed_cb (CcWifiPage *self, NMDevice *device)
|
||||
{
|
||||
const gchar *id;
|
||||
|
||||
@@ -610,77 +553,18 @@ device_removed_cb (CcWifiPanel *self, NMDevice *device)
|
||||
}
|
||||
|
||||
static void
|
||||
wireless_enabled_cb (CcWifiPanel *self)
|
||||
wireless_enabled_cb (CcWifiPage *self)
|
||||
{
|
||||
check_main_stack_page (self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_rfkill_proxy_properties_changed_cb (CcWifiPanel *self)
|
||||
{
|
||||
g_debug ("Rfkill properties changed");
|
||||
|
||||
sync_airplane_mode_switch (self);
|
||||
}
|
||||
|
||||
static void
|
||||
rfkill_proxy_acquired_cb (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
CcWifiPanel *self;
|
||||
GDBusProxy *proxy;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
g_printerr ("Error creating rfkill proxy: %s\n", error->message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self = CC_WIFI_PANEL (user_data);
|
||||
|
||||
self->rfkill_proxy = proxy;
|
||||
|
||||
g_signal_connect_object (proxy,
|
||||
"g-properties-changed",
|
||||
G_CALLBACK (on_rfkill_proxy_properties_changed_cb),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
sync_airplane_mode_switch (self);
|
||||
}
|
||||
|
||||
static void
|
||||
rfkill_switch_notify_activate_cb (CcWifiPanel *self)
|
||||
{
|
||||
gboolean enable;
|
||||
|
||||
enable = adw_switch_row_get_active (self->rfkill_row);
|
||||
|
||||
g_dbus_proxy_call (self->rfkill_proxy,
|
||||
"org.freedesktop.DBus.Properties.Set",
|
||||
g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill',"
|
||||
"'AirplaneMode', %v)",
|
||||
g_variant_new_boolean (enable)),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cc_panel_get_cancellable (CC_PANEL (self)),
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
on_stack_visible_child_changed_cb (CcWifiPanel *self)
|
||||
on_stack_visible_child_changed_cb (CcWifiPage *self)
|
||||
{
|
||||
const gchar *visible_device_id = NULL;
|
||||
guint i;
|
||||
|
||||
wifi_panel_update_qr_image_cb (self);
|
||||
wifi_page_update_qr_image_cb (self);
|
||||
|
||||
/* Remove previous bindings */
|
||||
g_clear_pointer (&self->spinner_binding, g_binding_unbind);
|
||||
@@ -703,7 +587,7 @@ on_stack_visible_child_changed_cb (CcWifiPanel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
on_stop_hotspot_dialog_response_cb (CcWifiPanel *self,
|
||||
on_stop_hotspot_dialog_response_cb (CcWifiPage *self,
|
||||
gchar *response,
|
||||
AdwMessageDialog *dialog)
|
||||
{
|
||||
@@ -719,12 +603,12 @@ on_stop_hotspot_dialog_response_cb (CcWifiPanel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
hotspot_stop_clicked_cb (CcWifiPanel *self)
|
||||
hotspot_stop_clicked_cb (CcWifiPage *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkNative *native;
|
||||
|
||||
g_assert (CC_IS_WIFI_PANEL (self));
|
||||
g_assert (CC_IS_WIFI_PAGE (self));
|
||||
|
||||
native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||
|
||||
@@ -747,31 +631,22 @@ hotspot_stop_clicked_cb (CcWifiPanel *self)
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
/* Overrides */
|
||||
|
||||
static const gchar *
|
||||
cc_wifi_panel_get_help_uri (CcPanel *panel)
|
||||
{
|
||||
return "help:gnome-help/net-wireless";
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wifi_panel_finalize (GObject *object)
|
||||
cc_wifi_page_finalize (GObject *object)
|
||||
{
|
||||
CcWifiPanel *self = (CcWifiPanel *)object;
|
||||
CcWifiPage *self = (CcWifiPage *)object;
|
||||
|
||||
g_clear_object (&self->client);
|
||||
g_clear_object (&self->rfkill_proxy);
|
||||
|
||||
g_clear_pointer (&self->devices, g_ptr_array_unref);
|
||||
|
||||
reset_command_line_args (self);
|
||||
|
||||
G_OBJECT_CLASS (cc_wifi_panel_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (cc_wifi_page_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wifi_panel_get_property (GObject *object,
|
||||
cc_wifi_page_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
@@ -780,12 +655,12 @@ cc_wifi_panel_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wifi_panel_set_property (GObject *object,
|
||||
cc_wifi_page_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CcWifiPanel *self = CC_WIFI_PANEL (object);
|
||||
CcWifiPage *self = CC_WIFI_PAGE (object);
|
||||
GVariant *parameters;
|
||||
|
||||
switch (prop_id)
|
||||
@@ -838,32 +713,26 @@ cc_wifi_panel_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wifi_panel_class_init (CcWifiPanelClass *klass)
|
||||
cc_wifi_page_class_init (CcWifiPageClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
|
||||
|
||||
panel_class->get_help_uri = cc_wifi_panel_get_help_uri;
|
||||
object_class->finalize = cc_wifi_page_finalize;
|
||||
object_class->get_property = cc_wifi_page_get_property;
|
||||
object_class->set_property = cc_wifi_page_set_property;
|
||||
|
||||
object_class->finalize = cc_wifi_panel_finalize;
|
||||
object_class->get_property = cc_wifi_panel_get_property;
|
||||
object_class->set_property = cc_wifi_panel_set_property;
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/cc-wifi-page.ui");
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/cc-wifi-panel.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, center_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, device_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, hotspot_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, list_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, main_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, spinner);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPage, wifi_qr_image);
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, center_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, device_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, hotspot_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, list_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, main_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, rfkill_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, rfkill_widget);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, spinner);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiPanel, wifi_qr_image);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, rfkill_switch_notify_activate_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_stack_visible_child_changed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, hotspot_stop_clicked_cb);
|
||||
|
||||
@@ -871,7 +740,7 @@ cc_wifi_panel_class_init (CcWifiPanelClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wifi_panel_init (CcWifiPanel *self)
|
||||
cc_wifi_page_init (CcWifiPage *self)
|
||||
{
|
||||
g_autoptr(GtkCssProvider) provider = NULL;
|
||||
|
||||
@@ -912,16 +781,6 @@ cc_wifi_panel_init (CcWifiPanel *self)
|
||||
/* Load Wi-Fi devices */
|
||||
load_wifi_devices (self);
|
||||
|
||||
/* Acquire Airplane Mode proxy */
|
||||
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
"org.gnome.SettingsDaemon.Rfkill",
|
||||
"/org/gnome/SettingsDaemon/Rfkill",
|
||||
"org.gnome.SettingsDaemon.Rfkill",
|
||||
cc_panel_get_cancellable (CC_PANEL (self)),
|
||||
rfkill_proxy_acquired_cb,
|
||||
self);
|
||||
|
||||
/* Handle comment-line arguments after loading devices */
|
||||
handle_argv (self);
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CC_TYPE_WIFI_PANEL (cc_wifi_panel_get_type())
|
||||
#define CC_TYPE_WIFI_PAGE (cc_wifi_page_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CcWifiPanel, cc_wifi_panel, CC, WIFI_PANEL, CcPanel)
|
||||
G_DECLARE_FINAL_TYPE (CcWifiPage, cc_wifi_page, CC, WIFI_PAGE, CcPanel)
|
||||
|
||||
void cc_wifi_panel_static_init_func (void);
|
||||
void cc_wifi_page_static_init_func (void);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="CcWifiPanel" parent="CcPanel">
|
||||
<template class="CcWifiPage" parent="CcPanel">
|
||||
<property name="tag">wifi</property>
|
||||
<property name="child">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
@@ -36,19 +37,6 @@
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<!-- Airplane Mode -->
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="rfkill_widget">
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="rfkill_row">
|
||||
<property name="title" translatable="yes">Airplane Mode</property>
|
||||
<property name="subtitle" translatable="yes">Disables Wi-Fi, Bluetooth and mobile broadband</property>
|
||||
<signal name="notify::active" handler="rfkill_switch_notify_activate_cb" object="CcWifiPanel" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<!-- Wi-Fi List / No Wi-Fi Adapter / Airplane Mode Enabled -->
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
@@ -174,7 +162,7 @@
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="transition_type">crossfade</property>
|
||||
<signal name="notify::visible-child-name" handler="on_stack_visible_child_changed_cb" object="CcWifiPanel" swapped="yes" />
|
||||
<signal name="notify::visible-child-name" handler="on_stack_visible_child_changed_cb" object="CcWifiPage" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Name=Network
|
||||
Name=Network & Internet
|
||||
Comment=Control how you connect to the Internet
|
||||
Exec=gnome-control-center network
|
||||
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
||||
|
||||
@@ -10,7 +10,7 @@ subdir('icons')
|
||||
|
||||
panel_names = [
|
||||
cappletname,
|
||||
'wifi'
|
||||
'wifi',
|
||||
]
|
||||
|
||||
panels_list += panel_names
|
||||
@@ -28,6 +28,8 @@ foreach name: panel_names
|
||||
)
|
||||
endforeach
|
||||
|
||||
subdir('wwan')
|
||||
|
||||
sources = files(
|
||||
'cc-qr-code.c',
|
||||
'cc-qr-code-dialog.c',
|
||||
@@ -35,7 +37,7 @@ sources = files(
|
||||
'cc-net-proxy-page.c',
|
||||
'cc-wifi-connection-row.c',
|
||||
'cc-wifi-connection-list.c',
|
||||
'cc-wifi-panel.c',
|
||||
'cc-wifi-page.c',
|
||||
'cc-wifi-hotspot-dialog.c',
|
||||
'net-device-bluetooth.c',
|
||||
'net-device-ethernet.c',
|
||||
|
||||
@@ -40,8 +40,7 @@ struct _NetDeviceEthernet
|
||||
GtkStack *connection_stack;
|
||||
GtkButton *details_button;
|
||||
GtkListBox *details_listbox;
|
||||
AdwActionRow *details_row;
|
||||
GtkSwitch *device_off_switch;
|
||||
AdwSwitchRow *details_row;
|
||||
|
||||
NMClient *client;
|
||||
NMDevice *device;
|
||||
@@ -51,133 +50,6 @@ struct _NetDeviceEthernet
|
||||
|
||||
G_DEFINE_TYPE (NetDeviceEthernet, net_device_ethernet, ADW_TYPE_PREFERENCES_GROUP)
|
||||
|
||||
static void
|
||||
add_details_row (GtkWidget *details, gint top, const gchar *heading, const gchar *value)
|
||||
{
|
||||
GtkWidget *heading_label;
|
||||
GtkWidget *value_label;
|
||||
|
||||
heading_label = gtk_label_new (heading);
|
||||
gtk_widget_add_css_class (heading_label, "dim-label");
|
||||
gtk_widget_set_halign (heading_label, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (heading_label, GTK_ALIGN_START);
|
||||
gtk_widget_set_hexpand (heading_label, TRUE);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (details), heading_label, 0, top, 1, 1);
|
||||
|
||||
value_label = gtk_label_new (value);
|
||||
gtk_widget_set_halign (value_label, GTK_ALIGN_START);
|
||||
gtk_widget_set_hexpand (value_label, TRUE);
|
||||
gtk_label_set_selectable (GTK_LABEL (value_label), TRUE);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (heading_label), value_label);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (details), value_label, 1, top, 1, 1);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
get_last_used_string (NMConnection *connection)
|
||||
{
|
||||
g_autoptr(GDateTime) now = NULL;
|
||||
g_autoptr(GDateTime) then = NULL;
|
||||
gint days;
|
||||
GTimeSpan diff;
|
||||
guint64 timestamp;
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
if (s_con == NULL)
|
||||
return NULL;
|
||||
timestamp = nm_setting_connection_get_timestamp (s_con);
|
||||
if (timestamp == 0)
|
||||
return g_strdup (_("never"));
|
||||
|
||||
/* calculate the amount of time that has elapsed */
|
||||
now = g_date_time_new_now_utc ();
|
||||
then = g_date_time_new_from_unix_utc (timestamp);
|
||||
diff = g_date_time_difference (now, then);
|
||||
days = diff / G_TIME_SPAN_DAY;
|
||||
if (days == 0)
|
||||
return g_strdup (_("today"));
|
||||
else if (days == 1)
|
||||
return g_strdup (_("yesterday"));
|
||||
else
|
||||
return g_strdup_printf (ngettext ("%i day ago", "%i days ago", days), days);
|
||||
}
|
||||
|
||||
static void
|
||||
add_details (GtkWidget *details, NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMIPConfig *ip4_config = NULL;
|
||||
NMIPConfig *ip6_config = NULL;
|
||||
const gchar *ip4_address = NULL;
|
||||
const gchar *ip4_route = NULL;
|
||||
g_autofree gchar *ip4_dns = NULL;
|
||||
g_autofree gchar *ip6_addresses = NULL;
|
||||
const gchar *ip6_route = NULL;
|
||||
g_autofree gchar *ip6_dns = NULL;
|
||||
gint i = 0;
|
||||
|
||||
ip4_config = nm_device_get_ip4_config (device);
|
||||
if (ip4_config) {
|
||||
GPtrArray *addresses;
|
||||
|
||||
addresses = nm_ip_config_get_addresses (ip4_config);
|
||||
if (addresses->len > 0)
|
||||
ip4_address = nm_ip_address_get_address (g_ptr_array_index (addresses, 0));
|
||||
|
||||
ip4_route = nm_ip_config_get_gateway (ip4_config);
|
||||
ip4_dns = g_strjoinv (" ", (char **) nm_ip_config_get_nameservers (ip4_config));
|
||||
if (!*ip4_dns)
|
||||
ip4_dns = NULL;
|
||||
}
|
||||
ip6_config = nm_device_get_ip6_config (device);
|
||||
if (ip6_config) {
|
||||
ip6_addresses = net_device_get_ip6_addresses (ip6_config);
|
||||
ip6_route = nm_ip_config_get_gateway (ip6_config);
|
||||
ip6_dns = g_strjoinv (" ", (char **) nm_ip_config_get_nameservers (ip6_config));
|
||||
if (!*ip6_dns)
|
||||
ip6_dns = NULL;
|
||||
}
|
||||
|
||||
if (ip4_address && ip6_addresses) {
|
||||
add_details_row (details, i++, _("IPv4 Address"), ip4_address);
|
||||
gtk_widget_set_valign (details, GTK_ALIGN_START);
|
||||
add_details_row (details, i++, _("IPv6 Address"), ip6_addresses);
|
||||
gtk_widget_set_valign (details, GTK_ALIGN_START);
|
||||
} else if (ip4_address) {
|
||||
add_details_row (details, i++, _("IP Address"), ip4_address);
|
||||
} else if (ip6_addresses) {
|
||||
add_details_row (details, i++, _("IP Address"), ip6_addresses);
|
||||
}
|
||||
|
||||
add_details_row (details, i++, _("Hardware Address"), nm_device_get_hw_address (device));
|
||||
|
||||
if (ip4_route && ip6_route) {
|
||||
g_autofree gchar *ip_routes = g_strjoin ("\n", ip4_route, ip6_route, NULL);
|
||||
add_details_row (details, i++, _("Default Route"), ip_routes);
|
||||
} else if (ip4_route) {
|
||||
add_details_row (details, i++, _("Default Route"), ip4_route);
|
||||
} else if (ip6_route) {
|
||||
add_details_row (details, i++, _("Default Route"), ip6_route);
|
||||
}
|
||||
|
||||
if (ip4_dns && ip6_dns) {
|
||||
add_details_row (details, i++, _("DNS4"), ip4_dns);
|
||||
add_details_row (details, i++, _("DNS6"), ip6_dns);
|
||||
} else if (ip4_dns) {
|
||||
add_details_row (details, i++, _("DNS"), ip4_dns);
|
||||
} else if (ip6_dns) {
|
||||
add_details_row (details, i++, _("DNS"), ip6_dns);
|
||||
}
|
||||
|
||||
if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED) {
|
||||
g_autofree gchar *last_used = NULL;
|
||||
last_used = get_last_used_string (connection);
|
||||
add_details_row (details, i++, _("Last used"), last_used);
|
||||
}
|
||||
}
|
||||
|
||||
static void populate_ui (NetDeviceEthernet *self);
|
||||
|
||||
static gboolean
|
||||
@@ -203,11 +75,11 @@ device_ethernet_refresh_ui (NetDeviceEthernet *self)
|
||||
g_autofree gchar *status = NULL;
|
||||
|
||||
state = nm_device_get_state (self->device);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (self->device_off_switch),
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (self->details_row),
|
||||
state != NM_DEVICE_STATE_UNAVAILABLE
|
||||
&& state != NM_DEVICE_STATE_UNMANAGED);
|
||||
self->updating_device = TRUE;
|
||||
gtk_switch_set_active (self->device_off_switch, device_state_to_off_switch (state));
|
||||
adw_switch_row_set_active (self->details_row, device_state_to_off_switch (state));
|
||||
self->updating_device = FALSE;
|
||||
|
||||
if (state != NM_DEVICE_STATE_UNAVAILABLE) {
|
||||
@@ -262,7 +134,7 @@ details_button_clicked_cb (NetDeviceEthernet *self)
|
||||
* profile. It is also used to display ethernet in the
|
||||
* device list.
|
||||
*/
|
||||
show_details (self, self->details_button, _("Wired"));
|
||||
show_details (self, self->details_button, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -270,8 +142,6 @@ add_row (NetDeviceEthernet *self, NMConnection *connection)
|
||||
{
|
||||
GtkWidget *row;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *box;
|
||||
GtkWidget *details;
|
||||
NMActiveConnection *aconn;
|
||||
gboolean active;
|
||||
|
||||
@@ -285,50 +155,21 @@ add_row (NetDeviceEthernet *self, NMConnection *connection)
|
||||
active = g_strcmp0 (uuid1, uuid2) == 0;
|
||||
}
|
||||
|
||||
row = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_box_append (GTK_BOX (row), box);
|
||||
widget = gtk_label_new (nm_connection_get_id (connection));
|
||||
gtk_widget_set_margin_start (widget, 12);
|
||||
gtk_widget_set_margin_end (widget, 12);
|
||||
gtk_widget_set_margin_top (widget, 8);
|
||||
gtk_widget_set_margin_bottom (widget, 8);
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
|
||||
if (active) {
|
||||
widget = gtk_image_new_from_icon_name ("object-select-symbolic");
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
|
||||
details = gtk_grid_new ();
|
||||
gtk_grid_set_row_spacing (GTK_GRID (details), 10);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (details), 10);
|
||||
|
||||
gtk_box_append (GTK_BOX (row), details);
|
||||
|
||||
add_details (details, self->device, connection);
|
||||
}
|
||||
|
||||
/* filler */
|
||||
widget = gtk_label_new ("");
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
row = adw_switch_row_new ();
|
||||
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), nm_connection_get_id (connection));
|
||||
adw_action_row_set_icon_name (ADW_ACTION_ROW (row), active ? "network-wired-symbolic" : "network-wired-disconnected-symbolic");
|
||||
adw_switch_row_set_active (ADW_SWITCH_ROW (row), active);
|
||||
|
||||
widget = gtk_button_new_from_icon_name ("emblem-system-symbolic");
|
||||
gtk_widget_set_margin_start (widget, 12);
|
||||
gtk_widget_set_margin_end (widget, 12);
|
||||
gtk_widget_set_margin_top (widget, 8);
|
||||
gtk_widget_set_margin_bottom (widget, 8);
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_add_css_class (widget, "flat");
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (widget),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Options…"),
|
||||
-1);
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
g_object_set_data (G_OBJECT (widget), "edit", widget);
|
||||
g_object_set_data (G_OBJECT (widget), "row", row);
|
||||
g_signal_connect_object (widget, "clicked", G_CALLBACK (show_details_for_row), self, G_CONNECT_SWAPPED);
|
||||
adw_action_row_add_suffix (ADW_ACTION_ROW (row), widget);
|
||||
|
||||
g_object_set_data (G_OBJECT (row), "connection", connection);
|
||||
|
||||
@@ -437,7 +278,7 @@ device_off_switch_changed_cb (NetDeviceEthernet *self)
|
||||
if (self->updating_device)
|
||||
return;
|
||||
|
||||
if (gtk_switch_get_active (self->device_off_switch)) {
|
||||
if (adw_switch_row_get_active (self->details_row)) {
|
||||
connection = net_device_get_find_connection (self->client, self->device);
|
||||
if (connection != NULL) {
|
||||
nm_client_activate_connection_async (self->client,
|
||||
@@ -496,7 +337,6 @@ net_device_ethernet_class_init (NetDeviceEthernetClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_listbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, device_off_switch);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, connection_list_row_activated_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, device_off_switch_changed_cb);
|
||||
@@ -539,3 +379,15 @@ net_device_ethernet_get_device (NetDeviceEthernet *self)
|
||||
g_return_val_if_fail (NET_IS_DEVICE_ETHERNET (self), NULL);
|
||||
return self->device;
|
||||
}
|
||||
|
||||
void
|
||||
net_device_ethernet_set_title (NetDeviceEthernet *self,
|
||||
const gchar *title)
|
||||
{
|
||||
g_return_if_fail (NET_IS_DEVICE_ETHERNET (self));
|
||||
|
||||
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->details_row), title);
|
||||
if (gtk_stack_get_visible_child (self->connection_stack) == GTK_WIDGET (self->connection_list)) {
|
||||
adw_preferences_group_set_title (ADW_PREFERENCES_GROUP (self), title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,7 @@ NetDeviceEthernet *net_device_ethernet_new (NMClient *client,
|
||||
|
||||
NMDevice *net_device_ethernet_get_device (NetDeviceEthernet *device);
|
||||
|
||||
void net_device_ethernet_set_title (NetDeviceEthernet *device,
|
||||
const gchar *title);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<interface>
|
||||
<template class="NetDeviceBluetooth" parent="AdwActionRow">
|
||||
<property name="activatable_widget">device_off_switch</property>
|
||||
<property name="title" translatable="yes">Wired</property>
|
||||
<child type="suffix">
|
||||
<object class="GtkSwitch" id="device_off_switch">
|
||||
<property name="valign">center</property>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<template class="NetDeviceEthernet" parent="AdwPreferencesGroup">
|
||||
<property name="title" translatable="yes">Wired</property>
|
||||
<property name="header-suffix">
|
||||
<object class="GtkButton">
|
||||
<property name="tooltip-text" translatable="yes">Add Ethernet Connection</property>
|
||||
@@ -16,7 +15,6 @@
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkStack" id="connection_stack">
|
||||
<child>
|
||||
@@ -24,28 +22,19 @@
|
||||
<property name="selection-mode">none</property>
|
||||
<signal name="row-activated" handler="connection_list_row_activated_cb" object="NetDeviceEthernet" swapped="yes"/>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
<class name="boxed-list"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<!-- Single profile row -->
|
||||
<child>
|
||||
<object class="GtkListBox" id="details_listbox">
|
||||
<property name="selection_mode">none</property>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
<object class="AdwPreferencesGroup" id="details_listbox">
|
||||
<child>
|
||||
<object class="AdwActionRow" id="details_row">
|
||||
<property name="activatable-widget">device_off_switch</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="device_off_switch">
|
||||
<property name="valign">center</property>
|
||||
<signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceEthernet" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="details_row">
|
||||
<property name="icon-name">network-wired-symbolic</property>
|
||||
<signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceEthernet" swapped="yes"/>
|
||||
<child type="suffix">
|
||||
<object class="GtkButton" id="details_button">
|
||||
<property name="tooltip-text" translatable="yes">Network Options</property>
|
||||
<property name="valign">center</property>
|
||||
@@ -54,7 +43,7 @@
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<file preprocess="xml-stripblanks">network-ethernet.ui</file>
|
||||
|
||||
<!-- Wi-Fi panel -->
|
||||
<file preprocess="xml-stripblanks">cc-wifi-panel.ui</file>
|
||||
<file preprocess="xml-stripblanks">cc-wifi-page.ui</file>
|
||||
<file>wifi-panel.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gnome/Settings/icons/scalable/actions">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* cc-wwan-panel.c
|
||||
/* cc-wwan-page.c
|
||||
*
|
||||
* Copyright 2019,2022 Purism SPC
|
||||
*
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "cc-wwan-panel"
|
||||
#define G_LOG_DOMAIN "cc-wwan-page"
|
||||
|
||||
#include <config.h>
|
||||
#include <glib/gi18n.h>
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "cc-wwan-device.h"
|
||||
#include "cc-wwan-data.h"
|
||||
#include "cc-wwan-device-page.h"
|
||||
#include "cc-wwan-panel.h"
|
||||
#include "cc-wwan-page.h"
|
||||
#include "cc-wwan-resources.h"
|
||||
|
||||
#include "shell/cc-application.h"
|
||||
@@ -44,9 +44,9 @@ typedef enum {
|
||||
OPERATION_SHOW_DEVICE,
|
||||
} CmdlineOperation;
|
||||
|
||||
struct _CcWwanPanel
|
||||
struct _CcWwanPage
|
||||
{
|
||||
CcPanel parent_instance;
|
||||
AdwNavigationPage parent_instance;
|
||||
|
||||
AdwToastOverlay *toast_overlay;
|
||||
AdwComboRow *data_list_row;
|
||||
@@ -77,7 +77,7 @@ enum {
|
||||
PROP_PARAMETERS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CcWwanPanel, cc_wwan_panel, CC_TYPE_PANEL)
|
||||
G_DEFINE_TYPE (CcWwanPage, cc_wwan_page, ADW_TYPE_NAVIGATION_PAGE)
|
||||
|
||||
|
||||
#define CC_TYPE_DATA_DEVICE_ROW (cc_data_device_row_get_type())
|
||||
@@ -114,14 +114,14 @@ cmdline_operation_from_string (const gchar *str)
|
||||
}
|
||||
|
||||
static void
|
||||
reset_command_line_args (CcWwanPanel *self)
|
||||
reset_command_line_args (CcWwanPage *self)
|
||||
{
|
||||
self->arg_operation = OPERATION_NULL;
|
||||
g_clear_pointer (&self->arg_device, g_free);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_argv (CcWwanPanel *self,
|
||||
verify_argv (CcWwanPage *self,
|
||||
const char **args)
|
||||
{
|
||||
switch (self->arg_operation)
|
||||
@@ -138,7 +138,7 @@ verify_argv (CcWwanPanel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_argv (CcWwanPanel *self)
|
||||
handle_argv (CcWwanPage *self)
|
||||
{
|
||||
if (self->arg_operation == OPERATION_SHOW_DEVICE &&
|
||||
self->arg_operation)
|
||||
@@ -163,7 +163,7 @@ handle_argv (CcWwanPanel *self)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wwan_panel_device_is_supported (GDBusObject *object)
|
||||
wwan_page_device_is_supported (GDBusObject *object)
|
||||
{
|
||||
MMObject *mm_object;
|
||||
MMModem *modem;
|
||||
@@ -233,7 +233,7 @@ wwan_model_get_item_from_mm_object (GListModel *model,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_update_data_selection (CcWwanPanel *self)
|
||||
cc_wwan_page_update_data_selection (CcWwanPage *self)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -247,7 +247,7 @@ cc_wwan_panel_update_data_selection (CcWwanPanel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_data_item_activate_cb (CcWwanPanel *self,
|
||||
cc_wwan_data_item_activate_cb (CcWwanPage *self,
|
||||
CcWwanDevice *device)
|
||||
{
|
||||
CcWwanData *data;
|
||||
@@ -269,11 +269,11 @@ cc_wwan_data_item_activate_cb (CcWwanPanel *self,
|
||||
cc_wwan_data_save_settings (data, NULL, NULL, NULL);
|
||||
|
||||
self->data_device = device;
|
||||
cc_wwan_panel_update_data_selection (self);
|
||||
cc_wwan_page_update_data_selection (self);
|
||||
}
|
||||
|
||||
static void
|
||||
wwan_on_airplane_off_clicked_cb (CcWwanPanel *self)
|
||||
wwan_on_airplane_off_clicked_cb (CcWwanPage *self)
|
||||
{
|
||||
g_debug ("Airplane Mode Off clicked, disabling airplane mode");
|
||||
g_dbus_proxy_call (self->rfkill_proxy,
|
||||
@@ -289,12 +289,12 @@ wwan_on_airplane_off_clicked_cb (CcWwanPanel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
wwan_data_list_selected_sim_changed_cb (CcWwanPanel *self)
|
||||
wwan_data_list_selected_sim_changed_cb (CcWwanPage *self)
|
||||
{
|
||||
CcWwanDevice *device;
|
||||
GObject *selected;
|
||||
|
||||
g_assert (CC_IS_WWAN_PANEL (self));
|
||||
g_assert (CC_IS_WWAN_PAGE (self));
|
||||
|
||||
selected = adw_combo_row_get_selected_item (self->data_list_row);
|
||||
if (!selected)
|
||||
@@ -305,7 +305,7 @@ wwan_data_list_selected_sim_changed_cb (CcWwanPanel *self)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cc_wwan_panel_get_cached_dbus_property (GDBusProxy *proxy,
|
||||
cc_wwan_page_get_cached_dbus_property (GDBusProxy *proxy,
|
||||
const gchar *property)
|
||||
{
|
||||
g_autoptr(GVariant) result = NULL;
|
||||
@@ -320,17 +320,17 @@ cc_wwan_panel_get_cached_dbus_property (GDBusProxy *proxy,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_update_view (CcWwanPanel *self)
|
||||
cc_wwan_page_update_view (CcWwanPage *self)
|
||||
{
|
||||
gboolean has_airplane, is_airplane = FALSE, enabled = FALSE;
|
||||
|
||||
has_airplane = cc_wwan_panel_get_cached_dbus_property (self->rfkill_proxy, "HasAirplaneMode");
|
||||
has_airplane &= cc_wwan_panel_get_cached_dbus_property (self->rfkill_proxy, "ShouldShowAirplaneMode");
|
||||
has_airplane = cc_wwan_page_get_cached_dbus_property (self->rfkill_proxy, "HasAirplaneMode");
|
||||
has_airplane &= cc_wwan_page_get_cached_dbus_property (self->rfkill_proxy, "ShouldShowAirplaneMode");
|
||||
|
||||
if (has_airplane)
|
||||
{
|
||||
is_airplane = cc_wwan_panel_get_cached_dbus_property (self->rfkill_proxy, "AirplaneMode");
|
||||
is_airplane |= cc_wwan_panel_get_cached_dbus_property (self->rfkill_proxy, "HardwareAirplaneMode");
|
||||
is_airplane = cc_wwan_page_get_cached_dbus_property (self->rfkill_proxy, "AirplaneMode");
|
||||
is_airplane |= cc_wwan_page_get_cached_dbus_property (self->rfkill_proxy, "HardwareAirplaneMode");
|
||||
}
|
||||
|
||||
if (self->nm_client)
|
||||
@@ -351,7 +351,7 @@ cc_wwan_panel_update_view (CcWwanPanel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_add_device (CcWwanPanel *self,
|
||||
cc_wwan_page_add_device (CcWwanPage *self,
|
||||
CcWwanDevice *device)
|
||||
{
|
||||
CcWwanDevicePage *device_page;
|
||||
@@ -372,8 +372,8 @@ cc_wwan_panel_add_device (CcWwanPanel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_update_page_title (CcWwanDevicePage *device_page,
|
||||
CcWwanPanel *self)
|
||||
cc_wwan_page_update_page_title (CcWwanDevicePage *device_page,
|
||||
CcWwanPage *self)
|
||||
{
|
||||
g_autofree gchar *title = NULL;
|
||||
g_autofree gchar *name = NULL;
|
||||
@@ -400,7 +400,7 @@ cc_wwan_panel_update_page_title (CcWwanDevicePage *device_page,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_remove_mm_object (CcWwanPanel *self,
|
||||
cc_wwan_page_remove_mm_object (CcWwanPage *self,
|
||||
MMObject *mm_object)
|
||||
{
|
||||
g_autoptr(CcWwanDevice) device = NULL;
|
||||
@@ -435,11 +435,11 @@ cc_wwan_panel_remove_mm_object (CcWwanPanel *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);
|
||||
cc_wwan_page_update_page_title (CC_WWAN_DEVICE_PAGE (child), self);
|
||||
}
|
||||
|
||||
static void
|
||||
wwan_panel_add_data_device_to_list (CcWwanPanel *self,
|
||||
wwan_page_add_data_device_to_list (CcWwanPage *self,
|
||||
CcWwanDevice *device)
|
||||
{
|
||||
g_autoptr(GtkStringObject) str = NULL;
|
||||
@@ -460,7 +460,7 @@ wwan_panel_add_data_device_to_list (CcWwanPanel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_update_data_connections (CcWwanPanel *self)
|
||||
cc_wwan_page_update_data_connections (CcWwanPage *self)
|
||||
{
|
||||
CcWwanData *device_data, *active_data = NULL;
|
||||
guint n_items;
|
||||
@@ -494,15 +494,15 @@ cc_wwan_panel_update_data_connections (CcWwanPanel *self)
|
||||
}
|
||||
|
||||
if (cc_wwan_data_get_enabled (device_data))
|
||||
wwan_panel_add_data_device_to_list (self, device);
|
||||
wwan_page_add_data_device_to_list (self, device);
|
||||
}
|
||||
|
||||
if (active_data)
|
||||
cc_wwan_panel_update_data_selection (self);
|
||||
cc_wwan_page_update_data_selection (self);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_update_devices (CcWwanPanel *self)
|
||||
cc_wwan_page_update_devices (CcWwanPage *self)
|
||||
{
|
||||
GList *devices, *iter;
|
||||
|
||||
@@ -513,49 +513,49 @@ cc_wwan_panel_update_devices (CcWwanPanel *self)
|
||||
MMObject *mm_object = iter->data;
|
||||
CcWwanDevice *device;
|
||||
|
||||
if(!wwan_panel_device_is_supported (iter->data))
|
||||
if(!wwan_page_device_is_supported (iter->data))
|
||||
continue;
|
||||
|
||||
device = cc_wwan_device_new (mm_object, G_OBJECT (self->nm_client));
|
||||
cc_wwan_panel_add_device (self, device);
|
||||
cc_wwan_page_add_device (self, device);
|
||||
g_signal_connect_object (device, "notify::has-data",
|
||||
G_CALLBACK (cc_wwan_panel_update_data_connections),
|
||||
G_CALLBACK (cc_wwan_page_update_data_connections),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
|
||||
if (cc_wwan_device_get_data (device))
|
||||
wwan_panel_add_data_device_to_list (self, device);
|
||||
wwan_page_add_data_device_to_list (self, device);
|
||||
}
|
||||
|
||||
cc_wwan_panel_update_data_connections (self);
|
||||
cc_wwan_page_update_data_connections (self);
|
||||
handle_argv (self);
|
||||
}
|
||||
|
||||
static void
|
||||
wwan_panel_device_added_cb (CcWwanPanel *self,
|
||||
wwan_page_device_added_cb (CcWwanPage *self,
|
||||
GDBusObject *object)
|
||||
{
|
||||
CcWwanDevice *device;
|
||||
|
||||
if(!wwan_panel_device_is_supported (object))
|
||||
if(!wwan_page_device_is_supported (object))
|
||||
return;
|
||||
|
||||
device = cc_wwan_device_new (MM_OBJECT (object), G_OBJECT (self->nm_client));
|
||||
cc_wwan_panel_add_device (self, device);
|
||||
cc_wwan_page_add_device (self, device);
|
||||
g_signal_connect_object (device, "notify::has-data",
|
||||
G_CALLBACK (cc_wwan_panel_update_data_connections),
|
||||
G_CALLBACK (cc_wwan_page_update_data_connections),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
cc_wwan_panel_update_view (self);
|
||||
cc_wwan_page_update_view (self);
|
||||
handle_argv (self);
|
||||
}
|
||||
|
||||
static void
|
||||
wwan_panel_device_removed_cb (CcWwanPanel *self,
|
||||
wwan_page_device_removed_cb (CcWwanPage *self,
|
||||
GDBusObject *object)
|
||||
{
|
||||
if (!wwan_panel_device_is_supported (object))
|
||||
if (!wwan_page_device_is_supported (object))
|
||||
return;
|
||||
|
||||
cc_wwan_panel_remove_mm_object (self, MM_OBJECT (object));
|
||||
cc_wwan_page_remove_mm_object (self, MM_OBJECT (object));
|
||||
|
||||
gtk_revealer_set_reveal_child (self->multi_device_revealer,
|
||||
g_list_model_get_n_items (G_LIST_MODEL (self->devices)) > 1);
|
||||
@@ -583,12 +583,12 @@ variant_av_to_string_array (GVariant *array)
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_set_property (GObject *object,
|
||||
cc_wwan_page_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CcWwanPanel *self = CC_WWAN_PANEL (object);
|
||||
CcWwanPage *self = CC_WWAN_PAGE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
@@ -630,9 +630,9 @@ cc_wwan_panel_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_dispose (GObject *object)
|
||||
cc_wwan_page_dispose (GObject *object)
|
||||
{
|
||||
CcWwanPanel *self = (CcWwanPanel *)object;
|
||||
CcWwanPage *self = (CcWwanPage *)object;
|
||||
|
||||
g_cancellable_cancel (self->cancellable);
|
||||
|
||||
@@ -645,31 +645,31 @@ cc_wwan_panel_dispose (GObject *object)
|
||||
g_clear_object (&self->rfkill_proxy);
|
||||
g_clear_pointer (&self->arg_device, g_free);
|
||||
|
||||
G_OBJECT_CLASS (cc_wwan_panel_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (cc_wwan_page_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_class_init (CcWwanPanelClass *klass)
|
||||
cc_wwan_page_class_init (CcWwanPageClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = cc_wwan_panel_set_property;
|
||||
object_class->dispose = cc_wwan_panel_dispose;
|
||||
object_class->set_property = cc_wwan_page_set_property;
|
||||
object_class->dispose = cc_wwan_page_dispose;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_PARAMETERS, "parameters");
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gnome/control-center/wwan/cc-wwan-panel.ui");
|
||||
"/org/gnome/control-center/wwan/cc-wwan-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, toast_overlay);
|
||||
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);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, enable_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, main_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPanel, multi_device_revealer);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, toast_overlay);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, data_list_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, data_sim_select_listbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, devices_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, devices_switcher);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, enable_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, main_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWwanPage, multi_device_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);
|
||||
@@ -677,7 +677,7 @@ cc_wwan_panel_class_init (CcWwanPanelClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
cc_wwan_panel_init (CcWwanPanel *self)
|
||||
cc_wwan_page_init (CcWwanPage *self)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
@@ -697,7 +697,7 @@ cc_wwan_panel_init (CcWwanPanel *self)
|
||||
self->nm_client = cc_object_storage_get_object (CC_OBJECT_NMCLIENT);
|
||||
g_signal_connect_object (self->nm_client,
|
||||
"notify::wwan-enabled",
|
||||
G_CALLBACK (cc_wwan_panel_update_view),
|
||||
G_CALLBACK (cc_wwan_page_update_view),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
|
||||
}
|
||||
@@ -718,13 +718,13 @@ cc_wwan_panel_init (CcWwanPanel *self)
|
||||
self->mm_manager = cc_object_storage_get_object ("CcObjectStorage::mm-manager");
|
||||
|
||||
g_signal_connect_object (self->mm_manager, "object-added",
|
||||
G_CALLBACK (wwan_panel_device_added_cb),
|
||||
G_CALLBACK (wwan_page_device_added_cb),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (self->mm_manager, "object-removed",
|
||||
G_CALLBACK (wwan_panel_device_removed_cb),
|
||||
G_CALLBACK (wwan_page_device_removed_cb),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
|
||||
cc_wwan_panel_update_devices (self);
|
||||
cc_wwan_page_update_devices (self);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -749,88 +749,9 @@ cc_wwan_panel_init (CcWwanPanel *self)
|
||||
{
|
||||
g_signal_connect_object (self->rfkill_proxy,
|
||||
"g-properties-changed",
|
||||
G_CALLBACK (cc_wwan_panel_update_view),
|
||||
G_CALLBACK (cc_wwan_page_update_view),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
|
||||
cc_wwan_panel_update_view (self);
|
||||
cc_wwan_page_update_view (self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wwan_update_panel_visibility (MMManager *mm_manager)
|
||||
{
|
||||
CcApplication *application;
|
||||
GList *devices;
|
||||
gboolean has_wwan;
|
||||
|
||||
g_assert (MM_IS_MANAGER (mm_manager));
|
||||
|
||||
CC_TRACE_MSG ("Updating WWAN panel visibility");
|
||||
|
||||
has_wwan = FALSE;
|
||||
devices = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (mm_manager));
|
||||
|
||||
for (GList *item = devices; item != NULL; item = item->next)
|
||||
{
|
||||
if(wwan_panel_device_is_supported (item->data))
|
||||
{
|
||||
has_wwan = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the new visibility */
|
||||
application = CC_APPLICATION (g_application_get_default ());
|
||||
cc_shell_model_set_panel_visibility (cc_application_get_model (application),
|
||||
"wwan",
|
||||
has_wwan ? CC_PANEL_VISIBLE : CC_PANEL_VISIBLE_IN_SEARCH);
|
||||
|
||||
g_debug ("WWAN panel visible: %s", has_wwan ? "yes" : "no");
|
||||
|
||||
g_list_free_full (devices, (GDestroyNotify)g_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
cc_wwan_panel_static_init_func (void)
|
||||
{
|
||||
g_autoptr(GDBusConnection) system_bus = NULL;
|
||||
g_autoptr(MMManager) mm_manager = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
/*
|
||||
* There could be other modems that are only handled by rfkill,
|
||||
* and not available via ModemManager. But as this panel
|
||||
* makes use of ModemManager APIs, we only care devices
|
||||
* supported by ModemManager.
|
||||
*/
|
||||
system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (system_bus == NULL)
|
||||
g_warning ("Error connecting to system D-Bus: %s", error->message);
|
||||
else
|
||||
mm_manager = mm_manager_new_sync (system_bus,
|
||||
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
||||
NULL, &error);
|
||||
|
||||
if (mm_manager == NULL)
|
||||
{
|
||||
CcApplication *application;
|
||||
|
||||
g_warning ("Error connecting to ModemManager: %s", error->message);
|
||||
|
||||
application = CC_APPLICATION (g_application_get_default ());
|
||||
cc_shell_model_set_panel_visibility (cc_application_get_model (application),
|
||||
"wwan", FALSE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
cc_object_storage_add_object ("CcObjectStorage::mm-manager", mm_manager);
|
||||
}
|
||||
|
||||
g_debug ("Monitoring ModemManager for WWAN devices");
|
||||
|
||||
g_signal_connect (mm_manager, "object-added", G_CALLBACK (wwan_update_panel_visibility), NULL);
|
||||
g_signal_connect (mm_manager, "object-removed", G_CALLBACK (wwan_update_panel_visibility), NULL);
|
||||
|
||||
wwan_update_panel_visibility (mm_manager);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* cc-wwan-panel.h
|
||||
/* cc-wwan-page.h
|
||||
*
|
||||
* Copyright 2019 Purism SPC
|
||||
*
|
||||
@@ -24,13 +24,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <shell/cc-panel.h>
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CC_TYPE_WWAN_PANEL (cc_wwan_panel_get_type())
|
||||
G_DECLARE_FINAL_TYPE (CcWwanPanel, cc_wwan_panel, CC, WWAN_PANEL, CcPanel)
|
||||
|
||||
void cc_wwan_panel_static_init_func (void);
|
||||
#define CC_TYPE_WWAN_PAGE (cc_wwan_page_get_type())
|
||||
G_DECLARE_FINAL_TYPE (CcWwanPage, cc_wwan_page, CC, WWAN_PAGE, AdwNavigationPage)
|
||||
|
||||
G_END_DECLS
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<template class="CcWwanPanel" parent="CcPanel">
|
||||
<template class="CcWwanPage" parent="AdwNavigationPage">
|
||||
<property name="tag">wwan</property>
|
||||
<property name="child">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
@@ -1,19 +1,8 @@
|
||||
|
||||
deps = common_deps + network_manager_deps + [gcr_dep, polkit_gobject_dep]
|
||||
panels_list += cappletname
|
||||
desktop = 'gnome-@0@-panel.desktop'.format(cappletname)
|
||||
|
||||
i18n.merge_file(
|
||||
type : 'desktop',
|
||||
input : desktop + '.in',
|
||||
output : desktop,
|
||||
po_dir : po_dir,
|
||||
install : true,
|
||||
install_dir : control_center_desktopdir
|
||||
)
|
||||
|
||||
sources = files(
|
||||
'cc-wwan-panel.c',
|
||||
'cc-wwan-page.c',
|
||||
'cc-wwan-device.c',
|
||||
'cc-wwan-data.c',
|
||||
'cc-wwan-device-page.c',
|
||||
@@ -25,10 +14,10 @@ sources = files(
|
||||
)
|
||||
|
||||
sources += gnome.compile_resources(
|
||||
'cc-' + cappletname + '-resources',
|
||||
cappletname + '.gresource.xml',
|
||||
c_name : 'cc_' + cappletname,
|
||||
export : true,
|
||||
'cc-wwan-resources',
|
||||
'wwan.gresource.xml',
|
||||
c_name: 'cc_wwan',
|
||||
export: true
|
||||
)
|
||||
|
||||
cflags += '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gnome/control-center/wwan">
|
||||
<file preprocess="xml-stripblanks">cc-wwan-panel.ui</file>
|
||||
<file preprocess="xml-stripblanks">cc-wwan-page.ui</file>
|
||||
<file preprocess="xml-stripblanks">cc-wwan-device-page.ui</file>
|
||||
<file preprocess="xml-stripblanks">cc-wwan-mode-dialog.ui</file>
|
||||
<file preprocess="xml-stripblanks">cc-wwan-network-dialog.ui</file>
|
||||
@@ -351,8 +351,6 @@ static const gchar * const panel_order[] = {
|
||||
/* Main page */
|
||||
"wifi",
|
||||
"network",
|
||||
"wwan",
|
||||
"mobile-broadband",
|
||||
"bluetooth",
|
||||
|
||||
"separator",
|
||||
|
||||
@@ -44,7 +44,6 @@ extern GType cc_mouse_panel_get_type (void);
|
||||
extern GType cc_multitasking_panel_get_type (void);
|
||||
#ifdef BUILD_NETWORK
|
||||
extern GType cc_network_panel_get_type (void);
|
||||
extern GType cc_wifi_panel_get_type (void);
|
||||
#endif /* BUILD_NETWORK */
|
||||
extern GType cc_notifications_panel_get_type (void);
|
||||
extern GType cc_online_accounts_panel_get_type (void);
|
||||
@@ -59,20 +58,11 @@ extern GType cc_ua_panel_get_type (void);
|
||||
#ifdef BUILD_WACOM
|
||||
extern GType cc_wacom_panel_get_type (void);
|
||||
#endif /* BUILD_WACOM */
|
||||
#ifdef BUILD_WWAN
|
||||
extern GType cc_wwan_panel_get_type (void);
|
||||
#endif /* BUILD_WWAN */
|
||||
|
||||
/* Static init functions */
|
||||
#ifdef BUILD_NETWORK
|
||||
extern void cc_wifi_panel_static_init_func (void);
|
||||
#endif /* BUILD_NETWORK */
|
||||
#ifdef BUILD_WACOM
|
||||
extern void cc_wacom_panel_static_init_func (void);
|
||||
#endif /* BUILD_WACOM */
|
||||
#ifdef BUILD_WWAN
|
||||
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 }
|
||||
|
||||
@@ -96,7 +86,6 @@ static CcPanelLoaderVtable default_panels[] =
|
||||
PANEL_TYPE("multitasking", cc_multitasking_panel_get_type, NULL),
|
||||
#ifdef BUILD_NETWORK
|
||||
PANEL_TYPE("network", cc_network_panel_get_type, NULL),
|
||||
PANEL_TYPE("wifi", cc_wifi_panel_get_type, cc_wifi_panel_static_init_func),
|
||||
#endif
|
||||
PANEL_TYPE("notifications", cc_notifications_panel_get_type, NULL),
|
||||
PANEL_TYPE("online-accounts", cc_online_accounts_panel_get_type, NULL),
|
||||
@@ -111,9 +100,6 @@ static CcPanelLoaderVtable default_panels[] =
|
||||
#ifdef BUILD_WACOM
|
||||
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),
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Override for the panel vtable. When NULL, the default_panels will
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
/* Including ‘.c’ file to test static functions */
|
||||
#include "cc-wifi-panel.c"
|
||||
#include "cc-wifi-page.c"
|
||||
#include "cc-qr-code.c"
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user