/* dialogs-problem-details-dialog.c generated by valac 0.56.3, the Vala compiler
 * generated from dialogs-problem-details-dialog.vala, do not modify */

/*
 * Copyright 2019 Michael Gratton <mike@vee.net>
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later). See the COPYING file in this distribution.
 */

#include "geary-client-43.0.h"
#include <gtk/gtk.h>
#include "geary-engine.h"
#include <gdk/gdk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>

#define DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_CLOSE "problem-details-close"
#define DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_SEARCH_TOGGLE "toggle-search"
#define DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_SEARCH_ACTIVATE "activate-search"

enum  {
	DIALOGS_PROBLEM_DETAILS_DIALOG_0_PROPERTY,
	DIALOGS_PROBLEM_DETAILS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dialogs_problem_details_dialog_properties[DIALOGS_PROBLEM_DETAILS_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _DialogsProblemDetailsDialogSaveData DialogsProblemDetailsDialogSaveData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _DialogsProblemDetailsDialogPrivate {
	GtkStack* stack;
	GtkButton* copy_button;
	GtkToggleButton* search_button;
	ComponentsInspectorErrorView* error_pane;
	ComponentsInspectorLogView* log_pane;
	ComponentsInspectorSystemView* system_pane;
	GearyErrorContext* error;
	GearyAccountInformation* account;
	GearyServiceInformation* service;
};

struct _DialogsProblemDetailsDialogSaveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DialogsProblemDetailsDialog* self;
	gchar* path;
	GCancellable* cancellable;
	GFile* dest;
	GFile* _tmp0_;
	GFileIOStream* dest_io;
	GFile* _tmp1_;
	GFileIOStream* _tmp2_;
	GDataOutputStream* out;
	GFileIOStream* _tmp3_;
	GOutputStream* _tmp4_;
	GBufferedOutputStream* _tmp5_;
	GBufferedOutputStream* _tmp6_;
	GDataOutputStream* _tmp7_;
	GDataOutputStream* _tmp8_;
	ComponentsInspectorErrorView* _tmp9_;
	GDataOutputStream* _tmp10_;
	GDataOutputStream* _tmp11_;
	ComponentsInspectorSystemView* _tmp12_;
	GDataOutputStream* _tmp13_;
	GDataOutputStream* _tmp14_;
	ComponentsInspectorLogView* _tmp15_;
	GDataOutputStream* _tmp16_;
	GDataOutputStream* _tmp17_;
	GFileIOStream* _tmp18_;
	GError* _inner_error0_;
};

static gint DialogsProblemDetailsDialog_private_offset;
static gpointer dialogs_problem_details_dialog_parent_class = NULL;

static void dialogs_problem_details_dialog_on_copy_clicked (DialogsProblemDetailsDialog* self);
static void _dialogs_problem_details_dialog_on_copy_clicked_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                       GVariant* parameter,
                                                                                       gpointer self);
static void dialogs_problem_details_dialog_on_close (DialogsProblemDetailsDialog* self);
static void _dialogs_problem_details_dialog_on_close_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                GVariant* parameter,
                                                                                gpointer self);
static void dialogs_problem_details_dialog_on_logs_search_toggled (DialogsProblemDetailsDialog* self,
                                                            GSimpleAction* action,
                                                            GVariant* param);
static void _dialogs_problem_details_dialog_on_logs_search_toggled_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                              GVariant* parameter,
                                                                                              gpointer self);
static void dialogs_problem_details_dialog_on_logs_search_activated (DialogsProblemDetailsDialog* self);
static void _dialogs_problem_details_dialog_on_logs_search_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                                GVariant* parameter,
                                                                                                gpointer self);
static void dialogs_problem_details_dialog_on_logs_selection_changed (DialogsProblemDetailsDialog* self);
static void _dialogs_problem_details_dialog_on_logs_selection_changed_components_inspector_log_view_record_selection_changed (ComponentsInspectorLogView* _sender,
                                                                                                                       gpointer self);
static gboolean dialogs_problem_details_dialog_real_key_press_event (GtkWidget* base,
                                                              GdkEventKey* event);
static void dialogs_problem_details_dialog_save_data_free (gpointer _data);
static void dialogs_problem_details_dialog_save (DialogsProblemDetailsDialog* self,
                                          const gchar* path,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dialogs_problem_details_dialog_save_finish (DialogsProblemDetailsDialog* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static gboolean dialogs_problem_details_dialog_save_co (DialogsProblemDetailsDialogSaveData* _data_);
static void dialogs_problem_details_dialog_save_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dialogs_problem_details_dialog_update_ui (DialogsProblemDetailsDialog* self);
static void dialogs_problem_details_dialog_on_visible_child_changed (DialogsProblemDetailsDialog* self);
static void _dialogs_problem_details_dialog_on_visible_child_changed_g_object_notify (GObject* _sender,
                                                                               GParamSpec* pspec,
                                                                               gpointer self);
static void dialogs_problem_details_dialog_on_save_as_clicked (DialogsProblemDetailsDialog* self);
static void ___lambda71_ (DialogsProblemDetailsDialog* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda71__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void _dialogs_problem_details_dialog_on_save_as_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                            gpointer self);
static gboolean _variant_get17 (GVariant* value);
static GVariant* _variant_new27 (gboolean value);
static void dialogs_problem_details_dialog_finalize (GObject * obj);
static GType dialogs_problem_details_dialog_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 const GActionEntry DIALOGS_PROBLEM_DETAILS_DIALOG_EDIT_ACTIONS[1] = {{ACTION_EDIT_COPY, _dialogs_problem_details_dialog_on_copy_clicked_gsimple_action_activate_callback}};
static const GActionEntry DIALOGS_PROBLEM_DETAILS_DIALOG_WINDOW_ACTIONS[4] = {{ACTION_WINDOW_CLOSE, _dialogs_problem_details_dialog_on_close_gsimple_action_activate_callback}, {DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_CLOSE, _dialogs_problem_details_dialog_on_close_gsimple_action_activate_callback}, {DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_SEARCH_TOGGLE, _dialogs_problem_details_dialog_on_logs_search_toggled_gsimple_action_activate_callback, NULL, "false"}, {DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_SEARCH_ACTIVATE, _dialogs_problem_details_dialog_on_logs_search_activated_gsimple_action_activate_callback}};

static inline gpointer
dialogs_problem_details_dialog_get_instance_private (DialogsProblemDetailsDialog* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsProblemDetailsDialog_private_offset);
}

static void
_dialogs_problem_details_dialog_on_copy_clicked_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                  GVariant* parameter,
                                                                                  gpointer self)
{
	dialogs_problem_details_dialog_on_copy_clicked ((DialogsProblemDetailsDialog*) self);
}

static void
_dialogs_problem_details_dialog_on_close_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self)
{
	dialogs_problem_details_dialog_on_close ((DialogsProblemDetailsDialog*) self);
}

static void
_dialogs_problem_details_dialog_on_logs_search_toggled_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                         GVariant* parameter,
                                                                                         gpointer self)
{
	dialogs_problem_details_dialog_on_logs_search_toggled ((DialogsProblemDetailsDialog*) self, action, parameter);
}

static void
_dialogs_problem_details_dialog_on_logs_search_activated_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                           GVariant* parameter,
                                                                                           gpointer self)
{
	dialogs_problem_details_dialog_on_logs_search_activated ((DialogsProblemDetailsDialog*) self);
}

void
dialogs_problem_details_dialog_add_accelerators (ApplicationClient* app)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	g_return_if_fail (APPLICATION_IS_CLIENT (app));
	_tmp0_ = g_strdup ("Escape");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	application_client_add_window_accelerators (app, DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_CLOSE, _tmp2_, (gint) 1, NULL);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	_tmp3_ = g_strdup ("<Ctrl>F");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = 1;
	application_client_add_window_accelerators (app, DIALOGS_PROBLEM_DETAILS_DIALOG_ACTION_SEARCH_ACTIVATE, _tmp5_, (gint) 1, NULL);
	_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
}

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

static void
_dialogs_problem_details_dialog_on_logs_selection_changed_components_inspector_log_view_record_selection_changed (ComponentsInspectorLogView* _sender,
                                                                                                                  gpointer self)
{
	dialogs_problem_details_dialog_on_logs_selection_changed ((DialogsProblemDetailsDialog*) self);
}

DialogsProblemDetailsDialog*
dialogs_problem_details_dialog_construct (GType object_type,
                                          GtkWindow* parent,
                                          ApplicationClient* application,
                                          GearyProblemReport* report)
{
	DialogsProblemDetailsDialog * self = NULL;
	GearyAccountProblemReport* account_report = NULL;
	GearyAccountProblemReport* _tmp0_;
	GearyServiceProblemReport* service_report = NULL;
	GearyServiceProblemReport* _tmp1_;
	GearyErrorContext* _tmp2_;
	GearyErrorContext* _tmp3_;
	GearyErrorContext* _tmp4_;
	GearyAccountInformation* _tmp5_ = NULL;
	GearyAccountProblemReport* _tmp6_;
	GearyAccountInformation* _tmp10_;
	GearyServiceInformation* _tmp11_ = NULL;
	GearyServiceProblemReport* _tmp12_;
	GearyServiceInformation* _tmp16_;
	GSimpleActionGroup* edit_actions = NULL;
	GSimpleActionGroup* _tmp17_;
	GSimpleActionGroup* window_actions = NULL;
	GSimpleActionGroup* _tmp18_;
	GearyErrorContext* _tmp19_;
	GearyAccountInformation* _tmp20_;
	GearyServiceInformation* _tmp21_;
	ComponentsInspectorErrorView* _tmp22_;
	ApplicationConfiguration* _tmp23_;
	ApplicationConfiguration* _tmp24_;
	GearyAccountInformation* _tmp25_;
	ComponentsInspectorLogView* _tmp26_;
	ComponentsInspectorLogView* _tmp27_;
	GearyLoggingRecord* _tmp28_;
	GearyLoggingRecord* _tmp29_;
	GearyLoggingRecord* _tmp30_;
	GearyLoggingRecord* _tmp31_;
	ComponentsInspectorLogView* _tmp32_;
	ComponentsInspectorSystemView* _tmp33_;
	GtkStack* _tmp34_;
	ComponentsInspectorErrorView* _tmp35_;
	GtkStack* _tmp36_;
	ComponentsInspectorLogView* _tmp37_;
	GtkStack* _tmp38_;
	ComponentsInspectorSystemView* _tmp39_;
	g_return_val_if_fail ((parent == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (parent, gtk_window_get_type ()), NULL);
	g_return_val_if_fail (APPLICATION_IS_CLIENT (application), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (report, GEARY_TYPE_PROBLEM_REPORT), NULL);
	self = (DialogsProblemDetailsDialog*) g_object_new (object_type, "transient-for", parent, "use-header-bar", 1, NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (report, GEARY_TYPE_ACCOUNT_PROBLEM_REPORT) ? ((GearyAccountProblemReport*) report) : NULL);
	account_report = _tmp0_;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (report, GEARY_TYPE_SERVICE_PROBLEM_REPORT) ? ((GearyServiceProblemReport*) report) : NULL);
	service_report = _tmp1_;
	_tmp2_ = geary_problem_report_get_error (report);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->error);
	self->priv->error = _tmp4_;
	_tmp6_ = account_report;
	if (_tmp6_ != NULL) {
		GearyAccountProblemReport* _tmp7_;
		GearyAccountInformation* _tmp8_;
		GearyAccountInformation* _tmp9_;
		_tmp7_ = account_report;
		_tmp8_ = geary_account_problem_report_get_account (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = _tmp9_;
	} else {
		_tmp5_ = NULL;
	}
	_tmp10_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (self->priv->account);
	self->priv->account = _tmp10_;
	_tmp12_ = service_report;
	if (_tmp12_ != NULL) {
		GearyServiceProblemReport* _tmp13_;
		GearyServiceInformation* _tmp14_;
		GearyServiceInformation* _tmp15_;
		_tmp13_ = service_report;
		_tmp14_ = geary_service_problem_report_get_service (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp11_ = _tmp15_;
	} else {
		_tmp11_ = NULL;
	}
	_tmp16_ = _g_object_ref0 (_tmp11_);
	_g_object_unref0 (self->priv->service);
	self->priv->service = _tmp16_;
	_tmp17_ = g_simple_action_group_new ();
	edit_actions = _tmp17_;
	g_action_map_add_action_entries (G_TYPE_CHECK_INSTANCE_CAST (edit_actions, g_action_map_get_type (), GActionMap), DIALOGS_PROBLEM_DETAILS_DIALOG_EDIT_ACTIONS, (gint) G_N_ELEMENTS (DIALOGS_PROBLEM_DETAILS_DIALOG_EDIT_ACTIONS), self);
	gtk_widget_insert_action_group (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), ACTION_EDIT_GROUP_NAME, G_TYPE_CHECK_INSTANCE_CAST (edit_actions, g_action_group_get_type (), GActionGroup));
	_tmp18_ = g_simple_action_group_new ();
	window_actions = _tmp18_;
	g_action_map_add_action_entries (G_TYPE_CHECK_INSTANCE_CAST (window_actions, g_action_map_get_type (), GActionMap), DIALOGS_PROBLEM_DETAILS_DIALOG_WINDOW_ACTIONS, (gint) G_N_ELEMENTS (DIALOGS_PROBLEM_DETAILS_DIALOG_WINDOW_ACTIONS), self);
	gtk_widget_insert_action_group (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), ACTION_WINDOW_GROUP_NAME, G_TYPE_CHECK_INSTANCE_CAST (window_actions, g_action_group_get_type (), GActionGroup));
	_tmp19_ = self->priv->error;
	_tmp20_ = self->priv->account;
	_tmp21_ = self->priv->service;
	_tmp22_ = components_inspector_error_view_new (_tmp19_, _tmp20_, _tmp21_);
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->error_pane);
	self->priv->error_pane = _tmp22_;
	_tmp23_ = application_client_get_config (application);
	_tmp24_ = _tmp23_;
	_tmp25_ = self->priv->account;
	_tmp26_ = components_inspector_log_view_new (_tmp24_, _tmp25_);
	g_object_ref_sink (_tmp26_);
	_g_object_unref0 (self->priv->log_pane);
	self->priv->log_pane = _tmp26_;
	_tmp27_ = self->priv->log_pane;
	_tmp28_ = geary_problem_report_get_earliest_log (report);
	_tmp29_ = _tmp28_;
	_tmp30_ = geary_problem_report_get_latest_log (report);
	_tmp31_ = _tmp30_;
	components_inspector_log_view_load (_tmp27_, _tmp29_, _tmp31_);
	_tmp32_ = self->priv->log_pane;
	g_signal_connect_object (_tmp32_, "record-selection-changed", (GCallback) _dialogs_problem_details_dialog_on_logs_selection_changed_components_inspector_log_view_record_selection_changed, self, 0);
	_tmp33_ = components_inspector_system_view_new (application);
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->system_pane);
	self->priv->system_pane = _tmp33_;
	_tmp34_ = self->priv->stack;
	_tmp35_ = self->priv->error_pane;
	gtk_stack_add_titled (_tmp34_, G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, gtk_widget_get_type (), GtkWidget), "error_pane", _ ("Details"));
	_tmp36_ = self->priv->stack;
	_tmp37_ = self->priv->log_pane;
	gtk_stack_add_titled (_tmp36_, G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, gtk_widget_get_type (), GtkWidget), "log_pane", _ ("Logs"));
	_tmp38_ = self->priv->stack;
	_tmp39_ = self->priv->system_pane;
	gtk_stack_add_titled (_tmp38_, G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, gtk_widget_get_type (), GtkWidget), "system_pane", _ ("System"));
	_g_object_unref0 (window_actions);
	_g_object_unref0 (edit_actions);
	_g_object_unref0 (service_report);
	_g_object_unref0 (account_report);
	return self;
}

DialogsProblemDetailsDialog*
dialogs_problem_details_dialog_new (GtkWindow* parent,
                                    ApplicationClient* application,
                                    GearyProblemReport* report)
{
	return dialogs_problem_details_dialog_construct (DIALOGS_TYPE_PROBLEM_DETAILS_DIALOG, parent, application, report);
}

static gboolean
dialogs_problem_details_dialog_real_key_press_event (GtkWidget* base,
                                                     GdkEventKey* event)
{
	DialogsProblemDetailsDialog * self;
	gboolean ret = FALSE;
	gboolean _tmp0_ = FALSE;
	ComponentsInspectorLogView* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, DIALOGS_TYPE_PROBLEM_DETAILS_DIALOG, DialogsProblemDetailsDialog);
	g_return_val_if_fail (event != NULL, FALSE);
	ret = GDK_EVENT_PROPAGATE;
	_tmp1_ = self->priv->log_pane;
	_tmp2_ = components_inspector_log_view_get_search_mode_enabled (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp0_ = event->keyval == GDK_KEY_Escape;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkToggleButton* _tmp4_;
		_tmp4_ = self->priv->search_button;
		gtk_toggle_button_set_active (_tmp4_, FALSE);
		ret = GDK_EVENT_STOP;
	}
	if (ret == GDK_EVENT_PROPAGATE) {
		ComponentsInspectorLogView* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = self->priv->log_pane;
		_tmp7_ = components_inspector_log_view_get_search_mode_enabled (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp5_ = _tmp8_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		ComponentsInspectorLogView* _tmp9_;
		_tmp9_ = self->priv->log_pane;
		ret = components_inspector_log_view_handle_key_press (_tmp9_, event);
	}
	if (ret == GDK_EVENT_PROPAGATE) {
		ret = GTK_WIDGET_CLASS (dialogs_problem_details_dialog_parent_class)->key_press_event (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog), gtk_widget_get_type (), GtkWidget), event);
	}
	if (ret == GDK_EVENT_PROPAGATE) {
		ComponentsInspectorLogView* _tmp11_;
		gboolean _tmp12_;
		gboolean _tmp13_;
		_tmp11_ = self->priv->log_pane;
		_tmp12_ = components_inspector_log_view_get_search_mode_enabled (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp10_ = !_tmp13_;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		ComponentsInspectorLogView* _tmp14_;
		_tmp14_ = self->priv->log_pane;
		ret = components_inspector_log_view_handle_key_press (_tmp14_, event);
		if (ret == GDK_EVENT_STOP) {
			GtkToggleButton* _tmp15_;
			_tmp15_ = self->priv->search_button;
			gtk_toggle_button_set_active (_tmp15_, TRUE);
		}
	}
	result = ret;
	return result;
}

static void
dialogs_problem_details_dialog_save_data_free (gpointer _data)
{
	DialogsProblemDetailsDialogSaveData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (DialogsProblemDetailsDialogSaveData, _data_);
}

static void
dialogs_problem_details_dialog_save (DialogsProblemDetailsDialog* self,
                                     const gchar* path,
                                     GCancellable* cancellable,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DialogsProblemDetailsDialogSaveData* _data_;
	DialogsProblemDetailsDialog* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	g_return_if_fail (path != NULL);
	g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()));
	_data_ = g_slice_new0 (DialogsProblemDetailsDialogSaveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dialogs_problem_details_dialog_save_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	dialogs_problem_details_dialog_save_co (_data_);
}

static void
dialogs_problem_details_dialog_save_finish (DialogsProblemDetailsDialog* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	DialogsProblemDetailsDialogSaveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
dialogs_problem_details_dialog_save_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DialogsProblemDetailsDialogSaveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dialogs_problem_details_dialog_save_co (_data_);
}

static gboolean
dialogs_problem_details_dialog_save_co (DialogsProblemDetailsDialogSaveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_file_new_for_path (_data_->path);
	_data_->dest = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->dest;
	_data_->_state_ = 1;
	g_file_replace_readwrite_async (_data_->_tmp1_, NULL, FALSE, G_FILE_CREATE_NONE, G_PRIORITY_DEFAULT, _data_->cancellable, dialogs_problem_details_dialog_save_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = g_file_replace_readwrite_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
	_data_->dest_io = _data_->_tmp2_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->dest_io;
	_data_->_tmp4_ = g_io_stream_get_output_stream (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, g_io_stream_get_type (), GIOStream));
	_data_->_tmp5_ = (GBufferedOutputStream*) g_buffered_output_stream_new (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = g_data_output_stream_new (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp6_, g_output_stream_get_type (), GOutputStream));
	_data_->_tmp8_ = _data_->_tmp7_;
	_g_object_unref0 (_data_->_tmp6_);
	_data_->out = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->self->priv->error_pane;
	_data_->_tmp10_ = _data_->out;
	components_inspector_error_view_save (_data_->_tmp9_, _data_->_tmp10_, COMPONENTS_INSPECTOR_TEXT_FORMAT_PLAIN, _data_->cancellable, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = _data_->out;
	g_data_output_stream_put_string (_data_->_tmp11_, "\n", NULL, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = _data_->self->priv->system_pane;
	_data_->_tmp13_ = _data_->out;
	components_inspector_system_view_save (_data_->_tmp12_, _data_->_tmp13_, COMPONENTS_INSPECTOR_TEXT_FORMAT_PLAIN, _data_->cancellable, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp14_ = _data_->out;
	g_data_output_stream_put_string (_data_->_tmp14_, "\n", NULL, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp15_ = _data_->self->priv->log_pane;
	_data_->_tmp16_ = _data_->out;
	components_inspector_log_view_save (_data_->_tmp15_, _data_->_tmp16_, COMPONENTS_INSPECTOR_TEXT_FORMAT_PLAIN, TRUE, _data_->cancellable, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp17_ = _data_->out;
	_data_->_state_ = 2;
	g_output_stream_close_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp17_, g_output_stream_get_type (), GOutputStream), G_PRIORITY_DEFAULT, NULL, dialogs_problem_details_dialog_save_ready, _data_);
	return FALSE;
	_state_2:
	g_output_stream_close_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp17_, g_output_stream_get_type (), GOutputStream), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp18_ = _data_->dest_io;
	_data_->_state_ = 3;
	g_io_stream_close_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp18_, g_io_stream_get_type (), GIOStream), G_PRIORITY_DEFAULT, NULL, dialogs_problem_details_dialog_save_ready, _data_);
	return FALSE;
	_state_3:
	g_io_stream_close_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp18_, g_io_stream_get_type (), GIOStream), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->out);
		_g_object_unref0 (_data_->dest_io);
		_g_object_unref0 (_data_->dest);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->out);
	_g_object_unref0 (_data_->dest_io);
	_g_object_unref0 (_data_->dest);
	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
dialogs_problem_details_dialog_update_ui (DialogsProblemDetailsDialog* self)
{
	gboolean logs_visible = FALSE;
	GtkStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	ComponentsInspectorLogView* _tmp3_;
	guint logs_selected = 0U;
	ComponentsInspectorLogView* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GtkButton* _tmp6_;
	GtkToggleButton* _tmp7_;
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	_tmp0_ = self->priv->stack;
	_tmp1_ = gtk_stack_get_visible_child (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->log_pane;
	logs_visible = _tmp2_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_widget_get_type (), GtkWidget);
	_tmp4_ = self->priv->log_pane;
	logs_selected = (guint) components_inspector_log_view_count_selected_records (_tmp4_);
	if (!logs_visible) {
		_tmp5_ = TRUE;
	} else {
		_tmp5_ = logs_selected > ((guint) 0);
	}
	_tmp6_ = self->priv->copy_button;
	gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_widget_get_type (), GtkWidget), _tmp5_);
	_tmp7_ = self->priv->search_button;
	gtk_widget_set_visible (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_widget_get_type (), GtkWidget), logs_visible);
}

static void
dialogs_problem_details_dialog_on_visible_child_changed (DialogsProblemDetailsDialog* self)
{
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	dialogs_problem_details_dialog_update_ui (self);
}

static void
_dialogs_problem_details_dialog_on_visible_child_changed_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self)
{
	dialogs_problem_details_dialog_on_visible_child_changed ((DialogsProblemDetailsDialog*) self);
}

static void
dialogs_problem_details_dialog_on_copy_clicked (DialogsProblemDetailsDialog* self)
{
	GMemoryOutputStream* bytes = NULL;
	GMemoryOutputStream* _tmp0_;
	GDataOutputStream* out = NULL;
	GMemoryOutputStream* _tmp1_;
	GDataOutputStream* _tmp2_;
	gchar* clipboard_value = NULL;
	GMemoryOutputStream* _tmp24_;
	guint8* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	_tmp0_ = (GMemoryOutputStream*) g_memory_output_stream_new_resizable ();
	bytes = _tmp0_;
	_tmp1_ = bytes;
	_tmp2_ = g_data_output_stream_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, g_output_stream_get_type (), GOutputStream));
	out = _tmp2_;
	{
		GtkStack* _tmp3_;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		ComponentsInspectorErrorView* _tmp6_;
		GDataOutputStream* _tmp21_;
		_tmp3_ = self->priv->stack;
		_tmp4_ = gtk_stack_get_visible_child (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = self->priv->error_pane;
		if (_tmp5_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_widget_get_type (), GtkWidget)) {
			ComponentsInspectorErrorView* _tmp7_;
			GDataOutputStream* _tmp8_;
			_tmp7_ = self->priv->error_pane;
			_tmp8_ = out;
			components_inspector_error_view_save (_tmp7_, _tmp8_, COMPONENTS_INSPECTOR_TEXT_FORMAT_MARKDOWN, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			GtkStack* _tmp9_;
			GtkWidget* _tmp10_;
			GtkWidget* _tmp11_;
			ComponentsInspectorLogView* _tmp12_;
			_tmp9_ = self->priv->stack;
			_tmp10_ = gtk_stack_get_visible_child (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = self->priv->log_pane;
			if (_tmp11_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, gtk_widget_get_type (), GtkWidget)) {
				ComponentsInspectorLogView* _tmp13_;
				GDataOutputStream* _tmp14_;
				_tmp13_ = self->priv->log_pane;
				_tmp14_ = out;
				components_inspector_log_view_save (_tmp13_, _tmp14_, COMPONENTS_INSPECTOR_TEXT_FORMAT_MARKDOWN, FALSE, NULL, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			} else {
				GtkStack* _tmp15_;
				GtkWidget* _tmp16_;
				GtkWidget* _tmp17_;
				ComponentsInspectorSystemView* _tmp18_;
				_tmp15_ = self->priv->stack;
				_tmp16_ = gtk_stack_get_visible_child (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp18_ = self->priv->system_pane;
				if (_tmp17_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, gtk_widget_get_type (), GtkWidget)) {
					ComponentsInspectorSystemView* _tmp19_;
					GDataOutputStream* _tmp20_;
					_tmp19_ = self->priv->system_pane;
					_tmp20_ = out;
					components_inspector_system_view_save (_tmp19_, _tmp20_, COMPONENTS_INSPECTOR_TEXT_FORMAT_MARKDOWN, NULL, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
				}
			}
		}
		_tmp21_ = out;
		g_data_output_stream_put_byte (_tmp21_, (guint8) 0, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		GError* _tmp22_;
		const gchar* _tmp23_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp22_ = err;
		_tmp23_ = _tmp22_->message;
		g_warning ("dialogs-problem-details-dialog.vala:202: Error saving inspector data f" \
"or clipboard: %s", _tmp23_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (out);
		_g_object_unref0 (bytes);
		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;
	}
	_tmp24_ = bytes;
	_tmp25_ = g_memory_output_stream_get_data (_tmp24_);
	_tmp26_ = g_strdup ((const gchar*) _tmp25_);
	clipboard_value = _tmp26_;
	_tmp27_ = clipboard_value;
	if (!geary_string_is_empty (_tmp27_)) {
		GtkClipboard* _tmp28_;
		const gchar* _tmp29_;
		_tmp28_ = gtk_widget_get_clipboard (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), GDK_SELECTION_CLIPBOARD);
		_tmp29_ = clipboard_value;
		gtk_clipboard_set_text (_tmp28_, _tmp29_, -1);
	}
	_g_free0 (clipboard_value);
	_g_object_unref0 (out);
	_g_object_unref0 (bytes);
}

static void
___lambda71_ (DialogsProblemDetailsDialog* self,
              GObject* obj,
              GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
	{
		dialogs_problem_details_dialog_save_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = err;
		_tmp1_ = _tmp0_->message;
		g_warning ("dialogs-problem-details-dialog.vala:237: Failed to save problem report" \
" data: %s", _tmp1_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
____lambda71__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda71_ ((DialogsProblemDetailsDialog*) self, source_object, res);
	g_object_unref (self);
}

static void
dialogs_problem_details_dialog_on_save_as_clicked (DialogsProblemDetailsDialog* self)
{
	GtkFileChooserNative* chooser = NULL;
	GtkFileChooserNative* _tmp0_;
	GtkFileChooserNative* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GtkFileChooserNative* _tmp6_;
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	_tmp0_ = gtk_file_chooser_native_new (_ ("Save As"), G_TYPE_CHECK_INSTANCE_CAST (self, gtk_window_get_type (), GtkWindow), GTK_FILE_CHOOSER_ACTION_SAVE, _ ("Save As"), _ ("Cancel"));
	chooser = _tmp0_;
	_tmp1_ = chooser;
	_tmp2_ = g_date_time_new_now_local ();
	_tmp3_ = _tmp2_;
	_tmp4_ = g_date_time_format (_tmp3_, "Geary Problem Report - %F %T.txt");
	_tmp5_ = _tmp4_;
	gtk_file_chooser_set_current_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_file_chooser_get_type (), GtkFileChooser), _tmp5_);
	_g_free0 (_tmp5_);
	_g_date_time_unref0 (_tmp3_);
	_tmp6_ = chooser;
	if (gtk_native_dialog_run (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_native_dialog_get_type (), GtkNativeDialog)) == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserNative* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp7_ = chooser;
		_tmp8_ = gtk_file_chooser_get_filename (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_file_chooser_get_type (), GtkFileChooser));
		_tmp9_ = _tmp8_;
		dialogs_problem_details_dialog_save (self, _tmp9_, NULL, ____lambda71__gasync_ready_callback, g_object_ref (self));
		_g_free0 (_tmp9_);
	}
	_g_object_unref0 (chooser);
}

static void
_dialogs_problem_details_dialog_on_save_as_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self)
{
	dialogs_problem_details_dialog_on_save_as_clicked ((DialogsProblemDetailsDialog*) self);
}

static void
dialogs_problem_details_dialog_on_logs_selection_changed (DialogsProblemDetailsDialog* self)
{
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	dialogs_problem_details_dialog_update_ui (self);
}

static gboolean
_variant_get17 (GVariant* value)
{
	return g_variant_get_boolean (value);
}

static GVariant*
_variant_new27 (gboolean value)
{
	return g_variant_ref_sink (g_variant_new_boolean (value));
}

static void
dialogs_problem_details_dialog_on_logs_search_toggled (DialogsProblemDetailsDialog* self,
                                                       GSimpleAction* action,
                                                       GVariant* param)
{
	gboolean enabled = FALSE;
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	ComponentsInspectorLogView* _tmp5_;
	GVariant* _tmp6_;
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (action, g_simple_action_get_type ()));
	_tmp0_ = g_action_get_state (G_TYPE_CHECK_INSTANCE_CAST (action, g_action_get_type (), GAction));
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _variant_get17 (_tmp2_);
	_tmp4_ = !_tmp3_;
	_g_variant_unref0 (_tmp2_);
	enabled = _tmp4_;
	_tmp5_ = self->priv->log_pane;
	components_inspector_log_view_set_search_mode_enabled (_tmp5_, enabled);
	_tmp6_ = _variant_new27 (enabled);
	g_simple_action_set_state (action, _tmp6_);
	_g_variant_unref0 (_tmp6_);
}

static void
dialogs_problem_details_dialog_on_logs_search_activated (DialogsProblemDetailsDialog* self)
{
	GtkToggleButton* _tmp0_;
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	_tmp0_ = self->priv->search_button;
	gtk_toggle_button_set_active (_tmp0_, TRUE);
}

static void
dialogs_problem_details_dialog_on_close (DialogsProblemDetailsDialog* self)
{
	g_return_if_fail (DIALOGS_IS_PROBLEM_DETAILS_DIALOG (self));
	gtk_widget_destroy (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
}

static void
dialogs_problem_details_dialog_class_init (DialogsProblemDetailsDialogClass * klass,
                                           gpointer klass_data)
{
	dialogs_problem_details_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsProblemDetailsDialog_private_offset);
	((GtkWidgetClass *) klass)->key_press_event = (gboolean (*) (GtkWidget*, GdkEventKey*)) dialogs_problem_details_dialog_real_key_press_event;
	G_OBJECT_CLASS (klass)->finalize = dialogs_problem_details_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Geary/problem-details-dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, DialogsProblemDetailsDialog_private_offset + G_STRUCT_OFFSET (DialogsProblemDetailsDialogPrivate, stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "copy_button", FALSE, DialogsProblemDetailsDialog_private_offset + G_STRUCT_OFFSET (DialogsProblemDetailsDialogPrivate, copy_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "search_button", FALSE, DialogsProblemDetailsDialog_private_offset + G_STRUCT_OFFSET (DialogsProblemDetailsDialogPrivate, search_button));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_visible_child_changed", G_CALLBACK(_dialogs_problem_details_dialog_on_visible_child_changed_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_save_as_clicked", G_CALLBACK(_dialogs_problem_details_dialog_on_save_as_clicked_gtk_button_clicked));
}

static void
dialogs_problem_details_dialog_instance_init (DialogsProblemDetailsDialog * self,
                                              gpointer klass)
{
	self->priv = dialogs_problem_details_dialog_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
dialogs_problem_details_dialog_finalize (GObject * obj)
{
	DialogsProblemDetailsDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_PROBLEM_DETAILS_DIALOG, DialogsProblemDetailsDialog);
	_g_object_unref0 (self->priv->error_pane);
	_g_object_unref0 (self->priv->log_pane);
	_g_object_unref0 (self->priv->system_pane);
	_g_object_unref0 (self->priv->error);
	_g_object_unref0 (self->priv->account);
	_g_object_unref0 (self->priv->service);
	G_OBJECT_CLASS (dialogs_problem_details_dialog_parent_class)->finalize (obj);
}

/**
 * Displays technical details when a problem has been reported.
 */
static GType
dialogs_problem_details_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsProblemDetailsDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_problem_details_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsProblemDetailsDialog), 0, (GInstanceInitFunc) dialogs_problem_details_dialog_instance_init, NULL };
	GType dialogs_problem_details_dialog_type_id;
	dialogs_problem_details_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "DialogsProblemDetailsDialog", &g_define_type_info, 0);
	DialogsProblemDetailsDialog_private_offset = g_type_add_instance_private (dialogs_problem_details_dialog_type_id, sizeof (DialogsProblemDetailsDialogPrivate));
	return dialogs_problem_details_dialog_type_id;
}

GType
dialogs_problem_details_dialog_get_type (void)
{
	static volatile gsize dialogs_problem_details_dialog_type_id__once = 0;
	if (g_once_init_enter (&dialogs_problem_details_dialog_type_id__once)) {
		GType dialogs_problem_details_dialog_type_id;
		dialogs_problem_details_dialog_type_id = dialogs_problem_details_dialog_get_type_once ();
		g_once_init_leave (&dialogs_problem_details_dialog_type_id__once, dialogs_problem_details_dialog_type_id);
	}
	return dialogs_problem_details_dialog_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);
}

