/* shared-folder-popover.c generated by valac 0.37.1.4-3591e, the Vala compiler
 * generated from shared-folder-popover.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>


#define BOXES_TYPE_SHARED_FOLDER_POPOVER (boxes_shared_folder_popover_get_type ())
#define BOXES_SHARED_FOLDER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SHARED_FOLDER_POPOVER, BoxesSharedFolderPopover))
#define BOXES_SHARED_FOLDER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SHARED_FOLDER_POPOVER, BoxesSharedFolderPopoverClass))
#define BOXES_IS_SHARED_FOLDER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SHARED_FOLDER_POPOVER))
#define BOXES_IS_SHARED_FOLDER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SHARED_FOLDER_POPOVER))
#define BOXES_SHARED_FOLDER_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SHARED_FOLDER_POPOVER, BoxesSharedFolderPopoverClass))

typedef struct _BoxesSharedFolderPopover BoxesSharedFolderPopover;
typedef struct _BoxesSharedFolderPopoverClass BoxesSharedFolderPopoverClass;
typedef struct _BoxesSharedFolderPopoverPrivate BoxesSharedFolderPopoverPrivate;
enum  {
	BOXES_SHARED_FOLDER_POPOVER_DUMMY_PROPERTY,
	BOXES_SHARED_FOLDER_POPOVER_LAST_PROPERTY
};
static GParamSpec* boxes_shared_folder_popover_properties[BOXES_SHARED_FOLDER_POPOVER_LAST_PROPERTY];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	BOXES_SHARED_FOLDER_POPOVER_SAVED_SIGNAL,
	BOXES_SHARED_FOLDER_POPOVER_LAST_SIGNAL
};
static guint boxes_shared_folder_popover_signals[BOXES_SHARED_FOLDER_POPOVER_LAST_SIGNAL] = {0};

struct _BoxesSharedFolderPopover {
	GtkPopover parent_instance;
	BoxesSharedFolderPopoverPrivate * priv;
	GtkFileChooserButton* file_chooser_button;
	GtkEntry* name_entry;
	gint target_position;
};

struct _BoxesSharedFolderPopoverClass {
	GtkPopoverClass parent_class;
};


static gpointer boxes_shared_folder_popover_parent_class = NULL;

GType boxes_shared_folder_popover_get_type (void) G_GNUC_CONST;
void boxes_shared_folder_popover_on_cancel (BoxesSharedFolderPopover* self, GtkButton* cancel_button);
static void _boxes_shared_folder_popover_on_cancel_gtk_button_clicked (GtkButton* _sender, gpointer self);
void boxes_shared_folder_popover_on_save (BoxesSharedFolderPopover* self, GtkButton* save_button);
static void _boxes_shared_folder_popover_on_save_gtk_button_clicked (GtkButton* _sender, gpointer self);
BoxesSharedFolderPopover* boxes_shared_folder_popover_new (void);
BoxesSharedFolderPopover* boxes_shared_folder_popover_construct (GType object_type);
static void g_cclosure_user_marshal_VOID__STRING_STRING_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void boxes_shared_folder_popover_finalize (GObject * obj);


void boxes_shared_folder_popover_on_cancel (BoxesSharedFolderPopover* self, GtkButton* cancel_button) {
#line 16 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	g_return_if_fail (self != NULL);
#line 16 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	g_return_if_fail (cancel_button != NULL);
#line 17 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_popover_popdown ((GtkPopover*) self);
#line 71 "shared-folder-popover.c"
}


static void _boxes_shared_folder_popover_on_cancel_gtk_button_clicked (GtkButton* _sender, gpointer self) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	boxes_shared_folder_popover_on_cancel ((BoxesSharedFolderPopover*) self, _sender);
#line 78 "shared-folder-popover.c"
}


void boxes_shared_folder_popover_on_save (BoxesSharedFolderPopover* self, GtkButton* save_button) {
	gchar* path = NULL;
	GtkFileChooserButton* _tmp0_;
	gchar* _tmp1_;
	gchar* name = NULL;
	GtkEntry* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
#line 21 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	g_return_if_fail (self != NULL);
#line 21 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	g_return_if_fail (save_button != NULL);
#line 22 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_tmp0_ = self->file_chooser_button;
#line 22 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_tmp1_ = gtk_file_chooser_get_uri ((GtkFileChooser*) _tmp0_);
#line 22 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	path = _tmp1_;
#line 23 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_tmp2_ = self->name_entry;
#line 23 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_tmp3_ = gtk_entry_get_text (_tmp2_);
#line 23 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_tmp4_ = g_strdup (_tmp3_);
#line 23 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	name = _tmp4_;
#line 25 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_tmp5_ = path;
#line 25 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	if (_tmp5_ != NULL) {
#line 113 "shared-folder-popover.c"
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gint _tmp13_;
#line 26 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		_tmp6_ = path;
#line 26 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		_tmp7_ = path;
#line 26 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		sscanf (_tmp6_, "file://%s", _tmp7_);
#line 27 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		_tmp8_ = name;
#line 27 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		if (g_strcmp0 (_tmp8_, "") == 0) {
#line 130 "shared-folder-popover.c"
			const gchar* _tmp9_;
			gchar* _tmp10_;
#line 28 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
			_tmp9_ = path;
#line 28 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
			_tmp10_ = g_path_get_basename (_tmp9_);
#line 28 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
			_g_free0 (name);
#line 28 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
			name = _tmp10_;
#line 141 "shared-folder-popover.c"
		}
#line 30 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		_tmp11_ = path;
#line 30 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		_tmp12_ = name;
#line 30 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		_tmp13_ = self->target_position;
#line 30 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		g_signal_emit (self, boxes_shared_folder_popover_signals[BOXES_SHARED_FOLDER_POPOVER_SAVED_SIGNAL], 0, _tmp11_, _tmp12_, _tmp13_);
#line 151 "shared-folder-popover.c"
	}
#line 33 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_popover_popdown ((GtkPopover*) self);
#line 21 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_g_free0 (name);
#line 21 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_g_free0 (path);
#line 159 "shared-folder-popover.c"
}


static void _boxes_shared_folder_popover_on_save_gtk_button_clicked (GtkButton* _sender, gpointer self) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	boxes_shared_folder_popover_on_save ((BoxesSharedFolderPopover*) self, _sender);
#line 166 "shared-folder-popover.c"
}


BoxesSharedFolderPopover* boxes_shared_folder_popover_construct (GType object_type) {
	BoxesSharedFolderPopover * self = NULL;
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	self = (BoxesSharedFolderPopover*) g_object_new (object_type, NULL);
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	return self;
#line 176 "shared-folder-popover.c"
}


BoxesSharedFolderPopover* boxes_shared_folder_popover_new (void) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	return boxes_shared_folder_popover_construct (BOXES_TYPE_SHARED_FOLDER_POPOVER);
#line 183 "shared-folder-popover.c"
}


static void g_cclosure_user_marshal_VOID__STRING_STRING_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
	typedef void (*GMarshalFunc_VOID__STRING_STRING_INT) (gpointer data1, const char* arg_1, const char* arg_2, gint arg_3, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	g_return_if_fail (n_param_values == 4);
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	if (G_CCLOSURE_SWAP_DATA (closure)) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		data1 = closure->data;
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		data2 = param_values->data[0].v_pointer;
#line 202 "shared-folder-popover.c"
	} else {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		data1 = param_values->data[0].v_pointer;
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
		data2 = closure->data;
#line 208 "shared-folder-popover.c"
	}
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	callback = (GMarshalFunc_VOID__STRING_STRING_INT) (marshal_data ? marshal_data : cc->callback);
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_int (param_values + 3), data2);
#line 214 "shared-folder-popover.c"
}


static void boxes_shared_folder_popover_class_init (BoxesSharedFolderPopoverClass * klass) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	boxes_shared_folder_popover_parent_class = g_type_class_peek_parent (klass);
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	G_OBJECT_CLASS (klass)->finalize = boxes_shared_folder_popover_finalize;
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/shared-folder-popover.ui");
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	boxes_shared_folder_popover_signals[BOXES_SHARED_FOLDER_POPOVER_SAVED_SIGNAL] = g_signal_new ("saved", BOXES_TYPE_SHARED_FOLDER_POPOVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_INT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "file_chooser_button", FALSE, G_STRUCT_OFFSET (BoxesSharedFolderPopover, file_chooser_button));
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "name_entry", FALSE, G_STRUCT_OFFSET (BoxesSharedFolderPopover, name_entry));
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_cancel", G_CALLBACK(_boxes_shared_folder_popover_on_cancel_gtk_button_clicked));
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_save", G_CALLBACK(_boxes_shared_folder_popover_on_save_gtk_button_clicked));
#line 235 "shared-folder-popover.c"
}


static void boxes_shared_folder_popover_instance_init (BoxesSharedFolderPopover * self) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	gtk_widget_init_template (GTK_WIDGET (self));
#line 242 "shared-folder-popover.c"
}


static void boxes_shared_folder_popover_finalize (GObject * obj) {
	BoxesSharedFolderPopover * self;
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_SHARED_FOLDER_POPOVER, BoxesSharedFolderPopover);
#line 9 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_g_object_unref0 (self->file_chooser_button);
#line 11 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	_g_object_unref0 (self->name_entry);
#line 5 "/home/fborges/checkout/gnome-boxes/src/shared-folder-popover.vala"
	G_OBJECT_CLASS (boxes_shared_folder_popover_parent_class)->finalize (obj);
#line 256 "shared-folder-popover.c"
}


GType boxes_shared_folder_popover_get_type (void) {
	static volatile gsize boxes_shared_folder_popover_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_shared_folder_popover_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesSharedFolderPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_shared_folder_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesSharedFolderPopover), 0, (GInstanceInitFunc) boxes_shared_folder_popover_instance_init, NULL };
		GType boxes_shared_folder_popover_type_id;
		boxes_shared_folder_popover_type_id = g_type_register_static (gtk_popover_get_type (), "BoxesSharedFolderPopover", &g_define_type_info, 0);
		g_once_init_leave (&boxes_shared_folder_popover_type_id__volatile, boxes_shared_folder_popover_type_id);
	}
	return boxes_shared_folder_popover_type_id__volatile;
}



