[network-manager-applet/jk/password-icon-1-0: 2/18] utils: move *_password_storage() functions from utils to libnm-gtk



commit d9e4404842a5f0541aff8878027e14b62a78fdb4
Author: Jiří Klimeš <jklimes redhat com>
Date:   Tue Mar 31 15:39:56 2015 +0200

    utils: move *_password_storage() functions from utils to libnm-gtk
    
    Thus the functions can can really be used on other places, like VPN plugins.
    
    (Related commit 6439ee74ac432c35ca4b4edb0babf6a327eca65e.)

 src/libnm-gtk/nm-ui-utils.c               |  205 ++++++++++++++++++++++++++++-
 src/libnm-gtk/nm-ui-utils.h               |   17 ++-
 src/utils/utils.c                         |  186 +--------------------------
 src/utils/utils.h                         |   11 +--
 src/wireless-security/Makefile.am         |    3 +-
 src/wireless-security/eap-method-leap.c   |    6 +-
 src/wireless-security/eap-method-simple.c |    6 +-
 src/wireless-security/eap-method-tls.c    |    6 +-
 src/wireless-security/ws-leap.c           |    6 +-
 src/wireless-security/ws-wep-key.c        |    5 +-
 src/wireless-security/ws-wpa-psk.c        |    6 +-
 11 files changed, 241 insertions(+), 216 deletions(-)
---
diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c
index f9b4d4f..d3f9e43 100644
--- a/src/libnm-gtk/nm-ui-utils.c
+++ b/src/libnm-gtk/nm-ui-utils.c
@@ -15,7 +15,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2007 - 2012 Red Hat, Inc.
+ * Copyright 2007 - 2015 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -593,3 +593,206 @@ nma_utils_get_connection_device_name (NMConnection *connection)
 
        return g_strdup_printf ("%s (%s)", display_type, iface);
 }
+
+/*---------------------------------------------------------------------------*/
+/* Password storage icon */
+
+static void
+change_password_storage_icon (GtkWidget *passwd_entry, int number)
+{
+       char *icon_name = "document-save";
+
+       if (number == 1)
+               icon_name = "document-save";
+       else if (number == 2)
+               icon_name = "document-save-as";
+
+       gtk_entry_set_icon_from_icon_name (GTK_ENTRY (passwd_entry), GTK_ENTRY_ICON_SECONDARY, icon_name);
+}
+
+typedef struct {
+       NMConnection *connection;
+       const char *setting_name;
+       const char *password_flags_name;
+       int item_number;
+       GtkWidget *passwd_entry;
+} PopupMenuItemInfo;
+
+static void
+popup_menu_item_info_destroy (gpointer data)
+{
+       g_slice_free (PopupMenuItemInfo, data);
+}
+
+static void
+activate_menu_item_cb (GtkMenuItem *menuitem, gpointer user_data)
+{
+       PopupMenuItemInfo *info = (PopupMenuItemInfo *) user_data;
+       NMSetting *setting;
+       NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
+
+       /* Get current secret flags */
+       setting = nm_connection_get_setting_by_name (info->connection, info->setting_name);
+       if (setting)
+               nm_setting_get_secret_flags (setting, info->password_flags_name, &secret_flags, NULL);
+
+       /* Update password flags according to the password-storage popup menu */
+       if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem))) {
+               if (info->item_number == 1)
+                       secret_flags |= NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+               else
+                       secret_flags &= ~NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+
+               /* Update the secret flags */
+               if (setting)
+                       nm_setting_set_secret_flags (setting, info->password_flags_name, secret_flags, NULL);
+
+               /* Change icon */
+               change_password_storage_icon (info->passwd_entry, info->item_number);
+       }
+}
+
+static void
+icon_release_cb (GtkEntry *entry,
+                 GtkEntryIconPosition position,
+                 GdkEventButton *event,
+                 gpointer data)
+{
+       GtkMenu *menu = GTK_MENU (data);
+       if (position == GTK_ENTRY_ICON_SECONDARY) {
+               gtk_widget_show_all (GTK_WIDGET (data));
+               gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
+                               event->button, event->time);
+       }
+}
+
+#define PASSWORD_STORAGE_MENU_TAG "password-storage-menu"
+
+/**
+ * nma_utils_setup_password_storage:
+ * @connection: an #NMConnection
+ * @setting_name: name of the setting containing the password
+ * @passwd_entry: password #GtkEntry which the icon is attached to
+ * @password_flags_name: name of the storage flags for password
+ *   (like psk-flags)
+ *
+ * Adds a secondary icon and creates a popup menu for password entry.
+ */
+void
+nma_utils_setup_password_storage (NMConnection *connection,
+                                  const char *setting_name,
+                                  GtkWidget *passwd_entry,
+                                  const char *password_flags_name)
+{
+       GtkWidget *popup_menu;
+       GtkWidget *item1, *item2;
+       GSList *group;
+       PopupMenuItemInfo *info;
+       NMSetting *setting;
+
+       gtk_entry_set_icon_from_icon_name (GTK_ENTRY (passwd_entry), GTK_ENTRY_ICON_SECONDARY, 
"document-save");
+       popup_menu = gtk_menu_new ();
+       g_object_set_data (G_OBJECT (popup_menu), PASSWORD_STORAGE_MENU_TAG, GUINT_TO_POINTER (TRUE));
+       group = NULL;
+       item1 = gtk_radio_menu_item_new_with_mnemonic (group, _("Store the password only for this _user"));
+       group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item1));
+       item2 = gtk_radio_menu_item_new_with_mnemonic (group, _("Store the password for _all users"));
+
+       gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item1);
+       gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item2);
+
+       info = g_slice_new0 (PopupMenuItemInfo);
+       info->connection = connection;
+       info->setting_name = setting_name;
+       info->password_flags_name = password_flags_name;
+       info->item_number = 1;
+       info->passwd_entry = passwd_entry;
+       g_signal_connect_data (item1, "activate",
+                              G_CALLBACK (activate_menu_item_cb),
+                              info,
+                              (GClosureNotify) popup_menu_item_info_destroy, 0);
+
+       info = g_slice_new0 (PopupMenuItemInfo);
+       info->connection = connection;
+       info->setting_name = setting_name;
+       info->password_flags_name = password_flags_name;
+       info->item_number = 2;
+       info->passwd_entry = passwd_entry;
+       g_signal_connect_data (item2, "activate",
+                              G_CALLBACK (activate_menu_item_cb),
+                              info,
+                              (GClosureNotify) popup_menu_item_info_destroy, 0);
+
+       g_signal_connect (passwd_entry, "icon-release", G_CALLBACK (icon_release_cb), popup_menu);
+       gtk_menu_attach_to_widget (GTK_MENU (popup_menu), passwd_entry, NULL);
+
+       /* Initialize active item for password-storage popup menu */
+       setting = nm_connection_get_setting_by_name (connection, setting_name);
+       if (setting) {
+               NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
+               nm_setting_get_secret_flags (setting, password_flags_name, &secret_flags, NULL);
+
+               if (secret_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)
+                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item1), TRUE);
+               else {
+                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item2), TRUE);
+                       /* Use different icon for system-storage */
+                       change_password_storage_icon (passwd_entry, 2);
+               }
+       } else {
+               gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item1), TRUE);
+       }
+}
+
+/**
+ * nma_utils_update_password_storage:
+ * @setting: #NMSetting containing the password
+ * @secret_flags: secret flags to use
+ * @passwd_entry: #GtkEntry with the password
+ * @password_flags_name: name of the storage flags for password
+ *   (like psk-flags)
+ *
+ * Updates secret flags and the storage popup menu.
+ */
+void
+nma_utils_update_password_storage (NMSetting *setting,
+                                   NMSettingSecretFlags secret_flags,
+                                   GtkWidget *passwd_entry,
+                                   const char *password_flags_name)
+{
+       GList *menu_list, *iter;
+       GtkWidget *menu = NULL;
+
+       /* Update secret flags (WEP_KEY_FLAGS, PSK_FLAGS, ...) in the security setting */
+       nm_setting_set_secret_flags (setting, password_flags_name, secret_flags, NULL);
+
+       menu_list = gtk_menu_get_for_attach_widget (passwd_entry);
+       for (iter = menu_list; iter; iter = g_list_next (iter)) {
+               if (g_object_get_data (G_OBJECT (iter->data), PASSWORD_STORAGE_MENU_TAG)) {
+                       menu = iter->data;
+                       break;
+               }
+       }
+
+       /* Update password-storage popup menu to reflect secret flags */
+       if (menu) {
+               GtkRadioMenuItem *item, *item_user, *item_system;
+               GSList *group;
+
+               /* radio menu group list contains the menu items in reverse order */
+               item = (GtkRadioMenuItem *) gtk_menu_get_active (GTK_MENU (menu));
+               group = gtk_radio_menu_item_get_group (item);
+               item_system = group->data;
+               item_user = group->next->data;
+
+               if (secret_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED) {
+                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item_user), TRUE);
+                       change_password_storage_icon (passwd_entry, 1);
+               } else {
+                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item_system), TRUE);
+                       change_password_storage_icon (passwd_entry, 2);
+               }
+       }
+}
+/*---------------------------------------------------------------------------*/
+
diff --git a/src/libnm-gtk/nm-ui-utils.h b/src/libnm-gtk/nm-ui-utils.h
index 693df44..a3e7e99 100644
--- a/src/libnm-gtk/nm-ui-utils.h
+++ b/src/libnm-gtk/nm-ui-utils.h
@@ -14,7 +14,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2007 - 2012 Red Hat, Inc.
+ * (C) Copyright 2007 - 2015 Red Hat, Inc.
  */
 
 
@@ -25,7 +25,11 @@
 #ifndef NMA_UI_UTILS_H
 #define NMA_UI_UTILS_H
 
+#include <glib.h>
+#include <gtk/gtk.h>
 #include <nm-device.h>
+#include <nm-setting.h>
+#include <nm-connection.h>
 
 const char *nma_utils_get_device_vendor (NMDevice *device);
 const char *nma_utils_get_device_product (NMDevice *device);
@@ -37,5 +41,14 @@ char **nma_utils_disambiguate_device_names (NMDevice **devices,
                                             int        num_devices);
 char *nma_utils_get_connection_device_name (NMConnection *connection);
 
-#endif /* NMA_UI_UTILS_H */
+void nma_utils_setup_password_storage (NMConnection *connection,
+                                       const char *setting_name,
+                                       GtkWidget *passwd_entry,
+                                       const char *password_flags_name);
+void nma_utils_update_password_storage (NMSetting *setting,
+                                        NMSettingSecretFlags secret_flags,
+                                        GtkWidget *passwd_entry,
+                                        const char *password_flags_name);
+
+#endif /* NMA_UI_UTILS_H */
 
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 269abe3..61d6a9e 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2007 - 2011 Red Hat, Inc.
+ * Copyright 2007 - 2015 Red Hat, Inc.
  */
 
 #include <config.h>
@@ -286,187 +286,3 @@ utils_filter_editable_on_insert_text (GtkEditable *editable,
        return count > 0;
 }
 
-static void
-change_password_storage_icon (GtkWidget *passwd_entry, int number)
-{
-       char *icon_name = "document-save";
-
-       if (number == 1)
-               icon_name = "document-save";
-       else if (number == 2)
-               icon_name = "document-save-as";
-
-       gtk_entry_set_icon_from_icon_name (GTK_ENTRY (passwd_entry), GTK_ENTRY_ICON_SECONDARY, icon_name);
-}
-
-typedef struct {
-       NMConnection *connection;
-       const char *setting_name;
-       const char *password_flags_name;
-       int item_number;
-       GtkWidget *passwd_entry;
-} PopupMenuItemInfo;
-
-static void
-popup_menu_item_info_destroy (gpointer data)
-{
-       g_slice_free (PopupMenuItemInfo, data);
-}
-
-static void
-activate_menu_item_cb (GtkMenuItem *menuitem, gpointer user_data)
-{
-       PopupMenuItemInfo *info = (PopupMenuItemInfo *) user_data;
-       NMSetting *setting;
-       NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
-
-       /* Get current secret flags */
-       setting = nm_connection_get_setting_by_name (info->connection, info->setting_name);
-       if (setting)
-               nm_setting_get_secret_flags (setting, info->password_flags_name, &secret_flags, NULL);
-
-       /* Update password flags according to the password-storage popup menu */
-       if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem))) {
-               if (info->item_number == 1)
-                       secret_flags |= NM_SETTING_SECRET_FLAG_AGENT_OWNED;
-               else
-                       secret_flags &= ~NM_SETTING_SECRET_FLAG_AGENT_OWNED;
-
-               /* Update the secret flags */
-               if (setting)
-                       nm_setting_set_secret_flags (setting, info->password_flags_name, secret_flags, NULL);
-
-               /* Change icon */
-               change_password_storage_icon (info->passwd_entry, info->item_number);
-       }
-}
-
-static void
-icon_release_cb (GtkEntry *entry,
-                 GtkEntryIconPosition position,
-                 GdkEventButton *event,
-                 gpointer data)
-{
-       GtkMenu *menu = GTK_MENU (data);
-       if (position == GTK_ENTRY_ICON_SECONDARY) {
-               gtk_widget_show_all (GTK_WIDGET (data));
-               gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
-                               event->button, event->time);
-       }
-}
-
-#define PASSWORD_STORAGE_MENU_TAG "password-storage-menu"
-
-/**
- * Add secondary icon and create popup menu for password entry.
- **/
-void
-utils_setup_password_storage (NMConnection *connection,
-                              const char *setting_name,
-                              GtkWidget *passwd_entry,
-                              const char *password_flags_name)
-{
-       GtkWidget *popup_menu;
-       GtkWidget *item1, *item2;
-       GSList *group;
-       PopupMenuItemInfo *info;
-       NMSetting *setting;
-
-       gtk_entry_set_icon_from_icon_name (GTK_ENTRY (passwd_entry), GTK_ENTRY_ICON_SECONDARY, 
"document-save");
-       popup_menu = gtk_menu_new ();
-       g_object_set_data (G_OBJECT (popup_menu), PASSWORD_STORAGE_MENU_TAG, GUINT_TO_POINTER (TRUE));
-       group = NULL;
-       item1 = gtk_radio_menu_item_new_with_mnemonic (group, _("Store the password only for this _user"));
-       group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item1));
-       item2 = gtk_radio_menu_item_new_with_mnemonic (group, _("Store the password for _all users"));
-
-       gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item1);
-       gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item2);
-
-       info = g_slice_new0 (PopupMenuItemInfo);
-       info->connection = connection;
-       info->setting_name = setting_name;
-       info->password_flags_name = password_flags_name;
-       info->item_number = 1;
-       info->passwd_entry = passwd_entry;
-       g_signal_connect_data (item1, "activate",
-                              G_CALLBACK (activate_menu_item_cb),
-                              info,
-                              (GClosureNotify) popup_menu_item_info_destroy, 0);
-
-       info = g_slice_new0 (PopupMenuItemInfo);
-       info->connection = connection;
-       info->setting_name = setting_name;
-       info->password_flags_name = password_flags_name;
-       info->item_number = 2;
-       info->passwd_entry = passwd_entry;
-       g_signal_connect_data (item2, "activate",
-                              G_CALLBACK (activate_menu_item_cb),
-                              info,
-                              (GClosureNotify) popup_menu_item_info_destroy, 0);
-
-       g_signal_connect (passwd_entry, "icon-release", G_CALLBACK (icon_release_cb), popup_menu);
-       gtk_menu_attach_to_widget (GTK_MENU (popup_menu), passwd_entry, NULL);
-
-       /* Initialize active item for password-storage popup menu */
-       setting = nm_connection_get_setting_by_name (connection, setting_name);
-       if (setting) {
-               NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
-               nm_setting_get_secret_flags (setting, password_flags_name, &secret_flags, NULL);
-
-               if (secret_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)
-                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item1), TRUE);
-               else {
-                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item2), TRUE);
-                       /* Use different icon for system-storage */
-                       change_password_storage_icon (passwd_entry, 2);
-               }
-       } else {
-               gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item1), TRUE);
-       }
-}
-
-/**
- * Updates secret flags and the storage popup menu.
- **/
-void
-utils_update_password_storage (NMSetting *setting,
-                               NMSettingSecretFlags secret_flags,
-                               GtkWidget *passwd_entry,
-                               const char *password_flags_name)
-{
-       GList *menu_list, *iter;
-       GtkWidget *menu = NULL;
-
-       /* Update secret flags (WEP_KEY_FLAGS, PSK_FLAGS, ...) in the security setting */
-       nm_setting_set_secret_flags (setting, password_flags_name, secret_flags, NULL);
-
-       menu_list = gtk_menu_get_for_attach_widget (passwd_entry);
-       for (iter = menu_list; iter; iter = g_list_next (iter)) {
-               if (g_object_get_data (G_OBJECT (iter->data), PASSWORD_STORAGE_MENU_TAG)) {
-                       menu = iter->data;
-                       break;
-               }
-       }
-
-       /* Update password-storage popup menu to reflect secret flags */
-       if (menu) {
-               GtkRadioMenuItem *item, *item_user, *item_system;
-               GSList *group;
-
-               /* radio menu group list contains the menu items in reverse order */
-               item = (GtkRadioMenuItem *) gtk_menu_get_active (GTK_MENU (menu));
-               group = gtk_radio_menu_item_get_group (item);
-               item_system = group->data;
-               item_user = group->next->data;
-
-               if (secret_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED) {
-                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item_user), TRUE);
-                       change_password_storage_icon (passwd_entry, 1);
-               } else {
-                       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item_system), TRUE);
-                       change_password_storage_icon (passwd_entry, 2);
-               }
-       }
-}
-
diff --git a/src/utils/utils.h b/src/utils/utils.h
index edc2666..1abff65 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2007 - 2012 Red Hat, Inc.
+ * (C) Copyright 2007 - 2015 Red Hat, Inc.
  */
 
 #ifndef UTILS_H
@@ -107,14 +107,5 @@ gboolean utils_filter_editable_on_insert_text (GtkEditable *editable,
                                                UtilsFilterGtkEditableFunc validate_character,
                                                gpointer block_func);
 
-void utils_setup_password_storage (NMConnection *connection,
-                                   const char *setting_name,
-                                   GtkWidget *passwd_entry,
-                                   const char *password_flags_name);
-void utils_update_password_storage (NMSetting *setting,
-                                    NMSettingSecretFlags secret_flags,
-                                    GtkWidget *passwd_entry,
-                                    const char *password_flags_name);
-
 #endif /* UTILS_H */
 
diff --git a/src/wireless-security/Makefile.am b/src/wireless-security/Makefile.am
index f8098f7..1df839f 100644
--- a/src/wireless-security/Makefile.am
+++ b/src/wireless-security/Makefile.am
@@ -35,7 +35,8 @@ libwireless_security_la_CPPFLAGS = \
        -DUIDIR=\""$(uidir)"\" \
        $(NMA_CFLAGS) \
        $(DISABLE_DEPRECATED) \
-       -I${top_srcdir}/src/utils
+       -I${top_srcdir}/src/utils \
+       -I${top_srcdir}/src/libnm-gtk
 
 libwireless_security_la_LIBADD = \
        $(GTK_LIBS) \
diff --git a/src/wireless-security/eap-method-leap.c b/src/wireless-security/eap-method-leap.c
index 3f0b446..f89754f 100644
--- a/src/wireless-security/eap-method-leap.c
+++ b/src/wireless-security/eap-method-leap.c
@@ -27,7 +27,7 @@
 #include "eap-method.h"
 #include "wireless-security.h"
 #include "helpers.h"
-#include "utils.h"
+#include "nm-ui-utils.h"
 
 struct _EAPMethodLEAP {
        EAPMethod parent;
@@ -100,7 +100,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
                GtkWidget *passwd_entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, 
"eap_leap_password_entry"));
                g_assert (passwd_entry);
 
-               utils_update_password_storage (NM_SETTING (s_8021x), flags, passwd_entry, 
parent->password_flags_name);
+               nma_utils_update_password_storage (NM_SETTING (s_8021x), flags, passwd_entry, 
parent->password_flags_name);
        }
 }
 
@@ -221,7 +221,7 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       utils_setup_password_storage (connection, NM_SETTING_802_1X_SETTING_NAME, widget, 
parent->password_flags_name);
+       nma_utils_setup_password_storage (connection, NM_SETTING_802_1X_SETTING_NAME, widget, 
parent->password_flags_name);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapleap"));
        g_assert (widget);
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 427bb9f..cb869f6 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -28,7 +28,7 @@
 #include "eap-method.h"
 #include "wireless-security.h"
 #include "helpers.h"
-#include "utils.h"
+#include "nm-ui-utils.h"
 
 struct _EAPMethodSimple {
        EAPMethod parent;
@@ -162,7 +162,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
                GtkWidget *passwd_entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, 
"eap_simple_password_entry"));
                g_assert (passwd_entry);
 
-               utils_update_password_storage (NM_SETTING (s_8021x), flags, passwd_entry, 
parent->password_flags_name);
+               nma_utils_update_password_storage (NM_SETTING (s_8021x), flags, passwd_entry, 
parent->password_flags_name);
        }
 }
 
@@ -329,7 +329,7 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       utils_setup_password_storage (connection, NM_SETTING_802_1X_SETTING_NAME, widget, 
parent->password_flags_name);
+       nma_utils_setup_password_storage (connection, NM_SETTING_802_1X_SETTING_NAME, widget, 
parent->password_flags_name);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_password_always_ask"));
        g_assert (widget);
diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c
index 6daa8f8..332b921 100644
--- a/src/wireless-security/eap-method-tls.c
+++ b/src/wireless-security/eap-method-tls.c
@@ -32,7 +32,7 @@
 #include "eap-method.h"
 #include "wireless-security.h"
 #include "helpers.h"
-#include "utils.h"
+#include "nm-ui-utils.h"
 
 struct _EAPMethodTLS {
        EAPMethod parent;
@@ -183,7 +183,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
 
        /* Update secret flags and popup when editing the connection */
        if (method->editing_connection) {
-               utils_update_password_storage (NM_SETTING (s_8021x), flags, passwd_entry, 
parent->password_flags_name);
+               nma_utils_update_password_storage (NM_SETTING (s_8021x), flags, passwd_entry, 
parent->password_flags_name);
        }
 
        /* TLS client certificate */
@@ -488,7 +488,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       utils_setup_password_storage (connection, NM_SETTING_802_1X_SETTING_NAME, widget, 
parent->password_flags_name);
+       nma_utils_setup_password_storage (connection, NM_SETTING_802_1X_SETTING_NAME, widget, 
parent->password_flags_name);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eaptls"));
        g_assert (widget);
diff --git a/src/wireless-security/ws-leap.c b/src/wireless-security/ws-leap.c
index bfb913f..aaf53f1 100644
--- a/src/wireless-security/ws-leap.c
+++ b/src/wireless-security/ws-leap.c
@@ -25,7 +25,7 @@
 
 #include "wireless-security.h"
 #include "helpers.h"
-#include "utils.h"
+#include "nm-ui-utils.h"
 
 struct _WirelessSecurityLEAP {
        WirelessSecurity parent;
@@ -117,7 +117,7 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
 
        /* Update secret flags and popup when editing the connection */
        if (sec->editing_connection)
-               utils_update_password_storage (NM_SETTING (s_wireless_sec), secret_flags, passwd_entry, 
sec->password_flags_name);
+               nma_utils_update_password_storage (NM_SETTING (s_wireless_sec), secret_flags, passwd_entry, 
sec->password_flags_name);
 }
 
 static void
@@ -174,7 +174,7 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
                          sec);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       utils_setup_password_storage (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, widget, 
sec->password_flags_name);
+       nma_utils_setup_password_storage (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, widget, 
sec->password_flags_name);
 
        if (wsec)
                update_secrets (WIRELESS_SECURITY (sec), connection);
diff --git a/src/wireless-security/ws-wep-key.c b/src/wireless-security/ws-wep-key.c
index f2ac042..3743526 100644
--- a/src/wireless-security/ws-wep-key.c
+++ b/src/wireless-security/ws-wep-key.c
@@ -28,6 +28,7 @@
 
 #include "wireless-security.h"
 #include "utils.h"
+#include "nm-ui-utils.h"
 
 struct _WirelessSecurityWEPKey {
        WirelessSecurity parent;
@@ -188,7 +189,7 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
 
        /* Update secret flags and popup when editing the connection */
        if (sec->editing_connection)
-               utils_update_password_storage (NM_SETTING (s_wsec), secret_flags, passwd_entry, 
sec->password_flags_name);
+               nma_utils_update_password_storage (NM_SETTING (s_wsec), secret_flags, passwd_entry, 
sec->password_flags_name);
 }
 
 static void
@@ -265,7 +266,7 @@ ws_wep_key_new (NMConnection *connection,
        gtk_entry_set_width_chars (GTK_ENTRY (widget), 28);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       utils_setup_password_storage (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, widget, 
sec->password_flags_name);
+       nma_utils_setup_password_storage (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, widget, 
sec->password_flags_name);
 
        if (connection) {
                NMSettingWireless *s_wireless;
diff --git a/src/wireless-security/ws-wpa-psk.c b/src/wireless-security/ws-wpa-psk.c
index aa50c9c..494bbae 100644
--- a/src/wireless-security/ws-wpa-psk.c
+++ b/src/wireless-security/ws-wpa-psk.c
@@ -26,7 +26,7 @@
 
 #include "wireless-security.h"
 #include "helpers.h"
-#include "utils.h"
+#include "nm-ui-utils.h"
 
 #define WPA_PMK_LEN 32
 
@@ -130,7 +130,7 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
 
        /* Update secret flags and popup when editing the connection */
        if (wpa_psk->editing_connection)
-               utils_update_password_storage (NM_SETTING (s_wireless_sec), secret_flags, passwd_entry, 
wpa_psk->password_flags_name);
+               nma_utils_update_password_storage (NM_SETTING (s_wireless_sec), secret_flags, passwd_entry, 
wpa_psk->password_flags_name);
 
        wireless_security_clear_ciphers (connection);
        if (is_adhoc) {
@@ -194,7 +194,7 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
        gtk_entry_set_width_chars (GTK_ENTRY (widget), 28);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       utils_setup_password_storage (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, widget, 
sec->password_flags_name);
+       nma_utils_setup_password_storage (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, widget, 
sec->password_flags_name);
 
        /* Fill secrets, if any */
        if (connection)


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