Logo Search packages:      
Sourcecode: caribou version File versions  Download package

scannable-group.c

/* scannable-group.c generated by valac 0.13.3, the Vala compiler
 * generated from scannable-group.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gee.h>


#define CARIBOU_TYPE_ISCANNABLE_GROUP (caribou_iscannable_group_get_type ())
#define CARIBOU_ISCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_ISCANNABLE_GROUP, CaribouIScannableGroup))
#define CARIBOU_IS_ISCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_ISCANNABLE_GROUP))
#define CARIBOU_ISCANNABLE_GROUP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_ISCANNABLE_GROUP, CaribouIScannableGroupIface))

typedef struct _CaribouIScannableGroup CaribouIScannableGroup;
typedef struct _CaribouIScannableGroupIface CaribouIScannableGroupIface;

#define CARIBOU_TYPE_ISCANNABLE_ITEM (caribou_iscannable_item_get_type ())
#define CARIBOU_ISCANNABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM, CaribouIScannableItem))
#define CARIBOU_IS_ISCANNABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM))
#define CARIBOU_ISCANNABLE_ITEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM, CaribouIScannableItemIface))

typedef struct _CaribouIScannableItem CaribouIScannableItem;
typedef struct _CaribouIScannableItemIface CaribouIScannableItemIface;

#define CARIBOU_TYPE_SCAN_GROUPING (caribou_scan_grouping_get_type ())

#define CARIBOU_TYPE_SCANNABLE_GROUP (caribou_scannable_group_get_type ())
#define CARIBOU_SCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroup))
#define CARIBOU_SCANNABLE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroupClass))
#define CARIBOU_IS_SCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_SCANNABLE_GROUP))
#define CARIBOU_IS_SCANNABLE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_SCANNABLE_GROUP))
#define CARIBOU_SCANNABLE_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroupClass))

typedef struct _CaribouScannableGroup CaribouScannableGroup;
typedef struct _CaribouScannableGroupClass CaribouScannableGroupClass;
typedef struct _CaribouScannableGroupPrivate CaribouScannableGroupPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _CaribouIScannableItemIface {
      GTypeInterface parent_iface;
      gboolean (*get_scan_stepping) (CaribouIScannableItem* self);
      void (*set_scan_stepping) (CaribouIScannableItem* self, gboolean value);
      gboolean (*get_scan_selected) (CaribouIScannableItem* self);
      void (*set_scan_selected) (CaribouIScannableItem* self, gboolean value);
};

typedef enum  {
      CARIBOU_SCAN_GROUPING_NONE,
      CARIBOU_SCAN_GROUPING_SUBGROUPS,
      CARIBOU_SCAN_GROUPING_ROWS,
      CARIBOU_SCAN_GROUPING_LINEAR
} CaribouScanGrouping;

struct _CaribouIScannableGroupIface {
      GTypeInterface parent_iface;
      CaribouIScannableItem* (*child_select) (CaribouIScannableGroup* self);
      void (*scan_reset) (CaribouIScannableGroup* self);
      CaribouIScannableItem** (*get_scan_children) (CaribouIScannableGroup* self, int* result_length1);
      CaribouIScannableItem* (*child_step) (CaribouIScannableGroup* self, gint cycles);
      CaribouIScannableItem** (*get_step_path) (CaribouIScannableGroup* self, int* result_length1);
      CaribouIScannableItem** (*get_selected_path) (CaribouIScannableGroup* self, int* result_length1);
      CaribouScanGrouping (*get_scan_grouping) (CaribouIScannableGroup* self);
      void (*set_scan_grouping) (CaribouIScannableGroup* self, CaribouScanGrouping value);
};

struct _CaribouScannableGroup {
      GObject parent_instance;
      CaribouScannableGroupPrivate * priv;
};

struct _CaribouScannableGroupClass {
      GObjectClass parent_class;
      CaribouIScannableItem** (*get_scan_children) (CaribouScannableGroup* self, int* result_length1);
      CaribouIScannableItem* (*child_select) (CaribouScannableGroup* self);
};

00078 struct _CaribouScannableGroupPrivate {
      GeeLinkedList* _step_path;
      GeeLinkedList* _selected_path;
      gint _cycle_count;
      CaribouScanGrouping _scan_grouping;
      gint _scan_child_index;
};


static gpointer caribou_scannable_group_parent_class = NULL;
static CaribouIScannableGroupIface* caribou_scannable_group_caribou_iscannable_group_parent_iface = NULL;

GType caribou_iscannable_item_get_type (void) G_GNUC_CONST;
GType caribou_scan_grouping_get_type (void) G_GNUC_CONST;
GType caribou_iscannable_group_get_type (void) G_GNUC_CONST;
GType caribou_scannable_group_get_type (void) G_GNUC_CONST;
#define CARIBOU_SCANNABLE_GROUP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroupPrivate))
enum  {
      CARIBOU_SCANNABLE_GROUP_DUMMY_PROPERTY,
      CARIBOU_SCANNABLE_GROUP_SCAN_GROUPING
};
CaribouIScannableItem** caribou_scannable_group_get_scan_children (CaribouScannableGroup* self, int* result_length1);
static CaribouIScannableItem** caribou_scannable_group_real_get_scan_children (CaribouScannableGroup* self, int* result_length1);
static CaribouIScannableItem** caribou_scannable_group_real_get_step_path (CaribouIScannableGroup* base, int* result_length1);
static CaribouIScannableItem** caribou_scannable_group_real_get_selected_path (CaribouIScannableGroup* base, int* result_length1);
static void caribou_scannable_group_add_to_step_path (CaribouScannableGroup* self, CaribouIScannableItem* item);
static void caribou_scannable_group_add_to_selected_path (CaribouScannableGroup* self, CaribouIScannableItem* item);
static CaribouIScannableItem* caribou_scannable_group_get_stepping_child (CaribouScannableGroup* self);
static gint caribou_scannable_group_get_scan_child_index (CaribouScannableGroup* self);
static CaribouIScannableItem* caribou_scannable_group_get_single_child (CaribouScannableGroup* self, CaribouIScannableItem* item);
CaribouIScannableItem* caribou_scannable_group_child_select (CaribouScannableGroup* self);
static CaribouIScannableItem* caribou_scannable_group_real_child_select (CaribouScannableGroup* self);
CaribouIScannableItem* caribou_iscannable_group_child_select (CaribouIScannableGroup* self);
void caribou_iscannable_item_set_scan_selected (CaribouIScannableItem* self, gboolean value);
static void caribou_scannable_group_set_scan_child_index (CaribouScannableGroup* self, gint value);
static void caribou_scannable_group_real_scan_reset (CaribouIScannableGroup* base);
void caribou_iscannable_item_set_scan_stepping (CaribouIScannableItem* self, gboolean value);
void caribou_iscannable_group_scan_reset (CaribouIScannableGroup* self);
static CaribouIScannableItem* caribou_scannable_group_real_child_step (CaribouIScannableGroup* base, gint cycles);
CaribouIScannableItem* caribou_iscannable_group_child_step (CaribouIScannableGroup* self, gint cycles);
CaribouScannableGroup* caribou_scannable_group_construct (GType object_type);
void caribou_iscannable_group_set_scan_grouping (CaribouIScannableGroup* self, CaribouScanGrouping value);
static GObject * caribou_scannable_group_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void caribou_scannable_group_finalize (GObject* obj);
CaribouScanGrouping caribou_iscannable_group_get_scan_grouping (CaribouIScannableGroup* self);
static void _vala_caribou_scannable_group_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_caribou_scannable_group_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static CaribouIScannableItem** caribou_scannable_group_real_get_scan_children (CaribouScannableGroup* self, int* result_length1) {
      g_return_val_if_fail (self != NULL, NULL);
      g_critical ("Type `%s' does not implement abstract method `caribou_scannable_group_get_scan_children'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
      return NULL;
}


CaribouIScannableItem** caribou_scannable_group_get_scan_children (CaribouScannableGroup* self, int* result_length1) {
      return CARIBOU_SCANNABLE_GROUP_GET_CLASS (self)->get_scan_children (self, result_length1);
}


static CaribouIScannableItem** caribou_scannable_group_real_get_step_path (CaribouIScannableGroup* base, int* result_length1) {
      CaribouScannableGroup * self;
      CaribouIScannableItem** result = NULL;
      GeeLinkedList* _tmp0_;
      gint _tmp1_ = 0;
      gpointer* _tmp2_ = NULL;
      CaribouIScannableItem** _tmp3_;
      gint _tmp3__length1;
      self = (CaribouScannableGroup*) base;
      _tmp0_ = self->priv->_step_path;
      _tmp2_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp0_, &_tmp1_);
      _tmp3_ = (CaribouIScannableItem**) _tmp2_;
      _tmp3__length1 = _tmp1_;
      if (result_length1) {
            *result_length1 = _tmp3__length1;
      }
      result = _tmp3_;
      return result;
}


static CaribouIScannableItem** caribou_scannable_group_real_get_selected_path (CaribouIScannableGroup* base, int* result_length1) {
      CaribouScannableGroup * self;
      CaribouIScannableItem** result = NULL;
      GeeLinkedList* _tmp0_;
      gint _tmp1_ = 0;
      gpointer* _tmp2_ = NULL;
      CaribouIScannableItem** _tmp3_;
      gint _tmp3__length1;
      self = (CaribouScannableGroup*) base;
      _tmp0_ = self->priv->_selected_path;
      _tmp2_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp0_, &_tmp1_);
      _tmp3_ = (CaribouIScannableItem**) _tmp2_;
      _tmp3__length1 = _tmp1_;
      if (result_length1) {
            *result_length1 = _tmp3__length1;
      }
      result = _tmp3_;
      return result;
}


static void caribou_scannable_group_add_to_step_path (CaribouScannableGroup* self, CaribouIScannableItem* item) {
      GeeLinkedList* _tmp0_;
      CaribouIScannableItem* _tmp1_;
      GeeLinkedList* _tmp2_;
      gpointer _tmp3_ = NULL;
      CaribouIScannableItem* _tmp4_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (item != NULL);
      _tmp0_ = self->priv->_step_path;
      _tmp1_ = item;
      gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp1_);
      _tmp2_ = self->priv->_step_path;
      _tmp3_ = gee_deque_peek_tail ((GeeDeque*) _tmp2_);
      _tmp4_ = (CaribouIScannableItem*) _tmp3_;
      g_signal_emit_by_name ((CaribouIScannableGroup*) self, "step-item-changed", _tmp4_);
      _g_object_unref0 (_tmp4_);
}


static void caribou_scannable_group_add_to_selected_path (CaribouScannableGroup* self, CaribouIScannableItem* item) {
      GeeLinkedList* _tmp0_;
      CaribouIScannableItem* _tmp1_;
      GeeLinkedList* _tmp2_;
      gpointer _tmp3_ = NULL;
      CaribouIScannableItem* _tmp4_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (item != NULL);
      _tmp0_ = self->priv->_selected_path;
      _tmp1_ = item;
      gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp1_);
      _tmp2_ = self->priv->_selected_path;
      _tmp3_ = gee_deque_peek_tail ((GeeDeque*) _tmp2_);
      _tmp4_ = (CaribouIScannableItem*) _tmp3_;
      g_signal_emit_by_name ((CaribouIScannableGroup*) self, "selected-item-changed", _tmp4_);
      _g_object_unref0 (_tmp4_);
}


static gpointer _g_object_ref0 (gpointer self) {
      return self ? g_object_ref (self) : NULL;
}


static CaribouIScannableItem* caribou_scannable_group_get_stepping_child (CaribouScannableGroup* self) {
      CaribouIScannableItem* result = NULL;
      gint _tmp0_;
      gint _tmp1_ = 0;
      CaribouIScannableItem** _tmp2_ = NULL;
      CaribouIScannableItem** _tmp3_;
      gint _tmp3__length1;
      gint _tmp4_;
      CaribouIScannableItem* _tmp5_;
      CaribouIScannableItem* _tmp6_;
      CaribouIScannableItem* _tmp7_;
      g_return_val_if_fail (self != NULL, NULL);
      _tmp0_ = self->priv->_scan_child_index;
      if (_tmp0_ < 0) {
            result = NULL;
            return result;
      }
      _tmp2_ = caribou_scannable_group_get_scan_children (self, &_tmp1_);
      _tmp3_ = _tmp2_;
      _tmp3__length1 = _tmp1_;
      _tmp4_ = self->priv->_scan_child_index;
      _tmp5_ = _tmp3_[_tmp4_];
      _tmp6_ = _g_object_ref0 (_tmp5_);
      _tmp7_ = _tmp6_;
      _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_object_unref), NULL);
      result = _tmp7_;
      return result;
}


static CaribouIScannableItem* caribou_scannable_group_get_single_child (CaribouScannableGroup* self, CaribouIScannableItem* item) {
      CaribouIScannableItem* result = NULL;
      CaribouIScannableItem* _tmp0_;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (item != NULL, NULL);
      _tmp0_ = item;
      if (CARIBOU_IS_SCANNABLE_GROUP (_tmp0_)) {
            CaribouIScannableItem* _tmp1_;
            gint _tmp2_ = 0;
            CaribouIScannableItem** _tmp3_ = NULL;
            CaribouIScannableItem** children;
            gint children_length1;
            gint _children_size_;
            CaribouIScannableItem** _tmp4_;
            gint _tmp4__length1;
            _tmp1_ = item;
            _tmp3_ = caribou_scannable_group_get_scan_children (CARIBOU_IS_SCANNABLE_GROUP (_tmp1_) ? ((CaribouScannableGroup*) _tmp1_) : NULL, &_tmp2_);
            children = _tmp3_;
            children_length1 = _tmp2_;
            _children_size_ = children_length1;
            _tmp4_ = children;
            _tmp4__length1 = children_length1;
            if (_tmp4__length1 == 1) {
                  CaribouIScannableItem** _tmp5_;
                  gint _tmp5__length1;
                  CaribouIScannableItem* _tmp6_;
                  CaribouIScannableItem* _tmp7_;
                  _tmp5_ = children;
                  _tmp5__length1 = children_length1;
                  _tmp6_ = _tmp5_[0];
                  _tmp7_ = _g_object_ref0 (_tmp6_);
                  result = _tmp7_;
                  children = (_vala_array_free (children, children_length1, (GDestroyNotify) g_object_unref), NULL);
                  return result;
            }
            children = (_vala_array_free (children, children_length1, (GDestroyNotify) g_object_unref), NULL);
      }
      result = NULL;
      return result;
}


static CaribouIScannableItem* caribou_scannable_group_real_child_select (CaribouScannableGroup* self) {
      CaribouIScannableItem* result = NULL;
      CaribouIScannableItem* _tmp0_ = NULL;
      CaribouIScannableItem* step_child;
      GeeLinkedList* _tmp1_;
      gpointer _tmp2_ = NULL;
      CaribouIScannableItem* selected_leaf;
      CaribouIScannableItem* _tmp3_;
      GeeLinkedList* _tmp20_;
      gpointer _tmp21_ = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      _tmp0_ = caribou_scannable_group_get_stepping_child (self);
      step_child = _tmp0_;
      _tmp1_ = self->priv->_selected_path;
      _tmp2_ = gee_deque_peek_tail ((GeeDeque*) _tmp1_);
      selected_leaf = (CaribouIScannableItem*) _tmp2_;
      _tmp3_ = selected_leaf;
      if (_tmp3_ != NULL) {
            CaribouIScannableItem* _tmp4_;
            CaribouIScannableItem* _tmp5_;
            CaribouIScannableItem* _tmp6_ = NULL;
            CaribouIScannableItem* _tmp7_;
            _tmp4_ = selected_leaf;
            g_assert (CARIBOU_IS_ISCANNABLE_GROUP (_tmp4_));
            _tmp5_ = selected_leaf;
            _tmp6_ = caribou_iscannable_group_child_select (CARIBOU_ISCANNABLE_GROUP (_tmp5_));
            _tmp7_ = _tmp6_;
            caribou_scannable_group_add_to_selected_path (self, _tmp7_);
            _g_object_unref0 (_tmp7_);
      } else {
            CaribouIScannableItem* _tmp8_;
            _tmp8_ = step_child;
            if (_tmp8_ != NULL) {
                  CaribouIScannableItem* _tmp9_;
                  CaribouIScannableItem* _tmp10_;
                  _tmp9_ = step_child;
                  caribou_iscannable_item_set_scan_selected (_tmp9_, TRUE);
                  _tmp10_ = step_child;
                  caribou_scannable_group_add_to_selected_path (self, _tmp10_);
                  caribou_scannable_group_set_scan_child_index (self, -1);
                  {
                        CaribouIScannableItem* _tmp11_;
                        CaribouIScannableItem* _tmp12_ = NULL;
                        CaribouIScannableItem* child;
                        _tmp11_ = step_child;
                        _tmp12_ = caribou_scannable_group_get_single_child (self, _tmp11_);
                        child = _tmp12_;
                        {
                              gboolean _tmp13_;
                              _tmp13_ = TRUE;
                              while (TRUE) {
                                    gboolean _tmp14_;
                                    CaribouIScannableItem* _tmp17_;
                                    CaribouIScannableItem* _tmp18_;
                                    CaribouIScannableItem* _tmp19_;
                                    _tmp14_ = _tmp13_;
                                    if (!_tmp14_) {
                                          CaribouIScannableItem* _tmp15_;
                                          CaribouIScannableItem* _tmp16_ = NULL;
                                          _tmp15_ = child;
                                          _tmp16_ = caribou_scannable_group_get_single_child (self, _tmp15_);
                                          _g_object_unref0 (child);
                                          child = _tmp16_;
                                    }
                                    _tmp13_ = FALSE;
                                    _tmp17_ = child;
                                    if (!(_tmp17_ != NULL)) {
                                          break;
                                    }
                                    _tmp18_ = child;
                                    caribou_iscannable_item_set_scan_selected (_tmp18_, TRUE);
                                    _tmp19_ = child;
                                    caribou_scannable_group_add_to_selected_path (self, _tmp19_);
                              }
                        }
                        _g_object_unref0 (child);
                  }
            }
      }
      _tmp20_ = self->priv->_selected_path;
      _tmp21_ = gee_deque_peek_tail ((GeeDeque*) _tmp20_);
      result = (CaribouIScannableItem*) _tmp21_;
      _g_object_unref0 (selected_leaf);
      _g_object_unref0 (step_child);
      return result;
}


CaribouIScannableItem* caribou_scannable_group_child_select (CaribouScannableGroup* self) {
      return CARIBOU_SCANNABLE_GROUP_GET_CLASS (self)->child_select (self);
}


static void caribou_scannable_group_real_scan_reset (CaribouIScannableGroup* base) {
      CaribouScannableGroup * self;
      GeeLinkedList* _tmp0_;
      GeeLinkedList* _tmp1_;
      gint _tmp2_ = 0;
      CaribouIScannableItem** _tmp3_ = NULL;
      self = (CaribouScannableGroup*) base;
      _tmp0_ = self->priv->_selected_path;
      gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
      _tmp1_ = self->priv->_step_path;
      gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp1_);
      caribou_scannable_group_set_scan_child_index (self, -1);
      _tmp3_ = caribou_scannable_group_get_scan_children (self, &_tmp2_);
      {
            CaribouIScannableItem** item_collection = NULL;
            gint item_collection_length1 = 0;
            gint _item_collection_size_ = 0;
            gint item_it = 0;
            item_collection = _tmp3_;
            item_collection_length1 = _tmp2_;
            for (item_it = 0; item_it < _tmp2_; item_it = item_it + 1) {
                  CaribouIScannableItem* _tmp4_;
                  CaribouIScannableItem* item = NULL;
                  _tmp4_ = _g_object_ref0 (item_collection[item_it]);
                  item = _tmp4_;
                  {
                        CaribouIScannableItem* _tmp5_;
                        CaribouIScannableItem* _tmp6_;
                        CaribouIScannableItem* _tmp7_;
                        _tmp5_ = item;
                        caribou_iscannable_item_set_scan_stepping (_tmp5_, FALSE);
                        _tmp6_ = item;
                        caribou_iscannable_item_set_scan_selected (_tmp6_, FALSE);
                        _tmp7_ = item;
                        if (CARIBOU_IS_ISCANNABLE_GROUP (_tmp7_)) {
                              CaribouIScannableItem* _tmp8_;
                              _tmp8_ = item;
                              caribou_iscannable_group_scan_reset (CARIBOU_ISCANNABLE_GROUP (_tmp8_));
                        }
                        _g_object_unref0 (item);
                  }
            }
            item_collection = (_vala_array_free (item_collection, item_collection_length1, (GDestroyNotify) g_object_unref), NULL);
      }
      g_signal_emit_by_name ((CaribouIScannableGroup*) self, "scan-cleared");
}


static CaribouIScannableItem* caribou_scannable_group_real_child_step (CaribouIScannableGroup* base, gint cycles) {
      CaribouScannableGroup * self;
      CaribouIScannableItem* result = NULL;
      CaribouIScannableItem* _tmp0_ = NULL;
      CaribouIScannableItem* step_child;
      GeeLinkedList* _tmp1_;
      gpointer _tmp2_ = NULL;
      CaribouIScannableItem* selected_leaf;
      CaribouIScannableItem* _tmp3_;
      GeeLinkedList* _tmp34_;
      gpointer _tmp35_ = NULL;
      self = (CaribouScannableGroup*) base;
      _tmp0_ = caribou_scannable_group_get_stepping_child (self);
      step_child = _tmp0_;
      _tmp1_ = self->priv->_selected_path;
      _tmp2_ = gee_deque_peek_tail ((GeeDeque*) _tmp1_);
      selected_leaf = (CaribouIScannableItem*) _tmp2_;
      _tmp3_ = selected_leaf;
      if (_tmp3_ != NULL) {
            CaribouIScannableItem* _tmp4_;
            CaribouIScannableItem* _tmp5_;
            CaribouIScannableItem* _tmp9_;
            _tmp4_ = step_child;
            g_assert (_tmp4_ == NULL);
            _tmp5_ = selected_leaf;
            if (CARIBOU_IS_ISCANNABLE_GROUP (_tmp5_)) {
                  CaribouIScannableItem* _tmp6_;
                  gint _tmp7_;
                  CaribouIScannableItem* _tmp8_ = NULL;
                  _tmp6_ = selected_leaf;
                  _tmp7_ = cycles;
                  _tmp8_ = caribou_iscannable_group_child_step (CARIBOU_ISCANNABLE_GROUP (_tmp6_), _tmp7_);
                  _g_object_unref0 (step_child);
                  step_child = _tmp8_;
            }
            _tmp9_ = step_child;
            if (_tmp9_ != NULL) {
                  CaribouIScannableItem* _tmp10_;
                  _tmp10_ = step_child;
                  caribou_scannable_group_add_to_step_path (self, _tmp10_);
            } else {
                  GeeLinkedList* _tmp11_;
                  _tmp11_ = self->priv->_step_path;
                  gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp11_);
            }
      } else {
            gboolean _tmp12_ = FALSE;
            CaribouIScannableItem* _tmp13_;
            gboolean _tmp15_;
            _tmp13_ = step_child;
            if (_tmp13_ != NULL) {
                  _tmp12_ = TRUE;
            } else {
                  gint _tmp14_;
                  _tmp14_ = self->priv->_scan_child_index;
                  _tmp12_ = _tmp14_ == (-1);
            }
            _tmp15_ = _tmp12_;
            if (_tmp15_) {
                  CaribouIScannableItem* _tmp16_;
                  gint _tmp17_ = 0;
                  CaribouIScannableItem** _tmp18_ = NULL;
                  CaribouIScannableItem** children;
                  gint children_length1;
                  gint _children_size_;
                  gint _tmp19_;
                  gint _tmp20_;
                  CaribouIScannableItem** _tmp21_;
                  gint _tmp21__length1;
                  gint _tmp23_;
                  gint _tmp24_;
                  _tmp16_ = selected_leaf;
                  g_assert (_tmp16_ == NULL);
                  _tmp18_ = caribou_scannable_group_get_scan_children (self, &_tmp17_);
                  children = _tmp18_;
                  children_length1 = _tmp17_;
                  _children_size_ = children_length1;
                  _tmp19_ = self->priv->_scan_child_index;
                  if (_tmp19_ == (-1)) {
                        self->priv->_cycle_count = 0;
                  }
                  _tmp20_ = self->priv->_scan_child_index;
                  _tmp21_ = children;
                  _tmp21__length1 = children_length1;
                  if (_tmp20_ == (_tmp21__length1 - 1)) {
                        gint _tmp22_;
                        caribou_scannable_group_set_scan_child_index (self, -1);
                        _tmp22_ = self->priv->_cycle_count;
                        self->priv->_cycle_count = _tmp22_ + 1;
                  }
                  _tmp23_ = self->priv->_cycle_count;
                  _tmp24_ = cycles;
                  if (_tmp23_ < _tmp24_) {
                        CaribouIScannableItem* _tmp25_;
                        CaribouIScannableItem** _tmp27_;
                        gint _tmp27__length1;
                        gint _tmp28_;
                        CaribouIScannableItem* _tmp29_;
                        CaribouIScannableItem* _tmp30_;
                        CaribouIScannableItem* _tmp31_;
                        CaribouIScannableItem* _tmp32_;
                        _tmp25_ = step_child;
                        if (_tmp25_ != NULL) {
                              CaribouIScannableItem* _tmp26_;
                              _tmp26_ = step_child;
                              caribou_iscannable_item_set_scan_stepping (_tmp26_, FALSE);
                        }
                        _tmp27_ = children;
                        _tmp27__length1 = children_length1;
                        _tmp28_ = self->priv->_scan_child_index;
                        caribou_scannable_group_set_scan_child_index (self, _tmp28_ + 1);
                        _tmp29_ = _tmp27_[_tmp28_ + 1];
                        _tmp30_ = _g_object_ref0 (_tmp29_);
                        _g_object_unref0 (step_child);
                        step_child = _tmp30_;
                        _tmp31_ = step_child;
                        caribou_iscannable_item_set_scan_stepping (_tmp31_, TRUE);
                        _tmp32_ = step_child;
                        caribou_scannable_group_add_to_step_path (self, _tmp32_);
                  } else {
                        GeeLinkedList* _tmp33_;
                        _tmp33_ = self->priv->_step_path;
                        gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp33_);
                  }
                  children = (_vala_array_free (children, children_length1, (GDestroyNotify) g_object_unref), NULL);
            } else {
                  g_warn_if_reached ();
            }
      }
      _tmp34_ = self->priv->_step_path;
      _tmp35_ = gee_deque_peek_tail ((GeeDeque*) _tmp34_);
      result = (CaribouIScannableItem*) _tmp35_;
      _g_object_unref0 (selected_leaf);
      _g_object_unref0 (step_child);
      return result;
}


CaribouScannableGroup* caribou_scannable_group_construct (GType object_type) {
      CaribouScannableGroup * self = NULL;
      self = (CaribouScannableGroup*) g_object_new (object_type, NULL);
      return self;
}


static CaribouScanGrouping caribou_scannable_group_real_get_scan_grouping (CaribouIScannableGroup* base) {
      CaribouScanGrouping result;
      CaribouScannableGroup* self;
      CaribouScanGrouping _tmp0_;
      self = (CaribouScannableGroup*) base;
      _tmp0_ = self->priv->_scan_grouping;
      result = _tmp0_;
      return result;
}


static void caribou_scannable_group_real_set_scan_grouping (CaribouIScannableGroup* base, CaribouScanGrouping value) {
      CaribouScannableGroup* self;
      CaribouScanGrouping _tmp0_;
      gint _tmp1_ = 0;
      CaribouIScannableItem** _tmp2_ = NULL;
      self = (CaribouScannableGroup*) base;
      _tmp0_ = value;
      self->priv->_scan_grouping = _tmp0_;
      _tmp2_ = caribou_scannable_group_get_scan_children (self, &_tmp1_);
      {
            CaribouIScannableItem** item_collection = NULL;
            gint item_collection_length1 = 0;
            gint _item_collection_size_ = 0;
            gint item_it = 0;
            item_collection = _tmp2_;
            item_collection_length1 = _tmp1_;
            for (item_it = 0; item_it < _tmp1_; item_it = item_it + 1) {
                  CaribouIScannableItem* _tmp3_;
                  CaribouIScannableItem* item = NULL;
                  _tmp3_ = _g_object_ref0 (item_collection[item_it]);
                  item = _tmp3_;
                  {
                        CaribouIScannableItem* _tmp4_;
                        _tmp4_ = item;
                        if (CARIBOU_IS_ISCANNABLE_GROUP (_tmp4_)) {
                              CaribouIScannableItem* _tmp5_;
                              CaribouScanGrouping _tmp6_;
                              _tmp5_ = item;
                              _tmp6_ = value;
                              caribou_iscannable_group_set_scan_grouping (CARIBOU_ISCANNABLE_GROUP (_tmp5_), _tmp6_);
                        }
                        _g_object_unref0 (item);
                  }
            }
            item_collection = (_vala_array_free (item_collection, item_collection_length1, (GDestroyNotify) g_object_unref), NULL);
      }
      g_object_notify ((GObject *) self, "scan-grouping");
}


static gint caribou_scannable_group_get_scan_child_index (CaribouScannableGroup* self) {
      gint result;
      gint _tmp0_;
      g_return_val_if_fail (self != NULL, 0);
      _tmp0_ = self->priv->_scan_child_index;
      result = _tmp0_;
      return result;
}


static void caribou_scannable_group_set_scan_child_index (CaribouScannableGroup* self, gint value) {
      gint _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_scan_child_index = _tmp0_;
}


static GObject * caribou_scannable_group_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
      GObject * obj;
      GObjectClass * parent_class;
      CaribouScannableGroup * self;
      GeeLinkedList* _tmp0_;
      GeeLinkedList* _tmp1_;
      parent_class = G_OBJECT_CLASS (caribou_scannable_group_parent_class);
      obj = parent_class->constructor (type, n_construct_properties, construct_properties);
      self = CARIBOU_SCANNABLE_GROUP (obj);
      _tmp0_ = gee_linked_list_new (CARIBOU_TYPE_ISCANNABLE_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
      _g_object_unref0 (self->priv->_step_path);
      self->priv->_step_path = _tmp0_;
      _tmp1_ = gee_linked_list_new (CARIBOU_TYPE_ISCANNABLE_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
      _g_object_unref0 (self->priv->_selected_path);
      self->priv->_selected_path = _tmp1_;
      return obj;
}


static void caribou_scannable_group_class_init (CaribouScannableGroupClass * klass) {
      caribou_scannable_group_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (CaribouScannableGroupPrivate));
      CARIBOU_SCANNABLE_GROUP_CLASS (klass)->get_scan_children = caribou_scannable_group_real_get_scan_children;
      CARIBOU_SCANNABLE_GROUP_CLASS (klass)->child_select = caribou_scannable_group_real_child_select;
      G_OBJECT_CLASS (klass)->get_property = _vala_caribou_scannable_group_get_property;
      G_OBJECT_CLASS (klass)->set_property = _vala_caribou_scannable_group_set_property;
      G_OBJECT_CLASS (klass)->constructor = caribou_scannable_group_constructor;
      G_OBJECT_CLASS (klass)->finalize = caribou_scannable_group_finalize;
      g_object_class_override_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNABLE_GROUP_SCAN_GROUPING, "scan-grouping");
}


static void caribou_scannable_group_caribou_iscannable_group_interface_init (CaribouIScannableGroupIface * iface) {
      caribou_scannable_group_caribou_iscannable_group_parent_iface = g_type_interface_peek_parent (iface);
      iface->get_scan_children = (CaribouIScannableItem** (*)(CaribouIScannableGroup*, int*)) caribou_scannable_group_get_scan_children;
      iface->get_step_path = (CaribouIScannableItem** (*)(CaribouIScannableGroup*, int*)) caribou_scannable_group_real_get_step_path;
      iface->get_selected_path = (CaribouIScannableItem** (*)(CaribouIScannableGroup*, int*)) caribou_scannable_group_real_get_selected_path;
      iface->child_select = (CaribouIScannableItem* (*)(CaribouIScannableGroup*)) caribou_scannable_group_child_select;
      iface->scan_reset = (void (*)(CaribouIScannableGroup*)) caribou_scannable_group_real_scan_reset;
      iface->child_step = (CaribouIScannableItem* (*)(CaribouIScannableGroup*, gint)) caribou_scannable_group_real_child_step;
      iface->get_scan_grouping = caribou_scannable_group_real_get_scan_grouping;
      iface->set_scan_grouping = caribou_scannable_group_real_set_scan_grouping;
}


static void caribou_scannable_group_instance_init (CaribouScannableGroup * self) {
      self->priv = CARIBOU_SCANNABLE_GROUP_GET_PRIVATE (self);
      self->priv->_scan_child_index = -1;
}


static void caribou_scannable_group_finalize (GObject* obj) {
      CaribouScannableGroup * self;
      self = CARIBOU_SCANNABLE_GROUP (obj);
      _g_object_unref0 (self->priv->_step_path);
      _g_object_unref0 (self->priv->_selected_path);
      G_OBJECT_CLASS (caribou_scannable_group_parent_class)->finalize (obj);
}


GType caribou_scannable_group_get_type (void) {
      static volatile gsize caribou_scannable_group_type_id__volatile = 0;
      if (g_once_init_enter (&caribou_scannable_group_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (CaribouScannableGroupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_scannable_group_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouScannableGroup), 0, (GInstanceInitFunc) caribou_scannable_group_instance_init, NULL };
            static const GInterfaceInfo caribou_iscannable_group_info = { (GInterfaceInitFunc) caribou_scannable_group_caribou_iscannable_group_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
            GType caribou_scannable_group_type_id;
            caribou_scannable_group_type_id = g_type_register_static (G_TYPE_OBJECT, "CaribouScannableGroup", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
            g_type_add_interface_static (caribou_scannable_group_type_id, CARIBOU_TYPE_ISCANNABLE_GROUP, &caribou_iscannable_group_info);
            g_once_init_leave (&caribou_scannable_group_type_id__volatile, caribou_scannable_group_type_id);
      }
      return caribou_scannable_group_type_id__volatile;
}


static void _vala_caribou_scannable_group_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      CaribouScannableGroup * self;
      self = CARIBOU_SCANNABLE_GROUP (object);
      switch (property_id) {
            case CARIBOU_SCANNABLE_GROUP_SCAN_GROUPING:
            g_value_set_enum (value, caribou_iscannable_group_get_scan_grouping ((CaribouIScannableGroup*) self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void _vala_caribou_scannable_group_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      CaribouScannableGroup * self;
      self = CARIBOU_SCANNABLE_GROUP (object);
      switch (property_id) {
            case CARIBOU_SCANNABLE_GROUP_SCAN_GROUPING:
            caribou_iscannable_group_set_scan_grouping ((CaribouIScannableGroup*) self, g_value_get_enum (value));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      if ((array != NULL) && (destroy_func != NULL)) {
            int i;
            for (i = 0; i < array_length; i = i + 1) {
                  if (((gpointer*) array)[i] != NULL) {
                        destroy_func (((gpointer*) array)[i]);
                  }
            }
      }
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      _vala_array_destroy (array, array_length, destroy_func);
      g_free (array);
}




Generated by  Doxygen 1.6.0   Back to index