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

#include <granite.h>
#include <glib-object.h>
#include "pantheon-files-core.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define FILES_VIEW_TYPE_WELCOME (files_view_welcome_get_type ())
#define FILES_VIEW_WELCOME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILES_VIEW_TYPE_WELCOME, FilesViewWelcome))
#define FILES_VIEW_WELCOME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FILES_VIEW_TYPE_WELCOME, FilesViewWelcomeClass))
#define FILES_VIEW_IS_WELCOME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FILES_VIEW_TYPE_WELCOME))
#define FILES_VIEW_IS_WELCOME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FILES_VIEW_TYPE_WELCOME))
#define FILES_VIEW_WELCOME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FILES_VIEW_TYPE_WELCOME, FilesViewWelcomeClass))

typedef struct _FilesViewWelcome FilesViewWelcome;
typedef struct _FilesViewWelcomeClass FilesViewWelcomeClass;
typedef struct _FilesViewWelcomePrivate FilesViewWelcomePrivate;

#define FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND (files_view_directory_not_found_get_type ())
#define FILES_VIEW_DIRECTORY_NOT_FOUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND, FilesViewDirectoryNotFound))
#define FILES_VIEW_DIRECTORY_NOT_FOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND, FilesViewDirectoryNotFoundClass))
#define FILES_VIEW_IS_DIRECTORY_NOT_FOUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND))
#define FILES_VIEW_IS_DIRECTORY_NOT_FOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND))
#define FILES_VIEW_DIRECTORY_NOT_FOUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND, FilesViewDirectoryNotFoundClass))

typedef struct _FilesViewDirectoryNotFound FilesViewDirectoryNotFound;
typedef struct _FilesViewDirectoryNotFoundClass FilesViewDirectoryNotFoundClass;
typedef struct _FilesViewDirectoryNotFoundPrivate FilesViewDirectoryNotFoundPrivate;

#define FILES_VIEW_TYPE_VIEW_CONTAINER (files_view_view_container_get_type ())
#define FILES_VIEW_VIEW_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILES_VIEW_TYPE_VIEW_CONTAINER, FilesViewViewContainer))
#define FILES_VIEW_VIEW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FILES_VIEW_TYPE_VIEW_CONTAINER, FilesViewViewContainerClass))
#define FILES_VIEW_IS_VIEW_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FILES_VIEW_TYPE_VIEW_CONTAINER))
#define FILES_VIEW_IS_VIEW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FILES_VIEW_TYPE_VIEW_CONTAINER))
#define FILES_VIEW_VIEW_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FILES_VIEW_TYPE_VIEW_CONTAINER, FilesViewViewContainerClass))

typedef struct _FilesViewViewContainer FilesViewViewContainer;
typedef struct _FilesViewViewContainerClass FilesViewViewContainerClass;
enum  {
	FILES_VIEW_DIRECTORY_NOT_FOUND_0_PROPERTY,
	FILES_VIEW_DIRECTORY_NOT_FOUND_NUM_PROPERTIES
};
static GParamSpec* files_view_directory_not_found_properties[FILES_VIEW_DIRECTORY_NOT_FOUND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block38Data Block38Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _FilesViewWelcome {
	GraniteWidgetsWelcome parent_instance;
	FilesViewWelcomePrivate * priv;
};

struct _FilesViewWelcomeClass {
	GraniteWidgetsWelcomeClass parent_class;
};

struct _FilesViewDirectoryNotFound {
	FilesViewWelcome parent_instance;
	FilesViewDirectoryNotFoundPrivate * priv;
	FilesDirectory* dir_saved;
	FilesViewViewContainer* ctab;
};

struct _FilesViewDirectoryNotFoundClass {
	FilesViewWelcomeClass parent_class;
};

struct _Block38Data {
	int _ref_count_;
	FilesViewDirectoryNotFound* self;
	FilesDirectory* dir;
};

static gpointer files_view_directory_not_found_parent_class = NULL;

VALA_EXTERN GType files_view_welcome_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FilesViewWelcome, g_object_unref)
VALA_EXTERN GType files_view_directory_not_found_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FilesViewDirectoryNotFound, g_object_unref)
VALA_EXTERN GType files_view_view_container_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FilesViewViewContainer, g_object_unref)
VALA_EXTERN FilesViewDirectoryNotFound* files_view_directory_not_found_new (FilesDirectory* dir,
                                                                FilesViewViewContainer* tab);
VALA_EXTERN FilesViewDirectoryNotFound* files_view_directory_not_found_construct (GType object_type,
                                                                      FilesDirectory* dir,
                                                                      FilesViewViewContainer* tab);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
VALA_EXTERN FilesViewWelcome* files_view_welcome_new (const gchar* primary,
                                          const gchar* secondary);
VALA_EXTERN FilesViewWelcome* files_view_welcome_construct (GType object_type,
                                                const gchar* primary,
                                                const gchar* secondary);
static void __lambda72_ (Block38Data* _data38_,
                  gint index);
static void _gtk_widget_destroy_gtk_dialog_response (GtkDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void ___lambda72__granite_widgets_welcome_activated (GraniteWidgetsWelcome* _sender,
                                                     gint index,
                                                     gpointer self);
static void files_view_directory_not_found_finalize (GObject * obj);
static GType files_view_directory_not_found_get_type_once (void);

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

static Block38Data*
block38_data_ref (Block38Data* _data38_)
{
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}

static void
block38_data_unref (void * _userdata_)
{
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		FilesViewDirectoryNotFound* self;
		self = _data38_->self;
		_g_object_unref0 (_data38_->dir);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

static void
_gtk_widget_destroy_gtk_dialog_response (GtkDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	gtk_widget_destroy ((GtkWidget*) self);
}

static void
__lambda72_ (Block38Data* _data38_,
             gint index)
{
	FilesViewDirectoryNotFound* self;
	gboolean success = FALSE;
	GError* _inner_error0_ = NULL;
	self = _data38_->self;
	success = FALSE;
	{
		gboolean _tmp0_ = FALSE;
		GFile* _tmp1_;
		GFile* _tmp2_;
		_tmp1_ = files_directory_get_location (_data38_->dir);
		_tmp2_ = _tmp1_;
		_tmp0_ = g_file_make_directory_with_parents (_tmp2_, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		success = _tmp0_;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		if (g_error_matches (_tmp3_, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
			success = TRUE;
		} else {
			GraniteMessageDialog* dialog = NULL;
			GError* _tmp4_;
			const gchar* _tmp5_;
			GThemedIcon* _tmp6_;
			GThemedIcon* _tmp7_;
			GraniteMessageDialog* _tmp8_;
			GraniteMessageDialog* _tmp9_;
			GraniteMessageDialog* _tmp10_;
			GraniteMessageDialog* _tmp11_;
			GraniteMessageDialog* _tmp12_;
			_tmp4_ = e;
			_tmp5_ = _tmp4_->message;
			_tmp6_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
			_tmp7_ = _tmp6_;
			_tmp8_ = granite_message_dialog_new (_ ("Failed to create the folder"), _tmp5_, (GIcon*) _tmp7_, GTK_BUTTONS_CLOSE);
			g_object_ref_sink (_tmp8_);
			_tmp9_ = _tmp8_;
			_g_object_unref0 (_tmp7_);
			dialog = _tmp9_;
			_tmp10_ = dialog;
			_tmp11_ = dialog;
			g_signal_connect_object ((GtkDialog*) _tmp10_, "response", (GCallback) _gtk_widget_destroy_gtk_dialog_response, (GtkWidget*) _tmp11_, 0);
			_tmp12_ = dialog;
			gtk_window_present ((GtkWindow*) _tmp12_);
			_g_object_unref0 (dialog);
		}
		_g_error_free0 (e);
	}
	__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;
	}
	if (success) {
		GActionGroup* _tmp13_;
		_tmp13_ = gtk_widget_get_action_group ((GtkWidget*) self, "win");
		g_action_group_activate_action (_tmp13_, "refresh", NULL);
	}
}

static void
___lambda72__granite_widgets_welcome_activated (GraniteWidgetsWelcome* _sender,
                                                gint index,
                                                gpointer self)
{
	__lambda72_ (self, index);
}

FilesViewDirectoryNotFound*
files_view_directory_not_found_construct (GType object_type,
                                          FilesDirectory* dir,
                                          FilesViewViewContainer* tab)
{
	FilesViewDirectoryNotFound * self = NULL;
	Block38Data* _data38_;
	FilesDirectory* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GFile* _tmp7_;
	GFile* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	FilesDirectory* _tmp13_;
	FilesViewViewContainer* _tmp14_;
	g_return_val_if_fail (dir != NULL, NULL);
	g_return_val_if_fail (tab != NULL, NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (dir);
	_g_object_unref0 (_data38_->dir);
	_data38_->dir = _tmp0_;
	_tmp1_ = files_directory_get_location (_data38_->dir);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_file_get_basename (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup_printf (_ ("The folder \"%s\" can't be found."), _tmp4_);
	_tmp6_ = _tmp5_;
	self = (FilesViewDirectoryNotFound*) files_view_welcome_construct (object_type, _ ("This Folder Does Not Exist"), _tmp6_);
	_data38_->self = g_object_ref (self);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_tmp7_ = files_directory_get_location (_data38_->dir);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_file_get_basename (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strdup_printf (_ ("Create the folder \"%s\""), _tmp10_);
	_tmp12_ = _tmp11_;
	granite_widgets_welcome_append ((GraniteWidgetsWelcome*) self, "folder-new", _ ("Create"), _tmp12_);
	_g_free0 (_tmp12_);
	_g_free0 (_tmp10_);
	_tmp13_ = _g_object_ref0 (_data38_->dir);
	_g_object_unref0 (self->dir_saved);
	self->dir_saved = _tmp13_;
	_tmp14_ = _g_object_ref0 (tab);
	_g_object_unref0 (self->ctab);
	self->ctab = _tmp14_;
	g_signal_connect_data ((GraniteWidgetsWelcome*) self, "activated", (GCallback) ___lambda72__granite_widgets_welcome_activated, block38_data_ref (_data38_), (GClosureNotify) block38_data_unref, 0);
	gtk_widget_show_all ((GtkWidget*) self);
	block38_data_unref (_data38_);
	_data38_ = NULL;
	return self;
}

FilesViewDirectoryNotFound*
files_view_directory_not_found_new (FilesDirectory* dir,
                                    FilesViewViewContainer* tab)
{
	return files_view_directory_not_found_construct (FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND, dir, tab);
}

static void
files_view_directory_not_found_class_init (FilesViewDirectoryNotFoundClass * klass,
                                           gpointer klass_data)
{
	files_view_directory_not_found_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = files_view_directory_not_found_finalize;
}

static void
files_view_directory_not_found_instance_init (FilesViewDirectoryNotFound * self,
                                              gpointer klass)
{
}

static void
files_view_directory_not_found_finalize (GObject * obj)
{
	FilesViewDirectoryNotFound * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FILES_VIEW_TYPE_DIRECTORY_NOT_FOUND, FilesViewDirectoryNotFound);
	_g_object_unref0 (self->dir_saved);
	_g_object_unref0 (self->ctab);
	G_OBJECT_CLASS (files_view_directory_not_found_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
files_view_directory_not_found_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FilesViewDirectoryNotFoundClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) files_view_directory_not_found_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FilesViewDirectoryNotFound), 0, (GInstanceInitFunc) files_view_directory_not_found_instance_init, NULL };
	GType files_view_directory_not_found_type_id;
	files_view_directory_not_found_type_id = g_type_register_static (FILES_VIEW_TYPE_WELCOME, "FilesViewDirectoryNotFound", &g_define_type_info, 0);
	return files_view_directory_not_found_type_id;
}

GType
files_view_directory_not_found_get_type (void)
{
	static volatile gsize files_view_directory_not_found_type_id__once = 0;
	if (g_once_init_enter (&files_view_directory_not_found_type_id__once)) {
		GType files_view_directory_not_found_type_id;
		files_view_directory_not_found_type_id = files_view_directory_not_found_get_type_once ();
		g_once_init_leave (&files_view_directory_not_found_type_id__once, files_view_directory_not_found_type_id);
	}
	return files_view_directory_not_found_type_id__once;
}

