/* Sidebar.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Sidebar.vala, do not modify */

/* Sidebar.vala
 *
 * Copyright (C) 2020-2024 Jerry Casiano
 *
 * This program 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.
 *
 * This program 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 this program.
 *
 * If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>.
*/

#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include "font-manager.h"
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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 FONT_MANAGER_TYPE_CACHEABLE (font_manager_cacheable_get_type ())
#define FONT_MANAGER_CACHEABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_MANAGER_TYPE_CACHEABLE, FontManagerCacheable))
#define FONT_MANAGER_CACHEABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FONT_MANAGER_TYPE_CACHEABLE, FontManagerCacheableClass))
#define FONT_MANAGER_IS_CACHEABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FONT_MANAGER_TYPE_CACHEABLE))
#define FONT_MANAGER_IS_CACHEABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FONT_MANAGER_TYPE_CACHEABLE))
#define FONT_MANAGER_CACHEABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FONT_MANAGER_TYPE_CACHEABLE, FontManagerCacheableClass))

typedef struct _FontManagerCacheable FontManagerCacheable;
typedef struct _FontManagerCacheableClass FontManagerCacheableClass;
typedef struct _FontManagerCacheablePrivate FontManagerCacheablePrivate;

#define FONT_MANAGER_TYPE_FONT_LIST_FILTER (font_manager_font_list_filter_get_type ())
#define FONT_MANAGER_FONT_LIST_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_MANAGER_TYPE_FONT_LIST_FILTER, FontManagerFontListFilter))
#define FONT_MANAGER_FONT_LIST_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FONT_MANAGER_TYPE_FONT_LIST_FILTER, FontManagerFontListFilterClass))
#define FONT_MANAGER_IS_FONT_LIST_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FONT_MANAGER_TYPE_FONT_LIST_FILTER))
#define FONT_MANAGER_IS_FONT_LIST_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FONT_MANAGER_TYPE_FONT_LIST_FILTER))
#define FONT_MANAGER_FONT_LIST_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FONT_MANAGER_TYPE_FONT_LIST_FILTER, FontManagerFontListFilterClass))

typedef struct _FontManagerFontListFilter FontManagerFontListFilter;
typedef struct _FontManagerFontListFilterClass FontManagerFontListFilterClass;
typedef struct _FontManagerFontListFilterPrivate FontManagerFontListFilterPrivate;

#define FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER (font_manager_google_fonts_filter_get_type ())
#define FONT_MANAGER_GOOGLE_FONTS_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, FontManagerGoogleFontsFilter))
#define FONT_MANAGER_GOOGLE_FONTS_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, FontManagerGoogleFontsFilterClass))
#define FONT_MANAGER_GOOGLE_FONTS_IS_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER))
#define FONT_MANAGER_GOOGLE_FONTS_IS_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER))
#define FONT_MANAGER_GOOGLE_FONTS_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, FontManagerGoogleFontsFilterClass))

typedef struct _FontManagerGoogleFontsFilter FontManagerGoogleFontsFilter;
typedef struct _FontManagerGoogleFontsFilterClass FontManagerGoogleFontsFilterClass;
typedef struct _FontManagerGoogleFontsFilterPrivate FontManagerGoogleFontsFilterPrivate;
enum  {
	FONT_MANAGER_GOOGLE_FONTS_FILTER_0_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_FILTER_N_VARIATIONS_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_FILTER_CATEGORIES_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_FILTER_LANGUAGE_SUPPORT_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_FILTER_NUM_PROPERTIES
};
static GParamSpec* font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY (font_manager_google_fonts_family_get_type ())
#define FONT_MANAGER_GOOGLE_FONTS_FAMILY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY, FontManagerGoogleFontsFamily))
#define FONT_MANAGER_GOOGLE_FONTS_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY, FontManagerGoogleFontsFamilyClass))
#define FONT_MANAGER_GOOGLE_FONTS_IS_FAMILY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY))
#define FONT_MANAGER_GOOGLE_FONTS_IS_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY))
#define FONT_MANAGER_GOOGLE_FONTS_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY, FontManagerGoogleFontsFamilyClass))

typedef struct _FontManagerGoogleFontsFamily FontManagerGoogleFontsFamily;
typedef struct _FontManagerGoogleFontsFamilyClass FontManagerGoogleFontsFamilyClass;
#define _g_free0(var) (var = (g_free (var), NULL))

#define FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR (font_manager_google_fonts_sidebar_get_type ())
#define FONT_MANAGER_GOOGLE_FONTS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, FontManagerGoogleFontsSidebar))
#define FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, FontManagerGoogleFontsSidebarClass))
#define FONT_MANAGER_GOOGLE_FONTS_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR))
#define FONT_MANAGER_GOOGLE_FONTS_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR))
#define FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, FontManagerGoogleFontsSidebarClass))

typedef struct _FontManagerGoogleFontsSidebar FontManagerGoogleFontsSidebar;
typedef struct _FontManagerGoogleFontsSidebarClass FontManagerGoogleFontsSidebarClass;
typedef struct _FontManagerGoogleFontsSidebarPrivate FontManagerGoogleFontsSidebarPrivate;
enum  {
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_0_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_N_VARIATIONS_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_FILTER_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CATEGORIES_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_LANGUAGE_SUPPORT_PROPERTY,
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_NUM_PROPERTIES
};
static GParamSpec* font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_NUM_PROPERTIES];

#define FONT_MANAGER_GOOGLE_FONTS_TYPE_LANGUAGE_DATA (font_manager_google_fonts_language_data_get_type ())
typedef struct _FontManagerGoogleFontsLanguageData FontManagerGoogleFontsLanguageData;
enum  {
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_SORT_CHANGED_SIGNAL,
	FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_NUM_SIGNALS
};
static guint font_manager_google_fonts_sidebar_signals[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_NUM_SIGNALS] = {0};

struct _FontManagerCacheable {
	GObject parent_instance;
	FontManagerCacheablePrivate * priv;
};

struct _FontManagerCacheableClass {
	GObjectClass parent_class;
	gboolean (*deserialize_property) (FontManagerCacheable* self, const gchar* prop_name, GValue* val, GParamSpec* pspec, JsonNode* node);
	JsonNode* (*serialize_property) (FontManagerCacheable* self, const gchar* prop_name, GValue* val, GParamSpec* pspec);
};

struct _FontManagerFontListFilter {
	FontManagerCacheable parent_instance;
	FontManagerFontListFilterPrivate * priv;
};

struct _FontManagerFontListFilterClass {
	FontManagerCacheableClass parent_class;
	void (*update) (FontManagerFontListFilter* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*update_finish) (FontManagerFontListFilter* self, GAsyncResult* _res_);
	gboolean (*matches) (FontManagerFontListFilter* self, GObject* item);
	gchar* (*get_name) (FontManagerFontListFilter* self);
	void (*set_name) (FontManagerFontListFilter* self, const gchar* value);
	gchar* (*get_icon) (FontManagerFontListFilter* self);
	void (*set_icon) (FontManagerFontListFilter* self, const gchar* value);
	gchar* (*get_comment) (FontManagerFontListFilter* self);
	void (*set_comment) (FontManagerFontListFilter* self, const gchar* value);
	gint (*get_index) (FontManagerFontListFilter* self);
	void (*set_index) (FontManagerFontListFilter* self, gint value);
	gint (*get_size) (FontManagerFontListFilter* self);
	gint (*get_depth) (FontManagerFontListFilter* self);
	void (*set_depth) (FontManagerFontListFilter* self, gint value);
};

struct _FontManagerGoogleFontsFilter {
	FontManagerFontListFilter parent_instance;
	FontManagerGoogleFontsFilterPrivate * priv;
};

struct _FontManagerGoogleFontsFilterClass {
	FontManagerFontListFilterClass parent_class;
};

struct _FontManagerGoogleFontsFilterPrivate {
	gint _n_variations;
	FontManagerStringSet* _categories;
	FontManagerStringSet* _language_support;
};

struct _FontManagerGoogleFontsSidebar {
	GtkBox parent_instance;
	FontManagerGoogleFontsSidebarPrivate * priv;
};

struct _FontManagerGoogleFontsSidebarClass {
	GtkBoxClass parent_class;
};

struct _FontManagerGoogleFontsSidebarPrivate {
	gint _n_variations;
	FontManagerGoogleFontsFilter* _filter;
	FontManagerStringSet* _categories;
	FontManagerStringSet* _language_support;
	GtkDropDown* sort_type;
	GtkGrid* category_grid;
	GtkListBox* language_list;
	gchar* sort_options[4];
};

struct _FontManagerGoogleFontsLanguageData {
	gchar* label;
	gchar* name;
	gchar* sample;
};

static gint FontManagerGoogleFontsFilter_private_offset;
static gpointer font_manager_google_fonts_filter_parent_class = NULL;
static gint FontManagerGoogleFontsSidebar_private_offset;
static gpointer font_manager_google_fonts_sidebar_parent_class = NULL;

VALA_EXTERN GType font_manager_cacheable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontManagerCacheable, g_object_unref)
VALA_EXTERN GType font_manager_font_list_filter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontManagerFontListFilter, g_object_unref)
VALA_EXTERN GType font_manager_google_fonts_filter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontManagerGoogleFontsFilter, g_object_unref)
VALA_EXTERN gboolean font_manager_font_list_filter_matches (FontManagerFontListFilter* self,
                                                GObject* item);
static gboolean font_manager_google_fonts_filter_real_matches (FontManagerFontListFilter* base,
                                                        GObject* item);
VALA_EXTERN GType font_manager_google_fonts_family_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontManagerGoogleFontsFamily, g_object_unref)
VALA_EXTERN FontManagerStringSet* font_manager_google_fonts_filter_get_categories (FontManagerGoogleFontsFilter* self);
VALA_EXTERN const gchar* font_manager_google_fonts_family_get_category (FontManagerGoogleFontsFamily* self);
VALA_EXTERN gint font_manager_google_fonts_family_get_count (FontManagerGoogleFontsFamily* self);
VALA_EXTERN gint font_manager_google_fonts_filter_get_n_variations (FontManagerGoogleFontsFilter* self);
VALA_EXTERN FontManagerStringSet* font_manager_google_fonts_filter_get_language_support (FontManagerGoogleFontsFilter* self);
VALA_EXTERN FontManagerStringSet* font_manager_google_fonts_family_get_subsets (FontManagerGoogleFontsFamily* self);
VALA_EXTERN FontManagerGoogleFontsFilter* font_manager_google_fonts_filter_new (void);
VALA_EXTERN FontManagerGoogleFontsFilter* font_manager_google_fonts_filter_construct (GType object_type);
VALA_EXTERN FontManagerFontListFilter* font_manager_font_list_filter_new (void);
VALA_EXTERN FontManagerFontListFilter* font_manager_font_list_filter_construct (GType object_type);
VALA_EXTERN void font_manager_google_fonts_filter_set_n_variations (FontManagerGoogleFontsFilter* self,
                                                        gint value);
VALA_EXTERN void font_manager_google_fonts_filter_set_categories (FontManagerGoogleFontsFilter* self,
                                                      FontManagerStringSet* value);
VALA_EXTERN void font_manager_google_fonts_filter_set_language_support (FontManagerGoogleFontsFilter* self,
                                                            FontManagerStringSet* value);
static void font_manager_google_fonts_filter_finalize (GObject * obj);
static GType font_manager_google_fonts_filter_get_type_once (void);
static void _vala_font_manager_google_fonts_filter_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_font_manager_google_fonts_filter_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
VALA_EXTERN GType font_manager_google_fonts_sidebar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontManagerGoogleFontsSidebar, g_object_unref)
VALA_EXTERN FontManagerGoogleFontsSidebar* font_manager_google_fonts_sidebar_new (void);
VALA_EXTERN FontManagerGoogleFontsSidebar* font_manager_google_fonts_sidebar_construct (GType object_type);
static void font_manager_google_fonts_sidebar_set_categories (FontManagerGoogleFontsSidebar* self,
                                                       FontManagerStringSet* value);
static void font_manager_google_fonts_sidebar_set_language_support (FontManagerGoogleFontsSidebar* self,
                                                             FontManagerStringSet* value);
VALA_EXTERN GType font_manager_google_fonts_language_data_get_type (void) G_GNUC_CONST ;
VALA_EXTERN FontManagerGoogleFontsLanguageData* font_manager_google_fonts_language_data_dup (const FontManagerGoogleFontsLanguageData* self);
VALA_EXTERN void font_manager_google_fonts_language_data_free (FontManagerGoogleFontsLanguageData* self);
VALA_EXTERN void font_manager_google_fonts_language_data_copy (const FontManagerGoogleFontsLanguageData* self,
                                                   FontManagerGoogleFontsLanguageData* dest);
VALA_EXTERN void font_manager_google_fonts_language_data_destroy (FontManagerGoogleFontsLanguageData* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FontManagerGoogleFontsLanguageData, font_manager_google_fonts_language_data_destroy)
static void font_manager_google_fonts_sidebar_on_language_toggled (FontManagerGoogleFontsSidebar* self,
                                                            GtkCheckButton* widget);
static void _font_manager_google_fonts_sidebar_on_language_toggled_gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                                      gpointer self);
VALA_EXTERN FontManagerStringSet* font_manager_google_fonts_sidebar_get_categories (FontManagerGoogleFontsSidebar* self);
static void font_manager_google_fonts_sidebar_set_filter (FontManagerGoogleFontsSidebar* self,
                                                   FontManagerGoogleFontsFilter* value);
VALA_EXTERN FontManagerGoogleFontsFilter* font_manager_google_fonts_sidebar_get_filter (FontManagerGoogleFontsSidebar* self);
static void __lambda189_ (FontManagerGoogleFontsSidebar* self);
static void ___lambda189__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void font_manager_google_fonts_sidebar_on_category_toggled (FontManagerGoogleFontsSidebar* self,
                                                            GtkCheckButton* widget);
static void _font_manager_google_fonts_sidebar_on_category_toggled_gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                                      gpointer self);
VALA_EXTERN FontManagerStringSet* font_manager_google_fonts_sidebar_get_language_support (FontManagerGoogleFontsSidebar* self);
static void font_manager_google_fonts_sidebar_on_variations_toggled (FontManagerGoogleFontsSidebar* self,
                                                              GtkToggleButton* widget);
static void font_manager_google_fonts_sidebar_set_n_variations (FontManagerGoogleFontsSidebar* self,
                                                         gint value);
static void _font_manager_google_fonts_sidebar_on_variations_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                         gpointer self);
VALA_EXTERN gint font_manager_google_fonts_sidebar_get_n_variations (FontManagerGoogleFontsSidebar* self);
static void font_manager_google_fonts_sidebar_finalize (GObject * obj);
static GType font_manager_google_fonts_sidebar_get_type_once (void);
static void _vala_font_manager_google_fonts_sidebar_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_font_manager_google_fonts_sidebar_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

VALA_EXTERN const FontManagerGoogleFontsLanguageData FONT_MANAGER_GOOGLE_FONTS_Languages[142];

static inline gpointer
font_manager_google_fonts_filter_get_instance_private (FontManagerGoogleFontsFilter* self)
{
	return G_STRUCT_MEMBER_P (self, FontManagerGoogleFontsFilter_private_offset);
}

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

static gboolean
font_manager_google_fonts_filter_real_matches (FontManagerFontListFilter* base,
                                               GObject* item)
{
	FontManagerGoogleFontsFilter * self;
	FontManagerGoogleFontsFamily* family = NULL;
	FontManagerGoogleFontsFamily* _tmp0_;
	gboolean _tmp1_ = FALSE;
	FontManagerStringSet* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	FontManagerGoogleFontsFamily* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	FontManagerStringSet* _tmp13_;
	guint _tmp14_;
	guint _tmp15_;
	gboolean result;
	self = (FontManagerGoogleFontsFilter*) base;
	g_return_val_if_fail (item != NULL, FALSE);
	g_return_val_if_fail (FONT_MANAGER_GOOGLE_FONTS_IS_FAMILY (item), FALSE);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (item, FONT_MANAGER_GOOGLE_FONTS_TYPE_FAMILY, FontManagerGoogleFontsFamily));
	family = _tmp0_;
	_tmp2_ = self->priv->_categories;
	g_object_get (_tmp2_, "size", &_tmp3_, NULL);
	_tmp4_ = _tmp3_;
	if (_tmp4_ < ((guint) 5)) {
		FontManagerStringSet* _tmp5_;
		FontManagerGoogleFontsFamily* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp5_ = self->priv->_categories;
		_tmp6_ = family;
		_tmp7_ = font_manager_google_fonts_family_get_category (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp1_ = !font_manager_string_set_contains (_tmp5_, _tmp8_);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		result = FALSE;
		_g_object_unref0 (family);
		return result;
	}
	_tmp9_ = family;
	_tmp10_ = font_manager_google_fonts_family_get_count (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = self->priv->_n_variations;
	if (_tmp11_ < _tmp12_) {
		result = FALSE;
		_g_object_unref0 (family);
		return result;
	}
	_tmp13_ = self->priv->_language_support;
	g_object_get (_tmp13_, "size", &_tmp14_, NULL);
	_tmp15_ = _tmp14_;
	if (_tmp15_ > ((guint) 0)) {
		{
			FontManagerStringSet* _entry_list = NULL;
			FontManagerStringSet* _tmp16_;
			guint _entry_size = 0U;
			FontManagerStringSet* _tmp17_;
			guint _tmp18_;
			guint _tmp19_;
			gint _entry_index = 0;
			_tmp16_ = self->priv->_language_support;
			_entry_list = _tmp16_;
			_tmp17_ = _entry_list;
			g_object_get (_tmp17_, "size", &_tmp18_, NULL);
			_tmp19_ = _tmp18_;
			_entry_size = _tmp19_;
			_entry_index = -1;
			while (TRUE) {
				gint _tmp20_;
				guint _tmp21_;
				gchar* entry = NULL;
				FontManagerStringSet* _tmp22_;
				const gchar* _tmp23_;
				gchar* _tmp24_;
				FontManagerGoogleFontsFamily* _tmp25_;
				FontManagerStringSet* _tmp26_;
				FontManagerStringSet* _tmp27_;
				const gchar* _tmp28_;
				_entry_index = _entry_index + 1;
				_tmp20_ = _entry_index;
				_tmp21_ = _entry_size;
				if (!(((guint) _tmp20_) < _tmp21_)) {
					break;
				}
				_tmp22_ = _entry_list;
				_tmp23_ = font_manager_string_set_get (_tmp22_, (guint) _entry_index);
				_tmp24_ = g_strdup (_tmp23_);
				entry = _tmp24_;
				_tmp25_ = family;
				_tmp26_ = font_manager_google_fonts_family_get_subsets (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = entry;
				if (font_manager_string_set_contains (_tmp27_, _tmp28_)) {
					result = TRUE;
					_g_free0 (entry);
					_g_object_unref0 (family);
					return result;
				}
				_g_free0 (entry);
			}
		}
		result = FALSE;
		_g_object_unref0 (family);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (family);
	return result;
}

FontManagerGoogleFontsFilter*
font_manager_google_fonts_filter_construct (GType object_type)
{
	FontManagerGoogleFontsFilter * self = NULL;
	self = (FontManagerGoogleFontsFilter*) font_manager_font_list_filter_construct (object_type);
	return self;
}

FontManagerGoogleFontsFilter*
font_manager_google_fonts_filter_new (void)
{
	return font_manager_google_fonts_filter_construct (FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER);
}

gint
font_manager_google_fonts_filter_get_n_variations (FontManagerGoogleFontsFilter* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_n_variations;
	return result;
}

void
font_manager_google_fonts_filter_set_n_variations (FontManagerGoogleFontsFilter* self,
                                                   gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_filter_get_n_variations (self);
	if (old_value != value) {
		self->priv->_n_variations = value;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_N_VARIATIONS_PROPERTY]);
	}
}

FontManagerStringSet*
font_manager_google_fonts_filter_get_categories (FontManagerGoogleFontsFilter* self)
{
	FontManagerStringSet* result;
	FontManagerStringSet* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_categories;
	result = _tmp0_;
	return result;
}

void
font_manager_google_fonts_filter_set_categories (FontManagerGoogleFontsFilter* self,
                                                 FontManagerStringSet* value)
{
	FontManagerStringSet* old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_filter_get_categories (self);
	if (old_value != value) {
		FontManagerStringSet* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_categories);
		self->priv->_categories = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_CATEGORIES_PROPERTY]);
	}
}

FontManagerStringSet*
font_manager_google_fonts_filter_get_language_support (FontManagerGoogleFontsFilter* self)
{
	FontManagerStringSet* result;
	FontManagerStringSet* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_language_support;
	result = _tmp0_;
	return result;
}

void
font_manager_google_fonts_filter_set_language_support (FontManagerGoogleFontsFilter* self,
                                                       FontManagerStringSet* value)
{
	FontManagerStringSet* old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_filter_get_language_support (self);
	if (old_value != value) {
		FontManagerStringSet* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_language_support);
		self->priv->_language_support = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_LANGUAGE_SUPPORT_PROPERTY]);
	}
}

static void
font_manager_google_fonts_filter_class_init (FontManagerGoogleFontsFilterClass * klass,
                                             gpointer klass_data)
{
	font_manager_google_fonts_filter_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FontManagerGoogleFontsFilter_private_offset);
	((FontManagerFontListFilterClass *) klass)->matches = (gboolean (*) (FontManagerFontListFilter*, GObject*)) font_manager_google_fonts_filter_real_matches;
	G_OBJECT_CLASS (klass)->get_property = _vala_font_manager_google_fonts_filter_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_font_manager_google_fonts_filter_set_property;
	G_OBJECT_CLASS (klass)->finalize = font_manager_google_fonts_filter_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_FILTER_N_VARIATIONS_PROPERTY, font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_N_VARIATIONS_PROPERTY] = g_param_spec_int ("n-variations", "n-variations", "n-variations", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_FILTER_CATEGORIES_PROPERTY, font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_CATEGORIES_PROPERTY] = g_param_spec_object ("categories", "categories", "categories", font_manager_string_set_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_FILTER_LANGUAGE_SUPPORT_PROPERTY, font_manager_google_fonts_filter_properties[FONT_MANAGER_GOOGLE_FONTS_FILTER_LANGUAGE_SUPPORT_PROPERTY] = g_param_spec_object ("language-support", "language-support", "language-support", font_manager_string_set_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
font_manager_google_fonts_filter_instance_init (FontManagerGoogleFontsFilter * self,
                                                gpointer klass)
{
	self->priv = font_manager_google_fonts_filter_get_instance_private (self);
}

static void
font_manager_google_fonts_filter_finalize (GObject * obj)
{
	FontManagerGoogleFontsFilter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, FontManagerGoogleFontsFilter);
	_g_object_unref0 (self->priv->_categories);
	_g_object_unref0 (self->priv->_language_support);
	G_OBJECT_CLASS (font_manager_google_fonts_filter_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
font_manager_google_fonts_filter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FontManagerGoogleFontsFilterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) font_manager_google_fonts_filter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FontManagerGoogleFontsFilter), 0, (GInstanceInitFunc) font_manager_google_fonts_filter_instance_init, NULL };
	GType font_manager_google_fonts_filter_type_id;
	font_manager_google_fonts_filter_type_id = g_type_register_static (FONT_MANAGER_TYPE_FONT_LIST_FILTER, "FontManagerGoogleFontsFilter", &g_define_type_info, 0);
	FontManagerGoogleFontsFilter_private_offset = g_type_add_instance_private (font_manager_google_fonts_filter_type_id, sizeof (FontManagerGoogleFontsFilterPrivate));
	return font_manager_google_fonts_filter_type_id;
}

GType
font_manager_google_fonts_filter_get_type (void)
{
	static volatile gsize font_manager_google_fonts_filter_type_id__once = 0;
	if (g_once_init_enter (&font_manager_google_fonts_filter_type_id__once)) {
		GType font_manager_google_fonts_filter_type_id;
		font_manager_google_fonts_filter_type_id = font_manager_google_fonts_filter_get_type_once ();
		g_once_init_leave (&font_manager_google_fonts_filter_type_id__once, font_manager_google_fonts_filter_type_id);
	}
	return font_manager_google_fonts_filter_type_id__once;
}

static void
_vala_font_manager_google_fonts_filter_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	FontManagerGoogleFontsFilter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, FontManagerGoogleFontsFilter);
	switch (property_id) {
		case FONT_MANAGER_GOOGLE_FONTS_FILTER_N_VARIATIONS_PROPERTY:
		g_value_set_int (value, font_manager_google_fonts_filter_get_n_variations (self));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_FILTER_CATEGORIES_PROPERTY:
		g_value_set_object (value, font_manager_google_fonts_filter_get_categories (self));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_FILTER_LANGUAGE_SUPPORT_PROPERTY:
		g_value_set_object (value, font_manager_google_fonts_filter_get_language_support (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_font_manager_google_fonts_filter_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	FontManagerGoogleFontsFilter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, FontManagerGoogleFontsFilter);
	switch (property_id) {
		case FONT_MANAGER_GOOGLE_FONTS_FILTER_N_VARIATIONS_PROPERTY:
		font_manager_google_fonts_filter_set_n_variations (self, g_value_get_int (value));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_FILTER_CATEGORIES_PROPERTY:
		font_manager_google_fonts_filter_set_categories (self, g_value_get_object (value));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_FILTER_LANGUAGE_SUPPORT_PROPERTY:
		font_manager_google_fonts_filter_set_language_support (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
font_manager_google_fonts_sidebar_get_instance_private (FontManagerGoogleFontsSidebar* self)
{
	return G_STRUCT_MEMBER_P (self, FontManagerGoogleFontsSidebar_private_offset);
}

static void
_font_manager_google_fonts_sidebar_on_language_toggled_gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                                 gpointer self)
{
	font_manager_google_fonts_sidebar_on_language_toggled ((FontManagerGoogleFontsSidebar*) self, _sender);
}

static void
__lambda189_ (FontManagerGoogleFontsSidebar* self)
{
	GtkDropDown* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	const gchar* _tmp3_;
	_tmp0_ = self->priv->sort_type;
	_tmp1_ = gtk_drop_down_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->sort_options[_tmp2_];
	g_signal_emit (self, font_manager_google_fonts_sidebar_signals[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_SORT_CHANGED_SIGNAL], 0, _tmp3_);
}

static void
___lambda189__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda189_ ((FontManagerGoogleFontsSidebar*) self);
}

FontManagerGoogleFontsSidebar*
font_manager_google_fonts_sidebar_construct (GType object_type)
{
	FontManagerGoogleFontsSidebar * self = NULL;
	GtkGrid* _tmp0_;
	GtkListBox* _tmp1_;
	FontManagerStringSet* _tmp2_;
	FontManagerStringSet* _tmp3_;
	FontManagerStringSet* _tmp4_;
	FontManagerStringSet* _tmp5_;
	GtkWidget* widget = NULL;
	GtkGrid* _tmp17_;
	GtkWidget* _tmp18_;
	GtkWidget* _tmp19_;
	FontManagerGoogleFontsFilter* _tmp28_;
	FontManagerGoogleFontsFilter* _tmp29_;
	GBindingFlags flags = 0U;
	FontManagerGoogleFontsFilter* _tmp30_;
	FontManagerGoogleFontsFilter* _tmp31_;
	FontManagerGoogleFontsFilter* _tmp32_;
	GtkDropDown* _tmp33_;
	self = (FontManagerGoogleFontsSidebar*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->category_grid;
	font_manager_widget_set_name ((GtkWidget*) _tmp0_, "FontManagerGoogleFontsCategories");
	_tmp1_ = self->priv->language_list;
	font_manager_widget_set_name ((GtkWidget*) _tmp1_, "FontManagerGoogleFontsOrthographies");
	_tmp2_ = font_manager_string_set_new ();
	_tmp3_ = _tmp2_;
	font_manager_google_fonts_sidebar_set_categories (self, _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = font_manager_string_set_new ();
	_tmp5_ = _tmp4_;
	font_manager_google_fonts_sidebar_set_language_support (self, _tmp5_);
	_g_object_unref0 (_tmp5_);
	{
		FontManagerGoogleFontsLanguageData* lang_collection = NULL;
		gint lang_collection_length1 = 0;
		gint _lang_collection_size_ = 0;
		gint lang_it = 0;
		lang_collection = FONT_MANAGER_GOOGLE_FONTS_Languages;
		lang_collection_length1 = G_N_ELEMENTS (FONT_MANAGER_GOOGLE_FONTS_Languages);
		for (lang_it = 0; lang_it < lang_collection_length1; lang_it = lang_it + 1) {
			FontManagerGoogleFontsLanguageData lang = {0};
			lang = lang_collection[lang_it];
			{
				gchar* label = NULL;
				FontManagerGoogleFontsLanguageData _tmp6_;
				const gchar* _tmp7_;
				gchar* _tmp8_;
				GtkCheckButton* check = NULL;
				const gchar* _tmp9_;
				FontManagerGoogleFontsLanguageData _tmp10_;
				const gchar* _tmp11_;
				gchar* _tmp12_;
				GtkCheckButton* _tmp13_ = NULL;
				GtkListBox* _tmp14_;
				GtkCheckButton* _tmp15_;
				GtkCheckButton* _tmp16_;
				_tmp6_ = lang;
				_tmp7_ = _tmp6_.label;
				_tmp8_ = g_strdup (g_dgettext (NULL, _tmp7_));
				label = _tmp8_;
				_tmp9_ = label;
				_tmp10_ = lang;
				_tmp11_ = _tmp10_.name;
				_tmp12_ = g_strdup (_tmp11_);
				_tmp13_ = (GtkCheckButton*) gtk_check_button_new_with_label (_tmp9_);
				gtk_widget_set_can_focus ((GtkWidget*) _tmp13_, FALSE);
				gtk_widget_set_name ((GtkWidget*) _tmp13_, _tmp12_);
				_g_free0 (_tmp12_);
				g_object_ref_sink (_tmp13_);
				check = _tmp13_;
				_tmp14_ = self->priv->language_list;
				_tmp15_ = check;
				gtk_list_box_insert (_tmp14_, (GtkWidget*) _tmp15_, -1);
				_tmp16_ = check;
				g_signal_connect_object (_tmp16_, "toggled", (GCallback) _font_manager_google_fonts_sidebar_on_language_toggled_gtk_check_button_toggled, self, 0);
				_g_object_unref0 (check);
				_g_free0 (label);
			}
		}
	}
	_tmp17_ = self->priv->category_grid;
	_tmp18_ = gtk_widget_get_first_child ((GtkWidget*) _tmp17_);
	_tmp19_ = _g_object_ref0 (_tmp18_);
	widget = _tmp19_;
	while (TRUE) {
		GtkWidget* _tmp20_;
		FontManagerStringSet* _tmp21_;
		GtkWidget* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		GtkWidget* _tmp25_;
		GtkWidget* _tmp26_;
		GtkWidget* _tmp27_;
		_tmp20_ = widget;
		if (!(_tmp20_ != NULL)) {
			break;
		}
		_tmp21_ = self->priv->_categories;
		_tmp22_ = widget;
		_tmp23_ = gtk_widget_get_name (_tmp22_);
		_tmp24_ = _tmp23_;
		font_manager_string_set_add (_tmp21_, _tmp24_);
		_tmp25_ = widget;
		_tmp26_ = gtk_widget_get_next_sibling (_tmp25_);
		_tmp27_ = _g_object_ref0 (_tmp26_);
		_g_object_unref0 (widget);
		widget = _tmp27_;
	}
	_tmp28_ = font_manager_google_fonts_filter_new ();
	_tmp29_ = _tmp28_;
	font_manager_google_fonts_sidebar_set_filter (self, _tmp29_);
	_g_object_unref0 (_tmp29_);
	flags = G_BINDING_SYNC_CREATE;
	_tmp30_ = self->priv->_filter;
	g_object_bind_property_with_closures ((GObject*) self, "n-variations", (GObject*) _tmp30_, "n-variations", flags, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp31_ = self->priv->_filter;
	g_object_bind_property_with_closures ((GObject*) self, "categories", (GObject*) _tmp31_, "categories", flags, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp32_ = self->priv->_filter;
	g_object_bind_property_with_closures ((GObject*) self, "language-support", (GObject*) _tmp32_, "language-support", flags, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp33_ = self->priv->sort_type;
	g_signal_connect_object ((GObject*) _tmp33_, "notify::selected", (GCallback) ___lambda189__g_object_notify, self, 0);
	_g_object_unref0 (widget);
	return self;
}

FontManagerGoogleFontsSidebar*
font_manager_google_fonts_sidebar_new (void)
{
	return font_manager_google_fonts_sidebar_construct (FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR);
}

static void
font_manager_google_fonts_sidebar_on_category_toggled (FontManagerGoogleFontsSidebar* self,
                                                       GtkCheckButton* widget)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	FontManagerGoogleFontsFilter* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = gtk_check_button_get_active (widget);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		FontManagerStringSet* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp2_ = self->priv->_categories;
		_tmp3_ = gtk_widget_get_name ((GtkWidget*) widget);
		_tmp4_ = _tmp3_;
		font_manager_string_set_add (_tmp2_, _tmp4_);
	} else {
		FontManagerStringSet* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp5_ = self->priv->_categories;
		_tmp6_ = gtk_widget_get_name ((GtkWidget*) widget);
		_tmp7_ = _tmp6_;
		font_manager_string_set_remove (_tmp5_, _tmp7_);
	}
	_tmp8_ = self->priv->_filter;
	g_signal_emit_by_name ((FontManagerCacheable*) _tmp8_, "changed");
	return;
}

static void
_font_manager_google_fonts_sidebar_on_category_toggled_gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                                 gpointer self)
{
	font_manager_google_fonts_sidebar_on_category_toggled ((FontManagerGoogleFontsSidebar*) self, _sender);
}

static void
font_manager_google_fonts_sidebar_on_language_toggled (FontManagerGoogleFontsSidebar* self,
                                                       GtkCheckButton* widget)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	FontManagerGoogleFontsFilter* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = gtk_check_button_get_active (widget);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		FontManagerStringSet* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp2_ = self->priv->_language_support;
		_tmp3_ = gtk_widget_get_name ((GtkWidget*) widget);
		_tmp4_ = _tmp3_;
		font_manager_string_set_add (_tmp2_, _tmp4_);
	} else {
		FontManagerStringSet* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp5_ = self->priv->_language_support;
		_tmp6_ = gtk_widget_get_name ((GtkWidget*) widget);
		_tmp7_ = _tmp6_;
		font_manager_string_set_remove (_tmp5_, _tmp7_);
	}
	_tmp8_ = self->priv->_filter;
	g_signal_emit_by_name ((FontManagerCacheable*) _tmp8_, "changed");
	return;
}

static void
font_manager_google_fonts_sidebar_on_variations_toggled (FontManagerGoogleFontsSidebar* self,
                                                         GtkToggleButton* widget)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	FontManagerGoogleFontsFilter* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = gtk_toggle_button_get_active (widget);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = gtk_widget_get_name ((GtkWidget*) widget);
	_tmp3_ = _tmp2_;
	font_manager_google_fonts_sidebar_set_n_variations (self, atoi (_tmp3_));
	_tmp4_ = self->priv->_filter;
	g_signal_emit_by_name ((FontManagerCacheable*) _tmp4_, "changed");
	return;
}

static void
_font_manager_google_fonts_sidebar_on_variations_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                    gpointer self)
{
	font_manager_google_fonts_sidebar_on_variations_toggled ((FontManagerGoogleFontsSidebar*) self, _sender);
}

gint
font_manager_google_fonts_sidebar_get_n_variations (FontManagerGoogleFontsSidebar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_n_variations;
	return result;
}

static void
font_manager_google_fonts_sidebar_set_n_variations (FontManagerGoogleFontsSidebar* self,
                                                    gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_sidebar_get_n_variations (self);
	if (old_value != value) {
		self->priv->_n_variations = value;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_N_VARIATIONS_PROPERTY]);
	}
}

FontManagerGoogleFontsFilter*
font_manager_google_fonts_sidebar_get_filter (FontManagerGoogleFontsSidebar* self)
{
	FontManagerGoogleFontsFilter* result;
	FontManagerGoogleFontsFilter* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_filter;
	result = _tmp0_;
	return result;
}

static void
font_manager_google_fonts_sidebar_set_filter (FontManagerGoogleFontsSidebar* self,
                                              FontManagerGoogleFontsFilter* value)
{
	FontManagerGoogleFontsFilter* old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_sidebar_get_filter (self);
	if (old_value != value) {
		FontManagerGoogleFontsFilter* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_filter);
		self->priv->_filter = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_FILTER_PROPERTY]);
	}
}

FontManagerStringSet*
font_manager_google_fonts_sidebar_get_categories (FontManagerGoogleFontsSidebar* self)
{
	FontManagerStringSet* result;
	FontManagerStringSet* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_categories;
	result = _tmp0_;
	return result;
}

static void
font_manager_google_fonts_sidebar_set_categories (FontManagerGoogleFontsSidebar* self,
                                                  FontManagerStringSet* value)
{
	FontManagerStringSet* old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_sidebar_get_categories (self);
	if (old_value != value) {
		FontManagerStringSet* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_categories);
		self->priv->_categories = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CATEGORIES_PROPERTY]);
	}
}

FontManagerStringSet*
font_manager_google_fonts_sidebar_get_language_support (FontManagerGoogleFontsSidebar* self)
{
	FontManagerStringSet* result;
	FontManagerStringSet* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_language_support;
	result = _tmp0_;
	return result;
}

static void
font_manager_google_fonts_sidebar_set_language_support (FontManagerGoogleFontsSidebar* self,
                                                        FontManagerStringSet* value)
{
	FontManagerStringSet* old_value;
	g_return_if_fail (self != NULL);
	old_value = font_manager_google_fonts_sidebar_get_language_support (self);
	if (old_value != value) {
		FontManagerStringSet* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_language_support);
		self->priv->_language_support = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_LANGUAGE_SUPPORT_PROPERTY]);
	}
}

static void
font_manager_google_fonts_sidebar_class_init (FontManagerGoogleFontsSidebarClass * klass,
                                              gpointer klass_data)
{
	font_manager_google_fonts_sidebar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FontManagerGoogleFontsSidebar_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_font_manager_google_fonts_sidebar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_font_manager_google_fonts_sidebar_set_property;
	G_OBJECT_CLASS (klass)->finalize = font_manager_google_fonts_sidebar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_N_VARIATIONS_PROPERTY, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_N_VARIATIONS_PROPERTY] = g_param_spec_int ("n-variations", "n-variations", "n-variations", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_FILTER_PROPERTY, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_FILTER_PROPERTY] = g_param_spec_object ("filter", "filter", "filter", FONT_MANAGER_GOOGLE_FONTS_TYPE_FILTER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CATEGORIES_PROPERTY, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CATEGORIES_PROPERTY] = g_param_spec_object ("categories", "categories", "categories", font_manager_string_set_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_LANGUAGE_SUPPORT_PROPERTY, font_manager_google_fonts_sidebar_properties[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_LANGUAGE_SUPPORT_PROPERTY] = g_param_spec_object ("language-support", "language-support", "language-support", font_manager_string_set_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/github/FontManager/FontManager/web/google/ui/google-fonts-sidebar.ui");
	font_manager_google_fonts_sidebar_signals[FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_SORT_CHANGED_SIGNAL] = g_signal_new ("sort-changed", FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sort_type", FALSE, FontManagerGoogleFontsSidebar_private_offset + G_STRUCT_OFFSET (FontManagerGoogleFontsSidebarPrivate, sort_type));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "category_grid", FALSE, FontManagerGoogleFontsSidebar_private_offset + G_STRUCT_OFFSET (FontManagerGoogleFontsSidebarPrivate, category_grid));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "language_list", FALSE, FontManagerGoogleFontsSidebar_private_offset + G_STRUCT_OFFSET (FontManagerGoogleFontsSidebarPrivate, language_list));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_category_toggled", G_CALLBACK(_font_manager_google_fonts_sidebar_on_category_toggled_gtk_check_button_toggled));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_variations_toggled", G_CALLBACK(_font_manager_google_fonts_sidebar_on_variations_toggled_gtk_toggle_button_toggled));
}

static void
font_manager_google_fonts_sidebar_instance_init (FontManagerGoogleFontsSidebar * self,
                                                 gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_[4] = {0};
	self->priv = font_manager_google_fonts_sidebar_get_instance_private (self);
	self->priv->_n_variations = 0;
	_tmp0_ = g_strdup ("alpha");
	_tmp1_ = g_strdup ("date");
	_tmp2_ = g_strdup ("popularity");
	_tmp3_ = g_strdup ("trending");
	_tmp4_[0] = _tmp0_;
	_tmp4_[1] = _tmp1_;
	_tmp4_[2] = _tmp2_;
	_tmp4_[3] = _tmp3_;
	memcpy (self->priv->sort_options, _tmp4_, 4 * sizeof (gchar*));
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
font_manager_google_fonts_sidebar_finalize (GObject * obj)
{
	FontManagerGoogleFontsSidebar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, FontManagerGoogleFontsSidebar);
	_g_object_unref0 (self->priv->_filter);
	_g_object_unref0 (self->priv->_categories);
	_g_object_unref0 (self->priv->_language_support);
	_vala_array_destroy (self->priv->sort_options, 4, (GDestroyNotify) g_free);
	G_OBJECT_CLASS (font_manager_google_fonts_sidebar_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
font_manager_google_fonts_sidebar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FontManagerGoogleFontsSidebarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) font_manager_google_fonts_sidebar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FontManagerGoogleFontsSidebar), 0, (GInstanceInitFunc) font_manager_google_fonts_sidebar_instance_init, NULL };
	GType font_manager_google_fonts_sidebar_type_id;
	font_manager_google_fonts_sidebar_type_id = g_type_register_static (gtk_box_get_type (), "FontManagerGoogleFontsSidebar", &g_define_type_info, 0);
	FontManagerGoogleFontsSidebar_private_offset = g_type_add_instance_private (font_manager_google_fonts_sidebar_type_id, sizeof (FontManagerGoogleFontsSidebarPrivate));
	return font_manager_google_fonts_sidebar_type_id;
}

GType
font_manager_google_fonts_sidebar_get_type (void)
{
	static volatile gsize font_manager_google_fonts_sidebar_type_id__once = 0;
	if (g_once_init_enter (&font_manager_google_fonts_sidebar_type_id__once)) {
		GType font_manager_google_fonts_sidebar_type_id;
		font_manager_google_fonts_sidebar_type_id = font_manager_google_fonts_sidebar_get_type_once ();
		g_once_init_leave (&font_manager_google_fonts_sidebar_type_id__once, font_manager_google_fonts_sidebar_type_id);
	}
	return font_manager_google_fonts_sidebar_type_id__once;
}

static void
_vala_font_manager_google_fonts_sidebar_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	FontManagerGoogleFontsSidebar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, FontManagerGoogleFontsSidebar);
	switch (property_id) {
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_N_VARIATIONS_PROPERTY:
		g_value_set_int (value, font_manager_google_fonts_sidebar_get_n_variations (self));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_FILTER_PROPERTY:
		g_value_set_object (value, font_manager_google_fonts_sidebar_get_filter (self));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CATEGORIES_PROPERTY:
		g_value_set_object (value, font_manager_google_fonts_sidebar_get_categories (self));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_LANGUAGE_SUPPORT_PROPERTY:
		g_value_set_object (value, font_manager_google_fonts_sidebar_get_language_support (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_font_manager_google_fonts_sidebar_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	FontManagerGoogleFontsSidebar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FONT_MANAGER_GOOGLE_FONTS_TYPE_SIDEBAR, FontManagerGoogleFontsSidebar);
	switch (property_id) {
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_N_VARIATIONS_PROPERTY:
		font_manager_google_fonts_sidebar_set_n_variations (self, g_value_get_int (value));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_FILTER_PROPERTY:
		font_manager_google_fonts_sidebar_set_filter (self, g_value_get_object (value));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_CATEGORIES_PROPERTY:
		font_manager_google_fonts_sidebar_set_categories (self, g_value_get_object (value));
		break;
		case FONT_MANAGER_GOOGLE_FONTS_SIDEBAR_LANGUAGE_SUPPORT_PROPERTY:
		font_manager_google_fonts_sidebar_set_language_support (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

