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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "planify.h"
#include <gio/gio.h>
#include <adwaita.h>
#include <glib/gi18n-lib.h>

#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 SERVICES_TYPE_NOTIFICATION (services_notification_get_type ())
#define SERVICES_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVICES_TYPE_NOTIFICATION, ServicesNotification))
#define SERVICES_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVICES_TYPE_NOTIFICATION, ServicesNotificationClass))
#define SERVICES_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVICES_TYPE_NOTIFICATION))
#define SERVICES_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVICES_TYPE_NOTIFICATION))
#define SERVICES_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVICES_TYPE_NOTIFICATION, ServicesNotificationClass))

typedef struct _ServicesNotification ServicesNotification;
typedef struct _ServicesNotificationClass ServicesNotificationClass;
typedef struct _ServicesNotificationPrivate ServicesNotificationPrivate;
enum  {
	SERVICES_NOTIFICATION_0_PROPERTY,
	SERVICES_NOTIFICATION_NUM_PROPERTIES
};
static GParamSpec* services_notification_properties[SERVICES_NOTIFICATION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block13Data Block13Data;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define TYPE_PLANIFY (planify_get_type ())
#define PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLANIFY, Planify))
#define PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLANIFY, PlanifyClass))
#define IS_PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLANIFY))
#define IS_PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLANIFY))
#define PLANIFY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLANIFY, PlanifyClass))

typedef struct _Planify Planify;
typedef struct _PlanifyClass PlanifyClass;
typedef struct _Block14Data Block14Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _ServicesNotification {
	GObject parent_instance;
	ServicesNotificationPrivate * priv;
};

struct _ServicesNotificationClass {
	GObjectClass parent_class;
};

struct _ServicesNotificationPrivate {
	GeeHashMap* reminders;
};

struct _Block13Data {
	int _ref_count_;
	ServicesNotification* self;
	ObjectsReminder* reminder;
};

struct _Block14Data {
	int _ref_count_;
	Block13Data * _data13_;
	gchar* uid;
};

static gint ServicesNotification_private_offset;
static gpointer services_notification_parent_class = NULL;
static ServicesNotification* services_notification__instance;
static ServicesNotification* services_notification__instance = NULL;

VALA_EXTERN GType services_notification_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ServicesNotification, g_object_unref)
VALA_EXTERN ServicesNotification* services_notification_get_default (void);
VALA_EXTERN ServicesNotification* services_notification_new (void);
VALA_EXTERN ServicesNotification* services_notification_construct (GType object_type);
VALA_EXTERN void services_notification_regresh (ServicesNotification* self);
static void services_notification_reminder_added (ServicesNotification* self,
                                           ObjectsReminder* reminder);
static void __lambda955_ (ServicesNotification* self,
                   ObjectsReminder* reminder);
static void ___lambda955__services_store_reminder_added (ServicesStore* _sender,
                                                  ObjectsReminder* reminder,
                                                  gpointer self);
static void __lambda956_ (ServicesNotification* self,
                   ObjectsReminder* reminder);
static void ___lambda956__services_store_reminder_deleted (ServicesStore* _sender,
                                                    ObjectsReminder* reminder,
                                                    gpointer self);
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_data_unref (void * _userdata_);
static GNotification* services_notification_build_notification (ServicesNotification* self,
                                                         ObjectsReminder* reminder);
VALA_EXTERN GType planify_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Planify, g_object_unref)
VALA_EXTERN Planify* planify_get_instance (void);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static GTimeSpan services_notification_time_until_now (ServicesNotification* self,
                                                GDateTime* dt);
static gboolean ____lambda954_ (Block14Data* _data14_);
static void services_notification_queue_reminder_notification (ServicesNotification* self,
                                                        ObjectsReminder* reminder,
                                                        const gchar* uid);
static gboolean _____lambda954__gsource_func (gpointer self);
static GObject * services_notification_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void services_notification_finalize (GObject * obj);
static GType services_notification_get_type_once (void);

static inline gpointer
services_notification_get_instance_private (ServicesNotification* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesNotification_private_offset);
}

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

ServicesNotification*
services_notification_get_default (void)
{
	ServicesNotification* _tmp0_;
	ServicesNotification* _tmp2_;
	ServicesNotification* _tmp3_;
	ServicesNotification* result;
	_tmp0_ = services_notification__instance;
	if (_tmp0_ == NULL) {
		ServicesNotification* _tmp1_;
		_tmp1_ = services_notification_new ();
		_g_object_unref0 (services_notification__instance);
		services_notification__instance = _tmp1_;
	}
	_tmp2_ = services_notification__instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
__lambda955_ (ServicesNotification* self,
              ObjectsReminder* reminder)
{
	g_return_if_fail (reminder != NULL);
	services_notification_reminder_added (self, reminder);
}

static void
___lambda955__services_store_reminder_added (ServicesStore* _sender,
                                             ObjectsReminder* reminder,
                                             gpointer self)
{
	__lambda955_ ((ServicesNotification*) self, reminder);
}

static void
__lambda956_ (ServicesNotification* self,
              ObjectsReminder* reminder)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (reminder != NULL);
	_tmp0_ = self->priv->reminders;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) reminder);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = self->priv->reminders;
		_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) reminder);
		_tmp5_ = _tmp4_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, _tmp5_, NULL);
	}
}

static void
___lambda956__services_store_reminder_deleted (ServicesStore* _sender,
                                               ObjectsReminder* reminder,
                                               gpointer self)
{
	__lambda956_ ((ServicesNotification*) self, reminder);
}

void
services_notification_regresh (ServicesNotification* self)
{
	GeeHashMap* _tmp0_;
	ServicesStore* _tmp14_;
	ServicesStore* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->reminders;
	if (_tmp0_ == NULL) {
		GeeHashMap* _tmp1_;
		_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->reminders);
		self->priv->reminders = _tmp1_;
	} else {
		GeeHashMap* _tmp2_;
		_tmp2_ = self->priv->reminders;
		gee_abstract_map_clear ((GeeAbstractMap*) _tmp2_);
	}
	{
		GeeArrayList* _reminder_list = NULL;
		ServicesStore* _tmp3_;
		GeeArrayList* _tmp4_;
		GeeArrayList* _tmp5_;
		gint _reminder_size = 0;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _reminder_index = 0;
		_tmp3_ = services_store_instance ();
		_tmp4_ = services_store_get_reminders (_tmp3_);
		_tmp5_ = _tmp4_;
		_reminder_list = _tmp5_;
		_tmp6_ = _reminder_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_reminder_size = _tmp8_;
		_reminder_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			ObjectsReminder* reminder = NULL;
			GeeArrayList* _tmp11_;
			gpointer _tmp12_;
			ObjectsReminder* _tmp13_;
			_reminder_index = _reminder_index + 1;
			_tmp9_ = _reminder_index;
			_tmp10_ = _reminder_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _reminder_list;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _reminder_index);
			reminder = (ObjectsReminder*) _tmp12_;
			_tmp13_ = reminder;
			services_notification_reminder_added (self, _tmp13_);
			_g_object_unref0 (reminder);
		}
	}
	_tmp14_ = services_store_instance ();
	g_signal_connect_object (_tmp14_, "reminder-added", (GCallback) ___lambda955__services_store_reminder_added, self, 0);
	_tmp15_ = services_store_instance ();
	g_signal_connect_object (_tmp15_, "reminder-deleted", (GCallback) ___lambda956__services_store_reminder_deleted, self, 0);
}

static Block13Data*
block13_data_ref (Block13Data* _data13_)
{
	g_atomic_int_inc (&_data13_->_ref_count_);
	return _data13_;
}

static void
block13_data_unref (void * _userdata_)
{
	Block13Data* _data13_;
	_data13_ = (Block13Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
		ServicesNotification* self;
		self = _data13_->self;
		_g_object_unref0 (_data13_->reminder);
		_g_object_unref0 (self);
		g_slice_free (Block13Data, _data13_);
	}
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		ServicesNotification* self;
		self = _data14_->_data13_->self;
		_g_free0 (_data14_->uid);
		block13_data_unref (_data14_->_data13_);
		_data14_->_data13_ = NULL;
		g_slice_free (Block14Data, _data14_);
	}
}

static gboolean
____lambda954_ (Block14Data* _data14_)
{
	Block13Data* _data13_;
	ServicesNotification* self;
	const gchar* _tmp0_;
	gboolean result;
	_data13_ = _data14_->_data13_;
	self = _data13_->self;
	_tmp0_ = _data14_->uid;
	services_notification_queue_reminder_notification (self, _data13_->reminder, _tmp0_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
_____lambda954__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda954_ (self);
	return result;
}

static void
services_notification_reminder_added (ServicesNotification* self,
                                      ObjectsReminder* reminder)
{
	Block13Data* _data13_;
	ObjectsReminder* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* _tmp4_;
	gboolean _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	_data13_ = g_slice_new0 (Block13Data);
	_data13_->_ref_count_ = 1;
	_data13_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (reminder);
	_g_object_unref0 (_data13_->reminder);
	_data13_->reminder = _tmp0_;
	_tmp1_ = objects_reminder_get_datetime (_data13_->reminder);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_date_time_new_now_local ();
	_tmp4_ = _tmp3_;
	_tmp5_ = g_date_time_compare (_tmp2_, _tmp4_) <= 0;
	_g_date_time_unref0 (_tmp4_);
	if (_tmp5_) {
		GNotification* notification = NULL;
		GNotification* _tmp6_;
		Planify* _tmp7_;
		Planify* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		GNotification* _tmp11_;
		ServicesStore* _tmp12_;
		_tmp6_ = services_notification_build_notification (self, _data13_->reminder);
		notification = _tmp6_;
		_tmp7_ = planify_get_instance ();
		_tmp8_ = _tmp7_;
		_tmp9_ = objects_base_object_get_id ((ObjectsBaseObject*) _data13_->reminder);
		_tmp10_ = _tmp9_;
		_tmp11_ = notification;
		g_application_send_notification ((GApplication*) _tmp8_, _tmp10_, _tmp11_);
		_tmp12_ = services_store_instance ();
		services_store_delete_reminder (_tmp12_, _data13_->reminder);
		_g_object_unref0 (notification);
	} else {
		GDateTime* _tmp13_;
		GDateTime* _tmp14_;
		GDateTime* _tmp15_;
		GDateTime* _tmp16_;
		gboolean _tmp17_;
		_tmp13_ = objects_reminder_get_datetime (_data13_->reminder);
		_tmp14_ = _tmp13_;
		_tmp15_ = g_date_time_new_now_local ();
		_tmp16_ = _tmp15_;
		_tmp17_ = utils_datetime_is_same_day (_tmp14_, _tmp16_);
		_g_date_time_unref0 (_tmp16_);
		if (_tmp17_) {
			Block14Data* _data14_;
			guint interval = 0U;
			GDateTime* _tmp18_;
			GDateTime* _tmp19_;
			gchar* _tmp20_;
			GeeHashMap* _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			_data14_ = g_slice_new0 (Block14Data);
			_data14_->_ref_count_ = 1;
			_data14_->_data13_ = block13_data_ref (_data13_);
			_tmp18_ = objects_reminder_get_datetime (_data13_->reminder);
			_tmp19_ = _tmp18_;
			interval = (guint) services_notification_time_until_now (self, _tmp19_);
			_tmp20_ = g_strdup_printf ("%u-%u", interval, (guint) g_random_int ());
			_data14_->uid = _tmp20_;
			_tmp21_ = self->priv->reminders;
			_tmp22_ = objects_base_object_get_id ((ObjectsBaseObject*) _data13_->reminder);
			_tmp23_ = _tmp22_;
			_tmp24_ = _data14_->uid;
			gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, _tmp23_, _tmp24_);
			g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, interval, _____lambda954__gsource_func, block14_data_ref (_data14_), block14_data_unref);
			block14_data_unref (_data14_);
			_data14_ = NULL;
		}
	}
	block13_data_unref (_data13_);
	_data13_ = NULL;
}

static GTimeSpan
services_notification_time_until_now (ServicesNotification* self,
                                      GDateTime* dt)
{
	GDateTime* now = NULL;
	GDateTime* _tmp0_;
	GTimeSpan result;
	g_return_val_if_fail (self != NULL, -1LL);
	g_return_val_if_fail (dt != NULL, -1LL);
	_tmp0_ = g_date_time_new_now_local ();
	now = _tmp0_;
	result = g_date_time_difference (dt, now) / G_TIME_SPAN_SECOND;
	_g_date_time_unref0 (now);
	return result;
}

static void
services_notification_queue_reminder_notification (ServicesNotification* self,
                                                   ObjectsReminder* reminder,
                                                   const gchar* uid)
{
	GeeHashMap* _tmp0_;
	GeeCollection* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* _tmp3_;
	gboolean _tmp4_;
	GNotification* notification = NULL;
	GNotification* _tmp5_;
	Planify* _tmp6_;
	Planify* _tmp7_;
	GNotification* _tmp8_;
	ServicesStore* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	g_return_if_fail (uid != NULL);
	_tmp0_ = self->priv->reminders;
	_tmp1_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_collection_contains (_tmp3_, uid) == FALSE;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		return;
	}
	_tmp5_ = services_notification_build_notification (self, reminder);
	notification = _tmp5_;
	_tmp6_ = planify_get_instance ();
	_tmp7_ = _tmp6_;
	_tmp8_ = notification;
	g_application_send_notification ((GApplication*) _tmp7_, uid, _tmp8_);
	_tmp9_ = services_store_instance ();
	services_store_delete_reminder (_tmp9_, reminder);
	_g_object_unref0 (notification);
}

static GNotification*
services_notification_build_notification (ServicesNotification* self,
                                          ObjectsReminder* reminder)
{
	GNotification* notification = NULL;
	ObjectsItem* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GNotification* _tmp6_;
	ObjectsItem* _tmp7_;
	ObjectsItem* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GThemedIcon* _tmp11_;
	GThemedIcon* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	GVariant* _tmp15_;
	GVariant* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	GVariant* _tmp19_;
	GVariant* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	GVariant* _tmp23_;
	GVariant* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	GVariant* _tmp27_;
	GVariant* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GVariant* _tmp31_;
	GVariant* _tmp32_;
	GNotification* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (reminder != NULL, NULL);
	_tmp0_ = objects_reminder_get_item (reminder);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_item_get_project (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_notification_new (_tmp5_);
	notification = _tmp6_;
	_tmp7_ = objects_reminder_get_item (reminder);
	_tmp8_ = _tmp7_;
	_tmp9_ = objects_item_get_content (_tmp8_);
	_tmp10_ = _tmp9_;
	g_notification_set_body (notification, _tmp10_);
	_tmp11_ = (GThemedIcon*) g_themed_icon_new ("io.github.alainm23.planify");
	_tmp12_ = _tmp11_;
	g_notification_set_icon (notification, (GIcon*) _tmp12_);
	_g_object_unref0 (_tmp12_);
	g_notification_set_priority (notification, G_NOTIFICATION_PRIORITY_URGENT);
	_tmp13_ = objects_reminder_get_item_id (reminder);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_variant_new_string (_tmp14_);
	g_variant_ref_sink (_tmp15_);
	_tmp16_ = _tmp15_;
	g_notification_set_default_action_and_target_value (notification, "show-item", _tmp16_);
	_g_variant_unref0 (_tmp16_);
	_tmp17_ = objects_reminder_get_item_id (reminder);
	_tmp18_ = _tmp17_;
	_tmp19_ = g_variant_new_string (_tmp18_);
	g_variant_ref_sink (_tmp19_);
	_tmp20_ = _tmp19_;
	g_notification_add_button_with_target_value (notification, _ ("Complete"), "app.complete", _tmp20_);
	_g_variant_unref0 (_tmp20_);
	_tmp21_ = objects_reminder_get_item_id (reminder);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_variant_new_string (_tmp22_);
	g_variant_ref_sink (_tmp23_);
	_tmp24_ = _tmp23_;
	g_notification_add_button_with_target_value (notification, _ ("Snooze for 10 minutes"), "app.snooze-10", _tmp24_);
	_g_variant_unref0 (_tmp24_);
	_tmp25_ = objects_reminder_get_item_id (reminder);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_variant_new_string (_tmp26_);
	g_variant_ref_sink (_tmp27_);
	_tmp28_ = _tmp27_;
	g_notification_add_button_with_target_value (notification, _ ("Snooze for 30 minutes"), "app.snooze-30", _tmp28_);
	_g_variant_unref0 (_tmp28_);
	_tmp29_ = objects_reminder_get_item_id (reminder);
	_tmp30_ = _tmp29_;
	_tmp31_ = g_variant_new_string (_tmp30_);
	g_variant_ref_sink (_tmp31_);
	_tmp32_ = _tmp31_;
	g_notification_add_button_with_target_value (notification, _ ("Snooze for 1 hour"), "app.snooze-60", _tmp32_);
	_g_variant_unref0 (_tmp32_);
	result = notification;
	return result;
}

ServicesNotification*
services_notification_construct (GType object_type)
{
	ServicesNotification * self = NULL;
	self = (ServicesNotification*) g_object_new (object_type, NULL);
	return self;
}

ServicesNotification*
services_notification_new (void)
{
	return services_notification_construct (SERVICES_TYPE_NOTIFICATION);
}

static GObject *
services_notification_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ServicesNotification * self;
	parent_class = G_OBJECT_CLASS (services_notification_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_TYPE_NOTIFICATION, ServicesNotification);
	services_notification_regresh (self);
	return obj;
}

static void
services_notification_class_init (ServicesNotificationClass * klass,
                                  gpointer klass_data)
{
	services_notification_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesNotification_private_offset);
	G_OBJECT_CLASS (klass)->constructor = services_notification_constructor;
	G_OBJECT_CLASS (klass)->finalize = services_notification_finalize;
}

static void
services_notification_instance_init (ServicesNotification * self,
                                     gpointer klass)
{
	self->priv = services_notification_get_instance_private (self);
}

static void
services_notification_finalize (GObject * obj)
{
	ServicesNotification * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_TYPE_NOTIFICATION, ServicesNotification);
	_g_object_unref0 (self->priv->reminders);
	G_OBJECT_CLASS (services_notification_parent_class)->finalize (obj);
}

static GType
services_notification_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesNotificationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_notification_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesNotification), 0, (GInstanceInitFunc) services_notification_instance_init, NULL };
	GType services_notification_type_id;
	services_notification_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesNotification", &g_define_type_info, 0);
	ServicesNotification_private_offset = g_type_add_instance_private (services_notification_type_id, sizeof (ServicesNotificationPrivate));
	return services_notification_type_id;
}

GType
services_notification_get_type (void)
{
	static volatile gsize services_notification_type_id__once = 0;
	if (g_once_init_enter (&services_notification_type_id__once)) {
		GType services_notification_type_id;
		services_notification_type_id = services_notification_get_type_once ();
		g_once_init_leave (&services_notification_type_id__once, services_notification_type_id);
	}
	return services_notification_type_id__once;
}

