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

/* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */
/* alm
 *
 * Copyright (C) 2012 Manish Sinha <manishsinha@ubuntu.com>
 * Copyright (C) 2011 Collabora Ltd.
 *             Authored by Siegfried-Angel Gevatter Pujals <siegfried@gevatter.com>
 *             Authored by Seif Lotfy <seif@lotfy.com>
 *
 * alm 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 2 of the License, or
 * (at your option) any later version.
 * 
 * alm 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/>.";
 */

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <zeitgeist-datamodel.h>
#include <zeitgeist.h>
#include <gtk/gtk.h>
#include <gobject/gvaluecollector.h>

#define ALM_UTILITIES_SIG_EVENT "asaasay"
#define ALM_UTILITIES_SIG_BLACKLIST "a{s(" ALM_UTILITIES_SIG_EVENT ")}"
#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 ALM_TYPE_BLACKLIST_INTERFACE (alm_blacklist_interface_get_type ())
#define ALM_BLACKLIST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_BLACKLIST_INTERFACE, AlmBlacklistInterface))
#define ALM_IS_BLACKLIST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_BLACKLIST_INTERFACE))
#define ALM_BLACKLIST_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ALM_TYPE_BLACKLIST_INTERFACE, AlmBlacklistInterfaceIface))

typedef struct _AlmBlacklistInterface AlmBlacklistInterface;
typedef struct _AlmBlacklistInterfaceIface AlmBlacklistInterfaceIface;

#define ALM_TYPE_BLACKLIST_INTERFACE_PROXY (alm_blacklist_interface_proxy_get_type ())
enum  {
	ALM_BLACKLIST_INTERFACE_TEMPLATE_ADDED_SIGNAL,
	ALM_BLACKLIST_INTERFACE_TEMPLATE_REMOVED_SIGNAL,
	ALM_BLACKLIST_INTERFACE_NUM_SIGNALS
};
static guint alm_blacklist_interface_signals[ALM_BLACKLIST_INTERFACE_NUM_SIGNALS] = {0};
typedef GDBusProxy AlmBlacklistInterfaceProxy;
typedef GDBusProxyClass AlmBlacklistInterfaceProxyClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef void (*AlmProcessFetchedEventsHandler) (GList* evs, gpointer user_data);

#define ALM_TYPE_BLACKLIST (alm_blacklist_get_type ())
#define ALM_BLACKLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_BLACKLIST, AlmBlacklist))
#define ALM_BLACKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_BLACKLIST, AlmBlacklistClass))
#define ALM_IS_BLACKLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_BLACKLIST))
#define ALM_IS_BLACKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_BLACKLIST))
#define ALM_BLACKLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_BLACKLIST, AlmBlacklistClass))

typedef struct _AlmBlacklist AlmBlacklist;
typedef struct _AlmBlacklistClass AlmBlacklistClass;
typedef struct _AlmBlacklistPrivate AlmBlacklistPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _alm_blacklist_unref0(var) ((var == NULL) ? NULL : (var = (alm_blacklist_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
typedef struct _AlmBlacklistFindEventsData AlmBlacklistFindEventsData;

#define ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG (alm_applications_chooser_dialog_get_type ())
#define ALM_APPLICATIONS_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialog))
#define ALM_APPLICATIONS_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialogClass))
#define ALM_IS_APPLICATIONS_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG))
#define ALM_IS_APPLICATIONS_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG))
#define ALM_APPLICATIONS_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_APPLICATIONS_CHOOSER_DIALOG, AlmApplicationsChooserDialogClass))

typedef struct _AlmApplicationsChooserDialog AlmApplicationsChooserDialog;
typedef struct _AlmApplicationsChooserDialogClass AlmApplicationsChooserDialogClass;
typedef struct _AlmBlacklistFindAllAppsData AlmBlacklistFindAllAppsData;
typedef struct _AlmParamSpecBlacklist AlmParamSpecBlacklist;
enum  {
	ALM_BLACKLIST_TEMPLATE_ADDED_SIGNAL,
	ALM_BLACKLIST_TEMPLATE_REMOVED_SIGNAL,
	ALM_BLACKLIST_INCOGNITO_TOGGLED_SIGNAL,
	ALM_BLACKLIST_NUM_SIGNALS
};
static guint alm_blacklist_signals[ALM_BLACKLIST_NUM_SIGNALS] = {0};

#define ALM_TYPE_UTILITIES (alm_utilities_get_type ())
#define ALM_UTILITIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_UTILITIES, AlmUtilities))
#define ALM_UTILITIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_UTILITIES, AlmUtilitiesClass))
#define ALM_IS_UTILITIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_UTILITIES))
#define ALM_IS_UTILITIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_UTILITIES))
#define ALM_UTILITIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_UTILITIES, AlmUtilitiesClass))

typedef struct _AlmUtilities AlmUtilities;
typedef struct _AlmUtilitiesClass AlmUtilitiesClass;
typedef struct _AlmUtilitiesPrivate AlmUtilitiesPrivate;
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
typedef struct _AlmParamSpecUtilities AlmParamSpecUtilities;

struct _AlmBlacklistInterfaceIface {
	GTypeInterface parent_iface;
	void (*add_template) (AlmBlacklistInterface* self, const gchar* blacklist_id, GVariant* blacklist_template, GError** error);
	GVariant* (*get_templates) (AlmBlacklistInterface* self, GError** error);
	void (*remove_template) (AlmBlacklistInterface* self, const gchar* blacklist_id, GError** error);
};

struct _AlmBlacklist {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AlmBlacklistPrivate * priv;
};

struct _AlmBlacklistClass {
	GTypeClass parent_class;
	void (*finalize) (AlmBlacklist *self);
};

struct _AlmBlacklistPrivate {
	AlmBlacklistInterface* blacklist;
	GHashTable* blacklists;
	ZeitgeistLog* log;
	gchar* incognito_id;
	ZeitgeistEvent* incognito_event;
};

struct _AlmBlacklistFindEventsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	AlmBlacklist* self;
	gchar* id;
	GtkTreeIter iter;
	GtkListStore* store;
	ZeitgeistEvent* event;
	ZeitgeistEvent* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GPtrArray* events;
	GPtrArray* _tmp3_;
	ZeitgeistEvent* _tmp4_;
	ZeitgeistEvent* event2;
	ZeitgeistEvent* _tmp5_;
	ZeitgeistSubject* subj;
	ZeitgeistSubject* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ZeitgeistEvent* _tmp9_;
	guint32* results;
	ZeitgeistLog* _tmp10_;
	ZeitgeistTimeRange* _tmp11_;
	ZeitgeistTimeRange* _tmp12_;
	gint _tmp13_;
	guint32* _tmp14_;
	guint32* _tmp15_;
	gint _tmp15__length1;
	gint results_length1;
	gint _results_size_;
	gint counter;
	GtkTreeIter _tmp16_;
	GValue _tmp17_;
	GError* _inner_error0_;
};

struct _AlmBlacklistFindAllAppsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	AlmBlacklist* self;
	AlmApplicationsChooserDialog* dialog;
	ZeitgeistEvent* event;
	ZeitgeistEvent* _tmp0_;
	GPtrArray* events;
	GPtrArray* _tmp1_;
	GPtrArray* _tmp2_;
	ZeitgeistEvent* _tmp3_;
	ZeitgeistEvent* event2;
	ZeitgeistEvent* _tmp4_;
	ZeitgeistSubject* subj;
	ZeitgeistSubject* _tmp5_;
	GPtrArray* _tmp6_;
	ZeitgeistEvent* _tmp7_;
	GPtrArray* _tmp8_;
	ZeitgeistResultSet* results;
	ZeitgeistLog* _tmp9_;
	ZeitgeistTimeRange* _tmp10_;
	ZeitgeistTimeRange* _tmp11_;
	GPtrArray* _tmp12_;
	ZeitgeistResultSet* _tmp13_;
	ZeitgeistResultSet* _tmp14_;
	GHashTable* all_actors;
	GHashFunc _tmp15_;
	GEqualFunc _tmp16_;
	GHashTable* _tmp17_;
	gint i;
	gboolean _tmp18_;
	gint _tmp19_;
	ZeitgeistEvent* ev;
	ZeitgeistEvent* _tmp20_;
	ZeitgeistEvent* _tmp21_;
	gchar* actor;
	ZeitgeistEvent* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gboolean _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GHashTable* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	ZeitgeistEvent* _tmp32_;
	gint64 _tmp33_;
	gint64 _tmp34_;
	gint64* _tmp35_;
	GHashTable* _tmp36_;
	GError* _inner_error0_;
};

struct _AlmParamSpecBlacklist {
	GParamSpec parent_instance;
};

struct _AlmUtilities {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AlmUtilitiesPrivate * priv;
};

struct _AlmUtilitiesClass {
	GTypeClass parent_class;
	void (*finalize) (AlmUtilities *self);
};

struct _AlmParamSpecUtilities {
	GParamSpec parent_instance;
};

static gint AlmBlacklist_private_offset;
static gpointer alm_blacklist_parent_class = NULL;
static gpointer alm_utilities_parent_class = NULL;

VALA_EXTERN GType alm_blacklist_interface_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint alm_blacklist_interface_register_object (void* object,
                                               GDBusConnection* connection,
                                               const gchar* path,
                                               GError** error);
VALA_EXTERN GType alm_blacklist_interface_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AlmBlacklistInterface, g_object_unref)
VALA_EXTERN void alm_blacklist_interface_add_template (AlmBlacklistInterface* self,
                                           const gchar* blacklist_id,
                                           GVariant* blacklist_template,
                                           GError** error);
VALA_EXTERN GVariant* alm_blacklist_interface_get_templates (AlmBlacklistInterface* self,
                                                 GError** error);
VALA_EXTERN void alm_blacklist_interface_remove_template (AlmBlacklistInterface* self,
                                              const gchar* blacklist_id,
                                              GError** error);
static void g_cclosure_user_marshal_VOID__STRING_VARIANT (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static GType alm_blacklist_interface_get_type_once (void);
static void alm_blacklist_interface_proxy_g_signal (GDBusProxy* proxy,
                                             const gchar* sender_name,
                                             const gchar* signal_name,
                                             GVariant* parameters);
static void _dbus_handle_alm_blacklist_interface_template_added (AlmBlacklistInterface* self,
                                                          GVariant* parameters);
static void _dbus_handle_alm_blacklist_interface_template_removed (AlmBlacklistInterface* self,
                                                            GVariant* parameters);
static void alm_blacklist_interface_proxy_add_template (AlmBlacklistInterface* self,
                                                 const gchar* blacklist_id,
                                                 GVariant* blacklist_template,
                                                 GError** error);
static GVariant* alm_blacklist_interface_proxy_get_templates (AlmBlacklistInterface* self,
                                                       GError** error);
static void alm_blacklist_interface_proxy_remove_template (AlmBlacklistInterface* self,
                                                    const gchar* blacklist_id,
                                                    GError** error);
static void alm_blacklist_interface_proxy_alm_blacklist_interface_interface_init (AlmBlacklistInterfaceIface* iface);
static void _dbus_alm_blacklist_interface_add_template (AlmBlacklistInterface* self,
                                                 GVariant* _parameters_,
                                                 GDBusMethodInvocation* invocation);
static void _dbus_alm_blacklist_interface_get_templates (AlmBlacklistInterface* self,
                                                  GVariant* _parameters_,
                                                  GDBusMethodInvocation* invocation);
static void _dbus_alm_blacklist_interface_remove_template (AlmBlacklistInterface* self,
                                                    GVariant* _parameters_,
                                                    GDBusMethodInvocation* invocation);
static void alm_blacklist_interface_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* alm_blacklist_interface_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 alm_blacklist_interface_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 _dbus_alm_blacklist_interface_template_added (GObject* _sender,
                                                   const gchar* blacklist_id,
                                                   GVariant* blacklist_template,
                                                   gpointer* _data);
static void _dbus_alm_blacklist_interface_template_removed (GObject* _sender,
                                                     const gchar* blacklist_id,
                                                     GVariant* blacklist_template,
                                                     gpointer* _data);
static void _alm_blacklist_interface_unregister_object (gpointer user_data);
VALA_EXTERN gpointer alm_blacklist_ref (gpointer instance);
VALA_EXTERN void alm_blacklist_unref (gpointer instance);
VALA_EXTERN GParamSpec* alm_param_spec_blacklist (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags);
VALA_EXTERN void alm_value_set_blacklist (GValue* value,
                              gpointer v_object);
VALA_EXTERN void alm_value_take_blacklist (GValue* value,
                               gpointer v_object);
VALA_EXTERN gpointer alm_value_get_blacklist (const GValue* value);
VALA_EXTERN GType alm_blacklist_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AlmBlacklist, alm_blacklist_unref)
VALA_EXTERN AlmBlacklist* alm_blacklist_new (void);
VALA_EXTERN AlmBlacklist* alm_blacklist_construct (GType object_type);
static void alm_blacklist_on_template_added (AlmBlacklist* self,
                                      const gchar* blacklist_id,
                                      GVariant* blacklist_template);
static void _alm_blacklist_on_template_added_alm_blacklist_interface_template_added (AlmBlacklistInterface* _sender,
                                                                              const gchar* blacklist_id,
                                                                              GVariant* blacklist_template,
                                                                              gpointer self);
static void alm_blacklist_on_template_removed (AlmBlacklist* self,
                                        const gchar* blacklist_id,
                                        GVariant* blacklist_template);
static void _alm_blacklist_on_template_removed_alm_blacklist_interface_template_removed (AlmBlacklistInterface* _sender,
                                                                                  const gchar* blacklist_id,
                                                                                  GVariant* blacklist_template,
                                                                                  gpointer self);
VALA_EXTERN void alm_blacklist_add_template (AlmBlacklist* self,
                                 const gchar* blacklist_id,
                                 ZeitgeistEvent* blacklist_template);
VALA_EXTERN void alm_blacklist_remove_template (AlmBlacklist* self,
                                    const gchar* blacklist_id);
VALA_EXTERN void alm_blacklist_set_incognito (AlmBlacklist* self,
                                  gboolean status);
VALA_EXTERN GHashTable* alm_blacklist_get_templates (AlmBlacklist* self);
VALA_EXTERN GHashTable* alm_utilities_from_variant (GVariant* templates_variant);
VALA_EXTERN gboolean alm_blacklist_get_incognito (AlmBlacklist* self);
VALA_EXTERN GHashTable* alm_blacklist_get_all_templates (AlmBlacklist* self);
VALA_EXTERN gboolean alm_utilities_matches_event_template (ZeitgeistEvent* event,
                                               ZeitgeistEvent* template_event);
static void alm_blacklist_find_events_data_free (gpointer _data);
VALA_EXTERN void alm_blacklist_find_events (AlmBlacklist* self,
                                const gchar* id,
                                GtkTreeIter* iter,
                                GtkListStore* store,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void alm_blacklist_find_events_finish (AlmBlacklist* self,
                                       GAsyncResult* _res_);
static gboolean alm_blacklist_find_events_co (AlmBlacklistFindEventsData* _data_);
static void _g_object_unref0_ (gpointer var);
static void alm_blacklist_find_events_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
VALA_EXTERN void alm_blacklist_get_count_for_app (AlmBlacklist* self,
                                      const gchar* app_id,
                                      GtkTreeIter* iter,
                                      GtkListStore* store);
static void alm_blacklist_find_all_apps_data_free (gpointer _data);
VALA_EXTERN GType alm_applications_chooser_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AlmApplicationsChooserDialog, g_object_unref)
VALA_EXTERN void alm_blacklist_find_all_apps (AlmBlacklist* self,
                                  AlmApplicationsChooserDialog* dialog,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN void alm_blacklist_find_all_apps_finish (AlmBlacklist* self,
                                         GAsyncResult* _res_);
static gboolean alm_blacklist_find_all_apps_co (AlmBlacklistFindAllAppsData* _data_);
static void alm_blacklist_find_all_apps_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_);
static void _g_free0_ (gpointer var);
static gint64* _int64_dup (gint64* self);
VALA_EXTERN void alm_applications_chooser_dialog_handle_app_population (AlmApplicationsChooserDialog* self,
                                                            GHashTable* all_actors);
VALA_EXTERN void alm_blacklist_get_all_applications (AlmBlacklist* self,
                                         AlmApplicationsChooserDialog* dialog);
static void g_cclosure_user_marshal_VOID__STRING_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void alm_blacklist_finalize (AlmBlacklist * obj);
static GType alm_blacklist_get_type_once (void);
VALA_EXTERN gpointer alm_utilities_ref (gpointer instance);
VALA_EXTERN void alm_utilities_unref (gpointer instance);
VALA_EXTERN GParamSpec* alm_param_spec_utilities (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags);
VALA_EXTERN void alm_value_set_utilities (GValue* value,
                              gpointer v_object);
VALA_EXTERN void alm_value_take_utilities (GValue* value,
                               gpointer v_object);
VALA_EXTERN gpointer alm_value_get_utilities (const GValue* value);
VALA_EXTERN GType alm_utilities_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AlmUtilities, alm_utilities_unref)
static gboolean alm_utilities_check_field_match (const gchar* property,
                                          const gchar* template_property,
                                          const gchar* property_name);
VALA_EXTERN gboolean alm_utilities_matches_subject_template (ZeitgeistSubject* subject,
                                                 ZeitgeistSubject* template_subject);
VALA_EXTERN gboolean alm_utilities_parse_negation (gchar** val);
VALA_EXTERN GVariant* alm_utilities_to_variant (GHashTable* blacklist);
VALA_EXTERN AlmUtilities* alm_utilities_new (void);
VALA_EXTERN AlmUtilities* alm_utilities_construct (GType object_type);
static void alm_utilities_finalize (AlmUtilities * obj);
static GType alm_utilities_get_type_once (void);

static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_add_template_blacklist_id = {-1, "blacklist_id", "s", NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_add_template_blacklist_template = {-1, "blacklist_template", "(asaasay)", NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_add_template_in[] = {&_alm_blacklist_interface_dbus_arg_info_add_template_blacklist_id, &_alm_blacklist_interface_dbus_arg_info_add_template_blacklist_template, NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_add_template_out[] = {NULL};
static const GDBusMethodInfo _alm_blacklist_interface_dbus_method_info_add_template = {-1, "AddTemplate", (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_add_template_in), (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_add_template_out), NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_get_templates_result = {-1, "result", "a{s(asaasay)}", NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_get_templates_in[] = {NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_get_templates_out[] = {&_alm_blacklist_interface_dbus_arg_info_get_templates_result, NULL};
static const GDBusMethodInfo _alm_blacklist_interface_dbus_method_info_get_templates = {-1, "GetTemplates", (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_get_templates_in), (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_get_templates_out), NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_remove_template_blacklist_id = {-1, "blacklist_id", "s", NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_remove_template_in[] = {&_alm_blacklist_interface_dbus_arg_info_remove_template_blacklist_id, NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_remove_template_out[] = {NULL};
static const GDBusMethodInfo _alm_blacklist_interface_dbus_method_info_remove_template = {-1, "RemoveTemplate", (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_remove_template_in), (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_remove_template_out), NULL};
static const GDBusMethodInfo * const _alm_blacklist_interface_dbus_method_info[] = {&_alm_blacklist_interface_dbus_method_info_add_template, &_alm_blacklist_interface_dbus_method_info_get_templates, &_alm_blacklist_interface_dbus_method_info_remove_template, NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_template_added_blacklist_id = {-1, "blacklist_id", "s", NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_template_added_blacklist_template = {-1, "blacklist_template", "s(asaasay)", NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_template_added[] = {&_alm_blacklist_interface_dbus_arg_info_template_added_blacklist_id, &_alm_blacklist_interface_dbus_arg_info_template_added_blacklist_template, NULL};
static const GDBusSignalInfo _alm_blacklist_interface_dbus_signal_info_template_added = {-1, "TemplateAdded", (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_template_added), NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_template_removed_blacklist_id = {-1, "blacklist_id", "s", NULL};
static const GDBusArgInfo _alm_blacklist_interface_dbus_arg_info_template_removed_blacklist_template = {-1, "blacklist_template", "s(asaasay)", NULL};
static const GDBusArgInfo * const _alm_blacklist_interface_dbus_arg_info_template_removed[] = {&_alm_blacklist_interface_dbus_arg_info_template_removed_blacklist_id, &_alm_blacklist_interface_dbus_arg_info_template_removed_blacklist_template, NULL};
static const GDBusSignalInfo _alm_blacklist_interface_dbus_signal_info_template_removed = {-1, "TemplateRemoved", (GDBusArgInfo **) (&_alm_blacklist_interface_dbus_arg_info_template_removed), NULL};
static const GDBusSignalInfo * const _alm_blacklist_interface_dbus_signal_info[] = {&_alm_blacklist_interface_dbus_signal_info_template_added, &_alm_blacklist_interface_dbus_signal_info_template_removed, NULL};
static const GDBusPropertyInfo * const _alm_blacklist_interface_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _alm_blacklist_interface_dbus_interface_info = {-1, "org.gnome.zeitgeist.Blacklist", (GDBusMethodInfo **) (&_alm_blacklist_interface_dbus_method_info), (GDBusSignalInfo **) (&_alm_blacklist_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_alm_blacklist_interface_dbus_property_info), NULL};
static const GDBusInterfaceVTable _alm_blacklist_interface_dbus_interface_vtable = {alm_blacklist_interface_dbus_interface_method_call, alm_blacklist_interface_dbus_interface_get_property, alm_blacklist_interface_dbus_interface_set_property};

void
alm_blacklist_interface_add_template (AlmBlacklistInterface* self,
                                      const gchar* blacklist_id,
                                      GVariant* blacklist_template,
                                      GError** error)
{
	AlmBlacklistInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = ALM_BLACKLIST_INTERFACE_GET_INTERFACE (self);
	if (_iface_->add_template) {
		_iface_->add_template (self, blacklist_id, blacklist_template, error);
	}
}

GVariant*
alm_blacklist_interface_get_templates (AlmBlacklistInterface* self,
                                       GError** error)
{
	AlmBlacklistInterfaceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = ALM_BLACKLIST_INTERFACE_GET_INTERFACE (self);
	if (_iface_->get_templates) {
		return _iface_->get_templates (self, error);
	}
	return NULL;
}

void
alm_blacklist_interface_remove_template (AlmBlacklistInterface* self,
                                         const gchar* blacklist_id,
                                         GError** error)
{
	AlmBlacklistInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = ALM_BLACKLIST_INTERFACE_GET_INTERFACE (self);
	if (_iface_->remove_template) {
		_iface_->remove_template (self, blacklist_id, error);
	}
}

static void
g_cclosure_user_marshal_VOID__STRING_VARIANT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_VARIANT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_VARIANT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_VARIANT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_variant (param_values + 2), data2);
}

static void
alm_blacklist_interface_default_init (AlmBlacklistInterfaceIface * iface,
                                      gpointer iface_data)
{
	alm_blacklist_interface_signals[ALM_BLACKLIST_INTERFACE_TEMPLATE_ADDED_SIGNAL] = g_signal_new ("template-added", ALM_TYPE_BLACKLIST_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_VARIANT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT);
	alm_blacklist_interface_signals[ALM_BLACKLIST_INTERFACE_TEMPLATE_REMOVED_SIGNAL] = g_signal_new ("template-removed", ALM_TYPE_BLACKLIST_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_VARIANT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT);
}

static GType
alm_blacklist_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AlmBlacklistInterfaceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_blacklist_interface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType alm_blacklist_interface_type_id;
	alm_blacklist_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "AlmBlacklistInterface", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (alm_blacklist_interface_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (alm_blacklist_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) alm_blacklist_interface_proxy_get_type);
	g_type_set_qdata (alm_blacklist_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.zeitgeist.Blacklist");
	g_type_set_qdata (alm_blacklist_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_alm_blacklist_interface_dbus_interface_info));
	g_type_set_qdata (alm_blacklist_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) alm_blacklist_interface_register_object);
	return alm_blacklist_interface_type_id;
}

GType
alm_blacklist_interface_get_type (void)
{
	static volatile gsize alm_blacklist_interface_type_id__once = 0;
	if (g_once_init_enter (&alm_blacklist_interface_type_id__once)) {
		GType alm_blacklist_interface_type_id;
		alm_blacklist_interface_type_id = alm_blacklist_interface_get_type_once ();
		g_once_init_leave (&alm_blacklist_interface_type_id__once, alm_blacklist_interface_type_id);
	}
	return alm_blacklist_interface_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (AlmBlacklistInterfaceProxy, alm_blacklist_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (ALM_TYPE_BLACKLIST_INTERFACE, alm_blacklist_interface_proxy_alm_blacklist_interface_interface_init) )
static void
alm_blacklist_interface_proxy_class_init (AlmBlacklistInterfaceProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = alm_blacklist_interface_proxy_g_signal;
}

static void
_dbus_handle_alm_blacklist_interface_template_added (AlmBlacklistInterface* self,
                                                     GVariant* parameters)
{
	GVariantIter _arguments_iter;
	gchar* blacklist_id = NULL;
	GVariant* _tmp0_;
	GVariant* blacklist_template = NULL;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	blacklist_id = g_variant_dup_string (_tmp0_, NULL);
	g_variant_unref (_tmp0_);
	blacklist_template = g_variant_iter_next_value (&_arguments_iter);
	g_signal_emit_by_name (self, "template-added", blacklist_id, blacklist_template);
	_g_free0 (blacklist_id);
	_g_variant_unref0 (blacklist_template);
}

static void
_dbus_handle_alm_blacklist_interface_template_removed (AlmBlacklistInterface* self,
                                                       GVariant* parameters)
{
	GVariantIter _arguments_iter;
	gchar* blacklist_id = NULL;
	GVariant* _tmp1_;
	GVariant* blacklist_template = NULL;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	blacklist_id = g_variant_dup_string (_tmp1_, NULL);
	g_variant_unref (_tmp1_);
	blacklist_template = g_variant_iter_next_value (&_arguments_iter);
	g_signal_emit_by_name (self, "template-removed", blacklist_id, blacklist_template);
	_g_free0 (blacklist_id);
	_g_variant_unref0 (blacklist_template);
}

static void
alm_blacklist_interface_proxy_g_signal (GDBusProxy* proxy,
                                        const gchar* sender_name,
                                        const gchar* signal_name,
                                        GVariant* parameters)
{
	if (strcmp (signal_name, "TemplateAdded") == 0) {
		_dbus_handle_alm_blacklist_interface_template_added ((AlmBlacklistInterface*) proxy, parameters);
	} else if (strcmp (signal_name, "TemplateRemoved") == 0) {
		_dbus_handle_alm_blacklist_interface_template_removed ((AlmBlacklistInterface*) proxy, parameters);
	}
}

static void
alm_blacklist_interface_proxy_init (AlmBlacklistInterfaceProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_alm_blacklist_interface_dbus_interface_info));
}

static void
alm_blacklist_interface_proxy_add_template (AlmBlacklistInterface* self,
                                            const gchar* blacklist_id,
                                            GVariant* blacklist_template,
                                            GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_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.Blacklist", "AddTemplate");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (blacklist_id));
	g_variant_builder_add_value (&_arguments_builder, blacklist_template);
	_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;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static GVariant*
alm_blacklist_interface_proxy_get_templates (AlmBlacklistInterface* self,
                                             GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	GVariant* _result = NULL;
	G_IO_ERROR;
	_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.Blacklist", "GetTemplates");
	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 = g_variant_iter_next_value (&_reply_iter);
	g_object_unref (_reply_message);
	return _result;
}

static void
alm_blacklist_interface_proxy_remove_template (AlmBlacklistInterface* self,
                                               const gchar* blacklist_id,
                                               GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_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.Blacklist", "RemoveTemplate");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (blacklist_id));
	_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;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
alm_blacklist_interface_proxy_alm_blacklist_interface_interface_init (AlmBlacklistInterfaceIface* iface)
{
	iface->add_template = alm_blacklist_interface_proxy_add_template;
	iface->get_templates = alm_blacklist_interface_proxy_get_templates;
	iface->remove_template = alm_blacklist_interface_proxy_remove_template;
}

static void
_dbus_alm_blacklist_interface_add_template (AlmBlacklistInterface* self,
                                            GVariant* _parameters_,
                                            GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* blacklist_id = NULL;
	GVariant* _tmp2_;
	GVariant* blacklist_template = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
	blacklist_id = g_variant_dup_string (_tmp2_, NULL);
	g_variant_unref (_tmp2_);
	blacklist_template = g_variant_iter_next_value (&_arguments_iter);
	alm_blacklist_interface_add_template (self, blacklist_id, blacklist_template, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_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);
	_error:
	_g_free0 (blacklist_id);
	_g_variant_unref0 (blacklist_template);
	;
}

static void
_dbus_alm_blacklist_interface_get_templates (AlmBlacklistInterface* self,
                                             GVariant* _parameters_,
                                             GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GVariant* result;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = alm_blacklist_interface_get_templates (self, &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);
	g_variant_builder_add_value (&_reply_builder, result);
	_g_variant_unref0 (result);
	_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
_dbus_alm_blacklist_interface_remove_template (AlmBlacklistInterface* self,
                                               GVariant* _parameters_,
                                               GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* blacklist_id = NULL;
	GVariant* _tmp3_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	blacklist_id = g_variant_dup_string (_tmp3_, NULL);
	g_variant_unref (_tmp3_);
	alm_blacklist_interface_remove_template (self, blacklist_id, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_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);
	_error:
	_g_free0 (blacklist_id);
	;
}

static void
alm_blacklist_interface_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, "AddTemplate") == 0) {
		_dbus_alm_blacklist_interface_add_template (object, parameters, invocation);
	} else if (strcmp (method_name, "GetTemplates") == 0) {
		_dbus_alm_blacklist_interface_get_templates (object, parameters, invocation);
	} else if (strcmp (method_name, "RemoveTemplate") == 0) {
		_dbus_alm_blacklist_interface_remove_template (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
alm_blacklist_interface_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
alm_blacklist_interface_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;
}

static void
_dbus_alm_blacklist_interface_template_added (GObject* _sender,
                                              const gchar* blacklist_id,
                                              GVariant* blacklist_template,
                                              gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (blacklist_id));
	g_variant_builder_add_value (&_arguments_builder, blacklist_template);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.gnome.zeitgeist.Blacklist", "TemplateAdded", _arguments, NULL);
}

static void
_dbus_alm_blacklist_interface_template_removed (GObject* _sender,
                                                const gchar* blacklist_id,
                                                GVariant* blacklist_template,
                                                gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (blacklist_id));
	g_variant_builder_add_value (&_arguments_builder, blacklist_template);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.gnome.zeitgeist.Blacklist", "TemplateRemoved", _arguments, NULL);
}

guint
alm_blacklist_interface_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 *) (&_alm_blacklist_interface_dbus_interface_info), &_alm_blacklist_interface_dbus_interface_vtable, data, _alm_blacklist_interface_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "template-added", (GCallback) _dbus_alm_blacklist_interface_template_added, data);
	g_signal_connect (object, "template-removed", (GCallback) _dbus_alm_blacklist_interface_template_removed, data);
	return result;
}

static void
_alm_blacklist_interface_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_alm_blacklist_interface_template_added, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_alm_blacklist_interface_template_removed, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static inline gpointer
alm_blacklist_get_instance_private (AlmBlacklist* self)
{
	return G_STRUCT_MEMBER_P (self, AlmBlacklist_private_offset);
}

static void
_alm_blacklist_on_template_added_alm_blacklist_interface_template_added (AlmBlacklistInterface* _sender,
                                                                         const gchar* blacklist_id,
                                                                         GVariant* blacklist_template,
                                                                         gpointer self)
{
	alm_blacklist_on_template_added ((AlmBlacklist*) self, blacklist_id, blacklist_template);
}

static void
_alm_blacklist_on_template_removed_alm_blacklist_interface_template_removed (AlmBlacklistInterface* _sender,
                                                                             const gchar* blacklist_id,
                                                                             GVariant* blacklist_template,
                                                                             gpointer self)
{
	alm_blacklist_on_template_removed ((AlmBlacklist*) self, blacklist_id, blacklist_template);
}

AlmBlacklist*
alm_blacklist_construct (GType object_type)
{
	AlmBlacklist* self = NULL;
	AlmBlacklistInterface* _tmp0_ = NULL;
	AlmBlacklistInterface* _tmp1_;
	AlmBlacklistInterface* _tmp2_;
	AlmBlacklistInterface* _tmp3_;
	AlmBlacklistInterface* _tmp4_;
	ZeitgeistLog* _tmp5_;
	ZeitgeistEvent* _tmp6_;
	GError* _inner_error0_ = NULL;
	self = (AlmBlacklist*) g_type_create_instance (object_type);
	_tmp1_ = (AlmBlacklistInterface*) g_initable_new (ALM_TYPE_BLACKLIST_INTERFACE_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", "org.gnome.zeitgeist.Engine", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/gnome/zeitgeist/blacklist", "g-interface-name", "org.gnome.zeitgeist.Blacklist", NULL);
	_tmp0_ = (AlmBlacklistInterface*) _tmp1_;
	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 NULL;
	}
	_tmp2_ = _tmp0_;
	_tmp0_ = NULL;
	_g_object_unref0 (self->priv->blacklist);
	self->priv->blacklist = _tmp2_;
	_tmp3_ = self->priv->blacklist;
	g_signal_connect (_tmp3_, "template-added", (GCallback) _alm_blacklist_on_template_added_alm_blacklist_interface_template_added, self);
	_tmp4_ = self->priv->blacklist;
	g_signal_connect (_tmp4_, "template-removed", (GCallback) _alm_blacklist_on_template_removed_alm_blacklist_interface_template_removed, self);
	_tmp5_ = zeitgeist_log_new ();
	_g_object_unref0 (self->priv->log);
	self->priv->log = _tmp5_;
	_tmp6_ = zeitgeist_event_new ();
	_g_object_unref0 (self->priv->incognito_event);
	self->priv->incognito_event = _tmp6_;
	_g_object_unref0 (_tmp0_);
	return self;
}

AlmBlacklist*
alm_blacklist_new (void)
{
	return alm_blacklist_construct (ALM_TYPE_BLACKLIST);
}

void
alm_blacklist_add_template (AlmBlacklist* self,
                            const gchar* blacklist_id,
                            ZeitgeistEvent* blacklist_template)
{
	AlmBlacklistInterface* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (blacklist_id != NULL);
	g_return_if_fail (blacklist_template != NULL);
	_tmp0_ = self->priv->blacklist;
	_tmp1_ = zeitgeist_event_to_variant (blacklist_template);
	_tmp2_ = _tmp1_;
	alm_blacklist_interface_add_template (_tmp0_, blacklist_id, _tmp2_, &_inner_error0_);
	_g_variant_unref0 (_tmp2_);
	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;
	}
}

void
alm_blacklist_remove_template (AlmBlacklist* self,
                               const gchar* blacklist_id)
{
	AlmBlacklistInterface* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (blacklist_id != NULL);
	_tmp0_ = self->priv->blacklist;
	alm_blacklist_interface_remove_template (_tmp0_, blacklist_id, &_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;
	}
}

void
alm_blacklist_set_incognito (AlmBlacklist* self,
                             gboolean status)
{
	g_return_if_fail (self != NULL);
	if (status) {
		const gchar* _tmp0_;
		ZeitgeistEvent* _tmp1_;
		_tmp0_ = self->priv->incognito_id;
		_tmp1_ = self->priv->incognito_event;
		alm_blacklist_add_template (self, _tmp0_, _tmp1_);
	} else {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->incognito_id;
		alm_blacklist_remove_template (self, _tmp2_);
	}
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

GHashTable*
alm_blacklist_get_templates (AlmBlacklist* self)
{
	GVariant* var_blacklists = NULL;
	AlmBlacklistInterface* _tmp0_;
	GVariant* _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	GHashTable* _tmp4_;
	GError* _inner_error0_ = NULL;
	GHashTable* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->blacklist;
	_tmp1_ = alm_blacklist_interface_get_templates (_tmp0_, &_inner_error0_);
	var_blacklists = _tmp1_;
	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 NULL;
	}
	_tmp2_ = alm_utilities_from_variant (var_blacklists);
	_g_hash_table_unref0 (self->priv->blacklists);
	self->priv->blacklists = _tmp2_;
	_tmp3_ = self->priv->blacklists;
	_tmp4_ = _g_hash_table_ref0 (_tmp3_);
	result = _tmp4_;
	_g_variant_unref0 (var_blacklists);
	return result;
}

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

static void
alm_blacklist_on_template_added (AlmBlacklist* self,
                                 const gchar* blacklist_id,
                                 GVariant* blacklist_template)
{
	ZeitgeistEvent* ev = NULL;
	ZeitgeistEvent* _tmp0_;
	const gchar* _tmp1_;
	GHashTable* _tmp2_;
	gchar* _tmp3_;
	ZeitgeistEvent* _tmp4_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (blacklist_id != NULL);
	g_return_if_fail (blacklist_template != NULL);
	_tmp0_ = zeitgeist_event_new_from_variant (blacklist_template, &_inner_error0_);
	ev = _tmp0_;
	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;
	}
	g_signal_emit (self, alm_blacklist_signals[ALM_BLACKLIST_TEMPLATE_ADDED_SIGNAL], 0, blacklist_id, ev);
	_tmp1_ = self->priv->incognito_id;
	if (g_strcmp0 (blacklist_id, _tmp1_) == 0) {
		g_signal_emit (self, alm_blacklist_signals[ALM_BLACKLIST_INCOGNITO_TOGGLED_SIGNAL], 0, TRUE);
	}
	_tmp2_ = self->priv->blacklists;
	_tmp3_ = g_strdup (blacklist_id);
	_tmp4_ = _g_object_ref0 (ev);
	g_hash_table_insert (_tmp2_, _tmp3_, _tmp4_);
	_g_object_unref0 (ev);
}

static void
alm_blacklist_on_template_removed (AlmBlacklist* self,
                                   const gchar* blacklist_id,
                                   GVariant* blacklist_template)
{
	ZeitgeistEvent* ev = NULL;
	ZeitgeistEvent* _tmp0_;
	const gchar* _tmp1_;
	GHashTable* _tmp2_;
	gconstpointer _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (blacklist_id != NULL);
	g_return_if_fail (blacklist_template != NULL);
	_tmp0_ = zeitgeist_event_new_from_variant (blacklist_template, &_inner_error0_);
	ev = _tmp0_;
	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;
	}
	g_signal_emit (self, alm_blacklist_signals[ALM_BLACKLIST_TEMPLATE_REMOVED_SIGNAL], 0, blacklist_id, ev);
	_tmp1_ = self->priv->incognito_id;
	if (g_strcmp0 (blacklist_id, _tmp1_) == 0) {
		g_signal_emit (self, alm_blacklist_signals[ALM_BLACKLIST_INCOGNITO_TOGGLED_SIGNAL], 0, FALSE);
	}
	_tmp2_ = self->priv->blacklists;
	_tmp3_ = g_hash_table_lookup (_tmp2_, blacklist_id);
	if (((ZeitgeistEvent*) _tmp3_) != NULL) {
		GHashTable* _tmp4_;
		_tmp4_ = self->priv->blacklists;
		g_hash_table_remove (_tmp4_, blacklist_id);
	}
	_g_object_unref0 (ev);
}

gboolean
alm_blacklist_get_incognito (AlmBlacklist* self)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp3_;
	GHashTable* _tmp4_;
	GList* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->blacklists;
	if (_tmp0_ == NULL) {
		GHashTable* _tmp1_;
		GHashTable* _tmp2_;
		_tmp1_ = alm_blacklist_get_templates (self);
		_tmp2_ = _tmp1_;
		_g_hash_table_unref0 (_tmp2_);
	}
	_tmp3_ = alm_blacklist_get_all_templates (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_hash_table_get_values (_tmp4_);
	{
		GList* ev_collection = NULL;
		GList* ev_it = NULL;
		ev_collection = _tmp5_;
		for (ev_it = ev_collection; ev_it != NULL; ev_it = ev_it->next) {
			ZeitgeistEvent* _tmp6_;
			ZeitgeistEvent* ev = NULL;
			_tmp6_ = _g_object_ref0 ((ZeitgeistEvent*) ev_it->data);
			ev = _tmp6_;
			{
				ZeitgeistEvent* _tmp7_;
				ZeitgeistEvent* _tmp8_;
				_tmp7_ = ev;
				_tmp8_ = self->priv->incognito_event;
				if (alm_utilities_matches_event_template (_tmp7_, _tmp8_)) {
					result = TRUE;
					_g_object_unref0 (ev);
					(ev_collection == NULL) ? NULL : (ev_collection = (g_list_free (ev_collection), NULL));
					return result;
				}
				_g_object_unref0 (ev);
			}
		}
		(ev_collection == NULL) ? NULL : (ev_collection = (g_list_free (ev_collection), NULL));
	}
	result = FALSE;
	return result;
}

static void
alm_blacklist_find_events_data_free (gpointer _data)
{
	AlmBlacklistFindEventsData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->store);
	_alm_blacklist_unref0 (_data_->self);
	g_slice_free (AlmBlacklistFindEventsData, _data_);
}

static gpointer
_alm_blacklist_ref0 (gpointer self)
{
	return self ? alm_blacklist_ref (self) : NULL;
}

void
alm_blacklist_find_events (AlmBlacklist* self,
                           const gchar* id,
                           GtkTreeIter* iter,
                           GtkListStore* store,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	AlmBlacklistFindEventsData* _data_;
	AlmBlacklist* _tmp0_;
	gchar* _tmp1_;
	GtkTreeIter _tmp2_;
	GtkListStore* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (iter != NULL);
	g_return_if_fail (store != NULL);
	_data_ = g_slice_new0 (AlmBlacklistFindEventsData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, alm_blacklist_find_events_data_free);
	_tmp0_ = _alm_blacklist_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp1_;
	_tmp2_ = *iter;
	_data_->iter = _tmp2_;
	_tmp3_ = _g_object_ref0 (store);
	_g_object_unref0 (_data_->store);
	_data_->store = _tmp3_;
	alm_blacklist_find_events_co (_data_);
}

void
alm_blacklist_find_events_finish (AlmBlacklist* self,
                                  GAsyncResult* _res_)
{
	AlmBlacklistFindEventsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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

static void
alm_blacklist_find_events_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	AlmBlacklistFindEventsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	alm_blacklist_find_events_co (_data_);
}

static gboolean
alm_blacklist_find_events_co (AlmBlacklistFindEventsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = zeitgeist_event_new ();
	_data_->event = _data_->_tmp0_;
	zeitgeist_event_set_manifestation (_data_->event, ZEITGEIST_ZG_USER_ACTIVITY);
	_data_->_tmp1_ = g_strconcat ("application://", _data_->id, NULL);
	_data_->_tmp2_ = _data_->_tmp1_;
	zeitgeist_event_set_actor (_data_->event, _data_->_tmp2_);
	_g_free0 (_data_->_tmp2_);
	_data_->_tmp3_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_data_->events = _data_->_tmp3_;
	_data_->_tmp4_ = _g_object_ref0 (_data_->event);
	g_ptr_array_add (_data_->events, _data_->_tmp4_);
	_data_->_tmp5_ = zeitgeist_event_new ();
	_data_->event2 = _data_->_tmp5_;
	zeitgeist_event_set_manifestation (_data_->event2, ZEITGEIST_ZG_USER_ACTIVITY);
	_data_->_tmp6_ = zeitgeist_subject_new ();
	_data_->subj = _data_->_tmp6_;
	_data_->_tmp7_ = g_strconcat ("application://", _data_->id, NULL);
	_data_->_tmp8_ = _data_->_tmp7_;
	zeitgeist_subject_set_uri (_data_->subj, _data_->_tmp8_);
	_g_free0 (_data_->_tmp8_);
	zeitgeist_event_add_subject (_data_->event2, _data_->subj);
	_data_->_tmp9_ = _g_object_ref0 (_data_->event2);
	g_ptr_array_add (_data_->events, _data_->_tmp9_);
	_data_->_tmp10_ = _data_->self->priv->log;
	_data_->_tmp11_ = zeitgeist_time_range_new_anytime ();
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = 0;
	_data_->_state_ = 1;
	zeitgeist_log_find_event_ids (_data_->_tmp10_, _data_->_tmp12_, _data_->events, ZEITGEIST_STORAGE_STATE_ANY, (guint32) 0, ZEITGEIST_RESULT_TYPE_MOST_RECENT_EVENTS, NULL, alm_blacklist_find_events_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp14_ = zeitgeist_log_find_event_ids_finish (_data_->_tmp10_, _data_->_res_, &_data_->_tmp13_, &_data_->_inner_error0_);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->_tmp15__length1 = _data_->_tmp13_;
	_g_object_unref0 (_data_->_tmp12_);
	_data_->results = _data_->_tmp15_;
	_data_->results_length1 = _data_->_tmp15__length1;
	_data_->_results_size_ = _data_->results_length1;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->subj);
		_g_object_unref0 (_data_->event2);
		_g_ptr_array_unref0 (_data_->events);
		_g_object_unref0 (_data_->event);
		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_->counter = _data_->results_length1 / 100;
	_data_->_tmp16_ = _data_->iter;
	memset (&_data_->_tmp17_, 0, sizeof (GValue));
	g_value_init (&_data_->_tmp17_, G_TYPE_INT);
	g_value_set_int (&_data_->_tmp17_, _data_->counter);
	gtk_list_store_set_value (_data_->store, &_data_->_tmp16_, 5, &_data_->_tmp17_);
	G_IS_VALUE (&_data_->_tmp17_) ? (g_value_unset (&_data_->_tmp17_), NULL) : NULL;
	_data_->results = (g_free (_data_->results), NULL);
	_g_object_unref0 (_data_->subj);
	_g_object_unref0 (_data_->event2);
	_g_ptr_array_unref0 (_data_->events);
	_g_object_unref0 (_data_->event);
	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;
}

void
alm_blacklist_get_count_for_app (AlmBlacklist* self,
                                 const gchar* app_id,
                                 GtkTreeIter* iter,
                                 GtkListStore* store)
{
	GtkTreeIter _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_id != NULL);
	g_return_if_fail (iter != NULL);
	g_return_if_fail (store != NULL);
	_tmp0_ = *iter;
	alm_blacklist_find_events (self, app_id, &_tmp0_, store, NULL, NULL);
}

static void
alm_blacklist_find_all_apps_data_free (gpointer _data)
{
	AlmBlacklistFindAllAppsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->dialog);
	_alm_blacklist_unref0 (_data_->self);
	g_slice_free (AlmBlacklistFindAllAppsData, _data_);
}

void
alm_blacklist_find_all_apps (AlmBlacklist* self,
                             AlmApplicationsChooserDialog* dialog,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_)
{
	AlmBlacklistFindAllAppsData* _data_;
	AlmBlacklist* _tmp0_;
	AlmApplicationsChooserDialog* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_data_ = g_slice_new0 (AlmBlacklistFindAllAppsData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, alm_blacklist_find_all_apps_data_free);
	_tmp0_ = _alm_blacklist_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (dialog);
	_g_object_unref0 (_data_->dialog);
	_data_->dialog = _tmp1_;
	alm_blacklist_find_all_apps_co (_data_);
}

void
alm_blacklist_find_all_apps_finish (AlmBlacklist* self,
                                    GAsyncResult* _res_)
{
	AlmBlacklistFindAllAppsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
alm_blacklist_find_all_apps_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_)
{
	AlmBlacklistFindAllAppsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	alm_blacklist_find_all_apps_co (_data_);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gint64*
_int64_dup (gint64* self)
{
	gint64* dup;
	dup = g_new0 (gint64, 1);
	memcpy (dup, self, sizeof (gint64));
	return dup;
}

static gpointer
__int64_dup0 (gpointer self)
{
	return self ? _int64_dup (self) : NULL;
}

static gboolean
alm_blacklist_find_all_apps_co (AlmBlacklistFindAllAppsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = zeitgeist_event_new ();
	_data_->event = _data_->_tmp0_;
	zeitgeist_event_set_manifestation (_data_->event, ZEITGEIST_ZG_USER_ACTIVITY);
	zeitgeist_event_set_actor (_data_->event, "application://*");
	_data_->_tmp1_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_data_->events = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->events;
	_data_->_tmp3_ = _g_object_ref0 (_data_->event);
	g_ptr_array_add (_data_->_tmp2_, _data_->_tmp3_);
	_data_->_tmp4_ = zeitgeist_event_new ();
	_data_->event2 = _data_->_tmp4_;
	zeitgeist_event_set_manifestation (_data_->event2, ZEITGEIST_ZG_USER_ACTIVITY);
	_data_->_tmp5_ = zeitgeist_subject_new ();
	_data_->subj = _data_->_tmp5_;
	zeitgeist_subject_set_uri (_data_->subj, "application://*");
	zeitgeist_event_add_subject (_data_->event2, _data_->subj);
	_data_->_tmp6_ = _data_->events;
	_data_->_tmp7_ = _g_object_ref0 (_data_->event2);
	g_ptr_array_add (_data_->_tmp6_, _data_->_tmp7_);
	_data_->_tmp8_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_g_ptr_array_unref0 (_data_->events);
	_data_->events = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->self->priv->log;
	_data_->_tmp10_ = zeitgeist_time_range_new_anytime ();
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = _data_->events;
	_data_->_state_ = 1;
	zeitgeist_log_find_events (_data_->_tmp9_, _data_->_tmp11_, _data_->_tmp12_, ZEITGEIST_STORAGE_STATE_ANY, (guint32) 0, ZEITGEIST_RESULT_TYPE_MOST_POPULAR_ACTOR, NULL, alm_blacklist_find_all_apps_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp13_ = zeitgeist_log_find_events_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_g_object_unref0 (_data_->_tmp11_);
	_data_->results = _data_->_tmp14_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->subj);
		_g_object_unref0 (_data_->event2);
		_g_ptr_array_unref0 (_data_->events);
		_g_object_unref0 (_data_->event);
		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_->_tmp15_ = g_str_hash;
	_data_->_tmp16_ = g_str_equal;
	_data_->_tmp17_ = g_hash_table_new_full (_data_->_tmp15_, _data_->_tmp16_, _g_free0_, _g_free0_);
	_data_->all_actors = _data_->_tmp17_;
	{
		_data_->i = 0;
		{
			_data_->_tmp18_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp18_) {
					_data_->_tmp19_ = _data_->i;
					_data_->i = _data_->_tmp19_ + 1;
				}
				_data_->_tmp18_ = FALSE;
				if (!(((guint) _data_->i) < zeitgeist_result_set_size (_data_->results))) {
					break;
				}
				_data_->_tmp20_ = zeitgeist_result_set_next_value (_data_->results);
				_data_->ev = _data_->_tmp20_;
				_data_->_tmp21_ = _data_->ev;
				if (_data_->_tmp21_ != NULL) {
				}
				{
					_data_->_tmp22_ = _data_->ev;
					_data_->_tmp23_ = zeitgeist_event_get_actor (_data_->_tmp22_);
					_data_->_tmp24_ = _data_->_tmp23_;
					_data_->_tmp25_ = g_strdup (_data_->_tmp24_);
					_data_->actor = _data_->_tmp25_;
					_data_->_tmp27_ = _data_->actor;
					if (_data_->_tmp27_ != NULL) {
						_data_->_tmp28_ = _data_->actor;
						_data_->_tmp26_ = g_str_has_prefix (_data_->_tmp28_, "application://");
					} else {
						_data_->_tmp26_ = FALSE;
					}
					if (_data_->_tmp26_) {
						_data_->_tmp29_ = _data_->all_actors;
						_data_->_tmp30_ = _data_->actor;
						_data_->_tmp31_ = string_substring (_data_->_tmp30_, (glong) 14, (glong) -1);
						_data_->_tmp32_ = _data_->ev;
						_data_->_tmp33_ = zeitgeist_event_get_timestamp (_data_->_tmp32_);
						_data_->_tmp34_ = _data_->_tmp33_;
						_data_->_tmp35_ = __int64_dup0 (&_data_->_tmp34_);
						g_hash_table_insert (_data_->_tmp29_, _data_->_tmp31_, _data_->_tmp35_);
					}
					_g_free0 (_data_->actor);
				}
				_g_object_unref0 (_data_->ev);
			}
		}
	}
	_data_->_tmp36_ = _data_->all_actors;
	alm_applications_chooser_dialog_handle_app_population (_data_->dialog, _data_->_tmp36_);
	_g_hash_table_unref0 (_data_->all_actors);
	_g_object_unref0 (_data_->results);
	_g_object_unref0 (_data_->subj);
	_g_object_unref0 (_data_->event2);
	_g_ptr_array_unref0 (_data_->events);
	_g_object_unref0 (_data_->event);
	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;
}

void
alm_blacklist_get_all_applications (AlmBlacklist* self,
                                    AlmApplicationsChooserDialog* dialog)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	alm_blacklist_find_all_apps (self, dialog, NULL, NULL);
}

GHashTable*
alm_blacklist_get_all_templates (AlmBlacklist* self)
{
	GHashTable* result;
	GHashTable* _tmp0_;
	GHashTable* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->blacklists;
	if (_tmp0_ == NULL) {
		GHashTable* _tmp1_;
		GHashTable* _tmp2_;
		_tmp1_ = alm_blacklist_get_templates (self);
		_tmp2_ = _tmp1_;
		_g_hash_table_unref0 (_tmp2_);
	}
	_tmp3_ = self->priv->blacklists;
	result = _tmp3_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__STRING_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_OBJECT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static void
alm_value_blacklist_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
alm_value_blacklist_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		alm_blacklist_unref (value->data[0].v_pointer);
	}
}

static void
alm_value_blacklist_copy_value (const GValue* src_value,
                                GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = alm_blacklist_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
alm_value_blacklist_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
alm_value_blacklist_collect_value (GValue* value,
                                   guint n_collect_values,
                                   GTypeCValue* collect_values,
                                   guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		AlmBlacklist * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = alm_blacklist_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
alm_value_blacklist_lcopy_value (const GValue* value,
                                 guint n_collect_values,
                                 GTypeCValue* collect_values,
                                 guint collect_flags)
{
	AlmBlacklist ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = alm_blacklist_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
alm_param_spec_blacklist (const gchar* name,
                          const gchar* nick,
                          const gchar* blurb,
                          GType object_type,
                          GParamFlags flags)
{
	AlmParamSpecBlacklist* spec;
	g_return_val_if_fail (g_type_is_a (object_type, ALM_TYPE_BLACKLIST), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
alm_value_get_blacklist (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_BLACKLIST), NULL);
	return value->data[0].v_pointer;
}

void
alm_value_set_blacklist (GValue* value,
                         gpointer v_object)
{
	AlmBlacklist * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_BLACKLIST));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_BLACKLIST));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		alm_blacklist_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		alm_blacklist_unref (old);
	}
}

void
alm_value_take_blacklist (GValue* value,
                          gpointer v_object)
{
	AlmBlacklist * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_BLACKLIST));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_BLACKLIST));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		alm_blacklist_unref (old);
	}
}

static void
alm_blacklist_class_init (AlmBlacklistClass * klass,
                          gpointer klass_data)
{
	alm_blacklist_parent_class = g_type_class_peek_parent (klass);
	((AlmBlacklistClass *) klass)->finalize = alm_blacklist_finalize;
	g_type_class_adjust_private_offset (klass, &AlmBlacklist_private_offset);
	alm_blacklist_signals[ALM_BLACKLIST_TEMPLATE_ADDED_SIGNAL] = g_signal_new ("template-added", ALM_TYPE_BLACKLIST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_OBJECT, G_TYPE_NONE, 2, G_TYPE_STRING, ZEITGEIST_TYPE_EVENT);
	alm_blacklist_signals[ALM_BLACKLIST_TEMPLATE_REMOVED_SIGNAL] = g_signal_new ("template-removed", ALM_TYPE_BLACKLIST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_OBJECT, G_TYPE_NONE, 2, G_TYPE_STRING, ZEITGEIST_TYPE_EVENT);
	alm_blacklist_signals[ALM_BLACKLIST_INCOGNITO_TOGGLED_SIGNAL] = g_signal_new ("incognito-toggled", ALM_TYPE_BLACKLIST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
alm_blacklist_instance_init (AlmBlacklist * self,
                             gpointer klass)
{
	gchar* _tmp0_;
	self->priv = alm_blacklist_get_instance_private (self);
	_tmp0_ = g_strdup ("block-all");
	self->priv->incognito_id = _tmp0_;
	self->ref_count = 1;
}

static void
alm_blacklist_finalize (AlmBlacklist * obj)
{
	AlmBlacklist * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ALM_TYPE_BLACKLIST, AlmBlacklist);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->blacklist);
	_g_hash_table_unref0 (self->priv->blacklists);
	_g_object_unref0 (self->priv->log);
	_g_free0 (self->priv->incognito_id);
	_g_object_unref0 (self->priv->incognito_event);
}

static GType
alm_blacklist_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { alm_value_blacklist_init, alm_value_blacklist_free_value, alm_value_blacklist_copy_value, alm_value_blacklist_peek_pointer, "p", alm_value_blacklist_collect_value, "p", alm_value_blacklist_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (AlmBlacklistClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_blacklist_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmBlacklist), 0, (GInstanceInitFunc) alm_blacklist_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType alm_blacklist_type_id;
	alm_blacklist_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AlmBlacklist", &g_define_type_info, &g_define_type_fundamental_info, 0);
	AlmBlacklist_private_offset = g_type_add_instance_private (alm_blacklist_type_id, sizeof (AlmBlacklistPrivate));
	return alm_blacklist_type_id;
}

GType
alm_blacklist_get_type (void)
{
	static volatile gsize alm_blacklist_type_id__once = 0;
	if (g_once_init_enter (&alm_blacklist_type_id__once)) {
		GType alm_blacklist_type_id;
		alm_blacklist_type_id = alm_blacklist_get_type_once ();
		g_once_init_leave (&alm_blacklist_type_id__once, alm_blacklist_type_id);
	}
	return alm_blacklist_type_id__once;
}

gpointer
alm_blacklist_ref (gpointer instance)
{
	AlmBlacklist * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
alm_blacklist_unref (gpointer instance)
{
	AlmBlacklist * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		ALM_BLACKLIST_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

gboolean
alm_utilities_matches_event_template (ZeitgeistEvent* event,
                                      ZeitgeistEvent* template_event)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gboolean result;
	g_return_val_if_fail (event != NULL, FALSE);
	g_return_val_if_fail (template_event != NULL, FALSE);
	_tmp0_ = zeitgeist_event_get_interpretation (event);
	_tmp1_ = _tmp0_;
	_tmp2_ = zeitgeist_event_get_interpretation (template_event);
	_tmp3_ = _tmp2_;
	if (!alm_utilities_check_field_match (_tmp1_, _tmp3_, "ev-int")) {
		result = FALSE;
		return result;
	}
	_tmp4_ = zeitgeist_event_get_manifestation (event);
	_tmp5_ = _tmp4_;
	_tmp6_ = zeitgeist_event_get_manifestation (template_event);
	_tmp7_ = _tmp6_;
	if (!alm_utilities_check_field_match (_tmp5_, _tmp7_, "ev-mani")) {
		result = FALSE;
		return result;
	}
	_tmp8_ = zeitgeist_event_get_actor (event);
	_tmp9_ = _tmp8_;
	_tmp10_ = zeitgeist_event_get_actor (template_event);
	_tmp11_ = _tmp10_;
	if (!alm_utilities_check_field_match (_tmp9_, _tmp11_, "ev-actor")) {
		result = FALSE;
		return result;
	}
	if (zeitgeist_event_num_subjects (event) == 0) {
		result = TRUE;
		return result;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				if (!_tmp12_) {
					gint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				if (!(i < zeitgeist_event_num_subjects (event))) {
					break;
				}
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp14_ = FALSE;
						_tmp14_ = TRUE;
						while (TRUE) {
							ZeitgeistSubject* _tmp16_;
							ZeitgeistSubject* _tmp17_;
							ZeitgeistSubject* _tmp18_;
							ZeitgeistSubject* _tmp19_;
							gboolean _tmp20_;
							if (!_tmp14_) {
								gint _tmp15_;
								_tmp15_ = j;
								j = _tmp15_ + 1;
							}
							_tmp14_ = FALSE;
							if (!(j < zeitgeist_event_num_subjects (template_event))) {
								break;
							}
							_tmp16_ = zeitgeist_event_get_subject (event, i);
							_tmp17_ = _tmp16_;
							_tmp18_ = zeitgeist_event_get_subject (template_event, j);
							_tmp19_ = _tmp18_;
							_tmp20_ = alm_utilities_matches_subject_template (_tmp17_, _tmp19_);
							_g_object_unref0 (_tmp19_);
							_g_object_unref0 (_tmp17_);
							if (_tmp20_) {
								result = TRUE;
								return result;
							}
						}
					}
				}
			}
		}
	}
	result = FALSE;
	return result;
}

gboolean
alm_utilities_matches_subject_template (ZeitgeistSubject* subject,
                                        ZeitgeistSubject* template_subject)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gboolean result;
	g_return_val_if_fail (subject != NULL, FALSE);
	g_return_val_if_fail (template_subject != NULL, FALSE);
	_tmp0_ = zeitgeist_subject_get_uri (subject);
	_tmp1_ = _tmp0_;
	_tmp2_ = zeitgeist_subject_get_uri (template_subject);
	_tmp3_ = _tmp2_;
	if (!alm_utilities_check_field_match (_tmp1_, _tmp3_, "sub-uri")) {
		result = FALSE;
		return result;
	}
	_tmp4_ = zeitgeist_subject_get_interpretation (subject);
	_tmp5_ = _tmp4_;
	_tmp6_ = zeitgeist_subject_get_interpretation (template_subject);
	_tmp7_ = _tmp6_;
	if (!alm_utilities_check_field_match (_tmp5_, _tmp7_, "sub-int")) {
		result = FALSE;
		return result;
	}
	_tmp8_ = zeitgeist_subject_get_manifestation (subject);
	_tmp9_ = _tmp8_;
	_tmp10_ = zeitgeist_subject_get_manifestation (template_subject);
	_tmp11_ = _tmp10_;
	if (!alm_utilities_check_field_match (_tmp9_, _tmp11_, "sub-mani")) {
		result = FALSE;
		return result;
	}
	_tmp12_ = zeitgeist_subject_get_origin (subject);
	_tmp13_ = _tmp12_;
	_tmp14_ = zeitgeist_subject_get_origin (template_subject);
	_tmp15_ = _tmp14_;
	if (!alm_utilities_check_field_match (_tmp13_, _tmp15_, "sub-origin")) {
		result = FALSE;
		return result;
	}
	_tmp16_ = zeitgeist_subject_get_mimetype (subject);
	_tmp17_ = _tmp16_;
	_tmp18_ = zeitgeist_subject_get_mimetype (template_subject);
	_tmp19_ = _tmp18_;
	if (!alm_utilities_check_field_match (_tmp17_, _tmp19_, "sub-mime")) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

static gboolean
alm_utilities_check_field_match (const gchar* property,
                                 const gchar* template_property,
                                 const gchar* property_name)
{
	gboolean matches = FALSE;
	gchar* parsed = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean is_negated = FALSE;
	const gchar* _tmp3_;
	gboolean _tmp5_ = FALSE;
	gboolean result;
	g_return_val_if_fail (property_name != NULL, FALSE);
	matches = FALSE;
	_tmp0_ = g_strdup (template_property);
	parsed = _tmp0_;
	if (template_property != NULL) {
		gboolean _tmp2_;
		_tmp2_ = alm_utilities_parse_negation (&parsed);
		_tmp1_ = _tmp2_;
	} else {
		_tmp1_ = FALSE;
	}
	is_negated = _tmp1_;
	_tmp3_ = parsed;
	if (g_strcmp0 (_tmp3_, "") == 0) {
		result = TRUE;
		_g_free0 (parsed);
		return result;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = parsed;
		if (g_strcmp0 (_tmp4_, property) == 0) {
			matches = TRUE;
		}
	}
	if (is_negated) {
		_tmp5_ = !matches;
	} else {
		_tmp5_ = matches;
	}
	result = _tmp5_;
	_g_free0 (parsed);
	return result;
}

gboolean
alm_utilities_parse_negation (gchar** val)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (*val != NULL, FALSE);
	if (!g_str_has_prefix (*val, "!")) {
		result = FALSE;
		return result;
	}
	_tmp0_ = string_substring (*val, (glong) 1, (glong) -1);
	_g_free0 (*val);
	*val = _tmp0_;
	result = TRUE;
	return result;
}

GHashTable*
alm_utilities_from_variant (GVariant* templates_variant)
{
	GHashTable* blacklist = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	const gchar* _tmp3_;
	GError* _inner_error0_ = NULL;
	GHashTable* result;
	g_return_val_if_fail (templates_variant != NULL, NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	blacklist = _tmp2_;
	_tmp3_ = g_variant_get_type_string (templates_variant);
	g_warn_if_fail (g_strcmp0 (_tmp3_, ALM_UTILITIES_SIG_BLACKLIST) == 0);
	{
		GVariantIter* _template_variant_it = NULL;
		GVariantIter* _tmp4_;
		GVariant* template_variant = NULL;
		_tmp4_ = g_variant_iter_new (templates_variant);
		_template_variant_it = _tmp4_;
		while (TRUE) {
			GVariantIter* _tmp5_;
			GVariant* _tmp6_;
			GVariant* _tmp7_;
			GVariantIter* iter = NULL;
			GVariant* _tmp8_;
			GVariantIter* _tmp9_;
			gchar* template_id = NULL;
			GVariantIter* _tmp10_;
			GVariant* _tmp11_;
			GVariant* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			GVariant* ev_variant = NULL;
			GVariantIter* _tmp16_;
			GVariant* _tmp17_;
			GVariant* _tmp18_;
			_tmp5_ = _template_variant_it;
			_tmp6_ = g_variant_iter_next_value (_tmp5_);
			_g_variant_unref0 (template_variant);
			template_variant = _tmp6_;
			_tmp7_ = template_variant;
			if (!(_tmp7_ != NULL)) {
				break;
			}
			_tmp8_ = template_variant;
			_tmp9_ = g_variant_iter_new (_tmp8_);
			iter = _tmp9_;
			_tmp10_ = iter;
			_tmp11_ = g_variant_iter_next_value (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_variant_get_string (_tmp12_, NULL);
			_tmp14_ = g_strdup (_tmp13_);
			_tmp15_ = _tmp14_;
			_g_variant_unref0 (_tmp12_);
			template_id = _tmp15_;
			_tmp16_ = iter;
			_tmp17_ = g_variant_iter_next_value (_tmp16_);
			ev_variant = _tmp17_;
			_tmp18_ = ev_variant;
			if (_tmp18_ != NULL) {
				ZeitgeistEvent* template = NULL;
				GVariant* _tmp19_;
				ZeitgeistEvent* _tmp20_;
				GHashTable* _tmp21_;
				const gchar* _tmp22_;
				gchar* _tmp23_;
				ZeitgeistEvent* _tmp24_;
				ZeitgeistEvent* _tmp25_;
				_tmp19_ = ev_variant;
				_tmp20_ = zeitgeist_event_new_from_variant (_tmp19_, &_inner_error0_);
				template = _tmp20_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_variant_unref0 (ev_variant);
					_g_free0 (template_id);
					_g_variant_iter_free0 (iter);
					_g_variant_unref0 (template_variant);
					_g_variant_iter_free0 (_template_variant_it);
					_g_hash_table_unref0 (blacklist);
					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 NULL;
				}
				_tmp21_ = blacklist;
				_tmp22_ = template_id;
				_tmp23_ = g_strdup (_tmp22_);
				_tmp24_ = template;
				_tmp25_ = _g_object_ref0 (_tmp24_);
				g_hash_table_insert (_tmp21_, _tmp23_, _tmp25_);
				_g_object_unref0 (template);
			}
			_g_variant_unref0 (ev_variant);
			_g_free0 (template_id);
			_g_variant_iter_free0 (iter);
		}
		_g_variant_unref0 (template_variant);
		_g_variant_iter_free0 (_template_variant_it);
	}
	result = blacklist;
	return result;
}

GVariant*
alm_utilities_to_variant (GHashTable* blacklist)
{
	GVariantBuilder* vb = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GVariantBuilder* _tmp19_;
	GVariant* _tmp20_;
	GVariant* result;
	g_return_val_if_fail (blacklist != NULL, NULL);
	_tmp0_ = g_variant_type_new (ALM_UTILITIES_SIG_BLACKLIST);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	vb = _tmp3_;
	{
		GHashTableIter iter = {0};
		gchar* template_id = NULL;
		ZeitgeistEvent* event_template = NULL;
		g_hash_table_iter_init (&iter, blacklist);
		while (TRUE) {
			gconstpointer _tmp4_ = NULL;
			gconstpointer _tmp5_ = NULL;
			gboolean _tmp6_;
			gchar* _tmp7_;
			ZeitgeistEvent* _tmp8_;
			GVariantBuilder* _tmp9_;
			GVariantType* _tmp10_;
			GVariantType* _tmp11_;
			GVariantBuilder* _tmp12_;
			const gchar* _tmp13_;
			GVariantBuilder* _tmp14_;
			ZeitgeistEvent* _tmp15_;
			GVariant* _tmp16_;
			GVariant* _tmp17_;
			GVariantBuilder* _tmp18_;
			_tmp6_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp4_), (gpointer*) (&_tmp5_));
			_g_free0 (template_id);
			_tmp7_ = g_strdup ((const gchar*) _tmp4_);
			template_id = _tmp7_;
			_g_object_unref0 (event_template);
			_tmp8_ = _g_object_ref0 ((ZeitgeistEvent*) _tmp5_);
			event_template = _tmp8_;
			if (!_tmp6_) {
				break;
			}
			_tmp9_ = vb;
			_tmp10_ = g_variant_type_new ("{s(" ALM_UTILITIES_SIG_EVENT ")}");
			_tmp11_ = _tmp10_;
			g_variant_builder_open (_tmp9_, _tmp11_);
			_g_variant_type_free0 (_tmp11_);
			_tmp12_ = vb;
			_tmp13_ = template_id;
			g_variant_builder_add (_tmp12_, "s", _tmp13_, NULL);
			_tmp14_ = vb;
			_tmp15_ = event_template;
			_tmp16_ = zeitgeist_event_to_variant (_tmp15_);
			_tmp17_ = _tmp16_;
			g_variant_builder_add_value (_tmp14_, _tmp17_);
			_g_variant_unref0 (_tmp17_);
			_tmp18_ = vb;
			g_variant_builder_close (_tmp18_);
		}
		_g_object_unref0 (event_template);
		_g_free0 (template_id);
	}
	_tmp19_ = vb;
	_tmp20_ = g_variant_builder_end (_tmp19_);
	g_variant_ref_sink (_tmp20_);
	result = _tmp20_;
	_g_variant_builder_unref0 (vb);
	return result;
}

AlmUtilities*
alm_utilities_construct (GType object_type)
{
	AlmUtilities* self = NULL;
	self = (AlmUtilities*) g_type_create_instance (object_type);
	return self;
}

AlmUtilities*
alm_utilities_new (void)
{
	return alm_utilities_construct (ALM_TYPE_UTILITIES);
}

static void
alm_value_utilities_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
alm_value_utilities_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		alm_utilities_unref (value->data[0].v_pointer);
	}
}

static void
alm_value_utilities_copy_value (const GValue* src_value,
                                GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = alm_utilities_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
alm_value_utilities_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
alm_value_utilities_collect_value (GValue* value,
                                   guint n_collect_values,
                                   GTypeCValue* collect_values,
                                   guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		AlmUtilities * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = alm_utilities_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
alm_value_utilities_lcopy_value (const GValue* value,
                                 guint n_collect_values,
                                 GTypeCValue* collect_values,
                                 guint collect_flags)
{
	AlmUtilities ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = alm_utilities_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
alm_param_spec_utilities (const gchar* name,
                          const gchar* nick,
                          const gchar* blurb,
                          GType object_type,
                          GParamFlags flags)
{
	AlmParamSpecUtilities* spec;
	g_return_val_if_fail (g_type_is_a (object_type, ALM_TYPE_UTILITIES), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
alm_value_get_utilities (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_UTILITIES), NULL);
	return value->data[0].v_pointer;
}

void
alm_value_set_utilities (GValue* value,
                         gpointer v_object)
{
	AlmUtilities * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_UTILITIES));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_UTILITIES));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		alm_utilities_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		alm_utilities_unref (old);
	}
}

void
alm_value_take_utilities (GValue* value,
                          gpointer v_object)
{
	AlmUtilities * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ALM_TYPE_UTILITIES));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ALM_TYPE_UTILITIES));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		alm_utilities_unref (old);
	}
}

static void
alm_utilities_class_init (AlmUtilitiesClass * klass,
                          gpointer klass_data)
{
	alm_utilities_parent_class = g_type_class_peek_parent (klass);
	((AlmUtilitiesClass *) klass)->finalize = alm_utilities_finalize;
}

static void
alm_utilities_instance_init (AlmUtilities * self,
                             gpointer klass)
{
	self->ref_count = 1;
}

static void
alm_utilities_finalize (AlmUtilities * obj)
{
	AlmUtilities * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ALM_TYPE_UTILITIES, AlmUtilities);
	g_signal_handlers_destroy (self);
}

static GType
alm_utilities_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { alm_value_utilities_init, alm_value_utilities_free_value, alm_value_utilities_copy_value, alm_value_utilities_peek_pointer, "p", alm_value_utilities_collect_value, "p", alm_value_utilities_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (AlmUtilitiesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_utilities_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmUtilities), 0, (GInstanceInitFunc) alm_utilities_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType alm_utilities_type_id;
	alm_utilities_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AlmUtilities", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return alm_utilities_type_id;
}

GType
alm_utilities_get_type (void)
{
	static volatile gsize alm_utilities_type_id__once = 0;
	if (g_once_init_enter (&alm_utilities_type_id__once)) {
		GType alm_utilities_type_id;
		alm_utilities_type_id = alm_utilities_get_type_once ();
		g_once_init_leave (&alm_utilities_type_id__once, alm_utilities_type_id);
	}
	return alm_utilities_type_id__once;
}

gpointer
alm_utilities_ref (gpointer instance)
{
	AlmUtilities * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
alm_utilities_unref (gpointer instance)
{
	AlmUtilities * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		ALM_UTILITIES_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

