[network-manager-applet/aleksander/mobile-providers: 5/11] libnm-gtk, mobile-providers: use 'G_DEFINE_BOXED_TYPE' to create the types



commit bbea9d17f6912e824b2c3758f8a5725edc3997dd
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Nov 23 12:34:49 2012 +0100

    libnm-gtk,mobile-providers: use 'G_DEFINE_BOXED_TYPE' to create the types

 src/libnm-gtk/nm-mobile-providers.c |   54 +++++++++-------------------------
 1 files changed, 15 insertions(+), 39 deletions(-)
---
diff --git a/src/libnm-gtk/nm-mobile-providers.c b/src/libnm-gtk/nm-mobile-providers.c
index 9fdea77..5086531 100644
--- a/src/libnm-gtk/nm-mobile-providers.c
+++ b/src/libnm-gtk/nm-mobile-providers.c
@@ -81,6 +81,11 @@ mcc_mnc_free (NMAGsmMccMnc *m)
 /******************************************************************************/
 /* Access method type */
 
+G_DEFINE_BOXED_TYPE (NMAMobileAccessMethod,
+                     nma_mobile_access_method,
+                     nma_mobile_access_method_ref,
+                     nma_mobile_access_method_unref)
+
 struct _NMAMobileAccessMethod {
     char *name;
     /* maps lang (char *) -> name (char *) */
@@ -235,22 +240,14 @@ nma_mobile_access_method_get_method_type (NMAMobileAccessMethod *method)
     return method->type;
 }
 
-GType
-nma_mobile_access_method_get_type (void)
-{
-    static GType type = 0;
-
-    if (G_UNLIKELY (type == 0)) {
-        type = g_boxed_type_register_static ("NMAMobileAccessMethod",
-                                             (GBoxedCopyFunc) nma_mobile_access_method_ref,
-                                             (GBoxedFreeFunc) nma_mobile_access_method_unref);
-    }
-    return type;
-}
-
 /******************************************************************************/
 /* Mobile provider type */
 
+G_DEFINE_BOXED_TYPE (NMAMobileProvider,
+                     nma_mobile_provider,
+                     nma_mobile_provider_ref,
+                     nma_mobile_provider_unref)
+
 struct _NMAMobileProvider {
     char *name;
     /* maps lang (char *) -> name (char *) */
@@ -363,22 +360,14 @@ nma_mobile_provider_get_cdma_sid (NMAMobileProvider *provider)
     return provider->cdma_sid;
 }
 
-GType
-nma_mobile_provider_get_type (void)
-{
-    static GType type = 0;
-
-    if (G_UNLIKELY (type == 0)) {
-        type = g_boxed_type_register_static ("NMAMobileProvider",
-                                             (GBoxedCopyFunc) nma_mobile_provider_ref,
-                                             (GBoxedFreeFunc) nma_mobile_provider_unref);
-    }
-    return type;
-}
-
 /******************************************************************************/
 /* Country Info type */
 
+G_DEFINE_BOXED_TYPE (NMACountryInfo,
+                     nma_country_info,
+                     nma_country_info_ref,
+                     nma_country_info_unref)
+
 struct _NMACountryInfo {
     char *country_code;
     char *country_name;
@@ -460,19 +449,6 @@ nma_country_info_get_providers (NMACountryInfo *country_info)
     return country_info->providers;
 }
 
-GType
-nma_country_info_get_type (void)
-{
-    static GType type = 0;
-
-    if (G_UNLIKELY (type == 0)) {
-        type = g_boxed_type_register_static ("NMACountryInfo",
-                                             (GBoxedCopyFunc) nma_country_info_ref,
-                                             (GBoxedFreeFunc) nma_country_info_unref);
-    }
-    return type;
-}
-
 /******************************************************************************/
 /* XML Parser for iso_3166.xml */
 



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