libmm-glib,network-timezone: improve documentation

This commit is contained in:
Aleksander Morgado
2012-10-03 16:41:12 +02:00
parent 487090607d
commit dc4656cead
3 changed files with 97 additions and 28 deletions

View File

@@ -476,19 +476,21 @@ mm_modem_time_get_type
<FILE>mm-network-timezone</FILE> <FILE>mm-network-timezone</FILE>
<TITLE>MMNetworkTimezone</TITLE> <TITLE>MMNetworkTimezone</TITLE>
MMNetworkTimezone MMNetworkTimezone
MMNetworkTimezoneClass
MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN
MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN
mm_network_timezone_get_dictionary MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN
<SUBSECTION Getters>
mm_network_timezone_get_offset
mm_network_timezone_get_dst_offset mm_network_timezone_get_dst_offset
mm_network_timezone_get_leap_seconds mm_network_timezone_get_leap_seconds
mm_network_timezone_get_offset <SUBSECTION Private>
mm_network_timezone_new mm_network_timezone_new
mm_network_timezone_new_from_dictionary mm_network_timezone_new_from_dictionary
mm_network_timezone_set_dst_offset mm_network_timezone_set_dst_offset
mm_network_timezone_set_leap_seconds mm_network_timezone_set_leap_seconds
mm_network_timezone_get_dictionary
mm_network_timezone_set_offset mm_network_timezone_set_offset
<SUBSECTION Standard> <SUBSECTION Standard>
MMNetworkTimezoneClass
MMNetworkTimezonePrivate MMNetworkTimezonePrivate
MM_IS_NETWORK_TIMEZONE MM_IS_NETWORK_TIMEZONE
MM_IS_NETWORK_TIMEZONE_CLASS MM_IS_NETWORK_TIMEZONE_CLASS

View File

@@ -18,6 +18,18 @@
#include "mm-errors-types.h" #include "mm-errors-types.h"
#include "mm-network-timezone.h" #include "mm-network-timezone.h"
/**
* SECTION: mm-network-timezone
* @title: MMNetworkTimezone
* @short_description: Helper object to handle network timezone information.
*
* The #MMNetworkTimezone is an object handling the timezone information
* reported by the network.
*
* This object is retrieved with either mm_modem_time_peek_network_timezone()
* or mm_modem_time_get_network_timezone().
*/
G_DEFINE_TYPE (MMNetworkTimezone, mm_network_timezone, G_TYPE_OBJECT); G_DEFINE_TYPE (MMNetworkTimezone, mm_network_timezone, G_TYPE_OBJECT);
struct _MMNetworkTimezonePrivate { struct _MMNetworkTimezonePrivate {
@@ -28,6 +40,14 @@ struct _MMNetworkTimezonePrivate {
/*****************************************************************************/ /*****************************************************************************/
/**
* mm_network_timezone_get_offset:
* @self: a #MMNetworkTimezone.
*
* Gets the timezone offset (in minutes) reported by the network.
*
* Returns: the offset, or %MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN if unknown.
*/
gint gint
mm_network_timezone_get_offset (MMNetworkTimezone *self) mm_network_timezone_get_offset (MMNetworkTimezone *self)
{ {
@@ -37,26 +57,6 @@ mm_network_timezone_get_offset (MMNetworkTimezone *self)
return self->priv->offset; return self->priv->offset;
} }
gint
mm_network_timezone_get_dst_offset (MMNetworkTimezone *self)
{
g_return_val_if_fail (MM_IS_NETWORK_TIMEZONE (self),
MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN);
return self->priv->dst_offset;
}
gint
mm_network_timezone_get_leap_seconds (MMNetworkTimezone *self)
{
g_return_val_if_fail (MM_IS_NETWORK_TIMEZONE (self),
MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN);
return self->priv->leap_seconds;
}
/*****************************************************************************/
void void
mm_network_timezone_set_offset (MMNetworkTimezone *self, mm_network_timezone_set_offset (MMNetworkTimezone *self,
gint offset) gint offset)
@@ -66,6 +66,26 @@ mm_network_timezone_set_offset (MMNetworkTimezone *self,
self->priv->offset = offset; self->priv->offset = offset;
} }
/*****************************************************************************/
/**
* mm_network_timezone_get_dst_offset:
* @self: a #MMNetworkTimezone.
*
* Gets the timezone offset due to daylight saving time (in minutes) reported by
* the network.
*
* Returns: the offset, or %MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN if unknown.
*/
gint
mm_network_timezone_get_dst_offset (MMNetworkTimezone *self)
{
g_return_val_if_fail (MM_IS_NETWORK_TIMEZONE (self),
MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN);
return self->priv->dst_offset;
}
void void
mm_network_timezone_set_dst_offset (MMNetworkTimezone *self, mm_network_timezone_set_dst_offset (MMNetworkTimezone *self,
gint dst_offset) gint dst_offset)
@@ -75,6 +95,25 @@ mm_network_timezone_set_dst_offset (MMNetworkTimezone *self,
self->priv->dst_offset = dst_offset; self->priv->dst_offset = dst_offset;
} }
/*****************************************************************************/
/**
* mm_network_timezone_get_leap_seconds:
* @self: a #MMNetworkTimezone.
*
* Gets the number of leap seconds (TAI-UTC), as reported by the network.
*
* Returns: the number of leap seconds, or %MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN if unknown.
*/
gint
mm_network_timezone_get_leap_seconds (MMNetworkTimezone *self)
{
g_return_val_if_fail (MM_IS_NETWORK_TIMEZONE (self),
MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN);
return self->priv->leap_seconds;
}
void void
mm_network_timezone_set_leap_seconds (MMNetworkTimezone *self, mm_network_timezone_set_leap_seconds (MMNetworkTimezone *self,
gint leap_seconds) gint leap_seconds)

View File

@@ -32,32 +32,58 @@ G_BEGIN_DECLS
#define MM_IS_NETWORK_TIMEZONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_NETWORK_TIMEZONE)) #define MM_IS_NETWORK_TIMEZONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_NETWORK_TIMEZONE))
#define MM_NETWORK_TIMEZONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_NETWORK_TIMEZONE, MMNetworkTimezoneClass)) #define MM_NETWORK_TIMEZONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_NETWORK_TIMEZONE, MMNetworkTimezoneClass))
/**
* MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN:
*
* Identifier for an unknown timezone offset.
*/
#define MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN G_MAXINT32 #define MM_NETWORK_TIMEZONE_OFFSET_UNKNOWN G_MAXINT32
/**
* MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN:
*
* Identifier for an unknown leap seconds value.
*/
#define MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN G_MAXINT32 #define MM_NETWORK_TIMEZONE_LEAP_SECONDS_UNKNOWN G_MAXINT32
typedef struct _MMNetworkTimezone MMNetworkTimezone; typedef struct _MMNetworkTimezone MMNetworkTimezone;
typedef struct _MMNetworkTimezoneClass MMNetworkTimezoneClass; typedef struct _MMNetworkTimezoneClass MMNetworkTimezoneClass;
typedef struct _MMNetworkTimezonePrivate MMNetworkTimezonePrivate; typedef struct _MMNetworkTimezonePrivate MMNetworkTimezonePrivate;
/**
* MMNetworkTimezone:
*
* The #MMNetworkTimezone structure contains private data and should
* only be accessed using the provided API.
*/
struct _MMNetworkTimezone { struct _MMNetworkTimezone {
/*< private >*/
GObject parent; GObject parent;
MMNetworkTimezonePrivate *priv; MMNetworkTimezonePrivate *priv;
}; };
struct _MMNetworkTimezoneClass { struct _MMNetworkTimezoneClass {
/*< private >*/
GObjectClass parent; GObjectClass parent;
}; };
GType mm_network_timezone_get_type (void); GType mm_network_timezone_get_type (void);
MMNetworkTimezone *mm_network_timezone_new (void);
MMNetworkTimezone *mm_network_timezone_new_from_dictionary (GVariant *dictionary,
GError **error);
gint32 mm_network_timezone_get_offset (MMNetworkTimezone *self); gint32 mm_network_timezone_get_offset (MMNetworkTimezone *self);
gint32 mm_network_timezone_get_dst_offset (MMNetworkTimezone *self); gint32 mm_network_timezone_get_dst_offset (MMNetworkTimezone *self);
gint32 mm_network_timezone_get_leap_seconds (MMNetworkTimezone *self); gint32 mm_network_timezone_get_leap_seconds (MMNetworkTimezone *self);
/*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */
#if defined (_LIBMM_INSIDE_MM) || \
defined (_LIBMM_INSIDE_MMCLI) || \
defined (LIBMM_GLIB_COMPILATION)
MMNetworkTimezone *mm_network_timezone_new (void);
MMNetworkTimezone *mm_network_timezone_new_from_dictionary (GVariant *dictionary,
GError **error);
void mm_network_timezone_set_offset (MMNetworkTimezone *self, void mm_network_timezone_set_offset (MMNetworkTimezone *self,
gint offset); gint offset);
void mm_network_timezone_set_dst_offset (MMNetworkTimezone *self, void mm_network_timezone_set_dst_offset (MMNetworkTimezone *self,
@@ -67,6 +93,8 @@ void mm_network_timezone_set_leap_seconds (MMNetworkTimezone *self,
GVariant *mm_network_timezone_get_dictionary (MMNetworkTimezone *self); GVariant *mm_network_timezone_get_dictionary (MMNetworkTimezone *self);
#endif
G_END_DECLS G_END_DECLS
#endif /* MM_NETWORK_TIMEZONE_H */ #endif /* MM_NETWORK_TIMEZONE_H */