/* tracker-category-view.c generated by valac 0.11.2, 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;
	const gchar* name;
	GtkTreeModel* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	GtkTreeModel* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sel != NULL);
	model = NULL;
	name = 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;
	GtkListStore* _tmp1_;
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp2_ = {0};
	GdkScreen* _tmp3_ = NULL;
	GdkPixbuf* _tmp4_ = NULL;
	GdkPixbuf* _tmp5_;
	GtkTreeIter _tmp6_ = {0};
	GdkScreen* _tmp7_ = NULL;
	GdkPixbuf* _tmp8_ = NULL;
	GdkPixbuf* _tmp9_;
	GtkTreeIter _tmp10_ = {0};
	GdkScreen* _tmp11_ = NULL;
	GdkPixbuf* _tmp12_ = NULL;
	GdkPixbuf* _tmp13_;
	GtkTreeIter _tmp14_ = {0};
	GdkScreen* _tmp15_ = NULL;
	GdkPixbuf* _tmp16_ = NULL;
	GdkPixbuf* _tmp17_;
	GtkTreeIter _tmp18_ = {0};
	GdkScreen* _tmp19_ = NULL;
	GdkPixbuf* _tmp20_ = NULL;
	GdkPixbuf* _tmp21_;
	GtkTreeIter _tmp22_ = {0};
	GdkScreen* _tmp23_ = NULL;
	GdkPixbuf* _tmp24_ = NULL;
	GdkPixbuf* _tmp25_;
	GtkTreeIter _tmp26_ = {0};
	GdkScreen* _tmp27_ = NULL;
	GdkPixbuf* _tmp28_ = NULL;
	GdkPixbuf* _tmp29_;
	GtkTreeIter _tmp30_ = {0};
	GdkScreen* _tmp31_ = NULL;
	GdkPixbuf* _tmp32_ = NULL;
	GdkPixbuf* _tmp33_;
	GtkTreeView* _tmp34_ = NULL;
	GtkTreeView* _tmp35_;
	GtkCellRendererPixbuf* _tmp36_ = NULL;
	GtkCellRendererPixbuf* _tmp37_;
	GtkCellRendererText* _tmp38_ = NULL;
	GtkCellRendererText* _tmp39_;
	GtkTreeSelection* _tmp40_ = NULL;
	GtkTreeSelection* _tmp41_;
	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);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (self->store);
	self->store = _tmp1_;
	gtk_list_store_append (self->store, &_tmp2_);
	iter = _tmp2_;
	_tmp3_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp4_ = tracker_utils_GetThemePixbufByName ("system-file-manager", icon_size, _tmp3_);
	_tmp5_ = _tmp4_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp5_, CATEGORY_COLUMNS_Name, "All", CATEGORY_COLUMNS_DisplayName, "All Files", -1, -1);
	_g_object_unref0 (_tmp5_);
	gtk_list_store_append (self->store, &_tmp6_);
	iter = _tmp6_;
	_tmp7_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp8_ = tracker_utils_GetThemePixbufByName ("folder", icon_size, _tmp7_);
	_tmp9_ = _tmp8_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp9_, CATEGORY_COLUMNS_Name, "nfo:Folder", CATEGORY_COLUMNS_DisplayName, "Folders", -1, -1);
	_g_object_unref0 (_tmp9_);
	gtk_list_store_append (self->store, &_tmp10_);
	iter = _tmp10_;
	_tmp11_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp12_ = tracker_utils_GetThemePixbufByName ("x-office-document", icon_size, _tmp11_);
	_tmp13_ = _tmp12_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp13_, CATEGORY_COLUMNS_Name, "nfo:Document", CATEGORY_COLUMNS_DisplayName, "Documents", -1, -1);
	_g_object_unref0 (_tmp13_);
	gtk_list_store_append (self->store, &_tmp14_);
	iter = _tmp14_;
	_tmp15_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp16_ = tracker_utils_GetThemePixbufByName ("image-x-generic", icon_size, _tmp15_);
	_tmp17_ = _tmp16_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp17_, CATEGORY_COLUMNS_Name, "nfo:Image", CATEGORY_COLUMNS_DisplayName, "Images", -1, -1);
	_g_object_unref0 (_tmp17_);
	gtk_list_store_append (self->store, &_tmp18_);
	iter = _tmp18_;
	_tmp19_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp20_ = tracker_utils_GetThemePixbufByName ("audio-x-generic", icon_size, _tmp19_);
	_tmp21_ = _tmp20_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp21_, CATEGORY_COLUMNS_Name, "nmm:MusicPiece", CATEGORY_COLUMNS_DisplayName, "Music", -1, -1);
	_g_object_unref0 (_tmp21_);
	gtk_list_store_append (self->store, &_tmp22_);
	iter = _tmp22_;
	_tmp23_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp24_ = tracker_utils_GetThemePixbufByName ("video-x-generic", icon_size, _tmp23_);
	_tmp25_ = _tmp24_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp25_, CATEGORY_COLUMNS_Name, "nmm:Video", CATEGORY_COLUMNS_DisplayName, "Videos", -1, -1);
	_g_object_unref0 (_tmp25_);
	gtk_list_store_append (self->store, &_tmp26_);
	iter = _tmp26_;
	_tmp27_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp28_ = tracker_utils_GetThemePixbufByName ("system-run", icon_size, _tmp27_);
	_tmp29_ = _tmp28_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp29_, CATEGORY_COLUMNS_Name, "nfo:SoftwareApplication", CATEGORY_COLUMNS_DisplayName, "Applications", -1, -1);
	_g_object_unref0 (_tmp29_);
	gtk_list_store_append (self->store, &_tmp30_);
	iter = _tmp30_;
	_tmp31_ = gtk_widget_get_screen ((GtkWidget*) self);
	_tmp32_ = tracker_utils_GetThemePixbufByName ("evolution-mail", icon_size, _tmp31_);
	_tmp33_ = _tmp32_;
	gtk_list_store_set (self->store, &iter, CATEGORY_COLUMNS_Icon, _tmp33_, CATEGORY_COLUMNS_Name, "nmo:Email", CATEGORY_COLUMNS_DisplayName, "Emails", -1, -1);
	_g_object_unref0 (_tmp33_);
	_tmp34_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) self->store);
	_tmp35_ = g_object_ref_sink (_tmp34_);
	_g_object_unref0 (self->treeview);
	self->treeview = _tmp35_;
	_tmp36_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ();
	_tmp37_ = g_object_ref_sink (_tmp36_);
	gtk_tree_view_insert_column_with_attributes (self->treeview, -1, "icon", (GtkCellRenderer*) _tmp37_, "pixbuf", 0, NULL, NULL);
	_g_object_unref0 (_tmp37_);
	_tmp38_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	_tmp39_ = g_object_ref_sink (_tmp38_);
	gtk_tree_view_insert_column_with_attributes (self->treeview, -1, "name", (GtkCellRenderer*) _tmp39_, "text", 2, NULL, NULL);
	_g_object_unref0 (_tmp39_);
	gtk_tree_view_set_headers_visible (self->treeview, FALSE);
	gtk_tree_view_set_enable_search (self->treeview, FALSE);
	_tmp40_ = gtk_tree_view_get_selection (self->treeview);
	_tmp41_ = _g_object_ref0 (_tmp40_);
	category_selection = _tmp41_;
	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;
	}
}



