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

scanner.c

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


#include <glib.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gdk/gdk.h>


#define CARIBOU_TYPE_SCANNER (caribou_scanner_get_type ())
#define CARIBOU_SCANNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_SCANNER, CaribouScanner))
#define CARIBOU_SCANNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_SCANNER, CaribouScannerClass))
#define CARIBOU_IS_SCANNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_SCANNER))
#define CARIBOU_IS_SCANNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_SCANNER))
#define CARIBOU_SCANNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_SCANNER, CaribouScannerClass))

typedef struct _CaribouScanner CaribouScanner;
typedef struct _CaribouScannerClass CaribouScannerClass;
typedef struct _CaribouScannerPrivate CaribouScannerPrivate;

#define CARIBOU_TYPE_SCAN_GROUPING (caribou_scan_grouping_get_type ())

#define CARIBOU_TYPE_KEYBOARD_MODEL (caribou_keyboard_model_get_type ())
#define CARIBOU_KEYBOARD_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_KEYBOARD_MODEL, CaribouKeyboardModel))
#define CARIBOU_KEYBOARD_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_KEYBOARD_MODEL, CaribouKeyboardModelClass))
#define CARIBOU_IS_KEYBOARD_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_KEYBOARD_MODEL))
#define CARIBOU_IS_KEYBOARD_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_KEYBOARD_MODEL))
#define CARIBOU_KEYBOARD_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_KEYBOARD_MODEL, CaribouKeyboardModelClass))

typedef struct _CaribouKeyboardModel CaribouKeyboardModel;
typedef struct _CaribouKeyboardModelClass CaribouKeyboardModelClass;

#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 _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CARIBOU_TYPE_GROUP_MODEL (caribou_group_model_get_type ())
#define CARIBOU_GROUP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_GROUP_MODEL, CaribouGroupModel))
#define CARIBOU_GROUP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_GROUP_MODEL, CaribouGroupModelClass))
#define CARIBOU_IS_GROUP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_GROUP_MODEL))
#define CARIBOU_IS_GROUP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_GROUP_MODEL))
#define CARIBOU_GROUP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_GROUP_MODEL, CaribouGroupModelClass))

typedef struct _CaribouGroupModel CaribouGroupModel;
typedef struct _CaribouGroupModelClass CaribouGroupModelClass;

#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;

#define CARIBOU_TYPE_LEVEL_MODEL (caribou_level_model_get_type ())
#define CARIBOU_LEVEL_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModel))
#define CARIBOU_LEVEL_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModelClass))
#define CARIBOU_IS_LEVEL_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_LEVEL_MODEL))
#define CARIBOU_IS_LEVEL_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_LEVEL_MODEL))
#define CARIBOU_LEVEL_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModelClass))

typedef struct _CaribouLevelModel CaribouLevelModel;
typedef struct _CaribouLevelModelClass CaribouLevelModelClass;

#define CARIBOU_TYPE_XADAPTER (caribou_xadapter_get_type ())
#define CARIBOU_XADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_XADAPTER, CaribouXAdapter))
#define CARIBOU_XADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_XADAPTER, CaribouXAdapterClass))
#define CARIBOU_IS_XADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_XADAPTER))
#define CARIBOU_IS_XADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_XADAPTER))
#define CARIBOU_XADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_XADAPTER, CaribouXAdapterClass))

typedef struct _CaribouXAdapter CaribouXAdapter;
typedef struct _CaribouXAdapterClass CaribouXAdapterClass;
typedef struct _Block1Data Block1Data;
typedef struct _Block2Data Block2Data;

struct _CaribouScanner {
      GObject parent_instance;
      CaribouScannerPrivate * priv;
};

struct _CaribouScannerClass {
      GObjectClass parent_class;
};

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

typedef void (*CaribouScannerUnconfigureSwitchFunc) (void* user_data);
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);
};

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);
};

00135 struct _CaribouScannerPrivate {
      gboolean _bind_settings;
      CaribouScanGrouping _scan_grouping;
      gboolean _scan_enabled;
      gdouble _step_time;
      gchar* _switch_device;
      gchar* _keyboard_key;
      gint _mouse_button;
      gint _scan_cycles;
      gboolean _autorestart;
      gboolean _inverse_scanning;
      CaribouScannerUnconfigureSwitchFunc unconfigure_switch_func;
      gpointer unconfigure_switch_func_target;
      GDestroyNotify unconfigure_switch_func_target_destroy_notify;
      guint scan_tid;
      CaribouKeyboardModel* keyboard;
      CaribouIScannableGroup* root_group;
      gboolean started;
};

00155 struct _Block1Data {
      int _ref_count_;
      CaribouScanner * self;
      CaribouXAdapter* xadapter;
};

00161 struct _Block2Data {
      int _ref_count_;
      Block1Data * _data1_;
      guint keyval;
};

typedef void (*CaribouXAdapterKeyButtonCallback) (guint keybuttoncode, gboolean pressed, void* user_data);

static gpointer caribou_scanner_parent_class = NULL;

GType caribou_scanner_get_type (void) G_GNUC_CONST;
GType caribou_scan_grouping_get_type (void) G_GNUC_CONST;
GType caribou_keyboard_model_get_type (void) G_GNUC_CONST;
GType caribou_iscannable_item_get_type (void) G_GNUC_CONST;
GType caribou_iscannable_group_get_type (void) G_GNUC_CONST;
#define CARIBOU_SCANNER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_SCANNER, CaribouScannerPrivate))
enum  {
      CARIBOU_SCANNER_DUMMY_PROPERTY,
      CARIBOU_SCANNER_BIND_SETTINGS,
      CARIBOU_SCANNER_SCAN_GROUPING,
      CARIBOU_SCANNER_SCAN_ENABLED,
      CARIBOU_SCANNER_STEP_TIME,
      CARIBOU_SCANNER_SWITCH_DEVICE,
      CARIBOU_SCANNER_KEYBOARD_KEY,
      CARIBOU_SCANNER_MOUSE_BUTTON,
      CARIBOU_SCANNER_SCAN_CYCLES,
      CARIBOU_SCANNER_AUTORESTART,
      CARIBOU_SCANNER_INVERSE_SCANNING
};
static void caribou_scanner_do_bind_settings (CaribouScanner* self);
static gboolean caribou_scanner_select (CaribouScanner* self);
CaribouIScannableItem* caribou_iscannable_group_child_select (CaribouIScannableGroup* self);
static CaribouIScannableItem* caribou_scanner_step (CaribouScanner* self);
void caribou_scanner_reset (CaribouScanner* self);
static void caribou_scanner_switch_pressed (CaribouScanner* self, guint code, gboolean pressed);
static void caribou_scanner_start (CaribouScanner* self);
static void caribou_scanner_stop (CaribouScanner* self);
gboolean caribou_scanner_get_inverse_scanning (CaribouScanner* self);
gboolean caribou_scanner_get_autorestart (CaribouScanner* self);
void caribou_scanner_set_keyboard (CaribouScanner* self, CaribouKeyboardModel* keyboard);
GType caribou_group_model_get_type (void) G_GNUC_CONST;
CaribouGroupModel* caribou_keyboard_model_get_group (CaribouKeyboardModel* self, const gchar* group_name);
const gchar* caribou_keyboard_model_get_active_group (CaribouKeyboardModel* self);
static void caribou_scanner_on_group_changed (CaribouScanner* self, GObject* obj, GParamSpec* prop);
static void _caribou_scanner_on_group_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
GType caribou_scannable_group_get_type (void) G_GNUC_CONST;
GType caribou_level_model_get_type (void) G_GNUC_CONST;
static void caribou_scanner_set_active_level (CaribouScanner* self, CaribouLevelModel* level);
CaribouLevelModel* caribou_group_model_get_level (CaribouGroupModel* self, const gchar* level_name);
const gchar* caribou_group_model_get_active_level (CaribouGroupModel* self);
gchar** caribou_keyboard_model_get_groups (CaribouKeyboardModel* self, int* result_length1);
static void caribou_scanner_on_level_changed (CaribouScanner* self, GObject* obj, GParamSpec* prop);
static void _caribou_scanner_on_level_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
void caribou_iscannable_group_set_scan_grouping (CaribouIScannableGroup* self, CaribouScanGrouping value);
void caribou_iscannable_group_scan_reset (CaribouIScannableGroup* self);
static void caribou_scanner_enable (CaribouScanner* self);
static void caribou_scanner_configure_switch (CaribouScanner* self);
static void caribou_scanner_disable (CaribouScanner* self);
static void caribou_scanner_unconfigure_switch (CaribouScanner* self);
static gboolean caribou_scanner_scan (CaribouScanner* self);
static gboolean _caribou_scanner_scan_gsource_func (gpointer self);
CaribouIScannableItem* caribou_iscannable_group_child_step (CaribouIScannableGroup* self, gint cycles);
gint caribou_scanner_get_scan_cycles (CaribouScanner* self);
GType caribou_xadapter_get_type (void) G_GNUC_CONST;
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
gboolean caribou_scanner_get_scan_enabled (CaribouScanner* self);
CaribouXAdapter* caribou_xadapter_get_default (void);
const gchar* caribou_scanner_get_switch_device (CaribouScanner* self);
const gchar* caribou_scanner_get_keyboard_key (CaribouScanner* self);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (Block2Data* _data2_);
void caribou_xadapter_register_key_func (CaribouXAdapter* self, guint keyval, CaribouXAdapterKeyButtonCallback func, void* func_target);
static void _caribou_scanner_switch_pressed_caribou_xadapter_key_button_callback (guint keybuttoncode, gboolean pressed, gpointer self);
static void ___lambda12_ (Block2Data* _data2_);
static void ____lambda12__caribou_scanner_unconfigure_switch_func (gpointer self);
gint caribou_scanner_get_mouse_button (CaribouScanner* self);
void caribou_xadapter_register_button_func (CaribouXAdapter* self, guint button, CaribouXAdapterKeyButtonCallback func, void* func_target);
static void ____lambda13_ (Block1Data* _data1_);
static void _____lambda13__caribou_scanner_unconfigure_switch_func (gpointer self);
CaribouScanner* caribou_scanner_new (void);
CaribouScanner* caribou_scanner_construct (GType object_type);
gboolean caribou_scanner_get_bind_settings (CaribouScanner* self);
static void caribou_scanner_set_bind_settings (CaribouScanner* self, gboolean value);
gint caribou_scanner_get_scan_grouping (CaribouScanner* self);
void caribou_scanner_set_scan_grouping (CaribouScanner* self, gint value);
void caribou_scanner_set_scan_enabled (CaribouScanner* self, gboolean value);
gdouble caribou_scanner_get_step_time (CaribouScanner* self);
void caribou_scanner_set_step_time (CaribouScanner* self, gdouble value);
void caribou_scanner_set_switch_device (CaribouScanner* self, const gchar* value);
void caribou_scanner_set_keyboard_key (CaribouScanner* self, const gchar* value);
void caribou_scanner_set_mouse_button (CaribouScanner* self, gint value);
void caribou_scanner_set_scan_cycles (CaribouScanner* self, gint value);
void caribou_scanner_set_autorestart (CaribouScanner* self, gboolean value);
void caribou_scanner_set_inverse_scanning (CaribouScanner* self, gboolean value);
static GObject * caribou_scanner_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void caribou_scanner_finalize (GObject* obj);
static void _vala_caribou_scanner_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_caribou_scanner_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 void caribou_scanner_do_bind_settings (CaribouScanner* self) {
      GSettings* _tmp0_;
      GSettings* caribou_settings;
      gchar* _tmp1_;
      gchar* _tmp2_;
      gchar* _tmp3_;
      gchar* _tmp4_;
      gchar* _tmp5_;
      gchar* _tmp6_;
      gchar* _tmp7_;
      gchar* _tmp8_;
      gchar* _tmp9_;
      gchar** _tmp10_ = NULL;
      gchar** settings;
      gint settings_length1;
      gint _settings_size_;
      gchar** _tmp11_;
      gint _tmp11__length1;
      g_return_if_fail (self != NULL);
      _tmp0_ = g_settings_new ("org.gnome.caribou");
      caribou_settings = _tmp0_;
      _tmp1_ = g_strdup ("scan-grouping");
      _tmp2_ = g_strdup ("step-time");
      _tmp3_ = g_strdup ("scan-cycles");
      _tmp4_ = g_strdup ("autorestart");
      _tmp5_ = g_strdup ("inverse-scanning");
      _tmp6_ = g_strdup ("switch-device");
      _tmp7_ = g_strdup ("keyboard-key");
      _tmp8_ = g_strdup ("mouse-button");
      _tmp9_ = g_strdup ("scan-enabled");
      _tmp10_ = g_new0 (gchar*, 9 + 1);
      _tmp10_[0] = _tmp1_;
      _tmp10_[1] = _tmp2_;
      _tmp10_[2] = _tmp3_;
      _tmp10_[3] = _tmp4_;
      _tmp10_[4] = _tmp5_;
      _tmp10_[5] = _tmp6_;
      _tmp10_[6] = _tmp7_;
      _tmp10_[7] = _tmp8_;
      _tmp10_[8] = _tmp9_;
      settings = _tmp10_;
      settings_length1 = 9;
      _settings_size_ = settings_length1;
      _tmp11_ = settings;
      _tmp11__length1 = settings_length1;
      {
            gchar** setting_collection = NULL;
            gint setting_collection_length1 = 0;
            gint _setting_collection_size_ = 0;
            gint setting_it = 0;
            setting_collection = _tmp11_;
            setting_collection_length1 = _tmp11__length1;
            for (setting_it = 0; setting_it < _tmp11__length1; setting_it = setting_it + 1) {
                  gchar* _tmp12_;
                  gchar* setting = NULL;
                  _tmp12_ = g_strdup (setting_collection[setting_it]);
                  setting = _tmp12_;
                  {
                        GSettings* _tmp13_;
                        const gchar* _tmp14_;
                        const gchar* _tmp15_;
                        _tmp13_ = caribou_settings;
                        _tmp14_ = setting;
                        _tmp15_ = setting;
                        g_settings_bind (_tmp13_, _tmp14_, self, _tmp15_, G_SETTINGS_BIND_GET);
                        _g_free0 (setting);
                  }
            }
      }
      settings = (_vala_array_free (settings, settings_length1, (GDestroyNotify) g_free), NULL);
      _g_object_unref0 (caribou_settings);
}


static gboolean caribou_scanner_select (CaribouScanner* self) {
      gboolean result = FALSE;
      CaribouIScannableGroup* _tmp0_;
      CaribouIScannableItem* _tmp1_ = NULL;
      CaribouIScannableItem* item;
      CaribouIScannableItem* _tmp2_;
      g_return_val_if_fail (self != NULL, FALSE);
      _tmp0_ = self->priv->root_group;
      _tmp1_ = caribou_iscannable_group_child_select (_tmp0_);
      item = _tmp1_;
      _tmp2_ = item;
      if (CARIBOU_IS_ISCANNABLE_GROUP (_tmp2_)) {
            CaribouIScannableItem* _tmp3_ = NULL;
            CaribouIScannableItem* _tmp4_;
            _tmp3_ = caribou_scanner_step (self);
            _tmp4_ = _tmp3_;
            _g_object_unref0 (_tmp4_);
            result = TRUE;
            _g_object_unref0 (item);
            return result;
      } else {
            caribou_scanner_reset (self);
            result = FALSE;
            _g_object_unref0 (item);
            return result;
      }
      _g_object_unref0 (item);
}


static void caribou_scanner_switch_pressed (CaribouScanner* self, guint code, gboolean pressed) {
      gboolean _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = pressed;
      if (_tmp0_) {
            gboolean _tmp1_;
            gboolean _tmp4_;
            _tmp1_ = self->priv->started;
            if (!_tmp1_) {
                  CaribouIScannableItem* _tmp2_ = NULL;
                  CaribouIScannableItem* _tmp3_;
                  _tmp2_ = caribou_scanner_step (self);
                  _tmp3_ = _tmp2_;
                  _g_object_unref0 (_tmp3_);
                  caribou_scanner_start (self);
                  return;
            }
            caribou_scanner_stop (self);
            _tmp4_ = self->priv->_inverse_scanning;
            if (_tmp4_) {
                  CaribouIScannableItem* _tmp5_ = NULL;
                  CaribouIScannableItem* _tmp6_;
                  _tmp5_ = caribou_scanner_step (self);
                  _tmp6_ = _tmp5_;
                  _g_object_unref0 (_tmp6_);
                  caribou_scanner_start (self);
            } else {
                  gboolean _tmp7_ = FALSE;
                  gboolean _tmp8_ = FALSE;
                  gboolean _tmp10_;
                  _tmp8_ = caribou_scanner_select (self);
                  if (_tmp8_) {
                        _tmp7_ = TRUE;
                  } else {
                        gboolean _tmp9_;
                        _tmp9_ = self->priv->_autorestart;
                        _tmp7_ = _tmp9_;
                  }
                  _tmp10_ = _tmp7_;
                  if (_tmp10_) {
                        caribou_scanner_start (self);
                  }
            }
      }
}


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


static void _caribou_scanner_on_group_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
      caribou_scanner_on_group_changed (self, _sender, pspec);
}


static void _caribou_scanner_on_level_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
      caribou_scanner_on_level_changed (self, _sender, pspec);
}


void caribou_scanner_set_keyboard (CaribouScanner* self, CaribouKeyboardModel* keyboard) {
      CaribouKeyboardModel* _tmp0_;
      CaribouKeyboardModel* _tmp1_;
      const gchar* _tmp2_;
      const gchar* _tmp3_;
      CaribouGroupModel* _tmp4_ = NULL;
      CaribouGroupModel* group;
      CaribouKeyboardModel* _tmp5_;
      CaribouKeyboardModel* _tmp6_;
      CaribouKeyboardModel* _tmp7_;
      CaribouGroupModel* _tmp8_;
      CaribouGroupModel* _tmp9_;
      const gchar* _tmp10_;
      const gchar* _tmp11_;
      CaribouLevelModel* _tmp12_ = NULL;
      CaribouLevelModel* _tmp13_;
      CaribouKeyboardModel* _tmp14_;
      gint _tmp15_ = 0;
      gchar** _tmp16_ = NULL;
      g_return_if_fail (self != NULL);
      g_return_if_fail (keyboard != NULL);
      _tmp0_ = keyboard;
      _tmp1_ = keyboard;
      _tmp2_ = caribou_keyboard_model_get_active_group (_tmp1_);
      _tmp3_ = _tmp2_;
      _tmp4_ = caribou_keyboard_model_get_group (_tmp0_, _tmp3_);
      group = _tmp4_;
      _tmp5_ = keyboard;
      _tmp6_ = _g_object_ref0 (_tmp5_);
      _g_object_unref0 (self->priv->keyboard);
      self->priv->keyboard = _tmp6_;
      _tmp7_ = self->priv->keyboard;
      g_signal_connect_object ((GObject*) _tmp7_, "notify::active-group", (GCallback) _caribou_scanner_on_group_changed_g_object_notify, self, 0);
      _tmp8_ = group;
      _tmp9_ = group;
      _tmp10_ = caribou_group_model_get_active_level (_tmp9_);
      _tmp11_ = _tmp10_;
      _tmp12_ = caribou_group_model_get_level (_tmp8_, _tmp11_);
      _tmp13_ = _tmp12_;
      caribou_scanner_set_active_level (self, _tmp13_);
      _g_object_unref0 (_tmp13_);
      _tmp14_ = keyboard;
      _tmp16_ = caribou_keyboard_model_get_groups (_tmp14_, &_tmp15_);
      {
            gchar** group_name_collection = NULL;
            gint group_name_collection_length1 = 0;
            gint _group_name_collection_size_ = 0;
            gint group_name_it = 0;
            group_name_collection = _tmp16_;
            group_name_collection_length1 = _tmp15_;
            for (group_name_it = 0; group_name_it < _tmp15_; group_name_it = group_name_it + 1) {
                  gchar* _tmp17_;
                  gchar* group_name = NULL;
                  _tmp17_ = g_strdup (group_name_collection[group_name_it]);
                  group_name = _tmp17_;
                  {
                        CaribouKeyboardModel* _tmp18_;
                        const gchar* _tmp19_;
                        CaribouGroupModel* _tmp20_ = NULL;
                        CaribouGroupModel* _tmp21_;
                        _tmp18_ = keyboard;
                        _tmp19_ = group_name;
                        _tmp20_ = caribou_keyboard_model_get_group (_tmp18_, _tmp19_);
                        _g_object_unref0 (group);
                        group = _tmp20_;
                        _tmp21_ = group;
                        g_signal_connect_object ((GObject*) _tmp21_, "notify::active-level", (GCallback) _caribou_scanner_on_level_changed_g_object_notify, self, 0);
                        _g_free0 (group_name);
                  }
            }
            group_name_collection = (_vala_array_free (group_name_collection, group_name_collection_length1, (GDestroyNotify) g_free), NULL);
      }
      _g_object_unref0 (group);
}


static void caribou_scanner_on_level_changed (CaribouScanner* self, GObject* obj, GParamSpec* prop) {
      GObject* _tmp0_;
      CaribouGroupModel* _tmp1_;
      CaribouGroupModel* group;
      const gchar* _tmp2_;
      const gchar* _tmp3_;
      CaribouLevelModel* _tmp4_ = NULL;
      CaribouLevelModel* _tmp5_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (obj != NULL);
      g_return_if_fail (prop != NULL);
      _tmp0_ = obj;
      _tmp1_ = _g_object_ref0 (CARIBOU_GROUP_MODEL (_tmp0_));
      group = _tmp1_;
      _tmp2_ = caribou_group_model_get_active_level (group);
      _tmp3_ = _tmp2_;
      _tmp4_ = caribou_group_model_get_level (group, _tmp3_);
      _tmp5_ = _tmp4_;
      caribou_scanner_set_active_level (self, _tmp5_);
      _g_object_unref0 (_tmp5_);
      _g_object_unref0 (group);
}


static void caribou_scanner_on_group_changed (CaribouScanner* self, GObject* obj, GParamSpec* prop) {
      CaribouKeyboardModel* _tmp0_;
      CaribouKeyboardModel* _tmp1_;
      const gchar* _tmp2_;
      const gchar* _tmp3_;
      CaribouGroupModel* _tmp4_ = NULL;
      CaribouGroupModel* group;
      const gchar* _tmp5_;
      const gchar* _tmp6_;
      CaribouLevelModel* _tmp7_ = NULL;
      CaribouLevelModel* _tmp8_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (obj != NULL);
      g_return_if_fail (prop != NULL);
      _tmp0_ = self->priv->keyboard;
      _tmp1_ = self->priv->keyboard;
      _tmp2_ = caribou_keyboard_model_get_active_group (_tmp1_);
      _tmp3_ = _tmp2_;
      _tmp4_ = caribou_keyboard_model_get_group (_tmp0_, _tmp3_);
      group = _tmp4_;
      _tmp5_ = caribou_group_model_get_active_level (group);
      _tmp6_ = _tmp5_;
      _tmp7_ = caribou_group_model_get_level (group, _tmp6_);
      _tmp8_ = _tmp7_;
      caribou_scanner_set_active_level (self, _tmp8_);
      _g_object_unref0 (_tmp8_);
      _g_object_unref0 (group);
}


static void caribou_scanner_set_active_level (CaribouScanner* self, CaribouLevelModel* level) {
      CaribouLevelModel* _tmp0_;
      CaribouIScannableGroup* _tmp1_;
      CaribouIScannableGroup* _tmp2_;
      CaribouScanGrouping _tmp3_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (level != NULL);
      _tmp0_ = level;
      _tmp1_ = _g_object_ref0 (CARIBOU_ISCANNABLE_GROUP (_tmp0_));
      _g_object_unref0 (self->priv->root_group);
      self->priv->root_group = _tmp1_;
      _tmp2_ = self->priv->root_group;
      _tmp3_ = self->priv->_scan_grouping;
      caribou_iscannable_group_set_scan_grouping (_tmp2_, _tmp3_);
}


void caribou_scanner_reset (CaribouScanner* self) {
      CaribouIScannableGroup* _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = self->priv->root_group;
      if (_tmp0_ != NULL) {
            CaribouIScannableGroup* _tmp1_;
            _tmp1_ = self->priv->root_group;
            caribou_iscannable_group_scan_reset (_tmp1_);
      }
}


static void caribou_scanner_enable (CaribouScanner* self) {
      g_return_if_fail (self != NULL);
      caribou_scanner_configure_switch (self);
}


static void caribou_scanner_disable (CaribouScanner* self) {
      g_return_if_fail (self != NULL);
      caribou_scanner_unconfigure_switch (self);
}


static gboolean _caribou_scanner_scan_gsource_func (gpointer self) {
      gboolean result;
      result = caribou_scanner_scan (self);
      return result;
}


static void caribou_scanner_start (CaribouScanner* self) {
      gboolean _tmp0_ = FALSE;
      gboolean _tmp1_;
      gboolean _tmp3_;
      gdouble _tmp4_;
      guint _tmp5_ = 0U;
      g_return_if_fail (self != NULL);
      _tmp1_ = self->priv->started;
      if (_tmp1_) {
            _tmp0_ = TRUE;
      } else {
            CaribouIScannableGroup* _tmp2_;
            _tmp2_ = self->priv->root_group;
            _tmp0_ = _tmp2_ == NULL;
      }
      _tmp3_ = _tmp0_;
      if (_tmp3_) {
            return;
      }
      self->priv->started = TRUE;
      _tmp4_ = self->priv->_step_time;
      _tmp5_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) ((gint) (_tmp4_ * 1000)), _caribou_scanner_scan_gsource_func, g_object_ref (self), g_object_unref);
      self->priv->scan_tid = _tmp5_;
}


static void caribou_scanner_stop (CaribouScanner* self) {
      gboolean _tmp0_;
      guint _tmp1_;
      g_return_if_fail (self != NULL);
      _tmp0_ = self->priv->started;
      if (!_tmp0_) {
            return;
      }
      self->priv->started = FALSE;
      _tmp1_ = self->priv->scan_tid;
      if (_tmp1_ != ((guint) 0)) {
            guint _tmp2_;
            _tmp2_ = self->priv->scan_tid;
            g_source_remove (_tmp2_);
      }
      self->priv->scan_tid = (guint) 0;
}


static CaribouIScannableItem* caribou_scanner_step (CaribouScanner* self) {
      CaribouIScannableItem* result = NULL;
      CaribouIScannableGroup* _tmp0_;
      gint _tmp1_;
      CaribouIScannableItem* _tmp2_ = NULL;
      CaribouIScannableItem* item;
      CaribouIScannableItem* _tmp3_;
      g_return_val_if_fail (self != NULL, NULL);
      _tmp0_ = self->priv->root_group;
      _tmp1_ = self->priv->_scan_cycles;
      _tmp2_ = caribou_iscannable_group_child_step (_tmp0_, _tmp1_);
      item = _tmp2_;
      _tmp3_ = item;
      if (_tmp3_ == NULL) {
            caribou_scanner_reset (self);
      }
      result = item;
      return result;
}


static gboolean caribou_scanner_scan (CaribouScanner* self) {
      gboolean result = FALSE;
      gboolean _tmp0_;
      g_return_val_if_fail (self != NULL, FALSE);
      _tmp0_ = self->priv->_inverse_scanning;
      if (_tmp0_) {
            caribou_scanner_select (self);
      } else {
            CaribouIScannableItem* _tmp1_ = NULL;
            CaribouIScannableItem* _tmp2_;
            gboolean _tmp3_;
            _tmp1_ = caribou_scanner_step (self);
            _tmp2_ = _tmp1_;
            _tmp3_ = _tmp2_ != NULL;
            _g_object_unref0 (_tmp2_);
            result = _tmp3_;
            return result;
      }
      result = TRUE;
      return result;
}


static void caribou_scanner_unconfigure_switch (CaribouScanner* self) {
      CaribouScannerUnconfigureSwitchFunc _tmp0_;
      void* _tmp0__target;
      g_return_if_fail (self != NULL);
      _tmp0_ = self->priv->unconfigure_switch_func;
      _tmp0__target = self->priv->unconfigure_switch_func_target;
      if (_tmp0_ != NULL) {
            CaribouScannerUnconfigureSwitchFunc _tmp1_;
            void* _tmp1__target;
            _tmp1_ = self->priv->unconfigure_switch_func;
            _tmp1__target = self->priv->unconfigure_switch_func_target;
            _tmp1_ (_tmp1__target);
      }
      (self->priv->unconfigure_switch_func_target_destroy_notify == NULL) ? NULL : (self->priv->unconfigure_switch_func_target_destroy_notify (self->priv->unconfigure_switch_func_target), NULL);
      self->priv->unconfigure_switch_func = NULL;
      self->priv->unconfigure_switch_func_target = NULL;
      self->priv->unconfigure_switch_func_target_destroy_notify = NULL;
      self->priv->unconfigure_switch_func = NULL;
      self->priv->unconfigure_switch_func_target = NULL;
      self->priv->unconfigure_switch_func_target_destroy_notify = NULL;
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
      g_atomic_int_inc (&_data1_->_ref_count_);
      return _data1_;
}


static void block1_data_unref (Block1Data* _data1_) {
      if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
            _g_object_unref0 (_data1_->self);
            _g_object_unref0 (_data1_->xadapter);
            g_slice_free (Block1Data, _data1_);
      }
}


static Block2Data* block2_data_ref (Block2Data* _data2_) {
      g_atomic_int_inc (&_data2_->_ref_count_);
      return _data2_;
}


static void block2_data_unref (Block2Data* _data2_) {
      if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
            block1_data_unref (_data2_->_data1_);
            _data2_->_data1_ = NULL;
            g_slice_free (Block2Data, _data2_);
      }
}


static void _caribou_scanner_switch_pressed_caribou_xadapter_key_button_callback (guint keybuttoncode, gboolean pressed, gpointer self) {
      caribou_scanner_switch_pressed (self, keybuttoncode, pressed);
}


static void ___lambda12_ (Block2Data* _data2_) {
      Block1Data* _data1_;
      CaribouScanner * self;
      CaribouXAdapter* _tmp0_;
      guint _tmp1_;
      _data1_ = _data2_->_data1_;
      self = _data1_->self;
      _tmp0_ = _data1_->xadapter;
      _tmp1_ = _data2_->keyval;
      caribou_xadapter_register_key_func (_tmp0_, _tmp1_, NULL, NULL);
}


static void ____lambda12__caribou_scanner_unconfigure_switch_func (gpointer self) {
      ___lambda12_ (self);
}


static void ____lambda13_ (Block1Data* _data1_) {
      CaribouScanner * self;
      CaribouXAdapter* _tmp0_;
      gint _tmp1_;
      gint _tmp2_;
      self = _data1_->self;
      _tmp0_ = _data1_->xadapter;
      _tmp1_ = caribou_scanner_get_mouse_button (self);
      _tmp2_ = _tmp1_;
      caribou_xadapter_register_key_func (_tmp0_, (guint) _tmp2_, NULL, NULL);
}


static void _____lambda13__caribou_scanner_unconfigure_switch_func (gpointer self) {
      ____lambda13_ (self);
}


static void caribou_scanner_configure_switch (CaribouScanner* self) {
      Block1Data* _data1_;
      gboolean _tmp0_;
      gboolean _tmp1_;
      CaribouXAdapter* _tmp2_ = NULL;
      gboolean _tmp3_ = FALSE;
      const gchar* _tmp4_;
      const gchar* _tmp5_;
      gboolean _tmp8_;
      g_return_if_fail (self != NULL);
      _data1_ = g_slice_new0 (Block1Data);
      _data1_->_ref_count_ = 1;
      _data1_->self = g_object_ref (self);
      _tmp0_ = caribou_scanner_get_scan_enabled (self);
      _tmp1_ = _tmp0_;
      if (!_tmp1_) {
            block1_data_unref (_data1_);
            _data1_ = NULL;
            return;
      }
      caribou_scanner_unconfigure_switch (self);
      _tmp2_ = caribou_xadapter_get_default ();
      _data1_->xadapter = _tmp2_;
      _tmp4_ = caribou_scanner_get_switch_device (self);
      _tmp5_ = _tmp4_;
      if (g_strcmp0 (_tmp5_, "keyboard") == 0) {
            const gchar* _tmp6_;
            const gchar* _tmp7_;
            _tmp6_ = caribou_scanner_get_keyboard_key (self);
            _tmp7_ = _tmp6_;
            _tmp3_ = _tmp7_ != NULL;
      } else {
            _tmp3_ = FALSE;
      }
      _tmp8_ = _tmp3_;
      if (_tmp8_) {
            Block2Data* _data2_;
            const gchar* _tmp9_;
            const gchar* _tmp10_;
            guint _tmp11_ = 0U;
            CaribouXAdapter* _tmp12_;
            guint _tmp13_;
            _data2_ = g_slice_new0 (Block2Data);
            _data2_->_ref_count_ = 1;
            _data2_->_data1_ = block1_data_ref (_data1_);
            _tmp9_ = caribou_scanner_get_keyboard_key (self);
            _tmp10_ = _tmp9_;
            _tmp11_ = gdk_keyval_from_name (_tmp10_);
            _data2_->keyval = _tmp11_;
            _tmp12_ = _data1_->xadapter;
            _tmp13_ = _data2_->keyval;
            caribou_xadapter_register_key_func (_tmp12_, _tmp13_, _caribou_scanner_switch_pressed_caribou_xadapter_key_button_callback, self);
            (self->priv->unconfigure_switch_func_target_destroy_notify == NULL) ? NULL : (self->priv->unconfigure_switch_func_target_destroy_notify (self->priv->unconfigure_switch_func_target), NULL);
            self->priv->unconfigure_switch_func = NULL;
            self->priv->unconfigure_switch_func_target = NULL;
            self->priv->unconfigure_switch_func_target_destroy_notify = NULL;
            self->priv->unconfigure_switch_func = ____lambda12__caribou_scanner_unconfigure_switch_func;
            self->priv->unconfigure_switch_func_target = block2_data_ref (_data2_);
            self->priv->unconfigure_switch_func_target_destroy_notify = block2_data_unref;
            block2_data_unref (_data2_);
            _data2_ = NULL;
      } else {
            gboolean _tmp14_ = FALSE;
            const gchar* _tmp15_;
            const gchar* _tmp16_;
            gboolean _tmp19_;
            _tmp15_ = caribou_scanner_get_switch_device (self);
            _tmp16_ = _tmp15_;
            if (g_strcmp0 (_tmp16_, "mouse") == 0) {
                  gint _tmp17_;
                  gint _tmp18_;
                  _tmp17_ = caribou_scanner_get_mouse_button (self);
                  _tmp18_ = _tmp17_;
                  _tmp14_ = _tmp18_ != 0;
            } else {
                  _tmp14_ = FALSE;
            }
            _tmp19_ = _tmp14_;
            if (_tmp19_) {
                  CaribouXAdapter* _tmp20_;
                  gint _tmp21_;
                  gint _tmp22_;
                  _tmp20_ = _data1_->xadapter;
                  _tmp21_ = caribou_scanner_get_mouse_button (self);
                  _tmp22_ = _tmp21_;
                  caribou_xadapter_register_button_func (_tmp20_, (guint) _tmp22_, _caribou_scanner_switch_pressed_caribou_xadapter_key_button_callback, self);
                  (self->priv->unconfigure_switch_func_target_destroy_notify == NULL) ? NULL : (self->priv->unconfigure_switch_func_target_destroy_notify (self->priv->unconfigure_switch_func_target), NULL);
                  self->priv->unconfigure_switch_func = NULL;
                  self->priv->unconfigure_switch_func_target = NULL;
                  self->priv->unconfigure_switch_func_target_destroy_notify = NULL;
                  self->priv->unconfigure_switch_func = _____lambda13__caribou_scanner_unconfigure_switch_func;
                  self->priv->unconfigure_switch_func_target = block1_data_ref (_data1_);
                  self->priv->unconfigure_switch_func_target_destroy_notify = block1_data_unref;
            }
      }
      block1_data_unref (_data1_);
      _data1_ = NULL;
}


CaribouScanner* caribou_scanner_construct (GType object_type) {
      CaribouScanner * self = NULL;
      self = (CaribouScanner*) g_object_new (object_type, NULL);
      return self;
}


CaribouScanner* caribou_scanner_new (void) {
      return caribou_scanner_construct (CARIBOU_TYPE_SCANNER);
}


gboolean caribou_scanner_get_bind_settings (CaribouScanner* self) {
      gboolean result;
      gboolean _tmp0_;
      g_return_val_if_fail (self != NULL, FALSE);
      _tmp0_ = self->priv->_bind_settings;
      result = _tmp0_;
      return result;
}


static void caribou_scanner_set_bind_settings (CaribouScanner* self, gboolean value) {
      gboolean _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_bind_settings = _tmp0_;
      g_object_notify ((GObject *) self, "bind-settings");
}


gint caribou_scanner_get_scan_grouping (CaribouScanner* self) {
      gint result;
      CaribouScanGrouping _tmp0_;
      g_return_val_if_fail (self != NULL, 0);
      _tmp0_ = self->priv->_scan_grouping;
      result = (gint) _tmp0_;
      return result;
}


void caribou_scanner_set_scan_grouping (CaribouScanner* self, gint value) {
      gint _tmp0_;
      CaribouIScannableGroup* _tmp1_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_scan_grouping = (CaribouScanGrouping) _tmp0_;
      _tmp1_ = self->priv->root_group;
      if (_tmp1_ != NULL) {
            CaribouIScannableGroup* _tmp2_;
            CaribouScanGrouping _tmp3_;
            _tmp2_ = self->priv->root_group;
            _tmp3_ = self->priv->_scan_grouping;
            caribou_iscannable_group_set_scan_grouping (_tmp2_, _tmp3_);
      }
      caribou_scanner_reset (self);
      g_object_notify ((GObject *) self, "scan-grouping");
}


gboolean caribou_scanner_get_scan_enabled (CaribouScanner* self) {
      gboolean result;
      gboolean _tmp0_;
      g_return_val_if_fail (self != NULL, FALSE);
      _tmp0_ = self->priv->_scan_enabled;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_scan_enabled (CaribouScanner* self, gboolean value) {
      gboolean _tmp0_;
      gboolean _tmp1_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_scan_enabled = _tmp0_;
      _tmp1_ = self->priv->_scan_enabled;
      if (_tmp1_) {
            caribou_scanner_enable (self);
      } else {
            caribou_scanner_disable (self);
      }
      g_object_notify ((GObject *) self, "scan-enabled");
}


gdouble caribou_scanner_get_step_time (CaribouScanner* self) {
      gdouble result;
      gdouble _tmp0_;
      g_return_val_if_fail (self != NULL, 0.0);
      _tmp0_ = self->priv->_step_time;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_step_time (CaribouScanner* self, gdouble value) {
      gdouble _tmp0_;
      guint _tmp1_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_step_time = _tmp0_;
      _tmp1_ = self->priv->scan_tid;
      if (_tmp1_ != ((guint) 0)) {
            guint _tmp2_;
            gdouble _tmp3_;
            guint _tmp4_ = 0U;
            _tmp2_ = self->priv->scan_tid;
            g_source_remove (_tmp2_);
            _tmp3_ = self->priv->_step_time;
            _tmp4_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) ((gint) (_tmp3_ * 1000)), _caribou_scanner_scan_gsource_func, g_object_ref (self), g_object_unref);
            self->priv->scan_tid = _tmp4_;
      }
      g_object_notify ((GObject *) self, "step-time");
}


const gchar* caribou_scanner_get_switch_device (CaribouScanner* self) {
      const gchar* result;
      const gchar* _tmp0_;
      g_return_val_if_fail (self != NULL, NULL);
      _tmp0_ = self->priv->_switch_device;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_switch_device (CaribouScanner* self, const gchar* value) {
      const gchar* _tmp0_;
      gchar* _tmp1_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      _tmp1_ = g_strdup (_tmp0_);
      _g_free0 (self->priv->_switch_device);
      self->priv->_switch_device = _tmp1_;
      caribou_scanner_configure_switch (self);
      g_object_notify ((GObject *) self, "switch-device");
}


const gchar* caribou_scanner_get_keyboard_key (CaribouScanner* self) {
      const gchar* result;
      const gchar* _tmp0_;
      g_return_val_if_fail (self != NULL, NULL);
      _tmp0_ = self->priv->_keyboard_key;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_keyboard_key (CaribouScanner* self, const gchar* value) {
      const gchar* _tmp0_;
      gchar* _tmp1_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      _tmp1_ = g_strdup (_tmp0_);
      _g_free0 (self->priv->_keyboard_key);
      self->priv->_keyboard_key = _tmp1_;
      caribou_scanner_configure_switch (self);
      g_object_notify ((GObject *) self, "keyboard-key");
}


gint caribou_scanner_get_mouse_button (CaribouScanner* self) {
      gint result;
      gint _tmp0_;
      g_return_val_if_fail (self != NULL, 0);
      _tmp0_ = self->priv->_mouse_button;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_mouse_button (CaribouScanner* self, gint value) {
      gint _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_mouse_button = _tmp0_;
      caribou_scanner_configure_switch (self);
      g_object_notify ((GObject *) self, "mouse-button");
}


gint caribou_scanner_get_scan_cycles (CaribouScanner* self) {
      gint result;
      gint _tmp0_;
      g_return_val_if_fail (self != NULL, 0);
      _tmp0_ = self->priv->_scan_cycles;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_scan_cycles (CaribouScanner* self, gint value) {
      gint _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_scan_cycles = _tmp0_;
      g_object_notify ((GObject *) self, "scan-cycles");
}


gboolean caribou_scanner_get_autorestart (CaribouScanner* self) {
      gboolean result;
      gboolean _tmp0_;
      g_return_val_if_fail (self != NULL, FALSE);
      _tmp0_ = self->priv->_autorestart;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_autorestart (CaribouScanner* self, gboolean value) {
      gboolean _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_autorestart = _tmp0_;
      g_object_notify ((GObject *) self, "autorestart");
}


gboolean caribou_scanner_get_inverse_scanning (CaribouScanner* self) {
      gboolean result;
      gboolean _tmp0_;
      g_return_val_if_fail (self != NULL, FALSE);
      _tmp0_ = self->priv->_inverse_scanning;
      result = _tmp0_;
      return result;
}


void caribou_scanner_set_inverse_scanning (CaribouScanner* self, gboolean value) {
      gboolean _tmp0_;
      g_return_if_fail (self != NULL);
      _tmp0_ = value;
      self->priv->_inverse_scanning = _tmp0_;
      g_object_notify ((GObject *) self, "inverse-scanning");
}


static GObject * caribou_scanner_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
      GObject * obj;
      GObjectClass * parent_class;
      CaribouScanner * self;
      gchar* _tmp0_;
      gboolean _tmp1_;
      parent_class = G_OBJECT_CLASS (caribou_scanner_parent_class);
      obj = parent_class->constructor (type, n_construct_properties, construct_properties);
      self = CARIBOU_SCANNER (obj);
      self->priv->_scan_grouping = CARIBOU_SCAN_GROUPING_SUBGROUPS;
      self->priv->_step_time = 1.0;
      _tmp0_ = g_strdup ("keyboard");
      _g_free0 (self->priv->_switch_device);
      self->priv->_switch_device = _tmp0_;
      _tmp1_ = self->priv->_bind_settings;
      if (_tmp1_) {
            caribou_scanner_do_bind_settings (self);
      }
      return obj;
}


static void caribou_scanner_class_init (CaribouScannerClass * klass) {
      caribou_scanner_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (CaribouScannerPrivate));
      G_OBJECT_CLASS (klass)->get_property = _vala_caribou_scanner_get_property;
      G_OBJECT_CLASS (klass)->set_property = _vala_caribou_scanner_set_property;
      G_OBJECT_CLASS (klass)->constructor = caribou_scanner_constructor;
      G_OBJECT_CLASS (klass)->finalize = caribou_scanner_finalize;
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_BIND_SETTINGS, g_param_spec_boolean ("bind-settings", "bind-settings", "bind-settings", TRUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_SCAN_GROUPING, g_param_spec_int ("scan-grouping", "scan-grouping", "scan-grouping", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_SCAN_ENABLED, g_param_spec_boolean ("scan-enabled", "scan-enabled", "scan-enabled", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_STEP_TIME, g_param_spec_double ("step-time", "step-time", "step-time", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_SWITCH_DEVICE, g_param_spec_string ("switch-device", "switch-device", "switch-device", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_KEYBOARD_KEY, g_param_spec_string ("keyboard-key", "keyboard-key", "keyboard-key", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_MOUSE_BUTTON, g_param_spec_int ("mouse-button", "mouse-button", "mouse-button", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_SCAN_CYCLES, g_param_spec_int ("scan-cycles", "scan-cycles", "scan-cycles", G_MININT, G_MAXINT, 1, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_AUTORESTART, g_param_spec_boolean ("autorestart", "autorestart", "autorestart", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
      g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_SCANNER_INVERSE_SCANNING, g_param_spec_boolean ("inverse-scanning", "inverse-scanning", "inverse-scanning", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}


static void caribou_scanner_instance_init (CaribouScanner * self) {
      self->priv = CARIBOU_SCANNER_GET_PRIVATE (self);
      self->priv->_bind_settings = TRUE;
      self->priv->_scan_cycles = 1;
      self->priv->_autorestart = FALSE;
      self->priv->_inverse_scanning = FALSE;
}


static void caribou_scanner_finalize (GObject* obj) {
      CaribouScanner * self;
      self = CARIBOU_SCANNER (obj);
      _g_free0 (self->priv->_switch_device);
      _g_free0 (self->priv->_keyboard_key);
      (self->priv->unconfigure_switch_func_target_destroy_notify == NULL) ? NULL : (self->priv->unconfigure_switch_func_target_destroy_notify (self->priv->unconfigure_switch_func_target), NULL);
      self->priv->unconfigure_switch_func = NULL;
      self->priv->unconfigure_switch_func_target = NULL;
      self->priv->unconfigure_switch_func_target_destroy_notify = NULL;
      _g_object_unref0 (self->priv->keyboard);
      _g_object_unref0 (self->priv->root_group);
      G_OBJECT_CLASS (caribou_scanner_parent_class)->finalize (obj);
}


GType caribou_scanner_get_type (void) {
      static volatile gsize caribou_scanner_type_id__volatile = 0;
      if (g_once_init_enter (&caribou_scanner_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (CaribouScannerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_scanner_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouScanner), 0, (GInstanceInitFunc) caribou_scanner_instance_init, NULL };
            GType caribou_scanner_type_id;
            caribou_scanner_type_id = g_type_register_static (G_TYPE_OBJECT, "CaribouScanner", &g_define_type_info, 0);
            g_once_init_leave (&caribou_scanner_type_id__volatile, caribou_scanner_type_id);
      }
      return caribou_scanner_type_id__volatile;
}


static void _vala_caribou_scanner_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      CaribouScanner * self;
      self = CARIBOU_SCANNER (object);
      switch (property_id) {
            case CARIBOU_SCANNER_BIND_SETTINGS:
            g_value_set_boolean (value, caribou_scanner_get_bind_settings (self));
            break;
            case CARIBOU_SCANNER_SCAN_GROUPING:
            g_value_set_int (value, caribou_scanner_get_scan_grouping (self));
            break;
            case CARIBOU_SCANNER_SCAN_ENABLED:
            g_value_set_boolean (value, caribou_scanner_get_scan_enabled (self));
            break;
            case CARIBOU_SCANNER_STEP_TIME:
            g_value_set_double (value, caribou_scanner_get_step_time (self));
            break;
            case CARIBOU_SCANNER_SWITCH_DEVICE:
            g_value_set_string (value, caribou_scanner_get_switch_device (self));
            break;
            case CARIBOU_SCANNER_KEYBOARD_KEY:
            g_value_set_string (value, caribou_scanner_get_keyboard_key (self));
            break;
            case CARIBOU_SCANNER_MOUSE_BUTTON:
            g_value_set_int (value, caribou_scanner_get_mouse_button (self));
            break;
            case CARIBOU_SCANNER_SCAN_CYCLES:
            g_value_set_int (value, caribou_scanner_get_scan_cycles (self));
            break;
            case CARIBOU_SCANNER_AUTORESTART:
            g_value_set_boolean (value, caribou_scanner_get_autorestart (self));
            break;
            case CARIBOU_SCANNER_INVERSE_SCANNING:
            g_value_set_boolean (value, caribou_scanner_get_inverse_scanning (self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void _vala_caribou_scanner_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      CaribouScanner * self;
      self = CARIBOU_SCANNER (object);
      switch (property_id) {
            case CARIBOU_SCANNER_BIND_SETTINGS:
            caribou_scanner_set_bind_settings (self, g_value_get_boolean (value));
            break;
            case CARIBOU_SCANNER_SCAN_GROUPING:
            caribou_scanner_set_scan_grouping (self, g_value_get_int (value));
            break;
            case CARIBOU_SCANNER_SCAN_ENABLED:
            caribou_scanner_set_scan_enabled (self, g_value_get_boolean (value));
            break;
            case CARIBOU_SCANNER_STEP_TIME:
            caribou_scanner_set_step_time (self, g_value_get_double (value));
            break;
            case CARIBOU_SCANNER_SWITCH_DEVICE:
            caribou_scanner_set_switch_device (self, g_value_get_string (value));
            break;
            case CARIBOU_SCANNER_KEYBOARD_KEY:
            caribou_scanner_set_keyboard_key (self, g_value_get_string (value));
            break;
            case CARIBOU_SCANNER_MOUSE_BUTTON:
            caribou_scanner_set_mouse_button (self, g_value_get_int (value));
            break;
            case CARIBOU_SCANNER_SCAN_CYCLES:
            caribou_scanner_set_scan_cycles (self, g_value_get_int (value));
            break;
            case CARIBOU_SCANNER_AUTORESTART:
            caribou_scanner_set_autorestart (self, g_value_get_boolean (value));
            break;
            case CARIBOU_SCANNER_INVERSE_SCANNING:
            caribou_scanner_set_inverse_scanning (self, g_value_get_boolean (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