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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdio.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 SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON (sway_notification_center_widgets_toggle_button_get_type ())
#define SWAY_NOTIFICATION_CENTER_WIDGETS_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON, SwayNotificationCenterWidgetsToggleButton))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON, SwayNotificationCenterWidgetsToggleButtonClass))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_TOGGLE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON, SwayNotificationCenterWidgetsToggleButtonClass))

typedef struct _SwayNotificationCenterWidgetsToggleButton SwayNotificationCenterWidgetsToggleButton;
typedef struct _SwayNotificationCenterWidgetsToggleButtonClass SwayNotificationCenterWidgetsToggleButtonClass;
typedef struct _SwayNotificationCenterWidgetsToggleButtonPrivate SwayNotificationCenterWidgetsToggleButtonPrivate;
enum  {
	SWAY_NOTIFICATION_CENTER_WIDGETS_TOGGLE_BUTTON_0_PROPERTY,
	SWAY_NOTIFICATION_CENTER_WIDGETS_TOGGLE_BUTTON_NUM_PROPERTIES
};
static GParamSpec* sway_notification_center_widgets_toggle_button_properties[SWAY_NOTIFICATION_CENTER_WIDGETS_TOGGLE_BUTTON_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _SwayNotificationCenterWidgetsToggleButtonOnToggleData SwayNotificationCenterWidgetsToggleButtonOnToggleData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _SwayNotificationCenterWidgetsToggleButtonOnUpdateData SwayNotificationCenterWidgetsToggleButtonOnUpdateData;

struct _SwayNotificationCenterWidgetsToggleButton {
	GtkToggleButton parent_instance;
	SwayNotificationCenterWidgetsToggleButtonPrivate * priv;
};

struct _SwayNotificationCenterWidgetsToggleButtonClass {
	GtkToggleButtonClass parent_class;
};

struct _SwayNotificationCenterWidgetsToggleButtonPrivate {
	gchar* command;
	gchar* update_command;
	gulong handler_id;
};

struct _SwayNotificationCenterWidgetsToggleButtonOnToggleData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SwayNotificationCenterWidgetsToggleButton* self;
	gchar* msg;
	gchar* _tmp0_;
	gchar** env_additions;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gint env_additions_length1;
	gint _env_additions_size_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
};

struct _SwayNotificationCenterWidgetsToggleButtonOnUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SwayNotificationCenterWidgetsToggleButton* self;
	const gchar* _tmp0_;
	gchar* msg;
	gchar* _tmp1_;
	gchar** env_additions;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gint env_additions_length1;
	gint _env_additions_size_;
	const gchar* _tmp9_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gchar* _tmp11_;
	GRegex* regex;
	GRegex* _tmp12_;
	gchar* res;
	GRegex* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gboolean _tmp22_;
	GError* e;
	FILE* _tmp23_;
	GError* _tmp24_;
	const gchar* _tmp25_;
	GError* _inner_error0_;
};

static gint SwayNotificationCenterWidgetsToggleButton_private_offset;
static gpointer sway_notification_center_widgets_toggle_button_parent_class = NULL;

VALA_EXTERN GType sway_notification_center_widgets_toggle_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwayNotificationCenterWidgetsToggleButton, g_object_unref)
VALA_EXTERN SwayNotificationCenterWidgetsToggleButton* sway_notification_center_widgets_toggle_button_new (const gchar* label,
                                                                                               const gchar* command,
                                                                                               const gchar* update_command,
                                                                                               gboolean active);
VALA_EXTERN SwayNotificationCenterWidgetsToggleButton* sway_notification_center_widgets_toggle_button_construct (GType object_type,
                                                                                                     const gchar* label,
                                                                                                     const gchar* command,
                                                                                                     const gchar* update_command,
                                                                                                     gboolean active);
static void sway_notification_center_widgets_toggle_button_on_toggle (SwayNotificationCenterWidgetsToggleButton* self,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static void sway_notification_center_widgets_toggle_button_on_toggle_finish (SwayNotificationCenterWidgetsToggleButton* self,
                                                                      GAsyncResult* _res_);
static void _sway_notification_center_widgets_toggle_button_on_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                          gpointer self);
static void sway_notification_center_widgets_toggle_button_on_toggle_data_free (gpointer _data);
static gboolean sway_notification_center_widgets_toggle_button_on_toggle_co (SwayNotificationCenterWidgetsToggleButtonOnToggleData* _data_);
VALA_EXTERN void sway_notification_center_functions_execute_command (const gchar* cmd,
                                                         gchar** env_additions,
                                                         gint env_additions_length1,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
VALA_EXTERN gboolean sway_notification_center_functions_execute_command_finish (GAsyncResult* _res_,
                                                                    gchar** msg);
static void sway_notification_center_widgets_toggle_button_on_toggle_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
static void sway_notification_center_widgets_toggle_button_on_update_data_free (gpointer _data);
VALA_EXTERN void sway_notification_center_widgets_toggle_button_on_update (SwayNotificationCenterWidgetsToggleButton* self,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
VALA_EXTERN void sway_notification_center_widgets_toggle_button_on_update_finish (SwayNotificationCenterWidgetsToggleButton* self,
                                                                      GAsyncResult* _res_);
static gboolean sway_notification_center_widgets_toggle_button_on_update_co (SwayNotificationCenterWidgetsToggleButtonOnUpdateData* _data_);
static void sway_notification_center_widgets_toggle_button_on_update_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
static void sway_notification_center_widgets_toggle_button_finalize (GObject * obj);
static GType sway_notification_center_widgets_toggle_button_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
sway_notification_center_widgets_toggle_button_get_instance_private (SwayNotificationCenterWidgetsToggleButton* self)
{
	return G_STRUCT_MEMBER_P (self, SwayNotificationCenterWidgetsToggleButton_private_offset);
}

static void
_sway_notification_center_widgets_toggle_button_on_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                     gpointer self)
{
	sway_notification_center_widgets_toggle_button_on_toggle ((SwayNotificationCenterWidgetsToggleButton*) self, NULL, NULL);
}

SwayNotificationCenterWidgetsToggleButton*
sway_notification_center_widgets_toggle_button_construct (GType object_type,
                                                          const gchar* label,
                                                          const gchar* command,
                                                          const gchar* update_command,
                                                          gboolean active)
{
	SwayNotificationCenterWidgetsToggleButton * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gulong _tmp2_;
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (command != NULL, NULL);
	g_return_val_if_fail (update_command != NULL, NULL);
	self = (SwayNotificationCenterWidgetsToggleButton*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (command);
	_g_free0 (self->priv->command);
	self->priv->command = _tmp0_;
	_tmp1_ = g_strdup (update_command);
	_g_free0 (self->priv->update_command);
	self->priv->update_command = _tmp1_;
	gtk_button_set_label (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_button_get_type (), GtkButton), label);
	gtk_button_set_has_frame (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_button_get_type (), GtkButton), TRUE);
	if (active) {
		gtk_toggle_button_set_active (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_toggle_button_get_type (), GtkToggleButton), TRUE);
	}
	_tmp2_ = g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_toggle_button_get_type (), GtkToggleButton), "toggled", (GCallback) _sway_notification_center_widgets_toggle_button_on_toggle_gtk_toggle_button_toggled, self, 0);
	self->priv->handler_id = _tmp2_;
	return self;
}

SwayNotificationCenterWidgetsToggleButton*
sway_notification_center_widgets_toggle_button_new (const gchar* label,
                                                    const gchar* command,
                                                    const gchar* update_command,
                                                    gboolean active)
{
	return sway_notification_center_widgets_toggle_button_construct (SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON, label, command, update_command, active);
}

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

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

static void
sway_notification_center_widgets_toggle_button_on_toggle (SwayNotificationCenterWidgetsToggleButton* self,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	SwayNotificationCenterWidgetsToggleButtonOnToggleData* _data_;
	SwayNotificationCenterWidgetsToggleButton* _tmp0_;
	g_return_if_fail (SWAY_NOTIFICATION_CENTER_WIDGETS_IS_TOGGLE_BUTTON (self));
	_data_ = g_slice_new0 (SwayNotificationCenterWidgetsToggleButtonOnToggleData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sway_notification_center_widgets_toggle_button_on_toggle_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sway_notification_center_widgets_toggle_button_on_toggle_co (_data_);
}

static void
sway_notification_center_widgets_toggle_button_on_toggle_finish (SwayNotificationCenterWidgetsToggleButton* self,
                                                                 GAsyncResult* _res_)
{
	SwayNotificationCenterWidgetsToggleButtonOnToggleData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

static void
sway_notification_center_widgets_toggle_button_on_toggle_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	SwayNotificationCenterWidgetsToggleButtonOnToggleData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sway_notification_center_widgets_toggle_button_on_toggle_co (_data_);
}

static gboolean
sway_notification_center_widgets_toggle_button_on_toggle_co (SwayNotificationCenterWidgetsToggleButtonOnToggleData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup ("");
	_data_->msg = _data_->_tmp0_;
	_data_->_tmp1_ = gtk_toggle_button_get_active (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, gtk_toggle_button_get_type (), GtkToggleButton));
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = bool_to_string (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = g_strconcat ("SWAYNC_TOGGLE_STATE=", _data_->_tmp4_, NULL);
	_data_->_tmp6_ = g_new0 (gchar*, 1 + 1);
	_data_->_tmp6_[0] = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp7__length1 = 1;
	_g_free0 (_data_->_tmp4_);
	_data_->env_additions = _data_->_tmp7_;
	_data_->env_additions_length1 = _data_->_tmp7__length1;
	_data_->_env_additions_size_ = _data_->env_additions_length1;
	_data_->_tmp8_ = _data_->self->priv->command;
	_data_->_tmp9_ = NULL;
	_data_->_state_ = 1;
	sway_notification_center_functions_execute_command (_data_->_tmp8_, _data_->env_additions, (gint) _data_->env_additions_length1, sway_notification_center_widgets_toggle_button_on_toggle_ready, _data_);
	return FALSE;
	_state_1:
	sway_notification_center_functions_execute_command_finish (_data_->_res_, &_data_->_tmp9_);
	_g_free0 (_data_->msg);
	_data_->msg = _data_->_tmp9_;
	_data_->env_additions = (_vala_array_free (_data_->env_additions, _data_->env_additions_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_data_->msg);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
sway_notification_center_widgets_toggle_button_on_update (SwayNotificationCenterWidgetsToggleButton* self,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	SwayNotificationCenterWidgetsToggleButtonOnUpdateData* _data_;
	SwayNotificationCenterWidgetsToggleButton* _tmp0_;
	g_return_if_fail (SWAY_NOTIFICATION_CENTER_WIDGETS_IS_TOGGLE_BUTTON (self));
	_data_ = g_slice_new0 (SwayNotificationCenterWidgetsToggleButtonOnUpdateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sway_notification_center_widgets_toggle_button_on_update_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sway_notification_center_widgets_toggle_button_on_update_co (_data_);
}

void
sway_notification_center_widgets_toggle_button_on_update_finish (SwayNotificationCenterWidgetsToggleButton* self,
                                                                 GAsyncResult* _res_)
{
	SwayNotificationCenterWidgetsToggleButtonOnUpdateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
sway_notification_center_widgets_toggle_button_on_update_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	SwayNotificationCenterWidgetsToggleButtonOnUpdateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sway_notification_center_widgets_toggle_button_on_update_co (_data_);
}

static gboolean
sway_notification_center_widgets_toggle_button_on_update_co (SwayNotificationCenterWidgetsToggleButtonOnUpdateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->update_command;
	if (g_strcmp0 (_data_->_tmp0_, "") == 0) {
		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;
	}
	_data_->_tmp1_ = g_strdup ("");
	_data_->msg = _data_->_tmp1_;
	_data_->_tmp2_ = gtk_toggle_button_get_active (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, gtk_toggle_button_get_type (), GtkToggleButton));
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = bool_to_string (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = g_strconcat ("SWAYNC_TOGGLE_STATE=", _data_->_tmp5_, NULL);
	_data_->_tmp7_ = g_new0 (gchar*, 1 + 1);
	_data_->_tmp7_[0] = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp8__length1 = 1;
	_g_free0 (_data_->_tmp5_);
	_data_->env_additions = _data_->_tmp8_;
	_data_->env_additions_length1 = _data_->_tmp8__length1;
	_data_->_env_additions_size_ = _data_->env_additions_length1;
	_data_->_tmp9_ = _data_->self->priv->update_command;
	_data_->_tmp10_ = _data_->env_additions;
	_data_->_tmp10__length1 = _data_->env_additions_length1;
	_data_->_tmp11_ = NULL;
	_data_->_state_ = 1;
	sway_notification_center_functions_execute_command (_data_->_tmp9_, _data_->_tmp10_, (gint) _data_->_tmp10__length1, sway_notification_center_widgets_toggle_button_on_update_ready, _data_);
	return FALSE;
	_state_1:
	sway_notification_center_functions_execute_command_finish (_data_->_res_, &_data_->_tmp11_);
	_g_free0 (_data_->msg);
	_data_->msg = _data_->_tmp11_;
	{
		_data_->_tmp12_ = g_regex_new ("\\s+$", 0, 0, &_data_->_inner_error0_);
		_data_->regex = _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_data_->env_additions = (_vala_array_free (_data_->env_additions, _data_->env_additions_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (_data_->msg);
			g_critical ("file %s: line %d: unexpected 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_->_tmp13_ = _data_->regex;
		_data_->_tmp14_ = _data_->msg;
		_data_->_tmp15_ = _data_->msg;
		_data_->_tmp16_ = strlen (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = g_regex_replace (_data_->_tmp13_, _data_->_tmp14_, (gssize) _data_->_tmp17_, 0, "", 0, &_data_->_inner_error0_);
		_data_->res = _data_->_tmp18_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_regex_unref0 (_data_->regex);
			if (_data_->_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_data_->env_additions = (_vala_array_free (_data_->env_additions, _data_->env_additions_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (_data_->msg);
			g_critical ("file %s: line %d: unexpected 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;
		}
		g_signal_handler_block (_data_->self, _data_->self->priv->handler_id);
		_data_->_tmp19_ = _data_->res;
		_data_->_tmp20_ = g_utf8_strup (_data_->_tmp19_, (gssize) -1);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = g_strcmp0 (_data_->_tmp21_, "TRUE") == 0;
		_g_free0 (_data_->_tmp21_);
		if (_data_->_tmp22_) {
			gtk_toggle_button_set_active (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, gtk_toggle_button_get_type (), GtkToggleButton), TRUE);
		} else {
			gtk_toggle_button_set_active (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, gtk_toggle_button_get_type (), GtkToggleButton), FALSE);
		}
		g_signal_handler_unblock (_data_->self, _data_->self->priv->handler_id);
		_g_free0 (_data_->res);
		_g_regex_unref0 (_data_->regex);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp23_ = stderr;
		_data_->_tmp24_ = _data_->e;
		_data_->_tmp25_ = _data_->_tmp24_->message;
		fprintf (_data_->_tmp23_, "RegexError: %s\n", _data_->_tmp25_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_data_->env_additions = (_vala_array_free (_data_->env_additions, _data_->env_additions_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->msg);
		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_->env_additions = (_vala_array_free (_data_->env_additions, _data_->env_additions_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_data_->msg);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
sway_notification_center_widgets_toggle_button_class_init (SwayNotificationCenterWidgetsToggleButtonClass * klass,
                                                           gpointer klass_data)
{
	sway_notification_center_widgets_toggle_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwayNotificationCenterWidgetsToggleButton_private_offset);
	G_OBJECT_CLASS (klass)->finalize = sway_notification_center_widgets_toggle_button_finalize;
}

static void
sway_notification_center_widgets_toggle_button_instance_init (SwayNotificationCenterWidgetsToggleButton * self,
                                                              gpointer klass)
{
	self->priv = sway_notification_center_widgets_toggle_button_get_instance_private (self);
}

static void
sway_notification_center_widgets_toggle_button_finalize (GObject * obj)
{
	SwayNotificationCenterWidgetsToggleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_TOGGLE_BUTTON, SwayNotificationCenterWidgetsToggleButton);
	_g_free0 (self->priv->command);
	_g_free0 (self->priv->update_command);
	G_OBJECT_CLASS (sway_notification_center_widgets_toggle_button_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
sway_notification_center_widgets_toggle_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwayNotificationCenterWidgetsToggleButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sway_notification_center_widgets_toggle_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwayNotificationCenterWidgetsToggleButton), 0, (GInstanceInitFunc) sway_notification_center_widgets_toggle_button_instance_init, NULL };
	GType sway_notification_center_widgets_toggle_button_type_id;
	sway_notification_center_widgets_toggle_button_type_id = g_type_register_static (gtk_toggle_button_get_type (), "SwayNotificationCenterWidgetsToggleButton", &g_define_type_info, 0);
	SwayNotificationCenterWidgetsToggleButton_private_offset = g_type_add_instance_private (sway_notification_center_widgets_toggle_button_type_id, sizeof (SwayNotificationCenterWidgetsToggleButtonPrivate));
	return sway_notification_center_widgets_toggle_button_type_id;
}

GType
sway_notification_center_widgets_toggle_button_get_type (void)
{
	static gsize sway_notification_center_widgets_toggle_button_type_id__once = 0;
	if (g_once_init_enter (&sway_notification_center_widgets_toggle_button_type_id__once)) {
		GType sway_notification_center_widgets_toggle_button_type_id;
		sway_notification_center_widgets_toggle_button_type_id = sway_notification_center_widgets_toggle_button_get_type_once ();
		g_once_init_leave (&sway_notification_center_widgets_toggle_button_type_id__once, sway_notification_center_widgets_toggle_button_type_id);
	}
	return sway_notification_center_widgets_toggle_button_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

