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

/*
 * Copyright 2011-2017 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include "granite.h"
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.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 TYPE_SOURCE_LIST_VIEW (source_list_view_get_type ())
#define SOURCE_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_LIST_VIEW, SourceListView))
#define SOURCE_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_LIST_VIEW, SourceListViewClass))
#define IS_SOURCE_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_LIST_VIEW))
#define IS_SOURCE_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_LIST_VIEW))
#define SOURCE_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_LIST_VIEW, SourceListViewClass))

typedef struct _SourceListView SourceListView;
typedef struct _SourceListViewClass SourceListViewClass;
typedef struct _SourceListViewPrivate SourceListViewPrivate;
enum  {
	SOURCE_LIST_VIEW_0_PROPERTY,
	SOURCE_LIST_VIEW_NUM_PROPERTIES
};
static GParamSpec* source_list_view_properties[SOURCE_LIST_VIEW_NUM_PROPERTIES];
typedef struct _Block14Data Block14Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _SourceListView {
	GtkFrame parent_instance;
	SourceListViewPrivate * priv;
};

struct _SourceListViewClass {
	GtkFrameClass parent_class;
};

struct _Block14Data {
	int _ref_count_;
	SourceListView* self;
	GtkLabel* label;
};

static gpointer source_list_view_parent_class = NULL;

VALA_EXTERN GType source_list_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceListView, g_object_unref)
VALA_EXTERN SourceListView* source_list_view_new (void);
VALA_EXTERN SourceListView* source_list_view_construct (GType object_type);
static GObject * source_list_view_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static void _source_list_view___lambda24_ (Block14Data* _data14_,
                                    GraniteWidgetsSourceListItem* item);
static void __source_list_view___lambda24__granite_widgets_source_list_item_selected (GraniteWidgetsSourceList* _sender,
                                                                               GraniteWidgetsSourceListItem* item,
                                                                               gpointer self);
static GType source_list_view_get_type_once (void);

SourceListView*
source_list_view_construct (GType object_type)
{
	SourceListView * self = NULL;
	self = (SourceListView*) g_object_new (object_type, NULL);
	return self;
}

SourceListView*
source_list_view_new (void)
{
	return source_list_view_construct (TYPE_SOURCE_LIST_VIEW);
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		SourceListView* self;
		self = _data14_->self;
		_g_object_unref0 (_data14_->label);
		_g_object_unref0 (self);
		g_slice_free (Block14Data, _data14_);
	}
}

static void
_source_list_view___lambda24_ (Block14Data* _data14_,
                               GraniteWidgetsSourceListItem* item)
{
	SourceListView* self;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GtkLabel* _tmp6_;
	GraniteWidgetsSourceListExpandableItem* _tmp7_;
	GraniteWidgetsSourceListExpandableItem* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	self = _data14_->self;
	if (item == NULL) {
		GtkLabel* _tmp0_;
		_tmp0_ = _data14_->label;
		gtk_label_set_label (_tmp0_, "No selected item");
		return;
	}
	_tmp2_ = granite_widgets_source_list_item_get_badge (item);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp3_, "") != 0) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = granite_widgets_source_list_item_get_badge (item);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		granite_widgets_source_list_item_set_badge (item, "");
	}
	_tmp6_ = _data14_->label;
	_tmp7_ = granite_widgets_source_list_item_get_parent (item);
	_tmp8_ = _tmp7_;
	_tmp9_ = granite_widgets_source_list_item_get_name ((GraniteWidgetsSourceListItem*) _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = granite_widgets_source_list_item_get_name (item);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strdup_printf ("%s - %s", _tmp10_, _tmp12_);
	_tmp14_ = _tmp13_;
	gtk_label_set_label (_tmp6_, _tmp14_);
	_g_free0 (_tmp14_);
}

static void
__source_list_view___lambda24__granite_widgets_source_list_item_selected (GraniteWidgetsSourceList* _sender,
                                                                          GraniteWidgetsSourceListItem* item,
                                                                          gpointer self)
{
	_source_list_view___lambda24_ (self, item);
}

static GObject *
source_list_view_constructor (GType type,
                              guint n_construct_properties,
                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SourceListView * self;
	Block14Data* _data14_;
	GraniteWidgetsSourceListItem* music_item = NULL;
	GraniteWidgetsSourceListItem* _tmp0_;
	GraniteWidgetsSourceListItem* _tmp1_;
	GraniteWidgetsSourceListItem* _tmp2_;
	GThemedIcon* _tmp3_;
	GThemedIcon* _tmp4_;
	GraniteWidgetsSourceListExpandableItem* library_category = NULL;
	GraniteWidgetsSourceListExpandableItem* _tmp5_;
	GraniteWidgetsSourceListExpandableItem* _tmp6_;
	GraniteWidgetsSourceListExpandableItem* _tmp7_;
	GraniteWidgetsSourceListItem* _tmp8_;
	GraniteWidgetsSourceListItem* my_store_podcast_item = NULL;
	GraniteWidgetsSourceListItem* _tmp9_;
	GraniteWidgetsSourceListItem* _tmp10_;
	GThemedIcon* _tmp11_;
	GThemedIcon* _tmp12_;
	GraniteWidgetsSourceListItem* my_store_music_item = NULL;
	GraniteWidgetsSourceListItem* _tmp13_;
	GraniteWidgetsSourceListItem* _tmp14_;
	GThemedIcon* _tmp15_;
	GThemedIcon* _tmp16_;
	GraniteWidgetsSourceListExpandableItem* my_store_item = NULL;
	GraniteWidgetsSourceListExpandableItem* _tmp17_;
	GraniteWidgetsSourceListExpandableItem* _tmp18_;
	GThemedIcon* _tmp19_;
	GThemedIcon* _tmp20_;
	GraniteWidgetsSourceListExpandableItem* _tmp21_;
	GraniteWidgetsSourceListItem* _tmp22_;
	GraniteWidgetsSourceListExpandableItem* _tmp23_;
	GraniteWidgetsSourceListItem* _tmp24_;
	GraniteWidgetsSourceListExpandableItem* store_category = NULL;
	GraniteWidgetsSourceListExpandableItem* _tmp25_;
	GraniteWidgetsSourceListExpandableItem* _tmp26_;
	GraniteWidgetsSourceListExpandableItem* _tmp27_;
	GraniteWidgetsSourceListExpandableItem* _tmp28_;
	GraniteWidgetsSourceListItem* player1_item = NULL;
	GraniteWidgetsSourceListItem* _tmp29_;
	GraniteWidgetsSourceListItem* _tmp30_;
	GThemedIcon* _tmp31_;
	GThemedIcon* _tmp32_;
	GraniteWidgetsSourceListItem* _tmp33_;
	GThemedIcon* _tmp34_;
	GThemedIcon* _tmp35_;
	GraniteWidgetsSourceListItem* _tmp36_;
	GraniteWidgetsSourceListItem* player2_item = NULL;
	GraniteWidgetsSourceListItem* _tmp37_;
	GraniteWidgetsSourceListItem* _tmp38_;
	GraniteWidgetsSourceListItem* _tmp39_;
	GThemedIcon* _tmp40_;
	GThemedIcon* _tmp41_;
	GraniteWidgetsSourceListExpandableItem* device_category = NULL;
	GraniteWidgetsSourceListExpandableItem* _tmp42_;
	GraniteWidgetsSourceListExpandableItem* _tmp43_;
	GraniteWidgetsSourceListExpandableItem* _tmp44_;
	GraniteWidgetsSourceListItem* _tmp45_;
	GraniteWidgetsSourceListExpandableItem* _tmp46_;
	GraniteWidgetsSourceListItem* _tmp47_;
	GraniteWidgetsSourceList* source_list = NULL;
	GraniteWidgetsSourceListExpandableItem* _tmp48_;
	GraniteWidgetsSourceListExpandableItem* _tmp49_;
	GraniteWidgetsSourceList* _tmp50_;
	GraniteWidgetsSourceList* _tmp51_;
	GraniteWidgetsSourceList* _tmp52_;
	GraniteWidgetsSourceListExpandableItem* _tmp53_;
	GraniteWidgetsSourceListExpandableItem* _tmp54_;
	GraniteWidgetsSourceListExpandableItem* _tmp55_;
	GraniteWidgetsSourceList* _tmp56_;
	GraniteWidgetsSourceListExpandableItem* _tmp57_;
	GraniteWidgetsSourceListExpandableItem* _tmp58_;
	GraniteWidgetsSourceListExpandableItem* _tmp59_;
	GraniteWidgetsSourceList* _tmp60_;
	GraniteWidgetsSourceListExpandableItem* _tmp61_;
	GraniteWidgetsSourceListExpandableItem* _tmp62_;
	GraniteWidgetsSourceListExpandableItem* _tmp63_;
	GtkLabel* _tmp64_;
	GtkPaned* paned = NULL;
	GtkPaned* _tmp65_;
	GtkPaned* _tmp66_;
	GtkPaned* _tmp67_;
	GraniteWidgetsSourceList* _tmp68_;
	GtkPaned* _tmp69_;
	GtkLabel* _tmp70_;
	GtkPaned* _tmp71_;
	GraniteWidgetsSourceList* _tmp72_;
	parent_class = G_OBJECT_CLASS (source_list_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SOURCE_LIST_VIEW, SourceListView);
	_data14_ = g_slice_new0 (Block14Data);
	_data14_->_ref_count_ = 1;
	_data14_->self = g_object_ref (self);
	_tmp0_ = granite_widgets_source_list_item_new ("Music");
	music_item = _tmp0_;
	_tmp1_ = music_item;
	granite_widgets_source_list_item_set_badge (_tmp1_, "1");
	_tmp2_ = music_item;
	_tmp3_ = (GThemedIcon*) g_themed_icon_new ("library-music");
	_tmp4_ = _tmp3_;
	granite_widgets_source_list_item_set_icon (_tmp2_, (GIcon*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = granite_widgets_source_list_expandable_item_new ("Libraries");
	library_category = _tmp5_;
	_tmp6_ = library_category;
	granite_widgets_source_list_expandable_item_expand_all (_tmp6_, TRUE, TRUE);
	_tmp7_ = library_category;
	_tmp8_ = music_item;
	granite_widgets_source_list_expandable_item_add (_tmp7_, _tmp8_);
	_tmp9_ = granite_widgets_source_list_item_new ("Podcasts");
	my_store_podcast_item = _tmp9_;
	_tmp10_ = my_store_podcast_item;
	_tmp11_ = (GThemedIcon*) g_themed_icon_new ("library-podcast");
	_tmp12_ = _tmp11_;
	granite_widgets_source_list_item_set_icon (_tmp10_, (GIcon*) _tmp12_);
	_g_object_unref0 (_tmp12_);
	_tmp13_ = granite_widgets_source_list_item_new ("Music");
	my_store_music_item = _tmp13_;
	_tmp14_ = my_store_music_item;
	_tmp15_ = (GThemedIcon*) g_themed_icon_new ("library-music");
	_tmp16_ = _tmp15_;
	granite_widgets_source_list_item_set_icon (_tmp14_, (GIcon*) _tmp16_);
	_g_object_unref0 (_tmp16_);
	_tmp17_ = granite_widgets_source_list_expandable_item_new ("My Store");
	my_store_item = _tmp17_;
	_tmp18_ = my_store_item;
	_tmp19_ = (GThemedIcon*) g_themed_icon_new ("system-software-install");
	_tmp20_ = _tmp19_;
	granite_widgets_source_list_item_set_icon ((GraniteWidgetsSourceListItem*) _tmp18_, (GIcon*) _tmp20_);
	_g_object_unref0 (_tmp20_);
	_tmp21_ = my_store_item;
	_tmp22_ = my_store_music_item;
	granite_widgets_source_list_expandable_item_add (_tmp21_, _tmp22_);
	_tmp23_ = my_store_item;
	_tmp24_ = my_store_podcast_item;
	granite_widgets_source_list_expandable_item_add (_tmp23_, _tmp24_);
	_tmp25_ = granite_widgets_source_list_expandable_item_new ("Stores");
	store_category = _tmp25_;
	_tmp26_ = store_category;
	granite_widgets_source_list_expandable_item_expand_all (_tmp26_, TRUE, TRUE);
	_tmp27_ = store_category;
	_tmp28_ = my_store_item;
	granite_widgets_source_list_expandable_item_add (_tmp27_, (GraniteWidgetsSourceListItem*) _tmp28_);
	_tmp29_ = granite_widgets_source_list_item_new ("Player 1");
	player1_item = _tmp29_;
	_tmp30_ = player1_item;
	_tmp31_ = (GThemedIcon*) g_themed_icon_new ("multimedia-player");
	_tmp32_ = _tmp31_;
	granite_widgets_source_list_item_set_icon (_tmp30_, (GIcon*) _tmp32_);
	_g_object_unref0 (_tmp32_);
	_tmp33_ = player1_item;
	_tmp34_ = (GThemedIcon*) g_themed_icon_new ("user-available");
	_tmp35_ = _tmp34_;
	granite_widgets_source_list_item_set_activatable (_tmp33_, (GIcon*) _tmp35_);
	_g_object_unref0 (_tmp35_);
	_tmp36_ = player1_item;
	granite_widgets_source_list_item_set_activatable_tooltip (_tmp36_, "Connected");
	_tmp37_ = granite_widgets_source_list_item_new ("Player 2");
	player2_item = _tmp37_;
	_tmp38_ = player2_item;
	granite_widgets_source_list_item_set_badge (_tmp38_, "3");
	_tmp39_ = player2_item;
	_tmp40_ = (GThemedIcon*) g_themed_icon_new ("phone");
	_tmp41_ = _tmp40_;
	granite_widgets_source_list_item_set_icon (_tmp39_, (GIcon*) _tmp41_);
	_g_object_unref0 (_tmp41_);
	_tmp42_ = granite_widgets_source_list_expandable_item_new ("Devices");
	device_category = _tmp42_;
	_tmp43_ = device_category;
	granite_widgets_source_list_expandable_item_expand_all (_tmp43_, TRUE, TRUE);
	_tmp44_ = device_category;
	_tmp45_ = player1_item;
	granite_widgets_source_list_expandable_item_add (_tmp44_, _tmp45_);
	_tmp46_ = device_category;
	_tmp47_ = player2_item;
	granite_widgets_source_list_expandable_item_add (_tmp46_, _tmp47_);
	_tmp48_ = granite_widgets_source_list_expandable_item_new ("");
	_tmp49_ = _tmp48_;
	_tmp50_ = granite_widgets_source_list_new (_tmp49_);
	g_object_ref_sink (_tmp50_);
	_tmp51_ = _tmp50_;
	_g_object_unref0 (_tmp49_);
	source_list = _tmp51_;
	_tmp52_ = source_list;
	_tmp53_ = granite_widgets_source_list_get_root (_tmp52_);
	_tmp54_ = _tmp53_;
	_tmp55_ = library_category;
	granite_widgets_source_list_expandable_item_add (_tmp54_, (GraniteWidgetsSourceListItem*) _tmp55_);
	_tmp56_ = source_list;
	_tmp57_ = granite_widgets_source_list_get_root (_tmp56_);
	_tmp58_ = _tmp57_;
	_tmp59_ = store_category;
	granite_widgets_source_list_expandable_item_add (_tmp58_, (GraniteWidgetsSourceListItem*) _tmp59_);
	_tmp60_ = source_list;
	_tmp61_ = granite_widgets_source_list_get_root (_tmp60_);
	_tmp62_ = _tmp61_;
	_tmp63_ = device_category;
	granite_widgets_source_list_expandable_item_add (_tmp62_, (GraniteWidgetsSourceListItem*) _tmp63_);
	_tmp64_ = (GtkLabel*) gtk_label_new ("No selected item");
	g_object_ref_sink (_tmp64_);
	_data14_->label = _tmp64_;
	_tmp65_ = (GtkPaned*) gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp65_);
	paned = _tmp65_;
	_tmp66_ = paned;
	gtk_paned_set_position (_tmp66_, 130);
	_tmp67_ = paned;
	_tmp68_ = source_list;
	gtk_paned_pack1 (_tmp67_, (GtkWidget*) _tmp68_, FALSE, FALSE);
	_tmp69_ = paned;
	_tmp70_ = _data14_->label;
	gtk_paned_add2 (_tmp69_, (GtkWidget*) _tmp70_);
	g_object_set ((GtkWidget*) self, "margin", 48, NULL);
	_tmp71_ = paned;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp71_);
	_tmp72_ = source_list;
	g_signal_connect_data (_tmp72_, "item-selected", (GCallback) __source_list_view___lambda24__granite_widgets_source_list_item_selected, block14_data_ref (_data14_), (GClosureNotify) block14_data_unref, 0);
	_g_object_unref0 (paned);
	_g_object_unref0 (source_list);
	_g_object_unref0 (device_category);
	_g_object_unref0 (player2_item);
	_g_object_unref0 (player1_item);
	_g_object_unref0 (store_category);
	_g_object_unref0 (my_store_item);
	_g_object_unref0 (my_store_music_item);
	_g_object_unref0 (my_store_podcast_item);
	_g_object_unref0 (library_category);
	_g_object_unref0 (music_item);
	block14_data_unref (_data14_);
	_data14_ = NULL;
	return obj;
}

static void
source_list_view_class_init (SourceListViewClass * klass,
                             gpointer klass_data)
{
	source_list_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = source_list_view_constructor;
}

static void
source_list_view_instance_init (SourceListView * self,
                                gpointer klass)
{
}

static GType
source_list_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SourceListViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) source_list_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SourceListView), 0, (GInstanceInitFunc) source_list_view_instance_init, NULL };
	GType source_list_view_type_id;
	source_list_view_type_id = g_type_register_static (gtk_frame_get_type (), "SourceListView", &g_define_type_info, 0);
	return source_list_view_type_id;
}

GType
source_list_view_get_type (void)
{
	static volatile gsize source_list_view_type_id__once = 0;
	if (g_once_init_enter (&source_list_view_type_id__once)) {
		GType source_list_view_type_id;
		source_list_view_type_id = source_list_view_get_type_once ();
		g_once_init_leave (&source_list_view_type_id__once, source_list_view_type_id);
	}
	return source_list_view_type_id__once;
}

