diff options
83 files changed, 3017 insertions, 3910 deletions
diff --git a/meson.build b/meson.build index 5075eacfc..f00280e9e 100644 --- a/meson.build +++ b/meson.build @@ -210,7 +210,7 @@ if host_is_linux # network manager network_manager_deps = [ dependency('libnm', version: '>= 1.24.0'), - dependency('libnma', version: '>= 1.8.0'), + dependency('libnma-gtk4', version: '>= 1.8.0'), dependency('mm-glib', version: '>= 0.7') ] endif diff --git a/panels/meson.build b/panels/meson.build index 5382bb034..3fec950e3 100644 --- a/panels/meson.build +++ b/panels/meson.build @@ -32,7 +32,7 @@ panels = [ ] if host_is_linux -# panels += ['network'] + panels += ['network'] endif if host_is_linux_not_s390 diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c index bd4e55df8..1bf09e8a8 100644 --- a/panels/network/cc-network-panel.c +++ b/panels/network/cc-network-panel.c @@ -426,8 +426,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_widget_show (GTK_WIDGET (device_ethernet)); - gtk_container_add (GTK_CONTAINER (self->box_wired), GTK_WIDGET (device_ethernet)); + gtk_box_append (GTK_BOX (self->box_wired), 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; @@ -453,15 +452,13 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device) } device_mobile = net_device_mobile_new (self->client, device, modem_object); - gtk_widget_show (GTK_WIDGET (device_mobile)); - gtk_container_add (GTK_CONTAINER (self->box_wired), GTK_WIDGET (device_mobile)); + gtk_box_append (GTK_BOX (self->box_wired), 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; case NM_DEVICE_TYPE_BT: device_bluetooth = net_device_bluetooth_new (self->client, device); - gtk_widget_show (GTK_WIDGET (device_bluetooth)); - gtk_container_add (GTK_CONTAINER (self->box_bluetooth), GTK_WIDGET (device_bluetooth)); + gtk_box_append (GTK_BOX (self->box_bluetooth), GTK_WIDGET (device_bluetooth)); g_ptr_array_add (self->bluetooth_devices, device_bluetooth); g_hash_table_insert (self->nm_device_to_device, device, device_bluetooth); @@ -496,7 +493,7 @@ panel_remove_device (CcNetworkPanel *self, NMDevice *device) g_ptr_array_remove (self->mobile_devices, net_device); g_hash_table_remove (self->nm_device_to_device, device); - gtk_widget_destroy (net_device); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (net_device)), net_device); /* update vpn widgets */ update_vpn_section (self); @@ -614,8 +611,7 @@ panel_add_vpn_device (CcNetworkPanel *self, NMConnection *connection) } net_vpn = net_vpn_new (self->client, connection); - gtk_widget_show (GTK_WIDGET (net_vpn)); - gtk_container_add (GTK_CONTAINER (self->box_vpn), GTK_WIDGET (net_vpn)); + gtk_box_append (GTK_BOX (self->box_vpn), GTK_WIDGET (net_vpn)); /* store in the devices array */ g_ptr_array_add (self->vpns, net_vpn); @@ -657,7 +653,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_widget_destroy (GTK_WIDGET (vpn)); + gtk_box_remove (GTK_BOX (self->box_vpn), GTK_WIDGET (vpn)); update_vpn_section (self); return; } @@ -676,27 +672,25 @@ panel_check_network_manager_version (CcNetworkPanel *self) GtkWidget *label; g_autofree gchar *markup = NULL; - gtk_container_remove (GTK_CONTAINER (self), gtk_bin_get_child (GTK_BIN (self))); - box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20); gtk_box_set_homogeneous (GTK_BOX (box), TRUE); gtk_widget_set_vexpand (box, TRUE); - gtk_container_add (GTK_CONTAINER (self), box); + adw_bin_set_child (ADW_BIN (self), box); label = gtk_label_new (_("Oops, something has gone wrong. Please contact your software vendor.")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_widget_set_vexpand (label, TRUE); + gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_valign (label, GTK_ALIGN_END); - gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0); + gtk_box_append (GTK_BOX (box), label); markup = g_strdup_printf ("<small><tt>%s</tt></small>", _("NetworkManager needs to be running.")); label = gtk_label_new (NULL); + gtk_widget_set_vexpand (label, TRUE); gtk_label_set_markup (GTK_LABEL (label), markup); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_valign (label, GTK_ALIGN_START); - gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0); - - gtk_widget_show_all (box); + gtk_box_append (GTK_BOX (box), label); } else { manager_running (self); } @@ -709,17 +703,19 @@ create_connection_cb (GtkWidget *button, NetConnectionEditor *editor; editor = net_connection_editor_new (NULL, NULL, NULL, self->client); - gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); + gtk_window_set_transient_for (GTK_WINDOW (editor), + GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self)))); gtk_window_present (GTK_WINDOW (editor)); } static void -on_toplevel_map (GtkWidget *widget, - CcNetworkPanel *self) +cc_network_panel_map (GtkWidget *widget) { + GTK_WIDGET_CLASS (cc_network_panel_parent_class)->map (widget); + /* is the user compiling against a new version, but not running * the daemon? */ - panel_check_network_manager_version (self); + panel_check_network_manager_version (CC_NETWORK_PANEL (widget)); } @@ -732,6 +728,8 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass) panel_class->get_help_uri = cc_network_panel_get_help_uri; + widget_class->map = cc_network_panel_map; + object_class->get_property = cc_network_panel_get_property; object_class->set_property = cc_network_panel_set_property; object_class->dispose = cc_network_panel_dispose; @@ -754,11 +752,10 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass) static void cc_network_panel_init (CcNetworkPanel *self) { - NetProxy *proxy; - g_autoptr(GError) error = NULL; - GtkWidget *toplevel; g_autoptr(GDBusConnection) system_bus = NULL; + g_autoptr(GError) error = NULL; const GPtrArray *connections; + NetProxy *proxy; guint i; g_resources_register (cc_network_get_resource ()); @@ -773,8 +770,7 @@ cc_network_panel_init (CcNetworkPanel *self) /* add the virtual proxy device */ proxy = net_proxy_new (); - gtk_widget_show (GTK_WIDGET (proxy)); - gtk_container_add (GTK_CONTAINER (self->box_proxy), GTK_WIDGET (proxy)); + gtk_box_append (GTK_BOX (self->box_proxy), GTK_WIDGET (proxy)); /* Create and store a NMClient instance if it doesn't exist yet */ if (!cc_object_storage_has_object (CC_OBJECT_NMCLIENT)) { @@ -815,9 +811,6 @@ cc_network_panel_init (CcNetworkPanel *self) g_signal_connect_object (self->client, NM_CLIENT_CONNECTION_REMOVED, G_CALLBACK (client_connection_removed_cb), self, G_CONNECT_SWAPPED); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self)); - g_signal_connect_after (toplevel, "map", G_CALLBACK (on_toplevel_map), self); - /* Cold-plug existing connections */ connections = nm_client_get_connections (self->client); if (connections) { diff --git a/panels/network/cc-network-panel.ui b/panels/network/cc-network-panel.ui index 84735fdbf..f11044ad4 100644 --- a/panels/network/cc-network-panel.ui +++ b/panels/network/cc-network-panel.ui @@ -2,30 +2,20 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="CcNetworkPanel" parent="CcPanel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <child> <object class="GtkScrolledWindow"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hscrollbar_policy">never</property> <child> <object class="GtkViewport"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="shadow_type">none</property> <child> - <object class="HdyClamp"> - <property name="visible">True</property> + <object class="AdwClamp"> <property name="margin_top">32</property> <property name="margin_bottom">32</property> <property name="margin_start">12</property> <property name="margin_end">12</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="spacing">12</property> <property name="orientation">vertical</property> @@ -34,33 +24,25 @@ <!-- Each GtkBox below will contain GtkStacks from the NetDevices --> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="spacing">24</property> <property name="orientation">vertical</property> <child> <object class="GtkBox" id="box_wired"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">24</property> </object> </child> <child> <object class="GtkBox" id="container_bluetooth"> - <property name="can_focus">False</property> + <property name="visible">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <!-- "Other Devices" header --> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="xalign">0.0</property> <property name="label" translatable="yes">Other Devices</property> @@ -72,36 +54,22 @@ </object> </child> <child> - <object class="GtkFrame"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkBox" id="box_bluetooth"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - </object> - </child> + <object class="GtkBox" id="box_bluetooth"> + <property name="orientation">vertical</property> </object> </child> </object> </child> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <!-- VPN header --> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="xalign">0.0</property> <property name="label" translatable="yes">VPN</property> @@ -112,57 +80,42 @@ </child> <child> <object class="GtkButton"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="relief">none</property> + <property name="icon_name">list-add-symbolic</property> + <style> + <class name="flat" /> + </style> <signal name="clicked" handler="create_connection_cb" object="CcNetworkPanel" swapped="no" /> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">list-add-symbolic</property> - </object> - </child> </object> </child> </object> </child> + <child> - <object class="GtkFrame"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkBox" id="box_vpn"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> + <object class="GtkBox" id="box_vpn"> + <property name="orientation">vertical</property> - <!-- "Not set up" row --> + <!-- "Not set up" row --> + <child> + <object class="GtkListBox" id="empty_listbox"> + <property name="selection_mode">none</property> + <style> + <class name="content" /> + </style> <child> - <object class="GtkListBox" id="empty_listbox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="selection_mode">none</property> - <child> - <object class="HdyActionRow"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="activatable">False</property> - <property name="title" translatable="yes">Not set up</property> - </object> - </child> + <object class="AdwActionRow"> + <property name="activatable">False</property> + <property name="title" translatable="yes">Not set up</property> </object> </child> </object> </child> </object> </child> + </object> </child> <child> <object class="GtkBox" id="box_proxy"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> </object> </child> diff --git a/panels/network/cc-wifi-connection-list.c b/panels/network/cc-wifi-connection-list.c index ff91892c2..c97128200 100644 --- a/panels/network/cc-wifi-connection-list.c +++ b/panels/network/cc-wifi-connection-list.c @@ -20,7 +20,9 @@ struct _CcWifiConnectionList { - GtkListBox parent_instance; + AdwBin parent_instance; + + GtkListBox *listbox; guint freeze_count; gboolean updating; @@ -59,7 +61,7 @@ static void on_device_ap_removed_cb (CcWifiConnectionList *self, static void on_row_configured_cb (CcWifiConnectionList *self, CcWifiConnectionRow *row); -G_DEFINE_TYPE (CcWifiConnectionList, cc_wifi_connection_list, GTK_TYPE_LIST_BOX) +G_DEFINE_TYPE (CcWifiConnectionList, cc_wifi_connection_list, ADW_TYPE_BIN) enum { @@ -127,8 +129,7 @@ cc_wifi_connection_list_row_add (CcWifiConnectionList *self, connection, aps, self->checkable); - gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (res)); - gtk_widget_show (GTK_WIDGET (res)); + gtk_list_box_append (self->listbox, GTK_WIDGET (res)); g_signal_connect_object (res, "configure", G_CALLBACK (on_row_configured_cb), self, G_CONNECT_SWAPPED); @@ -153,7 +154,7 @@ clear_widget (CcWifiConnectionList *self) while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &row)) { g_hash_table_iter_remove (&iter); - gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (row)); + gtk_list_box_remove (self->listbox, GTK_WIDGET (row)); } /* Remove all connection rows */ @@ -164,8 +165,7 @@ clear_widget (CcWifiConnectionList *self) row = g_ptr_array_index (self->connections_row, i); g_ptr_array_index (self->connections_row, i) = NULL; - gtk_container_remove (GTK_CONTAINER (self), - GTK_WIDGET (row)); + gtk_list_box_remove (self->listbox, GTK_WIDGET (row)); } /* Reset the internal state */ @@ -404,7 +404,7 @@ on_device_ap_removed_cb (CcWifiConnectionList *self, if (self->hide_unavailable) { g_ptr_array_index (self->connections_row, i) = NULL; - gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (row)); + gtk_list_box_remove (self->listbox, GTK_WIDGET (row)); } } } @@ -425,7 +425,7 @@ on_device_ap_removed_cb (CcWifiConnectionList *self, if (cc_wifi_connection_row_remove_access_point (row, ap)) { g_hash_table_remove (self->ssid_to_row, ssid); - gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (row)); + gtk_list_box_remove (self->listbox, GTK_WIDGET (row)); } } @@ -704,6 +704,11 @@ cc_wifi_connection_list_class_init (CcWifiConnectionListClass *klass) static void cc_wifi_connection_list_init (CcWifiConnectionList *self) { + self->listbox = GTK_LIST_BOX (gtk_list_box_new ()); + gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->listbox), GTK_SELECTION_NONE); + gtk_widget_add_css_class (GTK_WIDGET (self->listbox), "content"); + adw_bin_set_child (ADW_BIN (self), GTK_WIDGET (self->listbox)); + self->hide_unavailable = TRUE; self->show_aps = TRUE; @@ -757,3 +762,11 @@ cc_wifi_connection_list_thaw (CcWifiConnectionList *self) update_connections (self); } } + +GtkListBox * +cc_wifi_connection_list_get_list_box (CcWifiConnectionList *self) +{ + g_return_val_if_fail (CC_IS_WIFI_CONNECTION_LIST (self), NULL); + + return self->listbox; +} diff --git a/panels/network/cc-wifi-connection-list.h b/panels/network/cc-wifi-connection-list.h index 67dc23d81..eeec65fd9 100644 --- a/panels/network/cc-wifi-connection-list.h +++ b/panels/network/cc-wifi-connection-list.h @@ -17,14 +17,14 @@ #pragma once -#include <gtk/gtk.h> +#include <adwaita.h> #include <NetworkManager.h> G_BEGIN_DECLS #define CC_TYPE_WIFI_CONNECTION_LIST (cc_wifi_connection_list_get_type()) -G_DECLARE_FINAL_TYPE (CcWifiConnectionList, cc_wifi_connection_list, CC, WIFI_CONNECTION_LIST, GtkListBox) +G_DECLARE_FINAL_TYPE (CcWifiConnectionList, cc_wifi_connection_list, CC, WIFI_CONNECTION_LIST, AdwBin) CcWifiConnectionList *cc_wifi_connection_list_new (NMClient *client, NMDeviceWifi *device, @@ -36,4 +36,6 @@ CcWifiConnectionList *cc_wifi_connection_list_new (NMClient *client, void cc_wifi_connection_list_freeze (CcWifiConnectionList *list); void cc_wifi_connection_list_thaw (CcWifiConnectionList *list); +GtkListBox *cc_wifi_connection_list_get_list_box (CcWifiConnectionList *self); + G_END_DECLS diff --git a/panels/network/cc-wifi-connection-row.c b/panels/network/cc-wifi-connection-row.c index d1ded0fc9..30011c1cc 100644 --- a/panels/network/cc-wifi-connection-row.c +++ b/panels/network/cc-wifi-connection-row.c @@ -21,7 +21,7 @@ struct _CcWifiConnectionRow { - GtkListBoxRow parent_instance; + AdwActionRow parent_instance; gboolean constructed; @@ -36,7 +36,6 @@ struct _CcWifiConnectionRow GtkCheckButton *checkbutton; GtkSpinner *connecting_spinner; GtkImage *encrypted_icon; - GtkLabel *name_label; GtkImage *strength_icon; }; @@ -62,7 +61,7 @@ typedef enum NM_AP_SEC_OWE } NMAccessPointSecurity; -G_DEFINE_TYPE (CcWifiConnectionRow, cc_wifi_connection_row, GTK_TYPE_LIST_BOX_ROW) +G_DEFINE_TYPE (CcWifiConnectionRow, cc_wifi_connection_row, ADW_TYPE_ACTION_ROW) static GParamSpec *props[PROP_LAST]; @@ -208,13 +207,13 @@ update_ui (CcWifiConnectionRow *self) name, ssid_str); } - gtk_label_set_markup (self->name_label, title); + adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), title); } else { ssid = nm_access_point_get_ssid (best_ap); title = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); - gtk_label_set_text (self->name_label, title); + adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), title); } if (active_connection) @@ -321,20 +320,7 @@ cc_wifi_connection_row_constructed (GObject *object) G_OBJECT_CLASS (cc_wifi_connection_row_parent_class)->constructed (object); /* Reparent the label into the checkbox */ - if (self->checkable) - { - gtk_widget_set_visible (GTK_WIDGET (self->checkbutton), TRUE); - g_object_ref (self->name_label); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (GTK_WIDGET (self->name_label))), - GTK_WIDGET (self->name_label)); - gtk_container_add (GTK_CONTAINER (self->checkbutton), GTK_WIDGET (self->name_label)); - gtk_widget_show (GTK_WIDGET (self->name_label)); - g_object_unref (self->name_label); - } - else - { - gtk_widget_set_visible (GTK_WIDGET (self->checkbutton), FALSE); - } + gtk_widget_set_visible (GTK_WIDGET (self->checkbutton), self->checkable); update_ui (CC_WIFI_CONNECTION_ROW (object)); } @@ -456,7 +442,6 @@ cc_wifi_connection_row_class_init (CcWifiConnectionRowClass *klass) gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, checkbutton); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, connecting_spinner); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, encrypted_icon); - gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, name_label); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, strength_icon); gtk_widget_class_bind_template_callback (widget_class, configure_clicked_cb); diff --git a/panels/network/cc-wifi-connection-row.h b/panels/network/cc-wifi-connection-row.h index 4be230523..d632cbf20 100644 --- a/panels/network/cc-wifi-connection-row.h +++ b/panels/network/cc-wifi-connection-row.h @@ -17,7 +17,7 @@ #pragma once -#include <gtk/gtk.h> +#include <adwaita.h> #include <NetworkManager.h> G_BEGIN_DECLS @@ -25,7 +25,7 @@ G_BEGIN_DECLS typedef struct _CcWifiConnectionRow CcWifiConnectionRow; #define CC_TYPE_WIFI_CONNECTION_ROW (cc_wifi_connection_row_get_type ()) -G_DECLARE_FINAL_TYPE (CcWifiConnectionRow, cc_wifi_connection_row, CC, WIFI_CONNECTION_ROW, GtkListBoxRow) +G_DECLARE_FINAL_TYPE (CcWifiConnectionRow, cc_wifi_connection_row, CC, WIFI_CONNECTION_ROW, AdwActionRow) CcWifiConnectionRow *cc_wifi_connection_row_new (NMDeviceWifi *device, NMConnection *connection, diff --git a/panels/network/cc-wifi-connection-row.ui b/panels/network/cc-wifi-connection-row.ui index 39bb6db8b..6d4e618f8 100644 --- a/panels/network/cc-wifi-connection-row.ui +++ b/panels/network/cc-wifi-connection-row.ui @@ -2,68 +2,41 @@ <!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.20"/> - <template class="CcWifiConnectionRow" parent="GtkListBoxRow"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <child> + <template class="CcWifiConnectionRow" parent="AdwActionRow"> + <property name="activatable">True</property> + <child type="prefix"> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_start">12</property> - <property name="margin_end">12</property> - <property name="hexpand">True</property> - <property name="spacing">6</property> + <property name="valign">center</property> + <property name="margin_end">6</property> <child> <object class="GtkCheckButton" id="checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="halign">start</property> <property name="valign">center</property> - <property name="draw_indicator">True</property> - <child> - <placeholder/> - </child> + <property name="margin_end">6</property> </object> </child> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="valign">center</property> - <property name="margin_right">6</property> - <child> - <object class="GtkImage" id="strength_icon"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">network-wireless-signal-excellent-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <child> - <object class="GtkImage" id="encrypted_icon"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">end</property> - </object> - </child> + <object class="GtkImage" id="strength_icon"> + <property name="icon_name">network-wireless-signal-excellent-symbolic</property> + <property name="icon_size">1</property> </object> </child> <child> - <object class="GtkLabel" id="name_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="hexpand">True</property> - <property name="margin_top">12</property> - <property name="margin_bottom">12</property> - <property name="label" translatable="no">Connection/SSID</property> - <property name="ellipsize">end</property> + <object class="GtkImage" id="encrypted_icon"> + <property name="valign">end</property> + <property name="pixel-size">8</property> </object> </child> + </object> + </child> + + <child type="suffix"> + <object class="GtkBox"> + <property name="valign">center</property> + <property name="margin_start">6</property> + <property name="spacing">6</property> <child> <object class="GtkLabel" id="active_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_end">6</property> <property name="label" translatable="yes">Connected</property> <style> @@ -74,8 +47,6 @@ <child> <object class="GtkSpinner" id="connecting_spinner"> <property name="name">connecting_spinner</property> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> </object> @@ -83,31 +54,17 @@ <child> <object class="GtkButton"> <property name="name">options_button</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="icon_name">emblem-system-symbolic</property> <property name="halign">center</property> <property name="valign">center</property> <signal name="clicked" handler="configure_clicked_cb" object="CcWifiConnectionRow" swapped="yes"/> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">emblem-system-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="AtkObject::accessible-name" translatable="yes">Options…</property> - </object> - </child> - <style> - <class name="image-button"/> - </style> + <accessibility> + <property name="label" translatable="yes">Options…</property> + </accessibility> </object> </child> </object> </child> + </template> </interface> diff --git a/panels/network/cc-wifi-hotspot-dialog.c b/panels/network/cc-wifi-hotspot-dialog.c index 57f6d52a4..0610e2458 100644 --- a/panels/network/cc-wifi-hotspot-dialog.c +++ b/panels/network/cc-wifi-hotspot-dialog.c @@ -29,7 +29,6 @@ #include <glib/gi18n.h> #include <libmm-glib.h> -#include "list-box-helper.h" #include "cc-wifi-hotspot-dialog.h" #include "cc-network-resources.h" #include "ui-helpers.h" @@ -40,7 +39,7 @@ struct _CcWifiHotspotDialog { - GtkMessageDialog parent_instance; + GtkDialog parent_instance; GtkLabel *connection_label; GtkEntry *name_entry; @@ -56,7 +55,7 @@ struct _CcWifiHotspotDialog gboolean wpa_supported; /* WPA/WPA2 supported */ }; -G_DEFINE_TYPE (CcWifiHotspotDialog, cc_wifi_hotspot_dialog, GTK_TYPE_MESSAGE_DIALOG) +G_DEFINE_TYPE (CcWifiHotspotDialog, cc_wifi_hotspot_dialog, GTK_TYPE_DIALOG) static gchar * get_random_wpa_key (void) @@ -173,7 +172,7 @@ get_secrets_cb (GObject *source_object, key = nm_setting_wireless_security_get_wep_key (security_setting, 0); if (key) - gtk_entry_set_text (self->password_entry, key); + gtk_editable_set_text (GTK_EDITABLE (self->password_entry), key); nm_connection_clear_secrets (self->connection); } @@ -187,8 +186,8 @@ wifi_hotspot_dialog_update_entries (CcWifiHotspotDialog *self) g_assert (CC_IS_WIFI_HOTSPOT_DIALOG (self)); - gtk_entry_set_text (self->name_entry, ""); - gtk_entry_set_text (self->password_entry, ""); + gtk_editable_set_text (GTK_EDITABLE (self->name_entry), ""); + gtk_editable_set_text (GTK_EDITABLE (self->password_entry), ""); if (!self->connection) return; @@ -202,7 +201,7 @@ wifi_hotspot_dialog_update_entries (CcWifiHotspotDialog *self) ssid_text = g_strdup (self->host_name); if (ssid_text) - gtk_entry_set_text (self->name_entry, ssid_text); + gtk_editable_set_text (GTK_EDITABLE (self->name_entry), ssid_text); if (!NM_IS_REMOTE_CONNECTION (self->connection)) return; @@ -242,8 +241,8 @@ hotspot_entry_changed_cb (CcWifiHotspotDialog *self) g_assert (CC_IS_WIFI_HOTSPOT_DIALOG (self)); valid_ssid = valid_password = FALSE; - ssid = gtk_entry_get_text (self->name_entry); - password = gtk_entry_get_text (self->password_entry); + ssid = gtk_editable_get_text (GTK_EDITABLE (self->name_entry)); + password = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); if (ssid && *ssid) { @@ -293,7 +292,7 @@ generate_password_clicked_cb (CcWifiHotspotDialog *self) else key = get_random_wep_key (); - gtk_entry_set_text (self->password_entry, key); + gtk_editable_set_text (GTK_EDITABLE (self->password_entry), key); } static void @@ -317,7 +316,7 @@ hotspot_update_wireless_settings (CcWifiHotspotDialog *self) else g_object_set (setting, "mode", "adhoc", NULL); - ssid_text = gtk_entry_get_text (self->name_entry); + ssid_text = gtk_editable_get_text (GTK_EDITABLE (self->name_entry)); ssid = g_bytes_new (ssid_text, strlen (ssid_text)); g_object_set (setting, "ssid", ssid, NULL); } @@ -337,7 +336,7 @@ hotspot_update_wireless_security_settings (CcWifiHotspotDialog *self) nm_setting_wireless_security_clear_protos (setting); nm_setting_wireless_security_clear_pairwise (setting); nm_setting_wireless_security_clear_groups (setting); - value = gtk_entry_get_text (self->password_entry); + value = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); if (self->wpa_supported) key_type = "psk"; @@ -412,7 +411,7 @@ cc_wifi_hotspot_dialog_show (GtkWidget *widget) if (!self->connection) if (self->host_name) - gtk_entry_set_text (self->name_entry, self->host_name); + gtk_editable_set_text (GTK_EDITABLE (self->name_entry), self->host_name); GTK_WIDGET_CLASS (cc_wifi_hotspot_dialog_parent_class)->show (widget); } @@ -480,14 +479,9 @@ cc_wifi_hotspot_dialog_class_init (CcWifiHotspotDialogClass *klass) static void cc_wifi_hotspot_dialog_init (CcWifiHotspotDialog *self) { - g_autofree gchar *title = NULL; - self->cancellable = g_cancellable_new (); gtk_widget_init_template (GTK_WIDGET (self)); - - title = g_strdup_printf ("<big><b>%s</b></big>", _("Turn On Wi-Fi Hotspot?")); - gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (self), title); } CcWifiHotspotDialog * @@ -496,8 +490,8 @@ cc_wifi_hotspot_dialog_new (GtkWindow *parent_window) g_return_val_if_fail (GTK_IS_WINDOW (parent_window), NULL); return g_object_new (CC_TYPE_WIFI_HOTSPOT_DIALOG, + "use-header-bar", TRUE, "transient-for", parent_window, - "message-type", GTK_MESSAGE_OTHER, NULL); } diff --git a/panels/network/cc-wifi-hotspot-dialog.h b/panels/network/cc-wifi-hotspot-dialog.h index 585d7f1d0..29a326dfa 100644 --- a/panels/network/cc-wifi-hotspot-dialog.h +++ b/panels/network/cc-wifi-hotspot-dialog.h @@ -30,7 +30,7 @@ G_BEGIN_DECLS #define CC_TYPE_WIFI_HOTSPOT_DIALOG (cc_wifi_hotspot_dialog_get_type()) -G_DECLARE_FINAL_TYPE (CcWifiHotspotDialog, cc_wifi_hotspot_dialog, CC, WIFI_HOTSPOT_DIALOG, GtkMessageDialog) +G_DECLARE_FINAL_TYPE (CcWifiHotspotDialog, cc_wifi_hotspot_dialog, CC, WIFI_HOTSPOT_DIALOG, GtkDialog) CcWifiHotspotDialog *cc_wifi_hotspot_dialog_new (GtkWindow *parent_window); void cc_wifi_hotspot_dialog_set_hostname (CcWifiHotspotDialog *self, diff --git a/panels/network/cc-wifi-hotspot-dialog.ui b/panels/network/cc-wifi-hotspot-dialog.ui index 619e051c1..6552650a1 100644 --- a/panels/network/cc-wifi-hotspot-dialog.ui +++ b/panels/network/cc-wifi-hotspot-dialog.ui @@ -1,19 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> - <template class="CcWifiHotspotDialog" parent="GtkMessageDialog"> + <template class="CcWifiHotspotDialog" parent="GtkDialog"> + <property name="title" translatable="yes">Turn On Wi-Fi Hotspot?</property> <property name="modal">1</property> <property name="destroy-with-parent">1</property> - <property name="message-type">other</property> - <signal name="delete-event" handler="gtk_widget_hide_on_delete"/> + <property name="hide-on-close">True</property> - <child internal-child="message_area"> + <child internal-child="headerbar"> + <object class="GtkHeaderBar"> + <property name="show-title-buttons">0</property> + </object> + </child> + + <child internal-child="content_area"> <object class="GtkBox"> - <property name="visible">1</property> - <property name="margin-top">0</property> + <property name="orientation">vertical</property> + <property name="margin-top">30</property> + <property name="margin-bottom">30</property> + <property name="margin-start">30</property> + <property name="margin-end">30</property> + <property name="spacing">20</property> <child> <object class="GtkLabel" id="label"> - <property name="visible">1</property> <property name="wrap">1</property> <property name="max-width-chars">50</property> <property name="label" translatable="yes">Wi-Fi hotspot allows others to share your internet connection, by creating a Wi-Fi network that they can connect to. To do this, you must have an internet connection through a source other than Wi-Fi.</property> @@ -23,7 +32,6 @@ <child> <object class="GtkLabel" id="connection_label"> - <property name="visible">1</property> <property name="margin-bottom">18</property> <property name="wrap">1</property> <property name="max-width-chars">40</property> @@ -34,7 +42,6 @@ <child> <object class="GtkGrid"> - <property name="visible">1</property> <property name="row-spacing">6</property> <property name="column-spacing">12</property> @@ -43,24 +50,22 @@ <object class="GtkLabel"> <property name="label" translatable="yes">Network Name</property> <property name="halign">end</property> - <property name="visible">1</property> + <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> <property name="max-length">64</property> <signal name="changed" handler="hotspot_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> <!-- Hotspot Password --> @@ -68,34 +73,35 @@ <object class="GtkLabel"> <property name="label" translatable="yes">Password</property> <property name="halign">end</property> - <property name="visible">1</property> + <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="password_entry"> - <property name="visible">1</property> <property name="max-length">64</property> <property name="secondary-icon-name">view-refresh-symbolic</property> <property name="secondary-icon-tooltip-text" translatable="yes">Generate Random Password</property> <property name="placeholder-text" translatable="yes">Autogenerate Password</property> <signal name="icon-press" handler="generate_password_clicked_cb" swapped="yes" /> <signal name="changed" handler="hotspot_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> <!-- Error Label --> <child> <object class="GtkLabel" id="error_label"> <property name="halign">start</property> - <property name="visible">1</property> + <layout> + <property name="column">1</property> + <property name="row">2</property> + </layout> <style> <class name="dim-label" /> </style> @@ -103,10 +109,6 @@ <attribute name="scale" value="0.83"/> </attributes> </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">2</property> - </packing> </child> </object> @@ -117,15 +119,12 @@ <child type="action"> <object class="GtkButton" id="cancel_button"> - <property name="visible">1</property> <property name="use-underline">1</property> <property name="label" translatable="yes">_Cancel</property> </object> </child> <child type="action"> <object class="GtkButton" id="ok_button"> - <property name="visible">1</property> - <property name="can-default">1</property> <property name="use-underline">1</property> <property name="label" translatable="yes">_Turn On</property> </object> diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c index 9ca6e6ee5..1501803a8 100644 --- a/panels/network/cc-wifi-panel.c +++ b/panels/network/cc-wifi-panel.c @@ -355,12 +355,17 @@ wifi_panel_update_qr_image_cb (CcWifiPanel *self) str = get_qr_string_for_hotspot (self->client, hotspot); if (cc_qr_code_set_text (self->qr_code, str)) { + g_autoptr(GdkPixbuf) pixbuf = NULL; cairo_surface_t *surface; gint scale; scale = gtk_widget_get_scale_factor (GTK_WIDGET (self->wifi_qr_image)); surface = cc_qr_code_get_surface (self->qr_code, QR_IMAGE_SIZE, scale); - gtk_image_set_from_surface (self->wifi_qr_image, surface); + pixbuf = gdk_pixbuf_get_from_surface (surface, + 0, 0, + QR_IMAGE_SIZE, + QR_IMAGE_SIZE); + gtk_image_set_from_pixbuf (self->wifi_qr_image, pixbuf); } } @@ -426,10 +431,10 @@ remove_wifi_device (CcWifiPanel *self, /* Destroy all stack pages related to this device */ child = gtk_stack_get_child_by_name (self->stack, id); - gtk_widget_destroy (child); + gtk_stack_remove (self->stack, child); child = gtk_stack_get_child_by_name (self->header_stack, id); - gtk_widget_destroy (child); + gtk_stack_remove (self->header_stack, child); /* Update the title widget */ update_devices_names (self); @@ -565,7 +570,7 @@ update_devices_names (CcWifiPanel *self) if (single_page_widget) { g_object_ref (single_page_widget); - gtk_container_remove (GTK_CONTAINER (self->center_stack), single_page_widget); + gtk_stack_remove (self->center_stack, single_page_widget); g_object_unref (single_page_widget); } @@ -840,7 +845,7 @@ on_stack_visible_child_changed_cb (GtkStack *stack, self->spinner_binding = g_object_bind_property (net_device, "scanning", self->spinner, - "active", + "spinning", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); break; } @@ -848,16 +853,31 @@ on_stack_visible_child_changed_cb (GtkStack *stack, } static void +on_stop_hotspot_dialog_response_cb (GtkDialog *dialog, + gint response, + CcWifiPanel *self) +{ + if (response == GTK_RESPONSE_OK) + { + NetDeviceWifi *child; + + child = NET_DEVICE_WIFI (gtk_stack_get_visible_child (self->stack)); + net_device_wifi_turn_off_hotspot (child); + } + + gtk_window_destroy (GTK_WINDOW (dialog)); +} + +static void hotspot_stop_clicked_cb (CcWifiPanel *self) { GtkWidget *dialog; - GtkWidget *window; - int response; + GtkNative *native; g_assert (CC_IS_WIFI_PANEL (self)); - window = gtk_widget_get_toplevel (GTK_WIDGET (self)); - dialog = gtk_message_dialog_new (GTK_WINDOW (window), + native = gtk_widget_get_native (GTK_WIDGET (self)); + dialog = gtk_message_dialog_new (GTK_WINDOW (native), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE, @@ -867,17 +887,9 @@ hotspot_stop_clicked_cb (CcWifiPanel *self) _("_Stop Hotspot"), GTK_RESPONSE_OK, NULL); - response = gtk_dialog_run (GTK_DIALOG (dialog)); - - if (response == GTK_RESPONSE_OK) - { - NetDeviceWifi *child; - - child = NET_DEVICE_WIFI (gtk_stack_get_visible_child (self->stack)); - net_device_wifi_turn_off_hotspot (child); - } + g_signal_connect (dialog, "response", G_CALLBACK (on_stop_hotspot_dialog_response_cb), self); + gtk_window_present (GTK_WINDOW (dialog)); - gtk_widget_destroy (dialog); } /* Overrides */ diff --git a/panels/network/cc-wifi-panel.ui b/panels/network/cc-wifi-panel.ui index 2ac7570f9..dfd12a8ac 100644 --- a/panels/network/cc-wifi-panel.ui +++ b/panels/network/cc-wifi-panel.ui @@ -2,17 +2,12 @@ <interface> <requires lib="gtk+" version="3.20"/> <template class="CcWifiPanel" parent="CcPanel"> - <property name="visible">True</property> - <property name="can-focus">False</property> <child> <object class="GtkScrolledWindow"> - <property name="visible">True</property> - <property name="can-focus">False</property> <property name="hscrollbar-policy">never</property> <child> - <object class="HdyClamp"> - <property name="visible">True</property> + <object class="AdwClamp"> <property name="margin_top">32</property> <property name="margin_bottom">32</property> <property name="margin_start">12</property> @@ -20,14 +15,12 @@ <child> <object class="GtkBox"> - <property name="visible">True</property> <property name="hexpand">True</property> <property name="orientation">vertical</property> <!-- Airplane Mode --> <child> <object class="GtkListBox" id="rfkill_widget"> - <property name="visible">True</property> <property name="margin_bottom">32</property> <property name="selection-mode">none</property> <style> @@ -35,7 +28,6 @@ </style> <child> <object class="CcListRow" id="rfkill_row"> - <property name="visible">True</property> <property name="margin-start">6</property> <property name="margin-end">6</property> <property name="margin-top">6</property> @@ -53,271 +45,233 @@ <child> <object class="GtkStack" id="main_stack"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="homogeneous">False</property> + <property name="hhomogeneous">False</property> + <property name="vhomogeneous">False</property> <property name="transition_type">crossfade</property> <!-- "No Wi-Fi Adapter" page --> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="expand">True</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">network-wireless-no-route-symbolic</property> - <property name="pixel_size">256</property> - <property name="margin-bottom">18</property> - <style> - <class name="dim-label" /> - </style> - </object> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</property> - <property name="label" translatable="yes">No Wi-Fi 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">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</property> - <property name="label" translatable="yes">Make sure you have a Wi-Fi adapter plugged and turned on</property> - </object> - </child> - </object> - <packing> + <object class="GtkStackPage"> <property name="name">no-wifi-devices</property> - </packing> - </child> - - <!-- "Airplane Mode" page --> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="expand">True</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">airplane-mode-symbolic</property> - <property name="pixel_size">256</property> - <property name="margin-bottom">18</property> - <style> - <class name="dim-label" /> - </style> - </object> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</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">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</property> - <property name="label" translatable="yes">Turn off to use Wi-Fi</property> - </object> - </child> - </object> - <packing> - <property name="name">airplane-mode</property> - </packing> - </child> - - <!-- Wi-Fi connections and devices --> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="orientation">vertical</property> - - <child> - <object class="GtkBox" id="hotspot_box"> - <property name="visible">True</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> - - <!-- Hotspot QR code --> <child> - <object class="GtkImage" id="wifi_qr_image"> - <property name="visible">True</property> - <property name="halign">center</property> - <property name="width-request">180</property> - <property name="height-request">180</property> + <object class="GtkImage"> + <property name="icon_name">network-wireless-no-route-symbolic</property> + <property name="pixel_size">256</property> + <property name="margin-bottom">18</property> <style> - <class name="frame"/> + <class name="dim-label" /> </style> </object> </child> - <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="margin-top">12</property> - <property name="label" translatable="yes">Wi-Fi Hotspot Active</property> + <property name="wrap">True</property> + <property name="label" translatable="yes">No Wi-Fi Adapter Found</property> <attributes> <attribute name="weight" value="bold" /> - <attribute name="scale" value="1.8" /> + <attribute name="scale" value="1.2" /> </attributes> </object> </child> - <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">Mobile devices can scan the QR code to connect.</property> + <property name="wrap">True</property> + <property name="label" translatable="yes">Make sure you have a Wi-Fi adapter plugged and turned on</property> </object> </child> + </object> + </property> + </object> + </child> + <!-- "Airplane Mode" page --> + <child> + <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="halign">center</property> + <property name="valign">center</property> + <property name="orientation">vertical</property> <child> - <object class="GtkButton"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="halign">center</property> - <property name="margin-top">12</property> - <property name="label" translatable="yes">Turn Off Hotspot…</property> - <signal name="clicked" handler="hotspot_stop_clicked_cb" swapped="yes"/> + <object class="GtkImage"> + <property name="icon_name">airplane-mode-symbolic</property> + <property name="pixel_size">256</property> + <property name="margin-bottom">18</property> <style> - <class name="destructive-action"/> + <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 name="scale" value="1.2" /> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="wrap">True</property> + <property name="label" translatable="yes">Turn off to use Wi-Fi</property> + </object> + </child> </object> - </child> + </property> + </object> + </child> - <!-- Visible Networks label & spinner --> - <child> + <!-- Wi-Fi connections and devices --> + <child> + <object class="GtkStackPage"> + <property name="name">wifi-connections</property> + <property name="child"> <object class="GtkBox"> - <property name="visible">True</property> - <property name="hexpand">True</property> - <property name="halign">start</property> - <property name="spacing">6</property> - <property name="margin_bottom">12</property> + <property name="orientation">vertical</property> + <child> - <object class="GtkLabel" id="list_label"> - <property name="visible">True</property> - <property name="label" translatable="yes">Visible Networks</property> - <property name="xalign">0.0</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> + <object class="GtkBox" id="hotspot_box"> + <property name="orientation">vertical</property> + + <!-- Hotspot QR code --> + <child> + <object class="GtkImage" id="wifi_qr_image"> + <property name="halign">center</property> + <property name="width-request">180</property> + <property name="height-request">180</property> + <style> + <class name="frame"/> + </style> + </object> + </child> + + <child> + <object class="GtkLabel"> + <property name="margin-top">12</property> + <property name="label" translatable="yes">Wi-Fi Hotspot Active</property> + <attributes> + <attribute name="weight" value="bold" /> + <attribute name="scale" value="1.8" /> + </attributes> + </object> + </child> + + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">Mobile devices can scan the QR code to connect.</property> + </object> + </child> + + <child> + <object class="GtkButton"> + <property name="halign">center</property> + <property name="margin-top">12</property> + <property name="label" translatable="yes">Turn Off Hotspot…</property> + <signal name="clicked" handler="hotspot_stop_clicked_cb" swapped="yes"/> + <style> + <class name="destructive-action"/> + </style> + </object> + </child> + </object> </child> + + <!-- Visible Networks label & spinner --> <child> - <object class="GtkSpinner" id="spinner"> - <property name="visible">True</property> + <object class="GtkBox"> <property name="hexpand">True</property> + <property name="halign">start</property> + <property name="spacing">6</property> + <property name="margin_bottom">12</property> + <child> + <object class="GtkLabel" id="list_label"> + <property name="label" translatable="yes">Visible Networks</property> + <property name="xalign">0.0</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + <child> + <object class="GtkSpinner" id="spinner"> + <property name="hexpand">True</property> + </object> + </child> </object> </child> - </object> - </child> - <!-- Stack with a listbox for each Wi-Fi device --> - <child> - <object class="GtkFrame"> - <property name="visible">True</property> - <property name="valign">start</property> - <style> - <class name="view" /> - </style> + <!-- Stack with a listbox for each Wi-Fi device --> <child> <object class="GtkStack" id="stack"> - <property name="visible">True</property> <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="no" /> </object> </child> - </object> - </child> + </object> + </property> </object> - <packing> - <property name="name">wifi-connections</property> - </packing> </child> <!-- "NetworkManager Not Running" page --> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="expand">True</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="orientation">vertical</property> - <property name="margin">18</property> - <property name="spacing">18</property> - <child type="center"> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">face-sad-symbolic</property> - <property name="pixel_size">128</property> - <style> - <class name="dim-label" /> - </style> - </object> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</property> - <property name="label" translatable="yes">NetworkManager needs to be running</property> - </object> - <packing> - <property name="pack-type">end</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</property> - <property name="label" translatable="yes">Oops, something has gone wrong. Please contact your software vendor.</property> - <attributes> - <attribute name="scale" value="1.42" /> - </attributes> + <object class="GtkStackPage"> + <property name="name">nm-not-running</property> + <property name="child"> + <object class="GtkCenterBox"> + <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-top">18</property> + <property name="margin-bottom">18</property> + <property name="margin-start">18</property> + <property name="margin-end">18</property> + <child type="center"> + <object class="GtkImage"> + <property name="icon_name">face-sad-symbolic</property> + <property name="pixel_size">128</property> + <style> + <class name="dim-label" /> + </style> + </object> + </child> + <child type="end"> + <object class="GtkLabel"> + <property name="wrap">True</property> + <property name="label" translatable="yes">NetworkManager needs to be running</property> + </object> + </child> + <child type="end"> + <object class="GtkLabel"> + <property name="wrap">True</property> + <property name="label" translatable="yes">Oops, something has gone wrong. Please contact your software vendor.</property> + <attributes> + <attribute name="scale" value="1.42" /> + </attributes> + </object> + </child> </object> - <packing> - <property name="pack-type">end</property> - </packing> - </child> + </property> </object> - <packing> - <property name="name">nm-not-running</property> - </packing> </child> + </object> </child> @@ -333,26 +287,22 @@ <!-- End Stack --> <object class="GtkStack" id="header_stack"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="halign">end</property> </object> <!-- Center Widget --> <object class="GtkStack" id="center_stack"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="halign">center</property> <property name="hhomogeneous">False</property> <child> - <object class="GtkStackSwitcher"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stack">stack</property> - </object> - <packing> + <object class="GtkStackPage"> <property name="name">many</property> - </packing> + <property name="child"> + <object class="GtkStackSwitcher"> + <property name="stack">stack</property> + </object> + </property> + </object> </child> </object> </interface> diff --git a/panels/network/connection-editor/8021x-security-page.ui b/panels/network/connection-editor/8021x-security-page.ui index cde5d85ee..5be96b357 100644 --- a/panels/network/connection-editor/8021x-security-page.ui +++ b/panels/network/connection-editor/8021x-security-page.ui @@ -2,8 +2,6 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="CEPage8021xSecurity" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_start">50</property> <property name="margin_end">50</property> <property name="margin_top">12</property> @@ -14,49 +12,34 @@ <property name="column_spacing">6</property> <child> <object class="GtkLabel" id="security_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">802.1x _Security</property> <property name="use_underline">True</property> <property name="mnemonic_widget">enable_8021x_switch</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkSwitch" id="enable_8021x_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="halign">start</property> <property name="hexpand">True</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkBox" id="box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> + <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> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/connection-editor/ce-ip-address-entry.c b/panels/network/connection-editor/ce-ip-address-entry.c index 7bbcd6edd..586ea5d14 100644 --- a/panels/network/connection-editor/ce-ip-address-entry.c +++ b/panels/network/connection-editor/ce-ip-address-entry.c @@ -83,7 +83,7 @@ ce_ip_address_entry_is_empty (CEIPAddressEntry *self) g_return_val_if_fail (CE_IS_IP_ADDRESS_ENTRY (self), FALSE); - text = gtk_entry_get_text (GTK_ENTRY (self)); + text = gtk_editable_get_text (GTK_EDITABLE (self)); return text[0] == '\0'; } @@ -94,6 +94,6 @@ ce_ip_address_entry_is_valid (CEIPAddressEntry *self) g_return_val_if_fail (CE_IS_IP_ADDRESS_ENTRY (self), FALSE); - text = gtk_entry_get_text (GTK_ENTRY (self)); + text = gtk_editable_get_text (GTK_EDITABLE (self)); return text[0] == '\0' || nm_utils_ipaddr_valid (self->family, text); } diff --git a/panels/network/connection-editor/ce-netmask-entry.c b/panels/network/connection-editor/ce-netmask-entry.c index 9df5547d2..2fccf0fa4 100644 --- a/panels/network/connection-editor/ce-netmask-entry.c +++ b/panels/network/connection-editor/ce-netmask-entry.c @@ -107,7 +107,7 @@ ce_netmask_entry_is_empty (CENetmaskEntry *self) g_return_val_if_fail (CE_IS_NETMASK_ENTRY (self), FALSE); - text = gtk_entry_get_text (GTK_ENTRY (self)); + text = gtk_editable_get_text (GTK_EDITABLE (self)); return text[0] == '\0'; } @@ -118,7 +118,7 @@ ce_netmask_entry_is_valid (CENetmaskEntry *self) g_return_val_if_fail (CE_IS_NETMASK_ENTRY (self), FALSE); - text = gtk_entry_get_text (GTK_ENTRY (self)); + text = gtk_editable_get_text (GTK_EDITABLE (self)); return text[0] == '\0' || parse_netmask (text, NULL); } @@ -130,7 +130,7 @@ ce_netmask_entry_get_prefix (CENetmaskEntry *self) g_return_val_if_fail (CE_IS_NETMASK_ENTRY (self), 0); - text = gtk_entry_get_text (GTK_ENTRY (self)); + text = gtk_editable_get_text (GTK_EDITABLE (self)); parse_netmask (text, &prefix); return prefix; diff --git a/panels/network/connection-editor/ce-page-8021x-security.c b/panels/network/connection-editor/ce-page-8021x-security.c index 1e4f1464a..3a15d0711 100644 --- a/panels/network/connection-editor/ce-page-8021x-security.c +++ b/panels/network/connection-editor/ce-page-8021x-security.c @@ -66,12 +66,10 @@ security_item_changed_cb (CEPage8021xSecurity *self) static void finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointer user_data) { - GtkWidget *parent; - if (error) return; - self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); self->security = ws_wpa_eap_new (self->connection); if (!self->security) { @@ -79,19 +77,18 @@ finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointe return; } - g_signal_connect_object (WIRELESS_SECURITY (self->security), "changed", G_CALLBACK (security_item_changed_cb), self, G_CONNECT_SWAPPED); - parent = gtk_widget_get_parent (GTK_WIDGET (self->security)); - if (parent) - gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (self->security)); + g_signal_connect_object (WIRELESS_SECURITY (self->security), "changed", G_CALLBACK (security_item_changed_cb), self, G_CONNECT_SWAPPED); + if (gtk_widget_get_parent (GTK_WIDGET (self->security))) + gtk_box_remove (self->box, GTK_WIDGET (self->security)); gtk_switch_set_active (self->enable_8021x_switch, self->initial_have_8021x); g_signal_connect_object (self->enable_8021x_switch, "notify::active", G_CALLBACK (enable_toggled), self, G_CONNECT_SWAPPED); gtk_widget_set_sensitive (GTK_WIDGET (self->security), self->initial_have_8021x); - gtk_size_group_add_widget (self->group, GTK_WIDGET (self->security_label)); - wireless_security_add_to_size_group (WIRELESS_SECURITY (self->security), self->group); + gtk_size_group_add_widget (self->group, GTK_WIDGET (self->security_label)); + wireless_security_add_to_size_group (WIRELESS_SECURITY (self->security), self->group); - gtk_container_add (GTK_CONTAINER (self->box), GTK_WIDGET (self->security)); + gtk_box_append (self->box, GTK_WIDGET (self->security)); } diff --git a/panels/network/connection-editor/ce-page-details.c b/panels/network/connection-editor/ce-page-details.c index 390851569..ee335b1b2 100644 --- a/panels/network/connection-editor/ce-page-details.c +++ b/panels/network/connection-editor/ce-page-details.c @@ -177,7 +177,7 @@ all_user_changed (CEPageDetails *self) NMSettingConnection *sc; sc = nm_connection_get_setting_connection (self->connection); - all_users = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->all_user_check)); + all_users = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->all_user_check)); g_object_set (sc, "permissions", NULL, NULL); if (!all_users) @@ -192,7 +192,7 @@ restrict_data_changed (CEPageDetails *self) s_con = nm_connection_get_setting_connection (self->connection); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->restrict_data_check))) + if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->restrict_data_check))) metered = NM_METERED_YES; else metered = NM_METERED_NO; @@ -220,8 +220,8 @@ update_restrict_data (CEPageDetails *self) metered = nm_setting_connection_get_metered (s_con); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->restrict_data_check), - metered == NM_METERED_YES || metered == NM_METERED_GUESS_YES); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->restrict_data_check), + metered == NM_METERED_YES || metered == NM_METERED_GUESS_YES); gtk_widget_show (GTK_WIDGET (self->restrict_data_check)); g_signal_connect_object (self->restrict_data_check, "notify::active", G_CALLBACK (restrict_data_changed), self, G_CONNECT_SWAPPED); @@ -456,8 +456,8 @@ connect_details_page (CEPageDetails *self) } /* All users check */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->all_user_check), - nm_setting_connection_get_num_permissions (sc) == 0); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->all_user_check), + nm_setting_connection_get_num_permissions (sc) == 0); g_signal_connect_object (self->all_user_check, "toggled", G_CALLBACK (all_user_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->all_user_check, "toggled", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); diff --git a/panels/network/connection-editor/ce-page-ethernet.c b/panels/network/connection-editor/ce-page-ethernet.c index 98fe46079..79c1b7d7b 100644 --- a/panels/network/connection-editor/ce-page-ethernet.c +++ b/panels/network/connection-editor/ce-page-ethernet.c @@ -72,8 +72,8 @@ mtu_output_cb (CEPageEthernet *self) else buf = g_strdup_printf ("%d", val); - if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (self->mtu_spin)))) - gtk_entry_set_text (GTK_ENTRY (self->mtu_spin), buf); + if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (self->mtu_spin)))) + gtk_editable_set_text (GTK_EDITABLE (self->mtu_spin), buf); } static void @@ -86,7 +86,7 @@ connect_ethernet_page (CEPageEthernet *self) const gchar *cloned_mac; name = nm_setting_connection_get_id (self->setting_connection); - gtk_entry_set_text (self->name_entry, name); + gtk_editable_set_text (GTK_EDITABLE (self->name_entry), name); /* Device MAC address */ mac_list = ce_page_get_mac_list (self->client, NM_TYPE_DEVICE_ETHERNET, @@ -119,9 +119,9 @@ ui_to_setting (CEPageEthernet *self) const gchar *text; GtkWidget *entry; - entry = gtk_bin_get_child (GTK_BIN (self->mac_combo)); + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (self->mac_combo)); if (entry) { - text = gtk_entry_get_text (GTK_ENTRY (entry)); + text = gtk_editable_get_text (GTK_EDITABLE (entry)); device_mac = ce_page_trim_address (text); } @@ -134,7 +134,7 @@ ui_to_setting (CEPageEthernet *self) NULL); g_object_set (self->setting_connection, - NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name_entry), + NM_SETTING_CONNECTION_ID, gtk_editable_get_text (GTK_EDITABLE (self->name_entry)), NULL); } @@ -153,9 +153,9 @@ ce_page_ethernet_validate (CEPage *page, GtkWidget *entry; gboolean ret = TRUE; - entry = gtk_bin_get_child (GTK_BIN (self->mac_combo)); + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (self->mac_combo)); if (entry) { - if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) { + if (!ce_page_address_is_valid (gtk_editable_get_text (GTK_EDITABLE (entry)))) { widget_set_error (entry); ret = FALSE; } else { @@ -164,10 +164,10 @@ ce_page_ethernet_validate (CEPage *page, } if (!ce_page_cloned_mac_combo_valid (self->cloned_mac_combo)) { - widget_set_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo))); + widget_set_error (gtk_combo_box_get_child (GTK_COMBO_BOX (self->cloned_mac_combo))); ret = FALSE; } else { - widget_unset_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo))); + widget_unset_error (gtk_combo_box_get_child (GTK_COMBO_BOX (self->cloned_mac_combo))); } if (!ret) diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c index 140dedd75..36e586932 100644 --- a/panels/network/connection-editor/ce-page-ip4.c +++ b/panels/network/connection-editor/ce-page-ip4.c @@ -27,7 +27,6 @@ #include <glib/gi18n.h> #include <NetworkManager.h> -#include "list-box-helper.h" #include "ce-ip-address-entry.h" #include "ce-netmask-entry.h" #include "ce-page.h" @@ -39,24 +38,24 @@ static void ensure_empty_routes_row (CEPageIP4 *self); struct _CEPageIP4 { - GtkScrolledWindow parent; + AdwBin parent; GtkBox *address_box; GtkSizeGroup *address_sizegroup; GtkSwitch *auto_dns_switch; GtkSwitch *auto_routes_switch; - GtkRadioButton *automatic_radio; + GtkCheckButton *automatic_radio; GtkBox *content_box; - GtkRadioButton *disabled_radio; + GtkCheckButton *disabled_radio; GtkEntry *dns_entry; - GtkRadioButton *local_radio; + GtkCheckButton *local_radio; GtkGrid *main_box; - GtkRadioButton *manual_radio; + GtkCheckButton *manual_radio; GtkCheckButton *never_default_check; GtkBox *routes_box; GtkSizeGroup *routes_metric_sizegroup; GtkSizeGroup *routes_sizegroup; - GtkRadioButton *shared_radio; + GtkCheckButton *shared_radio; NMSettingIPConfig *setting; @@ -66,7 +65,7 @@ struct _CEPageIP4 static void ce_page_iface_init (CEPageInterface *); -G_DEFINE_TYPE_WITH_CODE (CEPageIP4, ce_page_ip4, GTK_TYPE_SCROLLED_WINDOW, +G_DEFINE_TYPE_WITH_CODE (CEPageIP4, ce_page_ip4, ADW_TYPE_BIN, G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init)) enum { @@ -89,15 +88,15 @@ method_changed (CEPageIP4 *self) gboolean dns_enabled; gboolean routes_enabled; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio)) || - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->shared_radio))) { + if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->disabled_radio)) || + gtk_check_button_get_active (GTK_CHECK_BUTTON (self->shared_radio))) { addr_enabled = FALSE; dns_enabled = FALSE; routes_enabled = FALSE; } else { - addr_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio)); - dns_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)); - routes_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)); + addr_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->manual_radio)); + dns_enabled = !gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio)); + routes_enabled = !gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio)); } gtk_widget_set_visible (GTK_WIDGET (self->address_box), addr_enabled); @@ -111,23 +110,24 @@ method_changed (CEPageIP4 *self) static void update_row_sensitivity (CEPageIP4 *self, GtkWidget *list) { - g_autoptr(GList) children = NULL; + GtkWidget *child; gint rows = 0, i = 0; - children = gtk_container_get_children (GTK_CONTAINER (list)); - for (GList *l = children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (GTK_WIDGET (list)); + child; + child = gtk_widget_get_next_sibling (child)) { GtkWidget *button; - button = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "delete-button")); + button = GTK_WIDGET (g_object_get_data (G_OBJECT (child), "delete-button")); if (button != NULL) rows++; } - for (GList *l = children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (GTK_WIDGET (list)); + child; + child = gtk_widget_get_next_sibling (child)) { GtkWidget *button; - button = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "delete-button")); + button = GTK_WIDGET (g_object_get_data (G_OBJECT (child), "delete-button")); if (button != NULL) gtk_widget_set_sensitive (button, rows > 1 && ++i < rows); } @@ -136,15 +136,15 @@ update_row_sensitivity (CEPageIP4 *self, GtkWidget *list) static void update_row_gateway_sensitivity (CEPageIP4 *self) { - g_autoptr(GList) children = NULL; + GtkWidget *child; gint rows = 0; - children = gtk_container_get_children (GTK_CONTAINER (self->address_list)); - for (GList *l = children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (self->address_list); + child; + child = gtk_widget_get_next_sibling (child)) { GtkWidget *entry; - entry = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "gateway")); + entry = GTK_WIDGET (g_object_get_data (G_OBJECT (child), "gateway")); gtk_widget_set_sensitive (entry, (rows == 0)); @@ -163,7 +163,7 @@ remove_row (CEPageIP4 *self, GtkButton *button) row = gtk_widget_get_parent (row_box); list = gtk_widget_get_parent (row); - gtk_container_remove (GTK_CONTAINER (list), row); + gtk_list_box_remove (GTK_LIST_BOX (list), row); ce_page_changed (CE_PAGE (self)); @@ -175,19 +175,20 @@ remove_row (CEPageIP4 *self, GtkButton *button) static gboolean validate_row (GtkWidget *row) { + GtkWidget *child; GtkWidget *box; - g_autoptr(GList) children = NULL; gboolean valid; valid = FALSE; - box = gtk_bin_get_child (GTK_BIN (row)); - children = gtk_container_get_children (GTK_CONTAINER (box)); + box = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row)); - for (GList *l = children; l != NULL; l = l->next) { - if (!GTK_IS_ENTRY (l->data)) + for (child = gtk_widget_get_first_child (box); + child; + child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_ENTRY (child)) continue; - valid = valid || gtk_entry_get_text_length (l->data) > 0; + valid = valid || gtk_entry_get_text_length (GTK_ENTRY (child)) > 0; } return valid; @@ -203,55 +204,53 @@ add_address_row (CEPageIP4 *self, GtkWidget *row_box; GtkWidget *widget; GtkWidget *delete_button; - GtkWidget *image; row = gtk_list_box_row_new (); + gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE); row_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked"); + gtk_widget_add_css_class (row_box, "linked"); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_address_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "address", widget); - gtk_entry_set_text (GTK_ENTRY (widget), address); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), address); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = GTK_WIDGET (ce_netmask_entry_new ()); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_address_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "netmask", widget); - gtk_entry_set_text (GTK_ENTRY (widget), network); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), network); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_address_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "gateway", widget); - gtk_entry_set_text (GTK_ENTRY (widget), gateway ? gateway : ""); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), gateway ? gateway : ""); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); - delete_button = gtk_button_new (); + delete_button = gtk_button_new_from_icon_name ("edit-delete-symbolic"); gtk_widget_set_sensitive (delete_button, FALSE); - gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button"); g_signal_connect_object (delete_button, "clicked", G_CALLBACK (remove_row), self, G_CONNECT_SWAPPED); - image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU); - atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Address")); - gtk_button_set_image (GTK_BUTTON (delete_button), image); - gtk_container_add (GTK_CONTAINER (row_box), delete_button); + gtk_accessible_update_property (GTK_ACCESSIBLE (delete_button), + GTK_ACCESSIBLE_PROPERTY_LABEL, _("Delete Address"), + -1); + gtk_box_append (GTK_BOX (row_box), delete_button); g_object_set_data (G_OBJECT (row), "delete-button", delete_button); gtk_size_group_add_widget (self->address_sizegroup, delete_button); - gtk_container_add (GTK_CONTAINER (row), row_box); - gtk_widget_show_all (row); - gtk_container_add (GTK_CONTAINER (self->address_list), row); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_box); + gtk_list_box_append (GTK_LIST_BOX (self->address_list), row); update_row_gateway_sensitivity (self); update_row_sensitivity (self, self->address_list); @@ -260,14 +259,10 @@ add_address_row (CEPageIP4 *self, static void ensure_empty_address_row (CEPageIP4 *self) { - g_autoptr(GList) children = NULL; - GList *l; - - children = gtk_container_get_children (GTK_CONTAINER (self->address_list)); - l = g_list_last (children); + GtkWidget *child = gtk_widget_get_last_child (self->address_list); /* Add the last, stub row if needed*/ - if (!l || validate_row (l->data)) + if (!child || validate_row (child)) add_address_row (self, "", "", ""); } @@ -279,8 +274,7 @@ add_address_box (CEPageIP4 *self) self->address_list = list = gtk_list_box_new (); gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE); - gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL); - gtk_container_add (GTK_CONTAINER (self->address_box), list); + gtk_box_append (self->address_box, list); for (i = 0; i < nm_setting_ip_config_get_num_addresses (self->setting); i++) { NMIPAddress *addr; @@ -301,8 +295,6 @@ add_address_box (CEPageIP4 *self) } if (nm_setting_ip_config_get_num_addresses (self->setting) == 0) ensure_empty_address_row (self); - - gtk_widget_show_all (GTK_WIDGET (self->address_box)); } static void @@ -327,7 +319,7 @@ add_dns_section (CEPageIP4 *self) g_string_append (string, address); } - gtk_entry_set_text (self->dns_entry, string->str); + gtk_editable_set_text (GTK_EDITABLE (self->dns_entry), string->str); g_signal_connect_object (self->dns_entry, "notify::text", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); @@ -345,39 +337,39 @@ add_route_row (CEPageIP4 *self, GtkWidget *row_box; GtkWidget *widget; GtkWidget *delete_button; - GtkWidget *image; row = gtk_list_box_row_new (); + gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE); row_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked"); + gtk_widget_add_css_class (row_box, "linked"); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "address", widget); - gtk_entry_set_text (GTK_ENTRY (widget), address); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), address); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = GTK_WIDGET (ce_netmask_entry_new ()); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "netmask", widget); - gtk_entry_set_text (GTK_ENTRY (widget), netmask); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), netmask); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "gateway", widget); - gtk_entry_set_text (GTK_ENTRY (widget), gateway ? gateway : ""); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), gateway ? gateway : ""); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = gtk_entry_new (); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); @@ -385,30 +377,29 @@ add_route_row (CEPageIP4 *self, g_object_set_data (G_OBJECT (row), "metric", widget); if (metric >= 0) { g_autofree gchar *s = g_strdup_printf ("%d", metric); - gtk_entry_set_text (GTK_ENTRY (widget), s); + gtk_editable_set_text (GTK_EDITABLE (widget), s); } - gtk_entry_set_width_chars (GTK_ENTRY (widget), 5); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 5); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); gtk_size_group_add_widget (self->routes_metric_sizegroup, widget); - delete_button = gtk_button_new (); - gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button"); + delete_button = gtk_button_new_from_icon_name ("edit-delete-symbolic"); + gtk_widget_set_sensitive (delete_button, FALSE); g_signal_connect_object (delete_button, "clicked", G_CALLBACK (remove_row), self, G_CONNECT_SWAPPED); - image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU); - atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Route")); - gtk_button_set_image (GTK_BUTTON (delete_button), image); + gtk_accessible_update_property (GTK_ACCESSIBLE (delete_button), + GTK_ACCESSIBLE_PROPERTY_LABEL, _("Delete Route"), + -1); gtk_widget_set_halign (delete_button, GTK_ALIGN_CENTER); gtk_widget_set_valign (delete_button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (row_box), delete_button); + gtk_box_append (GTK_BOX (row_box), delete_button); g_object_set_data (G_OBJECT (row), "delete-button", delete_button); gtk_size_group_add_widget (self->routes_sizegroup, delete_button); - gtk_container_add (GTK_CONTAINER (row), row_box); - gtk_widget_show_all (row); - gtk_container_add (GTK_CONTAINER (self->routes_list), row); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_box); + gtk_list_box_append (GTK_LIST_BOX (self->routes_list), row); update_row_sensitivity (self, self->routes_list); } @@ -416,14 +407,10 @@ add_route_row (CEPageIP4 *self, static void ensure_empty_routes_row (CEPageIP4 *self) { - g_autoptr(GList) children = NULL; - GList *l; - - children = gtk_container_get_children (GTK_CONTAINER (self->routes_list)); - l = g_list_last (children); + GtkWidget *child = gtk_widget_get_last_child (self->routes_list); /* Add the last, stub row if needed*/ - if (!l || validate_row (l->data)) + if (!child || validate_row (child)) add_route_row (self, "", "", "", -1); } @@ -435,8 +422,7 @@ add_routes_box (CEPageIP4 *self) self->routes_list = list = gtk_list_box_new (); gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE); - gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL); - gtk_container_add (GTK_CONTAINER (self->routes_box), list); + gtk_box_append (GTK_BOX (self->routes_box), list); gtk_switch_set_active (self->auto_routes_switch, !nm_setting_ip_config_get_ignore_auto_routes (self->setting)); g_signal_connect_object (self->auto_routes_switch, "notify::active", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); @@ -460,8 +446,6 @@ add_routes_box (CEPageIP4 *self) } if (nm_setting_ip_config_get_num_routes (self->setting) == 0) ensure_empty_routes_row (self); - - gtk_widget_show_all (GTK_WIDGET (self->routes_box)); } static void @@ -470,9 +454,6 @@ connect_ip4_page (CEPageIP4 *self) const gchar *str_method; guint method; - gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->main_box), - gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self))); - add_address_box (self); add_dns_section (self); add_routes_box (self); @@ -499,8 +480,8 @@ connect_ip4_page (CEPageIP4 *self) method = IP4_METHOD_DISABLED; } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->never_default_check), - nm_setting_ip_config_get_never_default (self->setting)); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->never_default_check), + nm_setting_ip_config_get_never_default (self->setting)); g_signal_connect_object (self->never_default_check, "toggled", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->automatic_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED); @@ -510,19 +491,19 @@ connect_ip4_page (CEPageIP4 *self) switch (method) { case IP4_METHOD_AUTO: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->automatic_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->automatic_radio), TRUE); break; case IP4_METHOD_LINK_LOCAL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->local_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->local_radio), TRUE); break; case IP4_METHOD_MANUAL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->manual_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->manual_radio), TRUE); break; case IP4_METHOD_SHARED: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->shared_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->shared_radio), TRUE); break; case IP4_METHOD_DISABLED: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->disabled_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->disabled_radio), TRUE); break; default: break; @@ -541,31 +522,33 @@ ui_to_setting (CEPageIP4 *self) GPtrArray *addresses = NULL; GPtrArray *dns_servers = NULL; GPtrArray *routes = NULL; + GtkWidget *child; GStrv dns_addresses = NULL; - g_autoptr(GList) address_children = NULL; - g_autoptr(GList) routes_children = NULL; gboolean ret = TRUE; const char *default_gateway = NULL; + gboolean add_addresses = FALSE; + gboolean add_routes = FALSE; gchar *dns_text = NULL; guint i; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) + if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->disabled_radio))) method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio))) + else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->automatic_radio))) method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio))) + else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio))) method = NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio))) + else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->manual_radio))) method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->shared_radio))) + else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->shared_radio))) method = NM_SETTING_IP4_CONFIG_METHOD_SHARED; addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref); - if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) - address_children = gtk_container_get_children (GTK_CONTAINER (self->address_list)); + add_addresses = g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); - for (GList *l = address_children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (self->address_list); + add_addresses && child; + child = gtk_widget_get_next_sibling (child)) { + GtkWidget *row = child; CEIPAddressEntry *address_entry; CENetmaskEntry *netmask_entry; CEIPAddressEntry *gateway_entry; @@ -594,18 +577,18 @@ ui_to_setting (CEPageIP4 *self) } else { if (!ce_ip_address_entry_is_empty (gateway_entry)) { g_assert (default_gateway == NULL); - default_gateway = gtk_entry_get_text (GTK_ENTRY (gateway_entry)); + default_gateway = gtk_editable_get_text (GTK_EDITABLE (gateway_entry)); } } if (!ret) continue; - addr = nm_ip_address_new (AF_INET, gtk_entry_get_text (GTK_ENTRY (address_entry)), ce_netmask_entry_get_prefix (netmask_entry), NULL); + addr = nm_ip_address_new (AF_INET, gtk_editable_get_text (GTK_EDITABLE (address_entry)), ce_netmask_entry_get_prefix (netmask_entry), NULL); if (addr) g_ptr_array_add (addresses, addr); - if (!l || !l->next) + if (!gtk_widget_get_next_sibling (row)) ensure_empty_address_row (self); } @@ -615,7 +598,7 @@ ui_to_setting (CEPageIP4 *self) } dns_servers = g_ptr_array_new_with_free_func (g_free); - dns_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (self->dns_entry)))); + dns_text = g_strstrip (g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->dns_entry)))); if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) || g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) dns_addresses = g_strsplit_set (dns_text, ", ", -1); @@ -650,12 +633,13 @@ ui_to_setting (CEPageIP4 *self) } routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_route_unref); - if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) || - g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) - routes_children = gtk_container_get_children (GTK_CONTAINER (self->routes_list)); + add_routes = g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) || + g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); - for (GList *l = routes_children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (self->routes_list); + add_routes && child; + child = gtk_widget_get_next_sibling (child)) { + GtkWidget *row = child; CEIPAddressEntry *address_entry; CENetmaskEntry *netmask_entry; CEIPAddressEntry *gateway_entry; @@ -669,7 +653,7 @@ ui_to_setting (CEPageIP4 *self) netmask_entry = CE_NETMASK_ENTRY (g_object_get_data (G_OBJECT (row), "netmask")); gateway_entry = CE_IP_ADDRESS_ENTRY (g_object_get_data (G_OBJECT (row), "gateway")); - text_metric = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (row), "metric"))); + text_metric = gtk_editable_get_text (GTK_EDITABLE (g_object_get_data (G_OBJECT (row), "metric"))); if (ce_ip_address_entry_is_empty (address_entry) && ce_netmask_entry_is_empty (netmask_entry) && ce_ip_address_entry_is_empty (gateway_entry) && !*text_metric) { /* ignore empty rows */ @@ -702,11 +686,15 @@ ui_to_setting (CEPageIP4 *self) if (!ret) continue; - route = nm_ip_route_new (AF_INET, gtk_entry_get_text (GTK_ENTRY (address_entry)), ce_netmask_entry_get_prefix (netmask_entry), gtk_entry_get_text (GTK_ENTRY (gateway_entry)), metric, NULL); + route = nm_ip_route_new (AF_INET, + gtk_editable_get_text (GTK_EDITABLE (address_entry)), + ce_netmask_entry_get_prefix (netmask_entry), + gtk_editable_get_text (GTK_EDITABLE (gateway_entry)), + metric, NULL); if (route) g_ptr_array_add (routes, route); - if (!l || !l->next) + if (!gtk_widget_get_next_sibling (row)) ensure_empty_routes_row (self); } @@ -720,7 +708,7 @@ ui_to_setting (CEPageIP4 *self) ignore_auto_dns = !gtk_switch_get_active (self->auto_dns_switch); ignore_auto_routes = !gtk_switch_get_active (self->auto_routes_switch); - never_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->never_default_check)); + never_default = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->never_default_check)); g_object_set (self->setting, NM_SETTING_IP_CONFIG_METHOD, method, diff --git a/panels/network/connection-editor/ce-page-ip4.h b/panels/network/connection-editor/ce-page-ip4.h index b76905d3b..3e6545f89 100644 --- a/panels/network/connection-editor/ce-page-ip4.h +++ b/panels/network/connection-editor/ce-page-ip4.h @@ -21,12 +21,12 @@ #pragma once -#include <gtk/gtk.h> +#include <adwaita.h> #include <NetworkManager.h> G_BEGIN_DECLS -G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, GtkScrolledWindow) +G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, AdwBin) CEPageIP4 *ce_page_ip4_new (NMConnection *connection, NMClient *client); diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c index 06e1842b5..d75eef3cb 100644 --- a/panels/network/connection-editor/ce-page-ip6.c +++ b/panels/network/connection-editor/ce-page-ip6.c @@ -27,7 +27,6 @@ #include <glib/gi18n.h> #include <NetworkManager.h> -#include "list-box-helper.h" #include "ce-ip-address-entry.h" #include "ce-page.h" #include "ce-page-ip6.h" @@ -39,25 +38,25 @@ static void ensure_empty_routes_row (CEPageIP6 *self); struct _CEPageIP6 { - GtkScrolledWindow parent; + AdwBin parent; GtkBox *address_box; GtkSizeGroup *address_sizegroup; GtkSwitch *auto_dns_switch; GtkSwitch *auto_routes_switch; - GtkRadioButton *automatic_radio; + GtkCheckButton *automatic_radio; GtkBox *content_box; - GtkRadioButton *dhcp_radio; - GtkRadioButton *disabled_radio; + GtkCheckButton *dhcp_radio; + GtkCheckButton *disabled_radio; GtkEntry *dns_entry; - GtkRadioButton *local_radio; + GtkCheckButton *local_radio; GtkGrid *main_box; - GtkRadioButton *manual_radio; + GtkCheckButton *manual_radio; GtkCheckButton *never_default_check; GtkBox *routes_box; GtkSizeGroup *routes_metric_sizegroup; GtkSizeGroup *routes_sizegroup; - GtkRadioButton *shared_radio; + GtkCheckButton *shared_radio; NMSettingIPConfig *setting; @@ -67,7 +66,7 @@ struct _CEPageIP6 static void ce_page_iface_init (CEPageInterface *); -G_DEFINE_TYPE_WITH_CODE (CEPageIP6, ce_page_ip6, GTK_TYPE_SCROLLED_WINDOW, +G_DEFINE_TYPE_WITH_CODE (CEPageIP6, ce_page_ip6, ADW_TYPE_BIN, G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init)) enum { @@ -91,15 +90,15 @@ method_changed (CEPageIP6 *self) gboolean dns_enabled; gboolean routes_enabled; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio)) || - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->shared_radio))) { + if (gtk_check_button_get_active (self->disabled_radio) || + gtk_check_button_get_active (self->shared_radio)) { addr_enabled = FALSE; dns_enabled = FALSE; routes_enabled = FALSE; } else { - addr_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio)); - dns_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)); - routes_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)); + addr_enabled = gtk_check_button_get_active (self->manual_radio); + dns_enabled = !gtk_check_button_get_active (self->local_radio); + routes_enabled = !gtk_check_button_get_active (self->local_radio); } gtk_widget_set_visible (GTK_WIDGET (self->address_box), addr_enabled); @@ -113,23 +112,24 @@ method_changed (CEPageIP6 *self) static void update_row_sensitivity (CEPageIP6 *self, GtkWidget *list) { - g_autoptr(GList) children = NULL; + GtkWidget *child; gint rows = 0, i = 0; - children = gtk_container_get_children (GTK_CONTAINER (list)); - for (GList *l = children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (GTK_WIDGET (list)); + child; + child = gtk_widget_get_next_sibling (child)) { GtkWidget *button; - button = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "delete-button")); + button = GTK_WIDGET (g_object_get_data (G_OBJECT (child), "delete-button")); if (button != NULL) rows++; } - for (GList *l = children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (GTK_WIDGET (list)); + child; + child = gtk_widget_get_next_sibling (child)) { GtkWidget *button; - button = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "delete-button")); + button = GTK_WIDGET (g_object_get_data (G_OBJECT (child), "delete-button")); if (button != NULL) gtk_widget_set_sensitive (button, rows > 1 && ++i < rows); } @@ -146,7 +146,7 @@ remove_row (CEPageIP6 *self, GtkButton *button) row = gtk_widget_get_parent (row_box); list = gtk_widget_get_parent (row); - gtk_container_remove (GTK_CONTAINER (list), row); + gtk_list_box_remove (GTK_LIST_BOX (list), row); ce_page_changed (CE_PAGE (self)); @@ -156,19 +156,20 @@ remove_row (CEPageIP6 *self, GtkButton *button) static gboolean validate_row (GtkWidget *row) { + GtkWidget *child; GtkWidget *box; - g_autoptr(GList) children = NULL; gboolean valid; valid = FALSE; - box = gtk_bin_get_child (GTK_BIN (row)); - children = gtk_container_get_children (GTK_CONTAINER (box)); + box = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row)); - for (GList *l = children; l != NULL; l = l->next) { - if (!GTK_IS_ENTRY (l->data)) + for (child = gtk_widget_get_first_child (box); + child; + child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_ENTRY (child)) continue; - valid = valid || gtk_entry_get_text_length (l->data) > 0; + valid = valid || gtk_entry_get_text_length (GTK_ENTRY (child)) > 0; } return valid; @@ -184,55 +185,53 @@ add_address_row (CEPageIP6 *self, GtkWidget *row_box; GtkWidget *widget; GtkWidget *delete_button; - GtkWidget *image; row = gtk_list_box_row_new (); + gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE); row_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked"); + gtk_widget_add_css_class (row_box, "linked"); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET6)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_address_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "address", widget); - gtk_entry_set_text (GTK_ENTRY (widget), address); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), address); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = gtk_entry_new (); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_address_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "prefix", widget); - gtk_entry_set_text (GTK_ENTRY (widget), network); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), network); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET6)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_address_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "gateway", widget); - gtk_entry_set_text (GTK_ENTRY (widget), gateway ? gateway : ""); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), gateway ? gateway : ""); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); - delete_button = gtk_button_new (); + delete_button = gtk_button_new_from_icon_name ("edit-delete-symbolic"); gtk_widget_set_sensitive (delete_button, FALSE); - gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button"); g_signal_connect_object (delete_button, "clicked", G_CALLBACK (remove_row), self, G_CONNECT_SWAPPED); - image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU); - atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Address")); - gtk_button_set_image (GTK_BUTTON (delete_button), image); - gtk_container_add (GTK_CONTAINER (row_box), delete_button); + gtk_accessible_update_property (GTK_ACCESSIBLE (delete_button), + GTK_ACCESSIBLE_PROPERTY_LABEL, _("Delete Address"), + -1); + gtk_box_append (GTK_BOX (row_box), delete_button); g_object_set_data (G_OBJECT (row), "delete-button", delete_button); gtk_size_group_add_widget (self->address_sizegroup, delete_button); - gtk_container_add (GTK_CONTAINER (row), row_box); - gtk_widget_show_all (row); - gtk_container_add (GTK_CONTAINER (self->address_list), row); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_box); + gtk_list_box_append (GTK_LIST_BOX (self->address_list), row); update_row_sensitivity (self, self->address_list); } @@ -240,14 +239,10 @@ add_address_row (CEPageIP6 *self, static void ensure_empty_address_row (CEPageIP6 *self) { - g_autoptr(GList) children = NULL; - GList *l; - - children = gtk_container_get_children (GTK_CONTAINER (self->address_list)); - l = g_list_last (children); + GtkWidget *child = gtk_widget_get_last_child (self->address_list); /* Add the last, stub row if needed*/ - if (!l || validate_row (l->data)) + if (!child || validate_row (child)) add_address_row (self, "", "", ""); } @@ -259,8 +254,7 @@ add_address_box (CEPageIP6 *self) self->address_list = list = gtk_list_box_new (); gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE); - gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL); - gtk_container_add (GTK_CONTAINER (self->address_box), list); + gtk_box_append (self->address_box, list); for (i = 0; i < nm_setting_ip_config_get_num_addresses (self->setting); i++) { NMIPAddress *addr; @@ -273,8 +267,6 @@ add_address_box (CEPageIP6 *self) } if (nm_setting_ip_config_get_num_addresses (self->setting) == 0) ensure_empty_address_row (self); - - gtk_widget_show_all (GTK_WIDGET (self->address_box)); } static void @@ -300,7 +292,7 @@ add_dns_section (CEPageIP6 *self) } - gtk_entry_set_text (self->dns_entry, string->str); + gtk_editable_set_text (GTK_EDITABLE (self->dns_entry), string->str); g_signal_connect_object (self->dns_entry, "notify::text", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); @@ -318,67 +310,65 @@ add_route_row (CEPageIP6 *self, GtkWidget *row_box; GtkWidget *widget; GtkWidget *delete_button; - GtkWidget *image; row = gtk_list_box_row_new (); + gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE); row_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked"); + gtk_widget_add_css_class (row_box, "linked"); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET6)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "address", widget); - gtk_entry_set_text (GTK_ENTRY (widget), address); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), address); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = gtk_entry_new (); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "prefix", widget); - gtk_entry_set_text (GTK_ENTRY (widget), prefix ? prefix : ""); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), prefix ? prefix : ""); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET6)); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "gateway", widget); - gtk_entry_set_text (GTK_ENTRY (widget), gateway); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 16); + gtk_editable_set_text (GTK_EDITABLE (widget), gateway); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 16); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); widget = gtk_entry_new (); g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED); g_object_set_data (G_OBJECT (row), "metric", widget); - gtk_entry_set_text (GTK_ENTRY (widget), metric ? metric : ""); - gtk_entry_set_width_chars (GTK_ENTRY (widget), 5); + gtk_editable_set_text (GTK_EDITABLE (widget), metric ? metric : ""); + gtk_editable_set_width_chars (GTK_EDITABLE (widget), 5); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (row_box), widget); + gtk_box_append (GTK_BOX (row_box), widget); gtk_size_group_add_widget (self->routes_metric_sizegroup, widget); - delete_button = gtk_button_new (); - gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button"); + delete_button = gtk_button_new_from_icon_name ("edit-delete-symbolic"); g_signal_connect_object (delete_button, "clicked", G_CALLBACK (remove_row), self, G_CONNECT_SWAPPED); - image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU); - atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Route")); - gtk_button_set_image (GTK_BUTTON (delete_button), image); + gtk_accessible_update_property (GTK_ACCESSIBLE (delete_button), + GTK_ACCESSIBLE_PROPERTY_LABEL, _("Delete Route"), + -1); gtk_widget_set_halign (delete_button, GTK_ALIGN_CENTER); gtk_widget_set_valign (delete_button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (row_box), delete_button); + gtk_box_append (GTK_BOX (row_box), delete_button); g_object_set_data (G_OBJECT (row), "delete-button", delete_button); gtk_size_group_add_widget (self->routes_sizegroup, delete_button); - gtk_container_add (GTK_CONTAINER (row), row_box); - gtk_widget_show_all (row); - gtk_container_add (GTK_CONTAINER (self->routes_list), row); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_box); + gtk_list_box_append (GTK_LIST_BOX (self->routes_list), row); update_row_sensitivity (self, self->routes_list); } @@ -386,17 +376,10 @@ add_route_row (CEPageIP6 *self, static void ensure_empty_routes_row (CEPageIP6 *self) { - g_autoptr(GList) children = NULL; - GList *l; - - children = gtk_container_get_children (GTK_CONTAINER (self->routes_list)); - l = g_list_last (children); - - while (l && l->next) - l = l->next; + GtkWidget *child = gtk_widget_get_last_child (self->routes_list); /* Add the last, stub row if needed*/ - if (!l || validate_row (l->data)) + if (!child || validate_row (child)) add_route_row (self, "", NULL, "", NULL); } @@ -414,8 +397,7 @@ add_routes_box (CEPageIP6 *self) self->routes_list = list = gtk_list_box_new (); gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE); - gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL); - gtk_container_add (GTK_CONTAINER (self->routes_box), list); + gtk_box_append (self->routes_box, list); gtk_switch_set_active (self->auto_routes_switch, !nm_setting_ip_config_get_ignore_auto_routes (self->setting)); g_signal_connect_object (self->auto_routes_switch, "notify::active", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); @@ -434,8 +416,6 @@ add_routes_box (CEPageIP6 *self) } if (nm_setting_ip_config_get_num_routes (self->setting) == 0) add_empty_route_row (self); - - gtk_widget_show_all (GTK_WIDGET (self->routes_box)); } static void @@ -444,9 +424,6 @@ connect_ip6_page (CEPageIP6 *self) const gchar *str_method; guint method; - gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->main_box), - gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self))); - add_address_box (self); add_dns_section (self); add_routes_box (self); @@ -476,8 +453,8 @@ connect_ip6_page (CEPageIP6 *self) method = IP6_METHOD_DISABLED; } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->never_default_check), - nm_setting_ip_config_get_never_default (self->setting)); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->never_default_check), + nm_setting_ip_config_get_never_default (self->setting)); g_signal_connect_object (self->never_default_check, "toggled", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->automatic_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED); @@ -488,22 +465,22 @@ connect_ip6_page (CEPageIP6 *self) switch (method) { case IP6_METHOD_AUTO: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->automatic_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->automatic_radio), TRUE); break; case IP6_METHOD_DHCP: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->dhcp_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->dhcp_radio), TRUE); break; case IP6_METHOD_LINK_LOCAL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->local_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->local_radio), TRUE); break; case IP6_METHOD_MANUAL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->manual_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->manual_radio), TRUE); break; case IP6_METHOD_SHARED: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->shared_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->shared_radio), TRUE); break; case IP6_METHOD_DISABLED: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->disabled_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->disabled_radio), TRUE); break; default: break; @@ -515,41 +492,44 @@ connect_ip6_page (CEPageIP6 *self) static gboolean ui_to_setting (CEPageIP6 *self) { + GtkWidget *child; const gchar *method; gboolean ignore_auto_dns; gboolean ignore_auto_routes; gboolean never_default; - g_autoptr(GList) address_children = NULL; - g_autoptr(GList) routes_children = NULL; + gboolean add_addresses = FALSE; + gboolean add_routes = FALSE; gboolean ret = TRUE; GStrv dns_addresses = NULL; gchar *dns_text = NULL; guint i; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) + if (gtk_check_button_get_active (self->disabled_radio)) method = NM_SETTING_IP6_CONFIG_METHOD_DISABLED; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio))) + else if (gtk_check_button_get_active (self->manual_radio)) method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio))) + else if (gtk_check_button_get_active (self->local_radio)) method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->dhcp_radio))) + else if (gtk_check_button_get_active (self->dhcp_radio)) method = NM_SETTING_IP6_CONFIG_METHOD_DHCP; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio))) + else if (gtk_check_button_get_active (self->automatic_radio)) method = NM_SETTING_IP6_CONFIG_METHOD_AUTO; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->shared_radio))) + else if (gtk_check_button_get_active (self->shared_radio)) method = NM_SETTING_IP6_CONFIG_METHOD_SHARED; nm_setting_ip_config_clear_addresses (self->setting); if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { - address_children = gtk_container_get_children (GTK_CONTAINER (self->address_list)); + add_addresses = TRUE; } else { g_object_set (G_OBJECT (self->setting), NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL); } - for (GList *l = address_children; l; l = l->next) { - GtkWidget *row = l->data; + for (child = gtk_widget_get_first_child (self->address_list); + add_addresses && child; + child = gtk_widget_get_next_sibling (child)) { + GtkWidget *row = child; CEIPAddressEntry *address_entry; CEIPAddressEntry *gateway_entry; const gchar *text_prefix; @@ -561,7 +541,7 @@ ui_to_setting (CEPageIP6 *self) if (!address_entry) continue; - text_prefix = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (row), "prefix"))); + text_prefix = gtk_editable_get_text (GTK_EDITABLE (g_object_get_data (G_OBJECT (row), "prefix"))); gateway_entry = CE_IP_ADDRESS_ENTRY (g_object_get_data (G_OBJECT (row), "gateway")); if (ce_ip_address_entry_is_empty (address_entry) && !*text_prefix && ce_ip_address_entry_is_empty (gateway_entry)) { @@ -587,19 +567,19 @@ ui_to_setting (CEPageIP6 *self) if (!ret) continue; - addr = nm_ip_address_new (AF_INET6, gtk_entry_get_text (GTK_ENTRY (address_entry)), prefix, NULL); + addr = nm_ip_address_new (AF_INET6, gtk_editable_get_text (GTK_EDITABLE (address_entry)), prefix, NULL); if (!ce_ip_address_entry_is_empty (gateway_entry)) g_object_set (G_OBJECT (self->setting), - NM_SETTING_IP_CONFIG_GATEWAY, gtk_entry_get_text (GTK_ENTRY (gateway_entry)), + NM_SETTING_IP_CONFIG_GATEWAY, gtk_editable_get_text (GTK_EDITABLE (gateway_entry)), NULL); nm_setting_ip_config_add_address (self->setting, addr); - if (!l || !l->next) + if (!gtk_widget_get_next_sibling (row)) ensure_empty_address_row (self); } nm_setting_ip_config_clear_dns (self->setting); - dns_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (self->dns_entry)))); + dns_text = g_strstrip (g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->dns_entry)))); if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) || g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) || @@ -629,13 +609,14 @@ ui_to_setting (CEPageIP6 *self) } nm_setting_ip_config_clear_routes (self->setting); - if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) || - g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) || - g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) - routes_children = gtk_container_get_children (GTK_CONTAINER (self->routes_list)); - - for (GList *l = routes_children; l; l = l->next) { - GtkWidget *row = l->data; + add_routes = g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) || + g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) || + g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL); + + for (child = gtk_widget_get_first_child (self->routes_list); + add_routes && child; + child = gtk_widget_get_next_sibling (child)) { + GtkWidget *row = child; CEIPAddressEntry *address_entry; CEIPAddressEntry *gateway_entry; const gchar *text_prefix; @@ -649,9 +630,9 @@ ui_to_setting (CEPageIP6 *self) if (!address_entry) continue; - text_prefix = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (row), "prefix"))); + text_prefix = gtk_editable_get_text (GTK_EDITABLE (g_object_get_data (G_OBJECT (row), "prefix"))); gateway_entry = CE_IP_ADDRESS_ENTRY (g_object_get_data (G_OBJECT (row), "gateway")); - text_metric = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (row), "metric"))); + text_metric = gtk_editable_get_text (GTK_EDITABLE (g_object_get_data (G_OBJECT (row), "metric"))); if (ce_ip_address_entry_is_empty (address_entry) && !*text_prefix && ce_ip_address_entry_is_empty (gateway_entry) && !*text_metric) { /* ignore empty rows */ @@ -691,11 +672,16 @@ ui_to_setting (CEPageIP6 *self) if (!ret) continue; - route = nm_ip_route_new (AF_INET6, gtk_entry_get_text (GTK_ENTRY (address_entry)), prefix, gtk_entry_get_text (GTK_ENTRY (gateway_entry)), metric, NULL); + route = nm_ip_route_new (AF_INET6, + gtk_editable_get_text (GTK_EDITABLE (address_entry)), + prefix, + gtk_editable_get_text (GTK_EDITABLE (gateway_entry)), + metric, + NULL); nm_setting_ip_config_add_route (self->setting, route); nm_ip_route_unref (route); - if (!l || !l->next) + if (!gtk_widget_get_next_sibling (row)) ensure_empty_routes_row (self); } @@ -704,7 +690,7 @@ ui_to_setting (CEPageIP6 *self) ignore_auto_dns = !gtk_switch_get_active (self->auto_dns_switch); ignore_auto_routes = !gtk_switch_get_active (self->auto_routes_switch); - never_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->never_default_check)); + never_default = gtk_check_button_get_active (self->never_default_check); g_object_set (self->setting, NM_SETTING_IP_CONFIG_METHOD, method, diff --git a/panels/network/connection-editor/ce-page-ip6.h b/panels/network/connection-editor/ce-page-ip6.h index 718a62cbb..c2c7d1be1 100644 --- a/panels/network/connection-editor/ce-page-ip6.h +++ b/panels/network/connection-editor/ce-page-ip6.h @@ -21,12 +21,12 @@ #pragma once -#include <gtk/gtk.h> +#include <adwaita.h> #include <NetworkManager.h> G_BEGIN_DECLS -G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, GtkScrolledWindow) +G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, AdwBin) CEPageIP6 *ce_page_ip6_new (NMConnection *connection, NMClient *client); diff --git a/panels/network/connection-editor/ce-page-security.c b/panels/network/connection-editor/ce-page-security.c index f640cbe13..a63b9394a 100644 --- a/panels/network/connection-editor/ce-page-security.c +++ b/panels/network/connection-editor/ce-page-security.c @@ -157,28 +157,23 @@ wsec_size_group_clear (GtkSizeGroup *group) static void security_combo_changed (CEPageSecurity *self) { - GList *l, *children; g_autoptr(WirelessSecurity) sec = NULL; + GtkWidget *child; wsec_size_group_clear (self->group); - children = gtk_container_get_children (GTK_CONTAINER (self->box)); - for (l = children; l; l = l->next) { - gtk_container_remove (GTK_CONTAINER (self->box), GTK_WIDGET (l->data)); - } + while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->box))) != NULL) + gtk_box_remove (self->box, child); sec = security_combo_get_active (self); if (sec) { - GtkWidget *parent; - - parent = gtk_widget_get_parent (GTK_WIDGET (sec)); - if (parent) - gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (sec)); + if (gtk_widget_get_parent (GTK_WIDGET (sec))) + gtk_box_remove (self->box, GTK_WIDGET (sec)); gtk_size_group_add_widget (self->group, GTK_WIDGET (self->security_label)); wireless_security_add_to_size_group (sec, self->group); - gtk_container_add (GTK_CONTAINER (self->box), g_object_ref (GTK_WIDGET (sec))); + gtk_box_append (self->box, g_object_ref (GTK_WIDGET (sec))); } ce_page_changed (CE_PAGE (self)); diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c index 9ad0a26f2..36afde53d 100644 --- a/panels/network/connection-editor/ce-page-vpn.c +++ b/panels/network/connection-editor/ce-page-vpn.c @@ -63,14 +63,7 @@ G_DEFINE_TYPE_WITH_CODE (CEPageVpn, ce_page_vpn, GTK_TYPE_BOX, static void vpn_gnome3ify_editor (GtkWidget *widget) { - if (GTK_IS_CONTAINER (widget)) { - GList *children, *iter; - - children = gtk_container_get_children (GTK_CONTAINER (widget)); - for (iter = children; iter; iter = iter->next) - vpn_gnome3ify_editor (iter->data); - g_list_free (children); - } else if (GTK_IS_LABEL (widget)) { + if (GTK_IS_LABEL (widget)) { const char *text; gfloat xalign; g_autofree gchar *newtext = NULL; @@ -87,6 +80,13 @@ vpn_gnome3ify_editor (GtkWidget *widget) newtext = g_strndup (text, len - 1); gtk_label_set_text (GTK_LABEL (widget), newtext); gtk_label_set_xalign (GTK_LABEL (widget), 1.0); + } else if (GTK_IS_WIDGET (widget)) { + GtkWidget *child; + + for (child = gtk_widget_get_first_child (widget); + child; + child = gtk_widget_get_next_sibling (child)) + vpn_gnome3ify_editor (child); } } @@ -109,10 +109,8 @@ load_vpn_plugin (CEPageVpn *self) } vpn_gnome3ify_editor (ui_widget); - gtk_widget_destroy (GTK_WIDGET (self->failure_label)); - - gtk_box_pack_start (GTK_BOX (self), ui_widget, TRUE, TRUE, 0); - gtk_widget_show_all (ui_widget); + gtk_box_remove (GTK_BOX (self), GTK_WIDGET (self->failure_label)); + gtk_box_append (GTK_BOX (self), ui_widget); g_signal_connect_object (self->editor, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); } @@ -123,7 +121,7 @@ connect_vpn_page (CEPageVpn *self) const gchar *name; name = nm_setting_connection_get_id (self->setting_connection); - gtk_entry_set_text (self->name_entry, name); + gtk_editable_set_text (GTK_EDITABLE (self->name_entry), name); g_signal_connect_object (self->name_entry, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); } @@ -158,7 +156,7 @@ ce_page_vpn_validate (CEPage *page, CEPageVpn *self = CE_PAGE_VPN (page); g_object_set (self->setting_connection, - NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name_entry), + NM_SETTING_CONNECTION_ID, gtk_editable_get_text (GTK_EDITABLE (self->name_entry)), NULL); if (!nm_setting_verify (NM_SETTING (self->setting_connection), NULL, error)) diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c index 7246170b7..5a662920e 100644 --- a/panels/network/connection-editor/ce-page-wifi.c +++ b/panels/network/connection-editor/ce-page-wifi.c @@ -65,7 +65,7 @@ connect_wifi_page (CEPageWifi *self) utf8_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); else utf8_ssid = g_strdup (""); - gtk_entry_set_text (self->ssid_entry, utf8_ssid); + gtk_editable_set_text (GTK_EDITABLE (self->ssid_entry), utf8_ssid); g_signal_connect_object (self->ssid_entry, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); @@ -101,18 +101,18 @@ ui_to_setting (CEPageWifi *self) g_autofree gchar *device_mac = NULL; g_autofree gchar *cloned_mac = NULL; - utf8_ssid = gtk_entry_get_text (self->ssid_entry); + utf8_ssid = gtk_editable_get_text (GTK_EDITABLE (self->ssid_entry)); if (!utf8_ssid || !*utf8_ssid) ssid = NULL; else { ssid = g_bytes_new_static (utf8_ssid, strlen (utf8_ssid)); } - entry = gtk_bin_get_child (GTK_BIN (self->bssid_combo)); - bssid = gtk_entry_get_text (GTK_ENTRY (entry)); + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (self->bssid_combo)); + bssid = gtk_editable_get_text (GTK_EDITABLE (entry)); if (*bssid == '\0') bssid = NULL; - entry = gtk_bin_get_child (GTK_BIN (self->mac_combo)); - device_mac = ce_page_trim_address (gtk_entry_get_text (GTK_ENTRY (entry))); + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (self->mac_combo)); + device_mac = ce_page_trim_address (gtk_editable_get_text (GTK_EDITABLE (entry))); cloned_mac = ce_page_cloned_mac_get (self->cloned_mac_combo); g_object_set (self->setting, @@ -138,16 +138,16 @@ ce_page_wifi_class_validate (CEPage *parent, GtkWidget *entry; gboolean ret = TRUE; - entry = gtk_bin_get_child (GTK_BIN (self->bssid_combo)); - if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) { + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (self->bssid_combo)); + if (!ce_page_address_is_valid (gtk_editable_get_text (GTK_EDITABLE (entry)))) { widget_set_error (entry); ret = FALSE; } else { widget_unset_error (entry); } - entry = gtk_bin_get_child (GTK_BIN (self->mac_combo)); - if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) { + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (self->mac_combo)); + if (!ce_page_address_is_valid (gtk_editable_get_text (GTK_EDITABLE (entry)))) { widget_set_error (entry); ret = FALSE; } else { @@ -155,10 +155,10 @@ ce_page_wifi_class_validate (CEPage *parent, } if (!ce_page_cloned_mac_combo_valid (self->cloned_mac_combo)) { - widget_set_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo))); + widget_set_error (gtk_combo_box_get_child (GTK_COMBO_BOX (self->cloned_mac_combo))); ret = FALSE; } else { - widget_unset_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo))); + widget_unset_error (gtk_combo_box_get_child (GTK_COMBO_BOX (self->cloned_mac_combo))); } if (!ret) diff --git a/panels/network/connection-editor/ce-page.c b/panels/network/connection-editor/ce-page.c index fb5d3993f..b6f07796f 100644 --- a/panels/network/connection-editor/ce-page.c +++ b/panels/network/connection-editor/ce-page.c @@ -207,9 +207,9 @@ ce_page_setup_mac_combo (GtkComboBoxText *combo, gtk_combo_box_text_prepend_text (combo, current_mac); } - entry = gtk_bin_get_child (GTK_BIN (combo)); + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (combo)); if (entry) - gtk_entry_set_text (GTK_ENTRY (entry), active_mac ? active_mac : current_mac); + gtk_editable_set_text (GTK_EDITABLE (entry), active_mac ? active_mac : current_mac); } } @@ -253,9 +253,9 @@ ce_page_setup_cloned_mac_combo (GtkComboBoxText *combo, const char *current) if (active != -1) { gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active); } else if (current && current[0]) { - entry = gtk_bin_get_child (GTK_BIN (combo)); + entry = gtk_combo_box_get_child (GTK_COMBO_BOX (combo)); g_assert (entry); - gtk_entry_set_text (GTK_ENTRY (entry), current); + gtk_editable_set_text (GTK_EDITABLE (entry), current); } } diff --git a/panels/network/connection-editor/connection-editor.ui b/panels/network/connection-editor/connection-editor.ui index 6a83f134e..98105ce78 100644 --- a/panels/network/connection-editor/connection-editor.ui +++ b/panels/network/connection-editor/connection-editor.ui @@ -2,22 +2,16 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="NetConnectionEditor" parent="GtkDialog"> - <property name="can_focus">False</property> - <property name="border_width">0</property> <property name="resizable">False</property> <property name="modal">True</property> <property name="default_width">500</property> <property name="default_height">300</property> - <property name="type_hint">dialog</property> <!-- This doesn't seem to work for a template, so it is also hardcoded. --> <property name="use_header_bar">1</property> - <signal name="delete-event" handler="delete_event_cb" swapped="yes"/> + <signal name="close-request" handler="close_request_cb" swapped="yes"/> <child type="action"> <object class="GtkButton" id="cancel_button"> <property name="label" translatable="yes">_Cancel</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> <property name="use_underline">True</property> <signal name="clicked" handler="cancel_clicked_cb" object="NetConnectionEditor" swapped="yes"/> </object> @@ -25,83 +19,49 @@ <child type="action"> <object class="GtkButton" id="apply_button"> <property name="label" translatable="yes">_Apply</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">True</property> <property name="use_underline">True</property> <signal name="clicked" handler="apply_clicked_cb" object="NetConnectionEditor" swapped="yes"/> </object> </child> - <child internal-child="vbox"> + <child> <object class="GtkBox"> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">0</property> - <property name="border_width">0</property> <child> <object class="GtkStack" id="toplevel_stack"> - <property name="visible">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <child> <object class="GtkSpinner" id="spinner"> - <property name="visible">True</property> - <property name="active">True</property> + <property name="spinning">True</property> </object> </child> <child> <object class="GtkNotebook" id="notebook"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="show_border">False</property> </object> </child> <child> <object class="GtkBox" id="add_connection_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="vexpand">True</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> + <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="orientation">vertical</property> <child> - <object class="GtkFrame" id="add_connection_frame"> - <property name="width_request">300</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">in</property> + <object class="AdwBin" id="add_connection_frame"> + <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="width_request">300</property> <property name="valign">start</property> - <child> - <placeholder/> - </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> </object> - <packing> - <property name="expand">True</property> - <property name="position">0</property> - </packing> </child> </object> - <packing> - <property name="position">1</property> - </packing> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> </child> diff --git a/panels/network/connection-editor/details-page.ui b/panels/network/connection-editor/details-page.ui index 7dfabbe6d..109ee0a2e 100644 --- a/panels/network/connection-editor/details-page.ui +++ b/panels/network/connection-editor/details-page.ui @@ -2,8 +2,6 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="CEPageDetails" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_start">24</property> <property name="margin_end">24</property> <property name="margin_top">24</property> @@ -12,350 +10,310 @@ <property name="column_spacing">12</property> <child> <object class="GtkLabel" id="strength_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Signal Strength</property> <property name="mnemonic_widget">strength_label</property> + <layout> + <property name="column">0</property> + <property name="row">0</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="strength_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="xalign">0</property> <property name="label">Weak</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">0</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="speed_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Link speed</property> <property name="mnemonic_widget">speed_label</property> + <layout> + <property name="column">0</property> + <property name="row">1</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="speed_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">1Mb/sec</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">1</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="security_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Security</property> <property name="mnemonic_widget">security_label</property> + <layout> + <property name="column">0</property> + <property name="row">2</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv4_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">IPv4 Address</property> <property name="mnemonic_widget">ipv4_label</property> + <layout> + <property name="column">0</property> + <property name="row">3</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv6_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">IPv6 Address</property> <property name="mnemonic_widget">ipv6_label</property> + <layout> + <property name="column">0</property> + <property name="row">4</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="mac_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Hardware Address</property> <property name="mnemonic_widget">mac_label</property> + <layout> + <property name="column">0</property> + <property name="row">5</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="freq_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Supported Frequencies</property> <property name="mnemonic_widget">freq_label</property> + <layout> + <property name="column">0</property> + <property name="row">6</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="route_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Default Route</property> <property name="mnemonic_widget">route_label</property> + <layout> + <property name="column">0</property> + <property name="row">7</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns4_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="yalign">0</property> <property name="label" translatable="yes">DNS</property> <property name="mnemonic_widget">dns4_label</property> + <layout> + <property name="column">0</property> + <property name="row">8</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns6_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="yalign">0</property> <property name="label" translatable="yes">DNS</property> <property name="mnemonic_widget">dns6_label</property> + <layout> + <property name="column">0</property> + <property name="row">9</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">9</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="last_used_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Last Used</property> <property name="mnemonic_widget">last_used_label</property> + <layout> + <property name="column">0</property> + <property name="row">10</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">10</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="security_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">WPA</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">2</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv4_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">127.0.0.1</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv6_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">::1</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">4</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="mac_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">AA:BB:CC:DD:55:66:77:88</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">5</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="freq_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">2.4 GHz / 5 GHz</property> <property name="selectable">True</property> <property name="hexpand">True</property> + <layout> + <property name="column">1</property> + <property name="row">6</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="route_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">127.0.0.1</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">7</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">7</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns4_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="yalign">0</property> <property name="label">127.0.0.1</property> @@ -364,18 +322,16 @@ <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">8</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">8</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns6_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="yalign">0</property> <property name="label">::1</property> @@ -384,85 +340,74 @@ <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">9</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">9</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="last_used_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label">today</property> <property name="selectable">True</property> <property name="hexpand">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">10</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">10</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkCheckButton" id="auto_connect_check"> <property name="label" translatable="yes">Connect _automatically</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="valign">end</property> <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> <property name="margin_top">12</property> + <layout> + <property name="column">0</property> + <property name="row">11</property> + <property name="column-span">2</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">11</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkCheckButton" id="all_user_check"> <property name="label" translatable="yes">Make available to _other users</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> + <layout> + <property name="column">0</property> + <property name="row">12</property> + <property name="column-span">2</property> + <property name="row-span">1</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">12</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <!-- "Restrict Data Usage" section --> <child> <object class="GtkCheckButton" id="restrict_data_check"> - <property name="can_focus">True</property> <property name="margin_bottom">12</property> + <layout> + <property name="column">0</property> + <property name="row">13</property> + <property name="column-span">2</property> + <property name="row-span">1</property> + </layout> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="orientation">vertical</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">_Metered connection: has data limits or can incur charges</property> <property name="hexpand">True</property> @@ -472,8 +417,6 @@ <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Software updates and other large downloads will not be started automatically.</property> <property name="wrap">True</property> @@ -490,33 +433,25 @@ </child> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">13</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkButton" id="forget_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="use_underline">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="halign">end</property> <property name="valign">end</property> + <layout> + <property name="column">0</property> + <property name="row">14</property> + <property name="column-span">2</property> + <property name="row-span">1</property> + </layout> <style> <class name="destructive-action" /> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">14</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/connection-editor/ethernet-page.ui b/panels/network/connection-editor/ethernet-page.ui index 4f7331b31..ad4f2cbb3 100644 --- a/panels/network/connection-editor/ethernet-page.ui +++ b/panels/network/connection-editor/ethernet-page.ui @@ -7,8 +7,6 @@ <property name="page_increment">10</property> </object> <template class="CEPageEthernet" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_start">50</property> <property name="margin_end">50</property> <property name="margin_top">12</property> @@ -19,159 +17,105 @@ <property name="column_spacing">6</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Name</property> <property name="use_underline">True</property> <property name="mnemonic_widget">name_entry</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkEntry" id="name_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="invisible_char">●</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_MAC Address</property> <property name="use_underline">True</property> <property name="mnemonic_widget">mac_combo</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBoxText" id="mac_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="has_entry">True</property> <property name="entry_text_column">0</property> <property name="id_column">1</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBoxText" id="cloned_mac_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="has_entry">True</property> <property name="hexpand">True</property> <property name="active_id">0</property> + <layout> + <property name="column">1</property> + <property name="row">2</property> + </layout> <child internal-child="entry"> <object class="GtkEntry"> - <property name="can_focus">True</property> </object> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">M_TU</property> <property name="use_underline">True</property> <property name="mnemonic_widget">mtu_spin</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="valign">center</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Cloned Address</property> <property name="use_underline">True</property> <property name="mnemonic_widget">cloned_mac_combo</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="mtu_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">bytes</property> + <layout> + <property name="column">2</property> + <property name="row">3</property> + </layout> </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkSpinButton" id="mtu_spin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> <property name="adjustment">mtu_adjustment</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> </child> </template> </interface> diff --git a/panels/network/connection-editor/ip4-page.ui b/panels/network/connection-editor/ip4-page.ui index 714036b55..ce7934d9d 100644 --- a/panels/network/connection-editor/ip4-page.ui +++ b/panels/network/connection-editor/ip4-page.ui @@ -1,420 +1,313 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <template class="CEPageIP4" parent="GtkScrolledWindow"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> + <template class="CEPageIP4" parent="AdwBin"> <child> - <object class="GtkViewport"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkScrolledWindow"> + <property name="hscrollbar_policy">never</property> <child> - <object class="GtkGrid" id="main_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_start">24</property> - <property name="margin_end">24</property> - <property name="margin_top">24</property> - <property name="margin_bottom">24</property> - <property name="orientation">vertical</property> - <property name="row-spacing">6</property> - <property name="column-spacing">6</property> + <object class="GtkViewport"> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">IPv_4 Method</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">disabled_radio</property> - <property name="xalign">0.0</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="top-attach">0</property> - <property name="left-attach">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="automatic_radio"> - <property name="label" translatable="yes">Automatic (DHCP)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="top-attach">0</property> - <property name="left-attach">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="local_radio"> - <property name="label" translatable="yes">Link-Local Only</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">0</property> - <property name="left-attach">2</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="manual_radio"> - <property name="label" translatable="yes">Manual</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">1</property> - <property name="left-attach">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="disabled_radio"> - <property name="label" translatable="yes">Disable</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">1</property> - <property name="left-attach">2</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="shared_radio"> - <property name="label" translatable="yes">Shared to other computers</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">2</property> - <property name="left-attach">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="content_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkGrid" id="main_box"> + <property name="margin_start">24</property> + <property name="margin_end">24</property> + <property name="margin_top">24</property> + <property name="margin_bottom">24</property> <property name="orientation">vertical</property> - <property name="spacing">6</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">IPv_4 Method</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">disabled_radio</property> + <property name="xalign">0.0</property> + <layout> + <property name="row">0</property> + <property name="column">0</property> + </layout> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + <child> + <object class="GtkCheckButton" id="automatic_radio"> + <property name="label" translatable="yes">Automatic (DHCP)</property> + <layout> + <property name="row">0</property> + <property name="column">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="local_radio"> + <property name="label" translatable="yes">Link-Local Only</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">0</property> + <property name="column">2</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="manual_radio"> + <property name="label" translatable="yes">Manual</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">1</property> + <property name="column">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="disabled_radio"> + <property name="label" translatable="yes">Disable</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">1</property> + <property name="column">2</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="shared_radio"> + <property name="label" translatable="yes">Shared to other computers</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">2</property> + <property name="column">1</property> + </layout> + </object> + </child> <child> - <object class="GtkBox" id="address_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkBox" id="content_box"> <property name="orientation">vertical</property> + <property name="spacing">6</property> + <layout> + <property name="row">3</property> + <property name="column">0</property> + <property name="column-span">3</property> + </layout> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Addresses</property> - <property name="margin_top">24</property> - <property name="margin_bottom">8</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">horizontal</property> + <object class="GtkBox" id="address_box"> + <property name="orientation">vertical</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Address</property> - <style> - <class name="dim-label" /> - </style> + <property name="xalign">0</property> + <property name="label" translatable="yes">Addresses</property> + <property name="margin_top">24</property> + <property name="margin_bottom">8</property> <attributes> - <attribute name="scale" value="0.8"/> + <attribute name="weight" value="bold"/> </attributes> </object> </child> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkBox"> + <property name="orientation">horizontal</property> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Address</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Netmask</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Gateway</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + + <!-- This invisible box is used to add some width in the + end of the header row, assuming the space used by the + delete button in the rows --> + <child> + <object class="GtkBox" id="address_stub_box"> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <property name="margin_top">24</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="dns4_label"> <property name="hexpand">True</property> - <property name="label" translatable="yes">Netmask</property> - <style> - <class name="dim-label" /> - </style> + <property name="xalign">0</property> + <property name="label" translatable="yes">DNS</property> <attributes> - <attribute name="scale" value="0.8"/> + <attribute name="weight" value="bold"/> </attributes> </object> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Gateway</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> + <property name="xalign">1</property> + <property name="label" translatable="yes">Automatic</property> </object> </child> - - <!-- This invisible box is used to add some width in the - end of the header row, assuming the space used by the - delete button in the rows --> <child> - <object class="GtkBox" id="address_stub_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkSwitch" id="auto_dns_switch"> + <property name="halign">end</property> + <property name="valign">center</property> + <accessibility> + <property name="label" translatable="yes">Automatic DNS</property> + </accessibility> </object> </child> </object> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">24</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="dns4_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">DNS</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Automatic</property> - </object> - </child> <child> - <object class="GtkSwitch" id="auto_dns_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="halign">end</property> - <property name="valign">center</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Automatic DNS</property> - </object> - </child> + <object class="GtkEntry" id="dns_entry"> </object> </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="dns_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - </object> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Separate IP addresses with commas</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">24</property> - <property name="spacing">6</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Routes</property> + <property name="label" translatable="yes">Separate IP addresses with commas</property> + <style> + <class name="dim-label" /> + </style> <attributes> - <attribute name="weight" value="bold"/> + <attribute name="scale" value="0.8"/> </attributes> </object> </child> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Automatic</property> - </object> - </child> - <child> - <object class="GtkSwitch" id="auto_routes_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="halign">end</property> - <property name="valign">center</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Automatic Routes</property> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkBox" id="routes_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">horizontal</property> - <child> - <object class="GtkLabel" id="routes_address_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Address</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> - </object> - </child> + <property name="margin_top">24</property> + <property name="spacing">6</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="xalign">0</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Netmask</property> - <style> - <class name="dim-label" /> - </style> + <property name="label" translatable="yes">Routes</property> <attributes> - <attribute name="scale" value="0.8"/> + <attribute name="weight" value="bold"/> </attributes> </object> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Gateway</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> + <property name="xalign">1</property> + <property name="label" translatable="yes">Automatic</property> </object> </child> <child> - <object class="GtkLabel" id="routes_metric_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" comments="Translators: Please see https://en.wikipedia.org/wiki/Metrics_(networking)">Metric</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> + <object class="GtkSwitch" id="auto_routes_switch"> + <property name="halign">end</property> + <property name="valign">center</property> + <accessibility> + <property name="label" translatable="yes">Automatic Routes</property> + </accessibility> </object> </child> - - <!-- This invisible box is used to add some width in the - end of the header row, assuming the space used by the - delete button in the rows --> + </object> + </child> + <child> + <object class="GtkBox" id="routes_box"> + <property name="orientation">vertical</property> <child> - <object class="GtkBox" id="routes_stub_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkBox"> + <property name="orientation">horizontal</property> + <child> + <object class="GtkLabel" id="routes_address_label"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Address</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Netmask</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Gateway</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel" id="routes_metric_label"> + <property name="label" translatable="yes" comments="Translators: Please see https://en.wikipedia.org/wiki/Metrics_(networking)">Metric</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + + <!-- This invisible box is used to add some width in the + end of the header row, assuming the space used by the + delete button in the rows --> + <child> + <object class="GtkBox" id="routes_stub_box"> + </object> + </child> </object> </child> </object> </child> + <child> + <object class="GtkCheckButton" id="never_default_check"> + <property name="label" translatable="yes">Use this connection _only for resources on its network</property> + <property name="use_underline">True</property> + </object> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">6</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="never_default_check"> - <property name="label" translatable="yes">Use this connection _only for resources on its network</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">7</property> - </packing> </child> </object> - <packing> - <property name="top-attach">3</property> - <property name="left-attach">0</property> - <property name="width">3</property> - </packing> </child> </object> </child> diff --git a/panels/network/connection-editor/ip6-page.ui b/panels/network/connection-editor/ip6-page.ui index 06044c468..c6ec8f525 100644 --- a/panels/network/connection-editor/ip6-page.ui +++ b/panels/network/connection-editor/ip6-page.ui @@ -1,434 +1,322 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <template class="CEPageIP6" parent="GtkScrolledWindow"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> + <template class="CEPageIP6" parent="AdwBin">column <child> - <object class="GtkViewport"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkScrolledWindow"> + <property name="hscrollbar_policy">never</property> <child> - <object class="GtkGrid" id="main_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_start">24</property> - <property name="margin_end">24</property> - <property name="margin_top">24</property> - <property name="margin_bottom">24</property> - <property name="orientation">vertical</property> - <property name="row-spacing">6</property> - <property name="column-spacing">6</property> + <object class="GtkViewport"> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">IPv_6 Method</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">disabled_radio</property> - <property name="xalign">0.0</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="top-attach">0</property> - <property name="left-attach">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="automatic_radio"> - <property name="label" translatable="yes">Automatic</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="top-attach">0</property> - <property name="left-attach">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="dhcp_radio"> - <property name="label" translatable="yes">Automatic, DHCP only</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">0</property> - <property name="left-attach">2</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="local_radio"> - <property name="label" translatable="yes">Link-Local Only</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">1</property> - <property name="left-attach">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="manual_radio"> - <property name="label" translatable="yes">Manual</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">1</property> - <property name="left-attach">2</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="disabled_radio"> - <property name="label" translatable="yes">Disable</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">2</property> - <property name="left-attach">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="shared_radio"> - <property name="label" translatable="yes">Shared to other computers</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_radio</property> - </object> - <packing> - <property name="top-attach">2</property> - <property name="left-attach">2</property> - </packing> - </child> - <child> - <object class="GtkBox" id="content_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkGrid" id="main_box"> + <property name="margin_start">24</property> + <property name="margin_end">24</property> + <property name="margin_top">24</property> + <property name="margin_bottom">24</property> <property name="orientation">vertical</property> - <property name="spacing">6</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> <child> - <object class="GtkBox" id="address_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkLabel"> + <property name="label" translatable="yes">IPv_6 Method</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">disabled_radio</property> + <property name="xalign">0.0</property> + <layout> + <property name="row">0</property> + <property name="column">0</property> + </layout> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + <child> + <object class="GtkCheckButton" id="automatic_radio"> + <property name="label" translatable="yes">Automatic</property> + <layout> + <property name="row">0</property> + <property name="column">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="dhcp_radio"> + <property name="label" translatable="yes">Automatic, DHCP only</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">0</property> + <property name="column">2</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="local_radio"> + <property name="label" translatable="yes">Link-Local Only</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">1</property> + <property name="column">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="manual_radio"> + <property name="label" translatable="yes">Manual</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">1</property> + <property name="column">2</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="disabled_radio"> + <property name="label" translatable="yes">Disable</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">2</property> + <property name="column">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkCheckButton" id="shared_radio"> + <property name="label" translatable="yes">Shared to other computers</property> + <property name="group">automatic_radio</property> + <layout> + <property name="row">2</property> + <property name="column">2</property> + </layout> + </object> + </child> + <child> + <object class="GtkBox" id="content_box"> <property name="orientation">vertical</property> + <property name="spacing">6</property> + <layout> + <property name="row">3</property> + <property name="column">0</property> + <property name="column-span">3</property> + </layout> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Addresses</property> - <property name="margin_top">24</property> - <property name="margin_bottom">8</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">horizontal</property> + <object class="GtkBox" id="address_box"> + <property name="orientation">vertical</property> <child> - <object class="GtkLabel" id="address_address_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Address</property> - <style> - <class name="dim-label" /> - </style> + <object class="GtkLabel"> + <property name="xalign">0</property> + <property name="label" translatable="yes">Addresses</property> + <property name="margin_top">24</property> + <property name="margin_bottom">8</property> <attributes> - <attribute name="scale" value="0.8"/> + <attribute name="weight" value="bold"/> </attributes> </object> </child> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkBox"> + <property name="orientation">horizontal</property> + <child> + <object class="GtkLabel" id="address_address_label"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Address</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Prefix</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Gateway</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + + <!-- This invisible box is used to add some width in the + end of the header row, assuming the space used by the + delete button in the rows --> + <child> + <object class="GtkBox" id="address_stub_box"> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <property name="margin_top">24</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="dns6_label"> <property name="hexpand">True</property> - <property name="label" translatable="yes">Prefix</property> - <style> - <class name="dim-label" /> - </style> + <property name="xalign">0</property> + <property name="label" translatable="yes">DNS</property> <attributes> - <attribute name="scale" value="0.8"/> + <attribute name="weight" value="bold"/> </attributes> </object> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Gateway</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> + <property name="xalign">1</property> + <property name="label" translatable="yes">Automatic</property> </object> </child> - - <!-- This invisible box is used to add some width in the - end of the header row, assuming the space used by the - delete button in the rows --> <child> - <object class="GtkBox" id="address_stub_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkSwitch" id="auto_dns_switch"> + <property name="halign">end</property> + <property name="valign">center</property> + <accessibility> + <property name="label" translatable="yes">Automatic DNS</property> + </accessibility> </object> </child> </object> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">24</property> - <property name="spacing">6</property> <child> - <object class="GtkLabel" id="dns6_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">DNS</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Automatic</property> - </object> - </child> - <child> - <object class="GtkSwitch" id="auto_dns_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="halign">end</property> - <property name="valign">center</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Automatic DNS</property> - </object> - </child> - </object> + <object class="GtkEntry" id="dns_entry" /> </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="dns_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - </object> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Separate IP addresses with commas</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">24</property> - <property name="spacing">6</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Routes</property> + <property name="label" translatable="yes">Separate IP addresses with commas</property> + <style> + <class name="dim-label" /> + </style> <attributes> - <attribute name="weight" value="bold"/> + <attribute name="scale" value="0.8"/> </attributes> </object> </child> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Automatic</property> - </object> - </child> - <child> - <object class="GtkSwitch" id="auto_routes_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="halign">end</property> - <property name="valign">center</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Automatic Routes</property> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkBox" id="routes_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">horizontal</property> - <child> - <object class="GtkLabel" id="routes_address_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Address</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> - </object> - </child> + <property name="margin_top">24</property> + <property name="spacing">6</property> <child> - <object class="GtkLabel" id="routes_prefix_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkLabel"> + <property name="xalign">0</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Prefix</property> - <style> - <class name="dim-label" /> - </style> + <property name="label" translatable="yes">Routes</property> <attributes> - <attribute name="scale" value="0.8"/> + <attribute name="weight" value="bold"/> </attributes> </object> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Gateway</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> + <property name="xalign">1</property> + <property name="label" translatable="yes">Automatic</property> </object> </child> <child> - <object class="GtkLabel" id="routes_metric_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" comments="Translators: Please see https://en.wikipedia.org/wiki/Metrics_(networking)">Metric</property> - <style> - <class name="dim-label" /> - </style> - <attributes> - <attribute name="scale" value="0.8"/> - </attributes> + <object class="GtkSwitch" id="auto_routes_switch"> + <property name="halign">end</property> + <property name="valign">center</property> + <accessibility> + <property name="label" translatable="yes">Automatic Routes</property> + </accessibility> </object> </child> - - <!-- This invisible box is used to add some width in the - end of the header row, assuming the space used by the - delete button in the rows --> + </object> + </child> + <child> + <object class="GtkBox" id="routes_box"> + <property name="orientation">vertical</property> <child> - <object class="GtkBox" id="routes_stub_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="GtkBox"> + <property name="orientation">horizontal</property> + <child> + <object class="GtkLabel" id="routes_address_label"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Address</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel" id="routes_prefix_label"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Prefix</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Gateway</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + <child> + <object class="GtkLabel" id="routes_metric_label"> + <property name="label" translatable="yes" comments="Translators: Please see https://en.wikipedia.org/wiki/Metrics_(networking)">Metric</property> + <style> + <class name="dim-label" /> + </style> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> + </object> + </child> + + <!-- This invisible box is used to add some width in the + end of the header row, assuming the space used by the + delete button in the rows --> + <child> + <object class="GtkBox" id="routes_stub_box"> + </object> + </child> </object> </child> </object> </child> + <child> + <object class="GtkCheckButton" id="never_default_check"> + <property name="label" translatable="yes">Use this connection _only for resources on its network</property> + <property name="use_underline">True</property> + </object> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">6</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="never_default_check"> - <property name="label" translatable="yes">Use this connection _only for resources on its network</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">7</property> - </packing> </child> </object> - <packing> - <property name="top-attach">3</property> - <property name="left-attach">0</property> - <property name="width">3</property> - </packing> </child> </object> </child> diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c index 505b8ee25..4b7fadc25 100644 --- a/panels/network/connection-editor/net-connection-editor.c +++ b/panels/network/connection-editor/net-connection-editor.c @@ -26,7 +26,6 @@ #include <NetworkManager.h> -#include "list-box-helper.h" #include "net-connection-editor.h" #include "net-connection-editor-resources.h" #include "ce-page.h" @@ -53,7 +52,7 @@ struct _NetConnectionEditor GtkDialog parent; GtkBox *add_connection_box; - GtkFrame *add_connection_frame; + AdwBin *add_connection_frame; GtkButton *apply_button; GtkButton *cancel_button; GtkNotebook *notebook; @@ -87,7 +86,7 @@ cancel_editing (NetConnectionEditor *self) } static void -delete_event_cb (NetConnectionEditor *self) +close_request_cb (NetConnectionEditor *self) { cancel_editing (self); } @@ -226,8 +225,8 @@ net_connection_editor_class_init (NetConnectionEditorClass *class) gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, notebook); gtk_widget_class_bind_template_child (widget_class, NetConnectionEditor, toplevel_stack); - gtk_widget_class_bind_template_callback (widget_class, delete_event_cb); gtk_widget_class_bind_template_callback (widget_class, cancel_clicked_cb); + gtk_widget_class_bind_template_callback (widget_class, close_request_cb); gtk_widget_class_bind_template_callback (widget_class, apply_clicked_cb); } @@ -255,9 +254,7 @@ net_connection_editor_error_dialog (NetConnectionEditor *self, "%s", secondary_text); } - g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_destroy), NULL); - g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); - gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_window_present (GTK_WINDOW (dialog)); } static void @@ -323,7 +320,7 @@ update_sensitivity (NetConnectionEditor *self) { NMSettingConnection *sc; gboolean sensitive; - GList *pages; + gint i; if (!editor_is_initialized (self)) return; @@ -336,10 +333,9 @@ update_sensitivity (NetConnectionEditor *self) sensitive = self->can_modify; } - pages = gtk_container_get_children (GTK_CONTAINER (self->notebook)); - for (GList *l = pages; l; l = l->next) { - CEPage *page = l->data; - gtk_widget_set_sensitive (GTK_WIDGET (page), sensitive); + for (i = 0; i < gtk_notebook_get_n_pages (self->notebook); i++) { + GtkWidget *page = gtk_notebook_get_nth_page (self->notebook, i); + gtk_widget_set_sensitive (page, sensitive); } } @@ -347,15 +343,14 @@ static void validate (NetConnectionEditor *self) { gboolean valid = FALSE; - GList *pages; + gint i; if (!editor_is_initialized (self)) goto done; valid = TRUE; - pages = gtk_container_get_children (GTK_CONTAINER (self->notebook)); - for (GList *l = pages; l; l = l->next) { - CEPage *page = l->data; + for (i = 0; i < gtk_notebook_get_n_pages (self->notebook); i++) { + CEPage *page = CE_PAGE (gtk_notebook_get_nth_page (self->notebook, i)); g_autoptr(GError) error = NULL; if (!ce_page_validate (page, self->connection, &error)) { @@ -406,18 +401,16 @@ page_initialized (NetConnectionEditor *self, GError *error, CEPage *page) { GtkWidget *label; gint position; - GList *children, *l; gint i; position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (page), "position")); g_object_set_data (G_OBJECT (page), "position", GINT_TO_POINTER (position)); - children = gtk_container_get_children (GTK_CONTAINER (self->notebook)); - for (l = children, i = 0; l; l = l->next, i++) { - gint pos = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (l->data), "position")); + for (i = 0; i < gtk_notebook_get_n_pages (self->notebook); i++) { + GtkWidget *page = gtk_notebook_get_nth_page (self->notebook, i); + gint pos = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (page), "position")); if (pos > position) break; } - g_list_free (children); label = gtk_label_new (ce_page_get_title (page)); @@ -608,11 +601,7 @@ complete_vpn_connection (NetConnectionEditor *self, NMConnection *connection) static void finish_add_connection (NetConnectionEditor *self, NMConnection *connection) { - GtkBin *frame; - - frame = GTK_BIN (self->add_connection_frame); - gtk_widget_destroy (gtk_bin_get_child (frame)); - + adw_bin_set_child (self->add_connection_frame, NULL); gtk_stack_set_visible_child (self->toplevel_stack, GTK_WIDGET (self->notebook)); gtk_widget_show (GTK_WIDGET (self->apply_button)); @@ -664,18 +653,16 @@ static void select_vpn_type (NetConnectionEditor *self, GtkListBox *list) { GSList *vpn_plugins, *iter; - GList *l; - GList *children; GtkWidget *row, *row_box; GtkWidget *name_label, *desc_label; + GtkWidget *child; /* Get the available VPN types */ vpn_plugins = vpn_get_plugins (); /* Remove the previous menu contents */ - children = gtk_container_get_children (GTK_CONTAINER (list)); - for (l = children; l != NULL; l = l->next) - gtk_widget_destroy (l->data); + while ((child = gtk_widget_get_first_child (GTK_WIDGET (list))) != NULL) + gtk_list_box_remove (list, child); /* Add the VPN types */ for (iter = vpn_plugins; iter; iter = iter->next) { @@ -684,7 +671,6 @@ select_vpn_type (NetConnectionEditor *self, GtkListBox *list) g_autofree gchar *desc = NULL; g_autofree gchar *desc_markup = NULL; g_autofree gchar *service_name = NULL; - GtkStyleContext *context; g_object_get (plugin, NM_VPN_EDITOR_PLUGIN_NAME, &name, @@ -703,20 +689,18 @@ select_vpn_type (NetConnectionEditor *self, GtkListBox *list) name_label = gtk_label_new (name); gtk_widget_set_halign (name_label, GTK_ALIGN_START); - gtk_box_pack_start (GTK_BOX (row_box), name_label, FALSE, TRUE, 0); + gtk_box_append (GTK_BOX (row_box), name_label); desc_label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (desc_label), desc_markup); - gtk_label_set_line_wrap (GTK_LABEL (desc_label), TRUE); + gtk_label_set_wrap (GTK_LABEL (desc_label), TRUE); gtk_widget_set_halign (desc_label, GTK_ALIGN_START); - context = gtk_widget_get_style_context (desc_label); - gtk_style_context_add_class (context, "dim-label"); - gtk_box_pack_start (GTK_BOX (row_box), desc_label, FALSE, TRUE, 0); + gtk_widget_add_css_class (desc_label, "dim-label"); + gtk_box_append (GTK_BOX (row_box), desc_label); - gtk_container_add (GTK_CONTAINER (row), row_box); - gtk_widget_show_all (row); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_box); g_object_set_data_full (G_OBJECT (row), "service_name", g_steal_pointer (&service_name), g_free); - gtk_container_add (GTK_CONTAINER (list), row); + gtk_list_box_append (list, row); } /* Import */ @@ -730,12 +714,11 @@ select_vpn_type (NetConnectionEditor *self, GtkListBox *list) name_label = gtk_label_new (_("Import from file…")); gtk_widget_set_halign (name_label, GTK_ALIGN_START); - gtk_box_pack_start (GTK_BOX (row_box), name_label, FALSE, TRUE, 0); + gtk_box_append (GTK_BOX (row_box), name_label); - gtk_container_add (GTK_CONTAINER (row), row_box); - gtk_widget_show_all (row); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_box); g_object_set_data (G_OBJECT (row), "service_name", "import"); - gtk_container_add (GTK_CONTAINER (list), row); + gtk_list_box_append (list, row); g_signal_connect_object (list, "row-activated", G_CALLBACK (vpn_type_activated), self, G_CONNECT_SWAPPED); @@ -744,19 +727,14 @@ select_vpn_type (NetConnectionEditor *self, GtkListBox *list) static void net_connection_editor_add_connection (NetConnectionEditor *self) { - GtkContainer *frame; GtkListBox *list; - frame = GTK_CONTAINER (self->add_connection_frame); - list = GTK_LIST_BOX (gtk_list_box_new ()); gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE); - gtk_list_box_set_header_func (list, cc_list_box_update_header_func, NULL, NULL); select_vpn_type (self, list); - gtk_widget_show_all (GTK_WIDGET (list)); - gtk_container_add (frame, GTK_WIDGET (list)); + adw_bin_set_child (self->add_connection_frame, GTK_WIDGET (list)); gtk_stack_set_visible_child (self->toplevel_stack, GTK_WIDGET (self->add_connection_box)); gtk_widget_hide (GTK_WIDGET (self->apply_button)); diff --git a/panels/network/connection-editor/security-page.ui b/panels/network/connection-editor/security-page.ui index f35c2502d..9a1c0debe 100644 --- a/panels/network/connection-editor/security-page.ui +++ b/panels/network/connection-editor/security-page.ui @@ -2,8 +2,6 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="CEPageSecurity" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_start">50</property> <property name="margin_end">50</property> <property name="margin_top">12</property> @@ -14,48 +12,34 @@ <property name="column_spacing">6</property> <child> <object class="GtkLabel" id="security_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">S_ecurity</property> <property name="use_underline">True</property> <property name="mnemonic_widget">security_combo</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBox" id="security_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkBox" id="box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> + <layout> + <property name="column">0</property> + <property name="row">1</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/connection-editor/vpn-helpers.c b/panels/network/connection-editor/vpn-helpers.c index 8ef486bb9..81ff4a2b8 100644 --- a/panels/network/connection-editor/vpn-helpers.c +++ b/panels/network/connection-editor/vpn-helpers.c @@ -97,6 +97,56 @@ vpn_get_plugins (void) return plugins; } + +typedef struct { + GMainLoop *mainloop; + gint response; +} RunData; + +static void +on_dialog_close_request_cb (GtkDialog *dialog, + gint response, + RunData *data) +{ + data->response = GTK_RESPONSE_CLOSE; + g_main_loop_quit (data->mainloop); +} + +static void +on_dialog_response_cb (GtkDialog *dialog, + gint response, + RunData *data) +{ + data->response = response; + g_main_loop_quit (data->mainloop); +} + +static int +run_dialog (GtkDialog *dialog) +{ + g_autoptr(GMainLoop) mainloop = NULL; + RunData run_data; + gulong response_id; + gulong close_id; + + mainloop = g_main_loop_new (NULL, FALSE); + run_data = (RunData) { + .response = GTK_RESPONSE_CLOSE, + .mainloop = mainloop, + }; + + close_id = g_signal_connect (dialog, "close-request", G_CALLBACK (on_dialog_close_request_cb), &run_data); + response_id = g_signal_connect_swapped (dialog, "response", G_CALLBACK (on_dialog_response_cb), &run_data); + + gtk_window_present (GTK_WINDOW (dialog)); + g_main_loop_run (mainloop); + + g_clear_signal_handler (&close_id, dialog); + g_clear_signal_handler (&response_id, dialog); + + return run_data.response; +} + typedef struct { VpnImportCallback callback; gpointer user_data; @@ -106,6 +156,7 @@ static void import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data) { g_autofree gchar *filename = NULL; + g_autoptr(GFile) file = NULL; ActionInfo *info = (ActionInfo *) user_data; NMConnection *connection = NULL; g_autoptr(GError) error = NULL; @@ -114,12 +165,13 @@ import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data) if (response != GTK_RESPONSE_ACCEPT) goto out; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - if (!filename) { + file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); + if (!file) { g_warning ("%s: didn't get a filename back from the chooser!", __func__); goto out; } + filename = g_file_get_path (file); for (iter = vpn_get_plugins (); !connection && iter; iter = iter->next) { NMVpnEditorPlugin *plugin; @@ -140,35 +192,33 @@ import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (err_dialog), _("The file “%s” could not be read or does not contain recognized VPN connection information\n\nError: %s."), bname, error ? error->message : "unknown error"); - g_signal_connect (err_dialog, "delete-event", G_CALLBACK (gtk_widget_destroy), NULL); - g_signal_connect (err_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); - gtk_dialog_run (GTK_DIALOG (err_dialog)); + run_dialog (GTK_DIALOG (err_dialog)); } out: - gtk_widget_hide (dialog); - gtk_widget_destroy (dialog); + gtk_window_destroy (GTK_WINDOW (dialog)); info->callback (connection, info->user_data); g_free (info); } -static void +static gboolean destroy_import_chooser (GtkWidget *dialog, gpointer user_data) { ActionInfo *info = (ActionInfo *) user_data; - gtk_widget_destroy (dialog); info->callback (NULL, info->user_data); g_free (info); + + return FALSE; } void vpn_import (GtkWindow *parent, VpnImportCallback callback, gpointer user_data) { + g_autoptr(GFile) home_folder = NULL; GtkWidget *dialog; ActionInfo *info; - const char *home_folder; dialog = gtk_file_chooser_dialog_new (_("Select file to import"), parent, @@ -177,16 +227,15 @@ vpn_import (GtkWindow *parent, VpnImportCallback callback, gpointer user_data) _("_Open"), GTK_RESPONSE_ACCEPT, NULL); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - home_folder = g_get_home_dir (); - gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), home_folder); + home_folder = g_file_new_for_path (g_get_home_dir ()); + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), home_folder, NULL); info = g_malloc0 (sizeof (ActionInfo)); info->callback = callback; info->user_data = user_data; - g_signal_connect (G_OBJECT (dialog), "close", G_CALLBACK (destroy_import_chooser), info); + g_signal_connect (G_OBJECT (dialog), "close-request", G_CALLBACK (destroy_import_chooser), info); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (import_vpn_from_file_cb), info); - gtk_widget_show_all (dialog); gtk_window_present (GTK_WINDOW (dialog)); } @@ -194,6 +243,7 @@ static void export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data) { g_autoptr(NMConnection) connection = NM_CONNECTION (user_data); + g_autoptr(GFile) file = NULL; char *filename = NULL; g_autoptr(GError) error = NULL; NMVpnEditorPlugin *plugin; @@ -206,12 +256,13 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data) if (response != GTK_RESPONSE_ACCEPT) goto out; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - if (!filename) { + file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); + if (!file) { g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "no filename"); goto done; } + filename = g_file_get_path (file); if (g_file_test (filename, G_FILE_TEST_EXISTS)) { int replace_response; GtkWidget *replace_dialog; @@ -227,8 +278,8 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data) gtk_dialog_add_buttons (GTK_DIALOG (replace_dialog), _("_Replace"), GTK_RESPONSE_OK, NULL); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (replace_dialog), _("Do you want to replace %s with the VPN connection you are saving?"), bname); - replace_response = gtk_dialog_run (GTK_DIALOG (replace_dialog)); - gtk_widget_destroy (replace_dialog); + replace_response = run_dialog (GTK_DIALOG (replace_dialog)); + gtk_window_destroy (GTK_WINDOW (replace_dialog)); if (replace_response != GTK_RESPONSE_OK) goto out; } @@ -265,25 +316,21 @@ done: gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (err_dialog), _("The VPN connection “%s” could not be exported to %s.\n\nError: %s."), id ? id : "(unknown)", bname, error ? error->message : "unknown error"); - g_signal_connect (err_dialog, "delete-event", G_CALLBACK (gtk_widget_destroy), NULL); - g_signal_connect (err_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); - gtk_widget_show_all (err_dialog); - gtk_window_present (GTK_WINDOW (err_dialog)); + run_dialog (GTK_DIALOG (err_dialog)); } out: - gtk_widget_hide (dialog); - gtk_widget_destroy (dialog); + gtk_window_destroy (GTK_WINDOW (dialog)); } void vpn_export (NMConnection *connection) { + g_autoptr(GFile) home_folder = NULL; GtkWidget *dialog; NMVpnEditorPlugin *plugin; NMSettingVpn *s_vpn = NULL; const char *service_type; - const char *home_folder; s_vpn = nm_connection_get_setting_vpn (connection); service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL; @@ -299,8 +346,8 @@ vpn_export (NMConnection *connection) _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); - home_folder = g_get_home_dir (); - gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), home_folder); + home_folder = g_file_new_for_path (g_get_home_dir ()); + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), home_folder, NULL); plugin = vpn_get_plugin_by_service (service_type); if (plugin) { @@ -311,8 +358,6 @@ vpn_export (NMConnection *connection) gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested); } - g_signal_connect (G_OBJECT (dialog), "close", G_CALLBACK (gtk_widget_destroy), NULL); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (export_vpn_to_file_cb), g_object_ref (connection)); - gtk_widget_show_all (dialog); gtk_window_present (GTK_WINDOW (dialog)); } diff --git a/panels/network/connection-editor/vpn-page.ui b/panels/network/connection-editor/vpn-page.ui index 682e7a707..98f801ba7 100644 --- a/panels/network/connection-editor/vpn-page.ui +++ b/panels/network/connection-editor/vpn-page.ui @@ -2,8 +2,6 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="CEPageVpn" parent="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_start">50</property> <property name="margin_end">50</property> <property name="margin_top">12</property> @@ -12,59 +10,32 @@ <property name="spacing">10</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="spacing">6</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Name</property> <property name="use_underline">True</property> <property name="mnemonic_widget">name_entry</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> <child> <object class="GtkEntry" id="name_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="hexpand">True</property> <property name="invisible_char">●</property> <property name="invisible_char_set">True</property> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> <child> <object class="GtkLabel" id="failure_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">(Error: unable to load VPN connection editor)</property> <attributes> <attribute name="style" value="italic"/> </attributes> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> </child> </template> </interface> diff --git a/panels/network/connection-editor/wifi-page.ui b/panels/network/connection-editor/wifi-page.ui index e15678040..6662b8f0c 100644 --- a/panels/network/connection-editor/wifi-page.ui +++ b/panels/network/connection-editor/wifi-page.ui @@ -2,8 +2,6 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="CEPageWifi" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_start">50</property> <property name="margin_end">50</property> <property name="margin_top">12</property> @@ -14,131 +12,98 @@ <property name="column_spacing">6</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_SSID</property> <property name="use_underline">True</property> <property name="mnemonic_widget">ssid_entry</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_BSSID</property> <property name="use_underline">True</property> <property name="mnemonic_widget">bssid_combo</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkEntry" id="ssid_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">●</property> <property name="invisible_char_set">True</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_MAC Address</property> <property name="use_underline">True</property> <property name="mnemonic_widget">mac_combo</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBoxText" id="cloned_mac_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="has_entry">True</property> <property name="hexpand">True</property> <property name="active_id">0</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + </layout> <child internal-child="entry"> <object class="GtkEntry"> - <property name="can_focus">True</property> </object> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">_Cloned Address</property> <property name="use_underline">True</property> <property name="mnemonic_widget">cloned_mac_combo</property> + <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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBoxText" id="bssid_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="has_entry">True</property> <property name="entry_text_column">0</property> <property name="id_column">1</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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBoxText" id="mac_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="has_entry">True</property> <property name="entry_text_column">0</property> <property name="id_column">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> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c index a4c3a7275..81e4687d9 100644 --- a/panels/network/net-device-ethernet.c +++ b/panels/network/net-device-ethernet.c @@ -23,12 +23,11 @@ #include <glib-object.h> #include <glib/gi18n.h> -#include <handy.h> +#include <adwaita.h> #include <NetworkManager.h> #include "panel-common.h" -#include "list-box-helper.h" #include "connection-editor/net-connection-editor.h" #include "connection-editor/ce-page.h" @@ -40,8 +39,8 @@ struct _NetDeviceEthernet GtkListBox *connection_list; GtkButton *details_button; - GtkFrame *details_frame; - HdyActionRow *details_row; + GtkListBox *details_listbox; + AdwActionRow *details_row; GtkLabel *device_label; GtkSwitch *device_off_switch; GtkScrolledWindow *scrolled_window; @@ -221,7 +220,7 @@ device_ethernet_refresh_ui (NetDeviceEthernet *self) } } status = panel_device_status_to_localized_string (self->device, speed_text); - hdy_preferences_row_set_title (HDY_PREFERENCES_ROW (self->details_row), status); + adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->details_row), status); populate_ui (self); } @@ -243,7 +242,7 @@ show_details (NetDeviceEthernet *self, GtkButton *button, const gchar *title) connection = NM_CONNECTION (g_object_get_data (G_OBJECT (row), "connection")); editor = net_connection_editor_new (connection, self->device, NULL, self->client); - gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); + gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self)))); if (title) net_connection_editor_set_title (editor, title); g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED); @@ -276,7 +275,6 @@ add_row (NetDeviceEthernet *self, NMConnection *connection) GtkWidget *details; NMActiveConnection *aconn; gboolean active; - GtkWidget *image; active = FALSE; @@ -290,25 +288,25 @@ add_row (NetDeviceEthernet *self, NMConnection *connection) row = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start (GTK_BOX (row), box, FALSE, TRUE, 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_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0); + gtk_box_append (GTK_BOX (box), widget); if (active) { - widget = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU); + 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_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0); + 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_pack_start (GTK_BOX (row), details, FALSE, TRUE, 0); + gtk_box_append (GTK_BOX (row), details); add_details (details, self->device, connection); } @@ -316,31 +314,26 @@ add_row (NetDeviceEthernet *self, NMConnection *connection) /* filler */ widget = gtk_label_new (""); gtk_widget_set_hexpand (widget, TRUE); - gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0); + gtk_box_append (GTK_BOX (box), widget); - image = gtk_image_new_from_icon_name ("emblem-system-symbolic", GTK_ICON_SIZE_MENU); - gtk_widget_show (image); - widget = gtk_button_new (); - gtk_style_context_add_class (gtk_widget_get_style_context (widget), "image-button"); + 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_show (widget); - gtk_container_add (GTK_CONTAINER (widget), image); gtk_widget_set_halign (widget, GTK_ALIGN_CENTER); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); - atk_object_set_name (gtk_widget_get_accessible (widget), _("Options…")); - gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0); + 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); - gtk_widget_show_all (row); - g_object_set_data (G_OBJECT (row), "connection", connection); - gtk_container_add (GTK_CONTAINER (self->connection_list), row); + gtk_list_box_append (self->connection_list, row); } static void @@ -353,16 +346,13 @@ connection_removed (NetDeviceEthernet *self, NMRemoteConnection *connection) static void populate_ui (NetDeviceEthernet *self) { - GList *children, *c; GSList *connections, *l; NMConnection *connection; + GtkWidget *child; gint n_connections; - children = gtk_container_get_children (GTK_CONTAINER (self->connection_list)); - for (c = children; c; c = c->next) { - gtk_container_remove (GTK_CONTAINER (self->connection_list), c->data); - } - g_list_free (children); + while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->connection_list))) != NULL) + gtk_list_box_remove (self->connection_list, child); connections = net_device_get_valid_connections (self->client, self->device); for (l = connections; l; l = l->next) { @@ -374,7 +364,7 @@ populate_ui (NetDeviceEthernet *self) n_connections = g_slist_length (connections); if (n_connections > 1) { - gtk_widget_hide (GTK_WIDGET (self->details_frame)); + gtk_widget_hide (GTK_WIDGET (self->details_listbox)); for (l = connections; l; l = l->next) { NMConnection *connection = l->data; add_row (self, connection); @@ -383,13 +373,13 @@ populate_ui (NetDeviceEthernet *self) } else if (n_connections == 1) { connection = connections->data; gtk_widget_hide (GTK_WIDGET (self->scrolled_window)); - gtk_widget_show_all (GTK_WIDGET (self->details_frame)); + gtk_widget_show (GTK_WIDGET (self->details_listbox)); g_object_set_data (G_OBJECT (self->details_button), "row", self->details_button); g_object_set_data (G_OBJECT (self->details_button), "connection", connection); } else { gtk_widget_hide (GTK_WIDGET (self->scrolled_window)); - gtk_widget_hide (GTK_WIDGET (self->details_frame)); + gtk_widget_hide (GTK_WIDGET (self->details_listbox)); } g_slist_free (connections); @@ -430,7 +420,7 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self) nm_connection_add_setting (connection, nm_setting_wired_new ()); editor = net_connection_editor_new (connection, self->device, NULL, self->client); - gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); + gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self)))); g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED); gtk_window_present (GTK_WINDOW (editor)); } @@ -460,12 +450,14 @@ static void connection_list_row_activated_cb (NetDeviceEthernet *self, GtkListBoxRow *row) { NMConnection *connection; + GtkWidget *child; if (!NM_IS_DEVICE_ETHERNET (self->device) || !nm_device_ethernet_get_carrier (NM_DEVICE_ETHERNET (self->device))) return; - connection = NM_CONNECTION (g_object_get_data (G_OBJECT (gtk_bin_get_child (GTK_BIN (row))), "connection")); + child = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row)); + connection = NM_CONNECTION (g_object_get_data (G_OBJECT (child), "connection")); nm_client_activate_connection_async (self->client, connection, @@ -497,7 +489,7 @@ net_device_ethernet_class_init (NetDeviceEthernetClass *klass) gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, connection_list); gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_button); - gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, details_frame); + 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_label); gtk_widget_class_bind_template_child (widget_class, NetDeviceEthernet, device_off_switch); @@ -515,8 +507,6 @@ net_device_ethernet_init (NetDeviceEthernet *self) gtk_widget_init_template (GTK_WIDGET (self)); self->connections = g_hash_table_new (NULL, NULL); - - gtk_list_box_set_header_func (self->connection_list, cc_list_box_update_header_func, NULL, NULL); } NetDeviceEthernet * diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c index 886180ebc..5dc677d91 100644 --- a/panels/network/net-device-mobile.c +++ b/panels/network/net-device-mobile.c @@ -107,7 +107,6 @@ network_combo_changed_cb (NetDeviceMobile *self) GtkTreeIter iter; GtkTreeModel *model; NMConnection *connection; - GtkWidget *toplevel; if (self->updating_device) return; @@ -122,8 +121,8 @@ network_combo_changed_cb (NetDeviceMobile *self) COLUMN_ID, &object_path, -1); if (g_strcmp0 (object_path, NULL) == 0) { - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self)); - cc_network_panel_connect_to_3g_network (toplevel, self->client, self->device); + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self)); + cc_network_panel_connect_to_3g_network (GTK_WIDGET (native), self->client, self->device); return; } diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index 69fe2e122..216e462b0 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -30,7 +30,6 @@ #include <polkit/polkit.h> #include "cc-wifi-hotspot-dialog.h" -#include "list-box-helper.h" #include "hostname-helper.h" #include "network-dialogs.h" #include "panel-common.h" @@ -51,17 +50,19 @@ static void show_hotspot_ui (NetDeviceWifi *self); struct _NetDeviceWifi { - GtkStack parent; + AdwBin parent; GtkBox *center_box; GtkButton *connect_hidden_button; GtkSwitch *device_off_switch; GtkBox *header_box; + GtkPopover *header_button_popover; GtkBox *hotspot_box; CcListRow *hotspot_name_row; CcListRow *hotspot_security_row; CcListRow *hotspot_password_row; GtkBox *listbox_box; + GtkStack *stack; GtkButton *start_hotspot_button; GtkLabel *status_label; GtkLabel *title_label; @@ -89,7 +90,7 @@ enum { PROP_LAST, }; -G_DEFINE_TYPE (NetDeviceWifi, net_device_wifi, GTK_TYPE_STACK) +G_DEFINE_TYPE (NetDeviceWifi, net_device_wifi, ADW_TYPE_BIN) static void disable_scan_timeout (NetDeviceWifi *self) @@ -385,10 +386,9 @@ device_off_switch_changed_cb (NetDeviceWifi *self) static void connect_hidden_button_clicked_cb (NetDeviceWifi *self) { - GtkWidget *toplevel; - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self)); - cc_network_panel_connect_to_hidden_network (toplevel, self->client); + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self)); + cc_network_panel_connect_to_hidden_network (GTK_WIDGET (native), self->client); + gtk_popover_popdown (self->header_button_popover); } static void @@ -582,7 +582,7 @@ static void show_hotspot_ui (NetDeviceWifi *self) { /* show hotspot tab */ - gtk_stack_set_visible_child (GTK_STACK (self), GTK_WIDGET (self->hotspot_box)); + gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->hotspot_box)); } static void @@ -676,29 +676,10 @@ overwrite_ssid_cb (GObject *source_object, } static void -start_hotspot_button_clicked_cb (NetDeviceWifi *self) +on_wifi_hotspot_dialog_respnse_cb (GtkDialog *dialog, + gint response, + NetDeviceWifi *self) { - g_autofree gchar *active_ssid = NULL; - GtkWidget *window; - NMConnection *c; - g_autofree gchar *hostname = NULL; - g_autofree gchar *ssid = NULL; - gint response; - - window = gtk_widget_get_toplevel (GTK_WIDGET (self)); - - if (!self->hotspot_dialog) - self->hotspot_dialog = cc_wifi_hotspot_dialog_new (GTK_WINDOW (window)); - cc_wifi_hotspot_dialog_set_device (self->hotspot_dialog, NM_DEVICE_WIFI (self->device)); - hostname = get_hostname (); - ssid = pretty_hostname_to_ssid (hostname); - cc_wifi_hotspot_dialog_set_hostname (self->hotspot_dialog, ssid); - c = net_device_wifi_get_hotspot_connection (self); - if (c) - cc_wifi_hotspot_dialog_set_connection (self->hotspot_dialog, c); - - response = gtk_dialog_run (GTK_DIALOG (self->hotspot_dialog)); - if (response == GTK_RESPONSE_APPLY) { NMConnection *connection; @@ -723,6 +704,31 @@ start_hotspot_button_clicked_cb (NetDeviceWifi *self) } static void +start_hotspot_button_clicked_cb (NetDeviceWifi *self) +{ + GtkNative *native; + NMConnection *c; + g_autofree gchar *hostname = NULL; + g_autofree gchar *ssid = NULL; + + native = gtk_widget_get_native (GTK_WIDGET (self)); + + if (!self->hotspot_dialog) + self->hotspot_dialog = cc_wifi_hotspot_dialog_new (GTK_WINDOW (native)); + cc_wifi_hotspot_dialog_set_device (self->hotspot_dialog, NM_DEVICE_WIFI (self->device)); + hostname = get_hostname (); + ssid = pretty_hostname_to_ssid (hostname); + cc_wifi_hotspot_dialog_set_hostname (self->hotspot_dialog, ssid); + c = net_device_wifi_get_hotspot_connection (self); + if (c) + cc_wifi_hotspot_dialog_set_connection (self->hotspot_dialog, c); + + g_signal_connect (self->hotspot_dialog, "response", G_CALLBACK (on_wifi_hotspot_dialog_respnse_cb), self); + gtk_window_present (GTK_WINDOW (self->hotspot_dialog)); + gtk_popover_popdown (self->header_button_popover); +} + +static void stop_shared_connection (NetDeviceWifi *self) { const GPtrArray *connections; @@ -754,7 +760,7 @@ stop_shared_connection (NetDeviceWifi *self) static void show_wifi_list (NetDeviceWifi *self) { - gtk_stack_set_visible_child (GTK_STACK (self), GTK_WIDGET (self->listbox_box)); + gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->listbox_box)); } static void @@ -819,7 +825,7 @@ really_forget (GtkDialog *dialog, gint response, gpointer data) NMRemoteConnection *connection; NetDeviceWifi *self; - gtk_widget_destroy (GTK_WIDGET (dialog)); + gtk_window_destroy (GTK_WINDOW (dialog)); if (response != GTK_RESPONSE_OK) return; @@ -838,11 +844,11 @@ really_forget (GtkDialog *dialog, gint response, gpointer data) static void forget_selected (GtkButton *forget, CcWifiConnectionList *list) { - GtkWidget *window; + GtkNative *native; GtkWidget *dialog; - window = gtk_widget_get_toplevel (GTK_WIDGET (forget)); - dialog = gtk_message_dialog_new (GTK_WINDOW (window), + native = gtk_widget_get_native (GTK_WIDGET (forget)); + dialog = gtk_message_dialog_new (GTK_WINDOW (native), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE, @@ -973,7 +979,7 @@ show_details_for_row (NetDeviceWifi *self, CcWifiConnectionRow *row, CcWifiConne ap = cc_wifi_connection_row_best_access_point (row); editor = net_connection_editor_new (connection, self->device, ap, self->client); - gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (row)))); + gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (row)))); gtk_window_present (GTK_WINDOW (editor)); } @@ -1018,63 +1024,53 @@ on_connection_list_row_activated_cb (NetDeviceWifi *self, static void history_button_clicked_cb (NetDeviceWifi *self) { + GtkListBox *listbox; GtkWidget *dialog; - GtkWidget *window; + GtkNative *native; GtkWidget *forget; GtkWidget *header; GtkWidget *swin; GtkWidget *content_area; GtkWidget *separator; GtkWidget *list; - GList *list_rows; + GtkWidget *child; dialog = g_object_new (GTK_TYPE_DIALOG, "use-header-bar", 1, NULL); - window = gtk_widget_get_toplevel (GTK_WIDGET (self)); - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window)); + native = gtk_widget_get_native (GTK_WIDGET (self)); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (native)); gtk_window_set_title (GTK_WINDOW (dialog), _("Known Wi-Fi Networks")); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400); /* Dialog's header */ header = gtk_header_bar_new (); - gtk_widget_show (header); - gtk_header_bar_set_title (GTK_HEADER_BAR (header), _("Known Wi-Fi Networks")); - gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE); + gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE); gtk_window_set_titlebar (GTK_WINDOW (dialog), header); - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), NULL); - - g_signal_connect (dialog, "delete-event", - G_CALLBACK (gtk_widget_destroy), NULL); + g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_container_set_border_width (GTK_CONTAINER (content_area), 0); + gtk_orientable_set_orientation (GTK_ORIENTABLE (content_area), GTK_ORIENTATION_VERTICAL); - swin = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (swin); + swin = gtk_scrolled_window_new (); gtk_widget_set_vexpand (swin, TRUE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), GTK_SHADOW_NONE); - gtk_container_add (GTK_CONTAINER (content_area), swin); + gtk_box_append (GTK_BOX (content_area), swin); list = GTK_WIDGET (cc_wifi_connection_list_new (self->client, NM_DEVICE_WIFI (self->device), FALSE, FALSE, TRUE)); - gtk_widget_show (list); - gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE); - gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL); - gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)history_sort, NULL, NULL); - gtk_container_add (GTK_CONTAINER (swin), list); + listbox = cc_wifi_connection_list_get_list_box (CC_WIFI_CONNECTION_LIST (list)); + gtk_list_box_set_selection_mode (listbox, GTK_SELECTION_NONE); + gtk_list_box_set_sort_func (listbox, (GtkListBoxSortFunc)history_sort, NULL, NULL); + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swin), list); /* Horizontal separator */ separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_widget_show (separator); - gtk_container_add (GTK_CONTAINER (content_area), separator); + gtk_box_append (GTK_BOX (content_area), separator); /* translators: This is the label for the "Forget wireless network" functionality */ forget = gtk_button_new_with_mnemonic (C_("Wi-Fi Network", "_Forget")); - gtk_widget_show (forget); gtk_widget_set_halign (forget, GTK_ALIGN_START); gtk_widget_set_margin_top (forget, 6); gtk_widget_set_margin_bottom (forget, 6); @@ -1084,7 +1080,7 @@ history_button_clicked_cb (NetDeviceWifi *self) g_signal_connect (forget, "clicked", G_CALLBACK (forget_selected), list); - gtk_container_add (GTK_CONTAINER (content_area), forget); + gtk_box_append (GTK_BOX (content_area), forget); g_object_set_data (G_OBJECT (list), "forget", forget); g_object_set_data (G_OBJECT (list), "net", self); @@ -1097,7 +1093,7 @@ history_button_clicked_cb (NetDeviceWifi *self) G_CALLBACK (on_connection_list_row_removed_cb), self, G_CONNECT_SWAPPED); - g_signal_connect_object (list, "row-activated", + g_signal_connect_object (listbox, "row-activated", G_CALLBACK (on_connection_list_row_activated_cb), self, G_CONNECT_SWAPPED); @@ -1106,16 +1102,17 @@ history_button_clicked_cb (NetDeviceWifi *self) self, G_CONNECT_SWAPPED); - list_rows = gtk_container_get_children (GTK_CONTAINER (list)); - while (list_rows) + for (child = gtk_widget_get_first_child (GTK_WIDGET (listbox)); + child; + child = gtk_widget_get_next_sibling (child)) { on_connection_list_row_added_cb (self, - CC_WIFI_CONNECTION_ROW (list_rows->data), + CC_WIFI_CONNECTION_ROW (child), CC_WIFI_CONNECTION_LIST (list)); - list_rows = g_list_delete_link (list_rows, list_rows); } gtk_window_present (GTK_WINDOW (dialog)); + gtk_popover_popdown (self->header_button_popover); } static void @@ -1175,11 +1172,13 @@ net_device_wifi_class_init (NetDeviceWifiClass *klass) gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, connect_hidden_button); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, device_off_switch); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, header_box); + gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, header_button_popover); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, hotspot_box); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, hotspot_name_row); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, hotspot_security_row); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, hotspot_password_row); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, listbox_box); + gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, stack); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, start_hotspot_button); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, status_label); gtk_widget_class_bind_template_child (widget_class, NetDeviceWifi, title_label); @@ -1228,6 +1227,7 @@ NetDeviceWifi * net_device_wifi_new (CcPanel *panel, NMClient *client, NMDevice *device) { NetDeviceWifi *self; + GtkListBox *listbox; GtkWidget *list; self = g_object_new (net_device_wifi_get_type (), NULL); @@ -1241,13 +1241,12 @@ net_device_wifi_new (CcPanel *panel, NMClient *client, NMDevice *device) g_signal_connect_object (device, "state-changed", G_CALLBACK (nm_device_wifi_refresh_ui), self, G_CONNECT_SWAPPED); list = GTK_WIDGET (cc_wifi_connection_list_new (client, NM_DEVICE_WIFI (device), TRUE, TRUE, FALSE)); - gtk_widget_show (list); - gtk_container_add (GTK_CONTAINER (self->listbox_box), list); + gtk_box_append (self->listbox_box, list); - gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL); - gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)ap_sort, self, NULL); + listbox = cc_wifi_connection_list_get_list_box (CC_WIFI_CONNECTION_LIST (list)); + gtk_list_box_set_sort_func (listbox, (GtkListBoxSortFunc)ap_sort, self, NULL); - g_signal_connect_object (list, "row-activated", + g_signal_connect_object (listbox, "row-activated", G_CALLBACK (ap_activated), self, G_CONNECT_SWAPPED); g_signal_connect_object (list, "configure", G_CALLBACK (show_details_for_row), self, G_CONNECT_SWAPPED); diff --git a/panels/network/net-device-wifi.h b/panels/network/net-device-wifi.h index 22866be68..1d4ae7dfa 100644 --- a/panels/network/net-device-wifi.h +++ b/panels/network/net-device-wifi.h @@ -21,13 +21,12 @@ #pragma once -#include <gtk/gtk.h> #include <shell/cc-panel.h> #include <NetworkManager.h> G_BEGIN_DECLS -G_DECLARE_FINAL_TYPE (NetDeviceWifi, net_device_wifi, NET, DEVICE_WIFI, GtkStack) +G_DECLARE_FINAL_TYPE (NetDeviceWifi, net_device_wifi, NET, DEVICE_WIFI, AdwBin) NetDeviceWifi *net_device_wifi_new (CcPanel *panel, NMClient *client, diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c index 8182adc4b..fc6c7448c 100644 --- a/panels/network/net-proxy.c +++ b/panels/network/net-proxy.c @@ -36,12 +36,12 @@ typedef enum struct _NetProxy { - GtkFrame parent; + AdwBin parent; - GtkRadioButton *automatic_radio; + GtkCheckButton *automatic_radio; GtkDialog *dialog; - GtkRadioButton *manual_radio; - GtkRadioButton *none_radio; + GtkCheckButton *manual_radio; + GtkCheckButton *none_radio; GtkEntry *proxy_ftp_entry; GtkEntry *proxy_http_entry; GtkEntry *proxy_https_entry; @@ -59,7 +59,7 @@ struct _NetProxy GSettings *settings; }; -G_DEFINE_TYPE (NetProxy, net_proxy, GTK_TYPE_FRAME) +G_DEFINE_TYPE (NetProxy, net_proxy, ADW_TYPE_BIN) static const gchar * panel_get_string_for_value (ProxyMode mode) @@ -155,11 +155,11 @@ panel_proxy_mode_setup_widgets (NetProxy *self, ProxyMode value) } static void -panel_proxy_mode_radio_changed_cb (NetProxy *self, GtkRadioButton *radio) +panel_proxy_mode_radio_changed_cb (NetProxy *self, GtkCheckButton *radio) { ProxyMode value; - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) + if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (radio))) return; /* get selected radio */ @@ -185,7 +185,7 @@ panel_proxy_mode_radio_changed_cb (NetProxy *self, GtkRadioButton *radio) static void show_dialog_cb (NetProxy *self) { - gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); + gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self)))); gtk_window_present (GTK_WINDOW (self->dialog)); } @@ -350,26 +350,19 @@ net_proxy_init (NetProxy *self) /* setup the radio before connecting to the :toggled signal */ switch (value) { case MODE_DISABLED: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->none_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->none_radio), TRUE); break; case MODE_MANUAL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->manual_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->manual_radio), TRUE); break; case MODE_AUTOMATIC: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->automatic_radio), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->automatic_radio), TRUE); break; default: g_assert_not_reached (); } panel_proxy_mode_setup_widgets (self, value); panel_update_status_label (self, value); - - /* prevent the dialog from being destroyed */ - g_signal_connect_object (self->dialog, - "delete-event", - G_CALLBACK (gtk_widget_hide_on_delete), - self->dialog, - G_CONNECT_SWAPPED); } NetProxy * diff --git a/panels/network/net-proxy.h b/panels/network/net-proxy.h index d0e019a33..5469c251d 100644 --- a/panels/network/net-proxy.h +++ b/panels/network/net-proxy.h @@ -21,11 +21,11 @@ #pragma once -#include <gtk/gtk.h> +#include <adwaita.h> G_BEGIN_DECLS -G_DECLARE_FINAL_TYPE (NetProxy, net_proxy, NET, PROXY, GtkFrame) +G_DECLARE_FINAL_TYPE (NetProxy, net_proxy, NET, PROXY, AdwBin) NetProxy *net_proxy_new (void); diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c index 44400662b..3e2c84745 100644 --- a/panels/network/net-vpn.c +++ b/panels/network/net-vpn.c @@ -154,7 +154,7 @@ edit_connection (NetVpn *self) g_autofree gchar *title = NULL; editor = net_connection_editor_new (self->connection, NULL, NULL, self->client); - gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); + gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self)))); title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (self->connection)); net_connection_editor_set_title (editor, title); diff --git a/panels/network/network-bluetooth.ui b/panels/network/network-bluetooth.ui index e068af397..14ec590fc 100644 --- a/panels/network/network-bluetooth.ui +++ b/panels/network/network-bluetooth.ui @@ -2,28 +2,20 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="NetDeviceBluetooth" parent="GtkBox"> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> <object class="GtkSeparator" id="separator"> - <property name="can_focus">False</property> <property name="orientation">horizontal</property> </object> </child> <child> <object class="GtkListBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="selection_mode">none</property> <child> <object class="GtkListBoxRow"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="activatable">False</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="margin_top">8</property> <property name="margin_bottom">8</property> <property name="margin_start">12</property> @@ -31,8 +23,6 @@ <property name="spacing">12</property> <child> <object class="GtkLabel" id="device_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="xalign">0.0</property> <property name="label" translatable="yes">Wired</property> @@ -41,22 +31,15 @@ </child> <child> <object class="GtkSwitch" id="device_off_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="valign">center</property> <signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceBluetooth" swapped="yes"/> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Turn device off</property> - </object> - </child> + <accessibility> + <property name="label" translatable="yes">Turn device off</property> + </accessibility> </object> </child> <child> <object class="GtkButton" id="options_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> <property name="valign">center</property> <property name="use_underline">True</property> <signal name="clicked" handler="options_button_clicked_cb" object="NetDeviceBluetooth" swapped="yes"/> @@ -65,17 +48,13 @@ </style> <child> <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="icon_name">emblem-system-symbolic</property> <property name="icon_size">1</property> </object> </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Options…</property> - </object> - </child> + <accessibility> + <property name="label" translatable="yes">Options…</property> + </accessibility> </object> </child> </object> diff --git a/panels/network/network-dialogs.c b/panels/network/network-dialogs.c index 41ceec5e5..83df99a72 100644 --- a/panels/network/network-dialogs.c +++ b/panels/network/network-dialogs.c @@ -167,7 +167,7 @@ wireless_dialog_response_cb (GtkDialog *foo, done: gtk_widget_hide (GTK_WIDGET (dialog)); - gtk_widget_destroy (GTK_WIDGET (dialog)); + gtk_window_destroy (GTK_WINDOW (dialog)); } static void @@ -179,7 +179,7 @@ show_wireless_dialog (GtkWidget *toplevel, g_debug ("About to parent and show a network dialog"); - g_assert (gtk_widget_is_toplevel (toplevel)); + g_assert (GTK_IS_NATIVE (toplevel)); g_object_set (G_OBJECT (dialog), "modal", TRUE, "transient-for", toplevel, diff --git a/panels/network/network-ethernet.ui b/panels/network/network-ethernet.ui index 392282872..0864c981b 100644 --- a/panels/network/network-ethernet.ui +++ b/panels/network/network-ethernet.ui @@ -2,17 +2,12 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="NetDeviceEthernet" parent="GtkBox"> - <property name="can_focus">False</property> <property name="spacing">6</property> <property name="orientation">vertical</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <child> <object class="GtkLabel" id="device_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Wired</property> @@ -24,18 +19,11 @@ </child> <child> <object class="GtkButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="relief">none</property> + <property name="icon_name">list-add-symbolic</property> <signal name="clicked" handler="add_profile_button_clicked_cb" object="NetDeviceEthernet" swapped="yes"/> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="icon_name">list-add-symbolic</property> - </object> - </child> + <style> + <class name="flat" /> + </style> </object> </child> </object> @@ -43,21 +31,15 @@ <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkScrolledWindow" id="scrolled_window"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="hscrollbar_policy">never</property> <property name="vscrollbar_policy">never</property> - <property name="shadow_type">in</property> <child> <object class="GtkListBox" id="connection_list"> - <property name="visible">True</property> <property name="selection-mode">none</property> <signal name="row-activated" handler="connection_list_row_activated_cb" object="NetDeviceEthernet" swapped="yes"/> </object> @@ -67,54 +49,33 @@ <!-- Single profile row --> <child> - <object class="GtkFrame" id="details_frame"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="expand">True</property> + <object class="GtkListBox" id="details_listbox"> + <property name="selection_mode">none</property> + <style> + <class name="content" /> + </style> <child> - <object class="GtkListBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="selection_mode">none</property> + <object class="AdwActionRow" id="details_row"> + <property name="selectable">False</property> + <property name="title">Cable unplugged</property> <child> - <object class="HdyActionRow" id="details_row"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="selectable">False</property> - <property name="title">Cable unplugged</property> - <child> - <object class="GtkSwitch" id="device_off_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="halign">end</property> - <property name="valign">center</property> - <signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceEthernet" swapped="yes"/> - </object> - </child> - <child> - <object class="GtkButton" id="details_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="halign">end</property> - <property name="valign">center</property> - <signal name="clicked" handler="details_button_clicked_cb" object="NetDeviceEthernet" swapped="yes"/> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon-name">emblem-system-symbolic</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Options…</property> - </object> - </child> - </object> - </child> + <object class="GtkSwitch" id="device_off_switch"> + <property name="halign">end</property> + <property name="valign">center</property> + <signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceEthernet" swapped="yes"/> </object> </child> + <child> + <object class="GtkButton" id="details_button"> + <property name="halign">end</property> + <property name="valign">center</property> + <property name="icon-name">emblem-system-symbolic</property> + <signal name="clicked" handler="details_button_clicked_cb" object="NetDeviceEthernet" swapped="yes"/> + <accessibility> + <property name="label" translatable="yes">Options…</property> + </accessibility> + </object> + </child> </object> </child> </object> diff --git a/panels/network/network-mobile.ui b/panels/network/network-mobile.ui index 6f8340b74..aa9a161b1 100644 --- a/panels/network/network-mobile.ui +++ b/panels/network/network-mobile.ui @@ -10,300 +10,242 @@ </columns> </object> <template class="NetDeviceMobile" parent="GtkBox"> - <property name="can_focus">False</property> - <property name="border_width">12</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="row_spacing">10</property> <property name="column_spacing">6</property> <child> <object class="GtkLabel" id="imei_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">IMEI</property> <property name="mnemonic_widget">imei_label</property> + <layout> + <property name="column">0</property> + <property name="row">1</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="provider_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Provider</property> <property name="mnemonic_widget">provider_label</property> + <layout> + <property name="column">0</property> + <property name="row">3</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="imei_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label">1234567890</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">1</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="provider_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label">SuperTel Supremo </property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv4_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label">127.0.0.1</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">4</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv6_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">5</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="route_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">6</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">6</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns4_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="yalign">0</property> <property name="wrap">True</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">7</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">7</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns6_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="yalign">0</property> <property name="wrap">True</property> <property name="selectable">True</property> <property name="max-width-chars">50</property> <property name="ellipsize">end</property> + <layout> + <property name="column">1</property> + <property name="row">8</property> + <property name="column-span">2</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">8</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="halign">end</property> <property name="valign">start</property> - <child> - <placeholder/> - </child> + <layout> + <property name="column">2</property> + <property name="row">0</property> + </layout> </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv4_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">IP Address</property> + <layout> + <property name="column">0</property> + <property name="row">4</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="ipv6_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">IPv6 Address</property> + <layout> + <property name="column">0</property> + <property name="row">5</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="route_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Default Route</property> + <layout> + <property name="column">0</property> + <property name="row">6</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns4_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="yalign">0</property> <property name="label" translatable="yes">DNS</property> + <layout> + <property name="column">0</property> + <property name="row">7</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="dns6_heading_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="yalign">0</property> <property name="label" translatable="yes">DNS</property> + <layout> + <property name="column">0</property> + <property name="row">8</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkLabel" id="network_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Network</property> + <layout> + <property name="column">0</property> + <property name="row">2</property> + </layout> <style> <class name="dim-label"/> </style> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkComboBox" id="network_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="model">mobile_connections_list_store</property> <property name="entry_text_column">1</property> <signal name="changed" handler="network_combo_changed_cb" object="NetDeviceMobile" swapped="yes"/> + <layout> + <property name="column">1</property> + <property name="row">2</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -311,22 +253,17 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="spacing">6</property> + <layout> + <property name="column">0</property> + <property name="row">0</property> + <property name="column-span">3</property> + </layout> <child> <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="halign">end</property> <property name="valign">start</property> <property name="xalign">1</property> @@ -334,24 +271,15 @@ <property name="icon_name">network-cellular-connected</property> <property name="icon-size">6</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="hexpand">True</property> <property name="spacing">3</property> <property name="orientation">vertical</property> <child> <object class="GtkLabel" id="device_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label">Mobile Broadband</property> <property name="ellipsize">end</property> @@ -360,105 +288,39 @@ <attribute name="scale" value="1.2"/> </attributes> </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> </child> <child> <object class="GtkLabel" id="status_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label">Not connected</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> <child> <object class="GtkSwitch" id="device_off_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="halign">end</property> <property name="valign">center</property> <signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceMobile" swapped="yes"/> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">3</property> - <property name="height">1</property> - </packing> - </child> - <child> - <placeholder/> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="yalign">1</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">12</property> - <child> - <object class="GtkButton" id="options_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="options_button_clicked_cb" object="NetDeviceMobile" swapped="yes"/> - <style> - <class name="image-button"/> - </style> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">emblem-system-symbolic</property> - <property name="icon_size">1</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Options…</property> - </object> - </child> - </object> - </child> + <object class="GtkButton" id="options_button"> + <property name="halign">end</property> + <property name="valign">end</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="margin-top">12</property> + <property name="icon_name">emblem-system-symbolic</property> + <signal name="clicked" handler="options_button_clicked_cb" object="NetDeviceMobile" swapped="yes"/> + <accessibility> + <property name="label" translatable="yes">Options…</property> + </accessibility> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/network-proxy.ui b/panels/network/network-proxy.ui index dcc88d5f5..ba7f43389 100644 --- a/panels/network/network-proxy.ui +++ b/panels/network/network-proxy.ui @@ -17,23 +17,18 @@ <property name="upper">65535</property> <property name="step_increment">1</property> </object> - <template class="NetProxy" parent="GtkFrame"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <template class="NetProxy" parent="AdwBin"> <child> <object class="GtkListBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="selection_mode">none</property> + <style> + <class name="content" /> + </style> <child> <object class="GtkListBoxRow"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="activatable">False</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="spacing">12</property> <property name="margin_top">8</property> <property name="margin_bottom">8</property> @@ -41,8 +36,6 @@ <property name="margin_end">12</property> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="label" translatable="yes">Network Proxy</property> <property name="ellipsize">end</property> @@ -54,8 +47,6 @@ </child> <child> <object class="GtkLabel" id="status_label"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="margin_top">8</property> <property name="margin_bottom">8</property> <style> @@ -65,13 +56,9 @@ </child> <child> <object class="GtkButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> <signal name="clicked" handler="show_dialog_cb" object="NetProxy" swapped="yes"/> <child> <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="icon_name">emblem-system-symbolic</property> </object> </child> @@ -86,403 +73,327 @@ </template> <object class="GtkDialog" id="dialog"> <property name="use_header_bar">1</property> - <property name="can_focus">False</property> - <property name="border_width">18</property> <property name="default_height">350</property> <property name="modal">True</property> - <property name="type_hint">dialog</property> - <property name="window_position">center</property> <property name="destroy_with_parent">True</property> + <property name="hide-on-close">True</property> <property name="title" translatable="yes">Network Proxy</property> - <child internal-child="vbox"> + <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">0</property> + <property name="margin-top">18</property> + <property name="margin-bottom">18</property> + <property name="margin-start">18</property> + <property name="margin-end">18</property> + <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkRadioButton" id="automatic_radio"> - <property name="visible">True</property> - <property name="can_focus">True</property> + <object class="GtkCheckButton" id="automatic_radio"> <property name="label" translatable="yes">Automatic</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> <property name="group">none_radio</property> <signal name="toggled" handler="panel_proxy_mode_radio_changed_cb" object="NetProxy" swapped="yes"/> </object> </child> <child> - <object class="GtkRadioButton" id="manual_radio"> - <property name="visible">True</property> - <property name="can_focus">True</property> + <object class="GtkCheckButton" id="manual_radio"> <property name="label" translatable="yes">Manual</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> <property name="group">none_radio</property> <signal name="toggled" handler="panel_proxy_mode_radio_changed_cb" object="NetProxy" swapped="yes"/> </object> </child> <child> - <object class="GtkRadioButton" id="none_radio"> - <property name="visible">True</property> - <property name="can_focus">True</property> + <object class="GtkCheckButton" id="none_radio"> <property name="label" translatable="yes">Disabled</property> - <property name="receives_default">False</property> - <property name="draw_indicator">True</property> <signal name="toggled" handler="panel_proxy_mode_radio_changed_cb" object="NetProxy" swapped="yes"/> </object> </child> <child> <object class="GtkStack" id="stack"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="transition_type">crossfade</property> <!-- Disabled (empty box) --> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> + <object class="GtkStackPage"> <property name="name">disabled</property> - </packing> + <property name="child"> + <object class="GtkBox" /> + </property> + </object> </child> <!-- Manual --> <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="border_width">12</property> - <property name="row_spacing">10</property> - <property name="column_spacing">6</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> + <object class="GtkStackPage"> + <property name="name">manual</property> + <property name="child"> + <object class="GtkGrid"> <property name="valign">start</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">_HTTP Proxy</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxy_http_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">H_TTPS Proxy</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxy_https_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">_FTP Proxy</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxy_ftp_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">_Socks Host</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxy_socks_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">_Ignore Hosts</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxy_ignore_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="proxy_http_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="xalign">1</property> - <property name="invisible_char_set">True</property> - <property name="adjustment">proxy_port_http_adjustment</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">HTTP proxy port</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="row_spacing">10</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel"> + <property name="xalign">1</property> + <property name="label" translatable="yes">_HTTP Proxy</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">proxy_http_entry</property> + <layout> + <property name="column">0</property> + <property name="row">3</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <style> + <class name="dim-label"/> + </style> </object> </child> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="proxy_https_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="proxy_ftp_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="proxy_socks_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="proxy_ignore_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">7</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="xalign">1</property> - <property name="invisible_char_set">True</property> - <property name="adjustment">proxy_port_https_adjustment</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">HTTPS proxy port</property> + <child> + <object class="GtkLabel"> + <property name="xalign">1</property> + <property name="label" translatable="yes">H_TTPS Proxy</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">proxy_https_entry</property> + <layout> + <property name="column">0</property> + <property name="row">4</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <style> + <class name="dim-label"/> + </style> </object> </child> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="xalign">1</property> - <property name="invisible_char_set">True</property> - <property name="adjustment">proxy_port_ftp_adjustment</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">FTP proxy port</property> + <child> + <object class="GtkLabel"> + <property name="xalign">1</property> + <property name="label" translatable="yes">_FTP Proxy</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">proxy_ftp_entry</property> + <layout> + <property name="column">0</property> + <property name="row">5</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <style> + <class name="dim-label"/> + </style> </object> </child> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="xalign">1</property> - <property name="invisible_char_set">True</property> - <property name="adjustment">proxy_port_socks_adjustment</property> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Socks proxy port</property> + <child> + <object class="GtkLabel"> + <property name="xalign">1</property> + <property name="label" translatable="yes">_Socks Host</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">proxy_socks_entry</property> + <layout> + <property name="column">0</property> + <property name="row">6</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <style> + <class name="dim-label"/> + </style> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="xalign">1</property> + <property name="label" translatable="yes">_Ignore Hosts</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">proxy_ignore_entry</property> + <layout> + <property name="column">0</property> + <property name="row">7</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <style> + <class name="dim-label"/> + </style> + </object> + </child> + <child> + <object class="GtkEntry" id="proxy_http_entry"> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkSpinButton"> + <property name="xalign">1</property> + <property name="adjustment">proxy_port_http_adjustment</property> + <layout> + <property name="column">2</property> + <property name="row">3</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <accessibility> + <property name="label" translatable="yes">HTTP proxy port</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkEntry" id="proxy_https_entry"> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <layout> + <property name="column">1</property> + <property name="row">4</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkEntry" id="proxy_ftp_entry"> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <layout> + <property name="column">1</property> + <property name="row">5</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkEntry" id="proxy_socks_entry"> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <layout> + <property name="column">1</property> + <property name="row">6</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkEntry" id="proxy_ignore_entry"> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <layout> + <property name="column">1</property> + <property name="row">7</property> + <property name="column-span">2</property> + <property name="row-span">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkSpinButton"> + <property name="xalign">1</property> + <property name="adjustment">proxy_port_https_adjustment</property> + <layout> + <property name="column">2</property> + <property name="row">4</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <accessibility> + <property name="label" translatable="yes">HTTPS proxy port</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkSpinButton"> + <property name="xalign">1</property> + <property name="adjustment">proxy_port_ftp_adjustment</property> + <layout> + <property name="column">2</property> + <property name="row">5</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <accessibility> + <property name="label" translatable="yes">FTP proxy port</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkSpinButton"> + <property name="xalign">1</property> + <property name="adjustment">proxy_port_socks_adjustment</property> + <layout> + <property name="column">2</property> + <property name="row">6</property> + <property name="column-span">1</property> + <property name="row-span">1</property> + </layout> + <accessibility> + <property name="label" translatable="yes">Socks proxy port</property> + </accessibility> </object> </child> </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + </property> </object> - <packing> - <property name="name">manual</property> - </packing> </child> <!-- Automatic --> <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">12</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">_Configuration URL</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">proxy_url_entry</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="top_attach">0</property> - <property name="left_attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="proxy_url_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="top_attach">0</property> - <property name="left_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="proxy_warning_label"> - <property name="visible">False</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">WPAD warning…</property> - <property name="wrap">True</property> - <property name="width_chars">50</property> + <object class="GtkStackPage"> + <property name="name">automatic</property> + <property name="child"> + <object class="GtkGrid"> + <property name="row_spacing">12</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel"> + <property name="xalign">1</property> + <property name="label" translatable="yes">_Configuration URL</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">proxy_url_entry</property> + <layout> + <property name="row">0</property> + <property name="column">0</property> + </layout> + <style> + <class name="dim-label"/> + </style> + </object> + </child> + <child> + <object class="GtkEntry" id="proxy_url_entry"> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <layout> + <property name="row">0</property> + <property name="column">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkLabel" id="proxy_warning_label"> + <property name="visible">False</property> + <property name="xalign">0</property> + <property name="wrap">True</property> + <property name="width_chars">50</property> + <layout> + <property name="row">1</property> + <property name="column">0</property> + <property name="column-span">2</property> + </layout> + </object> + </child> </object> - <packing> - <property name="top_attach">1</property> - <property name="left_attach">0</property> - <property name="width">2</property> - </packing> - </child> + </property> </object> - <packing> - <property name="name">automatic</property> - </packing> </child> + </object> </child> </object> diff --git a/panels/network/network-vpn.ui b/panels/network/network-vpn.ui index f60add2b8..bd6dd3d4a 100644 --- a/panels/network/network-vpn.ui +++ b/panels/network/network-vpn.ui @@ -2,14 +2,12 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <template class="NetVpn" parent="GtkBox"> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="orientation">vertical</property> <!-- HACK: a separator above the row, since we don't have a real listbox widget in the panel --> <child> <object class="GtkSeparator" id="separator"> - <property name="can_focus">False</property> <property name="orientation">horizontal</property> </object> </child> @@ -17,18 +15,15 @@ <!-- Main listbox --> <child> <object class="GtkListBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="selection_mode">none</property> + <style> + <class name="content" /> + </style> <child> <object class="GtkListBoxRow"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="activatable">False</property> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="margin_top">8</property> <property name="margin_bottom">8</property> @@ -37,8 +32,6 @@ <property name="spacing">12</property> <child> <object class="GtkLabel" id="device_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> <property name="ellipsize">end</property> <property name="hexpand">True</property> @@ -46,37 +39,21 @@ </child> <child> <object class="GtkSwitch" id="device_off_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="halign">end</property> <property name="valign">center</property> <signal name="notify::active" handler="device_off_toggled" object="NetVpn" swapped="yes"/> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Turn VPN connection off</property> - </object> - </child> + <accessibility> + <property name="label" translatable="yes">Turn VPN connection off</property> + </accessibility> </object> </child> <child> <object class="GtkButton" id="options_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="icon_name">emblem-system-symbolic</property> <signal name="clicked" handler="edit_connection" object="NetVpn" swapped="yes"/> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">emblem-system-symbolic</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Options…</property> - </object> - </child> + <accessibility> + <property name="label" translatable="yes">Options…</property> + </accessibility> </object> </child> </object> diff --git a/panels/network/network-wifi.ui b/panels/network/network-wifi.ui index b3e03c31e..2d5f13207 100644 --- a/panels/network/network-wifi.ui +++ b/panels/network/network-wifi.ui @@ -1,39 +1,56 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <template class="NetDeviceWifi" parent="GtkStack"> - <child> - <object class="GtkBox" id="listbox_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="height-request">140</property> - </object> - </child> + <template class="NetDeviceWifi" parent="AdwBin"> - <!-- Wi-Fi Hotspot deails --> <child> - <object class="GtkListBox" id="hotspot_box"> - <property name="visible">True</property> - <property name="selection-mode">none</property> - <child> - <object class="CcListRow" id="hotspot_name_row"> - <property name="visible">True</property> - <property name="title" context="Wi-Fi Hotspot" translatable="yes">Network Name</property> - </object> - </child> + <object class="GtkStack" id="stack"> + <property name="valign">start</property> + <property name="vhomogeneous">False</property> + <child> - <object class="CcListRow" id="hotspot_security_row"> - <property name="visible">True</property> - <property name="title" context="Wi-Fi Hotspot" translatable="yes">Security type</property> + <object class="GtkStackPage"> + <property name="child"> + <object class="GtkBox" id="listbox_box"> + <property name="orientation">vertical</property> + <property name="height-request">140</property> + </object> + </property> </object> </child> + + <!-- Wi-Fi Hotspot deails --> <child> - <object class="CcListRow" id="hotspot_password_row"> - <property name="visible">True</property> - <property name="title" context="Wi-Fi Hotspot" translatable="yes">Password</property> + <object class="GtkStackPage"> + <property name="child"> + <object class="GtkListBox" id="hotspot_box"> + <property name="selection-mode">none</property> + <style> + <class name="content" /> + </style> + <child> + <object class="CcListRow" id="hotspot_name_row"> + <property name="activatable">False</property> + <property name="title" context="Wi-Fi Hotspot" translatable="yes">Network Name</property> + </object> + </child> + <child> + <object class="CcListRow" id="hotspot_security_row"> + <property name="activatable">False</property> + <property name="title" context="Wi-Fi Hotspot" translatable="yes">Security type</property> + </object> + </child> + <child> + <object class="CcListRow" id="hotspot_password_row"> + <property name="activatable">False</property> + <property name="title" context="Wi-Fi Hotspot" translatable="yes">Password</property> + </object> + </child> + </object> + </property> </object> </child> + </object> </child> @@ -41,15 +58,11 @@ <!-- Center widget --> <object class="GtkBox" id="center_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="halign">center</property> <property name="valign">center</property> <child> <object class="GtkLabel" id="title_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">Wi-Fi</property> <style> <class name="title" /> @@ -58,8 +71,6 @@ </child> <child> <object class="GtkLabel" id="status_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <style> <class name="subtitle" /> </style> @@ -69,32 +80,22 @@ <!-- Box with the On/Off switch + menu button --> <object class="GtkBox" id="header_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="spacing">6</property> <property name="halign">end</property> <child> <object class="GtkSwitch" id="device_off_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="valign">center</property> <signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceWifi" swapped="yes"/> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="accessible-name" translatable="yes">Turn Wi-Fi off</property> - </object> - </child> + <accessibility> + <property name="label" translatable="yes">Turn Wi-Fi off</property> + </accessibility> </object> </child> <child> <object class="GtkMenuButton" id="header_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="popover">header_button_popover</property> <child> <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="icon_name">view-more-symbolic</property> </object> </child> @@ -103,44 +104,36 @@ </object> <!-- Menu Popover --> - <object class="GtkPopoverMenu" id="header_button_popover"> + <object class="GtkPopover" id="header_button_popover"> + <style> + <class name="menu" /> + </style> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin">12</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> <property name="spacing">6</property> <property name="orientation">vertical</property> <child> - <object class="GtkModelButton" id="connect_hidden_button"> + <object class="GtkButton" id="connect_hidden_button"> <property name="label" translatable="yes">_Connect to Hidden Network…</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> <property name="use_underline">True</property> - <property name="xalign">0.0</property> <signal name="clicked" handler="connect_hidden_button_clicked_cb" object="NetDeviceWifi" swapped="yes"/> </object> </child> <child> - <object class="GtkModelButton" id="start_hotspot_button"> + <object class="GtkButton" id="start_hotspot_button"> <property name="label" translatable="yes">_Turn On Wi-Fi Hotspot…</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> <property name="use_underline">True</property> - <property name="xalign">0.0</property> <signal name="clicked" handler="start_hotspot_button_clicked_cb" object="NetDeviceWifi" swapped="yes"/> </object> </child> <child> - <object class="GtkModelButton"> + <object class="GtkButton"> <property name="label" translatable="yes">_Known Wi-Fi Networks</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> <property name="use_underline">True</property> - <property name="xalign">0.0</property> <signal name="clicked" handler="history_button_clicked_cb" object="NetDeviceWifi" swapped="yes"/> </object> </child> diff --git a/panels/network/wireless-security/eap-method-fast.c b/panels/network/wireless-security/eap-method-fast.c index ecd1fb985..0988b8cf3 100644 --- a/panels/network/wireless-security/eap-method-fast.c +++ b/panels/network/wireless-security/eap-method-fast.c @@ -27,6 +27,7 @@ #include "eap-method-simple.h" #include "helpers.h" #include "ui-helpers.h" +#include "ws-file-chooser-button.h" #define I_NAME_COLUMN 0 #define I_ID_COLUMN 1 @@ -40,7 +41,7 @@ struct _EAPMethodFAST { GtkLabel *inner_auth_label; GtkListStore *inner_auth_model; GtkBox *inner_auth_box; - GtkFileChooserButton *pac_file_button; + WsFileChooserButton *pac_file_button; GtkLabel *pac_file_label; GtkCheckButton *pac_provision_check; GtkComboBox *pac_provision_combo; @@ -76,12 +77,12 @@ static gboolean validate (EAPMethod *parent, GError **error) { EAPMethodFAST *self = (EAPMethodFAST *) parent; - const char *file; + g_autoptr(GFile) file = NULL; gboolean provisioning; gboolean valid = TRUE; - provisioning = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->pac_provision_check)); - file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->pac_file_button)); + provisioning = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->pac_provision_check)); + file = ws_file_chooser_button_get_file (self->pac_file_button); if (!provisioning && !file) { widget_set_error (GTK_WIDGET (self->pac_file_button)); g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP-FAST PAC file")); @@ -110,9 +111,10 @@ static void fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFlags flags) { EAPMethodFAST *self = (EAPMethodFAST *) parent; + g_autofree gchar *filename = NULL; + g_autoptr(GFile) file = NULL; NMSetting8021x *s_8021x; const char *text; - char *filename; gboolean enabled; int pac_provisioning = 0; @@ -121,14 +123,15 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla nm_setting_802_1x_add_eap_method (s_8021x, "fast"); - text = gtk_entry_get_text (self->anon_identity_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->anon_identity_entry)); if (text && strlen (text)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL); - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->pac_file_button)); + file = ws_file_chooser_button_get_file (self->pac_file_button); + filename = file ? g_file_get_path (file) : NULL; g_object_set (s_8021x, NM_SETTING_802_1X_PAC_FILE, filename, NULL); - enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->pac_provision_check)); + enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->pac_provision_check)); if (!enabled) g_object_set (G_OBJECT (s_8021x), NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, "0", NULL); @@ -158,21 +161,21 @@ static void inner_auth_combo_changed_cb (EAPMethodFAST *self) { EAPMethod *inner_method; - GList *children; + GtkWidget *child; inner_method = get_inner_method (self); /* Remove the previous method and migrate username/password across */ - children = gtk_container_get_children (GTK_CONTAINER (self->inner_auth_box)); - if (children != NULL) { - EAPMethod *old_eap = g_list_nth_data (children, 0); + child = gtk_widget_get_first_child (GTK_WIDGET (self->inner_auth_box)); + if (child != NULL) { + EAPMethod *old_eap = EAP_METHOD (child); eap_method_set_username (inner_method, eap_method_get_username (old_eap)); eap_method_set_password (inner_method, eap_method_get_password (old_eap)); eap_method_set_show_password (inner_method, eap_method_get_show_password (old_eap)); - gtk_container_remove (GTK_CONTAINER (self->inner_auth_box), GTK_WIDGET (old_eap)); + gtk_box_remove (self->inner_auth_box, child); } - gtk_container_add (GTK_CONTAINER (self->inner_auth_box), g_object_ref (GTK_WIDGET (inner_method))); + gtk_box_append (self->inner_auth_box, g_object_ref (GTK_WIDGET (inner_method))); eap_method_emit_changed (EAP_METHOD (self)); } @@ -246,7 +249,7 @@ pac_toggled_cb (EAPMethodFAST *self) { gboolean enabled = FALSE; - enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->pac_provision_check)); + enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->pac_provision_check)); gtk_widget_set_sensitive (GTK_WIDGET (self->pac_provision_combo), enabled); eap_method_emit_changed (EAP_METHOD (self)); @@ -269,6 +272,8 @@ eap_method_fast_class_init (EAPMethodFASTClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + g_type_ensure (WS_TYPE_FILE_CHOOSER_BUTTON); + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/ControlCenter/network/eap-method-fast.ui"); gtk_widget_class_bind_template_child (widget_class, EAPMethodFAST, anon_identity_entry); @@ -306,7 +311,6 @@ eap_method_fast_new (NMConnection *connection) EAPMethodFAST *self; GtkFileFilter *filter; NMSetting8021x *s_8021x = NULL; - const char *filename; gboolean provisioning_enabled = TRUE; const gchar *phase2_auth = NULL; GtkTreeIter iter; @@ -335,31 +339,30 @@ eap_method_fast_new (NMConnection *connection) gtk_widget_set_sensitive (GTK_WIDGET (self->pac_provision_combo), provisioning_enabled); g_signal_connect_swapped (self->pac_provision_combo, "changed", G_CALLBACK (changed_cb), self); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->pac_provision_check), provisioning_enabled); + gtk_check_button_set_active (self->pac_provision_check, provisioning_enabled); g_signal_connect_swapped (self->pac_provision_check, "toggled", G_CALLBACK (pac_toggled_cb), self); if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x)) - gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity (s_8021x)); + gtk_editable_set_text (GTK_EDITABLE (self->anon_identity_entry), nm_setting_802_1x_get_anonymous_identity (s_8021x)); g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self); - gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->pac_file_button), TRUE); - gtk_file_chooser_button_set_title (self->pac_file_button, - _("Choose a PAC file")); - g_signal_connect_swapped (self->pac_file_button, "selection-changed", G_CALLBACK (changed_cb), self); + g_signal_connect_swapped (self->pac_file_button, "notify::file", G_CALLBACK (changed_cb), self); filter = gtk_file_filter_new (); gtk_file_filter_add_pattern (filter, "*.pac"); gtk_file_filter_set_name (filter, _("PAC files (*.pac)")); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->pac_file_button), filter); + gtk_file_chooser_add_filter (ws_file_chooser_button_get_filechooser (self->pac_file_button), filter); filter = gtk_file_filter_new (); gtk_file_filter_add_pattern (filter, "*"); gtk_file_filter_set_name (filter, _("All files")); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->pac_file_button), filter); + gtk_file_chooser_add_filter (ws_file_chooser_button_get_filechooser (self->pac_file_button), filter); if (connection && s_8021x) { - filename = nm_setting_802_1x_get_pac_file (s_8021x); - if (filename) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->pac_file_button), filename); + const char *filename = nm_setting_802_1x_get_pac_file (s_8021x); + if (filename) { + g_autoptr(GFile) file = g_file_new_for_path (filename); + ws_file_chooser_button_set_file (self->pac_file_button, file); + } } self->em_gtc = eap_method_simple_new (connection, "gtc", TRUE, FALSE); diff --git a/panels/network/wireless-security/eap-method-fast.ui b/panels/network/wireless-security/eap-method-fast.ui index 3d4f1dd25..ad63b1818 100644 --- a/panels/network/wireless-security/eap-method-fast.ui +++ b/panels/network/wireless-security/eap-method-fast.ui @@ -37,96 +37,82 @@ </data> </object> <template class="EAPMethodFAST" parent="GtkGrid"> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="anon_identity_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Anony_mous identity</property> <property name="use_underline">True</property> <property name="mnemonic_widget">anon_identity_entry</property> + <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="anon_identity_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="pac_file_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">PAC _file</property> <property name="use_underline">True</property> <property name="mnemonic_widget">pac_file_button</property> + <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="GtkFileChooserButton" id="pac_file_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="WsFileChooserButton" id="pac_file_button"> <property name="hexpand">True</property> + <property name="title" translatable="yes">Choose a PAC file</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> <child> <object class="GtkBox" id="inner_auth_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> + <layout> + <property name="column">0</property> + <property name="column-span">2</property> + <property name="row">4</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="width">2</property> - <property name="top_attach">4</property> - </packing> </child> <child> <object class="GtkLabel" id="inner_auth_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Inner authentication</property> <property name="use_underline">True</property> <property name="mnemonic_widget">inner_auth_combo</property> + <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="GtkComboBox" id="inner_auth_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">inner_auth_model</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -134,31 +120,25 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> </child> <child> <object class="GtkCheckButton" id="pac_provision_check"> <property name="label" translatable="yes">Allow automatic PAC pro_visioning</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <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="GtkComboBox" id="pac_provision_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">pac_provision_model</property> + <layout> + <property name="column">1</property> + <property name="row">1</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -166,10 +146,6 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/wireless-security/eap-method-leap.c b/panels/network/wireless-security/eap-method-leap.c index d218ade19..a5ff59e2e 100644 --- a/panels/network/wireless-security/eap-method-leap.c +++ b/panels/network/wireless-security/eap-method-leap.c @@ -47,7 +47,7 @@ static void show_toggled_cb (EAPMethodLEAP *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); gtk_entry_set_visibility (self->password_entry, visible); } @@ -59,7 +59,7 @@ validate (EAPMethod *parent, GError **error) const char *text; gboolean ret = TRUE; - text = gtk_entry_get_text (self->username_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->username_entry)); if (!text || !strlen (text)) { widget_set_error (GTK_WIDGET (self->username_entry)); g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP-LEAP username")); @@ -73,7 +73,7 @@ validate (EAPMethod *parent, GError **error) return TRUE; } - text = gtk_entry_get_text (self->password_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); if (!text || !strlen (text)) { widget_set_error (GTK_WIDGET (self->password_entry)); if (ret) { @@ -106,8 +106,8 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla nm_setting_802_1x_add_eap_method (s_8021x, "leap"); - g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->username_entry), NULL); - g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text (self->password_entry), NULL); + g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_editable_get_text (GTK_EDITABLE (self->username_entry)), NULL); + g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_editable_get_text (GTK_EDITABLE (self->password_entry)), NULL); /* Save 802.1X password flags to the connection */ secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry)); @@ -146,42 +146,42 @@ static const gchar * get_username (EAPMethod *method) { EAPMethodLEAP *self = EAP_METHOD_LEAP (method); - return gtk_entry_get_text (self->username_entry); + return gtk_editable_get_text (GTK_EDITABLE (self->username_entry)); } static void set_username (EAPMethod *method, const gchar *username) { EAPMethodLEAP *self = EAP_METHOD_LEAP (method); - gtk_entry_set_text (self->username_entry, username); + gtk_editable_set_text (GTK_EDITABLE (self->username_entry), username); } static const gchar * get_password (EAPMethod *method) { EAPMethodLEAP *self = EAP_METHOD_LEAP (method); - return gtk_entry_get_text (self->password_entry); + return gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); } static void set_password (EAPMethod *method, const gchar *password) { EAPMethodLEAP *self = EAP_METHOD_LEAP (method); - gtk_entry_set_text (self->password_entry, password); + gtk_editable_set_text (GTK_EDITABLE (self->password_entry), password); } static gboolean get_show_password (EAPMethod *method) { EAPMethodLEAP *self = EAP_METHOD_LEAP (method); - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + return gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); } static void set_show_password (EAPMethod *method, gboolean show_password) { EAPMethodLEAP *self = EAP_METHOD_LEAP (method); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->show_password_check), show_password); + gtk_check_button_set_active (self->show_password_check, show_password); } static void diff --git a/panels/network/wireless-security/eap-method-leap.ui b/panels/network/wireless-security/eap-method-leap.ui index abb6ea442..3f945bd3d 100644 --- a/panels/network/wireless-security/eap-method-leap.ui +++ b/panels/network/wireless-security/eap-method-leap.ui @@ -2,79 +2,62 @@ <interface> <requires lib="gtk+" version="3.4"/> <template class="EAPMethodLEAP" parent="GtkGrid"> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> - <placeholder/> - </child> - <child> <object class="GtkLabel" id="username_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Username</property> <property name="use_underline">True</property> <property name="mnemonic_widget">username_entry</property> + <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="password_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Password</property> <property name="use_underline">True</property> <property name="mnemonic_widget">password_entry</property> + <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="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> - <property name="activates_default">True</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> <child> <object class="GtkCheckButton" id="show_password_check"> <property name="label" translatable="yes">Sho_w password</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkEntry" id="username_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</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> </template> </interface> diff --git a/panels/network/wireless-security/eap-method-peap.c b/panels/network/wireless-security/eap-method-peap.c index 08997cde3..b30419da1 100644 --- a/panels/network/wireless-security/eap-method-peap.c +++ b/panels/network/wireless-security/eap-method-peap.c @@ -27,6 +27,7 @@ #include "eap-method-simple.h" #include "helpers.h" #include "ui-helpers.h" +#include "ws-file-chooser-button.h" #define I_NAME_COLUMN 0 #define I_ID_COLUMN 1 @@ -36,7 +37,7 @@ struct _EAPMethodPEAP { GtkEntry *anon_identity_entry; GtkLabel *anon_identity_label; - GtkFileChooserButton *ca_cert_button; + WsFileChooserButton *ca_cert_button; GtkLabel *ca_cert_label; GtkCheckButton *ca_cert_not_required_check; GtkBox *inner_auth_box; @@ -82,17 +83,17 @@ validate (EAPMethod *method, GError **error) EAPMethodPEAP *self = EAP_METHOD_PEAP (method); g_autoptr(GError) local_error = NULL; - if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->ca_cert_button), + if (!eap_method_validate_filepicker (ws_file_chooser_button_get_filechooser (self->ca_cert_button), TYPE_CA_CERT, NULL, NULL, &local_error)) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-PEAP CA certificate: %s"), local_error->message); return FALSE; } - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check))) { - g_autofree gchar *filename = NULL; + if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (self->ca_cert_not_required_check))) { + g_autoptr(GFile) file = NULL; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); - if (filename == NULL) { + file = ws_file_chooser_button_get_file (self->ca_cert_button); + if (file == NULL) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-PEAP CA certificate: no certificate specified")); return FALSE; } @@ -104,8 +105,8 @@ validate (EAPMethod *method, GError **error) static void ca_cert_not_required_toggled (EAPMethodPEAP *self) { - eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), - GTK_FILE_CHOOSER (self->ca_cert_button)); + eap_method_ca_cert_not_required_toggled (self->ca_cert_not_required_check, + ws_file_chooser_button_get_filechooser (self->ca_cert_button)); eap_method_emit_changed (EAP_METHOD (self)); } @@ -133,6 +134,7 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; const char *text; g_autofree gchar *filename = NULL; + g_autoptr(GFile) file = NULL; int peapver_active = 0; g_autoptr(GError) error = NULL; gboolean ca_cert_error = FALSE; @@ -142,11 +144,12 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla nm_setting_802_1x_add_eap_method (s_8021x, "peap"); - text = gtk_entry_get_text (self->anon_identity_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->anon_identity_entry)); if (text && strlen (text)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL); - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); + file = ws_file_chooser_button_get_file (self->ca_cert_button); + filename = file ? g_file_get_path (file) : NULL; if (!nm_setting_802_1x_set_ca_cert (s_8021x, filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) { g_warning ("Couldn't read CA certificate '%s': %s", filename, error ? error->message : "(unknown)"); ca_cert_error = TRUE; @@ -173,21 +176,21 @@ static void inner_auth_combo_changed_cb (EAPMethodPEAP *self) { EAPMethod *inner_method; - GList *children; + GtkWidget *child; inner_method = get_inner_method (self); /* Remove the previous method and migrate username/password across */ - children = gtk_container_get_children (GTK_CONTAINER (self->inner_auth_box)); - if (children != NULL) { - EAPMethod *old_eap = g_list_nth_data (children, 0); + child = gtk_widget_get_first_child (GTK_WIDGET (self->inner_auth_box)); + if (child != NULL) { + EAPMethod *old_eap = EAP_METHOD (child); eap_method_set_username (inner_method, eap_method_get_username (old_eap)); eap_method_set_password (inner_method, eap_method_get_password (old_eap)); eap_method_set_show_password (inner_method, eap_method_get_show_password (old_eap)); - gtk_container_remove (GTK_CONTAINER (self->inner_auth_box), GTK_WIDGET (old_eap)); + gtk_box_remove (self->inner_auth_box, GTK_WIDGET (old_eap)); } - gtk_container_add (GTK_CONTAINER (self->inner_auth_box), g_object_ref (GTK_WIDGET (inner_method))); + gtk_box_append (self->inner_auth_box, g_object_ref (GTK_WIDGET (inner_method))); eap_method_emit_changed (EAP_METHOD (self)); } @@ -323,21 +326,21 @@ eap_method_peap_new (NMConnection *connection) g_signal_connect_swapped (self->ca_cert_not_required_check, "toggled", G_CALLBACK (ca_cert_not_required_toggled), self); - gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->ca_cert_button), TRUE); - gtk_file_chooser_button_set_title (self->ca_cert_button, - _("Choose a Certificate Authority certificate")); - g_signal_connect_swapped (self->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb), self); + g_signal_connect_swapped (self->ca_cert_button, "notify::file", G_CALLBACK (changed_cb), self); filter = eap_method_default_file_chooser_filter_new (FALSE); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->ca_cert_button), filter); + gtk_file_chooser_add_filter (ws_file_chooser_button_get_filechooser (self->ca_cert_button), + filter); if (connection && s_8021x) { filename = NULL; if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) { filename = nm_setting_802_1x_get_ca_cert_path (s_8021x); - if (filename) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->ca_cert_button), filename); + if (filename) { + g_autoptr(GFile) file = g_file_new_for_path (filename); + ws_file_chooser_button_set_file (self->ca_cert_button, file); + } } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), - !filename && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)); + gtk_check_button_set_active (self->ca_cert_not_required_check, + !filename && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)); } self->em_mschap_v2 = eap_method_simple_new (connection, "mschapv2", TRUE, FALSE); @@ -389,7 +392,7 @@ eap_method_peap_new (NMConnection *connection) g_signal_connect_swapped (self->version_combo, "changed", G_CALLBACK (changed_cb), self); if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x)) - gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity (s_8021x)); + gtk_editable_set_text (GTK_EDITABLE (self->anon_identity_entry), nm_setting_802_1x_get_anonymous_identity (s_8021x)); g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self); return self; diff --git a/panels/network/wireless-security/eap-method-peap.ui b/panels/network/wireless-security/eap-method-peap.ui index 32766bf7a..ac04783d9 100644 --- a/panels/network/wireless-security/eap-method-peap.ui +++ b/panels/network/wireless-security/eap-method-peap.ui @@ -41,95 +41,82 @@ </data> </object> <template class="EAPMethodPEAP" parent="GtkGrid"> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="anon_identity_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Anony_mous identity</property> <property name="use_underline">True</property> <property name="mnemonic_widget">anon_identity_entry</property> + <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="anon_identity_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="ca_cert_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">C_A certificate</property> <property name="use_underline">True</property> <property name="mnemonic_widget">ca_cert_button</property> + <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="GtkFileChooserButton" id="ca_cert_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="WsFileChooserButton" id="ca_cert_button"> <property name="hexpand">True</property> + <property name="title" translatable="yes">Choose a Certificate Authority certificate</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> <child> <object class="GtkCheckButton" id="ca_cert_not_required_check"> <property name="label" translatable="yes">No CA certificate is _required</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkLabel" id="version_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">PEAP _version</property> <property name="use_underline">True</property> <property name="mnemonic_widget">version_combo</property> + <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="GtkComboBox" id="version_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">version_model</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -137,31 +124,27 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> </child> <child> <object class="GtkLabel" id="inner_auth_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Inner authentication</property> <property name="use_underline">True</property> <property name="mnemonic_widget">inner_auth_combo</property> + <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="GtkComboBox" id="inner_auth_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">inner_auth_model</property> + <layout> + <property name="column">1</property> + <property name="row">4</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -169,25 +152,16 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> - </packing> </child> <child> <object class="GtkBox" id="inner_auth_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> + <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> </template> </interface> diff --git a/panels/network/wireless-security/eap-method-simple.c b/panels/network/wireless-security/eap-method-simple.c index bb405a48b..d0f0b2200 100644 --- a/panels/network/wireless-security/eap-method-simple.c +++ b/panels/network/wireless-security/eap-method-simple.c @@ -54,7 +54,7 @@ show_toggled_cb (EAPMethodSimple *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); gtk_entry_set_visibility (self->password_entry, visible); } @@ -72,7 +72,7 @@ validate (EAPMethod *method, GError **error) const char *text; gboolean ret = TRUE; - text = gtk_entry_get_text (self->username_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->username_entry)); if (!text || !strlen (text)) { widget_set_error (GTK_WIDGET (self->username_entry)); g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP username")); @@ -84,7 +84,7 @@ validate (EAPMethod *method, GError **error) if (always_ask_selected (self->password_entry)) widget_unset_error (GTK_WIDGET (self->password_entry)); else { - text = gtk_entry_get_text (self->password_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); if (!text || !strlen (text)) { widget_set_error (GTK_WIDGET (self->password_entry)); if (ret) { @@ -139,7 +139,7 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla } else nm_setting_802_1x_add_eap_method (s_8021x, self->name); - g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->username_entry), NULL); + g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_editable_get_text (GTK_EDITABLE (self->username_entry)), NULL); /* Save the password always ask setting */ not_saved = always_ask_selected (self->password_entry); @@ -152,7 +152,7 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla * user checked "Always Ask". */ if (not_saved == FALSE) - g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text (self->password_entry), NULL); + g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_editable_get_text (GTK_EDITABLE (self->password_entry)), NULL); /* Update secret flags and popup when editing the connection */ nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), flags, @@ -193,42 +193,42 @@ static const gchar * get_username (EAPMethod *method) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (method); - return gtk_entry_get_text (self->username_entry); + return gtk_editable_get_text (GTK_EDITABLE (self->username_entry)); } static void set_username (EAPMethod *method, const gchar *username) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (method); - gtk_entry_set_text (self->username_entry, username); + gtk_editable_set_text (GTK_EDITABLE (self->username_entry), username); } static const gchar * get_password (EAPMethod *method) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (method); - return gtk_entry_get_text (self->password_entry); + return gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); } static void set_password (EAPMethod *method, const gchar *password) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (method); - gtk_entry_set_text (self->password_entry, password); + gtk_editable_set_text (GTK_EDITABLE (self->password_entry), password); } static gboolean get_show_password (EAPMethod *method) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (method); - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + return gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); } static void set_show_password (EAPMethod *method, gboolean show_password) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (method); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->show_password_check), show_password); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->show_password_check), show_password); } static gboolean @@ -249,7 +249,7 @@ password_storage_changed (EAPMethodSimple *self) if (always_ask) { /* we always clear this button and do not restore it * (because we want to hide the password). */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->show_password_check), FALSE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->show_password_check), FALSE); } gtk_widget_set_sensitive (GTK_WIDGET (self->show_password_check), !always_ask); diff --git a/panels/network/wireless-security/eap-method-simple.ui b/panels/network/wireless-security/eap-method-simple.ui index 59691ba7b..e5c37c96b 100644 --- a/panels/network/wireless-security/eap-method-simple.ui +++ b/panels/network/wireless-security/eap-method-simple.ui @@ -2,95 +2,67 @@ <interface> <requires lib="gtk+" version="3.4"/> <template class="EAPMethodSimple" parent="GtkGrid"> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> - <placeholder/> - </child> - <child> <object class="GtkLabel" id="username_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Username</property> <property name="use_underline">True</property> <property name="mnemonic_widget">username_entry</property> + <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="password_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Password</property> <property name="use_underline">True</property> <property name="mnemonic_widget">password_entry</property> + <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="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> - <property name="activates_default">True</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> <child> <object class="GtkEntry" id="username_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> <child> <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="orientation">vertical</property> + <layout> + <property name="column">1</property> + <property name="row">2</property> + </layout> <child> <object class="GtkCheckButton" id="show_password_check"> <property name="label" translatable="yes">Sho_w password</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</property> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> </child> </template> </interface> diff --git a/panels/network/wireless-security/eap-method-tls.c b/panels/network/wireless-security/eap-method-tls.c index fb039d740..3bf79adb8 100644 --- a/panels/network/wireless-security/eap-method-tls.c +++ b/panels/network/wireless-security/eap-method-tls.c @@ -27,21 +27,22 @@ #include "helpers.h" #include "nma-ui-utils.h" #include "ui-helpers.h" +#include "ws-file-chooser-button.h" struct _EAPMethodTLS { GtkGrid parent; - GtkFileChooserButton *ca_cert_button; + WsFileChooserButton *ca_cert_button; GtkLabel *ca_cert_label; GtkCheckButton *ca_cert_not_required_check; GtkEntry *identity_entry; GtkLabel *identity_label; - GtkFileChooserButton *private_key_button; + WsFileChooserButton *private_key_button; GtkLabel *private_key_label; GtkEntry *private_key_password_entry; GtkLabel *private_key_password_label; GtkCheckButton *show_password_check; - GtkFileChooserButton *user_cert_button; + WsFileChooserButton *user_cert_button; GtkLabel *user_cert_label; gchar *username; @@ -70,7 +71,7 @@ show_toggled_cb (EAPMethodTLS *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); gtk_entry_set_visibility (self->private_key_password_entry, visible); } @@ -86,7 +87,7 @@ validate (EAPMethod *method, GError **error) g_autoptr(GError) user_cert_error = NULL; gboolean ret = TRUE; - identity = gtk_entry_get_text (self->identity_entry); + identity = gtk_editable_get_text (GTK_EDITABLE (self->identity_entry)); if (!identity || !strlen (identity)) { widget_set_error (GTK_WIDGET (self->identity_entry)); g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP-TLS identity")); @@ -95,18 +96,18 @@ validate (EAPMethod *method, GError **error) widget_unset_error (GTK_WIDGET (self->identity_entry)); } - if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->ca_cert_button), + if (!eap_method_validate_filepicker (ws_file_chooser_button_get_filechooser (self->ca_cert_button), TYPE_CA_CERT, NULL, NULL, &ca_cert_error)) { widget_set_error (GTK_WIDGET (self->ca_cert_button)); if (ret) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TLS CA certificate: %s"), ca_cert_error->message); ret = FALSE; } - } else if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check))) { - g_autofree gchar *filename = NULL; + } else if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (self->ca_cert_not_required_check))) { + g_autoptr(GFile) file = NULL; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); - if (filename == NULL) { + file = ws_file_chooser_button_get_file (self->ca_cert_button); + if (file == NULL) { widget_set_error (GTK_WIDGET (self->ca_cert_button)); if (ret) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TLS CA certificate: no certificate specified")); @@ -115,12 +116,12 @@ validate (EAPMethod *method, GError **error) } } - password = gtk_entry_get_text (self->private_key_password_entry); + password = gtk_editable_get_text (GTK_EDITABLE (self->private_key_password_entry)); secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->private_key_password_entry)); if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) password = NULL; - if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->private_key_button), + if (!eap_method_validate_filepicker (ws_file_chooser_button_get_filechooser (self->private_key_button), TYPE_PRIVATE_KEY, password, &format, @@ -133,7 +134,7 @@ validate (EAPMethod *method, GError **error) } if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) { - if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->user_cert_button), + if (!eap_method_validate_filepicker (ws_file_chooser_button_get_filechooser (self->user_cert_button), TYPE_CLIENT_CERT, NULL, NULL, &user_cert_error)) { if (ret) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TLS user-certificate: %s"), user_cert_error->message); @@ -149,8 +150,8 @@ validate (EAPMethod *method, GError **error) static void ca_cert_not_required_toggled (EAPMethodTLS *self) { - eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), - GTK_FILE_CHOOSER (self->ca_cert_button)); + eap_method_ca_cert_not_required_toggled (self->ca_cert_not_required_check, + ws_file_chooser_button_get_filechooser (self->ca_cert_button)); eap_method_emit_changed (EAP_METHOD (self)); } @@ -175,7 +176,9 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla NMSetting8021x *s_8021x; NMSettingSecretFlags secret_flags; g_autofree gchar *ca_filename = NULL; + g_autoptr(GFile) ca_file = NULL; g_autofree gchar *pk_filename = NULL; + g_autoptr(GFile) pk_file = NULL; const char *password = NULL; gboolean ca_cert_error = FALSE; g_autoptr(GError) error = NULL; @@ -186,16 +189,17 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla nm_setting_802_1x_add_eap_method (s_8021x, "tls"); - g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->identity_entry), NULL); + g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_editable_get_text (GTK_EDITABLE (self->identity_entry)), NULL); /* TLS private key */ - password = gtk_entry_get_text (self->private_key_password_entry); + password = gtk_editable_get_text (GTK_EDITABLE (self->private_key_password_entry)); secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->private_key_password_entry)); if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) password = NULL; - pk_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->private_key_button)); - g_assert (pk_filename); + pk_file = ws_file_chooser_button_get_file (self->private_key_button); + g_assert (pk_file); + pk_filename = g_file_get_path (pk_file); if (!nm_setting_802_1x_set_private_key (s_8021x, pk_filename, password, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) g_warning ("Couldn't read private key '%s': %s", pk_filename, error ? error->message : "(unknown)"); @@ -211,13 +215,15 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla /* TLS client certificate */ if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) { g_autofree gchar *cc_filename = NULL; + g_autoptr(GFile) cc_file = NULL; g_autoptr(GError) error = NULL; /* If the key is pkcs#12 nm_setting_802_1x_set_private_key() already * set the client certificate for us. */ - cc_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->user_cert_button)); - g_assert (cc_filename); + cc_file = ws_file_chooser_button_get_file (self->private_key_button); + g_assert (cc_file); + cc_filename = g_file_get_path (cc_file); format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; if (!nm_setting_802_1x_set_client_cert (s_8021x, cc_filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) @@ -225,7 +231,8 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla } /* TLS CA certificate */ - ca_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); + ca_file = ws_file_chooser_button_get_file (self->private_key_button); + ca_filename = ca_file ? g_file_get_path (ca_file) : NULL; format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error2)) { @@ -242,14 +249,14 @@ private_key_picker_helper (EAPMethodTLS *self, const char *filename, gboolean ch NMSetting8021xCKFormat cert_format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; const char *password; - password = gtk_entry_get_text (self->private_key_password_entry); + password = gtk_editable_get_text (GTK_EDITABLE (self->private_key_password_entry)); setting = (NMSetting8021x *) nm_setting_802_1x_new (); nm_setting_802_1x_set_private_key (setting, filename, password, NM_SETTING_802_1X_CK_SCHEME_PATH, &cert_format, NULL); /* With PKCS#12, the client cert must be the same as the private key */ if (cert_format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) { - gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (self->user_cert_button)); + ws_file_chooser_button_set_file (self->user_cert_button, NULL); gtk_widget_set_sensitive (GTK_WIDGET (self->user_cert_button), FALSE); } else if (changed) gtk_widget_set_sensitive (GTK_WIDGET (self->user_cert_button), TRUE); @@ -257,12 +264,12 @@ private_key_picker_helper (EAPMethodTLS *self, const char *filename, gboolean ch /* Warn the user if the private key is unencrypted */ if (!eap_method_is_encrypted_private_key (filename)) { GtkWidget *dialog; - GtkWidget *toplevel; + GtkNative *native; GtkWindow *parent_window = NULL; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self)); - if (gtk_widget_is_toplevel (toplevel)) - parent_window = GTK_WINDOW (toplevel); + native = gtk_widget_get_native (GTK_WIDGET (self)); + if (GTK_IS_WINDOW (native)) + parent_window = GTK_WINDOW (native); dialog = gtk_message_dialog_new (parent_window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -273,18 +280,19 @@ private_key_picker_helper (EAPMethodTLS *self, const char *filename, gboolean ch gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", _("The selected private key does not appear to be protected by a password. This could allow your security credentials to be compromised. Please select a password-protected private key.\n\n(You can password-protect your private key with openssl)")); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); + gtk_window_present (GTK_WINDOW (dialog)); } } static void -private_key_picker_file_set_cb (GtkWidget *chooser, gpointer user_data) +private_key_picker_file_set_cb (WsFileChooserButton *chooser, gpointer user_data) { EAPMethodTLS *self = user_data; + g_autoptr(GFile) file = NULL; g_autofree gchar *filename = NULL; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); + file = ws_file_chooser_button_get_file (chooser); + filename = file ? g_file_get_path (file) : NULL; if (filename) private_key_picker_helper (self, filename, TRUE); } @@ -309,7 +317,7 @@ changed_cb (EAPMethodTLS *self) static void setup_filepicker (EAPMethodTLS *self, - GtkFileChooserButton *button, + WsFileChooserButton *button, const char *title, NMSetting8021x *s_8021x, SchemeFunc scheme_func, @@ -320,14 +328,13 @@ setup_filepicker (EAPMethodTLS *self, GtkFileFilter *filter; const char *filename = NULL; - gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (button), TRUE); - gtk_file_chooser_button_set_title (button, title); - if (s_8021x && path_func && scheme_func) { if (scheme_func (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) { filename = path_func (s_8021x); - if (filename) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (button), filename); + if (filename) { + g_autoptr(GFile) file = g_file_new_for_path (filename); + ws_file_chooser_button_set_file (button, file); + } } } @@ -335,17 +342,17 @@ setup_filepicker (EAPMethodTLS *self, * and desensitize the user cert button. */ if (privkey) { - g_signal_connect (button, "selection-changed", - (GCallback) private_key_picker_file_set_cb, + g_signal_connect (button, "notify::file", + G_CALLBACK (private_key_picker_file_set_cb), self); if (filename) private_key_picker_helper (self, filename, FALSE); } - g_signal_connect_swapped (button, "selection-changed", G_CALLBACK (changed_cb), self); + g_signal_connect_swapped (button, "notify::file", G_CALLBACK (changed_cb), self); filter = eap_method_default_file_chooser_filter_new (privkey); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (button), filter); + gtk_file_chooser_add_filter (ws_file_chooser_button_get_filechooser (button), filter); /* For some reason, GTK+ calls set_current_filter (..., NULL) from * gtkfilechooserdefault.c::show_and_select_files_finished_loading() on our @@ -372,8 +379,10 @@ update_secrets (EAPMethod *method, NMConnection *connection) s_8021x = nm_connection_get_setting_802_1x (connection); if (s_8021x && (nm_setting_802_1x_get_private_key_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH)) { filename = nm_setting_802_1x_get_private_key_path (s_8021x); - if (filename) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->private_key_button), filename); + if (filename) { + g_autoptr(GFile) file = g_file_new_for_path (filename); + ws_file_chooser_button_set_file (self->private_key_button, file); + } } } @@ -450,6 +459,8 @@ eap_method_tls_class_init (EAPMethodTLSClass *klass) object_class->dispose = eap_method_tls_dispose; + g_type_ensure (WS_TYPE_FILE_CHOOSER_BUTTON); + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/ControlCenter/network/eap-method-tls.ui"); gtk_widget_class_bind_template_child (widget_class, EAPMethodTLS, ca_cert_button); @@ -499,7 +510,7 @@ eap_method_tls_new (NMConnection *connection) g_signal_connect_swapped (self->identity_entry, "changed", G_CALLBACK (changed_cb), self); if (s_8021x && nm_setting_802_1x_get_identity (s_8021x)) - gtk_entry_set_text (self->identity_entry, nm_setting_802_1x_get_identity (s_8021x)); + gtk_editable_set_text (GTK_EDITABLE (self->identity_entry), nm_setting_802_1x_get_identity (s_8021x)); setup_filepicker (self, self->user_cert_button, @@ -523,9 +534,11 @@ eap_method_tls_new (NMConnection *connection) nm_setting_802_1x_get_private_key_path, TRUE, FALSE); - if (connection && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)) - ca_not_required = !gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), ca_not_required); + if (connection && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)) { + g_autoptr(GFile) file = ws_file_chooser_button_get_file (self->ca_cert_button); + ca_not_required = !file; + } + gtk_check_button_set_active (self->ca_cert_not_required_check, ca_not_required); /* Fill secrets, if any */ if (connection) diff --git a/panels/network/wireless-security/eap-method-tls.ui b/panels/network/wireless-security/eap-method-tls.ui index 61f8e5d4d..69c261013 100644 --- a/panels/network/wireless-security/eap-method-tls.ui +++ b/panels/network/wireless-security/eap-method-tls.ui @@ -2,170 +2,138 @@ <interface> <requires lib="gtk+" version="3.4"/> <template class="EAPMethodTLS" parent="GtkGrid"> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> - <placeholder/> - </child> - <child> <object class="GtkLabel" id="identity_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">I_dentity</property> <property name="use_underline">True</property> <property name="mnemonic_widget">identity_entry</property> + <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="identity_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="user_cert_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_User certificate</property> <property name="use_underline">True</property> <property name="mnemonic_widget">user_cert_button</property> + <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="GtkFileChooserButton" id="user_cert_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="WsFileChooserButton" id="user_cert_button"> <property name="hexpand">True</property> + <property name="title" translatable="yes">Choose a Certificate Authority certificate</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> <child> <object class="GtkLabel" id="ca_cert_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">C_A certificate</property> <property name="use_underline">True</property> <property name="mnemonic_widget">ca_cert_button</property> + <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="GtkFileChooserButton" id="ca_cert_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="WsFileChooserButton" id="ca_cert_button"> <property name="hexpand">True</property> + <property name="title" translatable="yes">Choose a Certificate Authority certificate</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> <child> <object class="GtkCheckButton" id="ca_cert_not_required_check"> <property name="label" translatable="yes">No CA certificate is _required</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkLabel" id="private_key_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Private _key</property> <property name="use_underline">True</property> <property name="mnemonic_widget">private_key_button</property> + <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="GtkFileChooserButton" id="private_key_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="WsFileChooserButton" id="private_key_button"> <property name="hexpand">True</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> <child> <object class="GtkLabel" id="private_key_password_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Private key password</property> <property name="use_underline">True</property> <property name="mnemonic_widget">private_key_password_entry</property> + <layout> + <property name="column">0</property> + <property name="row">5</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> - </packing> </child> <child> <object class="GtkEntry" id="private_key_password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> - <property name="activates_default">True</property> + <layout> + <property name="column">1</property> + <property name="row">5</property> + </layout> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> - </packing> </child> <child> <object class="GtkCheckButton" id="show_password_check"> <property name="label" translatable="yes">Sho_w password</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> </template> </interface> diff --git a/panels/network/wireless-security/eap-method-ttls.c b/panels/network/wireless-security/eap-method-ttls.c index fc7cd603a..699566706 100644 --- a/panels/network/wireless-security/eap-method-ttls.c +++ b/panels/network/wireless-security/eap-method-ttls.c @@ -26,6 +26,7 @@ #include "eap-method-simple.h" #include "eap-method-ttls.h" #include "helpers.h" +#include "ws-file-chooser-button.h" #define I_NAME_COLUMN 0 #define I_ID_COLUMN 1 @@ -35,7 +36,7 @@ struct _EAPMethodTTLS { GtkEntry *anon_identity_entry; GtkLabel *anon_identity_label; - GtkFileChooserButton *ca_cert_button; + WsFileChooserButton *ca_cert_button; GtkLabel *ca_cert_label; GtkCheckButton *ca_cert_not_required_check; GtkEntry *domain_match_entry; @@ -93,16 +94,16 @@ validate (EAPMethod *method, GError **error) EAPMethodTTLS *self = EAP_METHOD_TTLS (method); g_autoptr(GError) local_error = NULL; - if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->ca_cert_button), + if (!eap_method_validate_filepicker (ws_file_chooser_button_get_filechooser (self->ca_cert_button), TYPE_CA_CERT, NULL, NULL, &local_error)) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: %s"), local_error->message); return FALSE; } - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check))) { - g_autofree gchar *filename = NULL; + if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (self->ca_cert_not_required_check))) { + g_autoptr(GFile) file = NULL; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); - if (filename == NULL) { + file = ws_file_chooser_button_get_file (self->ca_cert_button); + if (file == NULL) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: no certificate specified")); return FALSE; } @@ -114,8 +115,8 @@ validate (EAPMethod *method, GError **error) static void ca_cert_not_required_toggled (EAPMethodTTLS *self) { - eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), - GTK_FILE_CHOOSER (self->ca_cert_button)); + eap_method_ca_cert_not_required_toggled (self->ca_cert_not_required_check, + ws_file_chooser_button_get_filechooser (self->ca_cert_button)); eap_method_emit_changed (EAP_METHOD (self)); } @@ -148,6 +149,7 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla const char *text; g_autofree gchar *filename = NULL; g_autoptr(GError) error = NULL; + g_autoptr(GFile) file = NULL; gboolean ca_cert_error = FALSE; s_8021x = nm_connection_get_setting_802_1x (connection); @@ -155,15 +157,16 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla nm_setting_802_1x_add_eap_method (s_8021x, "ttls"); - text = gtk_entry_get_text (self->anon_identity_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->anon_identity_entry)); if (text && strlen (text)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL); - text = gtk_entry_get_text (self->domain_match_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->domain_match_entry)); if (text && strlen (text)) g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL); - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button)); + file = ws_file_chooser_button_get_file (self->ca_cert_button); + filename = file ? g_file_get_path (file) : NULL; if (!nm_setting_802_1x_set_ca_cert (s_8021x, filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) { g_warning ("Couldn't read CA certificate '%s': %s", filename, error ? error->message : "(unknown)"); ca_cert_error = TRUE; @@ -177,21 +180,21 @@ static void inner_auth_combo_changed_cb (EAPMethodTTLS *self) { EAPMethod *inner_method; - GList *children; + GtkWidget *child; inner_method = get_inner_method (self); /* Remove the previous method and migrate username/password across */ - children = gtk_container_get_children (GTK_CONTAINER (self->inner_auth_box)); - if (children != NULL) { - EAPMethod *old_eap = g_list_nth_data (children, 0); + child = gtk_widget_get_first_child (GTK_WIDGET (self->inner_auth_box)); + if (child != NULL) { + EAPMethod *old_eap = EAP_METHOD (child); eap_method_set_username (inner_method, eap_method_get_username (old_eap)); eap_method_set_password (inner_method, eap_method_get_password (old_eap)); eap_method_set_show_password (inner_method, eap_method_get_show_password (old_eap)); - gtk_container_remove (GTK_CONTAINER (self->inner_auth_box), GTK_WIDGET (old_eap)); + gtk_box_remove (self->inner_auth_box, child); } - gtk_container_add (GTK_CONTAINER (self->inner_auth_box), g_object_ref (GTK_WIDGET (inner_method))); + gtk_box_append (self->inner_auth_box, g_object_ref (GTK_WIDGET (inner_method))); eap_method_emit_changed (EAP_METHOD (self)); } @@ -331,28 +334,28 @@ eap_method_ttls_new (NMConnection *connection) g_signal_connect_swapped (self->ca_cert_not_required_check, "toggled", G_CALLBACK (ca_cert_not_required_toggled), self); - gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->ca_cert_button), TRUE); - gtk_file_chooser_button_set_title (self->ca_cert_button, - _("Choose a Certificate Authority certificate")); - g_signal_connect_swapped (self->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb), self); + g_signal_connect_swapped (self->ca_cert_button, "notify::file", G_CALLBACK (changed_cb), self); filter = eap_method_default_file_chooser_filter_new (FALSE); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->ca_cert_button), filter); + gtk_file_chooser_add_filter (ws_file_chooser_button_get_filechooser (self->ca_cert_button), + filter); if (connection && s_8021x) { filename = NULL; if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) { filename = nm_setting_802_1x_get_ca_cert_path (s_8021x); - if (filename) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->ca_cert_button), filename); + if (filename) { + g_autoptr(GFile) file = g_file_new_for_path (filename); + ws_file_chooser_button_set_file (self->ca_cert_button, file); + } } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), - !filename && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)); + gtk_check_button_set_active (self->ca_cert_not_required_check, + !filename && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)); } if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x)) - gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity (s_8021x)); + gtk_editable_set_text (GTK_EDITABLE (self->anon_identity_entry), nm_setting_802_1x_get_anonymous_identity (s_8021x)); g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self); if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x)) - gtk_entry_set_text (self->domain_match_entry, nm_setting_802_1x_get_domain_suffix_match (s_8021x)); + gtk_editable_set_text (GTK_EDITABLE (self->domain_match_entry), nm_setting_802_1x_get_domain_suffix_match (s_8021x)); g_signal_connect_swapped (self->domain_match_entry, "changed", G_CALLBACK (changed_cb), self); self->em_pap = eap_method_simple_new (connection, "pap", TRUE, FALSE); diff --git a/panels/network/wireless-security/eap-method-ttls.ui b/panels/network/wireless-security/eap-method-ttls.ui index 2ba7d2011..b10dac29a 100644 --- a/panels/network/wireless-security/eap-method-ttls.ui +++ b/panels/network/wireless-security/eap-method-ttls.ui @@ -40,122 +40,103 @@ </data> </object> <template class="EAPMethodTTLS" parent="GtkGrid"> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="anon_identity_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Anony_mous identity</property> <property name="use_underline">True</property> <property name="mnemonic_widget">anon_identity_entry</property> + <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="anon_identity_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="domain_match_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">_Domain</property> <property name="use_underline">True</property> <property name="mnemonic_widget">domain_match_entry</property> <property name="xalign">1</property> + <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="domain_match_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="ca_cert_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">C_A certificate</property> <property name="use_underline">True</property> <property name="mnemonic_widget">ca_cert_button</property> <property name="xalign">1</property> + <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="GtkFileChooserButton" id="ca_cert_button"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <object class="WsFileChooserButton" id="ca_cert_button"> <property name="hexpand">True</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> <child> <object class="GtkCheckButton" id="ca_cert_not_required_check"> <property name="label" translatable="yes">No CA certificate is _required</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="halign">start</property> <property name="hexpand">True</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkLabel" id="inner_auth_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">_Inner authentication</property> <property name="use_underline">True</property> <property name="mnemonic_widget">inner_auth_combo</property> <property name="xalign">1</property> + <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="GtkComboBox" id="inner_auth_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">inner_auth_model</property> + <layout> + <property name="column">1</property> + <property name="row">4</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -163,26 +144,17 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> - </packing> </child> <child> <object class="GtkBox" id="inner_auth_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <child> - <placeholder/> - </child> + <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> </template> </interface> diff --git a/panels/network/wireless-security/eap-method.c b/panels/network/wireless-security/eap-method.c index fdda35b56..26135b683 100644 --- a/panels/network/wireless-security/eap-method.c +++ b/panels/network/wireless-security/eap-method.c @@ -181,6 +181,7 @@ eap_method_validate_filepicker (GtkFileChooser *chooser, { g_autofree gchar *filename = NULL; g_autoptr(NMSetting8021x) setting = NULL; + g_autoptr(GFile) file = NULL; gboolean success = TRUE; if (item_type == TYPE_PRIVATE_KEY) { @@ -188,8 +189,8 @@ eap_method_validate_filepicker (GtkFileChooser *chooser, success = FALSE; } - filename = gtk_file_chooser_get_filename (chooser); - if (!filename) { + file = gtk_file_chooser_get_file (chooser); + if (!file) { if (item_type != TYPE_CA_CERT) { success = FALSE; g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("no file selected")); @@ -197,6 +198,7 @@ eap_method_validate_filepicker (GtkFileChooser *chooser, goto out; } + filename = g_file_get_path (file); if (!g_file_test (filename, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { success = FALSE; goto out; @@ -358,34 +360,24 @@ out: } #endif -static gboolean -default_filter_privkey (const GtkFileFilterInfo *filter_info, gpointer user_data) -{ - const char *extensions[] = { ".der", ".pem", ".p12", ".key", NULL }; - - if (!filter_info->filename) - return FALSE; - - if (!file_has_extension (filter_info->filename, extensions)) - return FALSE; - - return TRUE; -} +static const char *privkey_extensions[] = { + ".der", ".pem", ".p12", ".key", NULL +}; +static const char *cert_extensions[] = { + ".der", ".pem", ".crt", ".cer", NULL +}; -static gboolean -default_filter_cert (const GtkFileFilterInfo *filter_info, gpointer user_data) +static void +add_file_extensions_to_filter (GtkFileFilter *filter, + const char **extensions) { - const char *extensions[] = { ".der", ".pem", ".crt", ".cer", NULL }; + int i; - if (!filter_info->filename) - return FALSE; - - if (!file_has_extension (filter_info->filename, extensions)) - return FALSE; - - return TRUE; + for (i = 0; extensions[i] != NULL; i++) + gtk_file_filter_add_suffix (filter, extensions[i]); } + GtkFileFilter * eap_method_default_file_chooser_filter_new (gboolean privkey) { @@ -393,10 +385,10 @@ eap_method_default_file_chooser_filter_new (gboolean privkey) filter = gtk_file_filter_new (); if (privkey) { - gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME, default_filter_privkey, NULL, NULL); + add_file_extensions_to_filter (filter, privkey_extensions); gtk_file_filter_set_name (filter, _("DER, PEM, or PKCS#12 private keys (*.der, *.pem, *.p12, *.key)")); } else { - gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME, default_filter_cert, NULL, NULL); + add_file_extensions_to_filter (filter, cert_extensions); gtk_file_filter_set_name (filter, _("DER or PEM certificates (*.der, *.pem, *.crt, *.cer)")); } return filter; @@ -405,10 +397,9 @@ eap_method_default_file_chooser_filter_new (gboolean privkey) gboolean eap_method_is_encrypted_private_key (const char *path) { - GtkFileFilterInfo info = { .filename = path }; gboolean is_encrypted; - if (!default_filter_privkey (&info, NULL)) + if (!file_has_extension (path, privkey_extensions)) return FALSE; #if LIBNM_BUILD @@ -425,31 +416,29 @@ eap_method_is_encrypted_private_key (const char *path) } void -eap_method_ca_cert_not_required_toggled (GtkToggleButton *id_ca_cert_not_required_checkbutton, GtkFileChooser *id_ca_cert_chooser) +eap_method_ca_cert_not_required_toggled (GtkCheckButton *id_ca_cert_not_required_checkbutton, GtkFileChooser *id_ca_cert_chooser) { - g_autofree gchar *filename = NULL; - g_autofree gchar *filename_old = NULL; + g_autoptr(GFile) file = NULL; + g_autoptr(GFile) file_old = NULL; gboolean is_not_required; g_assert (id_ca_cert_not_required_checkbutton && id_ca_cert_chooser); - is_not_required = gtk_toggle_button_get_active (id_ca_cert_not_required_checkbutton); + is_not_required = gtk_check_button_get_active (id_ca_cert_not_required_checkbutton); - filename = gtk_file_chooser_get_filename (id_ca_cert_chooser); - filename_old = g_object_steal_data (G_OBJECT (id_ca_cert_chooser), "filename-old"); + file = gtk_file_chooser_get_file (id_ca_cert_chooser); + file_old = g_object_steal_data (G_OBJECT (id_ca_cert_chooser), "filename-old"); if (is_not_required) { - g_free (filename_old); - filename_old = g_steal_pointer (&filename); + g_clear_object (&file_old); + file_old = g_steal_pointer (&file); } else { - g_free (filename); - filename = g_steal_pointer (&filename_old); + g_clear_object (&file); + file = g_steal_pointer (&file_old); } gtk_widget_set_sensitive (GTK_WIDGET (id_ca_cert_chooser), !is_not_required); - if (filename) - gtk_file_chooser_set_filename (id_ca_cert_chooser, filename); - else - gtk_file_chooser_unselect_all (id_ca_cert_chooser); - g_object_set_data_full (G_OBJECT (id_ca_cert_chooser), "filename-old", g_steal_pointer (&filename_old), g_free); + if (file) + gtk_file_chooser_set_file (id_ca_cert_chooser, file, NULL); + g_object_set_data_full (G_OBJECT (id_ca_cert_chooser), "filename-old", g_steal_pointer (&file_old), g_free); } /* Used as both GSettings keys and GObject data tags */ diff --git a/panels/network/wireless-security/eap-method.h b/panels/network/wireless-security/eap-method.h index 34b4144ac..d5a890829 100644 --- a/panels/network/wireless-security/eap-method.h +++ b/panels/network/wireless-security/eap-method.h @@ -93,7 +93,7 @@ gboolean eap_method_validate_filepicker (GtkFileChooser *chooser, NMSetting8021xCKFormat *out_format, GError **error); -void eap_method_ca_cert_not_required_toggled (GtkToggleButton *id_ca_cert_is_not_required_checkbox, +void eap_method_ca_cert_not_required_toggled (GtkCheckButton *id_ca_cert_is_not_required_checkbox, GtkFileChooser *id_ca_cert_chooser); void eap_method_ca_cert_ignore_set (EAPMethod *method, diff --git a/panels/network/wireless-security/helpers.c b/panels/network/wireless-security/helpers.c index ea08093de..fc8446b43 100644 --- a/panels/network/wireless-security/helpers.c +++ b/panels/network/wireless-security/helpers.c @@ -39,7 +39,7 @@ helper_fill_secret_entry (NMConnection *connection, if (setting) { tmp = (*func) (setting); if (tmp) { - gtk_entry_set_text (entry, tmp); + gtk_editable_set_text (GTK_EDITABLE (entry), tmp); } } } diff --git a/panels/network/wireless-security/meson.build b/panels/network/wireless-security/meson.build index f30f4eb5d..7f43efc70 100644 --- a/panels/network/wireless-security/meson.build +++ b/panels/network/wireless-security/meson.build @@ -14,6 +14,7 @@ nm_applet_headers = [ 'wireless-security.h', 'ws-leap.h', 'ws-dynamic-wep.h', + 'ws-file-chooser-button.h', 'ws-sae.h', 'ws-wep-key.h', 'ws-wpa-eap.h', @@ -32,6 +33,7 @@ nm_applet_sources = [ 'wireless-security.c', 'ws-leap.c', 'ws-dynamic-wep.c', + 'ws-file-chooser-button.c', 'ws-sae.c', 'ws-wep-key.c', 'ws-wpa-eap.c', diff --git a/panels/network/wireless-security/ws-dynamic-wep.c b/panels/network/wireless-security/ws-dynamic-wep.c index 91207ef46..001c561f7 100644 --- a/panels/network/wireless-security/ws-dynamic-wep.c +++ b/panels/network/wireless-security/ws-dynamic-wep.c @@ -145,22 +145,22 @@ static void auth_combo_changed_cb (WirelessSecurityDynamicWEP *self) { EAPMethod *eap; - GList *children; GtkWidget *eap_default_field; + GtkWidget *child; eap = get_eap (self); /* Remove the previous method and migrate username/password across */ - children = gtk_container_get_children (GTK_CONTAINER (self->method_box)); - if (children != NULL) { - EAPMethod *old_eap = g_list_nth_data (children, 0); + child = gtk_widget_get_first_child (GTK_WIDGET (self->method_box)); + if (child != NULL) { + EAPMethod *old_eap = EAP_METHOD (child); eap_method_set_username (eap, eap_method_get_username (old_eap)); eap_method_set_password (eap, eap_method_get_password (old_eap)); eap_method_set_show_password (eap, eap_method_get_show_password (old_eap)); - gtk_container_remove (GTK_CONTAINER (self->method_box), GTK_WIDGET (old_eap)); + gtk_box_remove (self->method_box, child); } - gtk_container_add (GTK_CONTAINER (self->method_box), g_object_ref (GTK_WIDGET (eap))); + gtk_box_append (self->method_box, g_object_ref (GTK_WIDGET (eap))); eap_default_field = eap_method_get_default_field (eap); if (eap_default_field) gtk_widget_grab_focus (eap_default_field); diff --git a/panels/network/wireless-security/ws-dynamic-wep.ui b/panels/network/wireless-security/ws-dynamic-wep.ui index a7fadffcb..85d638969 100644 --- a/panels/network/wireless-security/ws-dynamic-wep.ui +++ b/panels/network/wireless-security/ws-dynamic-wep.ui @@ -44,30 +44,28 @@ </data> </object> <template class="WirelessSecurityDynamicWEP" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="auth_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Au_thentication</property> <property name="use_underline">True</property> <property name="mnemonic_widget">auth_combo</property> + <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="GtkComboBox" id="auth_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">auth_model</property> + <layout> + <property name="column">1</property> + <property name="row">0</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -75,26 +73,17 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> </child> <child> <object class="GtkBox" id="method_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="spacing">6</property> <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> + <layout> + <property name="column">0</property> + <property name="column-span">2</property> + <property name="row">1</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="width">2</property> - <property name="top_attach">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/wireless-security/ws-file-chooser-button.c b/panels/network/wireless-security/ws-file-chooser-button.c new file mode 100644 index 000000000..998df4252 --- /dev/null +++ b/panels/network/wireless-security/ws-file-chooser-button.c @@ -0,0 +1,268 @@ +/* cc-file-chooser-button.c + * + * Copyright 2021 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include "ws-file-chooser-button.h" + +#include <glib/gi18n.h> + +struct _WsFileChooserButton +{ + GtkButton parent_instance; + + GtkFileChooser *filechooser; + GFile *file; + char *title; +}; + +G_DEFINE_FINAL_TYPE (WsFileChooserButton, ws_file_chooser_button, GTK_TYPE_BUTTON) + +enum +{ + PROP_0, + PROP_FILE, + PROP_TITLE, + N_PROPS +}; + +static GParamSpec *properties [N_PROPS] = { NULL, }; + +static const char * +get_title (WsFileChooserButton *self) +{ + return self->title ? self->title : _("Select a file"); +} + +static void +update_label (WsFileChooserButton *self) +{ + g_autofree gchar *label = NULL; + + if (self->file) + label = g_file_get_basename (self->file); + else + label = g_strdup (get_title (self)); + + gtk_button_set_label (GTK_BUTTON (self), label); +} + +static void +on_filechooser_dialog_response_cb (GtkFileChooser *filechooser, + gint response, + WsFileChooserButton *self) +{ + if (response == GTK_RESPONSE_ACCEPT) + { + g_autoptr(GFile) file = NULL; + + file = gtk_file_chooser_get_file (filechooser); + ws_file_chooser_button_set_file (self, file); + } + + gtk_widget_hide (GTK_WIDGET (filechooser)); +} +static void +ensure_filechooser (WsFileChooserButton *self) +{ + GtkNative *native; + GtkWidget *dialog; + + if (self->filechooser) + return; + + native = gtk_widget_get_native (GTK_WIDGET (self)); + + dialog = gtk_file_chooser_dialog_new (get_title (self), + GTK_WINDOW (native), + GTK_FILE_CHOOSER_ACTION_OPEN, + _("Cancel"), + GTK_RESPONSE_CANCEL, + _("Open"), + GTK_RESPONSE_ACCEPT, + NULL); + gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); + gtk_window_set_hide_on_close (GTK_WINDOW (dialog), TRUE); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + + if (self->file) + gtk_file_chooser_set_file (GTK_FILE_CHOOSER (dialog), self->file, NULL); + + g_signal_connect (dialog, "response", G_CALLBACK (on_filechooser_dialog_response_cb), self); + + self->filechooser = GTK_FILE_CHOOSER (dialog); +} + + +static void +ws_file_chooser_button_clicked (GtkButton *button) +{ + WsFileChooserButton *self = WS_FILE_CHOOSER_BUTTON (button); + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self)); + + ensure_filechooser (self); + + gtk_window_set_transient_for (GTK_WINDOW (self->filechooser), GTK_WINDOW (native)); + gtk_window_present (GTK_WINDOW (self->filechooser)); +} + +static void +ws_file_chooser_button_finalize (GObject *object) +{ + WsFileChooserButton *self = (WsFileChooserButton *)object; + + g_clear_pointer (&self->title, g_free); + g_clear_object (&self->file); + + G_OBJECT_CLASS (ws_file_chooser_button_parent_class)->finalize (object); +} + +static void +ws_file_chooser_button_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + WsFileChooserButton *self = WS_FILE_CHOOSER_BUTTON (object); + + switch (prop_id) + { + case PROP_FILE: + g_value_set_object (value, self->file); + break; + + case PROP_TITLE: + g_value_set_string (value, self->title); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +ws_file_chooser_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + WsFileChooserButton *self = WS_FILE_CHOOSER_BUTTON (object); + + switch (prop_id) + { + case PROP_FILE: + ws_file_chooser_button_set_file (self, g_value_get_object (value)); + break; + + case PROP_TITLE: + ws_file_chooser_button_set_title (self, g_value_get_string (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +ws_file_chooser_button_class_init (WsFileChooserButtonClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass); + + button_class->clicked = ws_file_chooser_button_clicked; + + object_class->finalize = ws_file_chooser_button_finalize; + object_class->get_property = ws_file_chooser_button_get_property; + object_class->set_property = ws_file_chooser_button_set_property; + + properties[PROP_FILE] = g_param_spec_object ("file", "", "", + G_TYPE_FILE, + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); + properties[PROP_TITLE] = g_param_spec_string ("title", "", "", NULL, + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, N_PROPS, properties); +} + +static void +ws_file_chooser_button_init (WsFileChooserButton *self) +{ + update_label (self); +} + +GtkWidget * +ws_file_chooser_button_new (void) +{ + return g_object_new (WS_TYPE_FILE_CHOOSER_BUTTON, NULL); +} + +void +ws_file_chooser_button_set_file (WsFileChooserButton *self, + GFile *file) +{ + g_return_if_fail (WS_IS_FILE_CHOOSER_BUTTON (self)); + + if (g_set_object (&self->file, file)) + { + gtk_file_chooser_set_file (self->filechooser, file, NULL); + update_label (self); + + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FILE]); + } +} + +GFile * +ws_file_chooser_button_get_file (WsFileChooserButton *self) +{ + g_return_val_if_fail (WS_IS_FILE_CHOOSER_BUTTON (self), NULL); + + return self->file ? g_object_ref (self->file) : NULL; +} + +void +ws_file_chooser_button_set_title (WsFileChooserButton *self, + const char *title) +{ + g_autofree char *old_title = NULL; + + g_return_if_fail (WS_IS_FILE_CHOOSER_BUTTON (self)); + + old_title = g_steal_pointer (&self->title); + self->title = g_strdup (title); + + update_label (self); + + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TITLE]); +} + +const char * +ws_file_chooser_button_get_title (WsFileChooserButton *self) +{ + g_return_val_if_fail (WS_IS_FILE_CHOOSER_BUTTON (self), NULL); + + return self->title; +} + +GtkFileChooser * +ws_file_chooser_button_get_filechooser (WsFileChooserButton *self) +{ + g_return_val_if_fail (WS_IS_FILE_CHOOSER_BUTTON (self), NULL); + + ensure_filechooser (self); + + return self->filechooser; +} diff --git a/panels/network/wireless-security/ws-file-chooser-button.h b/panels/network/wireless-security/ws-file-chooser-button.h new file mode 100644 index 000000000..db020203c --- /dev/null +++ b/panels/network/wireless-security/ws-file-chooser-button.h @@ -0,0 +1,44 @@ +/* ws-file-chooser-button.h + * + * Copyright 2021 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define WS_TYPE_FILE_CHOOSER_BUTTON (ws_file_chooser_button_get_type()) +G_DECLARE_FINAL_TYPE (WsFileChooserButton, ws_file_chooser_button, WS, FILE_CHOOSER_BUTTON, GtkButton) + +GtkWidget *ws_file_chooser_button_new (void); + +void ws_file_chooser_button_set_file (WsFileChooserButton *self, + GFile *file); + +GFile *ws_file_chooser_button_get_file (WsFileChooserButton *self); + +void ws_file_chooser_button_set_title (WsFileChooserButton *self, + const char *title); + +const char *ws_file_chooser_button_get_title (WsFileChooserButton *self); + +GtkFileChooser *ws_file_chooser_button_get_filechooser (WsFileChooserButton *self); + +G_END_DECLS diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c index 464f92831..4fcfb5f81 100644 --- a/panels/network/wireless-security/ws-leap.c +++ b/panels/network/wireless-security/ws-leap.c @@ -48,7 +48,7 @@ show_toggled_cb (WirelessSecurityLEAP *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); gtk_entry_set_visibility (self->password_entry, visible); } @@ -60,7 +60,7 @@ validate (WirelessSecurity *security, GError **error) const char *text; gboolean ret = TRUE; - text = gtk_entry_get_text (self->username_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->username_entry)); if (!text || !strlen (text)) { widget_set_error (GTK_WIDGET (self->username_entry)); g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing leap-username")); @@ -74,7 +74,7 @@ validate (WirelessSecurity *security, GError **error) return TRUE; } - text = gtk_entry_get_text (self->password_entry); + text = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); if (!text || !strlen (text)) { widget_set_error (GTK_WIDGET (self->password_entry)); if (ret) { @@ -107,8 +107,8 @@ fill_connection (WirelessSecurity *security, NMConnection *connection) s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec); - leap_username = gtk_entry_get_text (self->username_entry); - leap_password = gtk_entry_get_text (self->password_entry); + leap_username = gtk_editable_get_text (GTK_EDITABLE (self->username_entry)); + leap_password = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", @@ -202,7 +202,7 @@ ws_leap_new (NMConnection *connection) g_signal_connect_swapped (self->username_entry, "changed", G_CALLBACK (changed_cb), self); if (wsec) - gtk_entry_set_text (self->username_entry, nm_setting_wireless_security_get_leap_username (wsec)); + gtk_editable_set_text (GTK_EDITABLE (self->username_entry), nm_setting_wireless_security_get_leap_username (wsec)); g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self); diff --git a/panels/network/wireless-security/ws-leap.ui b/panels/network/wireless-security/ws-leap.ui index 3815d88dd..41e21d6e9 100644 --- a/panels/network/wireless-security/ws-leap.ui +++ b/panels/network/wireless-security/ws-leap.ui @@ -2,81 +2,62 @@ <interface> <requires lib="gtk+" version="3.4"/> <template class="WirelessSecurityLEAP" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="valign">start</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> - <placeholder/> - </child> - <child> <object class="GtkLabel" id="username_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Username</property> <property name="use_underline">True</property> <property name="mnemonic_widget">username_entry</property> + <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="password_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Password</property> <property name="use_underline">True</property> <property name="mnemonic_widget">password_entry</property> + <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="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> - <property name="activates_default">True</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> <child> <object class="GtkCheckButton" id="show_password_check"> <property name="label" translatable="yes">Sho_w password</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkEntry" id="username_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</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> </template> </interface> diff --git a/panels/network/wireless-security/ws-sae.c b/panels/network/wireless-security/ws-sae.c index 89017ad6a..532067286 100644 --- a/panels/network/wireless-security/ws-sae.c +++ b/panels/network/wireless-security/ws-sae.c @@ -51,7 +51,7 @@ show_toggled_cb (WirelessSecuritySAE *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); gtk_entry_set_visibility (self->password_entry, visible); } @@ -69,7 +69,7 @@ validate (WirelessSecurity *security, GError **error) return TRUE; } - key = gtk_entry_get_text (self->password_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); if (key == NULL || key[0] == '\0') { @@ -113,7 +113,7 @@ fill_connection (WirelessSecurity *security, NMConnection *connection) s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec); - key = gtk_entry_get_text (self->password_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_PSK, key, NULL); /* Save PSK_FLAGS to the connection */ @@ -194,7 +194,7 @@ ws_sae_new (NMConnection *connection) self = g_object_new (ws_sae_get_type (), NULL); g_signal_connect_swapped (self->password_entry, "changed", G_CALLBACK (changed_cb), self); - gtk_entry_set_width_chars (self->password_entry, 28); + gtk_editable_set_width_chars (GTK_EDITABLE (self->password_entry), 28); /* Create password-storage popup menu for password entry under entry's secondary icon */ if (connection) diff --git a/panels/network/wireless-security/ws-sae.ui b/panels/network/wireless-security/ws-sae.ui index d96bdc32c..028cd9fe9 100644 --- a/panels/network/wireless-security/ws-sae.ui +++ b/panels/network/wireless-security/ws-sae.ui @@ -3,76 +3,61 @@ <interface domain="nm-applet"> <requires lib="gtk+" version="3.10"/> <template class="WirelessSecuritySAE" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="password_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">_Password</property> <property name="use_underline">True</property> <property name="mnemonic_widget">password_entry</property> <property name="xalign">1</property> + <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="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="max_length">64</property> <property name="visibility">False</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="type_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="label" translatable="yes">_Type</property> <property name="use_underline">True</property> <property name="mnemonic_widget">type_combo</property> <property name="xalign">1</property> + <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="GtkCheckButton" id="show_password_check"> <property name="label" translatable="yes">Sho_w password</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="hexpand">True</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkComboBox" id="type_combo"> - <property name="visible">True</property> - <property name="can_focus">False</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> </template> </interface> diff --git a/panels/network/wireless-security/ws-wep-key.c b/panels/network/wireless-security/ws-wep-key.c index 006ecedae..741114fb2 100644 --- a/panels/network/wireless-security/ws-wep-key.c +++ b/panels/network/wireless-security/ws-wep-key.c @@ -54,7 +54,7 @@ show_toggled_cb (WirelessSecurityWEPKey *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_key_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_key_check)); gtk_entry_set_visibility (self->key_entry, visible); } @@ -65,7 +65,7 @@ key_index_combo_changed_cb (WirelessSecurityWEPKey *self) int key_index; /* Save WEP key for old key index */ - key = gtk_entry_get_text (self->key_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->key_entry)); if (key) g_strlcpy (self->keys[self->cur_index], key, sizeof (self->keys[self->cur_index])); else @@ -76,7 +76,7 @@ key_index_combo_changed_cb (WirelessSecurityWEPKey *self) g_return_if_fail (key_index >= 0); /* Populate entry with key from new index */ - gtk_entry_set_text (self->key_entry, self->keys[key_index]); + gtk_editable_set_text (GTK_EDITABLE (self->key_entry), self->keys[key_index]); self->cur_index = key_index; wireless_security_notify_changed ((WirelessSecurity *) self); @@ -108,7 +108,7 @@ validate (WirelessSecurity *security, GError **error) return TRUE; } - key = gtk_entry_get_text (self->key_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->key_entry)); if (!key) { widget_set_error (GTK_WIDGET (self->key_entry)); g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing wep-key")); @@ -173,7 +173,7 @@ fill_connection (WirelessSecurity *security, NMConnection *connection) auth_alg = gtk_combo_box_get_active (self->auth_method_combo); - key = gtk_entry_get_text (self->key_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->key_entry)); g_strlcpy (self->keys[self->cur_index], key, sizeof (self->keys[self->cur_index])); /* Blow away the old security setting by adding a clear one */ @@ -241,7 +241,7 @@ update_secrets (WirelessSecurityWEPKey *self, NMConnection *connection) } if (strlen (self->keys[self->cur_index])) - gtk_entry_set_text (self->key_entry, self->keys[self->cur_index]); + gtk_editable_set_text (GTK_EDITABLE (self->key_entry), self->keys[self->cur_index]); } static void @@ -298,7 +298,7 @@ ws_wep_key_new (NMConnection *connection, self->type = type; - gtk_entry_set_width_chars (self->key_entry, 28); + gtk_editable_set_width_chars (GTK_EDITABLE (self->key_entry), 28); /* Create password-storage popup menu for password entry under entry's secondary icon */ if (connection) diff --git a/panels/network/wireless-security/ws-wep-key.ui b/panels/network/wireless-security/ws-wep-key.ui index 7214032b6..49f525e63 100644 --- a/panels/network/wireless-security/ws-wep-key.ui +++ b/panels/network/wireless-security/ws-wep-key.ui @@ -36,84 +36,71 @@ </data> </object> <template class="WirelessSecurityWEPKey" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="key_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Key</property> <property name="use_underline">True</property> <property name="mnemonic_widget">key_entry</property> + <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="key_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="max_length">64</property> <property name="visibility">False</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> + <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="GtkCheckButton" id="show_key_check"> <property name="label" translatable="yes">Sho_w key</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkLabel" id="auth_method_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Au_thentication</property> <property name="use_underline">True</property> <property name="mnemonic_widget">auth_method_combo</property> + <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="GtkComboBox" id="auth_method_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">auth_method_model</property> + <layout> + <property name="column">1</property> + <property name="row">3</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -121,31 +108,27 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> </child> <child> <object class="GtkLabel" id="key_index_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">WEP inde_x</property> <property name="use_underline">True</property> <property name="mnemonic_widget">key_index_combo</property> + <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="GtkComboBox" id="key_index_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">key_index_model</property> + <layout> + <property name="column">1</property> + <property name="row">2</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -153,10 +136,6 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> </child> </template> </interface> diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c index fa8f2f2c1..662149d69 100644 --- a/panels/network/wireless-security/ws-wpa-eap.c +++ b/panels/network/wireless-security/ws-wpa-eap.c @@ -160,22 +160,22 @@ static void auth_combo_changed_cb (WirelessSecurityWPAEAP *self) { EAPMethod *eap; - GList *children; GtkWidget *eap_default_field; + GtkWidget *child; eap = get_eap (self); /* Remove the previous method and migrate username/password across */ - children = gtk_container_get_children (GTK_CONTAINER (self->method_box)); - if (children != NULL) { - EAPMethod *old_eap = g_list_nth_data (children, 0); + child = gtk_widget_get_first_child (GTK_WIDGET (self->method_box)); + if (child != NULL) { + EAPMethod *old_eap = EAP_METHOD (child); eap_method_set_username (eap, eap_method_get_username (old_eap)); eap_method_set_password (eap, eap_method_get_password (old_eap)); eap_method_set_show_password (eap, eap_method_get_show_password (old_eap)); - gtk_container_remove (GTK_CONTAINER (self->method_box), GTK_WIDGET (old_eap)); + gtk_box_remove (self->method_box, child); } - gtk_container_add (GTK_CONTAINER (self->method_box), g_object_ref (GTK_WIDGET (eap))); + gtk_box_append (self->method_box, g_object_ref (GTK_WIDGET (eap))); eap_default_field = eap_method_get_default_field (eap); if (eap_default_field) gtk_widget_grab_focus (eap_default_field); diff --git a/panels/network/wireless-security/ws-wpa-eap.ui b/panels/network/wireless-security/ws-wpa-eap.ui index 0555aaaf9..222eba771 100644 --- a/panels/network/wireless-security/ws-wpa-eap.ui +++ b/panels/network/wireless-security/ws-wpa-eap.ui @@ -49,30 +49,28 @@ </data> </object> <template class="WirelessSecurityWPAEAP" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="auth_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">Au_thentication</property> <property name="use_underline">True</property> <property name="mnemonic_widget">auth_combo</property> + <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="GtkComboBox" id="auth_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="model">auth_model</property> + <layout> + <property name="column">1</property> + <property name="row">0</property> + </layout> <child> <object class="GtkCellRendererText"/> <attributes> @@ -80,25 +78,16 @@ </attributes> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> </child> <child> <object class="GtkBox" id="method_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> + <layout> + <property name="column">0</property> + <property name="column-span">2</property> + <property name="row">1</property> + </layout> </object> - <packing> - <property name="left_attach">0</property> - <property name="width">2</property> - <property name="top_attach">1</property> - </packing> </child> </template> </interface> diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c index 978488b7e..348f11ef5 100644 --- a/panels/network/wireless-security/ws-wpa-psk.c +++ b/panels/network/wireless-security/ws-wpa-psk.c @@ -51,7 +51,7 @@ show_toggled_cb (WirelessSecurityWPAPSK *self) { gboolean visible; - visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check)); + visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->show_password_check)); gtk_entry_set_visibility (self->password_entry, visible); } @@ -70,7 +70,7 @@ validate (WirelessSecurity *security, GError **error) return TRUE; } - key = gtk_entry_get_text (self->password_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); len = key ? strlen (key) : 0; if ((len < 8) || (len > 64)) { widget_set_error (GTK_WIDGET (self->password_entry)); @@ -125,7 +125,7 @@ fill_connection (WirelessSecurity *security, NMConnection *connection) s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec); - key = gtk_entry_get_text (self->password_entry); + key = gtk_editable_get_text (GTK_EDITABLE (self->password_entry)); g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_PSK, key, NULL); /* Save PSK_FLAGS to the connection */ @@ -207,7 +207,7 @@ ws_wpa_psk_new (NMConnection *connection) self = g_object_new (ws_wpa_psk_get_type (), NULL); g_signal_connect_swapped (self->password_entry, "changed", G_CALLBACK (changed_cb), self); - gtk_entry_set_width_chars (self->password_entry, 28); + gtk_editable_set_width_chars (GTK_EDITABLE (self->password_entry), 28); /* Create password-storage popup menu for password entry under entry's secondary icon */ if (connection) diff --git a/panels/network/wireless-security/ws-wpa-psk.ui b/panels/network/wireless-security/ws-wpa-psk.ui index 203748e23..26c9415d4 100644 --- a/panels/network/wireless-security/ws-wpa-psk.ui +++ b/panels/network/wireless-security/ws-wpa-psk.ui @@ -2,88 +2,71 @@ <interface> <requires lib="gtk+" version="3.4"/> <template class="WirelessSecurityWPAPSK" parent="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> <object class="GtkLabel" id="password_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Password</property> <property name="use_underline">True</property> <property name="mnemonic_widget">password_entry</property> + <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="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="max_length">64</property> <property name="visibility">False</property> - <property name="activates_default">True</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> <child> <object class="GtkLabel" id="type_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">1</property> <property name="label" translatable="yes">_Type</property> <property name="use_underline">True</property> <property name="mnemonic_widget">type_combo</property> + <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"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="xalign">0</property> + <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="GtkCheckButton" id="show_password_check"> <property name="label" translatable="yes">Sho_w password</property> - <property name="visible">True</property> - <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="draw_indicator">True</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> <child> <object class="GtkComboBox" id="type_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> <property name="hexpand">True</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> </template> </interface> diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c index 31db92748..371ccac30 100644 --- a/shell/cc-panel-loader.c +++ b/shell/cc-panel-loader.c @@ -45,8 +45,8 @@ extern GType cc_keyboard_panel_get_type (void); 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); +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_goa_panel_get_type (void); @@ -78,7 +78,7 @@ extern GType cc_diagnostics_panel_get_type (void); /* Static init functions */ extern void cc_diagnostics_panel_static_init_func (void); #ifdef BUILD_NETWORK -//extern void cc_wifi_panel_static_init_func (void); +extern void cc_wifi_panel_static_init_func (void); #endif /* BUILD_NETWORK */ #ifdef BUILD_WACOM extern void cc_wacom_panel_static_init_func (void); @@ -116,8 +116,8 @@ static CcPanelLoaderVtable default_panels[] = PANEL_TYPE("mouse", cc_mouse_panel_get_type, NULL), 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), + 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_goa_panel_get_type, NULL), |