diff options
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/applet-device-cdma.c | 5 | ||||
-rw-r--r-- | src/applet-device-gsm.c | 5 | ||||
-rw-r--r-- | src/gnome-bluetooth/nma-bt-device.c | 17 | ||||
-rw-r--r-- | src/utils/utils.c | 13 | ||||
-rw-r--r-- | src/utils/utils.h | 3 |
6 files changed, 22 insertions, 22 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index ab32404e..6bd6bdd0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -57,6 +57,7 @@ src/libnm-gtk/nm-wireless-dialog.c src/main.c src/mb-menu-item.c src/utils/nmn-mobile-providers.c +src/utils/utils.c [type: gettext/glade]src/wired-8021x.ui src/wired-dialog.c src/wireless-security/eap-method.c diff --git a/src/applet-device-cdma.c b/src/applet-device-cdma.c index 4c18131d..1a5ecb74 100644 --- a/src/applet-device-cdma.c +++ b/src/applet-device-cdma.c @@ -135,10 +135,7 @@ mobile_wizard_done (NMAMobileWizard *wizard, nm_connection_add_setting (connection, nm_setting_ppp_new ()); setting = nm_setting_connection_new (); - if (method->plan_name) - id = g_strdup_printf ("%s %s", method->provider_name, method->plan_name); - else - id = g_strdup_printf ("%s connection", method->provider_name); + id = utils_create_mobile_connection_id (method->provider_name, method->plan_name); uuid = nm_utils_uuid_generate (); g_object_set (setting, NM_SETTING_CONNECTION_ID, id, diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c index e9cd1c17..0497ce40 100644 --- a/src/applet-device-gsm.c +++ b/src/applet-device-gsm.c @@ -165,10 +165,7 @@ mobile_wizard_done (NMAMobileWizard *wizard, nm_connection_add_setting (connection, nm_setting_ppp_new ()); setting = nm_setting_connection_new (); - if (method->plan_name) - id = g_strdup_printf ("%s %s", method->provider_name, method->plan_name); - else - id = g_strdup_printf ("%s connection", method->provider_name); + id = utils_create_mobile_connection_id (method->provider_name, method->plan_name); uuid = nm_utils_uuid_generate (); g_object_set (setting, NM_SETTING_CONNECTION_ID, id, diff --git a/src/gnome-bluetooth/nma-bt-device.c b/src/gnome-bluetooth/nma-bt-device.c index a81918fe..e1b9f383 100644 --- a/src/gnome-bluetooth/nma-bt-device.c +++ b/src/gnome-bluetooth/nma-bt-device.c @@ -41,6 +41,7 @@ #include "nma-marshal.h" #include "nm-mobile-wizard.h" #include "nm-utils.h" +#include "utils.h" #if !GLIB_CHECK_VERSION(2,28,0) #define g_clear_object(object_ptr) \ @@ -321,18 +322,6 @@ dun_error (NmaBtDevice *self, const char *func, GError *error, const char *fallb recheck_services_enabled (self); } -static char * -get_connection_name (NMAMobileWizardAccessMethod *method) -{ - if (method->plan_name) { - /* Results in something like "T-Mobile ToGo (prepaid)" */ - return g_strdup_printf (_("%s %s"), method->provider_name, method->plan_name); - } - - /* Results in something like "T-Mobile connection" */ - return g_strdup_printf (_("%s connection"), method->provider_name); -} - static NMConnection * dun_new_cdma (NMAMobileWizardAccessMethod *method) { @@ -363,7 +352,7 @@ dun_new_cdma (NMAMobileWizardAccessMethod *method) nm_connection_add_setting (connection, nm_setting_ppp_new ()); setting = nm_setting_connection_new (); - id = get_connection_name (method); + id = utils_create_mobile_connection_id (method->provider_name, method->plan_name); uuid = nm_utils_uuid_generate (); g_object_set (setting, NM_SETTING_CONNECTION_ID, id, @@ -409,7 +398,7 @@ dun_new_gsm (NMAMobileWizardAccessMethod *method) nm_connection_add_setting (connection, nm_setting_ppp_new ()); setting = nm_setting_connection_new (); - id = get_connection_name (method); + id = utils_create_mobile_connection_id (method->provider_name, method->plan_name); uuid = nm_utils_uuid_generate (); g_object_set (setting, NM_SETTING_CONNECTION_ID, id, diff --git a/src/utils/utils.c b/src/utils/utils.c index 2560b2e8..fac2b4f9 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -24,6 +24,7 @@ #include <string.h> #include <netinet/ether.h> #include <glib.h> +#include <glib/gi18n.h> #include <gtk/gtk.h> #include <nm-setting-connection.h> @@ -312,6 +313,18 @@ utils_escape_notify_message (const char *src) return g_string_free (escaped, FALSE); } +char * +utils_create_mobile_connection_id (const char *provider, const char *plan_name) +{ + g_return_val_if_fail (provider != NULL, NULL); + + if (plan_name) + return g_strdup_printf ("%s %s", provider, plan_name); + + /* The %s is a mobile provider name, eg "T-Mobile" */ + return g_strdup_printf (_("%s connection"), provider); +} + void utils_show_error_dialog (const char *title, const char *text1, diff --git a/src/utils/utils.h b/src/utils/utils.h index 8d562933..e3d231aa 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -46,6 +46,9 @@ char *utils_hash_ap (const GByteArray *ssid, char *utils_escape_notify_message (const char *src); +char *utils_create_mobile_connection_id (const char *provider, + const char *plan_name); + void utils_show_error_dialog (const char *title, const char *text1, const char *text2, |