[network-manager-applet/aleksander/mobile-providers: 1/9] libnm-gtk: expose the mobile providers database parser in the API
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/aleksander/mobile-providers: 1/9] libnm-gtk: expose the mobile providers database parser in the API
- Date: Fri, 23 Nov 2012 15:47:43 +0000 (UTC)
commit ec957dacf0d768445b5a5ac2432542fec3b0aa31
Author: Aleksander Morgado <aleksander lanedo com>
Date: Fri Nov 23 08:54:19 2012 +0100
libnm-gtk: expose the mobile providers database parser in the API
Prefix of the methods and types was changed to 'nma' in order to get it properly
exported in the library.
https://bugzilla.gnome.org/show_bug.cgi?id=688206
src/applet-device-cdma.c | 7 +-
src/applet-device-gsm.c | 9 +-
src/libnm-gtk/Makefile.am | 7 +-
.../nm-mobile-providers.c} | 94 +++++++--------
.../nm-mobile-providers.h} | 54 +++++----
src/libnm-gtk/nm-mobile-wizard.c | 124 ++++++++++----------
src/utils/Makefile.am | 5 +-
7 files changed, 149 insertions(+), 151 deletions(-)
---
diff --git a/src/applet-device-cdma.c b/src/applet-device-cdma.c
index 41510bc..09e195d 100644
--- a/src/applet-device-cdma.c
+++ b/src/applet-device-cdma.c
@@ -42,7 +42,7 @@
#include "nm-mobile-wizard.h"
#include "applet-dialogs.h"
#include "nma-marshal.h"
-#include "nmn-mobile-providers.h"
+#include "nm-mobile-providers.h"
#include "mb-menu-item.h"
#include "nm-ui-utils.h"
@@ -725,7 +725,7 @@ find_provider_for_sid (GHashTable *table, guint32 sid)
/* Search through each country's providers */
for (piter = providers; piter && !name; piter = g_slist_next (piter)) {
- NmnMobileProvider *provider = piter->data;
+ NMAMobileProvider *provider = piter->data;
/* Search through CDMA SID list */
for (siter = provider->cdma_sid; siter; siter = g_slist_next (siter)) {
@@ -943,7 +943,7 @@ cdma_device_added (NMDevice *device, NMApplet *applet)
info->bus = bus;
info->quality_valid = FALSE;
- info->providers = nmn_mobile_providers_parse (NULL);
+ info->providers = nma_mobile_providers_parse (NULL);
info->props_proxy = dbus_g_proxy_new_for_name (bus,
"org.freedesktop.ModemManager",
@@ -1020,4 +1020,3 @@ applet_device_cdma_get_class (NMApplet *applet)
return dclass;
}
-
diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
index 3166543..819483f 100644
--- a/src/applet-device-gsm.c
+++ b/src/applet-device-gsm.c
@@ -46,7 +46,7 @@
#include "applet-dialogs.h"
#include "mb-menu-item.h"
#include "nma-marshal.h"
-#include "nmn-mobile-providers.h"
+#include "nm-mobile-providers.h"
#include "nm-ui-utils.h"
typedef enum {
@@ -1115,11 +1115,11 @@ find_provider_for_mcc_mnc (GHashTable *table, const char *mccmnc)
/* Search through each country's providers */
for (piter = providers; piter && !done; piter = g_slist_next (piter)) {
- NmnMobileProvider *provider = piter->data;
+ NMAMobileProvider *provider = piter->data;
/* Search through MCC/MNC list */
for (siter = provider->gsm_mcc_mnc; siter; siter = g_slist_next (siter)) {
- NmnGsmMccMnc *mcc = siter->data;
+ NMAGsmMccMnc *mcc = siter->data;
/* Match both 2-digit and 3-digit MNC; prefer a
* 3-digit match if found, otherwise a 2-digit one.
@@ -1181,7 +1181,7 @@ parse_op_name (GsmDeviceInfo *info, const char *orig, const char *op_code)
*/
if (!info->providers)
- info->providers = nmn_mobile_providers_parse (NULL);
+ info->providers = nma_mobile_providers_parse (NULL);
if (!info->providers)
return strdup (orig);
@@ -1742,4 +1742,3 @@ applet_device_gsm_get_class (NMApplet *applet)
return dclass;
}
-
diff --git a/src/libnm-gtk/Makefile.am b/src/libnm-gtk/Makefile.am
index 7073296..5a9266e 100644
--- a/src/libnm-gtk/Makefile.am
+++ b/src/libnm-gtk/Makefile.am
@@ -7,7 +7,8 @@ libnmgtk_HEADERS = \
nm-wifi-dialog.h \
nm-wireless-dialog.h \
nm-mobile-wizard.h \
- nm-ui-utils.h
+ nm-ui-utils.h \
+ nm-mobile-providers.h
lib_LTLIBRARIES = libnm-gtk.la
@@ -15,7 +16,8 @@ libnm_gtk_la_SOURCES = \
nm-wifi-dialog.c \
nm-wireless-dialog.c \
nm-mobile-wizard.c \
- nm-ui-utils.c
+ nm-ui-utils.c \
+ nm-mobile-providers.c
libnm_gtk_la_CFLAGS = \
$(GTK_CFLAGS) \
@@ -28,6 +30,7 @@ libnm_gtk_la_CFLAGS = \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
+ -DDATADIR=\""$(datadir)"\" \
-DAUTOSTARTDIR=\""$(sysconfdir)/xdg/autostart"\" \
-DVPN_NAME_FILES_DIR=\""$(sysconfdir)/NetworkManager/VPN"\" \
-DNMALOCALEDIR=\"$(datadir)/locale\" \
diff --git a/src/utils/nmn-mobile-providers.c b/src/libnm-gtk/nm-mobile-providers.c
similarity index 91%
rename from src/utils/nmn-mobile-providers.c
rename to src/libnm-gtk/nm-mobile-providers.c
index 05b9af0..519b529 100644
--- a/src/utils/nmn-mobile-providers.c
+++ b/src/libnm-gtk/nm-mobile-providers.c
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
-#include "nmn-mobile-providers.h"
+#include "nm-mobile-providers.h"
#ifndef MOBILE_BROADBAND_PROVIDER_INFO
#define MOBILE_BROADBAND_PROVIDER_INFO DATADIR"/mobile-broadband-provider-info/serviceproviders.xml"
@@ -141,39 +141,39 @@ typedef struct {
char *current_country;
GSList *current_providers;
- NmnMobileProvider *current_provider;
- NmnMobileAccessMethod *current_method;
+ NMAMobileProvider *current_provider;
+ NMAMobileAccessMethod *current_method;
char *text_buffer;
MobileContextState state;
} MobileParser;
-static NmnGsmMccMnc *
+static NMAGsmMccMnc *
mcc_mnc_new (const char *mcc, const char *mnc)
{
- NmnGsmMccMnc *m;
+ NMAGsmMccMnc *m;
- m = g_slice_new0 (NmnGsmMccMnc);
+ m = g_slice_new0 (NMAGsmMccMnc);
m->mcc = g_strstrip (g_strdup (mcc));
m->mnc = g_strstrip (g_strdup (mnc));
return m;
}
static void
-mcc_mnc_free (NmnGsmMccMnc *m)
+mcc_mnc_free (NMAGsmMccMnc *m)
{
g_return_if_fail (m != NULL);
g_free (m->mcc);
g_free (m->mnc);
- g_slice_free (NmnGsmMccMnc, m);
+ g_slice_free (NMAGsmMccMnc, m);
}
-static NmnMobileAccessMethod *
+static NMAMobileAccessMethod *
access_method_new (void)
{
- NmnMobileAccessMethod *method;
+ NMAMobileAccessMethod *method;
- method = g_slice_new0 (NmnMobileAccessMethod);
+ method = g_slice_new0 (NMAMobileAccessMethod);
method->refs = 1;
method->lcl_names = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
@@ -182,19 +182,19 @@ access_method_new (void)
return method;
}
-NmnMobileAccessMethod *
-nmn_mobile_access_method_ref (NmnMobileAccessMethod *method)
+NMAMobileAccessMethod *
+nma_mobile_access_method_ref (NMAMobileAccessMethod *method)
{
g_return_val_if_fail (method != NULL, NULL);
g_return_val_if_fail (method->refs > 0, NULL);
-
+
method->refs++;
return method;
}
void
-nmn_mobile_access_method_unref (NmnMobileAccessMethod *method)
+nma_mobile_access_method_unref (NMAMobileAccessMethod *method)
{
g_return_if_fail (method != NULL);
g_return_if_fail (method->refs > 0);
@@ -209,30 +209,30 @@ nmn_mobile_access_method_unref (NmnMobileAccessMethod *method)
g_slist_foreach (method->dns, (GFunc) g_free, NULL);
g_slist_free (method->dns);
- g_slice_free (NmnMobileAccessMethod, method);
+ g_slice_free (NMAMobileAccessMethod, method);
}
}
GType
-nmn_mobile_access_method_get_type (void)
+nma_mobile_access_method_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0)) {
- type = g_boxed_type_register_static ("NmnMobileAccessMethod",
- (GBoxedCopyFunc) nmn_mobile_access_method_ref,
- (GBoxedFreeFunc) nmn_mobile_access_method_unref);
+ type = g_boxed_type_register_static ("NMAMobileAccessMethod",
+ (GBoxedCopyFunc) nma_mobile_access_method_ref,
+ (GBoxedFreeFunc) nma_mobile_access_method_unref);
}
return type;
}
-static NmnMobileProvider *
+static NMAMobileProvider *
provider_new (void)
{
- NmnMobileProvider *provider;
+ NMAMobileProvider *provider;
- provider = g_slice_new0 (NmnMobileProvider);
+ provider = g_slice_new0 (NMAMobileProvider);
provider->refs = 1;
provider->lcl_names = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
@@ -241,8 +241,8 @@ provider_new (void)
return provider;
}
-NmnMobileProvider *
-nmn_mobile_provider_ref (NmnMobileProvider *provider)
+NMAMobileProvider *
+nma_mobile_provider_ref (NMAMobileProvider *provider)
{
provider->refs++;
@@ -250,13 +250,13 @@ nmn_mobile_provider_ref (NmnMobileProvider *provider)
}
void
-nmn_mobile_provider_unref (NmnMobileProvider *provider)
+nma_mobile_provider_unref (NMAMobileProvider *provider)
{
if (--provider->refs == 0) {
g_free (provider->name);
g_hash_table_destroy (provider->lcl_names);
- g_slist_foreach (provider->methods, (GFunc) nmn_mobile_access_method_unref, NULL);
+ g_slist_foreach (provider->methods, (GFunc) nma_mobile_access_method_unref, NULL);
g_slist_free (provider->methods);
g_slist_foreach (provider->gsm_mcc_mnc, (GFunc) mcc_mnc_free, NULL);
@@ -264,19 +264,19 @@ nmn_mobile_provider_unref (NmnMobileProvider *provider)
g_slist_free (provider->cdma_sid);
- g_slice_free (NmnMobileProvider, provider);
+ g_slice_free (NMAMobileProvider, provider);
}
}
GType
-nmn_mobile_provider_get_type (void)
+nma_mobile_provider_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0)) {
- type = g_boxed_type_register_static ("NmnMobileProvider",
- (GBoxedCopyFunc) nmn_mobile_provider_ref,
- (GBoxedFreeFunc) nmn_mobile_provider_unref);
+ type = g_boxed_type_register_static ("NMAMobileProvider",
+ (GBoxedCopyFunc) nma_mobile_provider_ref,
+ (GBoxedFreeFunc) nma_mobile_provider_unref);
}
return type;
}
@@ -287,7 +287,7 @@ provider_list_free (gpointer data)
GSList *list = (GSList *) data;
while (list) {
- nmn_mobile_provider_unref ((NmnMobileProvider *) list->data);
+ nma_mobile_provider_unref ((NMAMobileProvider *) list->data);
list = g_slist_delete_link (list, list);
}
}
@@ -524,7 +524,7 @@ parser_gsm_apn_end (MobileParser *parser,
parser->current_method->gateway = parser->text_buffer;
parser->text_buffer = NULL;
} else if (!strcmp (name, "apn")) {
- parser->current_method->type = NMN_MOBILE_ACCESS_METHOD_TYPE_GSM;
+ parser->current_method->type = NMA_MOBILE_ACCESS_METHOD_TYPE_GSM;
parser->current_method->dns = g_slist_reverse (parser->current_method->dns);
if (!parser->current_method->name)
@@ -555,7 +555,7 @@ parser_cdma_end (MobileParser *parser,
parser->current_method->gateway = parser->text_buffer;
parser->text_buffer = NULL;
} else if (!strcmp (name, "cdma")) {
- parser->current_method->type = NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA;
+ parser->current_method->type = NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA;
parser->current_method->dns = g_slist_reverse (parser->current_method->dns);
if (!parser->current_method->name)
@@ -620,7 +620,7 @@ static const GMarkupParser mobile_parser = {
};
GHashTable *
-nmn_mobile_providers_parse (GHashTable **out_ccs)
+nma_mobile_providers_parse (GHashTable **out_ccs)
{
GMarkupParseContext *ctx;
GIOChannel *channel;
@@ -681,7 +681,7 @@ nmn_mobile_providers_parse (GHashTable **out_ccs)
if (parser.current_provider) {
g_warning ("pending current provider");
- nmn_mobile_provider_unref (parser.current_provider);
+ nma_mobile_provider_unref (parser.current_provider);
}
if (parser.current_providers) {
@@ -704,7 +704,7 @@ nmn_mobile_providers_parse (GHashTable **out_ccs)
}
static void
-dump_generic (NmnMobileAccessMethod *method)
+dump_generic (NMAMobileAccessMethod *method)
{
GSList *iter;
GString *dns;
@@ -722,7 +722,7 @@ dump_generic (NmnMobileAccessMethod *method)
}
static void
-dump_cdma (NmnMobileAccessMethod *method)
+dump_cdma (NMAMobileAccessMethod *method)
{
g_print (" CDMA: %s\n", method->name);
@@ -730,7 +730,7 @@ dump_cdma (NmnMobileAccessMethod *method)
}
static void
-dump_gsm (NmnMobileAccessMethod *method)
+dump_gsm (NMAMobileAccessMethod *method)
{
g_print (" APN: %s (%s)\n", method->name, method->gsm_apn);
@@ -743,16 +743,16 @@ dump_country (gpointer key, gpointer value, gpointer user_data)
GSList *citer, *miter;
for (citer = value; citer; citer = g_slist_next (citer)) {
- NmnMobileProvider *provider = citer->data;
+ NMAMobileProvider *provider = citer->data;
g_print ("Provider: %s (%s)\n", provider->name, (const char *) key);
for (miter = provider->methods; miter; miter = g_slist_next (miter)) {
- NmnMobileAccessMethod *method = miter->data;
+ NMAMobileAccessMethod *method = miter->data;
GSList *liter;
for (liter = provider->gsm_mcc_mnc; liter; liter = g_slist_next (liter)) {
- NmnGsmMccMnc *m = liter->data;
+ NMAGsmMccMnc *m = liter->data;
g_print (" MCC/MNC: %s-%s\n", m->mcc, m->mnc);
}
@@ -760,10 +760,10 @@ dump_country (gpointer key, gpointer value, gpointer user_data)
g_print (" SID: %d\n", GPOINTER_TO_UINT (liter->data));
switch (method->type) {
- case NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA:
+ case NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA:
dump_cdma (method);
break;
- case NMN_MOBILE_ACCESS_METHOD_TYPE_GSM:
+ case NMA_MOBILE_ACCESS_METHOD_TYPE_GSM:
dump_gsm (method);
break;
default:
@@ -775,10 +775,8 @@ dump_country (gpointer key, gpointer value, gpointer user_data)
}
void
-nmn_mobile_providers_dump (GHashTable *providers)
+nma_mobile_providers_dump (GHashTable *providers)
{
g_return_if_fail (providers != NULL);
g_hash_table_foreach (providers, dump_country, NULL);
}
-
-
diff --git a/src/utils/nmn-mobile-providers.h b/src/libnm-gtk/nm-mobile-providers.h
similarity index 56%
rename from src/utils/nmn-mobile-providers.h
rename to src/libnm-gtk/nm-mobile-providers.h
index 584a7f0..a9536df 100644
--- a/src/utils/nmn-mobile-providers.h
+++ b/src/libnm-gtk/nm-mobile-providers.h
@@ -21,25 +21,29 @@
* Copyright (C) 2009 - 2010 Red Hat, Inc.
*/
-#ifndef NMN_MOBILE_PROVIDERS_H
-#define NMN_MOBILE_PROVIDERS_H
+/* WARNING: this file is private API between nm-applet and various GNOME
+ * bits; it may change without notice and is not guaranteed to be stable.
+ */
+
+#ifndef NM_MOBILE_PROVIDERS_H
+#define NM_MOBILE_PROVIDERS_H
#include <glib.h>
#include <glib-object.h>
-#define NMN_TYPE_MOBILE_PROVIDER (nmn_mobile_provider_get_type ())
-#define NMN_TYPE_MOBILE_ACCESS_METHOD (nmn_mobile_access_method_get_type ())
+#define NMA_TYPE_MOBILE_PROVIDER (nma_mobile_provider_get_type ())
+#define NMA_TYPE_MOBILE_ACCESS_METHOD (nma_mobile_access_method_get_type ())
typedef enum {
- NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN = 0,
- NMN_MOBILE_ACCESS_METHOD_TYPE_GSM,
- NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA
-} NmnMobileAccessMethodType;
+ NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN = 0,
+ NMA_MOBILE_ACCESS_METHOD_TYPE_GSM,
+ NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA
+} NMAMobileAccessMethodType;
typedef struct {
char *mcc;
char *mnc;
-} NmnGsmMccMnc;
+} NMAGsmMccMnc;
typedef struct {
char *name;
@@ -51,43 +55,43 @@ typedef struct {
char *gateway;
GSList *dns; /* GSList of 'char *' */
- /* Only used with NMN_PROVIDER_TYPE_GSM */
+ /* Only used with NMA_PROVIDER_TYPE_GSM */
char *gsm_apn;
- NmnMobileAccessMethodType type;
+ NMAMobileAccessMethodType type;
gint refs;
-} NmnMobileAccessMethod;
+} NMAMobileAccessMethod;
typedef struct {
char *name;
/* maps lang (char *) -> name (char *) */
GHashTable *lcl_names;
- GSList *methods; /* GSList of NmnMobileAccessMethod */
+ GSList *methods; /* GSList of NmaMobileAccessMethod */
- GSList *gsm_mcc_mnc; /* GSList of NmnGsmMccMnc */
+ GSList *gsm_mcc_mnc; /* GSList of NmaGsmMccMnc */
GSList *cdma_sid; /* GSList of guint32 */
gint refs;
-} NmnMobileProvider;
+} NMAMobileProvider;
-GType nmn_mobile_provider_get_type (void);
-GType nmn_mobile_access_method_get_type (void);
+GType nma_mobile_provider_get_type (void);
+GType nma_mobile_access_method_get_type (void);
-NmnMobileProvider *nmn_mobile_provider_ref (NmnMobileProvider *provider);
-void nmn_mobile_provider_unref (NmnMobileProvider *provider);
+NMAMobileProvider *nma_mobile_provider_ref (NMAMobileProvider *provider);
+void nma_mobile_provider_unref (NMAMobileProvider *provider);
-NmnMobileAccessMethod *nmn_mobile_access_method_ref (NmnMobileAccessMethod *method);
-void nmn_mobile_access_method_unref (NmnMobileAccessMethod *method);
+NMAMobileAccessMethod *nma_mobile_access_method_ref (NMAMobileAccessMethod *method);
+void nma_mobile_access_method_unref (NMAMobileAccessMethod *method);
/* Returns a hash table where keys are country names 'char *',
- values are a 'GSList *' of 'NmnMobileProvider *'.
+ values are a 'GSList *' of 'NmaMobileProvider *'.
Everything is destroyed with g_hash_table_destroy (). */
-GHashTable *nmn_mobile_providers_parse (GHashTable **out_ccs);
+GHashTable *nma_mobile_providers_parse (GHashTable **out_ccs);
-void nmn_mobile_providers_dump (GHashTable *providers);
+void nma_mobile_providers_dump (GHashTable *providers);
-#endif /* NMN_MOBILE_PROVIDERS_H */
+#endif /* NM_MOBILE_PROVIDERS_H */
diff --git a/src/libnm-gtk/nm-mobile-wizard.c b/src/libnm-gtk/nm-mobile-wizard.c
index 29a49d7..147270c 100644
--- a/src/libnm-gtk/nm-mobile-wizard.c
+++ b/src/libnm-gtk/nm-mobile-wizard.c
@@ -37,16 +37,16 @@
#include <nm-device-modem.h>
#include "nm-mobile-wizard.h"
-#include "nmn-mobile-providers.h"
+#include "nm-mobile-providers.h"
#include "nm-ui-utils.h"
#define DEVICE_TAG "device"
#define TYPE_TAG "setting-type"
static char *get_selected_country (NMAMobileWizard *self, gboolean *unlisted);
-static NmnMobileProvider *get_selected_provider (NMAMobileWizard *self);
-static NmnMobileAccessMethodType get_provider_unlisted_type (NMAMobileWizard *self);
-static NmnMobileAccessMethod *get_selected_method (NMAMobileWizard *self, gboolean *manual);
+static NMAMobileProvider *get_selected_provider (NMAMobileWizard *self);
+static NMAMobileAccessMethodType get_provider_unlisted_type (NMAMobileWizard *self);
+static NMAMobileAccessMethod *get_selected_method (NMAMobileWizard *self, gboolean *manual);
struct NMAMobileWizard {
GtkWidget *assistant;
@@ -54,7 +54,7 @@ struct NMAMobileWizard {
gpointer user_data;
GHashTable *providers;
GHashTable *country_codes;
- NmnMobileAccessMethodType method_type;
+ NMAMobileAccessMethodType method_type;
gboolean initial_method_type;
gboolean will_connect_after;
@@ -112,20 +112,20 @@ static void
assistant_closed (GtkButton *button, gpointer user_data)
{
NMAMobileWizard *self = user_data;
- NmnMobileProvider *provider;
- NmnMobileAccessMethod *method;
+ NMAMobileProvider *provider;
+ NMAMobileAccessMethod *method;
NMAMobileWizardAccessMethod *wiz_method;
- NmnMobileAccessMethodType method_type = self->method_type;
+ NMAMobileAccessMethodType method_type = self->method_type;
wiz_method = g_malloc0 (sizeof (NMAMobileWizardAccessMethod));
provider = get_selected_provider (self);
if (!provider) {
- if (method_type == NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
+ if (method_type == NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
method_type = get_provider_unlisted_type (self);
wiz_method->provider_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->provider_unlisted_entry)));
- if (method_type == NMN_MOBILE_ACCESS_METHOD_TYPE_GSM)
+ if (method_type == NMA_MOBILE_ACCESS_METHOD_TYPE_GSM)
wiz_method->gsm_apn = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->plan_unlisted_entry)));
} else {
gboolean manual = FALSE;
@@ -136,13 +136,13 @@ assistant_closed (GtkButton *button, gpointer user_data)
if (method->name)
wiz_method->plan_name = g_strdup (method->name);
method_type = method->type;
- if (method_type == NMN_MOBILE_ACCESS_METHOD_TYPE_GSM)
+ if (method_type == NMA_MOBILE_ACCESS_METHOD_TYPE_GSM)
wiz_method->gsm_apn = g_strdup (method->gsm_apn);
wiz_method->username = method->username ? g_strdup (method->username) : NULL;
wiz_method->password = method->password ? g_strdup (method->password) : NULL;
} else {
if (self->provider_only_cdma) {
- method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA;
+ method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA;
/* Take username and password from the first (only) method for CDMA only provider */
if (provider->methods) {
method = provider->methods->data;
@@ -151,17 +151,17 @@ assistant_closed (GtkButton *button, gpointer user_data)
}
}
else {
- method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_GSM;
+ method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_GSM;
wiz_method->gsm_apn = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->plan_unlisted_entry)));
}
}
}
switch (method_type) {
- case NMN_MOBILE_ACCESS_METHOD_TYPE_GSM:
+ case NMA_MOBILE_ACCESS_METHOD_TYPE_GSM:
wiz_method->devtype = NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS;
break;
- case NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA:
+ case NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA:
wiz_method->devtype = NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO;
break;
default:
@@ -172,7 +172,7 @@ assistant_closed (GtkButton *button, gpointer user_data)
(*(self->callback)) (self, FALSE, wiz_method, self->user_data);
if (provider)
- nmn_mobile_provider_unref (provider);
+ nma_mobile_provider_unref (provider);
g_free (wiz_method->provider_name);
g_free (wiz_method->plan_name);
g_free (wiz_method->username);
@@ -281,8 +281,8 @@ confirm_setup (NMAMobileWizard *self)
static void
confirm_prepare (NMAMobileWizard *self)
{
- NmnMobileProvider *provider = NULL;
- NmnMobileAccessMethod *method = NULL;
+ NMAMobileProvider *provider = NULL;
+ NMAMobileAccessMethod *method = NULL;
char *country = NULL;
gboolean manual = FALSE;
GString *str;
@@ -296,7 +296,7 @@ confirm_prepare (NMAMobileWizard *self)
str = g_string_new (NULL);
if (provider) {
g_string_append (str, provider->name);
- nmn_mobile_provider_unref (provider);
+ nma_mobile_provider_unref (provider);
} else {
const char *unlisted_provider;
@@ -353,11 +353,11 @@ confirm_prepare (NMAMobileWizard *self)
#define PLAN_COL_METHOD 1
#define PLAN_COL_MANUAL 2
-static NmnMobileAccessMethod *
+static NMAMobileAccessMethod *
get_selected_method (NMAMobileWizard *self, gboolean *manual)
{
GtkTreeModel *model;
- NmnMobileAccessMethod *method = NULL;
+ NMAMobileAccessMethod *method = NULL;
GtkTreeIter iter;
gboolean is_manual = FALSE;
@@ -376,7 +376,7 @@ get_selected_method (NMAMobileWizard *self, gboolean *manual)
if (manual)
*manual = is_manual;
if (method)
- nmn_mobile_access_method_unref (method);
+ nma_mobile_access_method_unref (method);
method = NULL;
}
@@ -388,12 +388,12 @@ plan_update_complete (NMAMobileWizard *self)
{
GtkAssistant *assistant = GTK_ASSISTANT (self->assistant);
gboolean is_manual = FALSE;
- NmnMobileAccessMethod *method;
+ NMAMobileAccessMethod *method;
method = get_selected_method (self, &is_manual);
if (method) {
gtk_assistant_set_page_complete (assistant, self->plan_page, TRUE);
- nmn_mobile_access_method_unref (method);
+ nma_mobile_access_method_unref (method);
} else {
const char *manual_apn;
@@ -406,7 +406,7 @@ plan_update_complete (NMAMobileWizard *self)
static void
plan_combo_changed (NMAMobileWizard *self)
{
- NmnMobileAccessMethod *method = NULL;
+ NMAMobileAccessMethod *method = NULL;
gboolean is_manual = FALSE;
method = get_selected_method (self, &is_manual);
@@ -420,7 +420,7 @@ plan_combo_changed (NMAMobileWizard *self)
}
if (method)
- nmn_mobile_access_method_unref (method);
+ nma_mobile_access_method_unref (method);
plan_update_complete (self);
}
@@ -428,7 +428,7 @@ plan_combo_changed (NMAMobileWizard *self)
static gboolean
plan_row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
{
- NmnMobileAccessMethod *method = NULL;
+ NMAMobileAccessMethod *method = NULL;
gboolean is_manual = FALSE;
gboolean draw_separator = FALSE;
@@ -439,7 +439,7 @@ plan_row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
if (!method && !is_manual)
draw_separator = TRUE;
if (method)
- nmn_mobile_access_method_unref (method);
+ nma_mobile_access_method_unref (method);
return draw_separator;
}
@@ -493,7 +493,7 @@ plan_setup (NMAMobileWizard *self)
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- self->plan_store = gtk_tree_store_new (3, G_TYPE_STRING, NMN_TYPE_MOBILE_ACCESS_METHOD, G_TYPE_BOOLEAN);
+ self->plan_store = gtk_tree_store_new (3, G_TYPE_STRING, NMA_TYPE_MOBILE_ACCESS_METHOD, G_TYPE_BOOLEAN);
self->plan_combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (self->plan_store));
gtk_label_set_mnemonic_widget (GTK_LABEL (label), self->plan_combo);
@@ -554,7 +554,7 @@ plan_setup (NMAMobileWizard *self)
static void
plan_prepare (NMAMobileWizard *self)
{
- NmnMobileProvider *provider;
+ NMAMobileProvider *provider;
GtkTreeIter method_iter;
gtk_tree_store_clear (self->plan_store);
@@ -565,9 +565,9 @@ plan_prepare (NMAMobileWizard *self)
guint32 count = 0;
for (iter = provider->methods; iter; iter = g_slist_next (iter)) {
- NmnMobileAccessMethod *method = iter->data;
+ NMAMobileAccessMethod *method = iter->data;
- if ( (self->method_type != NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
+ if ( (self->method_type != NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
&& (method->type != self->method_type))
continue;
@@ -581,7 +581,7 @@ plan_prepare (NMAMobileWizard *self)
-1);
count++;
}
- nmn_mobile_provider_unref (provider);
+ nma_mobile_provider_unref (provider);
/* Draw the separator */
if (count)
@@ -634,13 +634,13 @@ providers_search_func (GtkTreeModel *model,
return unmatched;
}
-static NmnMobileProvider *
+static NMAMobileProvider *
get_selected_provider (NMAMobileWizard *self)
{
GtkTreeSelection *selection;
GtkTreeModel *model = NULL;
GtkTreeIter iter;
- NmnMobileProvider *provider = NULL;
+ NMAMobileProvider *provider = NULL;
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->providers_view_radio)))
return NULL;
@@ -663,12 +663,12 @@ providers_update_complete (NMAMobileWizard *self)
use_view = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->providers_view_radio));
if (use_view) {
- NmnMobileProvider *provider;
+ NMAMobileProvider *provider;
provider = get_selected_provider (self);
gtk_assistant_set_page_complete (assistant, self->providers_page, !!provider);
if (provider)
- nmn_mobile_provider_unref (provider);
+ nma_mobile_provider_unref (provider);
} else {
const char *manual_provider;
@@ -722,16 +722,16 @@ providers_radio_toggled (GtkToggleButton *button, gpointer user_data)
providers_update_complete (self);
}
-static NmnMobileAccessMethodType
+static NMAMobileAccessMethodType
get_provider_unlisted_type (NMAMobileWizard *self)
{
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (self->provider_unlisted_type_combo))) {
case 0:
- return NMN_MOBILE_ACCESS_METHOD_TYPE_GSM;
+ return NMA_MOBILE_ACCESS_METHOD_TYPE_GSM;
case 1:
- return NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA;
+ return NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA;
default:
- return NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN;
+ return NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN;
}
}
@@ -754,7 +754,7 @@ providers_setup (NMAMobileWizard *self)
g_signal_connect (self->providers_view_radio, "toggled", G_CALLBACK (providers_radio_toggled), self);
gtk_box_pack_start (GTK_BOX (vbox), self->providers_view_radio, FALSE, TRUE, 0);
- self->providers_store = gtk_tree_store_new (2, G_TYPE_STRING, NMN_TYPE_MOBILE_PROVIDER);
+ self->providers_store = gtk_tree_store_new (2, G_TYPE_STRING, NMA_TYPE_MOBILE_PROVIDER);
self->providers_sort = GTK_TREE_MODEL_SORT (gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (self->providers_store)));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->providers_sort),
@@ -836,7 +836,7 @@ providers_setup (NMAMobileWizard *self)
1, 2, 1, 2, 0, 0, 6, 6);
/* Only show the CDMA/GSM combo if we don't know the device type */
- if (self->method_type != NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
+ if (self->method_type != NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
gtk_widget_hide (self->provider_unlisted_type_combo);
self->providers_idx = gtk_assistant_append_page (GTK_ASSISTANT (self->assistant), vbox);
@@ -869,16 +869,16 @@ providers_prepare (NMAMobileWizard *self)
g_free (country);
for (piter = providers; piter; piter = g_slist_next (piter)) {
- NmnMobileProvider *provider = piter->data;
+ NMAMobileProvider *provider = piter->data;
GtkTreeIter provider_iter;
/* Ignore providers that don't match the current device type */
- if (self->method_type != NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN) {
+ if (self->method_type != NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN) {
GSList *miter;
guint32 count = 0;
for (miter = provider->methods; miter; miter = g_slist_next (miter)) {
- NmnMobileAccessMethod *method = miter->data;
+ NMAMobileAccessMethod *method = miter->data;
if (self->method_type == method->type)
count++;
@@ -929,7 +929,7 @@ done:
providers_update_complete (self);
/* If there's already a selected device, hide the GSM/CDMA radios */
- if (self->method_type != NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
+ if (self->method_type != NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
gtk_widget_hide (self->provider_unlisted_type_combo);
else
gtk_widget_show (self->provider_unlisted_type_combo);
@@ -1361,9 +1361,9 @@ intro_combo_changed (NMAMobileWizard *self)
self->dev_desc = g_strdup (nma_utils_get_device_description (selected));
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (selected));
if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS)
- self->method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_GSM;
+ self->method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_GSM;
else if (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)
- self->method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA;
+ self->method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA;
else
g_warning ("%s: unknown modem capabilities 0x%X", __func__, caps);
@@ -1526,39 +1526,39 @@ forward_func (gint current_page, gpointer user_data)
NMAMobileWizard *self = user_data;
if (current_page == self->providers_idx) {
- NmnMobileAccessMethodType method_type = self->method_type;
+ NMAMobileAccessMethodType method_type = self->method_type;
/* If the provider is unlisted, we can skip ahead of the user's
* access technology is CDMA.
*/
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->provider_unlisted_radio))) {
- if (method_type == NMN_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
+ if (method_type == NMA_MOBILE_ACCESS_METHOD_TYPE_UNKNOWN)
method_type = get_provider_unlisted_type (self);
} else {
/* Or, if the provider is only CDMA, then we can also skip ahead */
- NmnMobileProvider *provider;
+ NMAMobileProvider *provider;
GSList *iter;
gboolean gsm = FALSE, cdma = FALSE;
provider = get_selected_provider (self);
if (provider) {
for (iter = provider->methods; iter; iter = g_slist_next (iter)) {
- NmnMobileAccessMethod *method = iter->data;
+ NMAMobileAccessMethod *method = iter->data;
- if (method->type == NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA)
+ if (method->type == NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA)
cdma = TRUE;
- else if (method->type == NMN_MOBILE_ACCESS_METHOD_TYPE_GSM)
+ else if (method->type == NMA_MOBILE_ACCESS_METHOD_TYPE_GSM)
gsm = TRUE;
}
- nmn_mobile_provider_unref (provider);
+ nma_mobile_provider_unref (provider);
if (cdma && !gsm)
- method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA;
+ method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA;
}
}
/* Skip to the confirm page if we know its CDMA */
- if (method_type == NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA) {
+ if (method_type == NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA) {
self->provider_only_cdma = TRUE;
return self->confirm_idx;
} else
@@ -1616,7 +1616,7 @@ nma_mobile_wizard_new (GtkWindow *parent,
self = g_malloc0 (sizeof (NMAMobileWizard));
g_return_val_if_fail (self != NULL, NULL);
- self->providers = nmn_mobile_providers_parse (&(self->country_codes));
+ self->providers = nma_mobile_providers_parse (&(self->country_codes));
if (!self->providers || !self->country_codes) {
nma_mobile_wizard_destroy (self);
return NULL;
@@ -1631,9 +1631,9 @@ nma_mobile_wizard_new (GtkWindow *parent,
self->callback = cb;
self->user_data = user_data;
if (modem_caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS)
- self->method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_GSM;
+ self->method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_GSM;
else if (modem_caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)
- self->method_type = NMN_MOBILE_ACCESS_METHOD_TYPE_CDMA;
+ self->method_type = NMA_MOBILE_ACCESS_METHOD_TYPE_CDMA;
if (self->method_type)
self->initial_method_type = TRUE; /* Skip device selection */
@@ -1701,5 +1701,3 @@ nma_mobile_wizard_destroy (NMAMobileWizard *self)
g_free (self);
}
-
-
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 1c7d31a..1a3308c 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -4,14 +4,11 @@ noinst_LTLIBRARIES = libutils.la
libutils_la_SOURCES = \
utils.c \
- utils.h \
- nmn-mobile-providers.h \
- nmn-mobile-providers.c
+ utils.h
libutils_la_CPPFLAGS = \
$(GTK_CFLAGS) \
$(NMA_CFLAGS) \
- -DDATADIR=\""$(datadir)"\" \
$(DISABLE_DEPRECATED) \
-I${top_srcdir}/src
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]