[network-manager-pptp/th/vpn-editor-split-bgo766623: 19/21] properties: remove unused "import-export.c" file



commit 97abe6c1ff7d0b6d6187d05596ee1117a2864995
Author: Thomas Haller <thaller redhat com>
Date:   Wed May 18 20:23:22 2016 +0200

    properties: remove unused "import-export.c" file
    
    import/export is not yet implemented. Drop the empty "import-export.c" file.
    
    Even if we ever want to implement import/export, we might not want to move
    it to a separate source file. After all, "nm-pptp-editor-plugin.c" is small
    enough, to implement the functionality just there. And yes, we can do that
    even if we want to add unit-tests.

 properties/Makefile.am             |    4 +--
 properties/import-export.c         |   53 ------------------------------------
 properties/import-export.h         |   29 -------------------
 properties/nm-pptp-editor-plugin.c |   30 ++++++++++----------
 4 files changed, 16 insertions(+), 100 deletions(-)
---
diff --git a/properties/Makefile.am b/properties/Makefile.am
index d0bf1e6..157502c 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -8,9 +8,7 @@ AM_CPPFLAGS = -I${top_srcdir}
 
 plugin_sources = \
     nm-pptp-editor-plugin.c \
-    nm-pptp-editor-plugin.h \
-    import-export.c \
-    import-export.h
+    nm-pptp-editor-plugin.h
 
 editor_sources = \
     advanced-dialog.c \
diff --git a/properties/nm-pptp-editor-plugin.c b/properties/nm-pptp-editor-plugin.c
index c41d14d..90d6a9f 100644
--- a/properties/nm-pptp-editor-plugin.c
+++ b/properties/nm-pptp-editor-plugin.c
@@ -26,7 +26,6 @@
 #include "nm-pptp-editor-plugin.h"
 
 #include "nm-pptp-editor.h"
-#include "import-export.h"
 
 #define PPTP_PLUGIN_NAME    _("Point-to-Point Tunneling Protocol (PPTP)")
 #define PPTP_PLUGIN_DESC    _("Compatible with Microsoft and other PPTP VPN servers.")
@@ -53,9 +52,8 @@ enum {
 static NMConnection *
 import (NMVpnEditorPlugin *iface, const char *path, GError **error)
 {
-       NMConnection *connection = NULL;
-       char *contents = NULL;
-       char **lines = NULL;
+       gs_free char *contents = NULL;
+       gs_strfreev char **lines = NULL;
        char *ext;
 
        ext = strrchr (path, '.');
@@ -64,7 +62,7 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
                             NMV_EDITOR_PLUGIN_ERROR,
                             NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN,
                             "unknown PPTP file extension");
-               goto out;
+               return NULL;
        }
 
        if (strcmp (ext, ".conf") && strcmp (ext, ".cnf")) {
@@ -72,7 +70,7 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
                             NMV_EDITOR_PLUGIN_ERROR,
                             NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN,
                             "unknown PPTP file extension");
-               goto out;
+               return NULL;
        }
 
        if (!g_file_get_contents (path, &contents, NULL, error))
@@ -84,16 +82,14 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
                             NMV_EDITOR_PLUGIN_ERROR,
                             NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE,
                             "not a valid PPTP configuration file");
-               goto out;
+               return NULL;
        }
 
-       connection = do_import (path, lines, error);
-
-out:
-       if (lines)
-               g_strfreev (lines);
-       g_free (contents);
-       return connection;
+       g_set_error_literal (error,
+                            NMV_EDITOR_PLUGIN_ERROR,
+                            NMV_EDITOR_PLUGIN_ERROR_FAILED,
+                            "PPTP import is not implemented");
+       return NULL;
 }
 
 static gboolean
@@ -102,7 +98,11 @@ export (NMVpnEditorPlugin *iface,
         NMConnection *connection,
         GError **error)
 {
-       return do_export (path, connection, error);
+       g_set_error_literal (error,
+                            NMV_EDITOR_PLUGIN_ERROR,
+                            NMV_EDITOR_PLUGIN_ERROR_FAILED,
+                            "PPTP export is not implemented");
+       return FALSE;
 }
 
 static char *


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