clients: move clients/tui/vpn-helpers.c to clients/common/nm-vpn-helpers.c
authorJiří Klimeš <jklimes@redhat.com>
Mon, 23 Nov 2015 16:47:00 +0000 (17:47 +0100)
committerJiří Klimeš <jklimes@redhat.com>
Thu, 26 Nov 2015 10:08:44 +0000 (11:08 +0100)
The file has not been used up to now. But it is going to be used by both
nmtui and nmcli later.

clients/common/nm-vpn-helpers.c [moved from clients/tui/vpn-helpers.c with 96% similarity]
clients/common/nm-vpn-helpers.h [moved from clients/tui/vpn-helpers.h with 67% similarity]
clients/tui/nm-editor-utils.c
po/POTFILES.skip

similarity index 96%
rename from clients/tui/vpn-helpers.c
rename to clients/common/nm-vpn-helpers.c
index 9b623aa..1596a15 100644 (file)
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
- * Copyright 2013 Red Hat, Inc.
+ * Copyright 2013 - 2015 Red Hat, Inc.
  */
 
 /**
- * SECTION:vpn-helpers
+ * SECTION:nm-vpn-helpers
  * @short_description: VPN-related utilities
  *
- * This is copied directly from libnm-gtk and should probably
- * eventually move into libnm.
- *
- * It is also currently unused in nmtui.
- *
- * FIXME.
+ * Some functions should probably eventually move into libnm.
  */
 
 #include "config.h"
@@ -34,7 +29,7 @@
 #include <gmodule.h>
 
 #include "nm-default.h"
-#include "vpn-helpers.h"
+#include "nm-vpn-helpers.h"
 
 #include "nm-macros-internal.h"
 
@@ -42,7 +37,7 @@ static gboolean plugins_loaded;
 static GSList *plugins = NULL;
 
 NMVpnEditorPlugin *
-vpn_get_plugin_by_service (const char *service)
+nm_vpn_get_plugin_by_service (const char *service)
 {
        NMVpnEditorPlugin *plugin = NULL;
        NMVpnPluginInfo *plugin_info;
@@ -50,7 +45,7 @@ vpn_get_plugin_by_service (const char *service)
        g_return_val_if_fail (service != NULL, NULL);
 
        if (G_UNLIKELY (!plugins_loaded))
-               vpn_get_plugins ();
+               nm_vpn_get_plugins ();
 
        plugin_info = nm_vpn_plugin_info_list_find_by_service (plugins, service);
        if (plugin_info) {
@@ -62,7 +57,7 @@ vpn_get_plugin_by_service (const char *service)
 }
 
 GSList *
-vpn_get_plugins ()
+nm_vpn_get_plugins (void)
 {
        if (G_LIKELY (plugins_loaded))
                return plugins;
@@ -303,7 +298,7 @@ vpn_export (NMConnection *connection)
 #endif
 
 gboolean
-vpn_supports_ipv6 (NMConnection *connection)
+nm_vpn_supports_ipv6 (NMConnection *connection)
 {
        NMSettingVpn *s_vpn;
        const char *service_type;
@@ -316,7 +311,7 @@ vpn_supports_ipv6 (NMConnection *connection)
        service_type = nm_setting_vpn_get_service_type (s_vpn);
        g_return_val_if_fail (service_type != NULL, FALSE);
 
-       plugin = vpn_get_plugin_by_service (service_type);
+       plugin = nm_vpn_get_plugin_by_service (service_type);
        g_return_val_if_fail (plugin != NULL, FALSE);
 
        capabilities = nm_vpn_editor_plugin_get_capabilities (plugin);
similarity index 67%
rename from clients/tui/vpn-helpers.h
rename to clients/common/nm-vpn-helpers.h
index 47fc27e..a19608b 100644 (file)
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
- * Copyright 2013 Red Hat, Inc.
+ * Copyright 2013 - 2015 Red Hat, Inc.
  */
 
-#ifndef _VPN_HELPERS_H_
-#define _VPN_HELPERS_H_
+#ifndef __NM_VPN_HELPERS_H__
+#define __NM_VPN_HELPERS_H__
 
 #include <NetworkManager.h>
 
 #include "nm-default.h"
 
-GSList *vpn_get_plugins (void);
+GSList *nm_vpn_get_plugins (void);
 
-NMVpnEditorPlugin *vpn_get_plugin_by_service (const char *service);
+NMVpnEditorPlugin *nm_vpn_get_plugin_by_service (const char *service);
 
 typedef void (*VpnImportSuccessCallback) (NMConnection *connection, gpointer user_data);
-void vpn_import (VpnImportSuccessCallback callback, gpointer user_data);
+void nm_vpn_import (VpnImportSuccessCallback callback, gpointer user_data);
 
-void vpn_export (NMConnection *connection);
+void nm_vpn_export (NMConnection *connection);
 
-gboolean vpn_supports_ipv6 (NMConnection *connection);
+gboolean nm_vpn_supports_ipv6 (NMConnection *connection);
 
-#endif  /* _VPN_HELPERS_H_ */
+#endif  /* __NM_VPN_HELPERS_H__ */
index befc5f3..026ef23 100644 (file)
 #include "nm-default.h"
 #include "nm-editor-utils.h"
 #if 0
-#include "vpn-helpers.h"
+#include "nm-vpn-helpers.h"
 
 static GSList *vpn_plugins;
 
 static gint
 sort_vpn_plugins (gconstpointer a, gconstpointer b)
 {
-       NMVpnPluginUiInterface *aa = NM_VPN_PLUGIN_UI_INTERFACE (a);
-       NMVpnPluginUiInterface *bb = NM_VPN_PLUGIN_UI_INTERFACE (b);
+       NMVpnEditorPlugin *aa = NM_VPN_EDITOR_PLUGIN (a);
+       NMVpnEditorPlugin *bb = NM_VPN_EDITOR_PLUGIN (b);
        char *aa_desc = NULL, *bb_desc = NULL;
        int ret;
 
-       g_object_get (aa, NM_VPN_PLUGIN_UI_INTERFACE_NAME, &aa_desc, NULL);
-       g_object_get (bb, NM_VPN_PLUGIN_UI_INTERFACE_NAME, &bb_desc, NULL);
+       g_object_get (aa, NM_VPN_EDITOR_PLUGIN_NAME, &aa_desc, NULL);
+       g_object_get (bb, NM_VPN_EDITOR_PLUGIN_NAME, &bb_desc, NULL);
 
        ret = g_strcmp0 (aa_desc, bb_desc);
 
@@ -224,7 +224,7 @@ nm_editor_utils_get_connection_type_list (void)
 
 #if 0
        /* Add "VPN" only if there are plugins */
-       vpn_plugins_hash = vpn_get_plugins (NULL);
+       vpn_plugins_hash = nm_vpn_get_plugins ();
        have_vpn_plugins  = vpn_plugins_hash && g_hash_table_size (vpn_plugins_hash);
        if (have_vpn_plugins) {
                GHashTableIter iter;
index 3fc7b52..d4ecf22 100644 (file)
@@ -1,4 +1,3 @@
-clients/tui/vpn-helpers.c
 examples/python/NetworkManager.py
 examples/python/systray/eggtrayicon.c
 policy/org.freedesktop.NetworkManager.policy.in