network-manager-applet r1253 - in branches/NETWORKMANAGER_APPLET_0_7: . src/connection-editor src/wireless-security
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r1253 - in branches/NETWORKMANAGER_APPLET_0_7: . src/connection-editor src/wireless-security
- Date: Sat, 4 Apr 2009 15:33:22 +0000 (UTC)
Author: dcbw
Date: Sat Apr 4 15:33:22 2009
New Revision: 1253
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1253&view=rev
Log:
Merge system connection editing fixes from trunk
Added:
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/helpers.c
- copied unchanged from r1252, /trunk/src/wireless-security/helpers.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/helpers.h
- copied unchanged from r1252, /trunk/src/wireless-security/helpers.h
Modified:
branches/NETWORKMANAGER_APPLET_0_7/ChangeLog
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/ce-page.c
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.c
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.h
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wired-security.c
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wireless-security.c
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/polkit-helpers.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/Makefile.am
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-leap.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-simple.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-tls.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-leap.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wep-key.c
branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wpa-psk.c
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/ce-page.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/ce-page.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/ce-page.c Sat Apr 4 15:33:22 2009
@@ -210,17 +210,17 @@
get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
CEPage *self = user_data;
+ GError *pk_error = NULL;
GError *error = NULL;
GHashTable *settings = NULL, *setting_hash;
gboolean do_signal = TRUE;
- if (!dbus_g_proxy_end_call (proxy, call, &error,
+ if (!dbus_g_proxy_end_call (proxy, call, &pk_error,
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
G_TYPE_INVALID)) {
- if (pk_helper_is_permission_denied_error (error)) {
+ if (pk_helper_is_permission_denied_error (pk_error)) {
/* If permission was denied, try to authenticate */
- g_clear_error (&error);
- if (pk_helper_obtain_auth (error, self->parent_window, try_secrets_again, self, &error))
+ if (pk_helper_obtain_auth (pk_error, self->parent_window, try_secrets_again, self, &error))
do_signal = FALSE; /* 'secrets' signal will happen after auth result */
}
} else {
@@ -242,6 +242,7 @@
if (do_signal)
emit_initialized (self, error);
+ g_clear_error (&error);
}
static gboolean
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.c Sat Apr 4 15:33:22 2009
@@ -146,6 +146,9 @@
gboolean valid = FALSE;
GSList *iter;
+ if (!editor->initialized)
+ goto done;
+
if (!ui_to_setting (editor))
goto done;
@@ -197,7 +200,8 @@
if (nm_setting_connection_get_read_only (s_con))
gtk_widget_set_sensitive (editor->ok_button, FALSE);
- connection_editor_validate (editor);
+ if (editor->initialized)
+ connection_editor_validate (editor);
}
static void
@@ -504,6 +508,8 @@
populate_connection_ui (editor);
update_sensitivity (editor, POLKIT_RESULT_UNKNOWN);
+ editor->initialized = TRUE;
+
/* Validate the connection from an idle handler to ensure that stuff like
* GtkFileChoosers have had a chance to asynchronously find their files.
*/
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.h
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.h (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-editor.h Sat Apr 4 15:33:22 2009
@@ -43,6 +43,7 @@
/* private data */
NMConnection *connection;
+ gboolean initialized;
NMConnectionScope orig_scope;
PolKitAction *system_action;
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c Sat Apr 4 15:33:22 2009
@@ -1404,7 +1404,7 @@
ActionInfo *info = user_data;
if (GTK_WIDGET_SENSITIVE (info->button))
- do_edit ((ActionInfo *) user_data);
+ gtk_button_clicked (GTK_BUTTON (info->button));
}
static void
@@ -1944,7 +1944,7 @@
g_signal_connect (G_OBJECT (list->dialog), "response", G_CALLBACK (dialog_response_cb), list);
if (!vpn_get_plugins (&error)) {
- g_message ("%s: failed to load VPN plugins: %s", __func__, error->message);
+ g_warning ("%s: failed to load VPN plugins: %s", __func__, error->message);
g_error_free (error);
}
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wired-security.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wired-security.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wired-security.c Sat Apr 4 15:33:22 2009
@@ -87,7 +87,7 @@
priv->security_widget = wireless_security_get_widget (priv->security);
gtk_toggle_button_set_active (priv->enabled, priv->initial_have_8021x);
- g_signal_connect_swapped (priv->enabled, "toggled", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect (priv->enabled, "toggled", G_CALLBACK (enable_toggled), self);
gtk_widget_set_sensitive (priv->security_widget, priv->initial_have_8021x);
gtk_box_pack_start (GTK_BOX (parent->page), GTK_WIDGET (priv->enabled), FALSE, TRUE, 12);
@@ -118,8 +118,6 @@
priv->initial_have_8021x = TRUE;
priv->enabled = GTK_TOGGLE_BUTTON (gtk_check_button_new_with_label (_("Use 802.1X security for this connection")));
- g_signal_connect (priv->enabled, "toggled",
- G_CALLBACK (enable_toggled), self);
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
if (!ce_page_initialize (parent, NM_SETTING_802_1X_SETTING_NAME, error)) {
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wireless-security.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wireless-security.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/page-wireless-security.c Sat Apr 4 15:33:22 2009
@@ -377,8 +377,6 @@
self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
-
s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection,
NM_TYPE_SETTING_WIRELESS_SECURITY));
@@ -403,6 +401,7 @@
setting_name = NM_SETTING_802_1X_SETTING_NAME;
}
+ g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
if (!ce_page_initialize (parent, setting_name, error)) {
g_object_unref (self);
return NULL;
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/polkit-helpers.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/polkit-helpers.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/polkit-helpers.c Sat Apr 4 15:33:22 2009
@@ -48,9 +48,14 @@
gboolean success = FALSE;
guint xid = 0;
+ if (!pk_error) {
+ g_set_error (error, 0, 0, "%s", _("PolicyKit authorization request was invalid."));
+ return FALSE;
+ }
+
tokens = g_strsplit (pk_error->message, " ", 2);
if (g_strv_length (tokens) != 2) {
- g_set_error (error, 0, 0, "%s", _("PolicyKit authorization was malformed."));
+ g_set_error (error, 0, 0, "%s", _("PolicyKit authorization request was malformed."));
goto out;
}
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/Makefile.am
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/Makefile.am (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/Makefile.am Sat Apr 4 15:33:22 2009
@@ -26,7 +26,9 @@
eap-method-peap.h \
eap-method-peap.c \
eap-method-simple.h \
- eap-method-simple.c
+ eap-method-simple.c \
+ helpers.h \
+ helpers.c
libwireless_security_la_CPPFLAGS = \
$(NMA_CFLAGS) \
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-leap.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-leap.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-leap.c Sat Apr 4 15:33:22 2009
@@ -27,6 +27,7 @@
#include "eap-method.h"
#include "wireless-security.h"
#include "gconf-helpers.h"
+#include "helpers.h"
static void
show_toggled_cb (GtkCheckButton *button, EAPMethod *method)
@@ -158,23 +159,15 @@
g_signal_connect (G_OBJECT (widget), "changed",
(GCallback) wireless_security_changed_cb,
parent);
+
/* Fill secrets, if any */
if (connection) {
- GHashTable *secrets;
- GError *error = NULL;
- GValue *value;
-
- secrets = nm_gconf_get_keyring_items (connection,
- NM_SETTING_802_1X_SETTING_NAME,
- TRUE,
- &error);
- if (secrets) {
- value = g_hash_table_lookup (secrets, NM_SETTING_802_1X_PASSWORD);
- if (value)
- gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value));
- g_hash_table_destroy (secrets);
- } else if (error)
- g_error_free (error);
+ helper_fill_secret_entry (connection,
+ GTK_ENTRY (widget),
+ NM_TYPE_SETTING_802_1X,
+ (HelperSecretFunc) nm_setting_802_1x_get_password,
+ NM_SETTING_802_1X_SETTING_NAME,
+ NM_SETTING_802_1X_PASSWORD);
}
widget = glade_xml_get_widget (xml, "show_checkbutton");
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-simple.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-simple.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-simple.c Sat Apr 4 15:33:22 2009
@@ -27,6 +27,7 @@
#include "eap-method.h"
#include "wireless-security.h"
#include "gconf-helpers.h"
+#include "helpers.h"
static void
show_toggled_cb (GtkCheckButton *button, EAPMethod *method)
@@ -181,23 +182,15 @@
g_signal_connect (G_OBJECT (widget), "changed",
(GCallback) wireless_security_changed_cb,
parent);
+
/* Fill secrets, if any */
if (connection) {
- GHashTable *secrets;
- GError *error = NULL;
- GValue *value;
-
- secrets = nm_gconf_get_keyring_items (connection,
- NM_SETTING_802_1X_SETTING_NAME,
- TRUE,
- &error);
- if (secrets) {
- value = g_hash_table_lookup (secrets, NM_SETTING_802_1X_PASSWORD);
- if (value)
- gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value));
- g_hash_table_destroy (secrets);
- } else if (error)
- g_error_free (error);
+ helper_fill_secret_entry (connection,
+ GTK_ENTRY (widget),
+ NM_TYPE_SETTING_802_1X,
+ (HelperSecretFunc) nm_setting_802_1x_get_password,
+ NM_SETTING_802_1X_SETTING_NAME,
+ NM_SETTING_802_1X_PASSWORD);
}
widget = glade_xml_get_widget (xml, "show_checkbutton");
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-tls.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-tls.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/eap-method-tls.c Sat Apr 4 15:33:22 2009
@@ -31,6 +31,7 @@
#include "eap-method.h"
#include "wireless-security.h"
#include "utils.h"
+#include "helpers.h"
static void
show_toggled_cb (GtkCheckButton *button, EAPMethod *method)
@@ -390,27 +391,20 @@
gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_identity (s_8021x));
widget = glade_xml_get_widget (xml, "eap_tls_private_key_password_entry");
+ g_assert (widget);
+
/* Fill secrets, if any */
if (connection) {
- GHashTable *secrets;
- GError *error = NULL;
- GValue *value;
- const char *pw_secret_name = phase2 ? NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD :
- NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD;
-
- secrets = nm_gconf_get_keyring_items (connection,
- NM_SETTING_802_1X_SETTING_NAME,
- TRUE,
- &error);
- if (secrets) {
- value = g_hash_table_lookup (secrets, pw_secret_name);
- if (value)
- gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value));
- g_hash_table_destroy (secrets);
- }
- g_clear_error (&error);
+ helper_fill_secret_entry (connection,
+ GTK_ENTRY (widget),
+ NM_TYPE_SETTING_802_1X,
+ phase2 ? (HelperSecretFunc) nm_setting_802_1x_get_phase2_private_key_password :
+ (HelperSecretFunc) nm_setting_802_1x_get_private_key_password,
+ NM_SETTING_802_1X_SETTING_NAME,
+ phase2 ? NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD :
+ NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
}
- g_assert (widget);
+
g_signal_connect (G_OBJECT (widget), "changed",
(GCallback) wireless_security_changed_cb,
parent);
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-leap.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-leap.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-leap.c Sat Apr 4 15:33:22 2009
@@ -26,6 +26,7 @@
#include "wireless-security.h"
#include "utils.h"
#include "gconf-helpers.h"
+#include "helpers.h"
static void
@@ -166,21 +167,12 @@
(GCallback) wireless_security_changed_cb,
sec);
if (wsec) {
- GHashTable *secrets;
- GError *error = NULL;
- GValue *value;
-
- secrets = nm_gconf_get_keyring_items (connection,
- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- FALSE,
- &error);
- if (secrets) {
- value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD);
- if (value)
- gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value));
- g_hash_table_destroy (secrets);
- } else if (error)
- g_error_free (error);
+ helper_fill_secret_entry (connection,
+ GTK_ENTRY (widget),
+ NM_TYPE_SETTING_WIRELESS_SECURITY,
+ (HelperSecretFunc) nm_setting_wireless_security_get_leap_password,
+ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD);
}
widget = glade_xml_get_widget (xml, "leap_username_entry");
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wep-key.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wep-key.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wep-key.c Sat Apr 4 15:33:22 2009
@@ -251,6 +251,57 @@
g_free (result);
}
+static void
+fill_secrets (WirelessSecurityWEPKey *sec, NMConnection *connection)
+{
+ NMSettingWirelessSecurity *s_wsec;
+ GHashTable *secrets;
+ GError *error = NULL;
+ GValue *value;
+ const char *tmp;
+ int i;
+
+ g_return_if_fail (sec != NULL);
+ g_return_if_fail (connection != NULL);
+
+ s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
+
+ if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM) {
+ for (i = 0; s_wsec && i < 4; i++) {
+ tmp = nm_setting_wireless_security_get_wep_key (s_wsec, i);
+ if (tmp)
+ strcpy (sec->keys[i], tmp);
+ }
+ } else {
+ secrets = nm_gconf_get_keyring_items (connection,
+ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ FALSE,
+ &error);
+ if (!secrets) {
+ g_clear_error (&error);
+ return;
+ }
+
+ value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
+ if (value)
+ strcpy (sec->keys[0], g_value_get_string (value));
+
+ value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY1);
+ if (value)
+ strcpy (sec->keys[1], g_value_get_string (value));
+
+ value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY2);
+ if (value)
+ strcpy (sec->keys[2], g_value_get_string (value));
+
+ value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY3);
+ if (value)
+ strcpy (sec->keys[3], g_value_get_string (value));
+
+ g_hash_table_destroy (secrets);
+ }
+}
+
WirelessSecurityWEPKey *
ws_wep_key_new (const char *glade_file,
NMConnection *connection,
@@ -296,42 +347,13 @@
widget = glade_xml_get_widget (xml, "wep_key_entry");
g_assert (widget);
- /* Fill secrets, if any */
- if (connection) {
- GHashTable *secrets;
- GError *error = NULL;
- GValue *value;
-
- secrets = nm_gconf_get_keyring_items (connection,
- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- FALSE,
- &error);
- if (secrets) {
- value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
- if (value)
- strcpy (sec->keys[0], g_value_get_string (value));
-
- value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY1);
- if (value)
- strcpy (sec->keys[1], g_value_get_string (value));
-
- value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY2);
- if (value)
- strcpy (sec->keys[2], g_value_get_string (value));
-
- value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY3);
- if (value)
- strcpy (sec->keys[3], g_value_get_string (value));
-
- g_hash_table_destroy (secrets);
- } else if (error)
- g_error_free (error);
- }
-
if (connection) {
NMSettingWireless *s_wireless;
const char *mode, *auth_alg;
+ /* Fill secrets, if any */
+ fill_secrets (sec, connection);
+
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
mode = s_wireless ? nm_setting_wireless_get_mode (s_wireless) : NULL;
if (mode && !strcmp (mode, "adhoc"))
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wpa-psk.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wpa-psk.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/wireless-security/ws-wpa-psk.c Sat Apr 4 15:33:22 2009
@@ -28,6 +28,7 @@
#include "utils.h"
#include "sha1.h"
#include "gconf-helpers.h"
+#include "helpers.h"
#define WPA_PMK_LEN 32
@@ -200,21 +201,12 @@
/* Fill secrets, if any */
if (connection) {
- GHashTable *secrets;
- GError *error = NULL;
- GValue *value;
-
- secrets = nm_gconf_get_keyring_items (connection,
- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- FALSE,
- &error);
- if (secrets) {
- value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_PSK);
- if (value)
- gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value));
- g_hash_table_destroy (secrets);
- } else if (error)
- g_error_free (error);
+ helper_fill_secret_entry (connection,
+ GTK_ENTRY (widget),
+ NM_TYPE_SETTING_WIRELESS_SECURITY,
+ (HelperSecretFunc) nm_setting_wireless_security_get_psk,
+ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_PSK);
}
widget = glade_xml_get_widget (xml, "show_checkbutton");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]