[network-manager-applet] applet: remove usage of GNOME keyring from utils bits



commit 32b610d5ee0c4c86b7d18aeca2b24572bfafd27b
Author: Dan Williams <dcbw redhat com>
Date:   Wed Aug 8 11:35:29 2012 -0500

    applet: remove usage of GNOME keyring from utils bits
    
    The only user of this code was src/applet-agent.c; the control center
    doesn't use it and the GConf compat code has it's own version.

 src/applet-agent.c      |   50 +++++++++++++++++++++++++++++++++++++++++++---
 src/applet-device-gsm.c |    1 +
 src/utils/Makefile.am   |    3 +-
 src/utils/utils.c       |   43 ----------------------------------------
 src/utils/utils.h       |   12 -----------
 5 files changed, 48 insertions(+), 61 deletions(-)
---
diff --git a/src/applet-agent.c b/src/applet-agent.c
index 8952683..ae7e680 100644
--- a/src/applet-agent.c
+++ b/src/applet-agent.c
@@ -39,6 +39,10 @@
 #include "utils.h"
 #include "nma-marshal.h"
 
+#define KEYRING_UUID_TAG "connection-uuid"
+#define KEYRING_SN_TAG "setting-name"
+#define KEYRING_SK_TAG "setting-key"
+
 G_DEFINE_TYPE (AppletAgent, applet_agent, NM_TYPE_SECRET_AGENT);
 
 #define APPLET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APPLET_TYPE_AGENT, AppletAgentPrivate))
@@ -587,6 +591,44 @@ save_secret_cb (GnomeKeyringResult result, guint val, gpointer user_data)
 	save_request_try_complete (call->r, call);
 }
 
+static GnomeKeyringAttributeList *
+_create_keyring_add_attr_list (NMConnection *connection,
+                               const char *setting_name,
+                               const char *setting_key,
+                               char **out_display_name)
+{
+	GnomeKeyringAttributeList *attrs = NULL;
+	const char *connection_id, *connection_uuid;
+
+	g_return_val_if_fail (connection != NULL, NULL);
+	g_return_val_if_fail (setting_name != NULL, NULL);
+	g_return_val_if_fail (setting_key != NULL, NULL);
+
+	connection_uuid = nm_connection_get_uuid (connection);
+	g_assert (connection_uuid);
+	connection_id = nm_connection_get_id (connection);
+	g_assert (connection_id);
+
+	if (out_display_name) {
+		*out_display_name = g_strdup_printf ("Network secret for %s/%s/%s",
+		                                     connection_id,
+		                                     setting_name,
+		                                     setting_key);
+	}
+
+	attrs = gnome_keyring_attribute_list_new ();
+	gnome_keyring_attribute_list_append_string (attrs,
+	                                            KEYRING_UUID_TAG,
+	                                            connection_uuid);
+	gnome_keyring_attribute_list_append_string (attrs,
+	                                            KEYRING_SN_TAG,
+	                                            setting_name);
+	gnome_keyring_attribute_list_append_string (attrs,
+	                                            KEYRING_SK_TAG,
+	                                            setting_key);
+	return attrs;
+}
+
 static void
 save_one_secret (Request *r,
                  NMSetting *setting,
@@ -609,10 +651,10 @@ save_one_secret (Request *r,
 	setting_name = nm_setting_get_name (setting);
 	g_assert (setting_name);
 
-	attrs = utils_create_keyring_add_attr_list (r->connection, NULL, NULL,
-	                                            setting_name,
-	                                            key,
-	                                            display_name ? NULL : &alt_display_name);
+	attrs = _create_keyring_add_attr_list (r->connection,
+	                                       setting_name,
+	                                       key,
+	                                       display_name ? NULL : &alt_display_name);
 	g_assert (attrs);
 	call = keyring_call_new (r);
 	call->keyring_id = gnome_keyring_item_create (NULL,
diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
index d0da7e4..e9cd1c1 100644
--- a/src/applet-device-gsm.c
+++ b/src/applet-device-gsm.c
@@ -37,6 +37,7 @@
 #include <nm-device-modem.h>
 #include <nm-utils.h>
 #include <nm-secret-agent.h>
+#include <gnome-keyring.h>
 
 #include "applet.h"
 #include "applet-device-gsm.h"
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 060a2d8..1c7d31a 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -11,9 +11,8 @@ libutils_la_SOURCES = \
 libutils_la_CPPFLAGS = \
 	$(GTK_CFLAGS) \
 	$(NMA_CFLAGS) \
-	$(GNOME_KEYRING_CFLAGS) \
 	-DDATADIR=\""$(datadir)"\" \
 	$(DISABLE_DEPRECATED) \
 	-I${top_srcdir}/src
 
-libutils_la_LIBADD = $(GTK_LIBS) $(NMA_LIBS) $(GNOME_KEYRING_LIBS)
+libutils_la_LIBADD = $(GTK_LIBS) $(NMA_LIBS)
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 7ad0a3b..2560b2e 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -312,49 +312,6 @@ utils_escape_notify_message (const char *src)
 	return g_string_free (escaped, FALSE);
 }
 
-GnomeKeyringAttributeList *
-utils_create_keyring_add_attr_list (NMConnection *connection,
-                                    const char *connection_uuid,
-                                    const char *connection_id,
-                                    const char *setting_name,
-                                    const char *setting_key,
-                                    char **out_display_name)
-{
-	GnomeKeyringAttributeList *attrs = NULL;
-	NMSettingConnection *s_con;
-
-	if (connection) {
-		s_con = nm_connection_get_setting_connection (connection);
-		g_return_val_if_fail (s_con != NULL, NULL);
-		connection_uuid = nm_setting_connection_get_uuid (s_con);
-		connection_id = nm_setting_connection_get_id (s_con);
-	}
-
-	g_return_val_if_fail (connection_uuid != NULL, NULL);
-	g_return_val_if_fail (connection_id != NULL, NULL);
-	g_return_val_if_fail (setting_name != NULL, NULL);
-	g_return_val_if_fail (setting_key != NULL, NULL);
-
-	if (out_display_name) {
-		*out_display_name = g_strdup_printf ("Network secret for %s/%s/%s",
-		                                     connection_id,
-		                                     setting_name,
-		                                     setting_key);
-	}
-
-	attrs = gnome_keyring_attribute_list_new ();
-	gnome_keyring_attribute_list_append_string (attrs,
-	                                            KEYRING_UUID_TAG,
-	                                            connection_uuid);
-	gnome_keyring_attribute_list_append_string (attrs,
-	                                            KEYRING_SN_TAG,
-	                                            setting_name);
-	gnome_keyring_attribute_list_append_string (attrs,
-	                                            KEYRING_SK_TAG,
-	                                            setting_key);
-	return attrs;
-}
-
 void
 utils_show_error_dialog (const char *title,
                          const char *text1,
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 383d14f..8d56293 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -29,7 +29,6 @@
 #include <nm-device.h>
 #include <net/ethernet.h>
 #include <nm-access-point.h>
-#include <gnome-keyring.h>
 
 const char *utils_get_device_description (NMDevice *device);
 
@@ -47,17 +46,6 @@ char *utils_hash_ap (const GByteArray *ssid,
 
 char *utils_escape_notify_message (const char *src);
 
-#define KEYRING_UUID_TAG "connection-uuid"
-#define KEYRING_SN_TAG "setting-name"
-#define KEYRING_SK_TAG "setting-key"
-
-GnomeKeyringAttributeList *utils_create_keyring_add_attr_list (NMConnection *connection,
-                                                               const char *connection_uuid,
-                                                               const char *connection_id,
-                                                               const char *setting_name,
-                                                               const char *setting_key,
-                                                               char **out_display_name);
-
 void utils_show_error_dialog (const char *title,
                               const char *text1,
                               const char *text2,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]