[gnome-builder] egg: fix gir/vapi generation for additional egg types



commit 2a0d6a09709ca2655380b4258906279e8998137a
Author: Christian Hergert <christian hergert me>
Date:   Sun Feb 21 14:13:56 2016 -0800

    egg: fix gir/vapi generation for additional egg types

 contrib/egg/egg-counter.c                 |    8 +++++++
 contrib/egg/egg-heap.c                    |   29 +++++++++++++++++++++++++
 contrib/egg/egg-heap.h                    |    8 ++++--
 contrib/egg/egg-state-machine-action.c    |   33 ++++++++++++++++++----------
 contrib/egg/egg-state-machine-action.h    |    5 ++++
 contrib/egg/egg-state-machine-buildable.c |    3 ++
 contrib/egg/egg-state-machine.c           |    5 +---
 contrib/egg/egg-widget-action-group.c     |    9 ++++++++
 8 files changed, 81 insertions(+), 19 deletions(-)
---
diff --git a/contrib/egg/egg-counter.c b/contrib/egg/egg-counter.c
index cda05d4..e730eba 100644
--- a/contrib/egg/egg-counter.c
+++ b/contrib/egg/egg-counter.c
@@ -434,6 +434,14 @@ egg_counter_arena_unref (EggCounterArena *arena)
     _egg_counter_arena_destroy (arena);
 }
 
+/**
+ * egg_counter_arena_foreach:
+ * @arena: An #EggCounterArena
+ * @func: (scope call): A callback to execute
+ * @user_data: user data for @func
+ *
+ * Calls @func for every counter found in @area.
+ */
 void
 egg_counter_arena_foreach (EggCounterArena       *arena,
                            EggCounterForeachFunc  func,
diff --git a/contrib/egg/egg-heap.c b/contrib/egg/egg-heap.c
index 027de1c..cc45bf1 100644
--- a/contrib/egg/egg-heap.c
+++ b/contrib/egg/egg-heap.c
@@ -80,6 +80,8 @@
  * Section 10 - Heaps and Priority Queues.
  */
 
+G_DEFINE_BOXED_TYPE (EggHeap, egg_heap, egg_heap_ref, egg_heap_unref)
+
 typedef struct _EggHeapReal EggHeapReal;
 
 struct _EggHeapReal
@@ -105,6 +107,18 @@ struct _EggHeapReal
       memcpy (heap_index (h, b), (h)->tmp, (h)->element_size);          \
  } G_STMT_END
 
+/**
+ * egg_heap_new:
+ * @element_size: the size of each element in the heap
+ * @compare_func: (scope async): a function to compare to elements
+ *
+ * Creates a new #EggHeap. A heap is a tree-like structure stored in
+ * an array that is not fully sorted, but head is guaranteed to be either
+ * the max, or min value based on @compare_func. This is also known as
+ * a priority queue.
+ *
+ * Returns: (transfer full): A newly allocated #EggHeap
+ */
 EggHeap *
 egg_heap_new (guint        element_size,
               GCompareFunc compare_func)
@@ -125,6 +139,14 @@ egg_heap_new (guint        element_size,
     return (EggHeap *)real;
 }
 
+/**
+ * egg_heap_ref:
+ * @heap: An #EggHeap
+ *
+ * Increments the reference count of @heap by one.
+ *
+ * Returns: (transfer full): @heap
+ */
 EggHeap *
 egg_heap_ref (EggHeap *heap)
 {
@@ -148,6 +170,13 @@ egg_heap_real_free (EggHeapReal *real)
   g_free (real);
 }
 
+/**
+ * egg_heap_unref:
+ * @heap: (transfer full): An #EggHeap
+ *
+ * Decrements the reference count of @heap by one, freeing the structure
+ * when the reference count reaches zero.
+ */
 void
 egg_heap_unref (EggHeap *heap)
 {
diff --git a/contrib/egg/egg-heap.h b/contrib/egg/egg-heap.h
index 826fcc7..f5e841d 100644
--- a/contrib/egg/egg-heap.h
+++ b/contrib/egg/egg-heap.h
@@ -19,10 +19,11 @@
 #ifndef EGG_HEAP_H
 #define EGG_HEAP_H
 
-#include <glib.h>
+#include <glib-object.h>
 
 G_BEGIN_DECLS
 
+#define EGG_TYPE_HEAP            (egg_heap_get_type())
 #define egg_heap_insert_val(h,v) egg_heap_insert_vals(h,&(v),1)
 #define egg_heap_index(h,t,i)    (((t*)(void*)(h)->data)[i])
 #define egg_heap_peek(h,t)       egg_heap_index(h,t,0)
@@ -31,10 +32,11 @@ typedef struct _EggHeap EggHeap;
 
 struct _EggHeap
 {
-   gchar *data;
-   guint  len;
+  gchar *data;
+  guint  len;
 };
 
+GType      egg_heap_get_type      (void);
 EggHeap   *egg_heap_new           (guint           element_size,
                                    GCompareFunc    compare_func);
 EggHeap   *egg_heap_ref           (EggHeap        *heap);
diff --git a/contrib/egg/egg-state-machine-action.c b/contrib/egg/egg-state-machine-action.c
index c914cca..4353e22 100644
--- a/contrib/egg/egg-state-machine-action.c
+++ b/contrib/egg/egg-state-machine-action.c
@@ -36,11 +36,11 @@ G_DEFINE_TYPE_WITH_CODE (EggStateMachineAction, egg_state_machine_action, G_TYPE
 
 enum {
   PROP_0,
-  PROP_NAME,
   PROP_STATE_MACHINE,
   LAST_PROP,
 
   PROP_ENABLED,
+  PROP_NAME,
   PROP_PARAMETER_TYPE,
   PROP_STATE,
   PROP_STATE_TYPE,
@@ -202,10 +202,6 @@ egg_state_machine_action_set_property (GObject      *object,
       egg_state_machine_action_set_state_machine (self, g_value_get_object (value));
       break;
 
-    case PROP_NAME:
-      self->name = g_value_dup_string (value);
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -220,13 +216,6 @@ egg_state_machine_action_class_init (EggStateMachineActionClass *klass)
   object_class->get_property = egg_state_machine_action_get_property;
   object_class->set_property = egg_state_machine_action_set_property;
 
-  properties [PROP_NAME] =
-    g_param_spec_string ("name",
-                         "Name",
-                         "The name of the action",
-                         NULL,
-                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
-
   properties [PROP_STATE_MACHINE] =
     g_param_spec_object ("state-machine",
                          "State Machine",
@@ -236,6 +225,7 @@ egg_state_machine_action_class_init (EggStateMachineActionClass *klass)
 
   g_object_class_install_properties (object_class, LAST_PROP, properties);
 
+  g_object_class_override_property (object_class, PROP_NAME, "name");
   g_object_class_override_property (object_class, PROP_PARAMETER_TYPE, "parameter-type");
   g_object_class_override_property (object_class, PROP_ENABLED, "enabled");
   g_object_class_override_property (object_class, PROP_STATE_TYPE, "state-type");
@@ -257,3 +247,22 @@ action_iface_init (GActionInterface *iface)
   iface->get_state = egg_state_machine_action_get_state;
   iface->activate = egg_state_machine_action_activate;
 }
+
+/**
+ * egg_state_machine_action_new:
+ *
+ * Returns: (transfer full): A newly allocated #EggStateMachineAction
+ */
+GAction *
+egg_state_machine_action_new (EggStateMachine *machine,
+                              const gchar     *name)
+{
+  EggStateMachineAction *self;
+
+  self = g_object_new (EGG_TYPE_STATE_MACHINE_ACTION,
+                       "state-machine", machine,
+                       NULL);
+  self->name = g_strdup (name);
+
+  return G_ACTION (self);
+}
diff --git a/contrib/egg/egg-state-machine-action.h b/contrib/egg/egg-state-machine-action.h
index c14202d..976906b 100644
--- a/contrib/egg/egg-state-machine-action.h
+++ b/contrib/egg/egg-state-machine-action.h
@@ -21,12 +21,17 @@
 
 #include <gio/gio.h>
 
+#include "egg-state-machine.h"
+
 G_BEGIN_DECLS
 
 #define EGG_TYPE_STATE_MACHINE_ACTION (egg_state_machine_action_get_type())
 
 G_DECLARE_FINAL_TYPE (EggStateMachineAction, egg_state_machine_action, EGG, STATE_MACHINE_ACTION, GObject)
 
+GAction *egg_state_machine_action_new (EggStateMachine *machine,
+                                       const gchar     *name);
+
 G_END_DECLS
 
 #endif /* EGG_STATE_MACHINE_ACTION_H */
diff --git a/contrib/egg/egg-state-machine-buildable.c b/contrib/egg/egg-state-machine-buildable.c
index aa45b89..1113805 100644
--- a/contrib/egg/egg-state-machine-buildable.c
+++ b/contrib/egg/egg-state-machine-buildable.c
@@ -658,6 +658,9 @@ egg_state_machine_buildable_custom_finished (GtkBuildable *buildable,
     }
 }
 
+/**
+ * egg_state_machine_buildable_iface_init: (skip)
+ */
 void
 egg_state_machine_buildable_iface_init (GtkBuildableIface *iface)
 {
diff --git a/contrib/egg/egg-state-machine.c b/contrib/egg/egg-state-machine.c
index 6af6c8c..a9d6830 100644
--- a/contrib/egg/egg-state-machine.c
+++ b/contrib/egg/egg-state-machine.c
@@ -532,10 +532,7 @@ egg_state_machine_create_action (EggStateMachine *self,
   g_return_val_if_fail (EGG_IS_STATE_MACHINE (self), NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
-  return g_object_new (EGG_TYPE_STATE_MACHINE_ACTION,
-                       "state-machine", self,
-                       "name", name,
-                       NULL);
+  return egg_state_machine_action_new (self, name);
 }
 
 void
diff --git a/contrib/egg/egg-widget-action-group.c b/contrib/egg/egg-widget-action-group.c
index a49bafe..6ada3d1 100644
--- a/contrib/egg/egg-widget-action-group.c
+++ b/contrib/egg/egg-widget-action-group.c
@@ -307,6 +307,15 @@ create_action (const GSignalQuery *query,
   return G_ACTION (action);
 }
 
+/**
+ * egg_widget_action_group_new:
+ * @widget: A #GtkWidget
+ *
+ * Creates a new #GActionGroup that can proxy signal actions
+ * to @widget.
+ *
+ * Returns: (transfer full): A newly allocated #GActionGroup.
+ */
 GActionGroup *
 egg_widget_action_group_new (GtkWidget *widget)
 {


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