/* tracker-stats.c generated by valac 0.11.4, the Vala compiler
 * generated from tracker-stats.vala, do not modify */

/**/
/* Copyright 2010, Martyn Russell <martyn@lanedo.com>*/
/**/
/* 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 2*/
/* 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, write to the Free Software*/
/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA*/
/* 02110-1301, USA.*/
/**/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>


#define TYPE_STATISTICS (statistics_get_type ())
#define STATISTICS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STATISTICS, Statistics))
#define IS_STATISTICS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STATISTICS))
#define STATISTICS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_STATISTICS, StatisticsIface))

typedef struct _Statistics Statistics;
typedef struct _StatisticsIface StatisticsIface;

#define TYPE_STATISTICS_PROXY (statistics_proxy_get_type ())
typedef GDBusProxy StatisticsProxy;
typedef GDBusProxyClass StatisticsProxyClass;

#define TRACKER_TYPE_STATS (tracker_stats_get_type ())
#define TRACKER_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_STATS, TrackerStats))
#define TRACKER_STATS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_STATS, TrackerStatsClass))
#define TRACKER_IS_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_STATS))
#define TRACKER_IS_STATS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_STATS))
#define TRACKER_STATS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_STATS, TrackerStatsClass))

typedef struct _TrackerStats TrackerStats;
typedef struct _TrackerStatsClass TrackerStatsClass;
typedef struct _TrackerStatsPrivate TrackerStatsPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _StatisticsIface {
	GTypeInterface parent_iface;
	gchar** (*Get) (Statistics* self, int* result_length1, int* result_length2, GError** error);
};

struct _TrackerStats {
	GtkDialog parent_instance;
	TrackerStatsPrivate * priv;
};

struct _TrackerStatsClass {
	GtkDialogClass parent_class;
};

struct _TrackerStatsPrivate {
	Statistics* tracker;
};


static gpointer tracker_stats_parent_class = NULL;

#define b PACKAGE_NAME
GType statistics_proxy_get_type (void) G_GNUC_CONST;
guint statistics_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType statistics_get_type (void) G_GNUC_CONST;
gchar** statistics_Get (Statistics* self, int* result_length1, int* result_length2, GError** error);
static void statistics_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
static gchar** statistics_proxy_Get (Statistics* self, int* result_length1, int* result_length2, GError** error);
static void statistics_proxy_statistics_interface_init (StatisticsIface* iface);
static void _dbus_statistics_Get (Statistics* self, GVariant* parameters, GDBusMethodInvocation* invocation);
static void statistics_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
static GVariant* statistics_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
static gboolean statistics_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
static void _statistics_unregister_object (gpointer user_data);
GType tracker_stats_get_type (void) G_GNUC_CONST;
#define TRACKER_STATS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_STATS, TrackerStatsPrivate))
enum  {
	TRACKER_STATS_DUMMY_PROPERTY
};
TrackerStats* tracker_stats_new (void);
TrackerStats* tracker_stats_construct (GType object_type);
static void tracker_stats_setup_dbus (TrackerStats* self);
static void tracker_stats_setup_ui (TrackerStats* self);
static void tracker_stats_on_response (TrackerStats* self, GtkDialog* source, gint response_id);
static void _tracker_stats_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
static void tracker_stats_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);

static const GDBusArgInfo _statistics_dbus_arg_info_Get_result = {-1, "result", "aas"};
static const GDBusArgInfo * const _statistics_dbus_arg_info_Get_in[] = {NULL};
static const GDBusArgInfo * const _statistics_dbus_arg_info_Get_out[] = {&_statistics_dbus_arg_info_Get_result, NULL};
static const GDBusMethodInfo _statistics_dbus_method_info_Get = {-1, "Get", (GDBusArgInfo **) (&_statistics_dbus_arg_info_Get_in), (GDBusArgInfo **) (&_statistics_dbus_arg_info_Get_out)};
static const GDBusMethodInfo * const _statistics_dbus_method_info[] = {&_statistics_dbus_method_info_Get, NULL};
static const GDBusSignalInfo * const _statistics_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _statistics_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _statistics_dbus_interface_info = {-1, "org.freedesktop.Tracker1.Statistics", (GDBusMethodInfo **) (&_statistics_dbus_method_info), (GDBusSignalInfo **) (&_statistics_dbus_signal_info), (GDBusPropertyInfo **) (&_statistics_dbus_property_info)};
static const GDBusInterfaceVTable _statistics_dbus_interface_vtable = {statistics_dbus_interface_method_call, statistics_dbus_interface_get_property, statistics_dbus_interface_set_property};

gchar** statistics_Get (Statistics* self, int* result_length1, int* result_length2, GError** error) {
	return STATISTICS_GET_INTERFACE (self)->Get (self, result_length1, result_length2, error);
}


static void statistics_base_init (StatisticsIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


GType statistics_get_type (void) {
	static volatile gsize statistics_type_id__volatile = 0;
	if (g_once_init_enter (&statistics_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (StatisticsIface), (GBaseInitFunc) statistics_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType statistics_type_id;
		statistics_type_id = g_type_register_static (G_TYPE_INTERFACE, "Statistics", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (statistics_type_id, G_TYPE_DBUS_PROXY);
		g_type_set_qdata (statistics_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) statistics_proxy_get_type);
		g_type_set_qdata (statistics_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.Tracker1.Statistics");
		g_type_set_qdata (statistics_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) statistics_register_object);
		g_once_init_leave (&statistics_type_id__volatile, statistics_type_id);
	}
	return statistics_type_id__volatile;
}


G_DEFINE_TYPE_EXTENDED (StatisticsProxy, statistics_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_STATISTICS, statistics_proxy_statistics_interface_init) );
static void statistics_proxy_class_init (StatisticsProxyClass* klass) {
	G_DBUS_PROXY_CLASS (klass)->g_signal = statistics_proxy_g_signal;
}


static void statistics_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
}


static void statistics_proxy_init (StatisticsProxy* self) {
}


static gchar** statistics_proxy_Get (Statistics* self, int* result_length1, int* result_length2, GError** error) {
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gchar** _result;
	int _result_length1;
	int _result_length2;
	GVariant* _tmp0_;
	gchar** _tmp1_;
	int _tmp1__length;
	int _tmp1__size;
	int _tmp1__length1;
	GVariantIter _tmp2_;
	GVariant* _tmp3_;
	G_DBUS_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.Tracker1.Statistics", "Get");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
	g_object_unref (_message);
	if (!_reply_message) {
		return NULL;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return NULL;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_result_length1 = 0;
	_result_length2 = 0;
	_tmp0_ = g_variant_iter_next_value (&_reply_iter);
	_tmp1_ = g_new (gchar*, 5);
	_tmp1__length = 0;
	_tmp1__size = 4;
	_tmp1__length1 = 0;
	g_variant_iter_init (&_tmp2_, _tmp0_);
	for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
		int _tmp1__length2;
		GVariantIter _tmp4_;
		GVariant* _tmp5_;
		_tmp1__length2 = 0;
		g_variant_iter_init (&_tmp4_, _tmp3_);
		for (; (_tmp5_ = g_variant_iter_next_value (&_tmp4_)) != NULL; _tmp1__length2++) {
			if (_tmp1__size == _tmp1__length) {
				_tmp1__size = 2 * _tmp1__size;
				_tmp1_ = g_renew (gchar*, _tmp1_, _tmp1__size + 1);
			}
			_tmp1_[_tmp1__length++] = g_variant_dup_string (_tmp5_, NULL);
			g_variant_unref (_tmp5_);
		}
		_result_length2 = _tmp1__length2;
		g_variant_unref (_tmp3_);
	}
	_result_length1 = _tmp1__length1;
	_tmp1_[_tmp1__length] = NULL;
	_result = _tmp1_;
	g_variant_unref (_tmp0_);
	*result_length1 = _result_length1;
	*result_length2 = _result_length2;
	g_object_unref (_reply_message);
	return _result;
}


static void statistics_proxy_statistics_interface_init (StatisticsIface* iface) {
	iface->Get = statistics_proxy_Get;
}


static void _dbus_statistics_Get (Statistics* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	int result_length1 = 0;
	int result_length2 = 0;
	gchar** _tmp6_;
	GVariantBuilder _tmp7_;
	int _tmp8_;
	g_variant_iter_init (&_arguments_iter, parameters);
	result = statistics_Get (self, &result_length1, &result_length2, &error);
	if (error) {
		g_dbus_method_invocation_return_gerror (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_tmp6_ = result;
	g_variant_builder_init (&_tmp7_, G_VARIANT_TYPE ("aas"));
	for (_tmp8_ = 0; _tmp8_ < result_length1; _tmp8_++) {
		GVariantBuilder _tmp9_;
		int _tmp10_;
		g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("aas"));
		for (_tmp10_ = 0; _tmp10_ < result_length2; _tmp10_++) {
			g_variant_builder_add_value (&_tmp9_, g_variant_new_string (*_tmp6_));
			_tmp6_++;
		}
		g_variant_builder_add_value (&_tmp7_, g_variant_builder_end (&_tmp9_));
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp7_));
	result = (_vala_array_free (result,  result_length1 *  result_length2, (GDestroyNotify) g_free), NULL);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void statistics_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "Get") == 0) {
		_dbus_statistics_Get (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}


static GVariant* statistics_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}


static gboolean statistics_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}


guint statistics_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_statistics_dbus_interface_info), &_statistics_dbus_interface_vtable, data, _statistics_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}


static void _statistics_unregister_object (gpointer user_data) {
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}


TrackerStats* tracker_stats_construct (GType object_type) {
	TrackerStats * self = NULL;
	self = (TrackerStats*) g_object_new (object_type, NULL);
	gtk_window_set_title ((GtkWindow*) self, "Statistics");
	gtk_dialog_set_has_separator ((GtkDialog*) self, FALSE);
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 12);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	tracker_stats_setup_dbus (self);
	tracker_stats_setup_ui (self);
	return self;
}


TrackerStats* tracker_stats_new (void) {
	return tracker_stats_construct (TRACKER_TYPE_STATS);
}


static void tracker_stats_setup_dbus (TrackerStats* self) {
	Statistics* _tmp0_ = NULL;
	Statistics* _tmp1_;
	Statistics* _tmp2_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_debug ("tracker-stats.vala:44: Setting up statistics D-Bus connection");
	_tmp0_ = g_initable_new (TYPE_STATISTICS_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, "g-name", "org.freedesktop.Tracker1", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/freedesktop/Tracker1/Statistics", "g-interface-name", "org.freedesktop.Tracker1.Statistics", NULL);
	_tmp1_ = (Statistics*) _tmp0_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == G_IO_ERROR) {
			goto __catch5_g_io_error;
		}
		g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp2_ = _tmp1_;
	_g_object_unref0 (self->priv->tracker);
	self->priv->tracker = _tmp2_;
	goto __finally5;
	__catch5_g_io_error:
	{
		GError * e;
		GtkMessageDialog* _tmp3_ = NULL;
		GtkMessageDialog* msg;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = (GtkMessageDialog*) gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CANCEL, "Error connecting to D-Bus session bus, %s", e->message);
		msg = g_object_ref_sink (_tmp3_);
		gtk_dialog_run ((GtkDialog*) msg);
		gtk_main_quit ();
		_g_object_unref0 (msg);
		_g_error_free0 (e);
	}
	__finally5:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


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


static void _tracker_stats_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	tracker_stats_on_response (self, _sender, response_id);
}


static void tracker_stats_setup_ui (TrackerStats* self) {
	GtkWidget* _tmp0_ = NULL;
	GtkWidget* _tmp1_;
	GtkVBox* _tmp2_;
	GtkVBox* vbox;
	GtkLabel* _tmp3_ = NULL;
	GtkLabel* label;
	GtkSizeGroup* _tmp4_ = NULL;
	GtkSizeGroup* sizegroup;
	gint _tmp5_;
	gint _tmp6_;
	gchar** _tmp7_ = NULL;
	gint _result__length1;
	gint _result__length2;
	gchar** _tmp8_;
	gchar** _result_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_debug ("tracker-stats.vala:64: Setting up statistics UI");
	_tmp0_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp2_ = _g_object_ref0 ((_tmp1_ = _tmp0_, GTK_IS_VBOX (_tmp1_) ? ((GtkVBox*) _tmp1_) : NULL));
	vbox = _tmp2_;
	gtk_box_set_spacing ((GtkBox*) vbox, 18);
	gtk_container_set_border_width ((GtkContainer*) vbox, (guint) 0);
	_tmp3_ = (GtkLabel*) gtk_label_new ("The statistics represented here do not reflect their availability, rat" \
"her the total data stored:");
	label = g_object_ref_sink (_tmp3_);
	gtk_label_set_line_wrap (label, TRUE);
	gtk_misc_set_alignment ((GtkMisc*) label, 0.0f, 0.5f);
	gtk_box_pack_start ((GtkBox*) vbox, (GtkWidget*) label, TRUE, TRUE, (guint) 0);
	_tmp4_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	sizegroup = _tmp4_;
	_tmp7_ = statistics_Get (self->priv->tracker, &_tmp5_, &_tmp6_, &_inner_error_);
	_tmp8_ = _tmp7_;
	_result__length1 = _tmp5_;
	_result__length2 = _tmp6_;
	_result_ = _tmp8_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == G_DBUS_ERROR) {
			goto __catch6_g_dbus_error;
		}
		_g_object_unref0 (sizegroup);
		_g_object_unref0 (label);
		_g_object_unref0 (vbox);
		g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	{
		gint i;
		i = 0;
		{
			gboolean _tmp9_;
			_tmp9_ = TRUE;
			while (TRUE) {
				gchar* _tmp10_;
				gchar* key;
				gchar* _tmp11_;
				gchar* val;
				gchar* key_used;
				const gchar* _tmp12_;
				GQuark _tmp13_;
				static GQuark _tmp13__label0 = 0;
				static GQuark _tmp13__label1 = 0;
				static GQuark _tmp13__label2 = 0;
				static GQuark _tmp13__label3 = 0;
				static GQuark _tmp13__label4 = 0;
				static GQuark _tmp13__label5 = 0;
				static GQuark _tmp13__label6 = 0;
				static GQuark _tmp13__label7 = 0;
				static GQuark _tmp13__label8 = 0;
				static GQuark _tmp13__label9 = 0;
				static GQuark _tmp13__label10 = 0;
				static GQuark _tmp13__label11 = 0;
				static GQuark _tmp13__label12 = 0;
				static GQuark _tmp13__label13 = 0;
				GtkHBox* _tmp70_ = NULL;
				GtkHBox* hbox;
				GtkLabel* _tmp71_ = NULL;
				GtkLabel* label_key;
				GtkLabel* _tmp72_ = NULL;
				GtkLabel* label_val;
				if (!_tmp9_) {
					i++;
				}
				_tmp9_ = FALSE;
				if (!(i < _result__length1)) {
					break;
				}
				_tmp10_ = g_strdup (_result_[(i * _result__length2) + 0]);
				key = _tmp10_;
				_tmp11_ = g_strdup (_result_[(i * _result__length2) + 1]);
				val = _tmp11_;
				key_used = NULL;
				g_debug ("tracker-stats.vala:88: --> %s = %s", key, val);
				_tmp12_ = key;
				_tmp13_ = (NULL == _tmp12_) ? 0 : g_quark_from_string (_tmp12_);
				if (_tmp13_ == ((0 != _tmp13__label0) ? _tmp13__label0 : (_tmp13__label0 = g_quark_from_static_string ("nao:Tag")))) {
					switch (0) {
						default:
						{
							gint _tmp14_;
							const gchar* _tmp15_ = NULL;
							gchar* _tmp16_;
							gchar* _tmp17_;
							_tmp14_ = atoi (val);
							_tmp15_ = ngettext ("Tag", "Tags", (gulong) _tmp14_);
							_tmp16_ = g_strdup (_tmp15_);
							_tmp17_ = _tmp16_;
							_g_free0 (key_used);
							key_used = _tmp17_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label1) ? _tmp13__label1 : (_tmp13__label1 = g_quark_from_static_string ("nco:Contact")))) {
					switch (0) {
						default:
						{
							gint _tmp18_;
							const gchar* _tmp19_ = NULL;
							gchar* _tmp20_;
							gchar* _tmp21_;
							_tmp18_ = atoi (val);
							_tmp19_ = ngettext ("Contact", "Contacts", (gulong) _tmp18_);
							_tmp20_ = g_strdup (_tmp19_);
							_tmp21_ = _tmp20_;
							_g_free0 (key_used);
							key_used = _tmp21_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label2) ? _tmp13__label2 : (_tmp13__label2 = g_quark_from_static_string ("nfo:Audio")))) {
					switch (0) {
						default:
						{
							gint _tmp22_;
							const gchar* _tmp23_ = NULL;
							gchar* _tmp24_;
							gchar* _tmp25_;
							_tmp22_ = atoi (val);
							_tmp23_ = ngettext ("Audio", "Audios", (gulong) _tmp22_);
							_tmp24_ = g_strdup (_tmp23_);
							_tmp25_ = _tmp24_;
							_g_free0 (key_used);
							key_used = _tmp25_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label3) ? _tmp13__label3 : (_tmp13__label3 = g_quark_from_static_string ("nfo:Document")))) {
					switch (0) {
						default:
						{
							gint _tmp26_;
							const gchar* _tmp27_ = NULL;
							gchar* _tmp28_;
							gchar* _tmp29_;
							_tmp26_ = atoi (val);
							_tmp27_ = ngettext ("Document", "Documents", (gulong) _tmp26_);
							_tmp28_ = g_strdup (_tmp27_);
							_tmp29_ = _tmp28_;
							_g_free0 (key_used);
							key_used = _tmp29_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label4) ? _tmp13__label4 : (_tmp13__label4 = g_quark_from_static_string ("nfo:FileDataObject")))) {
					switch (0) {
						default:
						{
							gint _tmp30_;
							const gchar* _tmp31_ = NULL;
							gchar* _tmp32_;
							gchar* _tmp33_;
							_tmp30_ = atoi (val);
							_tmp31_ = ngettext ("File", "Files", (gulong) _tmp30_);
							_tmp32_ = g_strdup (_tmp31_);
							_tmp33_ = _tmp32_;
							_g_free0 (key_used);
							key_used = _tmp33_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label5) ? _tmp13__label5 : (_tmp13__label5 = g_quark_from_static_string ("nfo:Folder")))) {
					switch (0) {
						default:
						{
							gint _tmp34_;
							const gchar* _tmp35_ = NULL;
							gchar* _tmp36_;
							gchar* _tmp37_;
							_tmp34_ = atoi (val);
							_tmp35_ = ngettext ("Folder", "Folders", (gulong) _tmp34_);
							_tmp36_ = g_strdup (_tmp35_);
							_tmp37_ = _tmp36_;
							_g_free0 (key_used);
							key_used = _tmp37_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label6) ? _tmp13__label6 : (_tmp13__label6 = g_quark_from_static_string ("nfo:Image")))) {
					switch (0) {
						default:
						{
							gint _tmp38_;
							const gchar* _tmp39_ = NULL;
							gchar* _tmp40_;
							gchar* _tmp41_;
							_tmp38_ = atoi (val);
							_tmp39_ = ngettext ("Image", "Images", (gulong) _tmp38_);
							_tmp40_ = g_strdup (_tmp39_);
							_tmp41_ = _tmp40_;
							_g_free0 (key_used);
							key_used = _tmp41_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label7) ? _tmp13__label7 : (_tmp13__label7 = g_quark_from_static_string ("nfo:SoftwareApplication")))) {
					switch (0) {
						default:
						{
							gint _tmp42_;
							const gchar* _tmp43_ = NULL;
							gchar* _tmp44_;
							gchar* _tmp45_;
							_tmp42_ = atoi (val);
							_tmp43_ = ngettext ("Application", "Applications", (gulong) _tmp42_);
							_tmp44_ = g_strdup (_tmp43_);
							_tmp45_ = _tmp44_;
							_g_free0 (key_used);
							key_used = _tmp45_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label8) ? _tmp13__label8 : (_tmp13__label8 = g_quark_from_static_string ("nfo:Video")))) {
					switch (0) {
						default:
						{
							gint _tmp46_;
							const gchar* _tmp47_ = NULL;
							gchar* _tmp48_;
							gchar* _tmp49_;
							_tmp46_ = atoi (val);
							_tmp47_ = ngettext ("Video", "Videos", (gulong) _tmp46_);
							_tmp48_ = g_strdup (_tmp47_);
							_tmp49_ = _tmp48_;
							_g_free0 (key_used);
							key_used = _tmp49_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label9) ? _tmp13__label9 : (_tmp13__label9 = g_quark_from_static_string ("nmm:MusicAlbum")))) {
					switch (0) {
						default:
						{
							gint _tmp50_;
							const gchar* _tmp51_ = NULL;
							gchar* _tmp52_;
							gchar* _tmp53_;
							_tmp50_ = atoi (val);
							_tmp51_ = ngettext ("Album", "Albums", (gulong) _tmp50_);
							_tmp52_ = g_strdup (_tmp51_);
							_tmp53_ = _tmp52_;
							_g_free0 (key_used);
							key_used = _tmp53_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label10) ? _tmp13__label10 : (_tmp13__label10 = g_quark_from_static_string ("nmm:MusicPiece")))) {
					switch (0) {
						default:
						{
							gint _tmp54_;
							const gchar* _tmp55_ = NULL;
							gchar* _tmp56_;
							gchar* _tmp57_;
							_tmp54_ = atoi (val);
							_tmp55_ = ngettext ("Music Track", "Music Tracks", (gulong) _tmp54_);
							_tmp56_ = g_strdup (_tmp55_);
							_tmp57_ = _tmp56_;
							_g_free0 (key_used);
							key_used = _tmp57_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label11) ? _tmp13__label11 : (_tmp13__label11 = g_quark_from_static_string ("nmm:Photo")))) {
					switch (0) {
						default:
						{
							gint _tmp58_;
							const gchar* _tmp59_ = NULL;
							gchar* _tmp60_;
							gchar* _tmp61_;
							_tmp58_ = atoi (val);
							_tmp59_ = ngettext ("Photo", "Photos", (gulong) _tmp58_);
							_tmp60_ = g_strdup (_tmp59_);
							_tmp61_ = _tmp60_;
							_g_free0 (key_used);
							key_used = _tmp61_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label12) ? _tmp13__label12 : (_tmp13__label12 = g_quark_from_static_string ("nmm:Playlist")))) {
					switch (0) {
						default:
						{
							gint _tmp62_;
							const gchar* _tmp63_ = NULL;
							gchar* _tmp64_;
							gchar* _tmp65_;
							_tmp62_ = atoi (val);
							_tmp63_ = ngettext ("Playlist", "Playlists", (gulong) _tmp62_);
							_tmp64_ = g_strdup (_tmp63_);
							_tmp65_ = _tmp64_;
							_g_free0 (key_used);
							key_used = _tmp65_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp13__label13) ? _tmp13__label13 : (_tmp13__label13 = g_quark_from_static_string ("nmo:Email")))) {
					switch (0) {
						default:
						{
							gint _tmp66_;
							const gchar* _tmp67_ = NULL;
							gchar* _tmp68_;
							gchar* _tmp69_;
							_tmp66_ = atoi (val);
							_tmp67_ = ngettext ("Email", "Emails", (gulong) _tmp66_);
							_tmp68_ = g_strdup (_tmp67_);
							_tmp69_ = _tmp68_;
							_g_free0 (key_used);
							key_used = _tmp69_;
							break;
						}
					}
				} else {
					switch (0) {
						default:
						{
							continue;
						}
					}
				}
				_tmp70_ = (GtkHBox*) gtk_hbox_new (FALSE, 12);
				hbox = g_object_ref_sink (_tmp70_);
				_tmp71_ = (GtkLabel*) gtk_label_new (key_used);
				label_key = g_object_ref_sink (_tmp71_);
				_tmp72_ = (GtkLabel*) gtk_label_new (val);
				label_val = g_object_ref_sink (_tmp72_);
				gtk_misc_set_alignment ((GtkMisc*) label_key, 0.0f, 0.5f);
				gtk_misc_set_alignment ((GtkMisc*) label_val, 0.0f, 0.5f);
				gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label_key, TRUE, TRUE, (guint) 0);
				gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label_val, FALSE, TRUE, (guint) 0);
				gtk_size_group_add_widget (sizegroup, (GtkWidget*) label_key);
				gtk_box_pack_start ((GtkBox*) vbox, (GtkWidget*) hbox, TRUE, TRUE, (guint) 0);
				_g_object_unref0 (label_val);
				_g_object_unref0 (label_key);
				_g_object_unref0 (hbox);
				_g_free0 (key_used);
				_g_free0 (val);
				_g_free0 (key);
			}
		}
	}
	_result_ = (_vala_array_free (_result_, _result__length1 * _result__length2, (GDestroyNotify) g_free), NULL);
	goto __finally6;
	__catch6_g_dbus_error:
	{
		GError * e;
		gchar* _tmp73_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp73_ = g_strconcat ("Could not get Tracker statistics: ", e->message, NULL);
		g_warning ("tracker-stats.vala:153: %s", _tmp73_);
		_g_free0 (_tmp73_);
		_g_error_free0 (e);
	}
	__finally6:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (sizegroup);
		_g_object_unref0 (label);
		_g_object_unref0 (vbox);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	gtk_box_set_spacing ((GtkBox*) vbox, 10);
	gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_CLOSE, (gint) GTK_RESPONSE_CLOSE);
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _tracker_stats_on_response_gtk_dialog_response, self, 0);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (sizegroup);
	_g_object_unref0 (label);
	_g_object_unref0 (vbox);
}


static void tracker_stats_on_response (TrackerStats* self, GtkDialog* source, gint response_id) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	switch (response_id) {
		case GTK_RESPONSE_CLOSE:
		{
			gtk_object_destroy ((GtkObject*) self);
			break;
		}
		default:
		break;
	}
}


static void tracker_stats_class_init (TrackerStatsClass * klass) {
	tracker_stats_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (TrackerStatsPrivate));
	G_OBJECT_CLASS (klass)->finalize = tracker_stats_finalize;
}


static void tracker_stats_instance_init (TrackerStats * self) {
	self->priv = TRACKER_STATS_GET_PRIVATE (self);
}


static void tracker_stats_finalize (GObject* obj) {
	TrackerStats * self;
	self = TRACKER_STATS (obj);
	_g_object_unref0 (self->priv->tracker);
	G_OBJECT_CLASS (tracker_stats_parent_class)->finalize (obj);
}


GType tracker_stats_get_type (void) {
	static volatile gsize tracker_stats_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_stats_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerStatsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_stats_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStats), 0, (GInstanceInitFunc) tracker_stats_instance_init, NULL };
		GType tracker_stats_type_id;
		tracker_stats_type_id = g_type_register_static (GTK_TYPE_DIALOG, "TrackerStats", &g_define_type_info, 0);
		g_once_init_leave (&tracker_stats_type_id__volatile, tracker_stats_type_id);
	}
	return tracker_stats_type_id__volatile;
}


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



