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

/*  This file is part of corebird, a Gtk+ linux Twitter client.
 *  Copyright (C) 2013 Timm Bäder
 *
 *  corebird is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  corebird is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with corebird.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>


#define TYPE_DOUBLE_TAP_BUTTON (double_tap_button_get_type ())
#define DOUBLE_TAP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOUBLE_TAP_BUTTON, DoubleTapButton))
#define DOUBLE_TAP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOUBLE_TAP_BUTTON, DoubleTapButtonClass))
#define IS_DOUBLE_TAP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOUBLE_TAP_BUTTON))
#define IS_DOUBLE_TAP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOUBLE_TAP_BUTTON))
#define DOUBLE_TAP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOUBLE_TAP_BUTTON, DoubleTapButtonClass))

typedef struct _DoubleTapButton DoubleTapButton;
typedef struct _DoubleTapButtonClass DoubleTapButtonClass;
typedef struct _DoubleTapButtonPrivate DoubleTapButtonPrivate;

struct _DoubleTapButton {
	GtkToggleButton parent_instance;
	DoubleTapButtonPrivate * priv;
};

struct _DoubleTapButtonClass {
	GtkToggleButtonClass parent_class;
};

struct _DoubleTapButtonPrivate {
	gboolean first_step;
};


static gpointer double_tap_button_parent_class = NULL;

GType double_tap_button_get_type (void) G_GNUC_CONST;
#define DOUBLE_TAP_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DOUBLE_TAP_BUTTON, DoubleTapButtonPrivate))
enum  {
	DOUBLE_TAP_BUTTON_DUMMY_PROPERTY
};
void double_tap_button_reset (DoubleTapButton* self);
void double_tap_button_tap (DoubleTapButton* self);
DoubleTapButton* double_tap_button_new (void);
DoubleTapButton* double_tap_button_construct (GType object_type);
static void double_tap_button_finalize (GObject* obj);


void double_tap_button_reset (DoubleTapButton* self) {
	g_return_if_fail (IS_DOUBLE_TAP_BUTTON (self));
	self->priv->first_step = FALSE;
}


void double_tap_button_tap (DoubleTapButton* self) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (IS_DOUBLE_TAP_BUTTON (self));
	_tmp0_ = self->priv->first_step;
	if (!_tmp0_) {
		self->priv->first_step = TRUE;
		return;
	}
	_tmp1_ = gtk_toggle_button_get_active (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_toggle_button_get_type (), GtkToggleButton));
	_tmp2_ = _tmp1_;
	gtk_toggle_button_set_active (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_toggle_button_get_type (), GtkToggleButton), !_tmp2_);
	self->priv->first_step = FALSE;
}


DoubleTapButton* double_tap_button_construct (GType object_type) {
	DoubleTapButton * self = NULL;
	self = (DoubleTapButton*) g_object_new (object_type, NULL);
	return self;
}


DoubleTapButton* double_tap_button_new (void) {
	return double_tap_button_construct (TYPE_DOUBLE_TAP_BUTTON);
}


static void double_tap_button_class_init (DoubleTapButtonClass * klass) {
	double_tap_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (DoubleTapButtonPrivate));
	G_OBJECT_CLASS (klass)->finalize = double_tap_button_finalize;
}


static void double_tap_button_instance_init (DoubleTapButton * self) {
	self->priv = DOUBLE_TAP_BUTTON_GET_PRIVATE (self);
	self->priv->first_step = FALSE;
}


static void double_tap_button_finalize (GObject* obj) {
	DoubleTapButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DOUBLE_TAP_BUTTON, DoubleTapButton);
	G_OBJECT_CLASS (double_tap_button_parent_class)->finalize (obj);
}


GType double_tap_button_get_type (void) {
	static volatile gsize double_tap_button_type_id__volatile = 0;
	if (g_once_init_enter (&double_tap_button_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DoubleTapButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) double_tap_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DoubleTapButton), 0, (GInstanceInitFunc) double_tap_button_instance_init, NULL };
		GType double_tap_button_type_id;
		double_tap_button_type_id = g_type_register_static (gtk_toggle_button_get_type (), "DoubleTapButton", &g_define_type_info, 0);
		g_once_init_leave (&double_tap_button_type_id__volatile, double_tap_button_type_id);
	}
	return double_tap_button_type_id__volatile;
}



