/* tracker-category-view.c generated by valac 0.12.0, the Vala compiler
 * generated from tracker-category-view.gs, do not modify */


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


#define TYPE_CATEGORY_COLUMNS (category_columns_get_type ())

#define TYPE_TRACKER_CATEGORY_VIEW (tracker_category_view_get_type ())
#define TRACKER_CATEGORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_CATEGORY_VIEW, TrackerCategoryView))
#define TRACKER_CATEGORY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_CATEGORY_VIEW, TrackerCategoryViewClass))
#define IS_TRACKER_CATEGORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_CATEGORY_VIEW))
#define IS_TRACKER_CATEGORY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_CATEGORY_VIEW))
#define TRACKER_CATEGORY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_CATEGORY_VIEW, TrackerCategoryViewClass))

typedef struct _TrackerCategoryView TrackerCategoryView;
typedef struct _TrackerCategoryViewClass TrackerCategoryViewClass;
typedef struct _TrackerCategoryViewPrivate TrackerCategoryViewPrivate;

#define TYPE_CATEGORIES (categories_get_type ())

#define TYPE_TRACKER_QUERY (tracker_query_get_type ())
#define TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_QUERY, TrackerQuery))
#define TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_QUERY, TrackerQueryClass))
#define IS_TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_QUERY))
#define IS_TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_QUERY))
#define TRACKER_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_QUERY, TrackerQueryClass))

typedef struct _TrackerQuery TrackerQuery;
typedef struct _TrackerQueryClass TrackerQueryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

typedef enum  {
	CATEGORY_COLUMNS_Icon,
	CATEGORY_COLUMNS_Name,
	CATEGORY_COLUMNS_DisplayName,
	CATEGORY_COLUMNS_NumOfCols
} CategoryColumns;

typedef enum  {
	CATEGORIES_Application,
	CATEGORIES_Contact,
	CATEGORIES_Email,
	CATEGORIES_EmailAttachment,
	CATEGORIES_File,
	CATEGORIES_Folder,
	CATEGORIES_Audio,
	CATEGORIES_Video,
	CATEGORIES_Image,
	CATEGORIES_Document,
	CATEGORIES_Text,
	CATEGORIES_Development,
	CATEGORIES_Web,
	CATEGORIES_WebHistory
} Categories;

struct _TrackerCategoryView {
	GtkScrolledWindow parent_instance;
	TrackerCategoryViewPrivate * priv;
	GtkListStore* store;
	GtkTreeView* treeview;
	GtkLabel* lab;
	Categories catergory;
};

struct _TrackerCategoryViewClass {
	GtkScrolledWindowClass parent_class;
};

struct _TrackerCategoryViewPrivate {
	TrackerQuery* _Query;
};


static gpointer tracker_category_view_parent_class = NULL;

GType category_columns_get_type (void) G_GNUC_CONST;
#define icon_size 16
GType tracker_category_view_get_type (void) G_GNUC_CONST;
GType categories_get_type (void) G_GNUC_CONST;
GType tracker_query_get_type (void) G_GNUC_CONST;
#define TRACKER_CATEGORY_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TRACKER_CATEGORY_VIEW, TrackerCategoryViewPrivate))
enum  {
	TRACKER_CATEGORY_VIEW_DUMMY_PROPERTY,
	TRACKER_CATEGORY_VIEW_QUERY
};
void tracker_category_view_selection_changed (TrackerCategoryView* self, GtkTreeSelection* sel);
TrackerQuery* tracker_category_view_get_Query (TrackerCategoryView* self);
void tracker_query_set_Category (TrackerQuery* self, const gchar* value);
TrackerCategoryView* tracker_category_view_new (void);
TrackerCategoryView* tracker_category_view_construct (GType object_type);
void tracker_category_view_set_Query (TrackerCategoryView* self, TrackerQuery* value);
static GObject * tracker_category_view_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
GdkPixbuf* tracker_utils_GetThemePixbufByName (const gchar* icon_name, gint size, GdkScreen* screen);
static void _tracker_category_view_selection_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self);
static void tracker_category_view_finalize (GObject* obj);
static void _vala_tracker_category_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_tracker_category_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GType category_columns_get_type (void) {
	static volatile gsize category_columns_type_id__volatile = 0;
	if (g_once_init_enter (&category_columns_type_id__volatile)) {
		static const GEnumValue values[] = {{CATEGORY_COLUMNS_Icon, "CATEGORY_COLUMNS_Icon", "icon"}, {CATEGORY_COLUMNS_Name, "CATEGORY_COLUMNS_Name", "name"}, {CATEGORY_COLUMNS_DisplayName, "CATEGORY_COLUMNS_DisplayName", "displayname"}, {CATEGORY_COLUMNS_NumOfCols, "CATEGORY_COLUMNS_NumOfCols", "numofcols"}, {0, NULL, NULL}};
		GType category_columns_type_id;
		category_columns_type_id = g_enum_register_static ("CategoryColumns", values);
		g_once_init_leave (&category_columns_type_id__volatile, category_columns_type_id);
	}
	return category_columns_type_id__volatile;
}


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


void tracker_category_view_selection_changed (TrackerCategoryView* self, GtkTreeSelection* sel) {
	GtkTreeIter iter = {0};
	GtkTreeModel* model = NULL;
	const gchar* name = NULL;
	GtkTreeModel* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	GtkTreeModel* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sel != NULL);
	gtk_tree_selection_get_selected (sel, &_tmp0_, &_tmp1_);
	_g_object_unref0 (model);
	_tmp2_ = _g_object_ref0 (_tmp0_);
	model = _tmp2_;
	iter = _tmp1_;
	gtk_tree_model_get ((GtkTreeModel*) self->store, &iter, CATEGORY_COLUMNS_Name, &name, -1);
	if (self->priv->_Query != NULL) {
		tracker_query_set_Category (self->priv->_Query, name);
	}
	_g_object_unref0 (model);
}


TrackerCategoryView* tracker_category_view_construct (GType object_type) {
	TrackerCategoryView * self = NULL;
	self = (TrackerCategoryView*) g_object_new (object_type, NULL);
	return self;
}


TrackerCategoryView* tracker_category_view_new (void) {
	return tracker_category_view_construct (TYPE_TRACKER_CATEGORY_VIEW);
}


TrackerQuery* tracker_category_view_get_Query (TrackerCategoryView* self) {
	TrackerQuery* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_Query;
	return result;
}


void tracker_category_view_set_Query (TrackerCategoryView* self, TrackerQuery* value) {
	g_return_if_fail (self != NULL);
	self->priv->_Query = value;
	g_object_notify ((GObject *) self, "Query");
}


static void _tracker_category_view_selection_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self) {
	tracker_category_view_selection_changed (self, _sender);
}


static GObject * tracker_category_view_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	TrackerCategoryView * self;
	GtkListStore* _tmp0_ = NULL;
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp1_ = {0};
	GdkScreen* _tmp2_ = NULL;
	GdkPixbuf* _tmp3_ = NULL;
	GdkPixbuf* _tmp4_;
	GtkTreeIter _tmp5_ = {0};
	GdkScreen* _tmp6_ = NULL;
	GdkPixbuf* _tmp7_ = NULL;
	GdkPixbuf* _tmp8_;
	GtkTreeIter _tmp9_ = {0};
	GdkScreen* _tmp10_ = NULL;
	GdkPixbuf* _tmp11_ = NULL;
	GdkPixbuf* _tmp12_;
	GtkTreeIter _tmp13_ = {0};
	GdkScreen* _tmp14_ = NULL;
	GdkPixbuf* _tmp15_ = NULL;
	GdkPixbuf* _tmp16_;
	GtkTreeIter _tmp17_ = {0};
	GdkScreen* _tmp18_ = NULL;
	GdkPixbuf* _tmp19_ = NULL;
	GdkPixbuf* _tmp20_;
	GtkTreeIter _tmp21_ = {0};
	GdkScreen* _tmp22_ = NULL;
	GdkPixbuf* _tmp23_ = NULL;
	GdkPixbuf* _tmp24_;
	GtkTreeIter _tmp25_ = {0};
	GdkScreen* _tmp26_ = NULL;
	GdkPixbuf* _tmp27_ = NULL;
	GdkPixbuf* _tmp28_;
	GtkTreeIter _tmp29_ = {0};
	GdkScreen* _tmp30_ = NULL;
	GdkPixbuf* _tmp31_ = NULL;
	GdkPixbuf* _tmp32_;
	GtkTreeView* _tmp33_ = NULL;
	GtkCellRendererPixbuf* _tmp34_ = NULL;
	GtkCellRendererPixbuf* _tmp35_;
	GtkCellRendererText* _tmp36_ = NULL;
	GtkCellRendererText* _tmp37_;
	GtkTreeSelection* _tmp38_ = NULL;
	GtkTreeSelection* _tmp39_;
	GtkTreeSelection* category_selection;
	parent_class = G_OBJECT_CLASS (tracker_category_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = TRACKER_CATEGORY_VIEW (obj);
	g_object_set ((GtkScrolledWindow*) self, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set ((GtkScrolledWindow*) self, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	gtk_scrolled_window_set_shadow_type ((GtkScrolledWindow*) self, GTK_SHADOW_ETCHED_OUT);
	_tmp0_ = gtk_list_store_new ((gint) CATEGORY_COLUMNS_NumOfCols, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
	_g_object_unref0 (self->store);
	self->store = _tmp0_;
	gtk_list_store_append (self->store, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp3_ = tracker_utils_GetThemePixbufByName ("system-file-manager", icon_size, _tmp2_);
	_tmp4_ = _tmp3_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp4_, CATEGORY_COLUMNS_Name, "All", CATEGORY_COLUMNS_DisplayName, "All Files", -1, -1);
	_g_object_unref0 (_tmp4_);
	gtk_list_store_append (self->store, &_tmp5_);
	iter = _tmp5_;
	_tmp6_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp7_ = tracker_utils_GetThemePixbufByName ("folder", icon_size, _tmp6_);
	_tmp8_ = _tmp7_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp8_, CATEGORY_COLUMNS_Name, "nfo:Folder", CATEGORY_COLUMNS_DisplayName, "Folders", -1, -1);
	_g_object_unref0 (_tmp8_);
	gtk_list_store_append (self->store, &_tmp9_);
	iter = _tmp9_;
	_tmp10_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp11_ = tracker_utils_GetThemePixbufByName ("x-office-document", icon_size, _tmp10_);
	_tmp12_ = _tmp11_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp12_, CATEGORY_COLUMNS_Name, "nfo:Document", CATEGORY_COLUMNS_DisplayName, "Documents", -1, -1);
	_g_object_unref0 (_tmp12_);
	gtk_list_store_append (self->store, &_tmp13_);
	iter = _tmp13_;
	_tmp14_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp15_ = tracker_utils_GetThemePixbufByName ("image-x-generic", icon_size, _tmp14_);
	_tmp16_ = _tmp15_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp16_, CATEGORY_COLUMNS_Name, "nfo:Image", CATEGORY_COLUMNS_DisplayName, "Images", -1, -1);
	_g_object_unref0 (_tmp16_);
	gtk_list_store_append (self->store, &_tmp17_);
	iter = _tmp17_;
	_tmp18_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp19_ = tracker_utils_GetThemePixbufByName ("audio-x-generic", icon_size, _tmp18_);
	_tmp20_ = _tmp19_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp20_, CATEGORY_COLUMNS_Name, "nmm:MusicPiece", CATEGORY_COLUMNS_DisplayName, "Music", -1, -1);
	_g_object_unref0 (_tmp20_);
	gtk_list_store_append (self->store, &_tmp21_);
	iter = _tmp21_;
	_tmp22_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp23_ = tracker_utils_GetThemePixbufByName ("video-x-generic", icon_size, _tmp22_);
	_tmp24_ = _tmp23_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp24_, CATEGORY_COLUMNS_Name, "nmm:Video", CATEGORY_COLUMNS_DisplayName, "Videos", -1, -1);
	_g_object_unref0 (_tmp24_);
	gtk_list_store_append (self->store, &_tmp25_);
	iter = _tmp25_;
	_tmp26_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp27_ = tracker_utils_GetThemePixbufByName ("system-run", icon_size, _tmp26_);
	_tmp28_ = _tmp27_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp28_, CATEGORY_COLUMNS_Name, "nfo:SoftwareApplication", CATEGORY_COLUMNS_DisplayName, "Applications", -1, -1);
	_g_object_unref0 (_tmp28_);
	gtk_list_store_append (self->store, &_tmp29_);
	iter = _tmp29_;
	_tmp30_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp31_ = tracker_utils_GetThemePixbufByName ("evolution-mail", icon_size, _tmp30_);
	_tmp32_ = _tmp31_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp32_, CATEGORY_COLUMNS_Name, "nmo:Email", CATEGORY_COLUMNS_DisplayName, "Emails", -1, -1);
	_g_object_unref0 (_tmp32_);
	_tmp33_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) self->store);
	_g_object_unref0 (self->treeview);
	self->treeview = g_object_ref_sink (_tmp33_);
	_tmp34_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ();
	_tmp35_ = g_object_ref_sink (_tmp34_);
	gtk_tree_view_insert_column_with_attributes (self->treeview, -1, "icon", (GtkCellRenderer*) _tmp35_, "pixbuf", 0, NULL, NULL);
	_g_object_unref0 (_tmp35_);
	_tmp36_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	_tmp37_ = g_object_ref_sink (_tmp36_);
	gtk_tree_view_insert_column_with_attributes (self->treeview, -1, "name", (GtkCellRenderer*) _tmp37_, "text", 2, NULL, NULL);
	_g_object_unref0 (_tmp37_);
	gtk_tree_view_set_headers_visible (self->treeview, FALSE);
	gtk_tree_view_set_enable_search (self->treeview, FALSE);
	_tmp38_ = gtk_tree_view_get_selection (self->treeview);
	_tmp39_ = _g_object_ref0 (_tmp38_);
	category_selection = _tmp39_;
	gtk_tree_selection_set_mode (category_selection, GTK_SELECTION_BROWSE);
	g_signal_connect_object (category_selection, "changed", (GCallback) _tracker_category_view_selection_changed_gtk_tree_selection_changed, self, 0);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) self->treeview);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (category_selection);
	return obj;
}


static void tracker_category_view_class_init (TrackerCategoryViewClass * klass) {
	tracker_category_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (TrackerCategoryViewPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_tracker_category_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tracker_category_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = tracker_category_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = tracker_category_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TRACKER_CATEGORY_VIEW_QUERY, g_param_spec_object ("Query", "Query", "Query", TYPE_TRACKER_QUERY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void tracker_category_view_instance_init (TrackerCategoryView * self) {
	self->priv = TRACKER_CATEGORY_VIEW_GET_PRIVATE (self);
}


static void tracker_category_view_finalize (GObject* obj) {
	TrackerCategoryView * self;
	self = TRACKER_CATEGORY_VIEW (obj);
	_g_object_unref0 (self->store);
	_g_object_unref0 (self->treeview);
	_g_object_unref0 (self->lab);
	G_OBJECT_CLASS (tracker_category_view_parent_class)->finalize (obj);
}


GType tracker_category_view_get_type (void) {
	static volatile gsize tracker_category_view_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_category_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerCategoryViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_category_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerCategoryView), 0, (GInstanceInitFunc) tracker_category_view_instance_init, NULL };
		GType tracker_category_view_type_id;
		tracker_category_view_type_id = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, "TrackerCategoryView", &g_define_type_info, 0);
		g_once_init_leave (&tracker_category_view_type_id__volatile, tracker_category_view_type_id);
	}
	return tracker_category_view_type_id__volatile;
}


static void _vala_tracker_category_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TrackerCategoryView * self;
	self = TRACKER_CATEGORY_VIEW (object);
	switch (property_id) {
		case TRACKER_CATEGORY_VIEW_QUERY:
		g_value_set_object (value, tracker_category_view_get_Query (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_tracker_category_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	TrackerCategoryView * self;
	self = TRACKER_CATEGORY_VIEW (object);
	switch (property_id) {
		case TRACKER_CATEGORY_VIEW_QUERY:
		tracker_category_view_set_Query (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



