From be590d9793bb98b3e5ec64c05ab914f6b2a6935e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 27 Jul 2004 20:25:35 +0000 Subject: [PATCH] 2004-07-27 Dan Williams * info-daemon/NetworkManagerInfo.c - Update allowed network's GConf key when user enters a WEP key explicitly * info-daemon/NetworkManagerDbus.c - Fix some comments - nmi_dbus_get_allowed_networks(): kill warning git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@26 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 9 +++++++++ info-daemon/NetworkManagerInfo.c | 16 ++++++++++++++++ info-daemon/NetworkManagerInfoDbus.c | 8 ++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d23f577bd7..beb3957359 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-07-27 Dan Williams + + * info-daemon/NetworkManagerInfo.c + - Update allowed network's GConf key when user enters a WEP key explicitly + + * info-daemon/NetworkManagerDbus.c + - Fix some comments + - nmi_dbus_get_allowed_networks(): kill warning + 2004-07-27 Dan Williams * initscript/Makefile.in diff --git a/info-daemon/NetworkManagerInfo.c b/info-daemon/NetworkManagerInfo.c index 48797cba22..43889911f8 100644 --- a/info-daemon/NetworkManagerInfo.c +++ b/info-daemon/NetworkManagerInfo.c @@ -90,8 +90,24 @@ static void ok_button_clicked (GtkWidget *ok_button, gpointer user_data) const char *passphrase = gtk_entry_get_text (GTK_ENTRY (entry)); const char *device = g_object_get_data (G_OBJECT (dialog), "device"); const char *network = g_object_get_data (G_OBJECT (dialog), "network"); + gchar *key = NULL; + GConfEntry *gconf_entry; + /* Tell NetworkManager about the key the user typed in */ nmi_dbus_return_user_key (info->connection, device, network, passphrase); + + /* Update GConf with the new user key */ + key = g_strdup_printf ("%s/%s", NMI_GCONF_ALLOWED_NETWORKS_PATH, network); + gconf_entry = gconf_client_get_entry (info->gconf_client, key, NULL, TRUE, NULL); + g_free (key); + if (gconf_entry) + { + gconf_entry_unref (gconf_entry); + key = g_strdup_printf ("%s/%s/key", NMI_GCONF_ALLOWED_NETWORKS_PATH, network); + gconf_client_set_string (info->gconf_client, key, passphrase, NULL); + g_free (key); + } + nmi_clear_dialog (dialog, entry); } } diff --git a/info-daemon/NetworkManagerInfoDbus.c b/info-daemon/NetworkManagerInfoDbus.c index 02c150cd20..65a1d22437 100644 --- a/info-daemon/NetworkManagerInfoDbus.c +++ b/info-daemon/NetworkManagerInfoDbus.c @@ -193,7 +193,7 @@ static DBusMessage *nmi_dbus_get_allowed_networks (NMIAppInfo *info, DBusMessage gchar key[100]; GConfValue *value; - g_snprintf (&key[0], 99, "%s/essid", element->data); + g_snprintf (&key[0], 99, "%s/essid", (char *)(element->data)); value = gconf_client_get (info->gconf_client, key, NULL); if (value && gconf_value_get_string (value)) { @@ -242,7 +242,7 @@ static DBusMessage *nmi_dbus_get_allowed_network_prio (NMIAppInfo *info, DBusMes return (reply_message); } - /* List all allowed access points that gconf knows about */ + /* Grab priority key for our access point from GConf */ key = g_strdup_printf ("%s/%s/priority", NMI_GCONF_ALLOWED_NETWORKS_PATH, network); value = gconf_client_get (info->gconf_client, key, NULL); g_free (key); @@ -290,7 +290,7 @@ static DBusMessage *nmi_dbus_get_allowed_network_essid (NMIAppInfo *info, DBusMe return (reply_message); } - /* List all allowed access points that gconf knows about */ + /* Grab essid key for our access point from GConf */ key = g_strdup_printf ("%s/%s/essid", NMI_GCONF_ALLOWED_NETWORKS_PATH, network); value = gconf_client_get (info->gconf_client, key, NULL); g_free (key); @@ -338,7 +338,7 @@ static DBusMessage *nmi_dbus_get_allowed_network_key (NMIAppInfo *info, DBusMess return (reply_message); } - /* List all allowed access points that gconf knows about */ + /* Grab user-key key for our access point from GConf */ key = g_strdup_printf ("%s/%s/key", NMI_GCONF_ALLOWED_NETWORKS_PATH, network); value = gconf_client_get (info->gconf_client, key, NULL); g_free (key);