/* preferences-window-extension.c generated by valac 0.56.19, the Vala compiler
 * generated from preferences-window-extension.vala, do not modify */

/*
 * Copyright (c) 2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_plugin_gnome.h"
#include "ft_ui.h"
#include <adwaita.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.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

enum  {
	GNOME_PREFERENCES_WINDOW_EXTENSION_0_PROPERTY,
	GNOME_PREFERENCES_WINDOW_EXTENSION_NUM_PROPERTIES
};
static GParamSpec* gnome_preferences_window_extension_properties[GNOME_PREFERENCES_WINDOW_EXTENSION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block3Data Block3Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GnomePreferencesWindowExtensionPrivate {
	GnomeShellExtension* shell_extension;
	GnomeShellExtensionSettings* settings;
	FtPreferencesPanel* last_panel;
	AdwPreferencesGroup* indicator_group;
	AdwPreferencesGroup* screen_overlay_group;
	AdwPreferencesGroup* desktop_group;
	GtkSwitch* shell_extension_toggle;
	AdwSwitchRow* manage_notifications_row;
	GBinding* manage_notifications_binding;
	gboolean installing_extension;
};

struct _Block2Data {
	int _ref_count_;
	GnomePreferencesWindowExtension* self;
	GtkSwitch* toggle;
};

struct _Block3Data {
	int _ref_count_;
	GnomePreferencesWindowExtension* self;
	GnomeShellExtension* shell_extension;
	gchar* success_message;
};

static gint GnomePreferencesWindowExtension_private_offset;
static gpointer gnome_preferences_window_extension_parent_class = NULL;
static GType gnome_preferences_window_extension_type_id = 0;

static AdwToggle* gnome_preferences_window_extension_create_toggle (GnomePreferencesWindowExtension* self,
                                                             const gchar* name,
                                                             const gchar* label);
static void gnome_preferences_window_extension_setup_appearance_panel (GnomePreferencesWindowExtension* self,
                                                                FtPreferencesPanel* panel);
static void gnome_preferences_window_extension_taredown_appearance_panel (GnomePreferencesWindowExtension* self,
                                                                   FtPreferencesPanel* panel);
static void gnome_preferences_window_extension_setup_integrations_panel (GnomePreferencesWindowExtension* self,
                                                                  FtPreferencesPanel* panel);
static void gnome_preferences_window_extension_taredown_integrations_panel (GnomePreferencesWindowExtension* self,
                                                                     FtPreferencesPanel* panel);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void ___lambda9_ (GnomePreferencesWindowExtension* self);
static void gnome_preferences_window_extension_install_extension (GnomePreferencesWindowExtension* self,
                                                           const gchar* success_message);
static void ____lambda9__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void ___lambda11_ (GnomePreferencesWindowExtension* self);
static void ____lambda11__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void ___lambda12_ (Block2Data* _data2_,
                   GObject* object,
                   GParamSpec* pspec);
static void ____lambda12__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static gboolean gnome_preferences_window_extension_transform_visible_child_name_to_activatable (GnomePreferencesWindowExtension* self,
                                                                                         GBinding* binding,
                                                                                         GValue* source_value,
                                                                                         GValue* target_value);
static gboolean _gnome_preferences_window_extension_transform_visible_child_name_to_activatable_gbinding_transform_func (GBinding* binding,
                                                                                                                  GValue* from_value,
                                                                                                                  GValue* to_value,
                                                                                                                  gpointer self);
static gboolean gnome_preferences_window_extension_transform_state_to_visible_child_name (GnomePreferencesWindowExtension* self,
                                                                                   GBinding* binding,
                                                                                   GValue* source_value,
                                                                                   GValue* target_value);
static gboolean _gnome_preferences_window_extension_transform_state_to_visible_child_name_gbinding_transform_func (GBinding* binding,
                                                                                                            GValue* from_value,
                                                                                                            GValue* to_value,
                                                                                                            gpointer self);
static gboolean gnome_preferences_window_extension_transform_state_to_can_install (GnomePreferencesWindowExtension* self,
                                                                            GBinding* binding,
                                                                            GValue* source_value,
                                                                            GValue* target_value);
static gboolean _gnome_preferences_window_extension_transform_state_to_can_install_gbinding_transform_func (GBinding* binding,
                                                                                                     GValue* from_value,
                                                                                                     GValue* to_value,
                                                                                                     gpointer self);
static gboolean gnome_preferences_window_extension_transform_state_to_is_installed (GnomePreferencesWindowExtension* self,
                                                                             GBinding* binding,
                                                                             GValue* source_value,
                                                                             GValue* target_value);
static gboolean _gnome_preferences_window_extension_transform_state_to_is_installed_gbinding_transform_func (GBinding* binding,
                                                                                                      GValue* from_value,
                                                                                                      GValue* to_value,
                                                                                                      gpointer self);
static void gnome_preferences_window_extension_setup (GnomePreferencesWindowExtension* self);
static void gnome_preferences_window_extension_taredown (GnomePreferencesWindowExtension* self);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static void __lambda10_ (Block3Data* _data3_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda10__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void gnome_preferences_window_extension_update_settings (GnomePreferencesWindowExtension* self);
static void gnome_preferences_window_extension_on_notify_window (GnomePreferencesWindowExtension* self,
                                                          GObject* object,
                                                          GParamSpec* pspec);
static void gnome_preferences_window_extension_on_notify_visible_panel (GnomePreferencesWindowExtension* self);
static void _gnome_preferences_window_extension_on_notify_visible_panel_g_object_notify (GObject* _sender,
                                                                                  GParamSpec* pspec,
                                                                                  gpointer self);
static void gnome_preferences_window_extension_on_notify_settings (GnomePreferencesWindowExtension* self,
                                                            GObject* object,
                                                            GParamSpec* pspec);
static void gnome_preferences_window_extension_on_notify_available (GnomePreferencesWindowExtension* self,
                                                             GObject* object,
                                                             GParamSpec* pspec);
static void gnome_preferences_window_extension_real_dispose (GObject* base);
static void _gnome_preferences_window_extension_on_notify_settings_g_object_notify (GObject* _sender,
                                                                             GParamSpec* pspec,
                                                                             gpointer self);
static void _gnome_preferences_window_extension_on_notify_available_g_object_notify (GObject* _sender,
                                                                              GParamSpec* pspec,
                                                                              gpointer self);
static GObject * gnome_preferences_window_extension_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
static void _gnome_preferences_window_extension_on_notify_window_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
static void gnome_preferences_window_extension_finalize (GObject * obj);

static inline gpointer
gnome_preferences_window_extension_get_instance_private (GnomePreferencesWindowExtension* self)
{
	return G_STRUCT_MEMBER_P (self, GnomePreferencesWindowExtension_private_offset);
}

static AdwToggle*
gnome_preferences_window_extension_create_toggle (GnomePreferencesWindowExtension* self,
                                                  const gchar* name,
                                                  const gchar* label)
{
	AdwToggle* toggle = NULL;
	AdwToggle* _tmp0_;
	AdwToggle* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	_tmp0_ = adw_toggle_new ();
	toggle = _tmp0_;
	adw_toggle_set_name (toggle, name);
	adw_toggle_set_label (toggle, label);
	result = toggle;
	return result;
}

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

static void
gnome_preferences_window_extension_setup_appearance_panel (GnomePreferencesWindowExtension* self,
                                                           FtPreferencesPanel* panel)
{
	AdwPreferencesPage* page = NULL;
	AdwPreferencesPage* _tmp0_;
	AdwPreferencesPage* _tmp1_;
	GnomeShellExtensionSettings* _tmp2_;
	AdwPreferencesGroup* _tmp3_;
	AdwPreferencesGroup* _tmp26_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (panel != NULL);
	_tmp0_ = ft_preferences_panel_get_preferences_page (panel);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	page = _tmp1_;
	_tmp2_ = self->priv->settings;
	if (_tmp2_ == NULL) {
		gnome_preferences_window_extension_taredown_appearance_panel (self, panel);
		_g_object_unref0 (page);
		return;
	}
	_tmp3_ = self->priv->indicator_group;
	if (_tmp3_ == NULL) {
		AdwPreferencesGroup* indicator_group = NULL;
		AdwPreferencesGroup* _tmp4_;
		AdwPreferencesGroup* _tmp5_;
		AdwPreferencesPage* _tmp6_;
		AdwPreferencesGroup* _tmp7_;
		AdwToggleGroup* indicator_type_toggle_group = NULL;
		AdwToggleGroup* _tmp8_;
		AdwToggleGroup* _tmp9_;
		AdwToggleGroup* _tmp10_;
		AdwToggleGroup* _tmp11_;
		AdwToggleGroup* _tmp12_;
		AdwToggle* _tmp13_;
		AdwToggleGroup* _tmp14_;
		AdwToggle* _tmp15_;
		GnomeShellExtensionSettings* _tmp16_;
		AdwToggleGroup* _tmp17_;
		AdwActionRow* indicator_type_row = NULL;
		AdwActionRow* _tmp18_;
		AdwActionRow* _tmp19_;
		AdwActionRow* _tmp20_;
		AdwActionRow* _tmp21_;
		AdwToggleGroup* _tmp22_;
		AdwPreferencesGroup* _tmp23_;
		AdwActionRow* _tmp24_;
		AdwPreferencesGroup* _tmp25_;
		_tmp4_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
		g_object_ref_sink (_tmp4_);
		indicator_group = _tmp4_;
		_tmp5_ = indicator_group;
		adw_preferences_group_set_title (_tmp5_, _ ("Indicator"));
		_tmp6_ = page;
		_tmp7_ = indicator_group;
		adw_preferences_page_add (_tmp6_, _tmp7_);
		_tmp8_ = (AdwToggleGroup*) adw_toggle_group_new ();
		g_object_ref_sink (_tmp8_);
		indicator_type_toggle_group = _tmp8_;
		_tmp9_ = indicator_type_toggle_group;
		adw_toggle_group_set_homogeneous (_tmp9_, TRUE);
		_tmp10_ = indicator_type_toggle_group;
		adw_toggle_group_set_can_shrink (_tmp10_, FALSE);
		_tmp11_ = indicator_type_toggle_group;
		gtk_widget_set_valign ((GtkWidget*) _tmp11_, GTK_ALIGN_CENTER);
		_tmp12_ = indicator_type_toggle_group;
		_tmp13_ = gnome_preferences_window_extension_create_toggle (self, "icon", _ ("Icon"));
		adw_toggle_group_add (_tmp12_, _tmp13_);
		_tmp14_ = indicator_type_toggle_group;
		_tmp15_ = gnome_preferences_window_extension_create_toggle (self, "text", _ ("Text"));
		adw_toggle_group_add (_tmp14_, _tmp15_);
		_tmp16_ = self->priv->settings;
		_tmp17_ = indicator_type_toggle_group;
		g_object_bind_property_with_closures ((GObject*) _tmp16_, "indicator-type", (GObject*) _tmp17_, "active-name", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp18_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_tmp18_);
		indicator_type_row = _tmp18_;
		_tmp19_ = indicator_type_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp19_, _ ("Display As"));
		_tmp20_ = indicator_type_row;
		gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp20_, FALSE);
		_tmp21_ = indicator_type_row;
		_tmp22_ = indicator_type_toggle_group;
		adw_action_row_add_suffix (_tmp21_, (GtkWidget*) _tmp22_);
		_tmp23_ = indicator_group;
		_tmp24_ = indicator_type_row;
		adw_preferences_group_add (_tmp23_, (GtkWidget*) _tmp24_);
		_tmp25_ = indicator_group;
		self->priv->indicator_group = _tmp25_;
		_g_object_unref0 (indicator_type_row);
		_g_object_unref0 (indicator_type_toggle_group);
		_g_object_unref0 (indicator_group);
	}
	_tmp26_ = self->priv->screen_overlay_group;
	if (_tmp26_ == NULL) {
		AdwPreferencesGroup* screen_overlay_group = NULL;
		AdwPreferencesGroup* _tmp27_;
		AdwPreferencesGroup* _tmp28_;
		AdwPreferencesPage* _tmp29_;
		AdwPreferencesGroup* _tmp30_;
		AdwSwitchRow* blur_effect_row = NULL;
		AdwSwitchRow* _tmp31_;
		AdwSwitchRow* _tmp32_;
		GnomeShellExtensionSettings* _tmp33_;
		AdwSwitchRow* _tmp34_;
		AdwPreferencesGroup* _tmp35_;
		AdwSwitchRow* _tmp36_;
		AdwSwitchRow* dismiss_gesture_row = NULL;
		AdwSwitchRow* _tmp37_;
		AdwSwitchRow* _tmp38_;
		GnomeShellExtensionSettings* _tmp39_;
		AdwSwitchRow* _tmp40_;
		AdwPreferencesGroup* _tmp41_;
		AdwSwitchRow* _tmp42_;
		AdwPreferencesGroup* _tmp43_;
		_tmp27_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
		g_object_ref_sink (_tmp27_);
		screen_overlay_group = _tmp27_;
		_tmp28_ = screen_overlay_group;
		adw_preferences_group_set_title (_tmp28_, _ ("Screen Overlay"));
		_tmp29_ = page;
		_tmp30_ = screen_overlay_group;
		adw_preferences_page_add (_tmp29_, _tmp30_);
		_tmp31_ = (AdwSwitchRow*) adw_switch_row_new ();
		g_object_ref_sink (_tmp31_);
		blur_effect_row = _tmp31_;
		_tmp32_ = blur_effect_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp32_, _ ("Blur Effect"));
		_tmp33_ = self->priv->settings;
		_tmp34_ = blur_effect_row;
		g_object_bind_property_with_closures ((GObject*) _tmp33_, "blur-effect", (GObject*) _tmp34_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp35_ = screen_overlay_group;
		_tmp36_ = blur_effect_row;
		adw_preferences_group_add (_tmp35_, (GtkWidget*) _tmp36_);
		_tmp37_ = (AdwSwitchRow*) adw_switch_row_new ();
		g_object_ref_sink (_tmp37_);
		dismiss_gesture_row = _tmp37_;
		_tmp38_ = dismiss_gesture_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp38_, _ ("Dismiss Gesture"));
		_tmp39_ = self->priv->settings;
		_tmp40_ = dismiss_gesture_row;
		g_object_bind_property_with_closures ((GObject*) _tmp39_, "dismiss-gesture", (GObject*) _tmp40_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp41_ = screen_overlay_group;
		_tmp42_ = dismiss_gesture_row;
		adw_preferences_group_add (_tmp41_, (GtkWidget*) _tmp42_);
		_tmp43_ = screen_overlay_group;
		self->priv->screen_overlay_group = _tmp43_;
		_g_object_unref0 (dismiss_gesture_row);
		_g_object_unref0 (blur_effect_row);
		_g_object_unref0 (screen_overlay_group);
	}
	_g_object_unref0 (page);
}

static void
gnome_preferences_window_extension_taredown_appearance_panel (GnomePreferencesWindowExtension* self,
                                                              FtPreferencesPanel* panel)
{
	AdwPreferencesGroup* _tmp0_ = NULL;
	AdwPreferencesGroup* _tmp1_;
	AdwPreferencesGroup* _tmp2_ = NULL;
	AdwPreferencesGroup* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (panel != NULL);
	_tmp1_ = self->priv->indicator_group;
	_tmp0_ = _tmp1_;
	if (_tmp0_ != NULL) {
		gtk_widget_unparent ((GtkWidget*) _tmp0_);
	}
	self->priv->indicator_group = NULL;
	_tmp3_ = self->priv->screen_overlay_group;
	_tmp2_ = _tmp3_;
	if (_tmp2_ != NULL) {
		gtk_widget_unparent ((GtkWidget*) _tmp2_);
	}
	self->priv->screen_overlay_group = NULL;
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		GnomePreferencesWindowExtension* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->toggle);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
___lambda9_ (GnomePreferencesWindowExtension* self)
{
	gnome_preferences_window_extension_install_extension (self, "");
}

static void
____lambda9__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	___lambda9_ ((GnomePreferencesWindowExtension*) self);
}

static void
___lambda11_ (GnomePreferencesWindowExtension* self)
{
	gnome_preferences_window_extension_install_extension (self, _ ("Log out to finish the update"));
}

static void
____lambda11__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda11_ ((GnomePreferencesWindowExtension*) self);
}

static void
___lambda12_ (Block2Data* _data2_,
              GObject* object,
              GParamSpec* pspec)
{
	GnomePreferencesWindowExtension* self;
	GtkSwitch* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GnomeShellExtension* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	GtkSwitch* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	self = _data2_->self;
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = _data2_->toggle;
	_tmp1_ = gtk_switch_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->shell_extension;
	_tmp4_ = gnome_shell_extension_get_enabled (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp2_ == _tmp5_) {
		return;
	}
	_tmp6_ = _data2_->toggle;
	_tmp7_ = gtk_switch_get_active (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		GnomeShellExtension* _tmp9_;
		_tmp9_ = self->priv->shell_extension;
		gnome_shell_extension_enable_extension (_tmp9_, NULL, NULL);
	} else {
		GnomeShellExtension* _tmp10_;
		_tmp10_ = self->priv->shell_extension;
		gnome_shell_extension_disable_extension (_tmp10_, NULL, NULL);
	}
}

static void
____lambda12__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda12_ (self, _sender, pspec);
}

static gboolean
_gnome_preferences_window_extension_transform_visible_child_name_to_activatable_gbinding_transform_func (GBinding* binding,
                                                                                                         GValue* from_value,
                                                                                                         GValue* to_value,
                                                                                                         gpointer self)
{
	gboolean result;
	result = gnome_preferences_window_extension_transform_visible_child_name_to_activatable ((GnomePreferencesWindowExtension*) self, binding, from_value, to_value);
	return result;
}

static gboolean
_gnome_preferences_window_extension_transform_state_to_visible_child_name_gbinding_transform_func (GBinding* binding,
                                                                                                   GValue* from_value,
                                                                                                   GValue* to_value,
                                                                                                   gpointer self)
{
	gboolean result;
	result = gnome_preferences_window_extension_transform_state_to_visible_child_name ((GnomePreferencesWindowExtension*) self, binding, from_value, to_value);
	return result;
}

static gboolean
_gnome_preferences_window_extension_transform_state_to_can_install_gbinding_transform_func (GBinding* binding,
                                                                                            GValue* from_value,
                                                                                            GValue* to_value,
                                                                                            gpointer self)
{
	gboolean result;
	result = gnome_preferences_window_extension_transform_state_to_can_install ((GnomePreferencesWindowExtension*) self, binding, from_value, to_value);
	return result;
}

static gboolean
_gnome_preferences_window_extension_transform_state_to_is_installed_gbinding_transform_func (GBinding* binding,
                                                                                             GValue* from_value,
                                                                                             GValue* to_value,
                                                                                             gpointer self)
{
	gboolean result;
	result = gnome_preferences_window_extension_transform_state_to_is_installed ((GnomePreferencesWindowExtension*) self, binding, from_value, to_value);
	return result;
}

static void
gnome_preferences_window_extension_setup_integrations_panel (GnomePreferencesWindowExtension* self,
                                                             FtPreferencesPanel* panel)
{
	gboolean _tmp0_ = FALSE;
	GnomeShellExtension* _tmp1_;
	AdwPreferencesGroup* _tmp5_;
	GtkSwitch* _tmp58_;
	AdwSwitchRow* _tmp61_;
	gboolean _tmp64_ = FALSE;
	AdwSwitchRow* _tmp65_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (panel != NULL);
	_tmp1_ = self->priv->shell_extension;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		GnomeShellExtension* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->priv->shell_extension;
		_tmp3_ = gnome_shell_extension_get_available (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = !_tmp4_;
	}
	if (_tmp0_) {
		gnome_preferences_window_extension_taredown_integrations_panel (self, panel);
		return;
	}
	_tmp5_ = self->priv->desktop_group;
	if (_tmp5_ == NULL) {
		Block2Data* _data2_;
		AdwPreferencesGroup* desktop_group = NULL;
		AdwPreferencesGroup* _tmp6_;
		AdwPreferencesGroup* _tmp7_;
		AdwPreferencesGroup* _tmp8_;
		GtkButton* install_button = NULL;
		GtkButton* _tmp9_;
		GtkButton* _tmp10_;
		GtkButton* _tmp11_;
		GtkButton* update_button = NULL;
		GtkButton* _tmp12_;
		GtkButton* _tmp13_;
		GtkButton* _tmp14_;
		GtkSwitch* _tmp15_;
		GtkSwitch* _tmp16_;
		GtkSwitch* _tmp17_;
		GtkButton* outdated_button = NULL;
		GtkButton* _tmp18_;
		GtkButton* _tmp19_;
		GtkStack* state_stack = NULL;
		GtkStack* _tmp20_;
		GtkStack* _tmp21_;
		GtkStack* _tmp22_;
		GtkStack* _tmp23_;
		GtkStack* _tmp24_;
		GtkButton* _tmp25_;
		GtkStack* _tmp26_;
		GtkSwitch* _tmp27_;
		GtkStack* _tmp28_;
		GtkButton* _tmp29_;
		GtkStack* _tmp30_;
		GtkButton* _tmp31_;
		AdwActionRow* extension_row = NULL;
		AdwActionRow* _tmp32_;
		AdwActionRow* _tmp33_;
		AdwActionRow* _tmp34_;
		GtkStack* _tmp35_;
		AdwActionRow* _tmp36_;
		GtkSwitch* _tmp37_;
		AdwPreferencesGroup* _tmp38_;
		AdwActionRow* _tmp39_;
		AdwSwitchRow* manage_notifications_row = NULL;
		AdwSwitchRow* _tmp40_;
		AdwSwitchRow* _tmp41_;
		AdwSwitchRow* _tmp42_;
		AdwPreferencesGroup* _tmp43_;
		AdwSwitchRow* _tmp44_;
		GtkStack* _tmp45_;
		AdwActionRow* _tmp46_;
		GnomeShellExtension* _tmp47_;
		GtkSwitch* _tmp48_;
		GnomeShellExtension* _tmp49_;
		GtkStack* _tmp50_;
		GnomeShellExtension* _tmp51_;
		AdwPreferencesGroup* _tmp52_;
		GnomeShellExtension* _tmp53_;
		AdwSwitchRow* _tmp54_;
		AdwPreferencesGroup* _tmp55_;
		GtkSwitch* _tmp56_;
		AdwSwitchRow* _tmp57_;
		_data2_ = g_slice_new0 (Block2Data);
		_data2_->_ref_count_ = 1;
		_data2_->self = g_object_ref (self);
		_tmp6_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
		g_object_ref_sink (_tmp6_);
		desktop_group = _tmp6_;
		_tmp7_ = desktop_group;
		adw_preferences_group_set_title (_tmp7_, _ ("Desktop"));
		_tmp8_ = desktop_group;
		ft_preferences_panel_add_group (panel, "desktop", _tmp8_);
		_tmp9_ = (GtkButton*) gtk_button_new_with_label (_ ("Install"));
		g_object_ref_sink (_tmp9_);
		install_button = _tmp9_;
		_tmp10_ = install_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp10_, "suggested-action");
		_tmp11_ = install_button;
		g_signal_connect_object (_tmp11_, "clicked", (GCallback) ____lambda9__gtk_button_clicked, self, 0);
		_tmp12_ = (GtkButton*) gtk_button_new_with_label (_ ("Update"));
		g_object_ref_sink (_tmp12_);
		update_button = _tmp12_;
		_tmp13_ = update_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp13_, "suggested-action");
		_tmp14_ = update_button;
		g_signal_connect_object (_tmp14_, "clicked", (GCallback) ____lambda11__gtk_button_clicked, self, 0);
		_tmp15_ = (GtkSwitch*) gtk_switch_new ();
		g_object_ref_sink (_tmp15_);
		_data2_->toggle = _tmp15_;
		_tmp16_ = _data2_->toggle;
		gtk_widget_set_valign ((GtkWidget*) _tmp16_, GTK_ALIGN_CENTER);
		_tmp17_ = _data2_->toggle;
		g_signal_connect_data ((GObject*) _tmp17_, "notify::active", (GCallback) ____lambda12__g_object_notify, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
		_tmp18_ = (GtkButton*) gtk_button_new_with_label (_ ("Outdated"));
		g_object_ref_sink (_tmp18_);
		outdated_button = _tmp18_;
		_tmp19_ = outdated_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp19_, FALSE);
		_tmp20_ = (GtkStack*) gtk_stack_new ();
		g_object_ref_sink (_tmp20_);
		state_stack = _tmp20_;
		_tmp21_ = state_stack;
		gtk_stack_set_hhomogeneous (_tmp21_, FALSE);
		_tmp22_ = state_stack;
		gtk_stack_set_vhomogeneous (_tmp22_, TRUE);
		_tmp23_ = state_stack;
		gtk_widget_set_valign ((GtkWidget*) _tmp23_, GTK_ALIGN_CENTER);
		_tmp24_ = state_stack;
		_tmp25_ = install_button;
		gtk_stack_add_named (_tmp24_, (GtkWidget*) _tmp25_, "uninstalled");
		_tmp26_ = state_stack;
		_tmp27_ = _data2_->toggle;
		gtk_stack_add_named (_tmp26_, (GtkWidget*) _tmp27_, "installed");
		_tmp28_ = state_stack;
		_tmp29_ = outdated_button;
		gtk_stack_add_named (_tmp28_, (GtkWidget*) _tmp29_, "outdated");
		_tmp30_ = state_stack;
		_tmp31_ = update_button;
		gtk_stack_add_named (_tmp30_, (GtkWidget*) _tmp31_, "update");
		_tmp32_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_tmp32_);
		extension_row = _tmp32_;
		_tmp33_ = extension_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp33_, _ ("GNOME Shell Extension"));
		_tmp34_ = extension_row;
		_tmp35_ = state_stack;
		adw_action_row_add_suffix (_tmp34_, (GtkWidget*) _tmp35_);
		_tmp36_ = extension_row;
		_tmp37_ = _data2_->toggle;
		adw_action_row_set_activatable_widget (_tmp36_, (GtkWidget*) _tmp37_);
		_tmp38_ = desktop_group;
		_tmp39_ = extension_row;
		adw_preferences_group_add (_tmp38_, (GtkWidget*) _tmp39_);
		_tmp40_ = (AdwSwitchRow*) adw_switch_row_new ();
		g_object_ref_sink (_tmp40_);
		manage_notifications_row = _tmp40_;
		_tmp41_ = manage_notifications_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp41_, _ ("Do Not Disturb"));
		_tmp42_ = manage_notifications_row;
		adw_action_row_set_subtitle ((AdwActionRow*) _tmp42_, _ ("Hide non-critical notifications while using the timer."));
		_tmp43_ = desktop_group;
		_tmp44_ = manage_notifications_row;
		adw_preferences_group_add (_tmp43_, (GtkWidget*) _tmp44_);
		_tmp45_ = state_stack;
		_tmp46_ = extension_row;
		g_object_bind_property_with_closures ((GObject*) _tmp45_, "visible-child-name", (GObject*) _tmp46_, "activatable", G_BINDING_SYNC_CREATE, (GClosure*) ((_gnome_preferences_window_extension_transform_visible_child_name_to_activatable_gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) _gnome_preferences_window_extension_transform_visible_child_name_to_activatable_gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp47_ = self->priv->shell_extension;
		_tmp48_ = _data2_->toggle;
		g_object_bind_property_with_closures ((GObject*) _tmp47_, "enabled", (GObject*) _tmp48_, "active", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp49_ = self->priv->shell_extension;
		_tmp50_ = state_stack;
		g_object_bind_property_with_closures ((GObject*) _tmp49_, "state", (GObject*) _tmp50_, "visible-child-name", G_BINDING_SYNC_CREATE, (GClosure*) ((_gnome_preferences_window_extension_transform_state_to_visible_child_name_gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) _gnome_preferences_window_extension_transform_state_to_visible_child_name_gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp51_ = self->priv->shell_extension;
		_tmp52_ = desktop_group;
		g_object_bind_property_with_closures ((GObject*) _tmp51_, "state", (GObject*) _tmp52_, "visible", G_BINDING_SYNC_CREATE, (GClosure*) ((_gnome_preferences_window_extension_transform_state_to_can_install_gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) _gnome_preferences_window_extension_transform_state_to_can_install_gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp53_ = self->priv->shell_extension;
		_tmp54_ = manage_notifications_row;
		g_object_bind_property_with_closures ((GObject*) _tmp53_, "state", (GObject*) _tmp54_, "visible", G_BINDING_SYNC_CREATE, (GClosure*) ((_gnome_preferences_window_extension_transform_state_to_is_installed_gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) _gnome_preferences_window_extension_transform_state_to_is_installed_gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp55_ = desktop_group;
		self->priv->desktop_group = _tmp55_;
		_tmp56_ = _data2_->toggle;
		self->priv->shell_extension_toggle = _tmp56_;
		_tmp57_ = manage_notifications_row;
		self->priv->manage_notifications_row = _tmp57_;
		_g_object_unref0 (manage_notifications_row);
		_g_object_unref0 (extension_row);
		_g_object_unref0 (state_stack);
		_g_object_unref0 (outdated_button);
		_g_object_unref0 (update_button);
		_g_object_unref0 (install_button);
		_g_object_unref0 (desktop_group);
		block2_data_unref (_data2_);
		_data2_ = NULL;
	}
	_tmp58_ = self->priv->shell_extension_toggle;
	if (_tmp58_ != NULL) {
		GtkSwitch* _tmp59_;
		GnomeShellExtensionSettings* _tmp60_;
		_tmp59_ = self->priv->shell_extension_toggle;
		_tmp60_ = self->priv->settings;
		gtk_switch_set_state (_tmp59_, _tmp60_ != NULL);
	}
	_tmp61_ = self->priv->manage_notifications_row;
	if (_tmp61_ != NULL) {
		AdwSwitchRow* _tmp62_;
		GnomeShellExtensionSettings* _tmp63_;
		_tmp62_ = self->priv->manage_notifications_row;
		_tmp63_ = self->priv->settings;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp62_, _tmp63_ != NULL);
	}
	_tmp65_ = self->priv->manage_notifications_row;
	if (_tmp65_ != NULL) {
		GnomeShellExtensionSettings* _tmp66_;
		_tmp66_ = self->priv->settings;
		_tmp64_ = _tmp66_ != NULL;
	} else {
		_tmp64_ = FALSE;
	}
	if (_tmp64_) {
		GBinding* _tmp67_ = NULL;
		GBinding* _tmp68_;
		GnomeShellExtensionSettings* _tmp70_;
		AdwSwitchRow* _tmp71_;
		GBinding* _tmp72_;
		GBinding* _tmp73_;
		_tmp68_ = self->priv->manage_notifications_binding;
		_tmp67_ = _tmp68_;
		if (_tmp67_ != NULL) {
			GBinding* _tmp69_;
			_tmp69_ = _g_object_ref0 (_tmp67_);
			g_binding_unbind (_tmp69_);
		}
		_tmp70_ = self->priv->settings;
		_tmp71_ = self->priv->manage_notifications_row;
		_tmp72_ = g_object_bind_property_with_closures ((GObject*) _tmp70_, "manage-notifications", (GObject*) _tmp71_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp73_ = _g_object_ref0 (_tmp72_);
		_g_object_unref0 (self->priv->manage_notifications_binding);
		self->priv->manage_notifications_binding = _tmp73_;
	}
}

static void
gnome_preferences_window_extension_taredown_integrations_panel (GnomePreferencesWindowExtension* self,
                                                                FtPreferencesPanel* panel)
{
	GBinding* _tmp0_ = NULL;
	GBinding* _tmp1_;
	AdwPreferencesGroup* _tmp3_ = NULL;
	AdwPreferencesGroup* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (panel != NULL);
	self->priv->shell_extension_toggle = NULL;
	self->priv->manage_notifications_row = NULL;
	_tmp1_ = self->priv->manage_notifications_binding;
	_tmp0_ = _tmp1_;
	if (_tmp0_ != NULL) {
		GBinding* _tmp2_;
		_tmp2_ = _g_object_ref0 (_tmp0_);
		g_binding_unbind (_tmp2_);
	}
	_g_object_unref0 (self->priv->manage_notifications_binding);
	self->priv->manage_notifications_binding = NULL;
	_tmp4_ = self->priv->desktop_group;
	_tmp3_ = _tmp4_;
	if (_tmp3_ != NULL) {
		gtk_widget_unparent ((GtkWidget*) _tmp3_);
	}
	self->priv->desktop_group = NULL;
}

static gboolean
gnome_preferences_window_extension_transform_state_to_can_install (GnomePreferencesWindowExtension* self,
                                                                   GBinding* binding,
                                                                   GValue* source_value,
                                                                   GValue* target_value)
{
	gboolean _tmp0_ = FALSE;
	GnomeShellExtension* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	_tmp1_ = self->priv->shell_extension;
	if (gnome_shell_extension_is_installed (_tmp1_)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = GNOME_SHELL_EXTENSION_IS_PUBLISHED;
	}
	g_value_set_boolean (target_value, _tmp0_);
	result = TRUE;
	return result;
}

static gboolean
gnome_preferences_window_extension_transform_state_to_is_installed (GnomePreferencesWindowExtension* self,
                                                                    GBinding* binding,
                                                                    GValue* source_value,
                                                                    GValue* target_value)
{
	GnomeShellExtension* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	_tmp0_ = self->priv->shell_extension;
	g_value_set_boolean (target_value, gnome_shell_extension_is_installed (_tmp0_));
	result = TRUE;
	return result;
}

static gboolean
gnome_preferences_window_extension_transform_state_to_visible_child_name (GnomePreferencesWindowExtension* self,
                                                                          GBinding* binding,
                                                                          GValue* source_value,
                                                                          GValue* target_value)
{
	GnomeExtensionState state = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	state = (GnomeExtensionState) g_value_get_enum (source_value);
	switch (state) {
		case GNOME_EXTENSION_STATE_UNINSTALLED:
		case GNOME_EXTENSION_STATE_DOWNLOADING:
		{
			g_value_set_string (target_value, "uninstalled");
			break;
		}
		case GNOME_EXTENSION_STATE_ENABLED:
		case GNOME_EXTENSION_STATE_INACTIVE:
		case GNOME_EXTENSION_STATE_DEACTIVATING:
		case GNOME_EXTENSION_STATE_ACTIVATING:
		case GNOME_EXTENSION_STATE_INITIALIZED:
		case GNOME_EXTENSION_STATE_ERROR:
		{
			g_value_set_string (target_value, "installed");
			break;
		}
		case GNOME_EXTENSION_STATE_OUT_OF_DATE:
		{
			g_value_set_string (target_value, "outdated");
			break;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
	result = TRUE;
	return result;
}

static gboolean
gnome_preferences_window_extension_transform_visible_child_name_to_activatable (GnomePreferencesWindowExtension* self,
                                                                                GBinding* binding,
                                                                                GValue* source_value,
                                                                                GValue* target_value)
{
	const gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	_tmp0_ = g_value_get_string (source_value);
	g_value_set_boolean (target_value, g_strcmp0 (_tmp0_, "installed") == 0);
	result = TRUE;
	return result;
}

/**
         * Modify visible_panel of the PreferencesWindow.
         *
         * We allow to rerun setup functions as `settings` may vanish and reappear.
         */
static void
gnome_preferences_window_extension_setup (GnomePreferencesWindowExtension* self)
{
	FtPreferencesWindow* _tmp0_ = NULL;
	FtPreferencesWindow* _tmp1_;
	FtPreferencesWindow* _tmp2_;
	FtPreferencesPanel* _tmp3_ = NULL;
	FtPreferencesPanel* panel = NULL;
	FtPreferencesPanel* _tmp6_;
	FtPreferencesPanel* _tmp7_;
	FtPreferencesPanel* _tmp8_;
	FtPreferencesPanel* _tmp21_ = NULL;
	FtPreferencesPanel* _tmp22_;
	const gchar* _tmp23_ = NULL;
	const gchar* _tmp26_;
	GQuark _tmp28_ = 0U;
	static GQuark _tmp27_label0 = 0;
	static GQuark _tmp27_label1 = 0;
	g_return_if_fail (self != NULL);
	_tmp1_ = ft_preferences_window_extension_get_window ((FtPreferencesWindowExtension*) self);
	_tmp2_ = _tmp1_;
	_tmp0_ = _tmp2_;
	_tmp3_ = NULL;
	if (_tmp0_ != NULL) {
		FtPreferencesPanel* _tmp4_;
		FtPreferencesPanel* _tmp5_;
		_tmp4_ = ft_preferences_window_get_visible_panel (_tmp0_);
		_tmp5_ = _tmp4_;
		_tmp3_ = _tmp5_;
	}
	_tmp6_ = _g_object_ref0 (_tmp3_);
	panel = _tmp6_;
	_tmp7_ = panel;
	_tmp8_ = self->priv->last_panel;
	if (_tmp7_ != _tmp8_) {
		FtPreferencesPanel* _tmp9_ = NULL;
		FtPreferencesPanel* _tmp10_;
		const gchar* _tmp11_ = NULL;
		const gchar* _tmp14_;
		GQuark _tmp16_ = 0U;
		static GQuark _tmp15_label0 = 0;
		static GQuark _tmp15_label1 = 0;
		FtPreferencesPanel* _tmp19_;
		FtPreferencesPanel* _tmp20_;
		_tmp10_ = self->priv->last_panel;
		_tmp9_ = _tmp10_;
		_tmp11_ = NULL;
		if (_tmp9_ != NULL) {
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			_tmp12_ = adw_navigation_page_get_tag ((AdwNavigationPage*) _tmp9_);
			_tmp13_ = _tmp12_;
			_tmp11_ = _tmp13_;
		}
		_tmp14_ = _tmp11_;
		_tmp16_ = (NULL == _tmp14_) ? 0 : g_quark_from_string (_tmp14_);
		if (_tmp16_ == ((0 != _tmp15_label0) ? _tmp15_label0 : (_tmp15_label0 = g_quark_from_static_string ("appearance")))) {
			switch (0) {
				default:
				{
					FtPreferencesPanel* _tmp17_;
					_tmp17_ = self->priv->last_panel;
					gnome_preferences_window_extension_taredown_appearance_panel (self, _tmp17_);
					break;
				}
			}
		} else if (_tmp16_ == ((0 != _tmp15_label1) ? _tmp15_label1 : (_tmp15_label1 = g_quark_from_static_string ("integrations")))) {
			switch (0) {
				default:
				{
					FtPreferencesPanel* _tmp18_;
					_tmp18_ = self->priv->last_panel;
					gnome_preferences_window_extension_taredown_integrations_panel (self, _tmp18_);
					break;
				}
			}
		}
		_tmp19_ = panel;
		_tmp20_ = _g_object_ref0 (_tmp19_);
		_g_object_unref0 (self->priv->last_panel);
		self->priv->last_panel = _tmp20_;
	}
	_tmp22_ = panel;
	_tmp21_ = _tmp22_;
	_tmp23_ = NULL;
	if (_tmp21_ != NULL) {
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		_tmp24_ = adw_navigation_page_get_tag ((AdwNavigationPage*) _tmp21_);
		_tmp25_ = _tmp24_;
		_tmp23_ = _tmp25_;
	}
	_tmp26_ = _tmp23_;
	_tmp28_ = (NULL == _tmp26_) ? 0 : g_quark_from_string (_tmp26_);
	if (_tmp28_ == ((0 != _tmp27_label0) ? _tmp27_label0 : (_tmp27_label0 = g_quark_from_static_string ("appearance")))) {
		switch (0) {
			default:
			{
				FtPreferencesPanel* _tmp29_;
				_tmp29_ = panel;
				gnome_preferences_window_extension_setup_appearance_panel (self, _tmp29_);
				break;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label1) ? _tmp27_label1 : (_tmp27_label1 = g_quark_from_static_string ("integrations")))) {
		switch (0) {
			default:
			{
				FtPreferencesPanel* _tmp30_;
				_tmp30_ = panel;
				gnome_preferences_window_extension_setup_integrations_panel (self, _tmp30_);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				gnome_preferences_window_extension_taredown (self);
				break;
			}
		}
	}
	_g_object_unref0 (panel);
	_g_object_unref0 (_tmp0_);
}

static void
gnome_preferences_window_extension_taredown (GnomePreferencesWindowExtension* self)
{
	FtPreferencesPanel* _tmp0_;
	FtPreferencesPanel* _tmp1_;
	FtPreferencesPanel* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->last_panel;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->last_panel;
	gnome_preferences_window_extension_taredown_appearance_panel (self, _tmp1_);
	_tmp2_ = self->priv->last_panel;
	gnome_preferences_window_extension_taredown_integrations_panel (self, _tmp2_);
	_g_object_unref0 (self->priv->last_panel);
	self->priv->last_panel = NULL;
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		GnomePreferencesWindowExtension* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->shell_extension);
		_g_free0 (_data3_->success_message);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda10_ (Block3Data* _data3_,
             GObject* obj,
             GAsyncResult* res)
{
	GnomePreferencesWindowExtension* self;
	gchar* message = NULL;
	gchar* _tmp0_;
	const gchar* _tmp8_;
	GError* _inner_error0_ = NULL;
	self = _data3_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = g_strdup ("");
	message = _tmp0_;
	{
		gboolean success = FALSE;
		GnomeShellExtension* _tmp1_;
		_tmp1_ = _data3_->shell_extension;
		success = gnome_shell_extension_install_extension_finish (_tmp1_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == GNOME_SHELL_EXTENSION_ERROR) {
				goto __catch0_gnome_shell_extension_error;
			}
			_g_free0 (message);
			g_critical ("file %s: line %d: unexpected 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;
		}
		if (success) {
			gchar* _tmp2_;
			_tmp2_ = g_strdup (_data3_->success_message);
			_g_free0 (message);
			message = _tmp2_;
		}
	}
	goto __finally0;
	__catch0_gnome_shell_extension_error:
	{
		GError* _error_ = NULL;
		GError* _tmp3_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = _error_;
		switch (_tmp3_->code) {
			case GNOME_SHELL_EXTENSION_ERROR_TIMED_OUT:
			{
				gchar* _tmp4_;
				_tmp4_ = g_strdup (_ ("Time-out reached"));
				_g_free0 (message);
				message = _tmp4_;
				break;
			}
			case GNOME_SHELL_EXTENSION_ERROR_NOT_ALLOWED:
			{
				gchar* _tmp5_;
				_tmp5_ = g_strdup (_ ("Installing extensions is not allowed"));
				_g_free0 (message);
				message = _tmp5_;
				break;
			}
			case GNOME_SHELL_EXTENSION_ERROR_DOWNLOAD_FAILED:
			{
				gchar* _tmp6_;
				_tmp6_ = g_strdup (_ ("Failed to download the extension"));
				_g_free0 (message);
				message = _tmp6_;
				break;
			}
			default:
			{
				gchar* _tmp7_;
				_tmp7_ = g_strdup (_ ("Something went wrong"));
				_g_free0 (message);
				message = _tmp7_;
				_g_error_free0 (_error_);
				_g_free0 (message);
				return;
			}
		}
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (message);
		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;
	}
	_tmp8_ = message;
	if (g_strcmp0 (_tmp8_, "") != 0) {
		FtPreferencesWindow* _tmp9_ = NULL;
		FtPreferencesWindow* _tmp10_;
		FtPreferencesWindow* _tmp11_;
		_tmp10_ = ft_preferences_window_extension_get_window ((FtPreferencesWindowExtension*) self);
		_tmp11_ = _tmp10_;
		_tmp9_ = _tmp11_;
		if (_tmp9_ != NULL) {
			const gchar* _tmp12_;
			AdwToast* _tmp13_;
			_tmp12_ = message;
			_tmp13_ = adw_toast_new (_tmp12_);
			ft_preferences_window_add_toast (_tmp9_, _tmp13_);
		}
		_g_object_unref0 (_tmp9_);
	}
	self->priv->installing_extension = FALSE;
	_g_free0 (message);
}

static void
___lambda10__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda10_ (self, source_object, res);
	block3_data_unref (self);
}

static void
gnome_preferences_window_extension_install_extension (GnomePreferencesWindowExtension* self,
                                                      const gchar* success_message)
{
	Block3Data* _data3_;
	gchar* _tmp0_;
	GnomeShellExtension* _tmp1_;
	GnomeShellExtension* _tmp2_;
	GnomeShellExtension* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (success_message != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp0_ = g_strdup (success_message);
	_g_free0 (_data3_->success_message);
	_data3_->success_message = _tmp0_;
	_tmp1_ = self->priv->shell_extension;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data3_->shell_extension = _tmp2_;
	if (self->priv->installing_extension) {
		block3_data_unref (_data3_);
		_data3_ = NULL;
		return;
	}
	self->priv->installing_extension = TRUE;
	_tmp3_ = _data3_->shell_extension;
	gnome_shell_extension_install_extension (_tmp3_, ___lambda10__gasync_ready_callback, block3_data_ref (_data3_));
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

static void
gnome_preferences_window_extension_update_settings (GnomePreferencesWindowExtension* self)
{
	GnomeShellExtension* _tmp0_ = NULL;
	GnomeShellExtension* _tmp1_;
	GnomeShellExtensionSettings* _tmp2_ = NULL;
	GnomeShellExtensionSettings* settings = NULL;
	GnomeShellExtensionSettings* _tmp5_;
	GnomeShellExtensionSettings* _tmp6_;
	GnomeShellExtensionSettings* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->shell_extension;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		GnomeShellExtensionSettings* _tmp3_;
		GnomeShellExtensionSettings* _tmp4_;
		_tmp3_ = gnome_shell_extension_get_settings (_tmp0_);
		_tmp4_ = _tmp3_;
		_tmp2_ = _tmp4_;
	}
	_tmp5_ = _g_object_ref0 (_tmp2_);
	settings = _tmp5_;
	_tmp6_ = self->priv->settings;
	_tmp7_ = settings;
	if (_tmp6_ != _tmp7_) {
		GnomeShellExtensionSettings* _tmp8_;
		GnomeShellExtensionSettings* _tmp9_;
		_tmp8_ = settings;
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_g_object_unref0 (self->priv->settings);
		self->priv->settings = _tmp9_;
		gnome_preferences_window_extension_setup (self);
	}
	_g_object_unref0 (settings);
}

static void
_gnome_preferences_window_extension_on_notify_visible_panel_g_object_notify (GObject* _sender,
                                                                             GParamSpec* pspec,
                                                                             gpointer self)
{
	gnome_preferences_window_extension_on_notify_visible_panel ((GnomePreferencesWindowExtension*) self);
}

static void
gnome_preferences_window_extension_on_notify_window (GnomePreferencesWindowExtension* self,
                                                     GObject* object,
                                                     GParamSpec* pspec)
{
	FtPreferencesWindow* _tmp0_;
	FtPreferencesWindow* _tmp1_;
	FtPreferencesWindow* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = ft_preferences_window_extension_get_window ((FtPreferencesWindowExtension*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		FtPreferencesWindow* _tmp4_;
		FtPreferencesWindow* _tmp5_;
		FtPreferencesWindow* _tmp6_;
		_tmp4_ = ft_preferences_window_extension_get_window ((FtPreferencesWindowExtension*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		g_signal_connect_object ((GObject*) _tmp6_, "notify::visible-panel", (GCallback) _gnome_preferences_window_extension_on_notify_visible_panel_g_object_notify, self, 0);
		_g_object_unref0 (_tmp6_);
	}
}

static void
gnome_preferences_window_extension_on_notify_settings (GnomePreferencesWindowExtension* self,
                                                       GObject* object,
                                                       GParamSpec* pspec)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	gnome_preferences_window_extension_update_settings (self);
}

static void
gnome_preferences_window_extension_on_notify_available (GnomePreferencesWindowExtension* self,
                                                        GObject* object,
                                                        GParamSpec* pspec)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	gnome_preferences_window_extension_setup (self);
}

static void
gnome_preferences_window_extension_on_notify_visible_panel (GnomePreferencesWindowExtension* self)
{
	g_return_if_fail (self != NULL);
	gnome_preferences_window_extension_setup (self);
}

static void
_gnome_preferences_window_extension_on_notify_settings_g_object_notify (GObject* _sender,
                                                                        GParamSpec* pspec,
                                                                        gpointer self)
{
	gnome_preferences_window_extension_on_notify_settings ((GnomePreferencesWindowExtension*) self, _sender, pspec);
}

static void
_gnome_preferences_window_extension_on_notify_available_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self)
{
	gnome_preferences_window_extension_on_notify_available ((GnomePreferencesWindowExtension*) self, _sender, pspec);
}

static void
gnome_preferences_window_extension_real_dispose (GObject* base)
{
	GnomePreferencesWindowExtension * self;
	FtPreferencesWindow* _tmp0_;
	FtPreferencesWindow* _tmp1_;
	FtPreferencesWindow* _tmp2_;
	gboolean _tmp3_;
	GnomeShellExtension* _tmp9_;
	self = (GnomePreferencesWindowExtension*) base;
	gnome_preferences_window_extension_taredown (self);
	_tmp0_ = ft_preferences_window_extension_get_window ((FtPreferencesWindowExtension*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		FtPreferencesWindow* _tmp4_;
		FtPreferencesWindow* _tmp5_;
		FtPreferencesWindow* _tmp6_;
		guint _tmp7_;
		GQuark _tmp8_;
		_tmp4_ = ft_preferences_window_extension_get_window ((FtPreferencesWindowExtension*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		g_signal_parse_name ("notify::visible-panel", G_TYPE_OBJECT, &_tmp7_, &_tmp8_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, _tmp8_, NULL, (GCallback) _gnome_preferences_window_extension_on_notify_visible_panel_g_object_notify, self);
		_g_object_unref0 (_tmp6_);
	}
	_tmp9_ = self->priv->shell_extension;
	if (_tmp9_ != NULL) {
		GnomeShellExtension* _tmp10_;
		guint _tmp11_;
		GQuark _tmp12_;
		GnomeShellExtension* _tmp13_;
		guint _tmp14_;
		GQuark _tmp15_;
		_tmp10_ = self->priv->shell_extension;
		g_signal_parse_name ("notify::settings", G_TYPE_OBJECT, &_tmp11_, &_tmp12_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, _tmp12_, NULL, (GCallback) _gnome_preferences_window_extension_on_notify_settings_g_object_notify, self);
		_tmp13_ = self->priv->shell_extension;
		g_signal_parse_name ("notify::available", G_TYPE_OBJECT, &_tmp14_, &_tmp15_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp13_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, _tmp15_, NULL, (GCallback) _gnome_preferences_window_extension_on_notify_available_g_object_notify, self);
		_g_object_unref0 (self->priv->shell_extension);
		self->priv->shell_extension = NULL;
	}
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = NULL;
	G_OBJECT_CLASS (gnome_preferences_window_extension_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_PREFERENCES_WINDOW_EXTENSION, FtPreferencesWindowExtension));
}

GnomePreferencesWindowExtension*
gnome_preferences_window_extension_construct (GType object_type)
{
	GnomePreferencesWindowExtension * self = NULL;
	self = (GnomePreferencesWindowExtension*) ft_preferences_window_extension_construct (object_type);
	return self;
}

GnomePreferencesWindowExtension*
gnome_preferences_window_extension_new (void)
{
	return gnome_preferences_window_extension_construct (GNOME_TYPE_PREFERENCES_WINDOW_EXTENSION);
}

static void
_gnome_preferences_window_extension_on_notify_window_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	gnome_preferences_window_extension_on_notify_window ((GnomePreferencesWindowExtension*) self, _sender, pspec);
}

static GObject *
gnome_preferences_window_extension_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GnomePreferencesWindowExtension * self;
	GnomeShellExtension* _tmp0_;
	GnomeShellExtension* _tmp1_;
	GnomeShellExtension* _tmp2_;
	parent_class = G_OBJECT_CLASS (gnome_preferences_window_extension_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GNOME_TYPE_PREFERENCES_WINDOW_EXTENSION, GnomePreferencesWindowExtension);
	_tmp0_ = gnome_shell_extension_new ();
	_g_object_unref0 (self->priv->shell_extension);
	self->priv->shell_extension = _tmp0_;
	_tmp1_ = self->priv->shell_extension;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::settings", (GCallback) _gnome_preferences_window_extension_on_notify_settings_g_object_notify, self, 0);
	_tmp2_ = self->priv->shell_extension;
	g_signal_connect_object ((GObject*) _tmp2_, "notify::available", (GCallback) _gnome_preferences_window_extension_on_notify_available_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::window", (GCallback) _gnome_preferences_window_extension_on_notify_window_g_object_notify, self, 0);
	gnome_preferences_window_extension_update_settings (self);
	return obj;
}

static void
gnome_preferences_window_extension_class_init (GnomePreferencesWindowExtensionClass * klass,
                                               gpointer klass_data)
{
	gnome_preferences_window_extension_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GnomePreferencesWindowExtension_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) gnome_preferences_window_extension_real_dispose;
	G_OBJECT_CLASS (klass)->constructor = gnome_preferences_window_extension_constructor;
	G_OBJECT_CLASS (klass)->finalize = gnome_preferences_window_extension_finalize;
}

static void
gnome_preferences_window_extension_instance_init (GnomePreferencesWindowExtension * self,
                                                  gpointer klass)
{
	self->priv = gnome_preferences_window_extension_get_instance_private (self);
	self->priv->shell_extension = NULL;
	self->priv->settings = NULL;
	self->priv->last_panel = NULL;
	self->priv->indicator_group = NULL;
	self->priv->screen_overlay_group = NULL;
	self->priv->desktop_group = NULL;
	self->priv->shell_extension_toggle = NULL;
	self->priv->manage_notifications_row = NULL;
	self->priv->manage_notifications_binding = NULL;
	self->priv->installing_extension = FALSE;
}

static void
gnome_preferences_window_extension_finalize (GObject * obj)
{
	GnomePreferencesWindowExtension * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GNOME_TYPE_PREFERENCES_WINDOW_EXTENSION, GnomePreferencesWindowExtension);
	_g_object_unref0 (self->priv->shell_extension);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->last_panel);
	_g_object_unref0 (self->priv->manage_notifications_binding);
	G_OBJECT_CLASS (gnome_preferences_window_extension_parent_class)->finalize (obj);
}

GType
gnome_preferences_window_extension_get_type (void)
{
	return gnome_preferences_window_extension_type_id;
}

GType
gnome_preferences_window_extension_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (GnomePreferencesWindowExtensionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gnome_preferences_window_extension_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GnomePreferencesWindowExtension), 0, (GInstanceInitFunc) gnome_preferences_window_extension_instance_init, NULL };
	gnome_preferences_window_extension_type_id = g_type_module_register_type (module, FT_TYPE_PREFERENCES_WINDOW_EXTENSION, "GnomePreferencesWindowExtension", &g_define_type_info, 0);
	GnomePreferencesWindowExtension_private_offset = sizeof (GnomePreferencesWindowExtensionPrivate);
	return gnome_preferences_window_extension_type_id;
}

