/* NotificationRequests.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from NotificationRequests.vala, do not modify */

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gee.h>
#include <json-glib/json-glib.h>
#include <libsoup/soup.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 TUBA_VIEWS_TYPE_BASE (tuba_views_base_get_type ())
#define TUBA_VIEWS_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_BASE, TubaViewsBase))
#define TUBA_VIEWS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_BASE, TubaViewsBaseClass))
#define TUBA_VIEWS_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_BASE))
#define TUBA_VIEWS_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_BASE))
#define TUBA_VIEWS_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_BASE, TubaViewsBaseClass))

typedef struct _TubaViewsBase TubaViewsBase;
typedef struct _TubaViewsBaseClass TubaViewsBaseClass;
typedef struct _TubaViewsBasePrivate TubaViewsBasePrivate;

#define TUBA_VIEWS_TYPE_CONTENT_BASE (tuba_views_content_base_get_type ())
#define TUBA_VIEWS_CONTENT_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_CONTENT_BASE, TubaViewsContentBase))
#define TUBA_VIEWS_CONTENT_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_CONTENT_BASE, TubaViewsContentBaseClass))
#define TUBA_VIEWS_IS_CONTENT_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_CONTENT_BASE))
#define TUBA_VIEWS_IS_CONTENT_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_CONTENT_BASE))
#define TUBA_VIEWS_CONTENT_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_CONTENT_BASE, TubaViewsContentBaseClass))

typedef struct _TubaViewsContentBase TubaViewsContentBase;
typedef struct _TubaViewsContentBaseClass TubaViewsContentBaseClass;
typedef struct _TubaViewsContentBasePrivate TubaViewsContentBasePrivate;

#define TUBA_TYPE_ACCOUNT_HOLDER (tuba_account_holder_get_type ())
#define TUBA_ACCOUNT_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_HOLDER, TubaAccountHolder))
#define TUBA_IS_ACCOUNT_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_HOLDER))
#define TUBA_ACCOUNT_HOLDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_ACCOUNT_HOLDER, TubaAccountHolderIface))

typedef struct _TubaAccountHolder TubaAccountHolder;
typedef struct _TubaAccountHolderIface TubaAccountHolderIface;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;

#define TUBA_TYPE_STREAMABLE (tuba_streamable_get_type ())
#define TUBA_STREAMABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_STREAMABLE, TubaStreamable))
#define TUBA_IS_STREAMABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_STREAMABLE))
#define TUBA_STREAMABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_STREAMABLE, TubaStreamableIface))

typedef struct _TubaStreamable TubaStreamable;
typedef struct _TubaStreamableIface TubaStreamableIface;

#define TUBA_VIEWS_TYPE_TIMELINE (tuba_views_timeline_get_type ())
#define TUBA_VIEWS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimeline))
#define TUBA_VIEWS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimelineClass))
#define TUBA_VIEWS_IS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_TIMELINE))
#define TUBA_VIEWS_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_TIMELINE))
#define TUBA_VIEWS_TIMELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimelineClass))

typedef struct _TubaViewsTimeline TubaViewsTimeline;
typedef struct _TubaViewsTimelineClass TubaViewsTimelineClass;
typedef struct _TubaViewsTimelinePrivate TubaViewsTimelinePrivate;

#define TUBA_TYPE_REQUEST (tuba_request_get_type ())
#define TUBA_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_REQUEST, TubaRequest))
#define TUBA_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_REQUEST, TubaRequestClass))
#define TUBA_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_REQUEST))
#define TUBA_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_REQUEST))
#define TUBA_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_REQUEST, TubaRequestClass))

typedef struct _TubaRequest TubaRequest;
typedef struct _TubaRequestClass TubaRequestClass;

#define TUBA_STREAMABLE_TYPE_EVENT (tuba_streamable_event_get_type ())
typedef struct _TubaStreamableEvent TubaStreamableEvent;

#define TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS (tuba_views_notification_requests_get_type ())
#define TUBA_VIEWS_NOTIFICATION_REQUESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS, TubaViewsNotificationRequests))
#define TUBA_VIEWS_NOTIFICATION_REQUESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS, TubaViewsNotificationRequestsClass))
#define TUBA_VIEWS_IS_NOTIFICATION_REQUESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS))
#define TUBA_VIEWS_IS_NOTIFICATION_REQUESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS))
#define TUBA_VIEWS_NOTIFICATION_REQUESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS, TubaViewsNotificationRequestsClass))

typedef struct _TubaViewsNotificationRequests TubaViewsNotificationRequests;
typedef struct _TubaViewsNotificationRequestsClass TubaViewsNotificationRequestsClass;
typedef struct _TubaViewsNotificationRequestsPrivate TubaViewsNotificationRequestsPrivate;
enum  {
	TUBA_VIEWS_NOTIFICATION_REQUESTS_0_PROPERTY,
	TUBA_VIEWS_NOTIFICATION_REQUESTS_NUM_PROPERTIES
};
static GParamSpec* tuba_views_notification_requests_properties[TUBA_VIEWS_NOTIFICATION_REQUESTS_NUM_PROPERTIES];

#define TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST (tuba_widgets_notification_request_get_type ())
#define TUBA_WIDGETS_NOTIFICATION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST, TubaWidgetsNotificationRequest))
#define TUBA_WIDGETS_NOTIFICATION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST, TubaWidgetsNotificationRequestClass))
#define TUBA_WIDGETS_IS_NOTIFICATION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST))
#define TUBA_WIDGETS_IS_NOTIFICATION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST))
#define TUBA_WIDGETS_NOTIFICATION_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST, TubaWidgetsNotificationRequestClass))

typedef struct _TubaWidgetsNotificationRequest TubaWidgetsNotificationRequest;
typedef struct _TubaWidgetsNotificationRequestClass TubaWidgetsNotificationRequestClass;

#define TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST (tuba_api_notification_filter_request_get_type ())
#define TUBA_API_NOTIFICATION_FILTER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST, TubaAPINotificationFilterRequest))
#define TUBA_API_NOTIFICATION_FILTER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST, TubaAPINotificationFilterRequestClass))
#define TUBA_API_NOTIFICATION_FILTER_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST))
#define TUBA_API_NOTIFICATION_FILTER_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST))
#define TUBA_API_NOTIFICATION_FILTER_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST, TubaAPINotificationFilterRequestClass))

typedef struct _TubaAPINotificationFilterRequest TubaAPINotificationFilterRequest;
typedef struct _TubaAPINotificationFilterRequestClass TubaAPINotificationFilterRequestClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block87Data Block87Data;
typedef struct _TubaWidgetsNotificationRequestPrivate TubaWidgetsNotificationRequestPrivate;
typedef void (*TubaNetworkSuccessCallback) (GInputStream* in_stream, SoupMessageHeaders* response_headers, gpointer user_data, GError** error);

#define TUBA_TYPE_ACCOUNT_STORE (tuba_account_store_get_type ())
#define TUBA_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStore))
#define TUBA_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))
#define TUBA_IS_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_IS_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_ACCOUNT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))

typedef struct _TubaAccountStore TubaAccountStore;
typedef struct _TubaAccountStoreClass TubaAccountStoreClass;
typedef void (*TubaNetworkErrorCallback) (gint32 code, const gchar* reason, gpointer user_data);

struct _TubaViewsBase {
	AdwBreakpointBin parent_instance;
	TubaViewsBasePrivate * priv;
	AdwHeaderBar* header;
	AdwToolbarView* toolbar_view;
	GtkScrolledWindow* scrolled;
	GtkOverlay* scrolled_overlay;
	GtkRevealer* scroll_to_top_rev;
	GtkButton* scroll_to_top;
	GtkStack* states;
	AdwClamp* content_box;
	GtkButton* status_button;
};

struct _TubaViewsBaseClass {
	AdwBreakpointBinClass parent_class;
	void (*scroll_page) (TubaViewsBase* self, gboolean up);
	void (*unbind_listboxes) (TubaViewsBase* self);
	void (*build_actions) (TubaViewsBase* self);
	void (*build_header) (TubaViewsBase* self);
	void (*clear) (TubaViewsBase* self);
	void (*on_shown) (TubaViewsBase* self);
	void (*on_hidden) (TubaViewsBase* self);
	void (*on_content_changed) (TubaViewsBase* self);
	void (*on_error) (TubaViewsBase* self, gint32 code, const gchar* reason);
};

struct _TubaViewsContentBase {
	TubaViewsBase parent_instance;
	TubaViewsContentBasePrivate * priv;
	GtkListBox* content;
	GListStore* model;
};

struct _TubaViewsContentBaseClass {
	TubaViewsBaseClass parent_class;
	void (*on_scrolled_vadjustment_value_change) (TubaViewsContentBase* self);
	void (*clear_all_but_first) (TubaViewsContentBase* self, gint i);
	GtkWidget* (*on_create_model_widget) (TubaViewsContentBase* self, GObject* obj);
	void (*on_bottom_reached) (TubaViewsContentBase* self);
	void (*on_content_item_activated) (TubaViewsContentBase* self, GtkListBoxRow* row);
	gboolean (*get_empty) (TubaViewsContentBase* self);
};

struct _TubaAccountHolderIface {
	GTypeInterface parent_iface;
	void (*on_account_changed) (TubaAccountHolder* self, TubaInstanceAccount* acc);
	void (*on_accounts_changed) (TubaAccountHolder* self, GeeArrayList* accounts);
	TubaInstanceAccount* (*get_account) (TubaAccountHolder* self);
	void (*set_account) (TubaAccountHolder* self, TubaInstanceAccount* value);
};

struct _TubaStreamableIface {
	GTypeInterface parent_iface;
	gchar* (*get_stream_url) (TubaStreamable* self);
	void (*on_streaming_policy_changed) (TubaStreamable* self);
	const gchar* (*get_t_connection_url) (TubaStreamable* self);
	void (*set_t_connection_url) (TubaStreamable* self, const gchar* value);
	gboolean (*get_subscribed) (TubaStreamable* self);
	void (*set_subscribed) (TubaStreamable* self, gboolean value);
};

struct _TubaStreamableEvent {
	gchar* type;
	JsonNode* payload;
};

struct _TubaViewsTimeline {
	TubaViewsContentBase parent_instance;
	TubaViewsTimelinePrivate * priv;
};

struct _TubaViewsTimelineClass {
	TubaViewsContentBaseClass parent_class;
	gchar* (*get_req_url) (TubaViewsTimeline* self);
	TubaRequest* (*append_params) (TubaViewsTimeline* self, TubaRequest* req);
	void (*on_request_finish) (TubaViewsTimeline* self);
	gboolean (*request) (TubaViewsTimeline* self);
	void (*on_refresh) (TubaViewsTimeline* self);
	void (*on_manual_refresh) (TubaViewsTimeline* self);
	void (*on_account_changed) (TubaViewsTimeline* self, TubaInstanceAccount* acc);
	gchar* (*get_stream_url) (TubaViewsTimeline* self);
	gboolean (*should_hide) (TubaViewsTimeline* self, TubaEntity* entity);
	void (*on_new_post) (TubaViewsTimeline* self, TubaStreamableEvent* ev);
	void (*on_edit_post) (TubaViewsTimeline* self, TubaStreamableEvent* ev);
	void (*on_delete_post) (TubaViewsTimeline* self, TubaStreamableEvent* ev);
	void (*on_remove_user) (TubaViewsTimeline* self, const gchar* user_id);
};

struct _TubaViewsNotificationRequests {
	TubaViewsTimeline parent_instance;
	TubaViewsNotificationRequestsPrivate * priv;
};

struct _TubaViewsNotificationRequestsClass {
	TubaViewsTimelineClass parent_class;
};

struct _Block87Data {
	int _ref_count_;
	TubaViewsNotificationRequests* self;
	TubaWidgetsNotificationRequest* wdg;
	TubaAPINotificationFilterRequest* api_req;
};

struct _TubaWidgetsNotificationRequest {
	GtkListBoxRow parent_instance;
	TubaWidgetsNotificationRequestPrivate * priv;
	GtkBox* btns_box;
};

struct _TubaWidgetsNotificationRequestClass {
	GtkListBoxRowClass parent_class;
};

static gpointer tuba_views_notification_requests_parent_class = NULL;
VALA_EXTERN TubaAccountStore* tuba_accounts;

VALA_EXTERN GType tuba_views_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsBase, g_object_unref)
VALA_EXTERN GType tuba_views_content_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsContentBase, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN GType tuba_account_holder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountHolder, g_object_unref)
VALA_EXTERN GType tuba_streamable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaStreamable, g_object_unref)
VALA_EXTERN GType tuba_views_timeline_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsTimeline, g_object_unref)
VALA_EXTERN GType tuba_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequest, g_object_unref)
VALA_EXTERN GType tuba_streamable_event_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaStreamableEvent* tuba_streamable_event_dup (const TubaStreamableEvent* self);
VALA_EXTERN void tuba_streamable_event_free (TubaStreamableEvent* self);
VALA_EXTERN void tuba_streamable_event_copy (const TubaStreamableEvent* self,
                                 TubaStreamableEvent* dest);
VALA_EXTERN void tuba_streamable_event_destroy (TubaStreamableEvent* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaStreamableEvent, tuba_streamable_event_destroy)
VALA_EXTERN GType tuba_views_notification_requests_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsNotificationRequests, g_object_unref)
VALA_EXTERN GtkWidget* tuba_views_content_base_on_create_model_widget (TubaViewsContentBase* self,
                                                           GObject* obj);
VALA_EXTERN void tuba_views_content_base_on_content_item_activated (TubaViewsContentBase* self,
                                                        GtkListBoxRow* row);
static GtkWidget* tuba_views_notification_requests_real_on_create_model_widget (TubaViewsContentBase* base,
                                                                         GObject* obj);
VALA_EXTERN GType tuba_widgets_notification_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsNotificationRequest, g_object_unref)
VALA_EXTERN GType tuba_api_notification_filter_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPINotificationFilterRequest, g_object_unref)
static void tuba_views_notification_requests_on_response (TubaViewsNotificationRequests* self,
                                                   TubaWidgetsNotificationRequest* wdg,
                                                   TubaRequest* req,
                                                   TubaAPINotificationFilterRequest* api_req);
static void _tuba_views_notification_requests_on_response_tuba_widgets_notification_request_dismissed (TubaWidgetsNotificationRequest* _sender,
                                                                                                TubaRequest* req,
                                                                                                TubaAPINotificationFilterRequest* api_req,
                                                                                                gpointer self);
static void _tuba_views_notification_requests_on_response_tuba_widgets_notification_request_accepted (TubaWidgetsNotificationRequest* _sender,
                                                                                               TubaRequest* req,
                                                                                               TubaAPINotificationFilterRequest* api_req,
                                                                                               gpointer self);
static Block87Data* block87_data_ref (Block87Data* _data87_);
static void block87_data_unref (void * _userdata_);
VALA_EXTERN TubaRequest* tuba_request_then (TubaRequest* self,
                                TubaNetworkSuccessCallback cb,
                                gpointer cb_target,
                                GDestroyNotify cb_target_destroy_notify);
static void __lambda268_ (Block87Data* _data87_,
                   GInputStream* in_stream,
                   GError** error);
VALA_EXTERN GType tuba_account_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountStore, g_object_unref)
VALA_EXTERN TubaInstanceAccount* tuba_account_store_get_active (TubaAccountStore* self);
VALA_EXTERN gint tuba_instance_account_get_filtered_notifications_count (TubaInstanceAccount* self);
VALA_EXTERN const gchar* tuba_api_notification_filter_request_get_notifications_count (TubaAPINotificationFilterRequest* self);
VALA_EXTERN void tuba_instance_account_set_filtered_notifications_count (TubaInstanceAccount* self,
                                                             gint value);
static void ___lambda268__tuba_network_success_callback (GInputStream* in_stream,
                                                  SoupMessageHeaders* response_headers,
                                                  gpointer self,
                                                  GError** error);
VALA_EXTERN TubaRequest* tuba_request_on_error (TubaRequest* self,
                                    TubaNetworkErrorCallback cb,
                                    gpointer cb_target,
                                    GDestroyNotify cb_target_destroy_notify);
static void __lambda269_ (Block87Data* _data87_);
static void ___lambda269__tuba_network_error_callback (gint32 code,
                                                const gchar* reason,
                                                gpointer self);
VALA_EXTERN TubaRequest* tuba_request_exec (TubaRequest* self);
static void tuba_views_notification_requests_real_on_content_item_activated (TubaViewsContentBase* base,
                                                                      GtkListBoxRow* row);
VALA_EXTERN void tuba_widgets_notification_request_open (TubaWidgetsNotificationRequest* self);
VALA_EXTERN TubaViewsNotificationRequests* tuba_views_notification_requests_new (void);
VALA_EXTERN TubaViewsNotificationRequests* tuba_views_notification_requests_construct (GType object_type);
VALA_EXTERN TubaViewsTimeline* tuba_views_timeline_new (void);
VALA_EXTERN TubaViewsTimeline* tuba_views_timeline_construct (GType object_type);
static GObject * tuba_views_notification_requests_constructor (GType type,
                                                        guint n_construct_properties,
                                                        GObjectConstructParam * construct_properties);
VALA_EXTERN void tuba_views_timeline_set_url (TubaViewsTimeline* self,
                                  const gchar* value);
VALA_EXTERN void tuba_views_base_set_label (TubaViewsBase* self,
                                const gchar* value);
VALA_EXTERN void tuba_views_base_set_icon (TubaViewsBase* self,
                               const gchar* value);
VALA_EXTERN void tuba_views_timeline_set_accepts (TubaViewsTimeline* self,
                                      GType value);
VALA_EXTERN void tuba_views_base_set_empty_state_title (TubaViewsBase* self,
                                            const gchar* value);
VALA_EXTERN void tuba_views_timeline_set_batch_size_min (TubaViewsTimeline* self,
                                             gint value);
static GType tuba_views_notification_requests_get_type_once (void);

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

static void
_tuba_views_notification_requests_on_response_tuba_widgets_notification_request_dismissed (TubaWidgetsNotificationRequest* _sender,
                                                                                           TubaRequest* req,
                                                                                           TubaAPINotificationFilterRequest* api_req,
                                                                                           gpointer self)
{
	tuba_views_notification_requests_on_response ((TubaViewsNotificationRequests*) self, _sender, req, api_req);
}

static void
_tuba_views_notification_requests_on_response_tuba_widgets_notification_request_accepted (TubaWidgetsNotificationRequest* _sender,
                                                                                          TubaRequest* req,
                                                                                          TubaAPINotificationFilterRequest* api_req,
                                                                                          gpointer self)
{
	tuba_views_notification_requests_on_response ((TubaViewsNotificationRequests*) self, _sender, req, api_req);
}

static GtkWidget*
tuba_views_notification_requests_real_on_create_model_widget (TubaViewsContentBase* base,
                                                              GObject* obj)
{
	TubaViewsNotificationRequests * self;
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_;
	TubaWidgetsNotificationRequest* widget_notification_req = NULL;
	GtkWidget* _tmp1_;
	TubaWidgetsNotificationRequest* _tmp2_;
	TubaWidgetsNotificationRequest* _tmp3_;
	GtkWidget* result;
	self = (TubaViewsNotificationRequests*) base;
	g_return_val_if_fail (obj != NULL, NULL);
	_tmp0_ = TUBA_VIEWS_CONTENT_BASE_CLASS (tuba_views_notification_requests_parent_class)->on_create_model_widget ((TubaViewsContentBase*) G_TYPE_CHECK_INSTANCE_CAST (self, TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimeline), obj);
	widget = _tmp0_;
	_tmp1_ = widget;
	_tmp2_ = _g_object_ref0 (TUBA_WIDGETS_IS_NOTIFICATION_REQUEST (_tmp1_) ? ((TubaWidgetsNotificationRequest*) _tmp1_) : NULL);
	widget_notification_req = _tmp2_;
	_tmp3_ = widget_notification_req;
	if (_tmp3_ != NULL) {
		TubaWidgetsNotificationRequest* _tmp4_;
		TubaWidgetsNotificationRequest* _tmp5_;
		_tmp4_ = widget_notification_req;
		g_signal_connect_object (_tmp4_, "dismissed", (GCallback) _tuba_views_notification_requests_on_response_tuba_widgets_notification_request_dismissed, self, 0);
		_tmp5_ = widget_notification_req;
		g_signal_connect_object (_tmp5_, "accepted", (GCallback) _tuba_views_notification_requests_on_response_tuba_widgets_notification_request_accepted, self, 0);
	}
	result = widget;
	_g_object_unref0 (widget_notification_req);
	return result;
}

static Block87Data*
block87_data_ref (Block87Data* _data87_)
{
	g_atomic_int_inc (&_data87_->_ref_count_);
	return _data87_;
}

static void
block87_data_unref (void * _userdata_)
{
	Block87Data* _data87_;
	_data87_ = (Block87Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data87_->_ref_count_)) {
		TubaViewsNotificationRequests* self;
		self = _data87_->self;
		_g_object_unref0 (_data87_->wdg);
		_g_object_unref0 (_data87_->api_req);
		_g_object_unref0 (self);
		g_slice_free (Block87Data, _data87_);
	}
}

static void
__lambda268_ (Block87Data* _data87_,
              GInputStream* in_stream,
              GError** error)
{
	TubaViewsNotificationRequests* self;
	guint indx = 0U;
	gboolean found = FALSE;
	GListStore* _tmp0_;
	guint _tmp1_ = 0U;
	gboolean _tmp2_;
	self = _data87_->self;
	g_return_if_fail (in_stream != NULL);
	_tmp0_ = ((TubaViewsContentBase*) self)->model;
	_tmp2_ = g_list_store_find (_tmp0_, (GObject*) _data87_->api_req, &_tmp1_);
	indx = _tmp1_;
	found = _tmp2_;
	if (found) {
		GListStore* _tmp3_;
		TubaAccountStore* _tmp4_;
		TubaInstanceAccount* _tmp5_;
		TubaInstanceAccount* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp3_ = ((TubaViewsContentBase*) self)->model;
		g_list_store_remove (_tmp3_, indx);
		_tmp4_ = tuba_accounts;
		_tmp5_ = tuba_account_store_get_active (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = tuba_instance_account_get_filtered_notifications_count (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ > 0) {
			gint to_remove = 0;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			TubaAccountStore* _tmp11_;
			TubaInstanceAccount* _tmp12_;
			TubaInstanceAccount* _tmp13_;
			TubaAccountStore* _tmp14_;
			TubaInstanceAccount* _tmp15_;
			TubaInstanceAccount* _tmp16_;
			gint _tmp17_;
			gint _tmp18_;
			_tmp9_ = tuba_api_notification_filter_request_get_notifications_count (_data87_->api_req);
			_tmp10_ = _tmp9_;
			to_remove = atoi (_tmp10_);
			if (to_remove < 1) {
				to_remove = 1;
			}
			_tmp11_ = tuba_accounts;
			_tmp12_ = tuba_account_store_get_active (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = tuba_accounts;
			_tmp15_ = tuba_account_store_get_active (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = tuba_instance_account_get_filtered_notifications_count (_tmp16_);
			_tmp18_ = _tmp17_;
			tuba_instance_account_set_filtered_notifications_count (_tmp16_, _tmp18_ - to_remove);
		}
	} else {
		GtkBox* _tmp19_;
		_tmp19_ = _data87_->wdg->btns_box;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp19_, TRUE);
	}
}

static void
___lambda268__tuba_network_success_callback (GInputStream* in_stream,
                                             SoupMessageHeaders* response_headers,
                                             gpointer self,
                                             GError** error)
{
	__lambda268_ (self, in_stream, error);
}

static void
__lambda269_ (Block87Data* _data87_)
{
	TubaViewsNotificationRequests* self;
	GtkBox* _tmp0_;
	self = _data87_->self;
	_tmp0_ = _data87_->wdg->btns_box;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, TRUE);
}

static void
___lambda269__tuba_network_error_callback (gint32 code,
                                           const gchar* reason,
                                           gpointer self)
{
	__lambda269_ (self);
}

static void
tuba_views_notification_requests_on_response (TubaViewsNotificationRequests* self,
                                              TubaWidgetsNotificationRequest* wdg,
                                              TubaRequest* req,
                                              TubaAPINotificationFilterRequest* api_req)
{
	Block87Data* _data87_;
	TubaWidgetsNotificationRequest* _tmp0_;
	TubaAPINotificationFilterRequest* _tmp1_;
	GtkBox* _tmp2_;
	TubaRequest* _tmp3_;
	TubaRequest* _tmp4_;
	TubaRequest* _tmp5_;
	TubaRequest* _tmp6_;
	TubaRequest* _tmp7_;
	TubaRequest* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wdg != NULL);
	g_return_if_fail (req != NULL);
	g_return_if_fail (api_req != NULL);
	_data87_ = g_slice_new0 (Block87Data);
	_data87_->_ref_count_ = 1;
	_data87_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (wdg);
	_g_object_unref0 (_data87_->wdg);
	_data87_->wdg = _tmp0_;
	_tmp1_ = _g_object_ref0 (api_req);
	_g_object_unref0 (_data87_->api_req);
	_data87_->api_req = _tmp1_;
	_tmp2_ = _data87_->wdg->btns_box;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, FALSE);
	_tmp3_ = tuba_request_then (req, ___lambda268__tuba_network_success_callback, block87_data_ref (_data87_), block87_data_unref);
	_tmp4_ = _tmp3_;
	_tmp5_ = tuba_request_on_error (_tmp4_, ___lambda269__tuba_network_error_callback, block87_data_ref (_data87_), block87_data_unref);
	_tmp6_ = _tmp5_;
	_tmp7_ = tuba_request_exec (_tmp6_);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp8_);
	_g_object_unref0 (_tmp6_);
	_g_object_unref0 (_tmp4_);
	block87_data_unref (_data87_);
	_data87_ = NULL;
}

static void
tuba_views_notification_requests_real_on_content_item_activated (TubaViewsContentBase* base,
                                                                 GtkListBoxRow* row)
{
	TubaViewsNotificationRequests * self;
	self = (TubaViewsNotificationRequests*) base;
	g_return_if_fail (row != NULL);
	tuba_widgets_notification_request_open (G_TYPE_CHECK_INSTANCE_CAST (row, TUBA_WIDGETS_TYPE_NOTIFICATION_REQUEST, TubaWidgetsNotificationRequest));
}

TubaViewsNotificationRequests*
tuba_views_notification_requests_construct (GType object_type)
{
	TubaViewsNotificationRequests * self = NULL;
	self = (TubaViewsNotificationRequests*) tuba_views_timeline_construct (object_type);
	return self;
}

TubaViewsNotificationRequests*
tuba_views_notification_requests_new (void)
{
	return tuba_views_notification_requests_construct (TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS);
}

static GObject *
tuba_views_notification_requests_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaViewsNotificationRequests * self;
	parent_class = G_OBJECT_CLASS (tuba_views_notification_requests_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_VIEWS_TYPE_NOTIFICATION_REQUESTS, TubaViewsNotificationRequests);
	tuba_views_timeline_set_url ((TubaViewsTimeline*) self, "/api/v1/notifications/requests");
	tuba_views_base_set_label ((TubaViewsBase*) self, _ ("Filtered Notifications"));
	tuba_views_base_set_icon ((TubaViewsBase*) self, "tuba-bell-outline-symbolic");
	tuba_views_timeline_set_accepts ((TubaViewsTimeline*) self, TUBA_API_NOTIFICATION_FILTER_TYPE_REQUEST);
	tuba_views_base_set_empty_state_title ((TubaViewsBase*) self, _ ("No Filtered Notifications"));
	tuba_views_timeline_set_batch_size_min ((TubaViewsTimeline*) self, 20);
	return obj;
}

static void
tuba_views_notification_requests_class_init (TubaViewsNotificationRequestsClass * klass,
                                             gpointer klass_data)
{
	tuba_views_notification_requests_parent_class = g_type_class_peek_parent (klass);
	((TubaViewsContentBaseClass *) klass)->on_create_model_widget = (GtkWidget* (*) (TubaViewsContentBase*, GObject*)) tuba_views_notification_requests_real_on_create_model_widget;
	((TubaViewsContentBaseClass *) klass)->on_content_item_activated = (void (*) (TubaViewsContentBase*, GtkListBoxRow*)) tuba_views_notification_requests_real_on_content_item_activated;
	G_OBJECT_CLASS (klass)->constructor = tuba_views_notification_requests_constructor;
}

static void
tuba_views_notification_requests_instance_init (TubaViewsNotificationRequests * self,
                                                gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
tuba_views_notification_requests_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaViewsNotificationRequestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_views_notification_requests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaViewsNotificationRequests), 0, (GInstanceInitFunc) tuba_views_notification_requests_instance_init, NULL };
	GType tuba_views_notification_requests_type_id;
	tuba_views_notification_requests_type_id = g_type_register_static (TUBA_VIEWS_TYPE_TIMELINE, "TubaViewsNotificationRequests", &g_define_type_info, 0);
	return tuba_views_notification_requests_type_id;
}

GType
tuba_views_notification_requests_get_type (void)
{
	static gsize tuba_views_notification_requests_type_id__once = 0;
	if (g_once_init_enter (&tuba_views_notification_requests_type_id__once)) {
		GType tuba_views_notification_requests_type_id;
		tuba_views_notification_requests_type_id = tuba_views_notification_requests_get_type_once ();
		g_once_init_leave (&tuba_views_notification_requests_type_id__once, tuba_views_notification_requests_type_id);
	}
	return tuba_views_notification_requests_type_id__once;
}

