[network-manager-openvpn] Make error strings translatable



commit f2936bb2b10cec7da2c29f23e4efbccd97c31dd6
Author: Pablo Castellano <pablog gnome org>
Date:   Fri Oct 29 01:16:29 2010 +0200

    Make error strings translatable
    
    [lkundrak v3 sk: Rebase, whitespace fixes]
    
    https://bugzilla.gnome.org/show_bug.cgi?id=626291

 po/POTFILES.in             |    1 +
 properties/import-export.c |   20 ++++++------
 properties/nm-openvpn.c    |   20 ++++++------
 src/nm-openvpn-service.c   |   68 ++++++++++++++++++++------------------------
 4 files changed, 52 insertions(+), 57 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0613fc0..c6486e2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@
 auth-dialog/main.c
 nm-openvpn.desktop.in
 properties/auth-helpers.c
+properties/import-export.c
 properties/nm-openvpn.c
 [type: gettext/glade]properties/nm-openvpn-dialog.ui
 src/nm-openvpn-service.c
diff --git a/properties/import-export.c b/properties/import-export.c
index 6b1dad7..7273f91 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -680,17 +680,17 @@ do_import (const char *path, char **lines, GError **error)
        }
 
        if (!have_client && !have_sk) {
-               g_set_error (error,
-                            OPENVPN_PLUGIN_UI_ERROR,
-                            OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN,
-                            "The file to import wasn't a valid OpenVPN client configuration.");
+               g_set_error_literal (error,
+                                    OPENVPN_PLUGIN_UI_ERROR,
+                                    OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN,
+                                    _("The file to import wasn't a valid OpenVPN client configuration."));
                g_object_unref (connection);
                connection = NULL;
        } else if (!have_remote) {
-               g_set_error (error,
-                            OPENVPN_PLUGIN_UI_ERROR,
-                            OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN,
-                            "The file to import wasn't a valid OpenVPN configure (no remote).");
+               g_set_error_literal (error,
+                                    OPENVPN_PLUGIN_UI_ERROR,
+                                    OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN,
+                                    _("The file to import wasn't a valid OpenVPN configure (no remote)."));
                g_object_unref (connection);
                connection = NULL;
        } else {
@@ -800,7 +800,7 @@ do_export (const char *path, NMConnection *connection, GError **error)
 
        f = fopen (path, "w");
        if (!f) {
-               g_set_error (error, 0, 0, "could not open file for writing");
+               g_set_error_literal (error, 0, 0, _("could not open file for writing"));
                return FALSE;
        }
 
@@ -808,7 +808,7 @@ do_export (const char *path, NMConnection *connection, GError **error)
        if (value && strlen (value))
                gateways = value;
        else {
-               g_set_error (error, 0, 0, "connection was incomplete (missing gateway)");
+               g_set_error_literal (error, 0, 0, _("connection was incomplete (missing gateway)"));
                goto done;
        }
 
diff --git a/properties/nm-openvpn.c b/properties/nm-openvpn.c
index ba3c4ac..f9b9eb9 100644
--- a/properties/nm-openvpn.c
+++ b/properties/nm-openvpn.c
@@ -550,7 +550,7 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 
        object = NM_VPN_PLUGIN_UI_WIDGET_INTERFACE (g_object_new (OPENVPN_TYPE_PLUGIN_UI_WIDGET, NULL));
        if (!object) {
-               g_set_error (error, OPENVPN_PLUGIN_UI_ERROR, 0, "could not create openvpn object");
+               g_set_error_literal (error, OPENVPN_PLUGIN_UI_ERROR, 0, _("could not create openvpn object"));
                return NULL;
        }
 
@@ -576,7 +576,7 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 
        priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "openvpn-vbox"));
        if (!priv->widget) {
-               g_set_error (error, OPENVPN_PLUGIN_UI_ERROR, 0, "could not load UI widget");
+               g_set_error_literal (error, OPENVPN_PLUGIN_UI_ERROR, 0, _("could not load UI widget"));
                g_object_unref (object);
                return NULL;
        }
@@ -664,10 +664,10 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
                     && !g_str_has_suffix (ext, ".conf")
                     && !g_str_has_suffix (ext, ".cnf")
                     && !g_str_has_suffix (ext, ".ovpntest"))) {   /* Special extension for testcases */
-               g_set_error (error,
-                            OPENVPN_PLUGIN_UI_ERROR,
-                            OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN,
-                            "unknown OpenVPN file extension");
+               g_set_error_literal (error,
+                                    OPENVPN_PLUGIN_UI_ERROR,
+                                    OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN,
+                                    _("unknown OpenVPN file extension"));
                goto out;
        }
 
@@ -692,10 +692,10 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
 
        lines = g_strsplit_set (contents, "\r\n", 0);
        if (g_strv_length (lines) <= 1) {
-               g_set_error (error,
-                            OPENVPN_PLUGIN_UI_ERROR,
-                            OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_READABLE,
-                            "not a valid OpenVPN configuration file");
+               g_set_error_literal (error,
+                                    OPENVPN_PLUGIN_UI_ERROR,
+                                    OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_READABLE,
+                                    _("not a valid OpenVPN configuration file"));
                goto out;
        }
 
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 44ece16..9b75c37 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -255,11 +255,10 @@ nm_openvpn_properties_validate (NMSettingVPN *s_vpn, GError **error)
 
        nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info);
        if (!info.have_items) {
-               g_set_error (error,
-                            NM_VPN_PLUGIN_ERROR,
-                            NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-                            "%s",
-                            _("No VPN configuration options."));
+               g_set_error_literal (error,
+                                    NM_VPN_PLUGIN_ERROR,
+                                    NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+                                    _("No VPN configuration options."));
                return FALSE;
        }
 
@@ -886,33 +885,30 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
        /* Find openvpn */
        openvpn_binary = nm_find_openvpn ();
        if (!openvpn_binary) {
-               g_set_error (error,
-                            NM_VPN_PLUGIN_ERROR,
-                            NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-                            "%s",
-                            _("Could not find the openvpn binary."));
+               g_set_error_literal (error,
+                                    NM_VPN_PLUGIN_ERROR,
+                                    NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+                                    _("Could not find the openvpn binary."));
                return FALSE;
        }
-  
-       auth = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_AUTH);
-       if (auth) {
-               if (!validate_auth(auth)) {
-                       g_set_error (error,
-                                    NM_VPN_PLUGIN_ERROR,
-                                    NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-                                    "%s",
-                                    _("Invalid HMAC auth."));
-                       return FALSE;
-               }
-       }
+
+       auth = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_AUTH);
+       if (auth) {
+               if (!validate_auth(auth)) {
+                       g_set_error_literal (error,
+                                            NM_VPN_PLUGIN_ERROR,
+                                            NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+                                            _("Invalid HMAC auth."));
+                       return FALSE;
+               }
+       }
 
        connection_type = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE);
        if (!validate_connection_type (connection_type)) {
-               g_set_error (error,
-                            NM_VPN_PLUGIN_ERROR,
-                            NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-                            "%s",
-                            _("Invalid connection type."));
+               g_set_error_literal (error,
+                                    NM_VPN_PLUGIN_ERROR,
+                                    NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+                                    _("Invalid connection type."));
                return FALSE;
        }
 
@@ -1225,11 +1221,10 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
                tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_LOCAL_IP);
                if (!tmp) {
                        /* Insufficient data (FIXME: this should really be detected when validating the 
properties */
-                       g_set_error (error,
-                                    NM_VPN_PLUGIN_ERROR,
-                                    NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-                                    "%s",
-                                    _("Missing required local IP address for static key mode."));
+                       g_set_error_literal (error,
+                                            NM_VPN_PLUGIN_ERROR,
+                                            NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+                                            _("Missing required local IP address for static key mode."));
                        free_openvpn_args (args);
                        return FALSE;
                }
@@ -1238,11 +1233,10 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
                tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_IP);
                if (!tmp) {
                        /* Insufficient data (FIXME: this should really be detected when validating the 
properties */
-                       g_set_error (error,
-                                    NM_VPN_PLUGIN_ERROR,
-                                    NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-                                    "%s",
-                                    _("Missing required remote IP address for static key mode."));
+                       g_set_error_literal (error,
+                                            NM_VPN_PLUGIN_ERROR,
+                                            NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+                                            _("Missing required remote IP address for static key mode."));
                        free_openvpn_args (args);
                        return FALSE;
                }


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