/* bookmarks-controller.c generated by valac 0.56.3, the Vala compiler
 * generated from bookmarks-controller.vala, do not modify */

/*
  This file is part of Dconf Editor

  Dconf Editor 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.

  Dconf Editor 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 Dconf Editor.  If not, see <https://www.gnu.org/licenses/>.
*/

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

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_BOOKMARKS_CONTROLLER (bookmarks_controller_get_type ())
#define BOOKMARKS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOKMARKS_CONTROLLER, BookmarksController))
#define BOOKMARKS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOOKMARKS_CONTROLLER, BookmarksControllerClass))
#define IS_BOOKMARKS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOOKMARKS_CONTROLLER))
#define IS_BOOKMARKS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOOKMARKS_CONTROLLER))
#define BOOKMARKS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOOKMARKS_CONTROLLER, BookmarksControllerClass))

typedef struct _BookmarksController BookmarksController;
typedef struct _BookmarksControllerClass BookmarksControllerClass;
typedef struct _BookmarksControllerPrivate BookmarksControllerPrivate;
enum  {
	BOOKMARKS_CONTROLLER_0_PROPERTY,
	BOOKMARKS_CONTROLLER_SHOW_ROWS_SIZE_BUTTON_PROPERTY,
	BOOKMARKS_CONTROLLER_CONTROLLER_ACTION_PREFIX_PROPERTY,
	BOOKMARKS_CONTROLLER_NUM_PROPERTIES
};
static GParamSpec* bookmarks_controller_properties[BOOKMARKS_CONTROLLER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BookmarksController {
	GtkGrid parent_instance;
	BookmarksControllerPrivate * priv;
};

struct _BookmarksControllerClass {
	GtkGridClass parent_class;
};

struct _BookmarksControllerPrivate {
	GtkImage* big_rows_icon;
	GtkImage* small_rows_icon;
	GtkButton* rows_size_button;
	gboolean _show_rows_size_button;
	GtkButton* trash_bookmark_button;
	GtkButton* move_top_button;
	GtkButton* move_up_button;
	GtkButton* move_down_button;
	GtkButton* move_bottom_button;
};

static gint BookmarksController_private_offset;
static gpointer bookmarks_controller_parent_class = NULL;

VALA_EXTERN GType bookmarks_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BookmarksController, g_object_unref)
VALA_EXTERN BookmarksController* bookmarks_controller_new (const gchar* _controller_action_prefix,
                                               gboolean _show_rows_size_button);
VALA_EXTERN BookmarksController* bookmarks_controller_construct (GType object_type,
                                                     const gchar* _controller_action_prefix,
                                                     gboolean _show_rows_size_button);
VALA_EXTERN void bookmarks_controller_update_rows_size_button_icon (BookmarksController* self,
                                                        gboolean small_bookmarks_rows);
VALA_EXTERN gboolean bookmarks_controller_get_small_rows_state (BookmarksController* self);
static gboolean bookmarks_controller_get_show_rows_size_button (BookmarksController* self);
static void bookmarks_controller_set_show_rows_size_button (BookmarksController* self,
                                                     gboolean value);
static void bookmarks_controller_set_controller_action_prefix (BookmarksController* self,
                                                        const gchar* value);
static GObject * bookmarks_controller_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void bookmarks_controller_finalize (GObject * obj);
static GType bookmarks_controller_get_type_once (void);
static void _vala_bookmarks_controller_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_bookmarks_controller_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
bookmarks_controller_get_instance_private (BookmarksController* self)
{
	return G_STRUCT_MEMBER_P (self, BookmarksController_private_offset);
}

BookmarksController*
bookmarks_controller_construct (GType object_type,
                                const gchar* _controller_action_prefix,
                                gboolean _show_rows_size_button)
{
	BookmarksController * self = NULL;
	g_return_val_if_fail (_controller_action_prefix != NULL, NULL);
	self = (BookmarksController*) g_object_new (object_type, "controller-action-prefix", _controller_action_prefix, "show-rows-size-button", _show_rows_size_button, NULL);
	return self;
}

BookmarksController*
bookmarks_controller_new (const gchar* _controller_action_prefix,
                          gboolean _show_rows_size_button)
{
	return bookmarks_controller_construct (TYPE_BOOKMARKS_CONTROLLER, _controller_action_prefix, _show_rows_size_button);
}

void
bookmarks_controller_update_rows_size_button_icon (BookmarksController* self,
                                                   gboolean small_bookmarks_rows)
{
	g_return_if_fail (self != NULL);
	if (small_bookmarks_rows) {
		GtkButton* _tmp0_;
		GtkImage* _tmp1_;
		_tmp0_ = self->priv->rows_size_button;
		_tmp1_ = self->priv->big_rows_icon;
		gtk_button_set_image (_tmp0_, (GtkWidget*) _tmp1_);
	} else {
		GtkButton* _tmp2_;
		GtkImage* _tmp3_;
		_tmp2_ = self->priv->rows_size_button;
		_tmp3_ = self->priv->small_rows_icon;
		gtk_button_set_image (_tmp2_, (GtkWidget*) _tmp3_);
	}
}

gboolean
bookmarks_controller_get_small_rows_state (BookmarksController* self)
{
	GtkButton* _tmp0_;
	GtkWidget* _tmp1_;
	GtkImage* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->rows_size_button;
	_tmp1_ = gtk_button_get_image (_tmp0_);
	_tmp2_ = self->priv->small_rows_icon;
	result = _tmp1_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget);
	return result;
}

static gboolean
bookmarks_controller_get_show_rows_size_button (BookmarksController* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_rows_size_button;
	return result;
}

static void
bookmarks_controller_set_show_rows_size_button (BookmarksController* self,
                                                gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_show_rows_size_button = value;
}

static void
bookmarks_controller_set_controller_action_prefix (BookmarksController* self,
                                                   const gchar* value)
{
	GtkButton* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkButton* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GtkButton* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GtkButton* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GtkButton* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->trash_bookmark_button;
	_tmp1_ = g_strconcat (value, ".trash-bookmark", NULL);
	_tmp2_ = _tmp1_;
	gtk_actionable_set_detailed_action_name ((GtkActionable*) _tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = self->priv->move_top_button;
	_tmp4_ = g_strconcat (value, ".move-top", NULL);
	_tmp5_ = _tmp4_;
	gtk_actionable_set_detailed_action_name ((GtkActionable*) _tmp3_, _tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = self->priv->move_up_button;
	_tmp7_ = g_strconcat (value, ".move-up", NULL);
	_tmp8_ = _tmp7_;
	gtk_actionable_set_detailed_action_name ((GtkActionable*) _tmp6_, _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = self->priv->move_down_button;
	_tmp10_ = g_strconcat (value, ".move-down", NULL);
	_tmp11_ = _tmp10_;
	gtk_actionable_set_detailed_action_name ((GtkActionable*) _tmp9_, _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = self->priv->move_bottom_button;
	_tmp13_ = g_strconcat (value, ".move-bottom", NULL);
	_tmp14_ = _tmp13_;
	gtk_actionable_set_detailed_action_name ((GtkActionable*) _tmp12_, _tmp14_);
	_g_free0 (_tmp14_);
}

static GObject *
bookmarks_controller_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BookmarksController * self;
	gboolean _tmp0_;
	parent_class = G_OBJECT_CLASS (bookmarks_controller_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOOKMARKS_CONTROLLER, BookmarksController);
	_tmp0_ = self->priv->_show_rows_size_button;
	if (_tmp0_) {
		GtkButton* _tmp1_;
		_tmp1_ = self->priv->rows_size_button;
		gtk_widget_show ((GtkWidget*) _tmp1_);
	} else {
		GtkButton* _tmp2_;
		_tmp2_ = self->priv->rows_size_button;
		gtk_widget_hide ((GtkWidget*) _tmp2_);
	}
	return obj;
}

static void
bookmarks_controller_class_init (BookmarksControllerClass * klass,
                                 gpointer klass_data)
{
	bookmarks_controller_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BookmarksController_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_bookmarks_controller_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_bookmarks_controller_set_property;
	G_OBJECT_CLASS (klass)->constructor = bookmarks_controller_constructor;
	G_OBJECT_CLASS (klass)->finalize = bookmarks_controller_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOOKMARKS_CONTROLLER_SHOW_ROWS_SIZE_BUTTON_PROPERTY, bookmarks_controller_properties[BOOKMARKS_CONTROLLER_SHOW_ROWS_SIZE_BUTTON_PROPERTY] = g_param_spec_boolean ("show-rows-size-button", "show-rows-size-button", "show-rows-size-button", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOOKMARKS_CONTROLLER_CONTROLLER_ACTION_PREFIX_PROPERTY, bookmarks_controller_properties[BOOKMARKS_CONTROLLER_CONTROLLER_ACTION_PREFIX_PROPERTY] = g_param_spec_string ("controller-action-prefix", "controller-action-prefix", "controller-action-prefix", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/ca/desrt/dconf-editor/ui/bookmarks-controller.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "big_rows_icon", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, big_rows_icon));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "small_rows_icon", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, small_rows_icon));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "rows_size_button", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, rows_size_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "trash_bookmark_button", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, trash_bookmark_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "move_top_button", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, move_top_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "move_up_button", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, move_up_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "move_down_button", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, move_down_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "move_bottom_button", FALSE, BookmarksController_private_offset + G_STRUCT_OFFSET (BookmarksControllerPrivate, move_bottom_button));
}

static void
bookmarks_controller_instance_init (BookmarksController * self,
                                    gpointer klass)
{
	self->priv = bookmarks_controller_get_instance_private (self);
	self->priv->_show_rows_size_button = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
bookmarks_controller_finalize (GObject * obj)
{
	BookmarksController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOOKMARKS_CONTROLLER, BookmarksController);
	G_OBJECT_CLASS (bookmarks_controller_parent_class)->finalize (obj);
}

static GType
bookmarks_controller_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BookmarksControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bookmarks_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BookmarksController), 0, (GInstanceInitFunc) bookmarks_controller_instance_init, NULL };
	GType bookmarks_controller_type_id;
	bookmarks_controller_type_id = g_type_register_static (gtk_grid_get_type (), "BookmarksController", &g_define_type_info, 0);
	BookmarksController_private_offset = g_type_add_instance_private (bookmarks_controller_type_id, sizeof (BookmarksControllerPrivate));
	return bookmarks_controller_type_id;
}

GType
bookmarks_controller_get_type (void)
{
	static volatile gsize bookmarks_controller_type_id__once = 0;
	if (g_once_init_enter (&bookmarks_controller_type_id__once)) {
		GType bookmarks_controller_type_id;
		bookmarks_controller_type_id = bookmarks_controller_get_type_once ();
		g_once_init_leave (&bookmarks_controller_type_id__once, bookmarks_controller_type_id);
	}
	return bookmarks_controller_type_id__once;
}

static void
_vala_bookmarks_controller_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	BookmarksController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BOOKMARKS_CONTROLLER, BookmarksController);
	switch (property_id) {
		case BOOKMARKS_CONTROLLER_SHOW_ROWS_SIZE_BUTTON_PROPERTY:
		g_value_set_boolean (value, bookmarks_controller_get_show_rows_size_button (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_bookmarks_controller_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	BookmarksController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BOOKMARKS_CONTROLLER, BookmarksController);
	switch (property_id) {
		case BOOKMARKS_CONTROLLER_SHOW_ROWS_SIZE_BUTTON_PROPERTY:
		bookmarks_controller_set_show_rows_size_button (self, g_value_get_boolean (value));
		break;
		case BOOKMARKS_CONTROLLER_CONTROLLER_ACTION_PREFIX_PROPERTY:
		bookmarks_controller_set_controller_action_prefix (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

