Box GPollFD to make it introspectable
authorMartin Pitt <martinpitt@gnome.org>
Wed, 24 Oct 2012 14:30:37 +0000 (16:30 +0200)
committerMartin Pitt <martinpitt@gnome.org>
Mon, 5 Nov 2012 13:41:31 +0000 (14:41 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=686797

docs/reference/gobject/gobject-sections.txt
gobject/gboxed.c
gobject/glib-types.h
gobject/gobject.symbols

index abcf248..5d142dd 100644 (file)
@@ -373,6 +373,7 @@ G_TYPE_KEY_FILE
 G_TYPE_MAIN_CONTEXT
 G_TYPE_MAIN_LOOP
 G_TYPE_SOURCE
+G_TYPE_POLLFD
 GStrv
 
 <SUBSECTION Standard>
@@ -398,6 +399,7 @@ g_gtype_get_type
 g_main_context_get_type
 g_main_loop_get_type
 g_source_get_type
+g_pollfd_get_type
 g_bytes_get_type
 g_key_file_get_type
 </SECTION>
index b5c6029..c45e1cd 100644 (file)
@@ -77,6 +77,15 @@ value_free (GValue *value)
   g_free (value);
 }
 
+static GPollFD *
+pollfd_copy (GPollFD *src)
+{
+  GPollFD *dest = g_new0 (GPollFD, 1);
+  /* just a couple of integers */
+  memcpy (dest, src, sizeof (GPollFD));
+  return dest;
+}
+
 void
 _g_boxed_type_init (void)
 {
@@ -150,6 +159,7 @@ G_DEFINE_BOXED_TYPE (GKeyFile, g_key_file, g_key_file_ref, g_key_file_unref)
 G_DEFINE_BOXED_TYPE (GMainLoop, g_main_loop, g_main_loop_ref, g_main_loop_unref)
 G_DEFINE_BOXED_TYPE (GMainContext, g_main_context, g_main_context_ref, g_main_context_unref)
 G_DEFINE_BOXED_TYPE (GSource, g_source, g_source_ref, g_source_unref)
+G_DEFINE_BOXED_TYPE (GPollFD, g_pollfd, pollfd_copy, g_free)
 
 /* This one can't use G_DEFINE_BOXED_TYPE (GStrv, g_strv, g_strdupv, g_strfreev) */
 GType
index 50bc033..27a515f 100644 (file)
@@ -228,6 +228,15 @@ typedef gsize GType;
 #define G_TYPE_SOURCE (g_source_get_type ())
 
 /**
+ * G_TYPE_POLLFD:
+ *
+ * The #GType for a boxed type holding a #GPollFD.
+ *
+ * Since: 2.36
+ */
+#define G_TYPE_POLLFD (g_pollfd_get_type ())
+
+/**
  * G_TYPE_KEY_FILE:
  *
  * The #GType for a boxed type holding a #GKeyFile.
@@ -261,6 +270,8 @@ GLIB_AVAILABLE_IN_2_30
 GType   g_main_context_get_type    (void) G_GNUC_CONST;
 GLIB_AVAILABLE_IN_2_30
 GType   g_source_get_type          (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_36
+GType   g_pollfd_get_type          (void) G_GNUC_CONST;
 
 GLIB_DEPRECATED_FOR('G_TYPE_VARIANT')
 GType   g_variant_get_gtype        (void) G_GNUC_CONST;
index b5fa09e..1a052fd 100644 (file)
@@ -33,6 +33,7 @@ g_key_file_get_type
 g_main_loop_get_type
 g_main_context_get_type
 g_source_get_type
+g_pollfd_get_type
 g_closure_get_type
 g_value_get_type
 g_value_array_get_type