network: Update wireless-security from network-manager-applet

This commit is contained in:
Bastien Nocera 2017-03-13 14:22:09 +01:00
parent 909eb2ac31
commit 0470c040b1
25 changed files with 123 additions and 479 deletions

View file

@ -349,7 +349,7 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/eap-method-fast.ui",
"/org/freedesktop/network-manager-applet/eap-method-fast.ui",
"eap_fast_notebook",
"eap_fast_anon_identity_entry",
FALSE);

View file

@ -176,15 +176,11 @@ destroy (EAPMethod *parent)
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_leap_notebook"));
g_assert (widget);
g_signal_handlers_disconnect_by_data (widget, method);
g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
(GCallback) widgets_realized,
method);
g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
(GCallback) widgets_unrealized,
method);
wireless_security_unref (method->ws_parent);
g_signal_handlers_disconnect_by_data (method->username_entry, method->ws_parent);
g_signal_handlers_disconnect_by_data (method->password_entry, method->ws_parent);
g_signal_handlers_disconnect_by_data (method->show_password, method);
}
EAPMethodLEAP *
@ -203,7 +199,7 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/eap-method-leap.ui",
"/org/freedesktop/network-manager-applet/eap-method-leap.ui",
"eap_leap_notebook",
"eap_leap_username_entry",
FALSE);
@ -213,7 +209,7 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
method = (EAPMethodLEAP *) parent;
method->editing_connection = secrets_only ? FALSE : TRUE;
method->ws_parent = wireless_security_ref (ws_parent);
method->ws_parent = ws_parent;
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_leap_notebook"));
g_assert (widget);

View file

@ -349,7 +349,7 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/eap-method-peap.ui",
"/org/freedesktop/network-manager-applet/eap-method-peap.ui",
"eap_peap_notebook",
"eap_peap_anon_identity_entry",
FALSE);

View file

@ -115,13 +115,14 @@ typedef struct {
/* Indexed by EAP_METHOD_SIMPLE_TYPE_* */
static const EapType eap_table[EAP_METHOD_SIMPLE_TYPE_LAST] = {
[EAP_METHOD_SIMPLE_TYPE_PAP] = { "pap", FALSE },
[EAP_METHOD_SIMPLE_TYPE_MSCHAP] = { "mschap", FALSE },
[EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2] = { "mschapv2", TRUE },
[EAP_METHOD_SIMPLE_TYPE_MD5] = { "md5", TRUE },
[EAP_METHOD_SIMPLE_TYPE_PWD] = { "pwd", TRUE },
[EAP_METHOD_SIMPLE_TYPE_CHAP] = { "chap", FALSE },
[EAP_METHOD_SIMPLE_TYPE_GTC] = { "gtc", TRUE },
[EAP_METHOD_SIMPLE_TYPE_PAP] = { "pap", FALSE },
[EAP_METHOD_SIMPLE_TYPE_MSCHAP] = { "mschap", FALSE },
[EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2] = { "mschapv2", TRUE },
[EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2] = { "mschapv2", FALSE },
[EAP_METHOD_SIMPLE_TYPE_MD5] = { "md5", TRUE },
[EAP_METHOD_SIMPLE_TYPE_PWD] = { "pwd", TRUE },
[EAP_METHOD_SIMPLE_TYPE_CHAP] = { "chap", FALSE },
[EAP_METHOD_SIMPLE_TYPE_GTC] = { "gtc", TRUE },
};
static void
@ -268,25 +269,14 @@ destroy (EAPMethod *parent)
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_simple_notebook"));
g_assert (widget);
g_signal_handlers_disconnect_by_data (widget, method);
g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
(GCallback) widgets_realized,
method);
g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
(GCallback) widgets_unrealized,
method);
g_signal_handlers_disconnect_by_data (method->username_entry, method->ws_parent);
g_signal_handlers_disconnect_by_data (method->password_entry, method->ws_parent);
g_signal_handlers_disconnect_by_data (method->password_entry, method);
g_signal_handlers_disconnect_by_data (method->show_password, method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_simple_password_entry"));
g_assert (widget);
g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
(GCallback) password_storage_changed,
method);
if (method->idle_func_id > 0) {
g_source_remove (method->idle_func_id);
method->idle_func_id = 0;
}
wireless_security_unref (method->ws_parent);
nm_clear_g_source (&method->idle_func_id);
}
EAPMethodSimple *
@ -306,7 +296,7 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/eap-method-simple.ui",
"/org/freedesktop/network-manager-applet/eap-method-simple.ui",
"eap_simple_notebook",
"eap_simple_username_entry",
flags & EAP_METHOD_SIMPLE_FLAG_PHASE2);
@ -315,7 +305,7 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
method = (EAPMethodSimple *) parent;
method->ws_parent = wireless_security_ref (ws_parent);
method->ws_parent = ws_parent;
method->flags = flags;
method->type = type;
g_assert (type < EAP_METHOD_SIMPLE_TYPE_LAST);

View file

@ -30,6 +30,7 @@ typedef enum {
EAP_METHOD_SIMPLE_TYPE_PAP = 0,
EAP_METHOD_SIMPLE_TYPE_MSCHAP,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
EAP_METHOD_SIMPLE_TYPE_MD5,
EAP_METHOD_SIMPLE_TYPE_PWD,
EAP_METHOD_SIMPLE_TYPE_CHAP,

View file

@ -316,7 +316,7 @@ private_key_picker_helper (EAPMethod *parent, const char *filename, gboolean cha
_("Unencrypted private keys are insecure"));
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)"));
_("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);
}
@ -458,7 +458,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
NULL,
"/org/gnome/control-center/network/eap-method-tls.ui",
"/org/freedesktop/network-manager-applet/eap-method-tls.ui",
"eap_tls_notebook",
"eap_tls_identity_entry",
phase2);

View file

@ -227,6 +227,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
EAPMethodSimple *em_pap;
EAPMethodSimple *em_mschap;
EAPMethodSimple *em_mschap_v2;
EAPMethodSimple *em_plain_mschap_v2;
EAPMethodSimple *em_chap;
EAPMethodSimple *em_md5;
EAPMethodSimple *em_gtc;
@ -291,9 +292,26 @@ inner_auth_combo_init (EAPMethodTTLS *method,
eap_method_unref (EAP_METHOD (em_mschap_v2));
/* Check for defaulting to MSCHAPv2 */
if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2"))
if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2") &&
nm_setting_802_1x_get_phase2_autheap (s_8021x) != NULL)
active = 2;
em_plain_mschap_v2 = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
simple_flags);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
I_NAME_COLUMN, _("MSCHAPv2 (no EAP)"),
I_METHOD_COLUMN, em_plain_mschap_v2,
-1);
eap_method_unref (EAP_METHOD (em_plain_mschap_v2));
/* Check for defaulting to plain MSCHAPv2 */
if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2") &&
nm_setting_802_1x_get_phase2_auth (s_8021x) != NULL)
active = 3;
em_chap = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_CHAP,
@ -307,7 +325,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
/* Check for defaulting to CHAP */
if (phase2_auth && !strcasecmp (phase2_auth, "chap"))
active = 3;
active = 4;
em_md5 = eap_method_simple_new (method->sec_parent,
connection,
@ -322,7 +340,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
/* Check for defaulting to MD5 */
if (phase2_auth && !strcasecmp (phase2_auth, "md5"))
active = 4;
active = 5;
em_gtc = eap_method_simple_new (method->sec_parent,
connection,
@ -337,7 +355,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
/* Check for defaulting to GTC */
if (phase2_auth && !strcasecmp (phase2_auth, "gtc"))
active = 5;
active = 6;
combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
g_assert (combo);
@ -380,7 +398,7 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/eap-method-ttls.ui",
"/org/freedesktop/network-manager-applet/eap-method-ttls.ui",
"eap_ttls_notebook",
"eap_ttls_anon_identity_entry",
FALSE);

View file

@ -34,19 +34,7 @@
#include "utils.h"
#include "helpers.h"
GType
eap_method_get_type (void)
{
static GType type_id = 0;
if (!type_id) {
type_id = g_boxed_type_register_static ("CcEAPMethod",
(GBoxedCopyFunc) eap_method_ref,
(GBoxedFreeFunc) eap_method_unref);
}
return type_id;
}
G_DEFINE_BOXED_TYPE (EAPMethod, eap_method, eap_method_ref, eap_method_unref)
GtkWidget *
eap_method_get_widget (EAPMethod *method)
@ -66,7 +54,7 @@ eap_method_validate (EAPMethod *method, GError **error)
g_assert (method->validate);
result = (*(method->validate)) (method, error);
if (!result && error && !*error)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("undefined error in 802.1x security (wpa-eap)"));
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("undefined error in 802.1X security (wpa-eap)"));
return result;
}
@ -167,7 +155,7 @@ eap_method_init (gsize obj_size,
method->builder = gtk_builder_new ();
if (!gtk_builder_add_from_resource (method->builder, ui_resource, &error)) {
g_warning ("Couldn't load UI builder file %s: %s",
g_warning ("Couldn't load UI builder resource %s: %s",
ui_resource, error->message);
eap_method_unref (method);
return NULL;
@ -282,31 +270,6 @@ out:
return success;
}
#ifdef LIBNM_GLIB_BUILD
static const char *
find_tag (const char *tag, const char *buf, gsize len)
{
gsize i, taglen;
taglen = strlen (tag);
if (len < taglen)
return NULL;
for (i = 0; i < len - taglen + 1; i++) {
if (memcmp (buf + i, tag, taglen) == 0)
return buf + i;
}
return NULL;
}
static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
static const char *pem_dsa_key_begin = "-----BEGIN DSA PRIVATE KEY-----";
static const char *pem_pkcs8_enc_key_begin = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
static const char *pem_pkcs8_dec_key_begin = "-----BEGIN PRIVATE KEY-----";
static const char *pem_cert_begin = "-----BEGIN CERTIFICATE-----";
static const char *proc_type_tag = "Proc-Type: 4,ENCRYPTED";
static const char *dek_info_tag = "DEK-Info:";
static gboolean
file_has_extension (const char *filename, const char *extensions[])
{
@ -332,6 +295,31 @@ file_has_extension (const char *filename, const char *extensions[])
return found;
}
#if !LIBNM_BUILD
static const char *
find_tag (const char *tag, const char *buf, gsize len)
{
gsize i, taglen;
taglen = strlen (tag);
if (len < taglen)
return NULL;
for (i = 0; i < len - taglen + 1; i++) {
if (memcmp (buf + i, tag, taglen) == 0)
return buf + i;
}
return NULL;
}
static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
static const char *pem_dsa_key_begin = "-----BEGIN DSA PRIVATE KEY-----";
static const char *pem_pkcs8_enc_key_begin = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
static const char *pem_pkcs8_dec_key_begin = "-----BEGIN PRIVATE KEY-----";
static const char *pem_cert_begin = "-----BEGIN CERTIFICATE-----";
static const char *proc_type_tag = "Proc-Type: 4,ENCRYPTED";
static const char *dek_info_tag = "DEK-Info:";
static gboolean
pem_file_is_encrypted (const char *buffer, gsize bytes_read)
{
@ -415,57 +403,28 @@ out:
static gboolean
default_filter_privkey (const GtkFileFilterInfo *filter_info, gpointer user_data)
{
#ifdef LIBNM_GLIB_BUILD
const char *extensions[] = { ".der", ".pem", ".p12", ".key", NULL };
#endif
gboolean require_encrypted = !!user_data;
gboolean is_encrypted;
if (!filter_info->filename)
return FALSE;
#if defined (LIBNM_GLIB_BUILD)
if (!file_has_extension (filter_info->filename, extensions))
return FALSE;
is_encrypted = TRUE;
if ( !file_is_der_or_pem (filter_info->filename, TRUE, &is_encrypted)
&& !nm_utils_file_is_pkcs12 (filter_info->filename))
return FALSE;
#elif defined (LIBNM_BUILD)
is_encrypted = FALSE;
if (!nm_utils_file_is_private_key (filter_info->filename, &is_encrypted))
return FALSE;
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
return require_encrypted ? is_encrypted : TRUE;
return TRUE;
}
static gboolean
default_filter_cert (const GtkFileFilterInfo *filter_info, gpointer user_data)
{
#ifdef LIBNM_GLIB_BUILD
const char *extensions[] = { ".der", ".pem", ".crt", ".cer", NULL };
#endif
if (!filter_info->filename)
return FALSE;
#if defined (LIBNM_GLIB_BUILD)
if (!file_has_extension (filter_info->filename, extensions))
return FALSE;
if (!file_is_der_or_pem (filter_info->filename, FALSE, NULL))
return FALSE;
#elif defined (LIBNM_BUILD)
if (!nm_utils_file_is_certificate (filter_info->filename))
return FALSE;
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
return TRUE;
}
@ -489,8 +448,22 @@ gboolean
eap_method_is_encrypted_private_key (const char *path)
{
GtkFileFilterInfo info = { .filename = path };
gboolean is_encrypted;
return default_filter_privkey (&info, (gpointer) TRUE);
if (!default_filter_privkey (&info, NULL))
return FALSE;
#if LIBNM_BUILD
is_encrypted = FALSE;
if (!nm_utils_file_is_private_key (path, &is_encrypted))
return FALSE;
#else
is_encrypted = TRUE;
if ( !file_is_der_or_pem (path, TRUE, &is_encrypted)
&& !nm_utils_file_is_pkcs12 (path))
return FALSE;
#endif
return is_encrypted;
}
/* Some methods (PEAP, TLS, TTLS) require a CA certificate. The user can choose

View file

@ -23,18 +23,6 @@
#ifndef EAP_METHOD_H
#define EAP_METHOD_H
#include <glib.h>
#include <gtk/gtk.h>
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#include <nm-setting-8021x.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _EAPMethod EAPMethod;
typedef void (*EMAddToSizeGroupFunc) (EAPMethod *method, GtkSizeGroup *group);
@ -141,4 +129,3 @@ void eap_method_ca_cert_ignore_save (NMConnection *connection);
void eap_method_ca_cert_ignore_load (NMConnection *connection);
#endif /* EAP_METHOD_H */

View file

@ -23,18 +23,6 @@
#ifndef _HELPERS_H_
#define _HELPERS_H_
#include <glib.h>
#include <gtk/gtk.h>
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#include <nm-setting.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef const char * (*HelperSecretFunc)(NMSetting *);
void helper_fill_secret_entry (NMConnection *connection,

View file

@ -1,158 +1,3 @@
diff --git a/panels/network/wireless-security/eap-method-fast.c b/panels/network/wireless-security/eap-method-fast.c
index 69b8a86..be5578d 100644
--- a/panels/network/wireless-security/eap-method-fast.c
+++ b/panels/network/wireless-security/eap-method-fast.c
@@ -351,7 +351,7 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
- UIDIR "/eap-method-fast.ui",
+ "/org/gnome/control-center/network/eap-method-fast.ui",
"eap_fast_notebook",
"eap_fast_anon_identity_entry",
FALSE);
diff --git a/panels/network/wireless-security/eap-method-leap.c b/panels/network/wireless-security/eap-method-leap.c
index 5fbdd86..6163468 100644
--- a/panels/network/wireless-security/eap-method-leap.c
+++ b/panels/network/wireless-security/eap-method-leap.c
@@ -204,7 +204,7 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
- UIDIR "/eap-method-leap.ui",
+ "/org/gnome/control-center/network/eap-method-leap.ui",
"eap_leap_notebook",
"eap_leap_username_entry",
FALSE);
diff --git a/panels/network/wireless-security/eap-method-peap.c b/panels/network/wireless-security/eap-method-peap.c
index 6462ef2..7f87541 100644
--- a/panels/network/wireless-security/eap-method-peap.c
+++ b/panels/network/wireless-security/eap-method-peap.c
@@ -349,7 +349,7 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
- UIDIR "/eap-method-peap.ui",
+ "/org/gnome/control-center/network/eap-method-peap.ui",
"eap_peap_notebook",
"eap_peap_anon_identity_entry",
FALSE);
diff --git a/panels/network/wireless-security/eap-method-simple.c b/panels/network/wireless-security/eap-method-simple.c
index 0f72029..f9fd473 100644
--- a/panels/network/wireless-security/eap-method-simple.c
+++ b/panels/network/wireless-security/eap-method-simple.c
@@ -307,7 +307,7 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
- UIDIR "/eap-method-simple.ui",
+ "/org/gnome/control-center/network/eap-method-simple.ui",
"eap_simple_notebook",
"eap_simple_username_entry",
flags & EAP_METHOD_SIMPLE_FLAG_PHASE2);
diff --git a/panels/network/wireless-security/eap-method-tls.c b/panels/network/wireless-security/eap-method-tls.c
index 8f33d83..587c399 100644
--- a/panels/network/wireless-security/eap-method-tls.c
+++ b/panels/network/wireless-security/eap-method-tls.c
@@ -453,7 +453,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
NULL,
- UIDIR "/eap-method-tls.ui",
+ "/org/gnome/control-center/network/eap-method-tls.ui",
"eap_tls_notebook",
"eap_tls_identity_entry",
phase2);
diff --git a/panels/network/wireless-security/eap-method-ttls.c b/panels/network/wireless-security/eap-method-ttls.c
index 789f0fa..ef02529 100644
--- a/panels/network/wireless-security/eap-method-ttls.c
+++ b/panels/network/wireless-security/eap-method-ttls.c
@@ -380,7 +380,7 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
fill_connection,
update_secrets,
destroy,
- UIDIR "/eap-method-ttls.ui",
+ "/org/gnome/control-center/network/eap-method-ttls.ui",
"eap_ttls_notebook",
"eap_ttls_anon_identity_entry",
FALSE);
diff --git a/panels/network/wireless-security/eap-method.c b/panels/network/wireless-security/eap-method.c
index 90efea1..6ec4849 100644
--- a/panels/network/wireless-security/eap-method.c
+++ b/panels/network/wireless-security/eap-method.c
@@ -34,7 +34,19 @@
#include "utils.h"
#include "helpers.h"
-G_DEFINE_BOXED_TYPE (EAPMethod, eap_method, eap_method_ref, eap_method_unref)
+GType
+eap_method_get_type (void)
+{
+ static GType type_id = 0;
+
+ if (!type_id) {
+ type_id = g_boxed_type_register_static ("CcEAPMethod",
+ (GBoxedCopyFunc) eap_method_ref,
+ (GBoxedFreeFunc) eap_method_unref);
+ }
+
+ return type_id;
+}
GtkWidget *
eap_method_get_widget (EAPMethod *method)
@@ -129,7 +141,7 @@ eap_method_init (gsize obj_size,
EMFillConnectionFunc fill_connection,
EMUpdateSecretsFunc update_secrets,
EMDestroyFunc destroy,
- const char *ui_file,
+ const char *ui_resource,
const char *ui_widget_name,
const char *default_field,
gboolean phase2)
@@ -138,7 +150,7 @@ eap_method_init (gsize obj_size,
GError *error = NULL;
g_return_val_if_fail (obj_size > 0, NULL);
- g_return_val_if_fail (ui_file != NULL, NULL);
+ g_return_val_if_fail (ui_resource != NULL, NULL);
g_return_val_if_fail (ui_widget_name != NULL, NULL);
method = g_slice_alloc0 (obj_size);
@@ -154,9 +166,9 @@ eap_method_init (gsize obj_size,
method->phase2 = phase2;
method->builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (method->builder, ui_file, &error)) {
+ if (!gtk_builder_add_from_resource (method->builder, ui_resource, &error)) {
g_warning ("Couldn't load UI builder file %s: %s",
- ui_file, error->message);
+ ui_resource, error->message);
eap_method_unref (method);
return NULL;
}
@@ -164,7 +176,7 @@ eap_method_init (gsize obj_size,
method->ui_widget = GTK_WIDGET (gtk_builder_get_object (method->builder, ui_widget_name));
if (!method->ui_widget) {
g_warning ("Couldn't load UI widget '%s' from UI file %s",
- ui_widget_name, ui_file);
+ ui_widget_name, ui_resource);
eap_method_unref (method);
return NULL;
}
diff --git a/panels/network/wireless-security/eap-method.h b/panels/network/wireless-security/eap-method.h
index 84c1c78..de287e3 100644
--- a/panels/network/wireless-security/eap-method.h
+++ b/panels/network/wireless-security/eap-method.h
@@ -99,7 +99,7 @@ EAPMethod *eap_method_init (gsize obj_size,
EMFillConnectionFunc fill_connection,
EMUpdateSecretsFunc update_secrets,
EMDestroyFunc destroy,
- const char *ui_file,
+ const char *ui_resource,
const char *ui_widget_name,
const char *default_field,
gboolean phase2);
diff --git a/panels/network/wireless-security/wireless-security.c b/panels/network/wireless-security/wireless-security.c
index 23b8a27..bd233b0 100644
--- a/panels/network/wireless-security/wireless-security.c
@ -174,7 +19,7 @@ index 23b8a27..bd233b0 100644
+ if (!type_id) {
+ g_resources_register (wireless_security_get_resource ());
+
+ type_id = g_boxed_type_register_static ("CcWirelessSecurity",
+ type_id = g_boxed_type_register_static ("WirelessSecurity",
+ (GBoxedCopyFunc) wireless_security_ref,
+ (GBoxedFreeFunc) wireless_security_unref);
+ }
@ -184,129 +29,16 @@ index 23b8a27..bd233b0 100644
GtkWidget *
wireless_security_get_widget (WirelessSecurity *sec)
@@ -146,7 +161,7 @@ wireless_security_init (gsize obj_size,
WSFillConnectionFunc fill_connection,
WSUpdateSecretsFunc update_secrets,
WSDestroyFunc destroy,
- const char *ui_file,
+ const char *ui_resource,
const char *ui_widget_name,
const char *default_field)
{
@@ -154,7 +169,7 @@ wireless_security_init (gsize obj_size,
GError *error = NULL;
g_return_val_if_fail (obj_size > 0, NULL);
- g_return_val_if_fail (ui_file != NULL, NULL);
+ g_return_val_if_fail (ui_resource != NULL, NULL);
g_return_val_if_fail (ui_widget_name != NULL, NULL);
sec = g_slice_alloc0 (obj_size);
@@ -170,9 +185,9 @@ wireless_security_init (gsize obj_size,
sec->default_field = default_field;
sec->builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (sec->builder, ui_file, &error)) {
+ if (!gtk_builder_add_from_resource (sec->builder, ui_resource, &error)) {
g_warning ("Couldn't load UI builder file %s: %s",
- ui_file, error->message);
+ ui_resource, error->message);
g_error_free (error);
wireless_security_unref (sec);
return NULL;
@@ -181,7 +196,7 @@ wireless_security_init (gsize obj_size,
sec->ui_widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, ui_widget_name));
if (!sec->ui_widget) {
g_warning ("Couldn't load UI widget '%s' from UI file %s",
- ui_widget_name, ui_file);
+ ui_widget_name, ui_resource);
wireless_security_unref (sec);
return NULL;
}
diff --git a/panels/network/wireless-security/wireless-security.h b/panels/network/wireless-security/wireless-security.h
index e9bcf63..3d56fa3 100644
index cb6553be5..4de618e16 100644
--- a/panels/network/wireless-security/wireless-security.h
+++ b/panels/network/wireless-security/wireless-security.h
@@ -23,6 +23,8 @@
#ifndef WIRELESS_SECURITY_H
#define WIRELESS_SECURITY_H
+#define LIBNM_GLIB_BUILD
+#include <gtk/gtk.h>
+
#include <glib.h>
#include <gtk/gtk.h>
typedef struct _WirelessSecurity WirelessSecurity;
@@ -118,7 +120,7 @@ WirelessSecurity *wireless_security_init (gsize obj_size,
WSFillConnectionFunc fill_connection,
WSUpdateSecretsFunc update_secrets,
WSDestroyFunc destroy,
- const char *ui_file,
+ const char *ui_resource,
const char *ui_widget_name,
const char *default_field);
diff --git a/panels/network/wireless-security/ws-dynamic-wep.c b/panels/network/wireless-security/ws-dynamic-wep.c
index db55119..0192d24 100644
--- a/panels/network/wireless-security/ws-dynamic-wep.c
+++ b/panels/network/wireless-security/ws-dynamic-wep.c
@@ -109,7 +109,7 @@ ws_dynamic_wep_new (NMConnection *connection,
fill_connection,
update_secrets,
destroy,
- UIDIR "/ws-dynamic-wep.ui",
+ "/org/gnome/control-center/network/ws-dynamic-wep.ui",
"dynamic_wep_notebook",
NULL);
if (!parent)
diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c
index 2b8b615..3a0f60c 100644
--- a/panels/network/wireless-security/ws-leap.c
+++ b/panels/network/wireless-security/ws-leap.c
@@ -155,7 +155,7 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
fill_connection,
update_secrets,
NULL,
- UIDIR "/ws-leap.ui",
+ "/org/gnome/control-center/network/ws-leap.ui",
"leap_notebook",
"leap_username_entry");
if (!parent)
diff --git a/panels/network/wireless-security/ws-wep-key.c b/panels/network/wireless-security/ws-wep-key.c
index 045ac4b..cd7dbac 100644
--- a/panels/network/wireless-security/ws-wep-key.c
+++ b/panels/network/wireless-security/ws-wep-key.c
@@ -264,7 +264,7 @@ ws_wep_key_new (NMConnection *connection,
fill_connection,
update_secrets,
destroy,
- UIDIR "/ws-wep-key.ui",
+ "/org/gnome/control-center/network/ws-wep-key.ui",
"wep_key_notebook",
"wep_key_entry");
if (!parent)
diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c
index d83218d..7db42df 100644
--- a/panels/network/wireless-security/ws-wpa-eap.c
+++ b/panels/network/wireless-security/ws-wpa-eap.c
@@ -110,7 +110,7 @@ ws_wpa_eap_new (NMConnection *connection,
fill_connection,
update_secrets,
destroy,
- UIDIR "/ws-wpa-eap.ui",
+ "/org/gnome/control-center/network/ws-wpa-eap.ui",
"wpa_eap_notebook",
NULL);
if (!parent)
diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c
index e56f348..4be28f2 100644
--- a/panels/network/wireless-security/ws-wpa-psk.c
+++ b/panels/network/wireless-security/ws-wpa-psk.c
@@ -182,7 +182,7 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
fill_connection,
update_secrets,
NULL,
- UIDIR "/ws-wpa-psk.ui",
+ "/org/gnome/control-center/network/ws-wpa-psk.ui",
"wpa_psk_notebook",
"wpa_psk_entry");
if (!parent)
typedef void (*WSChangedFunc) (WirelessSecurity *sec, gpointer user_data);

View file

@ -38,6 +38,21 @@
#include <gtk/gtk.h>
#include <libnm/nm-connection.h>
#include <libnm/nm-setting-wireless-security.h>
#include <libnm/nm-setting-8021x.h>
static inline gboolean
nm_clear_g_source (guint *id)
{
if (id && *id) {
g_source_remove (*id);
*id = 0;
return TRUE;
}
return FALSE;
}
/*****************************************************************************/
#include <glib/gi18n.h>

View file

@ -37,7 +37,7 @@ wireless_security_get_type (void)
if (!type_id) {
g_resources_register (wireless_security_get_resource ());
type_id = g_boxed_type_register_static ("CcWirelessSecurity",
type_id = g_boxed_type_register_static ("WirelessSecurity",
(GBoxedCopyFunc) wireless_security_ref,
(GBoxedFreeFunc) wireless_security_unref);
}
@ -84,7 +84,7 @@ wireless_security_validate (WirelessSecurity *sec, GError **error)
g_assert (sec->validate);
result = (*(sec->validate)) (sec, error);
if (!result && error && !*error)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Unknown error validating 802.1x security"));
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Unknown error validating 802.1X security"));
return result;
}
@ -186,7 +186,7 @@ wireless_security_init (gsize obj_size,
sec->builder = gtk_builder_new ();
if (!gtk_builder_add_from_resource (sec->builder, ui_resource, &error)) {
g_warning ("Couldn't load UI builder file %s: %s",
g_warning ("Couldn't load UI builder resource %s: %s",
ui_resource, error->message);
g_error_free (error);
wireless_security_unref (sec);

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/network">
<gresource prefix="/org/freedesktop/network-manager-applet/">
<file preprocess="xml-stripblanks">eap-method-leap.ui</file>
<file preprocess="xml-stripblanks">eap-method-fast.ui</file>
<file preprocess="xml-stripblanks">eap-method-peap.ui</file>

View file

@ -23,19 +23,8 @@
#ifndef WIRELESS_SECURITY_H
#define WIRELESS_SECURITY_H
#define LIBNM_GLIB_BUILD
#include <glib.h>
#include <gtk/gtk.h>
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _WirelessSecurity WirelessSecurity;
typedef void (*WSChangedFunc) (WirelessSecurity *sec, gpointer user_data);

View file

@ -109,7 +109,7 @@ ws_dynamic_wep_new (NMConnection *connection,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/ws-dynamic-wep.ui",
"/org/freedesktop/network-manager-applet/ws-dynamic-wep.ui",
"dynamic_wep_notebook",
NULL);
if (!parent)

View file

@ -23,14 +23,6 @@
#ifndef WS_DYNAMIC_WEP_H
#define WS_DYNAMIC_WEP_H
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _WirelessSecurityDynamicWEP WirelessSecurityDynamicWEP;
WirelessSecurityDynamicWEP *ws_dynamic_wep_new (NMConnection *connection,
@ -38,4 +30,3 @@ WirelessSecurityDynamicWEP *ws_dynamic_wep_new (NMConnection *connection,
gboolean secrets_only);
#endif /* WS_DYNAMIC_WEP_H */

View file

@ -154,7 +154,7 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
fill_connection,
update_secrets,
NULL,
"/org/gnome/control-center/network/ws-leap.ui",
"/org/freedesktop/network-manager-applet/ws-leap.ui",
"leap_notebook",
"leap_username_entry");
if (!parent)

View file

@ -23,17 +23,8 @@
#ifndef WS_LEAP_H
#define WS_LEAP_H
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _WirelessSecurityLEAP WirelessSecurityLEAP;
WirelessSecurityLEAP * ws_leap_new (NMConnection *connection, gboolean secrets_only);
#endif /* WS_LEAP_H */

View file

@ -264,7 +264,7 @@ ws_wep_key_new (NMConnection *connection,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/ws-wep-key.ui",
"/org/freedesktop/network-manager-applet/ws-wep-key.ui",
"wep_key_notebook",
"wep_key_entry");
if (!parent)

View file

@ -23,14 +23,6 @@
#ifndef WS_WEP_KEY_H
#define WS_WEP_KEY_H
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-setting-wireless-security.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _WirelessSecurityWEPKey WirelessSecurityWEPKey;
WirelessSecurityWEPKey *ws_wep_key_new (NMConnection *connection,
@ -39,4 +31,3 @@ WirelessSecurityWEPKey *ws_wep_key_new (NMConnection *connection,
gboolean secrets_only);
#endif /* WS_WEP_KEY_H */

View file

@ -110,7 +110,7 @@ ws_wpa_eap_new (NMConnection *connection,
fill_connection,
update_secrets,
destroy,
"/org/gnome/control-center/network/ws-wpa-eap.ui",
"/org/freedesktop/network-manager-applet/ws-wpa-eap.ui",
"wpa_eap_notebook",
NULL);
if (!parent)

View file

@ -23,14 +23,6 @@
#ifndef WS_WPA_EAP_H
#define WS_WPA_EAP_H
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _WirelessSecurityWPAEAP WirelessSecurityWPAEAP;
WirelessSecurityWPAEAP * ws_wpa_eap_new (NMConnection *connection,
@ -38,4 +30,3 @@ WirelessSecurityWPAEAP * ws_wpa_eap_new (NMConnection *connection,
gboolean secrets_only);
#endif /* WS_WPA_EAP_H */

View file

@ -182,7 +182,7 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
fill_connection,
update_secrets,
NULL,
"/org/gnome/control-center/network/ws-wpa-psk.ui",
"/org/freedesktop/network-manager-applet/ws-wpa-psk.ui",
"wpa_psk_notebook",
"wpa_psk_entry");
if (!parent)

View file

@ -23,17 +23,8 @@
#ifndef WS_WPA_PSK_H
#define WS_WPA_PSK_H
#if defined (LIBNM_BUILD)
#include <NetworkManager.h>
#elif defined (LIBNM_GLIB_BUILD)
#include <nm-connection.h>
#else
#error neither LIBNM_BUILD nor LIBNM_GLIB_BUILD defined
#endif
typedef struct _WirelessSecurityWPAPSK WirelessSecurityWPAPSK;
WirelessSecurityWPAPSK * ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only);
#endif /* WS_WEP_KEY_H */