network: Use g_autofree for strings
This commit is contained in:
parent
b085a8af51
commit
de84f7e344
23 changed files with 115 additions and 204 deletions
|
@ -277,7 +277,7 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
|
||||||
GPtrArray *ndarray, *nmdarray;
|
GPtrArray *ndarray, *nmdarray;
|
||||||
NetDevice **devices;
|
NetDevice **devices;
|
||||||
NMDevice **nm_devices, *nm_device;
|
NMDevice **nm_devices, *nm_device;
|
||||||
gchar **titles;
|
g_auto(GStrv) titles = NULL;
|
||||||
gint i, num_devices;
|
gint i, num_devices;
|
||||||
|
|
||||||
ndarray = cc_network_panel_get_devices (panel);
|
ndarray = cc_network_panel_get_devices (panel);
|
||||||
|
@ -311,9 +311,7 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
|
||||||
net_object_set_title (NET_OBJECT (devices[i]), bt_name);
|
net_object_set_title (NET_OBJECT (devices[i]), bt_name);
|
||||||
else
|
else
|
||||||
net_object_set_title (NET_OBJECT (devices[i]), titles[i]);
|
net_object_set_title (NET_OBJECT (devices[i]), titles[i]);
|
||||||
g_free (titles[i]);
|
|
||||||
}
|
}
|
||||||
g_free (titles);
|
|
||||||
g_ptr_array_free (ndarray, TRUE);
|
g_ptr_array_free (ndarray, TRUE);
|
||||||
g_ptr_array_free (nmdarray, TRUE);
|
g_ptr_array_free (nmdarray, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -698,7 +696,7 @@ static void
|
||||||
panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
|
panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
|
||||||
{
|
{
|
||||||
GtkWidget *stack;
|
GtkWidget *stack;
|
||||||
gchar *title;
|
g_autofree gchar *title = NULL;
|
||||||
NetVpn *net_vpn;
|
NetVpn *net_vpn;
|
||||||
const gchar *id;
|
const gchar *id;
|
||||||
|
|
||||||
|
@ -729,8 +727,6 @@ panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
|
||||||
/* store in the devices array */
|
/* store in the devices array */
|
||||||
g_ptr_array_add (panel->devices, net_vpn);
|
g_ptr_array_add (panel->devices, net_vpn);
|
||||||
|
|
||||||
g_free (title);
|
|
||||||
|
|
||||||
/* update vpn widgets */
|
/* update vpn widgets */
|
||||||
update_vpn_section (panel);
|
update_vpn_section (panel);
|
||||||
}
|
}
|
||||||
|
@ -771,14 +767,15 @@ notify_connection_added_cb (NMClient *client,
|
||||||
static void
|
static void
|
||||||
panel_check_network_manager_version (CcNetworkPanel *panel)
|
panel_check_network_manager_version (CcNetworkPanel *panel)
|
||||||
{
|
{
|
||||||
GtkWidget *box;
|
|
||||||
GtkWidget *label;
|
|
||||||
gchar *markup;
|
|
||||||
const gchar *version;
|
const gchar *version;
|
||||||
|
|
||||||
/* parse running version */
|
/* parse running version */
|
||||||
version = nm_client_get_version (panel->client);
|
version = nm_client_get_version (panel->client);
|
||||||
if (version == NULL) {
|
if (version == NULL) {
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkWidget *label;
|
||||||
|
g_autofree gchar *markup = NULL;
|
||||||
|
|
||||||
gtk_container_remove (GTK_CONTAINER (panel), gtk_bin_get_child (GTK_BIN (panel)));
|
gtk_container_remove (GTK_CONTAINER (panel), gtk_bin_get_child (GTK_BIN (panel)));
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
|
||||||
|
@ -800,7 +797,6 @@ panel_check_network_manager_version (CcNetworkPanel *panel)
|
||||||
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
|
||||||
|
|
||||||
gtk_widget_show_all (box);
|
gtk_widget_show_all (box);
|
||||||
g_free (markup);
|
|
||||||
} else {
|
} else {
|
||||||
manager_running (panel->client, NULL, panel);
|
manager_running (panel->client, NULL, panel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ get_ap_security_string (NMAccessPoint *ap)
|
||||||
static void
|
static void
|
||||||
update_last_used (CEPageDetails *page, NMConnection *connection)
|
update_last_used (CEPageDetails *page, NMConnection *connection)
|
||||||
{
|
{
|
||||||
gchar *last_used = NULL;
|
g_autofree gchar *last_used = NULL;
|
||||||
GDateTime *now = NULL;
|
GDateTime *now = NULL;
|
||||||
GDateTime *then = NULL;
|
GDateTime *then = NULL;
|
||||||
gint days;
|
gint days;
|
||||||
|
@ -114,7 +114,6 @@ out:
|
||||||
g_date_time_unref (now);
|
g_date_time_unref (now);
|
||||||
if (then != NULL)
|
if (then != NULL)
|
||||||
g_date_time_unref (then);
|
g_date_time_unref (then);
|
||||||
g_free (last_used);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -85,8 +85,8 @@ connect_ethernet_page (CEPageEthernet *page)
|
||||||
static void
|
static void
|
||||||
ui_to_setting (CEPageEthernet *page)
|
ui_to_setting (CEPageEthernet *page)
|
||||||
{
|
{
|
||||||
gchar *device_mac = NULL;
|
g_autofree gchar *device_mac = NULL;
|
||||||
gchar *cloned_mac = NULL;
|
g_autofree gchar *cloned_mac = NULL;
|
||||||
const gchar *text;
|
const gchar *text;
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GtkComboBoxText *combo;
|
GtkComboBoxText *combo;
|
||||||
|
@ -109,9 +109,6 @@ ui_to_setting (CEPageEthernet *page)
|
||||||
g_object_set (page->setting_connection,
|
g_object_set (page->setting_connection,
|
||||||
NM_SETTING_CONNECTION_ID, gtk_entry_get_text (page->name),
|
NM_SETTING_CONNECTION_ID, gtk_entry_get_text (page->name),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (cloned_mac);
|
|
||||||
g_free (device_mac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -404,9 +404,8 @@ add_route_row (CEPageIP4 *page,
|
||||||
g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
|
g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
|
||||||
g_object_set_data (G_OBJECT (row), "metric", widget);
|
g_object_set_data (G_OBJECT (row), "metric", widget);
|
||||||
if (metric >= 0) {
|
if (metric >= 0) {
|
||||||
gchar *s = g_strdup_printf ("%d", metric);
|
g_autofree gchar *s = g_strdup_printf ("%d", metric);
|
||||||
gtk_entry_set_text (GTK_ENTRY (widget), s);
|
gtk_entry_set_text (GTK_ENTRY (widget), s);
|
||||||
g_free (s);
|
|
||||||
}
|
}
|
||||||
gtk_entry_set_width_chars (GTK_ENTRY (widget), 5);
|
gtk_entry_set_width_chars (GTK_ENTRY (widget), 5);
|
||||||
gtk_widget_set_hexpand (widget, TRUE);
|
gtk_widget_set_hexpand (widget, TRUE);
|
||||||
|
|
|
@ -277,13 +277,12 @@ add_address_section (CEPageIP6 *page)
|
||||||
|
|
||||||
for (i = 0; i < nm_setting_ip_config_get_num_addresses (page->setting); i++) {
|
for (i = 0; i < nm_setting_ip_config_get_num_addresses (page->setting); i++) {
|
||||||
NMIPAddress *addr;
|
NMIPAddress *addr;
|
||||||
char *netmask;
|
g_autofree gchar *netmask = NULL;
|
||||||
|
|
||||||
addr = nm_setting_ip_config_get_address (page->setting, i);
|
addr = nm_setting_ip_config_get_address (page->setting, i);
|
||||||
netmask = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr));
|
netmask = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr));
|
||||||
add_address_row (page, nm_ip_address_get_address (addr), netmask,
|
add_address_row (page, nm_ip_address_get_address (addr), netmask,
|
||||||
i == 0 ? nm_setting_ip_config_get_gateway (page->setting) : NULL);
|
i == 0 ? nm_setting_ip_config_get_gateway (page->setting) : NULL);
|
||||||
g_free (netmask);
|
|
||||||
}
|
}
|
||||||
if (nm_setting_ip_config_get_num_addresses (page->setting) == 0)
|
if (nm_setting_ip_config_get_num_addresses (page->setting) == 0)
|
||||||
ensure_empty_address_row (page);
|
ensure_empty_address_row (page);
|
||||||
|
@ -448,7 +447,8 @@ add_routes_section (CEPageIP6 *page)
|
||||||
|
|
||||||
for (i = 0; i < nm_setting_ip_config_get_num_routes (page->setting); i++) {
|
for (i = 0; i < nm_setting_ip_config_get_num_routes (page->setting); i++) {
|
||||||
NMIPRoute *route;
|
NMIPRoute *route;
|
||||||
char *prefix, *metric;
|
g_autofree gchar *prefix = NULL;
|
||||||
|
g_autofree gchar *metric = NULL;
|
||||||
|
|
||||||
route = nm_setting_ip_config_get_route (page->setting, i);
|
route = nm_setting_ip_config_get_route (page->setting, i);
|
||||||
prefix = g_strdup_printf ("%u", nm_ip_route_get_prefix (route));
|
prefix = g_strdup_printf ("%u", nm_ip_route_get_prefix (route));
|
||||||
|
@ -457,8 +457,6 @@ add_routes_section (CEPageIP6 *page)
|
||||||
prefix,
|
prefix,
|
||||||
nm_ip_route_get_next_hop (route),
|
nm_ip_route_get_next_hop (route),
|
||||||
metric);
|
metric);
|
||||||
g_free (prefix);
|
|
||||||
g_free (metric);
|
|
||||||
}
|
}
|
||||||
if (nm_setting_ip_config_get_num_routes (page->setting) == 0)
|
if (nm_setting_ip_config_get_num_routes (page->setting) == 0)
|
||||||
add_empty_route_row (page);
|
add_empty_route_row (page);
|
||||||
|
|
|
@ -55,7 +55,7 @@ vpn_gnome3ify_editor (GtkWidget *widget)
|
||||||
} else if (GTK_IS_LABEL (widget)) {
|
} else if (GTK_IS_LABEL (widget)) {
|
||||||
const char *text;
|
const char *text;
|
||||||
gfloat xalign;
|
gfloat xalign;
|
||||||
char *newtext;
|
g_autofree gchar *newtext = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
xalign = gtk_label_get_xalign (GTK_LABEL (widget));
|
xalign = gtk_label_get_xalign (GTK_LABEL (widget));
|
||||||
|
@ -68,7 +68,6 @@ vpn_gnome3ify_editor (GtkWidget *widget)
|
||||||
|
|
||||||
newtext = g_strndup (text, len - 1);
|
newtext = g_strndup (text, len - 1);
|
||||||
gtk_label_set_text (GTK_LABEL (widget), newtext);
|
gtk_label_set_text (GTK_LABEL (widget), newtext);
|
||||||
g_free (newtext);
|
|
||||||
gtk_label_set_xalign (GTK_LABEL (widget), 1.0);
|
gtk_label_set_xalign (GTK_LABEL (widget), 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ connect_wifi_page (CEPageWifi *page)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GBytes *ssid;
|
GBytes *ssid;
|
||||||
gchar *utf8_ssid;
|
g_autofree gchar *utf8_ssid = NULL;
|
||||||
GPtrArray *bssid_array;
|
GPtrArray *bssid_array;
|
||||||
gchar **bssid_list;
|
gchar **bssid_list;
|
||||||
const char *s_bssid_str;
|
const char *s_bssid_str;
|
||||||
|
@ -56,7 +56,6 @@ connect_wifi_page (CEPageWifi *page)
|
||||||
else
|
else
|
||||||
utf8_ssid = g_strdup ("");
|
utf8_ssid = g_strdup ("");
|
||||||
gtk_entry_set_text (GTK_ENTRY (widget), utf8_ssid);
|
gtk_entry_set_text (GTK_ENTRY (widget), utf8_ssid);
|
||||||
g_free (utf8_ssid);
|
|
||||||
|
|
||||||
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
|
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
|
||||||
|
|
||||||
|
@ -98,7 +97,8 @@ ui_to_setting (CEPageWifi *page)
|
||||||
const gchar *utf8_ssid, *bssid;
|
const gchar *utf8_ssid, *bssid;
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GtkComboBoxText *combo;
|
GtkComboBoxText *combo;
|
||||||
char *device_mac, *cloned_mac;
|
g_autofree gchar *device_mac = NULL;
|
||||||
|
g_autofree gchar *cloned_mac = NULL;
|
||||||
|
|
||||||
entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_ssid"));
|
entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_ssid"));
|
||||||
utf8_ssid = gtk_entry_get_text (GTK_ENTRY (entry));
|
utf8_ssid = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||||
|
@ -125,8 +125,6 @@ ui_to_setting (CEPageWifi *page)
|
||||||
|
|
||||||
if (ssid)
|
if (ssid)
|
||||||
g_bytes_unref (ssid);
|
g_bytes_unref (ssid);
|
||||||
g_free (cloned_mac);
|
|
||||||
g_free (device_mac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -326,7 +326,8 @@ ce_page_get_mac_list (NMClient *client,
|
||||||
for (i = 0; devices && (i < devices->len); i++) {
|
for (i = 0; devices && (i < devices->len); i++) {
|
||||||
NMDevice *dev = g_ptr_array_index (devices, i);
|
NMDevice *dev = g_ptr_array_index (devices, i);
|
||||||
const char *iface;
|
const char *iface;
|
||||||
char *mac, *item;
|
g_autofree gchar *mac = NULL;
|
||||||
|
g_autofree gchar *item = NULL;
|
||||||
|
|
||||||
if (!G_TYPE_CHECK_INSTANCE_TYPE (dev, device_type))
|
if (!G_TYPE_CHECK_INSTANCE_TYPE (dev, device_type))
|
||||||
continue;
|
continue;
|
||||||
|
@ -334,8 +335,7 @@ ce_page_get_mac_list (NMClient *client,
|
||||||
g_object_get (G_OBJECT (dev), mac_property, &mac, NULL);
|
g_object_get (G_OBJECT (dev), mac_property, &mac, NULL);
|
||||||
iface = nm_device_get_iface (NM_DEVICE (dev));
|
iface = nm_device_get_iface (NM_DEVICE (dev));
|
||||||
item = g_strdup_printf ("%s (%s)", mac, iface);
|
item = g_strdup_printf ("%s (%s)", mac, iface);
|
||||||
g_free (mac);
|
g_ptr_array_add (macs, g_steal_pointer (&item));
|
||||||
g_ptr_array_add (macs, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ptr_array_add (macs, NULL);
|
g_ptr_array_add (macs, NULL);
|
||||||
|
@ -443,7 +443,7 @@ ce_page_address_is_valid (const gchar *addr)
|
||||||
{0x00, 0x30, 0xb4, 0x00, 0x00, 0x00}, /* prism54 dummy MAC */
|
{0x00, 0x30, 0xb4, 0x00, 0x00, 0x00}, /* prism54 dummy MAC */
|
||||||
};
|
};
|
||||||
guint8 addr_bin[ETH_ALEN];
|
guint8 addr_bin[ETH_ALEN];
|
||||||
char *trimmed_addr;
|
g_autofree gchar *trimmed_addr = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (!addr || *addr == '\0')
|
if (!addr || *addr == '\0')
|
||||||
|
@ -451,17 +451,11 @@ ce_page_address_is_valid (const gchar *addr)
|
||||||
|
|
||||||
trimmed_addr = ce_page_trim_address (addr);
|
trimmed_addr = ce_page_trim_address (addr);
|
||||||
|
|
||||||
if (!nm_utils_hwaddr_valid (trimmed_addr, -1)) {
|
if (!nm_utils_hwaddr_valid (trimmed_addr, -1))
|
||||||
g_free (trimmed_addr);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!nm_utils_hwaddr_aton (trimmed_addr, addr_bin, ETH_ALEN)) {
|
if (!nm_utils_hwaddr_aton (trimmed_addr, addr_bin, ETH_ALEN))
|
||||||
g_free (trimmed_addr);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
g_free (trimmed_addr);
|
|
||||||
|
|
||||||
/* Check for multicast address */
|
/* Check for multicast address */
|
||||||
if ((((guint8 *) addr_bin)[0]) & 0x01)
|
if ((((guint8 *) addr_bin)[0]) & 0x01)
|
||||||
|
@ -531,7 +525,7 @@ ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data)
|
||||||
{
|
{
|
||||||
gint defvalue = GPOINTER_TO_INT (user_data);
|
gint defvalue = GPOINTER_TO_INT (user_data);
|
||||||
gint val;
|
gint val;
|
||||||
gchar *buf = NULL;
|
g_autofree gchar *buf = NULL;
|
||||||
|
|
||||||
val = gtk_spin_button_get_value_as_int (spin);
|
val = gtk_spin_button_get_value_as_int (spin);
|
||||||
if (val == defvalue)
|
if (val == defvalue)
|
||||||
|
@ -542,7 +536,6 @@ ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data)
|
||||||
if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (spin))))
|
if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (spin))))
|
||||||
gtk_entry_set_text (GTK_ENTRY (spin), buf);
|
gtk_entry_set_text (GTK_ENTRY (spin), buf);
|
||||||
|
|
||||||
g_free (buf);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +560,7 @@ ce_page_get_next_available_name (const GPtrArray *connections,
|
||||||
|
|
||||||
/* Find the next available unique connection name */
|
/* Find the next available unique connection name */
|
||||||
while (!cname && (i++ < 10000)) {
|
while (!cname && (i++ < 10000)) {
|
||||||
gchar *temp;
|
g_autofree gchar *temp = NULL;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
@ -588,9 +581,7 @@ ce_page_get_next_available_name (const GPtrArray *connections,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
cname = temp;
|
cname = g_steal_pointer (&temp);
|
||||||
else
|
|
||||||
g_free (temp);
|
|
||||||
}
|
}
|
||||||
g_slist_free (names);
|
g_slist_free (names);
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ net_connection_editor_error_dialog (NetConnectionEditor *editor,
|
||||||
static void
|
static void
|
||||||
net_connection_editor_do_fallback (NetConnectionEditor *editor, const gchar *type)
|
net_connection_editor_do_fallback (NetConnectionEditor *editor, const gchar *type)
|
||||||
{
|
{
|
||||||
gchar *cmdline;
|
g_autofree gchar *cmdline = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
if (editor->is_new_connection) {
|
if (editor->is_new_connection) {
|
||||||
|
@ -252,7 +252,6 @@ net_connection_editor_do_fallback (NetConnectionEditor *editor, const gchar *typ
|
||||||
}
|
}
|
||||||
|
|
||||||
g_spawn_command_line_async (cmdline, &error);
|
g_spawn_command_line_async (cmdline, &error);
|
||||||
g_free (cmdline);
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
net_connection_editor_error_dialog (editor,
|
net_connection_editor_error_dialog (editor,
|
||||||
|
@ -265,7 +264,7 @@ net_connection_editor_do_fallback (NetConnectionEditor *editor, const gchar *typ
|
||||||
static void
|
static void
|
||||||
net_connection_editor_update_title (NetConnectionEditor *editor)
|
net_connection_editor_update_title (NetConnectionEditor *editor)
|
||||||
{
|
{
|
||||||
gchar *id;
|
g_autofree gchar *id = NULL;
|
||||||
|
|
||||||
if (editor->title_set)
|
if (editor->title_set)
|
||||||
return;
|
return;
|
||||||
|
@ -289,7 +288,6 @@ net_connection_editor_update_title (NetConnectionEditor *editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gtk_window_set_title (GTK_WINDOW (editor), id);
|
gtk_window_set_title (GTK_WINDOW (editor), id);
|
||||||
g_free (id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -561,23 +559,21 @@ complete_vpn_connection (NetConnectionEditor *editor, NMConnection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nm_setting_connection_get_uuid (s_con)) {
|
if (!nm_setting_connection_get_uuid (s_con)) {
|
||||||
gchar *uuid = nm_utils_uuid_generate ();
|
g_autofree gchar *uuid = nm_utils_uuid_generate ();
|
||||||
g_object_set (s_con,
|
g_object_set (s_con,
|
||||||
NM_SETTING_CONNECTION_UUID, uuid,
|
NM_SETTING_CONNECTION_UUID, uuid,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nm_setting_connection_get_id (s_con)) {
|
if (!nm_setting_connection_get_id (s_con)) {
|
||||||
const GPtrArray *connections;
|
const GPtrArray *connections;
|
||||||
gchar *id;
|
g_autofree gchar *id = NULL;
|
||||||
|
|
||||||
connections = nm_client_get_connections (editor->client);
|
connections = nm_client_get_connections (editor->client);
|
||||||
id = ce_page_get_next_available_name (connections, NAME_FORMAT_TYPE, _("VPN"));
|
id = ce_page_get_next_available_name (connections, NAME_FORMAT_TYPE, _("VPN"));
|
||||||
g_object_set (s_con,
|
g_object_set (s_con,
|
||||||
NM_SETTING_CONNECTION_ID, id,
|
NM_SETTING_CONNECTION_ID, id,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s_type = nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
|
s_type = nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
|
||||||
|
@ -670,7 +666,10 @@ select_vpn_type (NetConnectionEditor *editor, GtkListBox *list)
|
||||||
/* Add the VPN types */
|
/* Add the VPN types */
|
||||||
for (iter = vpn_plugins; iter; iter = iter->next) {
|
for (iter = vpn_plugins; iter; iter = iter->next) {
|
||||||
NMVpnEditorPlugin *plugin = nm_vpn_plugin_info_get_editor_plugin (iter->data);
|
NMVpnEditorPlugin *plugin = nm_vpn_plugin_info_get_editor_plugin (iter->data);
|
||||||
char *name, *desc, *desc_markup, *service_name;
|
g_autofree gchar *name = NULL;
|
||||||
|
g_autofree gchar *desc = NULL;
|
||||||
|
g_autofree gchar *desc_markup = NULL;
|
||||||
|
g_autofree gchar *service_name = NULL;
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
|
||||||
g_object_get (plugin,
|
g_object_get (plugin,
|
||||||
|
@ -700,13 +699,9 @@ select_vpn_type (NetConnectionEditor *editor, GtkListBox *list)
|
||||||
gtk_style_context_add_class (context, "dim-label");
|
gtk_style_context_add_class (context, "dim-label");
|
||||||
gtk_box_pack_start (GTK_BOX (row_box), desc_label, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (row_box), desc_label, FALSE, TRUE, 0);
|
||||||
|
|
||||||
g_free (name);
|
|
||||||
g_free (desc);
|
|
||||||
g_free (desc_markup);
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (row), row_box);
|
gtk_container_add (GTK_CONTAINER (row), row_box);
|
||||||
gtk_widget_show_all (row);
|
gtk_widget_show_all (row);
|
||||||
g_object_set_data_full (G_OBJECT (row), "service_name", service_name, g_free);
|
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_container_add (GTK_CONTAINER (list), row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ typedef struct {
|
||||||
static void
|
static void
|
||||||
import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
|
import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
|
||||||
{
|
{
|
||||||
char *filename = NULL;
|
g_autofree gchar *filename = NULL;
|
||||||
ActionInfo *info = (ActionInfo *) user_data;
|
ActionInfo *info = (ActionInfo *) user_data;
|
||||||
NMConnection *connection = NULL;
|
NMConnection *connection = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
@ -131,7 +131,7 @@ import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
|
||||||
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
GtkWidget *err_dialog;
|
GtkWidget *err_dialog;
|
||||||
char *bname = g_path_get_basename (filename);
|
g_autofree gchar *bname = g_path_get_basename (filename);
|
||||||
|
|
||||||
err_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
|
err_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
|
||||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
@ -141,12 +141,10 @@ import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
|
||||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (err_dialog),
|
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."),
|
_("The file “%s” could not be read or does not contain recognized VPN connection information\n\nError: %s."),
|
||||||
bname, error ? error->message : "unknown error");
|
bname, error ? error->message : "unknown error");
|
||||||
g_free (bname);
|
|
||||||
g_signal_connect (err_dialog, "delete-event", G_CALLBACK (gtk_widget_destroy), NULL);
|
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);
|
g_signal_connect (err_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
gtk_dialog_run (GTK_DIALOG (err_dialog));
|
gtk_dialog_run (GTK_DIALOG (err_dialog));
|
||||||
}
|
}
|
||||||
g_free (filename);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
gtk_widget_hide (dialog);
|
gtk_widget_hide (dialog);
|
||||||
|
@ -218,7 +216,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
|
||||||
if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
|
if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
|
||||||
int replace_response;
|
int replace_response;
|
||||||
GtkWidget *replace_dialog;
|
GtkWidget *replace_dialog;
|
||||||
char *bname;
|
g_autofree gchar *bname = NULL;
|
||||||
|
|
||||||
bname = g_path_get_basename (filename);
|
bname = g_path_get_basename (filename);
|
||||||
replace_dialog = gtk_message_dialog_new (NULL,
|
replace_dialog = gtk_message_dialog_new (NULL,
|
||||||
|
@ -230,7 +228,6 @@ 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_dialog_add_buttons (GTK_DIALOG (replace_dialog), _("_Replace"), GTK_RESPONSE_OK, NULL);
|
||||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (replace_dialog),
|
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);
|
_("Do you want to replace %s with the VPN connection you are saving?"), bname);
|
||||||
g_free (bname);
|
|
||||||
replace_response = gtk_dialog_run (GTK_DIALOG (replace_dialog));
|
replace_response = gtk_dialog_run (GTK_DIALOG (replace_dialog));
|
||||||
gtk_widget_destroy (replace_dialog);
|
gtk_widget_destroy (replace_dialog);
|
||||||
if (replace_response != GTK_RESPONSE_OK)
|
if (replace_response != GTK_RESPONSE_OK)
|
||||||
|
@ -259,7 +256,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
|
||||||
done:
|
done:
|
||||||
if (!success) {
|
if (!success) {
|
||||||
GtkWidget *err_dialog;
|
GtkWidget *err_dialog;
|
||||||
char *bname = filename ? g_path_get_basename (filename) : g_strdup ("(none)");
|
g_autofree gchar *bname = filename ? g_path_get_basename (filename) : g_strdup ("(none)");
|
||||||
|
|
||||||
err_dialog = gtk_message_dialog_new (NULL,
|
err_dialog = gtk_message_dialog_new (NULL,
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
@ -269,7 +266,6 @@ done:
|
||||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (err_dialog),
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (err_dialog),
|
||||||
_("The VPN connection “%s” could not be exported to %s.\n\nError: %s."),
|
_("The VPN connection “%s” could not be exported to %s.\n\nError: %s."),
|
||||||
id ? id : "(unknown)", bname, error ? error->message : "unknown error");
|
id ? id : "(unknown)", bname, error ? error->message : "unknown error");
|
||||||
g_free (bname);
|
|
||||||
g_signal_connect (err_dialog, "delete-event", G_CALLBACK (gtk_widget_destroy), NULL);
|
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);
|
g_signal_connect (err_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
gtk_widget_show_all (err_dialog);
|
gtk_widget_show_all (err_dialog);
|
||||||
|
@ -311,13 +307,11 @@ vpn_export (NMConnection *connection)
|
||||||
|
|
||||||
plugin = vpn_get_plugin_by_service (service_type);
|
plugin = vpn_get_plugin_by_service (service_type);
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
char *suggested = NULL;
|
g_autofree gchar *suggested = NULL;
|
||||||
|
|
||||||
suggested = nm_vpn_editor_plugin_get_suggested_filename (plugin, connection);
|
suggested = nm_vpn_editor_plugin_get_suggested_filename (plugin, connection);
|
||||||
if (suggested) {
|
if (suggested)
|
||||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested);
|
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested);
|
||||||
g_free (suggested);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "close", G_CALLBACK (gtk_widget_destroy), NULL);
|
g_signal_connect (G_OBJECT (dialog), "close", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
|
|
|
@ -149,10 +149,10 @@ add_details (GtkWidget *details, NMDevice *device, NMConnection *connection)
|
||||||
{
|
{
|
||||||
NMIPConfig *ip4_config = NULL;
|
NMIPConfig *ip4_config = NULL;
|
||||||
NMIPConfig *ip6_config = NULL;
|
NMIPConfig *ip6_config = NULL;
|
||||||
gchar *ip4_address = NULL;
|
g_autofree gchar *ip4_address = NULL;
|
||||||
gchar *ip4_route = NULL;
|
g_autofree gchar *ip4_route = NULL;
|
||||||
gchar *ip4_dns = NULL;
|
g_autofree gchar *ip4_dns = NULL;
|
||||||
gchar *ip6_address = NULL;
|
g_autofree gchar *ip6_address = NULL;
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
|
||||||
ip4_config = nm_device_get_ip4_config (device);
|
ip4_config = nm_device_get_ip4_config (device);
|
||||||
|
@ -184,16 +184,10 @@ add_details (GtkWidget *details, NMDevice *device, NMConnection *connection)
|
||||||
add_details_row (details, i++, _("DNS"), ip4_dns);
|
add_details_row (details, i++, _("DNS"), ip4_dns);
|
||||||
|
|
||||||
if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED) {
|
if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED) {
|
||||||
gchar *last_used;
|
g_autofree gchar *last_used = NULL;
|
||||||
last_used = get_last_used_string (connection);
|
last_used = get_last_used_string (connection);
|
||||||
add_details_row (details, i++, _("Last used"), last_used);
|
add_details_row (details, i++, _("Last used"), last_used);
|
||||||
g_free (last_used);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (ip4_address);
|
|
||||||
g_free (ip4_route);
|
|
||||||
g_free (ip4_dns);
|
|
||||||
g_free (ip6_address);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void populate_ui (NetDeviceEthernet *device);
|
static void populate_ui (NetDeviceEthernet *device);
|
||||||
|
@ -437,7 +431,8 @@ add_profile (GtkButton *button, NetDeviceEthernet *device)
|
||||||
{
|
{
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMSettingConnection *sc;
|
NMSettingConnection *sc;
|
||||||
gchar *uuid, *id;
|
g_autofree gchar *uuid = NULL;
|
||||||
|
g_autofree gchar *id = NULL;
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
|
@ -463,9 +458,6 @@ add_profile (GtkButton *button, NetDeviceEthernet *device)
|
||||||
|
|
||||||
nm_connection_add_setting (connection, nm_setting_wired_new ());
|
nm_connection_add_setting (connection, nm_setting_wired_new ());
|
||||||
|
|
||||||
g_free (uuid);
|
|
||||||
g_free (id);
|
|
||||||
|
|
||||||
window = gtk_widget_get_toplevel (GTK_WIDGET (button));
|
window = gtk_widget_get_toplevel (GTK_WIDGET (button));
|
||||||
|
|
||||||
nmdev = net_device_get_nm_device (NET_DEVICE (device));
|
nmdev = net_device_get_nm_device (NET_DEVICE (device));
|
||||||
|
|
|
@ -105,7 +105,7 @@ static void
|
||||||
mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mobile)
|
mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mobile)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
gchar *object_path = NULL;
|
g_autofree gchar *object_path = NULL;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
|
@ -115,15 +115,15 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
|
||||||
GtkWidget *toplevel;
|
GtkWidget *toplevel;
|
||||||
|
|
||||||
if (device_mobile->updating_device)
|
if (device_mobile->updating_device)
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
ret = gtk_combo_box_get_active_iter (combo_box, &iter);
|
ret = gtk_combo_box_get_active_iter (combo_box, &iter);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
device = net_device_get_nm_device (NET_DEVICE (device_mobile));
|
device = net_device_get_nm_device (NET_DEVICE (device_mobile));
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
goto out;
|
return;
|
||||||
client = net_object_get_client (NET_OBJECT (device_mobile));
|
client = net_object_get_client (NET_OBJECT (device_mobile));
|
||||||
|
|
||||||
/* get entry */
|
/* get entry */
|
||||||
|
@ -137,7 +137,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
|
||||||
cc_network_panel_connect_to_3g_network (toplevel,
|
cc_network_panel_connect_to_3g_network (toplevel,
|
||||||
client,
|
client,
|
||||||
device);
|
device);
|
||||||
goto out;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* activate the connection */
|
/* activate the connection */
|
||||||
|
@ -150,10 +150,8 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
|
||||||
device, NULL, NULL,
|
device, NULL, NULL,
|
||||||
connection_activate_cb,
|
connection_activate_cb,
|
||||||
device_mobile);
|
device_mobile);
|
||||||
goto out;
|
return;
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
g_free (object_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -308,7 +306,7 @@ static void
|
||||||
device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
|
device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
|
||||||
{
|
{
|
||||||
if (device_mobile->mm_object != NULL) {
|
if (device_mobile->mm_object != NULL) {
|
||||||
gchar *operator_name = NULL;
|
g_autofree gchar *operator_name = NULL;
|
||||||
MMModem3gpp *modem_3gpp;
|
MMModem3gpp *modem_3gpp;
|
||||||
MMModemCdma *modem_cdma;
|
MMModemCdma *modem_cdma;
|
||||||
|
|
||||||
|
@ -344,7 +342,6 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
|
||||||
}
|
}
|
||||||
|
|
||||||
panel_set_device_widget_details (device_mobile->builder, "provider", operator_name);
|
panel_set_device_widget_details (device_mobile->builder, "provider", operator_name);
|
||||||
g_free (operator_name);
|
|
||||||
} else {
|
} else {
|
||||||
const gchar *gsm;
|
const gchar *gsm;
|
||||||
const gchar *cdma;
|
const gchar *cdma;
|
||||||
|
@ -356,11 +353,8 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
|
||||||
"ControlCenter::OperatorNameCdma");
|
"ControlCenter::OperatorNameCdma");
|
||||||
|
|
||||||
if (gsm != NULL && cdma != NULL) {
|
if (gsm != NULL && cdma != NULL) {
|
||||||
gchar *both;
|
g_autofree gchar *both = g_strdup_printf ("%s, %s", gsm, cdma);
|
||||||
|
|
||||||
both = g_strdup_printf ("%s, %s", gsm, cdma);
|
|
||||||
panel_set_device_widget_details (device_mobile->builder, "provider", both);
|
panel_set_device_widget_details (device_mobile->builder, "provider", both);
|
||||||
g_free (both);
|
|
||||||
} else if (gsm != NULL) {
|
} else if (gsm != NULL) {
|
||||||
panel_set_device_widget_details (device_mobile->builder, "provider", gsm);
|
panel_set_device_widget_details (device_mobile->builder, "provider", gsm);
|
||||||
} else if (cdma != NULL) {
|
} else if (cdma != NULL) {
|
||||||
|
@ -538,11 +532,11 @@ device_mobile_get_registration_info_cb (GObject *source_object,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gchar *operator_code = NULL;
|
g_autofree gchar *operator_code = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
guint registration_status;
|
guint registration_status;
|
||||||
GVariant *result = NULL;
|
GVariant *result = NULL;
|
||||||
gchar *operator_name = NULL;
|
g_autofree gchar *operator_name = NULL;
|
||||||
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
|
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
|
||||||
|
|
||||||
result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
|
result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
|
||||||
|
@ -569,8 +563,6 @@ device_mobile_get_registration_info_cb (GObject *source_object,
|
||||||
"ControlCenter::OperatorNameGsm",
|
"ControlCenter::OperatorNameGsm",
|
||||||
operator_name);
|
operator_name);
|
||||||
|
|
||||||
g_free (operator_name);
|
|
||||||
g_free (operator_code);
|
|
||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,8 +574,8 @@ device_mobile_gsm_signal_cb (GDBusProxy *proxy,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
guint registration_status = 0;
|
guint registration_status = 0;
|
||||||
gchar *operator_code = NULL;
|
g_autofree gchar *operator_code = NULL;
|
||||||
gchar *operator_name = NULL;
|
g_autofree gchar *operator_name = NULL;
|
||||||
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
|
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
|
||||||
|
|
||||||
if (!g_str_equal (signal_name, "RegistrationInfo"))
|
if (!g_str_equal (signal_name, "RegistrationInfo"))
|
||||||
|
@ -605,9 +597,6 @@ device_mobile_gsm_signal_cb (GDBusProxy *proxy,
|
||||||
device_mobile_save_operator_name (device_mobile,
|
device_mobile_save_operator_name (device_mobile,
|
||||||
"ControlCenter::OperatorNameGsm",
|
"ControlCenter::OperatorNameGsm",
|
||||||
operator_name);
|
operator_name);
|
||||||
|
|
||||||
g_free (operator_code);
|
|
||||||
g_free (operator_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -652,7 +641,7 @@ device_mobile_get_serving_system_cb (GObject *source_object,
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
guint32 band_class;
|
guint32 band_class;
|
||||||
gchar *band;
|
g_autofree gchar *band = NULL;
|
||||||
guint32 sid;
|
guint32 sid;
|
||||||
gchar *operator_name;
|
gchar *operator_name;
|
||||||
|
|
||||||
|
@ -676,7 +665,6 @@ device_mobile_get_serving_system_cb (GObject *source_object,
|
||||||
"ControlCenter::OperatorNameCdma",
|
"ControlCenter::OperatorNameCdma",
|
||||||
operator_name);
|
operator_name);
|
||||||
|
|
||||||
g_free (band);
|
|
||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,9 +346,9 @@ static void
|
||||||
nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
|
nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
|
||||||
{
|
{
|
||||||
GBytes *ssid;
|
GBytes *ssid;
|
||||||
gchar *hotspot_secret = NULL;
|
g_autofree gchar *hotspot_secret = NULL;
|
||||||
gchar *hotspot_security = NULL;
|
g_autofree gchar *hotspot_security = NULL;
|
||||||
gchar *hotspot_ssid = NULL;
|
g_autofree gchar *hotspot_ssid = NULL;
|
||||||
NMDevice *nm_device;
|
NMDevice *nm_device;
|
||||||
|
|
||||||
/* refresh hotspot ui */
|
/* refresh hotspot ui */
|
||||||
|
@ -376,16 +376,12 @@ nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
|
||||||
panel_set_device_widget_details (device_wifi->builder,
|
panel_set_device_widget_details (device_wifi->builder,
|
||||||
"hotspot_connected",
|
"hotspot_connected",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (hotspot_secret);
|
|
||||||
g_free (hotspot_security);
|
|
||||||
g_free (hotspot_ssid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_last_used (NetDeviceWifi *device_wifi, NMConnection *connection)
|
update_last_used (NetDeviceWifi *device_wifi, NMConnection *connection)
|
||||||
{
|
{
|
||||||
gchar *last_used = NULL;
|
g_autofree gchar *last_used = NULL;
|
||||||
GDateTime *now = NULL;
|
GDateTime *now = NULL;
|
||||||
GDateTime *then = NULL;
|
GDateTime *then = NULL;
|
||||||
gint days;
|
gint days;
|
||||||
|
@ -421,7 +417,6 @@ out:
|
||||||
g_date_time_unref (now);
|
g_date_time_unref (now);
|
||||||
if (then != NULL)
|
if (then != NULL)
|
||||||
g_date_time_unref (then);
|
g_date_time_unref (then);
|
||||||
g_free (last_used);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -488,8 +483,8 @@ static void
|
||||||
nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
|
nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
|
||||||
{
|
{
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
gchar *speed_text = NULL;
|
g_autofree gchar *speed_text = NULL;
|
||||||
gchar *security_text = NULL;
|
g_autofree gchar *security_text = NULL;
|
||||||
gint strength = 0;
|
gint strength = 0;
|
||||||
guint speed = 0;
|
guint speed = 0;
|
||||||
NMAccessPoint *active_ap;
|
NMAccessPoint *active_ap;
|
||||||
|
@ -541,7 +536,6 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
|
||||||
panel_set_device_widget_details (device_wifi->builder,
|
panel_set_device_widget_details (device_wifi->builder,
|
||||||
"speed",
|
"speed",
|
||||||
speed_text);
|
speed_text);
|
||||||
g_free (speed_text);
|
|
||||||
|
|
||||||
/* device MAC */
|
/* device MAC */
|
||||||
str = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (nm_device));
|
str = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (nm_device));
|
||||||
|
@ -554,7 +548,6 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
|
||||||
panel_set_device_widget_details (device_wifi->builder,
|
panel_set_device_widget_details (device_wifi->builder,
|
||||||
"security",
|
"security",
|
||||||
security_text);
|
security_text);
|
||||||
g_free (security_text);
|
|
||||||
|
|
||||||
/* signal strength */
|
/* signal strength */
|
||||||
if (ap != NULL)
|
if (ap != NULL)
|
||||||
|
@ -828,11 +821,11 @@ static GBytes *
|
||||||
generate_ssid_for_hotspot (NetDeviceWifi *device_wifi)
|
generate_ssid_for_hotspot (NetDeviceWifi *device_wifi)
|
||||||
{
|
{
|
||||||
GBytes *ssid_bytes;
|
GBytes *ssid_bytes;
|
||||||
gchar *hostname, *ssid;
|
g_autofree gchar *hostname = NULL;
|
||||||
|
gchar *ssid;
|
||||||
|
|
||||||
hostname = get_hostname ();
|
hostname = get_hostname ();
|
||||||
ssid = pretty_hostname_to_ssid (hostname);
|
ssid = pretty_hostname_to_ssid (hostname);
|
||||||
g_free (hostname);
|
|
||||||
|
|
||||||
ssid_bytes = g_bytes_new_with_free_func (ssid,
|
ssid_bytes = g_bytes_new_with_free_func (ssid,
|
||||||
strlen (ssid),
|
strlen (ssid),
|
||||||
|
@ -1170,7 +1163,7 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
|
||||||
{
|
{
|
||||||
NMDevice *device;
|
NMDevice *device;
|
||||||
const GPtrArray *connections;
|
const GPtrArray *connections;
|
||||||
gchar *active_ssid;
|
g_autofree gchar *active_ssid = NULL;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
|
@ -1178,8 +1171,6 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GString *str;
|
GString *str;
|
||||||
|
|
||||||
active_ssid = NULL;
|
|
||||||
|
|
||||||
client = net_object_get_client (NET_OBJECT (device_wifi));
|
client = net_object_get_client (NET_OBJECT (device_wifi));
|
||||||
device = net_device_get_nm_device (NET_DEVICE (device_wifi));
|
device = net_device_get_nm_device (NET_DEVICE (device_wifi));
|
||||||
connections = nm_client_get_active_connections (client);
|
connections = nm_client_get_active_connections (client);
|
||||||
|
@ -1256,7 +1247,6 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
|
||||||
G_CALLBACK (start_hotspot_response_cb), device_wifi);
|
G_CALLBACK (start_hotspot_response_cb), device_wifi);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (dialog));
|
gtk_window_present (GTK_WINDOW (dialog));
|
||||||
g_free (active_ssid);
|
|
||||||
g_string_free (str, TRUE);
|
g_string_free (str, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,7 +1414,7 @@ static void
|
||||||
device_wifi_edit (NetObject *object)
|
device_wifi_edit (NetObject *object)
|
||||||
{
|
{
|
||||||
const gchar *uuid;
|
const gchar *uuid;
|
||||||
gchar *cmdline;
|
g_autofree gchar *cmdline = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
NetDeviceWifi *device = NET_DEVICE_WIFI (object);
|
NetDeviceWifi *device = NET_DEVICE_WIFI (object);
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
|
@ -1441,7 +1431,6 @@ device_wifi_edit (NetObject *object)
|
||||||
g_debug ("Launching '%s'\n", cmdline);
|
g_debug ("Launching '%s'\n", cmdline);
|
||||||
if (!g_spawn_command_line_async (cmdline, &error))
|
if (!g_spawn_command_line_async (cmdline, &error))
|
||||||
g_warning ("Failed to launch nm-connection-editor: %s", error->message);
|
g_warning ("Failed to launch nm-connection-editor: %s", error->message);
|
||||||
g_free (cmdline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -102,21 +102,18 @@ compare_mac_device_with_mac_connection (NMDevice *device,
|
||||||
NMConnection *connection)
|
NMConnection *connection)
|
||||||
{
|
{
|
||||||
const gchar *mac_dev = NULL;
|
const gchar *mac_dev = NULL;
|
||||||
gchar *mac_conn = NULL;
|
g_autofree gchar *mac_conn = NULL;
|
||||||
|
|
||||||
mac_dev = get_mac_address_of_device (device);
|
mac_dev = get_mac_address_of_device (device);
|
||||||
if (mac_dev != NULL) {
|
if (mac_dev == NULL)
|
||||||
mac_conn = get_mac_address_of_connection (connection);
|
return FALSE;
|
||||||
if (mac_conn) {
|
|
||||||
/* compare both MACs */
|
mac_conn = get_mac_address_of_connection (connection);
|
||||||
if (g_strcmp0 (mac_dev, mac_conn) == 0) {
|
if (mac_conn == NULL)
|
||||||
g_free (mac_conn);
|
return FALSE;
|
||||||
return TRUE;
|
|
||||||
}
|
/* compare both MACs */
|
||||||
g_free (mac_conn);
|
return g_strcmp0 (mac_dev, mac_conn) == 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMConnection *
|
static NMConnection *
|
||||||
|
@ -190,7 +187,7 @@ static void
|
||||||
net_device_edit (NetObject *object)
|
net_device_edit (NetObject *object)
|
||||||
{
|
{
|
||||||
const gchar *uuid;
|
const gchar *uuid;
|
||||||
gchar *cmdline;
|
g_autofree gchar *cmdline = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
NetDevice *device = NET_DEVICE (object);
|
NetDevice *device = NET_DEVICE (object);
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
|
@ -201,7 +198,6 @@ net_device_edit (NetObject *object)
|
||||||
g_debug ("Launching '%s'\n", cmdline);
|
g_debug ("Launching '%s'\n", cmdline);
|
||||||
if (!g_spawn_command_line_async (cmdline, &error))
|
if (!g_spawn_command_line_async (cmdline, &error))
|
||||||
g_warning ("Failed to launch nm-connection-editor: %s", error->message);
|
g_warning ("Failed to launch nm-connection-editor: %s", error->message);
|
||||||
g_free (cmdline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void
|
||||||
check_wpad_warning (NetProxy *proxy)
|
check_wpad_warning (NetProxy *proxy)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
gchar *autoconfig_url = NULL;
|
g_autofree gchar *autoconfig_url = NULL;
|
||||||
GString *string = NULL;
|
GString *string = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
guint mode;
|
guint mode;
|
||||||
|
@ -115,7 +115,6 @@ out:
|
||||||
gtk_label_set_markup (GTK_LABEL (widget), string->str);
|
gtk_label_set_markup (GTK_LABEL (widget), string->str);
|
||||||
gtk_widget_set_visible (widget, (string->len > 0));
|
gtk_widget_set_visible (widget, (string->len > 0));
|
||||||
|
|
||||||
g_free (autoconfig_url);
|
|
||||||
g_string_free (string, TRUE);
|
g_string_free (string, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +242,8 @@ get_ignore_hosts (GValue *value,
|
||||||
{
|
{
|
||||||
GVariantIter iter;
|
GVariantIter iter;
|
||||||
const gchar *s;
|
const gchar *s;
|
||||||
gchar **av, **p;
|
g_autofree gchar **av = NULL;
|
||||||
|
gchar **p;
|
||||||
gsize n;
|
gsize n;
|
||||||
|
|
||||||
n = g_variant_iter_init (&iter, variant);
|
n = g_variant_iter_init (&iter, variant);
|
||||||
|
@ -256,7 +256,6 @@ get_ignore_hosts (GValue *value,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_value_take_string (value, g_strjoinv (", ", av));
|
g_value_take_string (value, g_strjoinv (", ", av));
|
||||||
g_free (av);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
|
||||||
NMActiveConnection *a;
|
NMActiveConnection *a;
|
||||||
gint i;
|
gint i;
|
||||||
NMVpnConnectionState state;
|
NMVpnConnectionState state;
|
||||||
gchar *title;
|
g_autofree gchar *title = NULL;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
|
|
||||||
/* update title */
|
/* update title */
|
||||||
|
@ -167,7 +167,6 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
|
||||||
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
|
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
|
||||||
net_object_set_title (NET_OBJECT (vpn), title);
|
net_object_set_title (NET_OBJECT (vpn), title);
|
||||||
gtk_label_set_label (GTK_LABEL (widget), title);
|
gtk_label_set_label (GTK_LABEL (widget), title);
|
||||||
g_free (title);
|
|
||||||
|
|
||||||
if (vpn->active_connection) {
|
if (vpn->active_connection) {
|
||||||
g_signal_handlers_disconnect_by_func (vpn->active_connection,
|
g_signal_handlers_disconnect_by_func (vpn->active_connection,
|
||||||
|
@ -281,7 +280,7 @@ vpn_proxy_edit (NetObject *object)
|
||||||
GtkWidget *button, *window;
|
GtkWidget *button, *window;
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
gchar *title;
|
g_autofree gchar *title = NULL;
|
||||||
|
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
|
button = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
|
||||||
"button_options"));
|
"button_options"));
|
||||||
|
@ -294,7 +293,6 @@ vpn_proxy_edit (NetObject *object)
|
||||||
NULL, NULL, client);
|
NULL, NULL, client);
|
||||||
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
|
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
|
||||||
net_connection_editor_set_title (editor, title);
|
net_connection_editor_set_title (editor, title);
|
||||||
g_free (title);
|
|
||||||
|
|
||||||
g_signal_connect (editor, "done", G_CALLBACK (editor_done), g_object_ref (vpn));
|
g_signal_connect (editor, "done", G_CALLBACK (editor_done), g_object_ref (vpn));
|
||||||
net_connection_editor_run (editor);
|
net_connection_editor_run (editor);
|
||||||
|
|
|
@ -230,7 +230,7 @@ cc_network_panel_connect_to_8021x_network (GtkWidget *toplevel,
|
||||||
NMSetting8021x *s_8021x;
|
NMSetting8021x *s_8021x;
|
||||||
NM80211ApSecurityFlags wpa_flags, rsn_flags;
|
NM80211ApSecurityFlags wpa_flags, rsn_flags;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
char *uuid;
|
g_autofree gchar *uuid = NULL;
|
||||||
NMAccessPoint *ap;
|
NMAccessPoint *ap;
|
||||||
|
|
||||||
g_debug ("connect to 8021x wifi");
|
g_debug ("connect to 8021x wifi");
|
||||||
|
@ -258,7 +258,6 @@ cc_network_panel_connect_to_8021x_network (GtkWidget *toplevel,
|
||||||
s_con = (NMSettingConnection *) nm_setting_connection_new ();
|
s_con = (NMSettingConnection *) nm_setting_connection_new ();
|
||||||
uuid = nm_utils_uuid_generate ();
|
uuid = nm_utils_uuid_generate ();
|
||||||
g_object_set (s_con, NM_SETTING_CONNECTION_UUID, uuid, NULL);
|
g_object_set (s_con, NM_SETTING_CONNECTION_UUID, uuid, NULL);
|
||||||
g_free (uuid);
|
|
||||||
nm_connection_add_setting (connection, NM_SETTING (s_con));
|
nm_connection_add_setting (connection, NM_SETTING (s_con));
|
||||||
|
|
||||||
s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
|
s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
|
||||||
|
@ -315,7 +314,8 @@ cdma_mobile_wizard_done (NMAMobileWizard *wizard,
|
||||||
|
|
||||||
if (!canceled && method) {
|
if (!canceled && method) {
|
||||||
NMSetting *setting;
|
NMSetting *setting;
|
||||||
char *uuid, *id;
|
g_autofree gchar *uuid = NULL;
|
||||||
|
g_autofree gchar *id = NULL;
|
||||||
|
|
||||||
if (method->devtype != NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) {
|
if (method->devtype != NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) {
|
||||||
g_warning ("Unexpected device type (not CDMA).");
|
g_warning ("Unexpected device type (not CDMA).");
|
||||||
|
@ -357,8 +357,6 @@ cdma_mobile_wizard_done (NMAMobileWizard *wizard,
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
|
NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
|
||||||
NM_SETTING_CONNECTION_UUID, uuid,
|
NM_SETTING_CONNECTION_UUID, uuid,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (uuid);
|
|
||||||
g_free (id);
|
|
||||||
nm_connection_add_setting (connection, setting);
|
nm_connection_add_setting (connection, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +375,8 @@ gsm_mobile_wizard_done (NMAMobileWizard *wizard,
|
||||||
|
|
||||||
if (!canceled && method) {
|
if (!canceled && method) {
|
||||||
NMSetting *setting;
|
NMSetting *setting;
|
||||||
char *uuid, *id;
|
g_autofree gchar *uuid = NULL;
|
||||||
|
g_autofree gchar *id = NULL;
|
||||||
|
|
||||||
if (method->devtype != NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) {
|
if (method->devtype != NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) {
|
||||||
g_warning ("Unexpected device type (not GSM).");
|
g_warning ("Unexpected device type (not GSM).");
|
||||||
|
@ -420,8 +419,6 @@ gsm_mobile_wizard_done (NMAMobileWizard *wizard,
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
|
NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
|
||||||
NM_SETTING_CONNECTION_UUID, uuid,
|
NM_SETTING_CONNECTION_UUID, uuid,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (uuid);
|
|
||||||
g_free (id);
|
|
||||||
nm_connection_add_setting (connection, setting);
|
nm_connection_add_setting (connection, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -470,12 +470,11 @@ panel_set_device_status (GtkBuilder *builder,
|
||||||
const gchar *speed)
|
const gchar *speed)
|
||||||
{
|
{
|
||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
gchar *status;
|
g_autofree gchar *status = NULL;
|
||||||
|
|
||||||
label = GTK_LABEL (gtk_builder_get_object (builder, label_name));
|
label = GTK_LABEL (gtk_builder_get_object (builder, label_name));
|
||||||
status = device_status_to_localized_string (nm_device, speed);
|
status = device_status_to_localized_string (nm_device, speed);
|
||||||
gtk_label_set_label (label, status);
|
gtk_label_set_label (label, status);
|
||||||
g_free (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -497,8 +496,8 @@ panel_set_device_widget_details (GtkBuilder *builder,
|
||||||
const gchar *widget_suffix,
|
const gchar *widget_suffix,
|
||||||
const gchar *value)
|
const gchar *value)
|
||||||
{
|
{
|
||||||
gchar *heading_id;
|
g_autofree gchar *heading_id = NULL;
|
||||||
gchar *label_id;
|
g_autofree gchar *label_id = NULL;
|
||||||
GtkWidget *heading;
|
GtkWidget *heading;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
@ -511,8 +510,6 @@ panel_set_device_widget_details (GtkBuilder *builder,
|
||||||
g_critical ("no widgets %s, %s found", heading_id, label_id);
|
g_critical ("no widgets %s, %s found", heading_id, label_id);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free (heading_id);
|
|
||||||
g_free (label_id);
|
|
||||||
|
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
gtk_widget_hide (heading);
|
gtk_widget_hide (heading);
|
||||||
|
@ -534,7 +531,7 @@ panel_set_device_widget_header (GtkBuilder *builder,
|
||||||
const gchar *widget_suffix,
|
const gchar *widget_suffix,
|
||||||
const gchar *heading)
|
const gchar *heading)
|
||||||
{
|
{
|
||||||
gchar *label_id = NULL;
|
g_autofree gchar *label_id = NULL;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
label_id = g_strdup_printf ("heading_%s", widget_suffix);
|
label_id = g_strdup_printf ("heading_%s", widget_suffix);
|
||||||
|
@ -544,7 +541,6 @@ panel_set_device_widget_header (GtkBuilder *builder,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
gtk_label_set_label (GTK_LABEL (widget), heading);
|
gtk_label_set_label (GTK_LABEL (widget), heading);
|
||||||
g_free (label_id);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
const char *text;
|
const char *text;
|
||||||
char *filename;
|
g_autofree gchar *filename = NULL;
|
||||||
EAPMethod *eap = NULL;
|
EAPMethod *eap = NULL;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
@ -166,7 +166,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
ca_cert_error = TRUE;
|
ca_cert_error = TRUE;
|
||||||
}
|
}
|
||||||
eap_method_ca_cert_ignore_set (parent, connection, filename, ca_cert_error);
|
eap_method_ca_cert_ignore_set (parent, connection, filename, ca_cert_error);
|
||||||
g_free (filename);
|
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_version_combo"));
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_version_combo"));
|
||||||
peapver_active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
peapver_active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||||
|
|
|
@ -163,7 +163,8 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
NMSetting8021x *s_8021x;
|
NMSetting8021x *s_8021x;
|
||||||
NMSettingSecretFlags secret_flags;
|
NMSettingSecretFlags secret_flags;
|
||||||
GtkWidget *widget, *passwd_entry;
|
GtkWidget *widget, *passwd_entry;
|
||||||
char *ca_filename, *pk_filename, *cc_filename;
|
g_autofree gchar *ca_filename = NULL;
|
||||||
|
g_autofree gchar *pk_filename = NULL;
|
||||||
const char *password = NULL;
|
const char *password = NULL;
|
||||||
gboolean ca_cert_error = FALSE;
|
gboolean ca_cert_error = FALSE;
|
||||||
|
|
||||||
|
@ -200,7 +201,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
if (!nm_setting_802_1x_set_private_key (s_8021x, pk_filename, password, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error))
|
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)");
|
g_warning ("Couldn't read private key '%s': %s", pk_filename, error ? error->message : "(unknown)");
|
||||||
}
|
}
|
||||||
g_free (pk_filename);
|
|
||||||
|
|
||||||
/* Save 802.1X password flags to the connection */
|
/* Save 802.1X password flags to the connection */
|
||||||
secret_flags = nma_utils_menu_to_secret_flags (passwd_entry);
|
secret_flags = nma_utils_menu_to_secret_flags (passwd_entry);
|
||||||
|
@ -215,6 +215,8 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
|
|
||||||
/* TLS client certificate */
|
/* TLS client certificate */
|
||||||
if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) {
|
if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) {
|
||||||
|
g_autofree gchar *cc_filename = NULL;
|
||||||
|
|
||||||
/* If the key is pkcs#12 nm_setting_802_1x_set_private_key() already
|
/* If the key is pkcs#12 nm_setting_802_1x_set_private_key() already
|
||||||
* set the client certificate for us.
|
* set the client certificate for us.
|
||||||
*/
|
*/
|
||||||
|
@ -233,7 +235,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
if (!nm_setting_802_1x_set_client_cert (s_8021x, cc_filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error))
|
if (!nm_setting_802_1x_set_client_cert (s_8021x, cc_filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error))
|
||||||
g_warning ("Couldn't read client certificate '%s': %s", cc_filename, error ? error->message : "(unknown)");
|
g_warning ("Couldn't read client certificate '%s': %s", cc_filename, error ? error->message : "(unknown)");
|
||||||
}
|
}
|
||||||
g_free (cc_filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TLS CA certificate */
|
/* TLS CA certificate */
|
||||||
|
@ -256,7 +257,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eap_method_ca_cert_ignore_set (parent, connection, ca_filename, ca_cert_error);
|
eap_method_ca_cert_ignore_set (parent, connection, ca_filename, ca_cert_error);
|
||||||
g_free (ca_filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -311,12 +311,11 @@ static void
|
||||||
private_key_picker_file_set_cb (GtkWidget *chooser, gpointer user_data)
|
private_key_picker_file_set_cb (GtkWidget *chooser, gpointer user_data)
|
||||||
{
|
{
|
||||||
EAPMethod *parent = (EAPMethod *) user_data;
|
EAPMethod *parent = (EAPMethod *) user_data;
|
||||||
char *filename;
|
g_autofree gchar *filename = NULL;
|
||||||
|
|
||||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
|
||||||
if (filename)
|
if (filename)
|
||||||
private_key_picker_helper (parent, filename, TRUE);
|
private_key_picker_helper (parent, filename, TRUE);
|
||||||
g_free (filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset_filter (GtkWidget *widget, GParamSpec *spec, gpointer user_data)
|
static void reset_filter (GtkWidget *widget, GParamSpec *spec, gpointer user_data)
|
||||||
|
|
|
@ -139,7 +139,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
const char *text;
|
const char *text;
|
||||||
char *filename;
|
g_autofree gchar *filename = NULL;
|
||||||
EAPMethod *eap = NULL;
|
EAPMethod *eap = NULL;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
@ -171,7 +171,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
|
||||||
ca_cert_error = TRUE;
|
ca_cert_error = TRUE;
|
||||||
}
|
}
|
||||||
eap_method_ca_cert_ignore_set (parent, connection, filename, ca_cert_error);
|
eap_method_ca_cert_ignore_set (parent, connection, filename, ca_cert_error);
|
||||||
g_free (filename);
|
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
||||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
|
||||||
|
|
|
@ -227,7 +227,7 @@ eap_method_validate_filepicker (GtkBuilder *builder,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
char *filename;
|
g_autofree gchar *filename = NULL;
|
||||||
NMSetting8021x *setting;
|
NMSetting8021x *setting;
|
||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
|
|
||||||
|
@ -270,8 +270,6 @@ eap_method_validate_filepicker (GtkBuilder *builder,
|
||||||
g_object_unref (setting);
|
g_object_unref (setting);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_free (filename);
|
|
||||||
|
|
||||||
if (!success && error && !*error)
|
if (!success && error && !*error)
|
||||||
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("unspecified error validating eap-method file"));
|
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("unspecified error validating eap-method file"));
|
||||||
|
|
||||||
|
@ -285,7 +283,8 @@ out:
|
||||||
static gboolean
|
static gboolean
|
||||||
file_has_extension (const char *filename, const char *extensions[])
|
file_has_extension (const char *filename, const char *extensions[])
|
||||||
{
|
{
|
||||||
char *p, *ext;
|
char *p;
|
||||||
|
g_autofree gchar *ext = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
|
@ -302,7 +301,6 @@ file_has_extension (const char *filename, const char *extensions[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_free (ext);
|
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
@ -486,7 +484,6 @@ eap_method_is_encrypted_private_key (const char *path)
|
||||||
gboolean
|
gboolean
|
||||||
eap_method_ca_cert_required (GtkBuilder *builder, const char *id_ca_cert_not_required_checkbutton, const char *id_ca_cert_chooser)
|
eap_method_ca_cert_required (GtkBuilder *builder, const char *id_ca_cert_not_required_checkbutton, const char *id_ca_cert_chooser)
|
||||||
{
|
{
|
||||||
char *filename;
|
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
g_assert (builder && id_ca_cert_not_required_checkbutton && id_ca_cert_chooser);
|
g_assert (builder && id_ca_cert_not_required_checkbutton && id_ca_cert_chooser);
|
||||||
|
@ -495,13 +492,14 @@ eap_method_ca_cert_required (GtkBuilder *builder, const char *id_ca_cert_not_req
|
||||||
g_assert (widget && GTK_IS_TOGGLE_BUTTON (widget));
|
g_assert (widget && GTK_IS_TOGGLE_BUTTON (widget));
|
||||||
|
|
||||||
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
|
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
|
||||||
|
g_autofree gchar *filename = NULL;
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (builder, id_ca_cert_chooser));
|
widget = GTK_WIDGET (gtk_builder_get_object (builder, id_ca_cert_chooser));
|
||||||
g_assert (widget && GTK_IS_FILE_CHOOSER (widget));
|
g_assert (widget && GTK_IS_FILE_CHOOSER (widget));
|
||||||
|
|
||||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
g_free (filename);
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +508,8 @@ eap_method_ca_cert_required (GtkBuilder *builder, const char *id_ca_cert_not_req
|
||||||
void
|
void
|
||||||
eap_method_ca_cert_not_required_toggled (GtkBuilder *builder, const char *id_ca_cert_not_required_checkbutton, const char *id_ca_cert_chooser)
|
eap_method_ca_cert_not_required_toggled (GtkBuilder *builder, const char *id_ca_cert_not_required_checkbutton, const char *id_ca_cert_chooser)
|
||||||
{
|
{
|
||||||
char *filename, *filename_old;
|
g_autofree gchar *filename = NULL;
|
||||||
|
g_autofree gchar *filename_old = NULL;
|
||||||
gboolean is_not_required;
|
gboolean is_not_required;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
@ -527,20 +526,17 @@ eap_method_ca_cert_not_required_toggled (GtkBuilder *builder, const char *id_ca_
|
||||||
filename_old = g_object_steal_data (G_OBJECT (widget), "filename-old");
|
filename_old = g_object_steal_data (G_OBJECT (widget), "filename-old");
|
||||||
if (is_not_required) {
|
if (is_not_required) {
|
||||||
g_free (filename_old);
|
g_free (filename_old);
|
||||||
filename_old = filename;
|
filename_old = g_steal_pointer (&filename);
|
||||||
filename = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
filename = filename_old;
|
filename = g_steal_pointer (&filename_old);
|
||||||
filename_old = NULL;
|
|
||||||
}
|
}
|
||||||
gtk_widget_set_sensitive (widget, !is_not_required);
|
gtk_widget_set_sensitive (widget, !is_not_required);
|
||||||
if (filename)
|
if (filename)
|
||||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
|
||||||
else
|
else
|
||||||
gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (widget));
|
gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (widget));
|
||||||
g_free (filename);
|
g_object_set_data_full (G_OBJECT (widget), "filename-old", g_steal_pointer (&filename_old), g_free);
|
||||||
g_object_set_data_full (G_OBJECT (widget), "filename-old", filename_old, g_free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used as both GSettings keys and GObject data tags */
|
/* Used as both GSettings keys and GObject data tags */
|
||||||
|
@ -604,7 +600,7 @@ static GSettings *
|
||||||
_get_ca_ignore_settings (NMConnection *connection)
|
_get_ca_ignore_settings (NMConnection *connection)
|
||||||
{
|
{
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
char *path = NULL;
|
g_autofree gchar *path = NULL;
|
||||||
const char *uuid;
|
const char *uuid;
|
||||||
|
|
||||||
g_return_val_if_fail (connection, NULL);
|
g_return_val_if_fail (connection, NULL);
|
||||||
|
@ -614,7 +610,6 @@ _get_ca_ignore_settings (NMConnection *connection)
|
||||||
|
|
||||||
path = g_strdup_printf ("/org/gnome/nm-applet/eap/%s/", uuid);
|
path = g_strdup_printf ("/org/gnome/nm-applet/eap/%s/", uuid);
|
||||||
settings = g_settings_new_with_path ("org.gnome.nm-applet.eap", path);
|
settings = g_settings_new_with_path ("org.gnome.nm-applet.eap", path);
|
||||||
g_free (path);
|
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ utils_filter_editable_on_insert_text (GtkEditable *editable,
|
||||||
gpointer block_func)
|
gpointer block_func)
|
||||||
{
|
{
|
||||||
int i, count = 0;
|
int i, count = 0;
|
||||||
gchar *result = g_new (gchar, length+1);
|
g_autofree gchar *result = g_new (gchar, length+1);
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (validate_character (text[i]))
|
if (validate_character (text[i]))
|
||||||
|
@ -65,8 +65,6 @@ utils_filter_editable_on_insert_text (GtkEditable *editable,
|
||||||
}
|
}
|
||||||
g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
|
g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
|
||||||
|
|
||||||
g_free (result);
|
|
||||||
|
|
||||||
return count > 0;
|
return count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue