Add a boxed type for GDate. (#301787, Tim-Philipp Müller)

2005-04-29  Matthias Clasen  <mclasen@redhat.com>

	* gobject.symbols:
	* gboxed.h (G_TYPE_DATE):
	* gboxed.c: Add a boxed type for GDate. (#301787, Tim-Philipp
	Müller)
This commit is contained in:
Matthias Clasen 2005-04-29 18:33:41 +00:00 committed by Matthias Clasen
parent 98b40e24de
commit a82bcb3107
7 changed files with 43 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-04-29 Matthias Clasen <mclasen@redhat.com>
* gobject/tmpl/gboxed.sgml:
* gobject/gobject-sections.txt: Add G_TYPE_DATE.
2005-04-23 Stefan Kost <ensonic@users.sf.net>
* gobject/tut_gtype.xml:

View File

@ -309,6 +309,7 @@ g_boxed_type_register_static
g_pointer_type_register_static
<SUBSECTION>
G_TYPE_DATE
G_TYPE_GSTRING
G_TYPE_STRV
GStrv

View File

@ -75,6 +75,13 @@ pointer type with name @name.
@Returns: a new %G_TYPE_POINTER derived type id for @name.
<!-- ##### MACRO G_TYPE_DATE ##### -->
<para>
The #GType for #GDate.
</para>
<!-- ##### MACRO G_TYPE_GSTRING ##### -->
<para>
The #GType for #GString.

View File

@ -1,3 +1,10 @@
2005-04-29 Matthias Clasen <mclasen@redhat.com>
* gobject.symbols:
* gboxed.h (G_TYPE_DATE):
* gboxed.c: Add a boxed type for GDate. (#301787, Tim-Philipp
Müller)
2005-03-25 Matthias Clasen <mclasen@redhat.com>
* gparam.c (param_spec_ht_lookup): Don't do the second

View File

@ -93,6 +93,14 @@ value_free (gpointer boxed)
g_free (value);
}
static gpointer
gdate_copy (gpointer boxed)
{
const GDate *date = (const GDate*) boxed;
return g_date_new_julian (g_date_get_julian (date));
}
static gpointer
gstring_copy (gpointer boxed)
{
@ -172,6 +180,18 @@ g_value_array_get_type (void)
return type_id;
}
GType
g_date_get_type (void)
{
static GType type_id = 0;
if (!type_id)
type_id = g_boxed_type_register_static ("GDate",
(GBoxedCopyFunc) gdate_copy,
(GBoxedFreeFunc) g_date_free);
return type_id;
}
GType
g_strv_get_type (void)
{

View File

@ -60,6 +60,7 @@ GType g_boxed_type_register_static (const gchar *name,
#define G_TYPE_CLOSURE (g_closure_get_type ())
#define G_TYPE_VALUE (g_value_get_type ())
#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
#define G_TYPE_DATE (g_date_get_type ())
#define G_TYPE_STRV (g_strv_get_type ())
#define G_TYPE_GSTRING (g_gstring_get_type ())
@ -73,6 +74,7 @@ void g_value_set_boxed_take_ownership (GValue *value,
GType g_closure_get_type (void) G_GNUC_CONST;
GType g_value_get_type (void) G_GNUC_CONST;
GType g_value_array_get_type (void) G_GNUC_CONST;
GType g_date_get_type (void) G_GNUC_CONST;
GType g_strv_get_type (void) G_GNUC_CONST;
GType g_gstring_get_type (void) G_GNUC_CONST;

View File

@ -16,6 +16,7 @@
g_boxed_copy
g_boxed_free
g_boxed_type_register_static
g_date_get_type G_GNUC_CONST
g_gstring_get_type G_GNUC_CONST
g_strv_get_type G_GNUC_CONST
g_closure_get_type G_GNUC_CONST