/* zeitgeist-datahub.c generated by valac 0.56.19, the Vala compiler
 * generated from zeitgeist-datahub.vala, do not modify */

/*
 * Zeitgeist
 *
 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by Michal Hruby <michal.mhr@gmail.com>
 *
 */

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "zeitgeist.h"
#include "zeitgeist-datamodel.h"
#include <stdio.h>

#define DATA_HUB_UNIQUE_NAME "org.gnome.zeitgeist.datahub"
#define DATA_HUB_OBJECT_PATH "/org/gnome/zeitgeist/datahub"
#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_DATA_HUB_SERVICE (data_hub_service_get_type ())
#define DATA_HUB_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_HUB_SERVICE, DataHubService))
#define IS_DATA_HUB_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_HUB_SERVICE))
#define DATA_HUB_SERVICE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_DATA_HUB_SERVICE, DataHubServiceIface))

typedef struct _DataHubService DataHubService;
typedef struct _DataHubServiceIface DataHubServiceIface;

#define TYPE_DATA_HUB_SERVICE_PROXY (data_hub_service_proxy_get_type ())
typedef GDBusProxy DataHubServiceProxy;
typedef GDBusProxyClass DataHubServiceProxyClass;

#define TYPE_DATA_HUB (data_hub_get_type ())
#define DATA_HUB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_HUB, DataHub))
#define DATA_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_HUB, DataHubClass))
#define IS_DATA_HUB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_HUB))
#define IS_DATA_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_HUB))
#define DATA_HUB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_HUB, DataHubClass))

typedef struct _DataHub DataHub;
typedef struct _DataHubClass DataHubClass;
typedef struct _DataHubPrivate DataHubPrivate;

#define TYPE_DATA_PROVIDER (data_provider_get_type ())
#define DATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_PROVIDER, DataProvider))
#define DATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_PROVIDER, DataProviderClass))
#define IS_DATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_PROVIDER))
#define IS_DATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_PROVIDER))
#define DATA_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_PROVIDER, DataProviderClass))

typedef struct _DataProvider DataProvider;
typedef struct _DataProviderClass DataProviderClass;
enum  {
	DATA_HUB_0_PROPERTY,
	DATA_HUB_RETURN_CODE_PROPERTY,
	DATA_HUB_NUM_PROPERTIES
};
static GParamSpec* data_hub_properties[DATA_HUB_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TYPE_RECENT_MANAGER_GTK (recent_manager_gtk_get_type ())
#define RECENT_MANAGER_GTK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RECENT_MANAGER_GTK, RecentManagerGtk))
#define RECENT_MANAGER_GTK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RECENT_MANAGER_GTK, RecentManagerGtkClass))
#define IS_RECENT_MANAGER_GTK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RECENT_MANAGER_GTK))
#define IS_RECENT_MANAGER_GTK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RECENT_MANAGER_GTK))
#define RECENT_MANAGER_GTK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RECENT_MANAGER_GTK, RecentManagerGtkClass))

typedef struct _RecentManagerGtk RecentManagerGtk;
typedef struct _RecentManagerGtkClass RecentManagerGtkClass;

#define TYPE_RECENT_DOCUMENTS_KDE (recent_documents_kde_get_type ())
#define RECENT_DOCUMENTS_KDE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RECENT_DOCUMENTS_KDE, RecentDocumentsKDE))
#define RECENT_DOCUMENTS_KDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RECENT_DOCUMENTS_KDE, RecentDocumentsKDEClass))
#define IS_RECENT_DOCUMENTS_KDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RECENT_DOCUMENTS_KDE))
#define IS_RECENT_DOCUMENTS_KDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RECENT_DOCUMENTS_KDE))
#define RECENT_DOCUMENTS_KDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RECENT_DOCUMENTS_KDE, RecentDocumentsKDEClass))

typedef struct _RecentDocumentsKDE RecentDocumentsKDE;
typedef struct _RecentDocumentsKDEClass RecentDocumentsKDEClass;

#define TYPE_TELEPATHY_OBSERVER (telepathy_observer_get_type ())
#define TELEPATHY_OBSERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TELEPATHY_OBSERVER, TelepathyObserver))
#define TELEPATHY_OBSERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TELEPATHY_OBSERVER, TelepathyObserverClass))
#define IS_TELEPATHY_OBSERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TELEPATHY_OBSERVER))
#define IS_TELEPATHY_OBSERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TELEPATHY_OBSERVER))
#define TELEPATHY_OBSERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TELEPATHY_OBSERVER, TelepathyObserverClass))

typedef struct _TelepathyObserver TelepathyObserver;
typedef struct _TelepathyObserverClass TelepathyObserverClass;

#define TYPE_DOWNLOADS_DIRECTORY_MONITOR (downloads_directory_monitor_get_type ())
#define DOWNLOADS_DIRECTORY_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOWNLOADS_DIRECTORY_MONITOR, DownloadsDirectoryMonitor))
#define DOWNLOADS_DIRECTORY_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOWNLOADS_DIRECTORY_MONITOR, DownloadsDirectoryMonitorClass))
#define IS_DOWNLOADS_DIRECTORY_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOWNLOADS_DIRECTORY_MONITOR))
#define IS_DOWNLOADS_DIRECTORY_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOWNLOADS_DIRECTORY_MONITOR))
#define DOWNLOADS_DIRECTORY_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOWNLOADS_DIRECTORY_MONITOR, DownloadsDirectoryMonitorClass))

typedef struct _DownloadsDirectoryMonitor DownloadsDirectoryMonitor;
typedef struct _DownloadsDirectoryMonitorClass DownloadsDirectoryMonitorClass;

#define TYPE_DESKTOP_LAUNCH_LISTENER (desktop_launch_listener_get_type ())
#define DESKTOP_LAUNCH_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DESKTOP_LAUNCH_LISTENER, DesktopLaunchListener))
#define DESKTOP_LAUNCH_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DESKTOP_LAUNCH_LISTENER, DesktopLaunchListenerClass))
#define IS_DESKTOP_LAUNCH_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DESKTOP_LAUNCH_LISTENER))
#define IS_DESKTOP_LAUNCH_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DESKTOP_LAUNCH_LISTENER))
#define DESKTOP_LAUNCH_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DESKTOP_LAUNCH_LISTENER, DesktopLaunchListenerClass))

typedef struct _DesktopLaunchListener DesktopLaunchListener;
typedef struct _DesktopLaunchListenerClass DesktopLaunchListenerClass;
typedef struct _DataHubStartDataProvidersData DataHubStartDataProvidersData;
typedef struct _Block1Data Block1Data;
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
typedef struct _DataHubBatchInsertEventsData DataHubBatchInsertEventsData;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _DataHubServiceIface {
	GTypeInterface parent_iface;
	gchar** (*get_data_providers) (DataHubService* self, gint* result_length1, GError** error);
};

struct _DataHub {
	GObject parent_instance;
	DataHubPrivate * priv;
};

struct _DataHubClass {
	GObjectClass parent_class;
};

struct _DataHubPrivate {
	ZeitgeistLog* zg_log;
	ZeitgeistDataSourceRegistry* registry;
	GMainLoop* main_loop;
	GList* providers;
	GList* sources_info;
	GPtrArray* queued_events;
	guint idle_id;
	gint _return_code;
};

struct _DataHubStartDataProvidersData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DataHub* self;
	ZeitgeistDataSourceRegistry* _tmp0_;
	GPtrArray* sources;
	ZeitgeistDataSourceRegistry* _tmp1_;
	GPtrArray* _tmp2_;
	guint i;
	gboolean _tmp3_;
	guint _tmp4_;
	GPtrArray* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GPtrArray* _tmp8_;
	gconstpointer _tmp9_;
	ZeitgeistDataSource* _tmp10_;
	ZeitgeistDataSource* _tmp11_;
	GError* err;
	GError* _tmp12_;
	const gchar* _tmp13_;
	RecentManagerGtk* _tmp14_;
	RecentDocumentsKDE* _tmp15_;
	RecentDocumentsKDE* _tmp16_;
	RecentDocumentsKDE* _tmp17_;
	TelepathyObserver* _tmp18_;
	TelepathyObserver* _tmp19_;
	TelepathyObserver* _tmp20_;
	DownloadsDirectoryMonitor* _tmp21_;
	DownloadsDirectoryMonitor* _tmp22_;
	DownloadsDirectoryMonitor* _tmp23_;
	DesktopLaunchListener* _tmp24_;
	GList* _tmp25_;
	GList* prov_collection;
	GList* prov_it;
	DataProvider* prov;
	gboolean enabled;
	gint64 timestamp;
	GList* _tmp26_;
	GList* src_collection;
	GList* src_it;
	ZeitgeistDataSource* _tmp27_;
	ZeitgeistDataSource* src;
	ZeitgeistDataSource* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	DataProvider* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	ZeitgeistDataSource* _tmp34_;
	gint64 _tmp35_;
	gint64 _tmp36_;
	DataProvider* _tmp37_;
	gboolean _tmp38_;
	gboolean _tmp39_;
	ZeitgeistDataSource* ds;
	DataProvider* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	DataProvider* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	DataProvider* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	GPtrArray* _tmp49_;
	GPtrArray* _tmp50_;
	ZeitgeistDataSource* _tmp51_;
	ZeitgeistDataSource* _tmp52_;
	gboolean _tmp53_;
	ZeitgeistDataSourceRegistry* _tmp54_;
	ZeitgeistDataSource* _tmp55_;
	GError* reg_err;
	GError* _tmp56_;
	const gchar* _tmp57_;
	DataProvider* _tmp58_;
	DataProvider* _tmp59_;
	DataProvider* _tmp60_;
	GError* _inner_error0_;
};

struct _Block1Data {
	int _ref_count_;
	DataHub* self;
	GPtrArray* all_events;
	gpointer _async_data_;
};

struct _DataHubBatchInsertEventsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DataHub* self;
	Block1Data* _data1_;
	GPtrArray* _tmp0_;
	GPtrArray* _tmp1_;
	GPtrArray* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	guint elements_pushed;
	GPtrArray* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GPtrArray* ptr_arr;
	GPtrArray* _tmp8_;
	guint i;
	gboolean _tmp9_;
	guint _tmp10_;
	GPtrArray* _tmp11_;
	GPtrArray* _tmp12_;
	gconstpointer _tmp13_;
	ZeitgeistEvent* _tmp14_;
	ZeitgeistLog* _tmp15_;
	GPtrArray* _tmp16_;
	GArray* _tmp17_;
	GArray* _tmp18_;
	GError* err;
	GError* _tmp19_;
	const gchar* _tmp20_;
	GPtrArray* _tmp21_;
	GError* _inner_error0_;
};

static gint DataHub_private_offset;
static gpointer data_hub_parent_class = NULL;
static DataHubServiceIface * data_hub_data_hub_service_parent_iface = NULL;

VALA_EXTERN GType data_hub_service_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint data_hub_service_register_object (void* object,
                                        GDBusConnection* connection,
                                        const gchar* path,
                                        GError** error);
VALA_EXTERN GType data_hub_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataHubService, g_object_unref)
VALA_EXTERN gchar** data_hub_service_get_data_providers (DataHubService* self,
                                             gint* result_length1,
                                             GError** error);
static GType data_hub_service_get_type_once (void);
static void data_hub_service_proxy_g_signal (GDBusProxy* proxy,
                                      const gchar* sender_name,
                                      const gchar* signal_name,
                                      GVariant* parameters);
static gchar** data_hub_service_proxy_get_data_providers (DataHubService* self,
                                                   gint* result_length1,
                                                   GError** error);
static void data_hub_service_proxy_data_hub_service_interface_init (DataHubServiceIface* iface);
static void _dbus_data_hub_service_get_data_providers (DataHubService* self,
                                                GVariant* _parameters_,
                                                GDBusMethodInvocation* invocation);
static void data_hub_service_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* data_hub_service_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 data_hub_service_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 _data_hub_service_unregister_object (gpointer user_data);
VALA_EXTERN GType data_hub_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataHub, g_object_unref)
VALA_EXTERN GType data_provider_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataProvider, g_object_unref)
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN DataHub* data_hub_new (void);
VALA_EXTERN DataHub* data_hub_construct (GType object_type);
static void data_hub_data_source_registered (DataHub* self,
                                      ZeitgeistDataSource* ds);
static void data_hub_start_data_providers_data_free (gpointer _data);
static void data_hub_start_data_providers (DataHub* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void data_hub_start_data_providers_finish (DataHub* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static gboolean data_hub_start_data_providers_co (DataHubStartDataProvidersData* _data_);
static void _data_hub_data_source_registered_zeitgeist_data_source_registry_source_registered (ZeitgeistDataSourceRegistry* _sender,
                                                                                        ZeitgeistDataSource* data_source,
                                                                                        gpointer self);
static void data_hub_start_data_providers_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN RecentManagerGtk* recent_manager_gtk_new (DataHub* datahub);
VALA_EXTERN RecentManagerGtk* recent_manager_gtk_construct (GType object_type,
                                                DataHub* datahub);
VALA_EXTERN GType recent_manager_gtk_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RecentManagerGtk, g_object_unref)
VALA_EXTERN GType recent_documents_kde_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RecentDocumentsKDE, g_object_unref)
VALA_EXTERN RecentDocumentsKDE* recent_documents_kde_new (DataHub* datahub,
                                              GError** error);
VALA_EXTERN RecentDocumentsKDE* recent_documents_kde_construct (GType object_type,
                                                    DataHub* datahub,
                                                    GError** error);
VALA_EXTERN GType telepathy_observer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TelepathyObserver, g_object_unref)
VALA_EXTERN TelepathyObserver* telepathy_observer_new (DataHub* datahub,
                                           GError** error);
VALA_EXTERN TelepathyObserver* telepathy_observer_construct (GType object_type,
                                                 DataHub* datahub,
                                                 GError** error);
VALA_EXTERN GType downloads_directory_monitor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DownloadsDirectoryMonitor, g_object_unref)
VALA_EXTERN DownloadsDirectoryMonitor* downloads_directory_monitor_new (DataHub* datahub,
                                                            GError** error);
VALA_EXTERN DownloadsDirectoryMonitor* downloads_directory_monitor_construct (GType object_type,
                                                                  DataHub* datahub,
                                                                  GError** error);
VALA_EXTERN DesktopLaunchListener* desktop_launch_listener_new (DataHub* datahub);
VALA_EXTERN DesktopLaunchListener* desktop_launch_listener_construct (GType object_type,
                                                          DataHub* datahub);
VALA_EXTERN GType desktop_launch_listener_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DesktopLaunchListener, g_object_unref)
VALA_EXTERN const gchar* data_provider_get_unique_id (DataProvider* self);
VALA_EXTERN gboolean data_provider_get_register (DataProvider* self);
VALA_EXTERN const gchar* data_provider_get_name (DataProvider* self);
VALA_EXTERN const gchar* data_provider_get_description (DataProvider* self);
static void data_hub_items_available (DataHub* self,
                               DataProvider* prov,
                               GPtrArray* events);
static void _data_hub_items_available_data_provider_items_available (DataProvider* _sender,
                                                              GPtrArray* events,
                                                              gpointer self);
VALA_EXTERN void data_provider_set_last_timestamp (DataProvider* self,
                                       gint64 value);
VALA_EXTERN void data_provider_start (DataProvider* self);
VALA_EXTERN gboolean data_provider_get_enabled (DataProvider* self);
static void __lambda10_ (DataHub* self,
                  ZeitgeistEvent* e);
static void ___lambda10__gfunc (gconstpointer data,
                         gpointer self);
static gboolean ___lambda11_ (DataHub* self);
static void data_hub_insert_events (DataHub* self);
static gboolean ____lambda11__gsource_func (gpointer self);
VALA_EXTERN void data_hub_batch_insert_events (DataHub* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void data_hub_batch_insert_events_finish (DataHub* self,
                                          GAsyncResult* _res_);
static void data_hub_batch_insert_events_data_free (gpointer _data);
static gboolean data_hub_batch_insert_events_co (DataHubBatchInsertEventsData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void __lambda12_ (Block1Data* _data1_,
                  ZeitgeistEvent* e);
static void ___lambda12__gfunc (gconstpointer data,
                         gpointer self);
static void data_hub_batch_insert_events_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
VALA_EXTERN void data_hub_run (DataHub* self,
                   GError** error);
static void __lambda13_ (DataHub* self,
                  GDBusConnection* conn);
static void ___lambda13__gbus_acquired_callback (GDBusConnection* connection,
                                          const gchar* name,
                                          gpointer self);
static void __lambda14_ (DataHub* self);
static void ___lambda14__gbus_name_acquired_callback (GDBusConnection* connection,
                                               const gchar* name,
                                               gpointer self);
static void __lambda15_ (DataHub* self);
static void data_hub_set_return_code (DataHub* self,
                               gint value);
VALA_EXTERN void data_hub_quit (DataHub* self);
static void ___lambda15__gbus_name_lost_callback (GDBusConnection* connection,
                                           const gchar* name,
                                           gpointer self);
VALA_EXTERN gchar** data_hub_get_data_source_actors (DataHub* self,
                                         gboolean only_enabled,
                                         gint* result_length1);
static void _vala_array_add3 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static gchar** data_hub_real_get_data_providers (DataHubService* base,
                                          gint* result_length1,
                                          GError** error);
static void _vala_array_add4 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static gint data_hub_main (gchar** args,
                    gint args_length1);
VALA_EXTERN gint data_hub_get_return_code (DataHub* self);
static GObject * data_hub_constructor (GType type,
                                guint n_construct_properties,
                                GObjectConstructParam * construct_properties);
static void _data_hub___lambda16_ (DataHub* self);
static void __data_hub___lambda16__g_object_notify (GObject* _sender,
                                             GParamSpec* pspec,
                                             gpointer self);
static void data_hub_finalize (GObject * obj);
static GType data_hub_get_type_once (void);
static void _vala_data_hub_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec);
static void _vala_data_hub_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 const GDBusArgInfo _data_hub_service_dbus_arg_info_get_data_providers_result = {-1, "result", "as", NULL};
static const GDBusArgInfo * const _data_hub_service_dbus_arg_info_get_data_providers_in[] = {NULL};
static const GDBusArgInfo * const _data_hub_service_dbus_arg_info_get_data_providers_out[] = {&_data_hub_service_dbus_arg_info_get_data_providers_result, NULL};
static const GDBusMethodInfo _data_hub_service_dbus_method_info_get_data_providers = {-1, "GetDataProviders", (GDBusArgInfo **) (&_data_hub_service_dbus_arg_info_get_data_providers_in), (GDBusArgInfo **) (&_data_hub_service_dbus_arg_info_get_data_providers_out), NULL};
static const GDBusMethodInfo * const _data_hub_service_dbus_method_info[] = {&_data_hub_service_dbus_method_info_get_data_providers, NULL};
static const GDBusSignalInfo * const _data_hub_service_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _data_hub_service_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _data_hub_service_dbus_interface_info = {-1, "org.gnome.zeitgeist.datahub", (GDBusMethodInfo **) (&_data_hub_service_dbus_method_info), (GDBusSignalInfo **) (&_data_hub_service_dbus_signal_info), (GDBusPropertyInfo **) (&_data_hub_service_dbus_property_info), NULL};
static const GDBusInterfaceVTable _data_hub_service_dbus_interface_vtable = {data_hub_service_dbus_interface_method_call, data_hub_service_dbus_interface_get_property, data_hub_service_dbus_interface_set_property};

gchar**
data_hub_service_get_data_providers (DataHubService* self,
                                     gint* result_length1,
                                     GError** error)
{
	DataHubServiceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = DATA_HUB_SERVICE_GET_INTERFACE (self);
	if (_iface_->get_data_providers) {
		return _iface_->get_data_providers (self, result_length1, error);
	}
	return NULL;
}

static void
data_hub_service_default_init (DataHubServiceIface * iface,
                               gpointer iface_data)
{
}

static GType
data_hub_service_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DataHubServiceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) data_hub_service_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType data_hub_service_type_id;
	data_hub_service_type_id = g_type_register_static (G_TYPE_INTERFACE, "DataHubService", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (data_hub_service_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (data_hub_service_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) data_hub_service_proxy_get_type);
	g_type_set_qdata (data_hub_service_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.zeitgeist.datahub");
	g_type_set_qdata (data_hub_service_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_data_hub_service_dbus_interface_info));
	g_type_set_qdata (data_hub_service_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) data_hub_service_register_object);
	return data_hub_service_type_id;
}

GType
data_hub_service_get_type (void)
{
	static volatile gsize data_hub_service_type_id__once = 0;
	if (g_once_init_enter (&data_hub_service_type_id__once)) {
		GType data_hub_service_type_id;
		data_hub_service_type_id = data_hub_service_get_type_once ();
		g_once_init_leave (&data_hub_service_type_id__once, data_hub_service_type_id);
	}
	return data_hub_service_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (DataHubServiceProxy, data_hub_service_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_DATA_HUB_SERVICE, data_hub_service_proxy_data_hub_service_interface_init) )
static void
data_hub_service_proxy_class_init (DataHubServiceProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = data_hub_service_proxy_g_signal;
}

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

static void
data_hub_service_proxy_init (DataHubServiceProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_data_hub_service_dbus_interface_info));
}

static gchar**
data_hub_service_proxy_get_data_providers (DataHubService* self,
                                           gint* result_length1,
                                           GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gchar** _result = NULL;
	gint _result_length1;
	GVariant* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length;
	gint _tmp1__size;
	gint _tmp1__length1;
	GVariantIter _tmp2_;
	GVariant* _tmp3_;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.zeitgeist.datahub", "GetDataProviders");
	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;
	_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++) {
		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 (_tmp3_, NULL);
		g_variant_unref (_tmp3_);
	}
	_result_length1 = _tmp1__length1;
	_tmp1_[_tmp1__length] = NULL;
	_result = _tmp1_;
	g_variant_unref (_tmp0_);
	*result_length1 = _result_length1;
	g_object_unref (_reply_message);
	return _result;
}

static void
data_hub_service_proxy_data_hub_service_interface_init (DataHubServiceIface* iface)
{
	iface->get_data_providers = data_hub_service_proxy_get_data_providers;
}

static void
_dbus_data_hub_service_get_data_providers (DataHubService* self,
                                           GVariant* _parameters_,
                                           GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	gint result_length1 = 0;
	gchar** _tmp4_;
	GVariantBuilder _tmp5_;
	gint _tmp6_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = data_hub_service_get_data_providers (self, &result_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (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);
	_tmp4_ = result;
	g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("as"));
	for (_tmp6_ = 0; _tmp6_ < result_length1; _tmp6_++) {
		g_variant_builder_add_value (&_tmp5_, g_variant_new_string (*_tmp4_));
		_tmp4_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
	result = (_vala_array_free (result, result_length1, (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
data_hub_service_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, "GetDataProviders") == 0) {
		_dbus_data_hub_service_get_data_providers (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
data_hub_service_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)
{
	return NULL;
}

static gboolean
data_hub_service_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)
{
	return FALSE;
}

guint
data_hub_service_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 *) (&_data_hub_service_dbus_interface_info), &_data_hub_service_dbus_interface_vtable, data, _data_hub_service_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_data_hub_service_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);
}

static inline gpointer
data_hub_get_instance_private (DataHub* self)
{
	return G_STRUCT_MEMBER_P (self, DataHub_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

DataHub*
data_hub_construct (GType object_type)
{
	DataHub * self = NULL;
	self = (DataHub*) g_object_new (object_type, NULL);
	return self;
}

DataHub*
data_hub_new (void)
{
	return data_hub_construct (TYPE_DATA_HUB);
}

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

static void
data_hub_data_source_registered (DataHub* self,
                                 ZeitgeistDataSource* ds)
{
	GList* iter = NULL;
	GList* _tmp0_;
	GList* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ds != NULL);
	_tmp0_ = self->priv->sources_info;
	iter = _tmp0_;
	while (TRUE) {
		GList* _tmp1_;
		GList* _tmp2_;
		gconstpointer _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		GList* _tmp8_;
		GList* _tmp9_;
		_tmp1_ = iter;
		if (!(_tmp1_ != NULL)) {
			break;
		}
		_tmp2_ = iter;
		_tmp3_ = _tmp2_->data;
		_tmp4_ = zeitgeist_data_source_get_unique_id ((ZeitgeistDataSource*) _tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = zeitgeist_data_source_get_unique_id (ds);
		_tmp7_ = _tmp6_;
		if (g_strcmp0 (_tmp5_, _tmp7_) == 0) {
			break;
		}
		_tmp8_ = iter;
		_tmp9_ = _tmp8_->next;
		iter = _tmp9_;
	}
	_tmp10_ = iter;
	if (_tmp10_ != NULL) {
		GList* _tmp11_;
		ZeitgeistDataSource* _tmp12_;
		_tmp11_ = iter;
		_tmp12_ = _g_object_ref0 (ds);
		_g_object_unref0 (_tmp11_->data);
		_tmp11_->data = _tmp12_;
	} else {
		ZeitgeistDataSource* _tmp13_;
		_tmp13_ = _g_object_ref0 (ds);
		self->priv->sources_info = g_list_prepend (self->priv->sources_info, _tmp13_);
	}
}

static void
data_hub_start_data_providers_data_free (gpointer _data)
{
	DataHubStartDataProvidersData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DataHubStartDataProvidersData, _data_);
}

static void
data_hub_start_data_providers (DataHub* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DataHubStartDataProvidersData* _data_;
	DataHub* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DataHubStartDataProvidersData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, data_hub_start_data_providers_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	data_hub_start_data_providers_co (_data_);
}

static void
data_hub_start_data_providers_finish (DataHub* self,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	DataHubStartDataProvidersData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_data_hub_data_source_registered_zeitgeist_data_source_registry_source_registered (ZeitgeistDataSourceRegistry* _sender,
                                                                                   ZeitgeistDataSource* data_source,
                                                                                   gpointer self)
{
	data_hub_data_source_registered ((DataHub*) self, data_source);
}

static void
data_hub_start_data_providers_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DataHubStartDataProvidersData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	data_hub_start_data_providers_co (_data_);
}

static gint
vala_g_ptr_array_get_length (GPtrArray* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) self->len;
	return result;
}

static void
_data_hub_items_available_data_provider_items_available (DataProvider* _sender,
                                                         GPtrArray* events,
                                                         gpointer self)
{
	data_hub_items_available ((DataHub*) self, _sender, events);
}

static gboolean
data_hub_start_data_providers_co (DataHubStartDataProvidersData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->registry;
		g_signal_connect_object (_data_->_tmp0_, "source-registered", (GCallback) _data_hub_data_source_registered_zeitgeist_data_source_registry_source_registered, _data_->self, 0);
		_data_->_tmp1_ = _data_->self->priv->registry;
		_data_->_state_ = 1;
		zeitgeist_data_source_registry_get_data_sources (_data_->_tmp1_, NULL, data_hub_start_data_providers_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = zeitgeist_data_source_registry_get_data_sources_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->sources = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp3_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp3_) {
						_data_->_tmp4_ = _data_->i;
						_data_->i = _data_->_tmp4_ + 1;
					}
					_data_->_tmp3_ = FALSE;
					_data_->_tmp5_ = _data_->sources;
					_data_->_tmp6_ = vala_g_ptr_array_get_length (_data_->_tmp5_);
					_data_->_tmp7_ = _data_->_tmp6_;
					if (!(_data_->i < ((guint) _data_->_tmp7_))) {
						break;
					}
					_data_->_tmp8_ = _data_->sources;
					_data_->_tmp9_ = g_ptr_array_index (_data_->_tmp8_, _data_->i);
					_data_->_tmp10_ = (ZeitgeistDataSource*) _data_->_tmp9_;
					_data_->_tmp11_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp10_, ZEITGEIST_TYPE_DATA_SOURCE) ? ((ZeitgeistDataSource*) _data_->_tmp10_) : NULL);
					_data_->self->priv->sources_info = g_list_prepend (_data_->self->priv->sources_info, _data_->_tmp11_);
				}
			}
		}
		_g_ptr_array_unref0 (_data_->sources);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp12_ = _data_->err;
		_data_->_tmp13_ = _data_->_tmp12_->message;
		g_warning ("zeitgeist-datahub.vala:103: %s", _data_->_tmp13_);
		_g_error_free0 (_data_->err);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp14_ = recent_manager_gtk_new (_data_->self);
	_data_->self->priv->providers = g_list_prepend (_data_->self->priv->providers, (DataProvider*) _data_->_tmp14_);
	_data_->_tmp16_ = recent_documents_kde_new (_data_->self, &_data_->_inner_error0_);
	_data_->_tmp15_ = _data_->_tmp16_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp17_ = _data_->_tmp15_;
	_data_->_tmp15_ = NULL;
	_data_->self->priv->providers = g_list_prepend (_data_->self->priv->providers, (DataProvider*) _data_->_tmp17_);
	_data_->_tmp19_ = telepathy_observer_new (_data_->self, &_data_->_inner_error0_);
	_data_->_tmp18_ = _data_->_tmp19_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->_tmp15_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp20_ = _data_->_tmp18_;
	_data_->_tmp18_ = NULL;
	_data_->self->priv->providers = g_list_prepend (_data_->self->priv->providers, (DataProvider*) _data_->_tmp20_);
	_data_->_tmp22_ = downloads_directory_monitor_new (_data_->self, &_data_->_inner_error0_);
	_data_->_tmp21_ = _data_->_tmp22_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->_tmp18_);
		_g_object_unref0 (_data_->_tmp15_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp23_ = _data_->_tmp21_;
	_data_->_tmp21_ = NULL;
	_data_->self->priv->providers = g_list_prepend (_data_->self->priv->providers, (DataProvider*) _data_->_tmp23_);
	_data_->_tmp24_ = desktop_launch_listener_new (_data_->self);
	_data_->self->priv->providers = g_list_prepend (_data_->self->priv->providers, (DataProvider*) _data_->_tmp24_);
	_data_->_tmp25_ = _data_->self->priv->providers;
	{
		_data_->prov_collection = _data_->_tmp25_;
		for (_data_->prov_it = _data_->prov_collection; _data_->prov_it != NULL; _data_->prov_it = _data_->prov_it->next) {
			_data_->prov = (DataProvider*) _data_->prov_it->data;
			{
				_data_->enabled = TRUE;
				_data_->timestamp = (gint64) 0;
				_data_->_tmp26_ = _data_->self->priv->sources_info;
				{
					_data_->src_collection = _data_->_tmp26_;
					for (_data_->src_it = _data_->src_collection; _data_->src_it != NULL; _data_->src_it = _data_->src_it->next) {
						_data_->_tmp27_ = _g_object_ref0 ((ZeitgeistDataSource*) _data_->src_it->data);
						_data_->src = _data_->_tmp27_;
						{
							_data_->_tmp28_ = _data_->src;
							_data_->_tmp29_ = zeitgeist_data_source_get_unique_id (_data_->_tmp28_);
							_data_->_tmp30_ = _data_->_tmp29_;
							_data_->_tmp31_ = _data_->prov;
							_data_->_tmp32_ = data_provider_get_unique_id (_data_->_tmp31_);
							_data_->_tmp33_ = _data_->_tmp32_;
							if (g_strcmp0 (_data_->_tmp30_, _data_->_tmp33_) == 0) {
								_data_->_tmp34_ = _data_->src;
								_data_->_tmp35_ = zeitgeist_data_source_get_timestamp (_data_->_tmp34_);
								_data_->_tmp36_ = _data_->_tmp35_;
								_data_->timestamp = _data_->_tmp36_;
								_g_object_unref0 (_data_->src);
								break;
							}
							_g_object_unref0 (_data_->src);
						}
					}
				}
				_data_->_tmp37_ = _data_->prov;
				_data_->_tmp38_ = data_provider_get_register (_data_->_tmp37_);
				_data_->_tmp39_ = _data_->_tmp38_;
				if (_data_->_tmp39_) {
					_data_->_tmp40_ = _data_->prov;
					_data_->_tmp41_ = data_provider_get_unique_id (_data_->_tmp40_);
					_data_->_tmp42_ = _data_->_tmp41_;
					_data_->_tmp43_ = _data_->prov;
					_data_->_tmp44_ = data_provider_get_name (_data_->_tmp43_);
					_data_->_tmp45_ = _data_->_tmp44_;
					_data_->_tmp46_ = _data_->prov;
					_data_->_tmp47_ = data_provider_get_description (_data_->_tmp46_);
					_data_->_tmp48_ = _data_->_tmp47_;
					_data_->_tmp49_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
					_data_->_tmp50_ = _data_->_tmp49_;
					_data_->_tmp51_ = zeitgeist_data_source_new_full (_data_->_tmp42_, _data_->_tmp45_, _data_->_tmp48_, _data_->_tmp50_);
					_data_->_tmp52_ = _data_->_tmp51_;
					_g_ptr_array_unref0 (_data_->_tmp50_);
					_data_->ds = _data_->_tmp52_;
					{
						_data_->_tmp54_ = _data_->self->priv->registry;
						_data_->_tmp55_ = _data_->ds;
						_data_->_state_ = 2;
						zeitgeist_data_source_registry_register_data_source (_data_->_tmp54_, _data_->_tmp55_, NULL, data_hub_start_data_providers_ready, _data_);
						return FALSE;
						_state_2:
						_data_->_tmp53_ = zeitgeist_data_source_registry_register_data_source_finish (_data_->_tmp54_, _data_->_res_, &_data_->_inner_error0_);
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							goto __catch1_g_error;
						}
						_data_->enabled = _data_->_tmp53_;
					}
					goto __finally1;
					__catch1_g_error:
					{
						_data_->reg_err = _data_->_inner_error0_;
						_data_->_inner_error0_ = NULL;
						_data_->_tmp56_ = _data_->reg_err;
						_data_->_tmp57_ = _data_->_tmp56_->message;
						g_warning ("zeitgeist-datahub.vala:151: %s", _data_->_tmp57_);
						_g_error_free0 (_data_->reg_err);
					}
					__finally1:
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
						_g_object_unref0 (_data_->ds);
						_g_object_unref0 (_data_->_tmp21_);
						_g_object_unref0 (_data_->_tmp18_);
						_g_object_unref0 (_data_->_tmp15_);
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_g_object_unref0 (_data_->ds);
				}
				_data_->_tmp58_ = _data_->prov;
				g_signal_connect_object (_data_->_tmp58_, "items-available", (GCallback) _data_hub_items_available_data_provider_items_available, _data_->self, 0);
				if (_data_->enabled) {
					_data_->_tmp59_ = _data_->prov;
					data_provider_set_last_timestamp (_data_->_tmp59_, _data_->timestamp);
					_data_->_tmp60_ = _data_->prov;
					data_provider_start (_data_->_tmp60_);
				}
			}
		}
	}
	_g_object_unref0 (_data_->_tmp21_);
	_g_object_unref0 (_data_->_tmp18_);
	_g_object_unref0 (_data_->_tmp15_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda10_ (DataHub* self,
             ZeitgeistEvent* e)
{
	GPtrArray* _tmp0_;
	ZeitgeistEvent* _tmp1_;
	g_return_if_fail (e != NULL);
	_tmp0_ = self->priv->queued_events;
	_tmp1_ = _g_object_ref0 (e);
	g_ptr_array_add (_tmp0_, _tmp1_);
}

static void
___lambda10__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda10_ ((DataHub*) self, (ZeitgeistEvent*) data);
}

static gboolean
___lambda11_ (DataHub* self)
{
	gboolean result;
	data_hub_insert_events (self);
	self->priv->idle_id = (guint) 0;
	result = FALSE;
	return result;
}

static gboolean
____lambda11__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda11_ ((DataHub*) self);
	return result;
}

static void
data_hub_items_available (DataHub* self,
                          DataProvider* prov,
                          GPtrArray* events)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_ = FALSE;
	GPtrArray* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (prov != NULL);
	g_return_if_fail (events != NULL);
	_tmp0_ = data_provider_get_enabled (prov);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	g_ptr_array_foreach (events, ___lambda10__gfunc, self);
	_tmp3_ = self->priv->queued_events;
	_tmp4_ = vala_g_ptr_array_get_length (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ > 0) {
		_tmp2_ = self->priv->idle_id == ((guint) 0);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		self->priv->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ____lambda11__gsource_func, g_object_ref (self), g_object_unref);
	}
}

static void
data_hub_insert_events (DataHub* self)
{
	GPtrArray* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GPtrArray* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->queued_events;
	_tmp1_ = vala_g_ptr_array_get_length (_tmp0_);
	_tmp2_ = _tmp1_;
	g_debug ("zeitgeist-datahub.vala:182: Inserting %u events", (guint) _tmp2_);
	data_hub_batch_insert_events (self, NULL, NULL);
	_tmp3_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_g_ptr_array_unref0 (self->priv->queued_events);
	self->priv->queued_events = _tmp3_;
}

static void
data_hub_batch_insert_events_data_free (gpointer _data)
{
	DataHubBatchInsertEventsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DataHubBatchInsertEventsData, _data_);
}

void
data_hub_batch_insert_events (DataHub* self,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	DataHubBatchInsertEventsData* _data_;
	DataHub* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DataHubBatchInsertEventsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, data_hub_batch_insert_events_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	data_hub_batch_insert_events_co (_data_);
}

void
data_hub_batch_insert_events_finish (DataHub* self,
                                     GAsyncResult* _res_)
{
	DataHubBatchInsertEventsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		DataHub* self;
		self = _data1_->self;
		_g_ptr_array_unref0 (_data1_->all_events);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
__lambda12_ (Block1Data* _data1_,
             ZeitgeistEvent* e)
{
	DataHub* self;
	GPtrArray* _tmp0_;
	ZeitgeistEvent* _tmp1_;
	self = _data1_->self;
	g_return_if_fail (e != NULL);
	_tmp0_ = _data1_->all_events;
	_tmp1_ = _g_object_ref0 (e);
	g_ptr_array_add (_tmp0_, _tmp1_);
}

static void
___lambda12__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda12_ (self, (ZeitgeistEvent*) data);
}

static void
data_hub_batch_insert_events_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	DataHubBatchInsertEventsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	data_hub_batch_insert_events_co (_data_);
}

static gboolean
data_hub_batch_insert_events_co (DataHubBatchInsertEventsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data1_ = g_slice_new0 (Block1Data);
	_data_->_data1_->_ref_count_ = 1;
	_data_->_data1_->self = g_object_ref (_data_->self);
	_data_->_data1_->_async_data_ = _data_;
	_data_->_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_data_->_data1_->all_events = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->queued_events;
	g_ptr_array_foreach (_data_->_tmp1_, ___lambda12__gfunc, _data_->_data1_);
	while (TRUE) {
		_data_->_tmp2_ = _data_->_data1_->all_events;
		_data_->_tmp3_ = vala_g_ptr_array_get_length (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		if (!(_data_->_tmp4_ > 0)) {
			break;
		}
		_data_->_tmp5_ = _data_->_data1_->all_events;
		_data_->_tmp6_ = vala_g_ptr_array_get_length (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->elements_pushed = MIN ((guint) _data_->_tmp7_, (guint) 100);
		_data_->_tmp8_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
		_data_->ptr_arr = _data_->_tmp8_;
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp9_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp9_) {
						_data_->_tmp10_ = _data_->i;
						_data_->i = _data_->_tmp10_ + 1;
					}
					_data_->_tmp9_ = FALSE;
					if (!(_data_->i < _data_->elements_pushed)) {
						break;
					}
					_data_->_tmp11_ = _data_->ptr_arr;
					_data_->_tmp12_ = _data_->_data1_->all_events;
					_data_->_tmp13_ = g_ptr_array_index (_data_->_tmp12_, _data_->i);
					_data_->_tmp14_ = _g_object_ref0 ((ZeitgeistEvent*) _data_->_tmp13_);
					g_ptr_array_add (_data_->_tmp11_, _data_->_tmp14_);
				}
			}
		}
		{
			_data_->_tmp15_ = _data_->self->priv->zg_log;
			_data_->_tmp16_ = _data_->ptr_arr;
			_data_->_state_ = 1;
			zeitgeist_log_insert_events (_data_->_tmp15_, _data_->_tmp16_, NULL, data_hub_batch_insert_events_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp17_ = zeitgeist_log_insert_events_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp18_ = _data_->_tmp17_;
			_g_array_unref0 (_data_->_tmp18_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->err = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp19_ = _data_->err;
			_data_->_tmp20_ = _data_->_tmp19_->message;
			g_warning ("zeitgeist-datahub.vala:207: Error during inserting events: %s", _data_->_tmp20_);
			_g_error_free0 (_data_->err);
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_ptr_array_unref0 (_data_->ptr_arr);
			block1_data_unref (_data_->_data1_);
			_data_->_data1_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp21_ = _data_->_data1_->all_events;
		g_ptr_array_remove_range (_data_->_tmp21_, (guint) 0, _data_->elements_pushed);
		_g_ptr_array_unref0 (_data_->ptr_arr);
	}
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda13_ (DataHub* self,
             GDBusConnection* conn)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (conn != NULL);
	data_hub_service_register_object (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_HUB_SERVICE, DataHubService), conn, DATA_HUB_OBJECT_PATH, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda13__gbus_acquired_callback (GDBusConnection* connection,
                                     const gchar* name,
                                     gpointer self)
{
	__lambda13_ ((DataHub*) self, connection);
}

static void
__lambda14_ (DataHub* self)
{
	data_hub_start_data_providers (self, NULL, NULL);
}

static void
___lambda14__gbus_name_acquired_callback (GDBusConnection* connection,
                                          const gchar* name,
                                          gpointer self)
{
	__lambda14_ ((DataHub*) self);
}

static void
__lambda15_ (DataHub* self)
{
	g_warning ("zeitgeist-datahub.vala:224: %s", "Unable to get name \"org.gnome.zeitgeist.datahub\"" " on the bus!");
	data_hub_set_return_code (self, 1);
	data_hub_quit (self);
}

static void
___lambda15__gbus_name_lost_callback (GDBusConnection* connection,
                                      const gchar* name,
                                      gpointer self)
{
	__lambda15_ ((DataHub*) self);
}

void
data_hub_run (DataHub* self,
              GError** error)
{
	GMainLoop* _tmp0_;
	g_return_if_fail (self != NULL);
	g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, DATA_HUB_UNIQUE_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((___lambda13__gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda13__gbus_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((___lambda14__gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda14__gbus_name_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((___lambda15__gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda15__gbus_name_lost_callback, g_object_ref (self), (GClosureNotify) g_object_unref)));
	_tmp0_ = self->priv->main_loop;
	g_main_loop_run (_tmp0_);
}

void
data_hub_quit (DataHub* self)
{
	GMainLoop* _tmp0_;
	g_return_if_fail (self != NULL);
	(self->priv->providers == NULL) ? NULL : (self->priv->providers = (_g_list_free__g_object_unref0_ (self->priv->providers), NULL));
	self->priv->providers = NULL;
	_tmp0_ = self->priv->main_loop;
	g_main_loop_quit (_tmp0_);
}

static gpointer
_g_ptr_array_ref0 (gpointer self)
{
	return self ? g_ptr_array_ref (self) : NULL;
}

static void
_vala_array_add3 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

gchar**
data_hub_get_data_source_actors (DataHub* self,
                                 gboolean only_enabled,
                                 gint* result_length1)
{
	gchar** actors = NULL;
	gchar** _tmp0_;
	gint actors_length1;
	gint _actors_size_;
	GList* _tmp1_;
	gchar** _tmp29_;
	gint _tmp29__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	actors = _tmp0_;
	actors_length1 = 0;
	_actors_size_ = actors_length1;
	_tmp1_ = self->priv->sources_info;
	{
		GList* src_collection = NULL;
		GList* src_it = NULL;
		src_collection = _tmp1_;
		for (src_it = src_collection; src_it != NULL; src_it = src_it->next) {
			ZeitgeistDataSource* src = NULL;
			src = (ZeitgeistDataSource*) src_it->data;
			{
				gboolean _tmp2_ = FALSE;
				GPtrArray* template_arr = NULL;
				ZeitgeistDataSource* _tmp6_;
				GPtrArray* _tmp7_;
				GPtrArray* _tmp8_;
				GPtrArray* _tmp9_;
				GPtrArray* _tmp10_;
				if (only_enabled) {
					ZeitgeistDataSource* _tmp3_;
					gboolean _tmp4_;
					gboolean _tmp5_;
					_tmp3_ = src;
					_tmp4_ = zeitgeist_data_source_get_enabled (_tmp3_);
					_tmp5_ = _tmp4_;
					_tmp2_ = !_tmp5_;
				} else {
					_tmp2_ = FALSE;
				}
				if (_tmp2_) {
					continue;
				}
				_tmp6_ = src;
				_tmp7_ = zeitgeist_data_source_get_event_templates (_tmp6_);
				_tmp8_ = _tmp7_;
				_tmp9_ = _g_ptr_array_ref0 (_tmp8_);
				template_arr = _tmp9_;
				_tmp10_ = template_arr;
				if (_tmp10_ != NULL) {
					{
						guint i = 0U;
						i = (guint) 0;
						{
							gboolean _tmp11_ = FALSE;
							_tmp11_ = TRUE;
							while (TRUE) {
								GPtrArray* _tmp13_;
								gint _tmp14_;
								gint _tmp15_;
								ZeitgeistEvent* event_template = NULL;
								GPtrArray* _tmp16_;
								gconstpointer _tmp17_;
								ZeitgeistEvent* _tmp18_;
								ZeitgeistEvent* _tmp19_;
								gchar* actor = NULL;
								ZeitgeistEvent* _tmp20_;
								const gchar* _tmp21_;
								const gchar* _tmp22_;
								gchar* _tmp23_;
								gboolean _tmp24_ = FALSE;
								const gchar* _tmp25_;
								if (!_tmp11_) {
									guint _tmp12_;
									_tmp12_ = i;
									i = _tmp12_ + 1;
								}
								_tmp11_ = FALSE;
								_tmp13_ = template_arr;
								_tmp14_ = vala_g_ptr_array_get_length (_tmp13_);
								_tmp15_ = _tmp14_;
								if (!(i < ((guint) _tmp15_))) {
									break;
								}
								_tmp16_ = template_arr;
								_tmp17_ = g_ptr_array_index (_tmp16_, i);
								_tmp18_ = (ZeitgeistEvent*) _tmp17_;
								_tmp19_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp18_, ZEITGEIST_TYPE_EVENT) ? ((ZeitgeistEvent*) _tmp18_) : NULL);
								event_template = _tmp19_;
								_tmp20_ = event_template;
								_tmp21_ = zeitgeist_event_get_actor (_tmp20_);
								_tmp22_ = _tmp21_;
								_tmp23_ = g_strdup (_tmp22_);
								actor = _tmp23_;
								_tmp25_ = actor;
								if (_tmp25_ != NULL) {
									const gchar* _tmp26_;
									_tmp26_ = actor;
									_tmp24_ = g_strcmp0 (_tmp26_, "") != 0;
								} else {
									_tmp24_ = FALSE;
								}
								if (_tmp24_) {
									const gchar* _tmp27_;
									gchar* _tmp28_;
									_tmp27_ = actor;
									_tmp28_ = g_strdup (_tmp27_);
									_vala_array_add3 (&actors, &actors_length1, &_actors_size_, _tmp28_);
								}
								_g_free0 (actor);
								_g_object_unref0 (event_template);
							}
						}
					}
				}
				_g_ptr_array_unref0 (template_arr);
			}
		}
	}
	_tmp29_ = actors;
	_tmp29__length1 = actors_length1;
	if (result_length1) {
		*result_length1 = _tmp29__length1;
	}
	result = _tmp29_;
	return result;
}

static void
_vala_array_add4 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar**
data_hub_real_get_data_providers (DataHubService* base,
                                  gint* result_length1,
                                  GError** error)
{
	DataHub * self;
	gchar** arr = NULL;
	gchar** _tmp0_;
	gint arr_length1;
	gint _arr_size_;
	GList* _tmp1_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** result;
	self = (DataHub*) base;
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	arr = _tmp0_;
	arr_length1 = 0;
	_arr_size_ = arr_length1;
	_tmp1_ = self->priv->providers;
	{
		GList* provider_collection = NULL;
		GList* provider_it = NULL;
		provider_collection = _tmp1_;
		for (provider_it = provider_collection; provider_it != NULL; provider_it = provider_it->next) {
			DataProvider* _tmp2_;
			DataProvider* provider = NULL;
			_tmp2_ = _g_object_ref0 ((DataProvider*) provider_it->data);
			provider = _tmp2_;
			{
				DataProvider* _tmp3_;
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				gchar* _tmp6_;
				_tmp3_ = provider;
				_tmp4_ = data_provider_get_unique_id (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = g_strdup (_tmp5_);
				_vala_array_add4 (&arr, &arr_length1, &_arr_size_, _tmp6_);
				_g_object_unref0 (provider);
			}
		}
	}
	_tmp7_ = arr;
	_tmp7__length1 = arr_length1;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	return result;
}

static gint
data_hub_main (gchar** args,
               gint args_length1)
{
	DataHub* hub = NULL;
	DataHub* _tmp0_;
	gint _tmp7_;
	GError* _inner_error0_ = NULL;
	gint result;
	g_set_prgname ("zeitgeist-datahub");
	_tmp0_ = data_hub_new ();
	hub = _tmp0_;
	{
		data_hub_run (hub, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		FILE* _tmp1_;
		GError* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = stdout;
		_tmp2_ = err;
		_tmp3_ = _tmp2_->message;
		_tmp4_ = g_strdup_printf ("Error running Zeitgeist Datahub %s", _tmp3_);
		_tmp5_ = _tmp4_;
		fprintf (_tmp1_, "%s", _tmp5_);
		_g_free0 (_tmp5_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gint _tmp6_ = -1;
		_g_object_unref0 (hub);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp6_;
	}
	_tmp7_ = hub->priv->_return_code;
	result = _tmp7_;
	_g_object_unref0 (hub);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return data_hub_main (argv, argc);
}

gint
data_hub_get_return_code (DataHub* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_return_code;
	return result;
}

static void
data_hub_set_return_code (DataHub* self,
                          gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = data_hub_get_return_code (self);
	if (old_value != value) {
		self->priv->_return_code = value;
		g_object_notify_by_pspec ((GObject *) self, data_hub_properties[DATA_HUB_RETURN_CODE_PROPERTY]);
	}
}

static void
_data_hub___lambda16_ (DataHub* self)
{
	ZeitgeistLog* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->zg_log;
	_tmp1_ = zeitgeist_queued_proxy_wrapper_get_is_connected ((ZeitgeistQueuedProxyWrapper*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		g_debug ("zeitgeist-datahub.vala:60: Zeitgeist-daemon disappeared from the bus, " \
"exitting...");
		data_hub_quit (self);
	}
}

static void
__data_hub___lambda16__g_object_notify (GObject* _sender,
                                        GParamSpec* pspec,
                                        gpointer self)
{
	_data_hub___lambda16_ ((DataHub*) self);
}

static GObject *
data_hub_constructor (GType type,
                      guint n_construct_properties,
                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DataHub * self;
	GPtrArray* _tmp0_;
	GMainLoop* _tmp1_;
	ZeitgeistLog* _tmp2_;
	ZeitgeistLog* _tmp3_;
	ZeitgeistDataSourceRegistry* _tmp4_;
	parent_class = G_OBJECT_CLASS (data_hub_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DATA_HUB, DataHub);
	(self->priv->providers == NULL) ? NULL : (self->priv->providers = (_g_list_free__g_object_unref0_ (self->priv->providers), NULL));
	self->priv->providers = NULL;
	(self->priv->sources_info == NULL) ? NULL : (self->priv->sources_info = (_g_list_free__g_object_unref0_ (self->priv->sources_info), NULL));
	self->priv->sources_info = NULL;
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_g_ptr_array_unref0 (self->priv->queued_events);
	self->priv->queued_events = _tmp0_;
	_tmp1_ = g_main_loop_new (NULL, FALSE);
	_g_main_loop_unref0 (self->priv->main_loop);
	self->priv->main_loop = _tmp1_;
	_tmp2_ = zeitgeist_log_new ();
	_g_object_unref0 (self->priv->zg_log);
	self->priv->zg_log = _tmp2_;
	_tmp3_ = self->priv->zg_log;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::connected", (GCallback) __data_hub___lambda16__g_object_notify, self, 0);
	_tmp4_ = zeitgeist_data_source_registry_new ();
	_g_object_unref0 (self->priv->registry);
	self->priv->registry = _tmp4_;
	return obj;
}

static void
data_hub_class_init (DataHubClass * klass,
                     gpointer klass_data)
{
	data_hub_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DataHub_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_data_hub_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_data_hub_set_property;
	G_OBJECT_CLASS (klass)->constructor = data_hub_constructor;
	G_OBJECT_CLASS (klass)->finalize = data_hub_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_HUB_RETURN_CODE_PROPERTY, data_hub_properties[DATA_HUB_RETURN_CODE_PROPERTY] = g_param_spec_int ("return-code", "return-code", "return-code", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
data_hub_data_hub_service_interface_init (DataHubServiceIface * iface,
                                          gpointer iface_data)
{
	data_hub_data_hub_service_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_data_providers = (gchar** (*) (DataHubService*, gint*, GError**)) data_hub_real_get_data_providers;
}

static void
data_hub_instance_init (DataHub * self,
                        gpointer klass)
{
	self->priv = data_hub_get_instance_private (self);
	self->priv->idle_id = (guint) 0;
	self->priv->_return_code = 0;
}

static void
data_hub_finalize (GObject * obj)
{
	DataHub * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DATA_HUB, DataHub);
	_g_object_unref0 (self->priv->zg_log);
	_g_object_unref0 (self->priv->registry);
	_g_main_loop_unref0 (self->priv->main_loop);
	(self->priv->providers == NULL) ? NULL : (self->priv->providers = (_g_list_free__g_object_unref0_ (self->priv->providers), NULL));
	(self->priv->sources_info == NULL) ? NULL : (self->priv->sources_info = (_g_list_free__g_object_unref0_ (self->priv->sources_info), NULL));
	_g_ptr_array_unref0 (self->priv->queued_events);
	G_OBJECT_CLASS (data_hub_parent_class)->finalize (obj);
}

static GType
data_hub_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DataHubClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) data_hub_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DataHub), 0, (GInstanceInitFunc) data_hub_instance_init, NULL };
	static const GInterfaceInfo data_hub_service_info = { (GInterfaceInitFunc) data_hub_data_hub_service_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType data_hub_type_id;
	data_hub_type_id = g_type_register_static (G_TYPE_OBJECT, "DataHub", &g_define_type_info, 0);
	g_type_add_interface_static (data_hub_type_id, TYPE_DATA_HUB_SERVICE, &data_hub_service_info);
	DataHub_private_offset = g_type_add_instance_private (data_hub_type_id, sizeof (DataHubPrivate));
	return data_hub_type_id;
}

GType
data_hub_get_type (void)
{
	static volatile gsize data_hub_type_id__once = 0;
	if (g_once_init_enter (&data_hub_type_id__once)) {
		GType data_hub_type_id;
		data_hub_type_id = data_hub_get_type_once ();
		g_once_init_leave (&data_hub_type_id__once, data_hub_type_id);
	}
	return data_hub_type_id__once;
}

static void
_vala_data_hub_get_property (GObject * object,
                             guint property_id,
                             GValue * value,
                             GParamSpec * pspec)
{
	DataHub * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_DATA_HUB, DataHub);
	switch (property_id) {
		case DATA_HUB_RETURN_CODE_PROPERTY:
		g_value_set_int (value, data_hub_get_return_code (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_data_hub_set_property (GObject * object,
                             guint property_id,
                             const GValue * value,
                             GParamSpec * pspec)
{
	DataHub * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_DATA_HUB, DataHub);
	switch (property_id) {
		case DATA_HUB_RETURN_CODE_PROPERTY:
		data_hub_set_return_code (self, g_value_get_int (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);
}

