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

/*///////////////////////////////////////////////////////////////////////*/
/* Copyright 2011-2021 Simon Schneegans*/
/**/
/* Permission is hereby granted, free of charge, to any person obtaining*/
/* a copy of this software and associated documentation files (the*/
/* "Software"), to deal in the Software without restriction, including*/
/* without limitation the rights to use, copy, modify, merge, publish,*/
/* distribute, sublicense, and/or sell copies of the Software, and to*/
/* permit persons to whom the Software is furnished to do so, subject to*/
/* the following conditions:*/
/* */
/* The above copyright notice and this permission notice shall be*/
/* included in all copies or substantial portions of the Software.*/
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,*/
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF*/
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY*/
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,*/
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE*/
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/
/*///////////////////////////////////////////////////////////////////////*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n-lib.h>

#define GNOME_PIE_NEWS_WINDOW_news_count 2
#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 GNOME_PIE_TYPE_NEWS_WINDOW (gnome_pie_news_window_get_type ())
#define GNOME_PIE_NEWS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_NEWS_WINDOW, GnomePieNewsWindow))
#define GNOME_PIE_NEWS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_NEWS_WINDOW, GnomePieNewsWindowClass))
#define GNOME_PIE_IS_NEWS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_NEWS_WINDOW))
#define GNOME_PIE_IS_NEWS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_NEWS_WINDOW))
#define GNOME_PIE_NEWS_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_NEWS_WINDOW, GnomePieNewsWindowClass))

typedef struct _GnomePieNewsWindow GnomePieNewsWindow;
typedef struct _GnomePieNewsWindowClass GnomePieNewsWindowClass;
typedef struct _GnomePieNewsWindowPrivate GnomePieNewsWindowPrivate;
enum  {
	GNOME_PIE_NEWS_WINDOW_0_PROPERTY,
	GNOME_PIE_NEWS_WINDOW_NUM_PROPERTIES
};
static GParamSpec* gnome_pie_news_window_properties[GNOME_PIE_NEWS_WINDOW_NUM_PROPERTIES];

#define GNOME_PIE_TYPE_CONFIG (gnome_pie_config_get_type ())
#define GNOME_PIE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_CONFIG, GnomePieConfig))
#define GNOME_PIE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_CONFIG, GnomePieConfigClass))
#define GNOME_PIE_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_CONFIG))
#define GNOME_PIE_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_CONFIG))
#define GNOME_PIE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_CONFIG, GnomePieConfigClass))

typedef struct _GnomePieConfig GnomePieConfig;
typedef struct _GnomePieConfigClass GnomePieConfigClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GnomePieNewsWindow {
	GtkDialog parent_instance;
	GnomePieNewsWindowPrivate * priv;
};

struct _GnomePieNewsWindowClass {
	GtkDialogClass parent_class;
};

static gpointer gnome_pie_news_window_parent_class = NULL;

VALA_EXTERN GType gnome_pie_news_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieNewsWindow, g_object_unref)
VALA_EXTERN GnomePieNewsWindow* gnome_pie_news_window_new (void);
VALA_EXTERN GnomePieNewsWindow* gnome_pie_news_window_construct (GType object_type);
static void __lambda101_ (GnomePieNewsWindow* self,
                   GtkToggleButton* check_box);
VALA_EXTERN GType gnome_pie_config_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieConfig, g_object_unref)
VALA_EXTERN GnomePieConfig* gnome_pie_config_get_global (void);
VALA_EXTERN void gnome_pie_config_set_showed_news (GnomePieConfig* self,
                                       gint value);
VALA_EXTERN void gnome_pie_config_save (GnomePieConfig* self);
static void ___lambda101__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                              gpointer self);
static void __lambda102_ (GnomePieNewsWindow* self,
                   gint id);
static void ___lambda102__gtk_dialog_response (GtkDialog* _sender,
                                        gint response_id,
                                        gpointer self);
static GType gnome_pie_news_window_get_type_once (void);

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

static void
__lambda101_ (GnomePieNewsWindow* self,
              GtkToggleButton* check_box)
{
	GtkCheckButton* checky = NULL;
	GtkCheckButton* _tmp0_;
	GtkCheckButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GnomePieConfig* _tmp8_;
	GnomePieConfig* _tmp9_;
	g_return_if_fail (check_box != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (check_box, gtk_check_button_get_type ()) ? ((GtkCheckButton*) check_box) : NULL);
	checky = _tmp0_;
	_tmp1_ = checky;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		GnomePieConfig* _tmp4_;
		GnomePieConfig* _tmp5_;
		_tmp4_ = gnome_pie_config_get_global ();
		_tmp5_ = _tmp4_;
		gnome_pie_config_set_showed_news (_tmp5_, GNOME_PIE_NEWS_WINDOW_news_count);
	} else {
		GnomePieConfig* _tmp6_;
		GnomePieConfig* _tmp7_;
		_tmp6_ = gnome_pie_config_get_global ();
		_tmp7_ = _tmp6_;
		gnome_pie_config_set_showed_news (_tmp7_, GNOME_PIE_NEWS_WINDOW_news_count - 1);
	}
	_tmp8_ = gnome_pie_config_get_global ();
	_tmp9_ = _tmp8_;
	gnome_pie_config_save (_tmp9_);
	_g_object_unref0 (checky);
}

static void
___lambda101__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                         gpointer self)
{
	__lambda101_ ((GnomePieNewsWindow*) self, _sender);
}

static void
__lambda102_ (GnomePieNewsWindow* self,
              gint id)
{
	if (id == 0) {
		gtk_widget_hide ((GtkWidget*) self);
	}
}

static void
___lambda102__gtk_dialog_response (GtkDialog* _sender,
                                   gint response_id,
                                   gpointer self)
{
	__lambda102_ ((GnomePieNewsWindow*) self, response_id);
}

GnomePieNewsWindow*
gnome_pie_news_window_construct (GType object_type)
{
	GnomePieNewsWindow * self = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkImage* image = NULL;
	GtkImage* _tmp1_;
	GtkLabel* news = NULL;
	GtkLabel* _tmp2_;
	GtkCheckButton* check = NULL;
	GtkCheckButton* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	self = (GnomePieNewsWindow*) g_object_new (object_type, NULL);
	gtk_window_set_title ((GtkWindow*) self, "Gnome-Pie");
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 5);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name ("gnome-pie", (GtkIconSize) GTK_ICON_SIZE_DIALOG);
	g_object_ref_sink (_tmp1_);
	image = _tmp1_;
	gtk_box_pack_start (box, (GtkWidget*) image, TRUE, TRUE, (guint) 0);
	_tmp2_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp2_);
	news = _tmp2_;
	g_object_set (news, "wrap", TRUE, NULL);
	gtk_label_set_width_chars (news, 75);
	gtk_label_set_markup (news, "<b>Thank you!</b>\n\n");
	gtk_box_pack_start (box, (GtkWidget*) news, FALSE, FALSE, (guint) 0);
	_tmp3_ = (GtkCheckButton*) gtk_check_button_new_with_label ("Don't show this window again.");
	g_object_ref_sink (_tmp3_);
	check = _tmp3_;
	g_signal_connect_object ((GtkToggleButton*) check, "toggled", (GCallback) ___lambda101__gtk_toggle_button_toggled, self, 0);
	gtk_box_pack_end (box, (GtkWidget*) check, TRUE, TRUE, (guint) 0);
	_tmp4_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_box_pack_start ((GtkBox*) (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, gtk_vbox_get_type ()) ? ((GtkVBox*) _tmp4_) : NULL), (GtkWidget*) box, TRUE, TRUE, (guint) 0);
	_tmp5_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_widget_show_all ((GtkWidget*) _tmp5_);
	gtk_dialog_add_button ((GtkDialog*) self, _ ("_Close"), 0);
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) ___lambda102__gtk_dialog_response, self, 0);
	_g_object_unref0 (check);
	_g_object_unref0 (news);
	_g_object_unref0 (image);
	_g_object_unref0 (box);
	return self;
}

GnomePieNewsWindow*
gnome_pie_news_window_new (void)
{
	return gnome_pie_news_window_construct (GNOME_PIE_TYPE_NEWS_WINDOW);
}

static void
gnome_pie_news_window_class_init (GnomePieNewsWindowClass * klass,
                                  gpointer klass_data)
{
	gnome_pie_news_window_parent_class = g_type_class_peek_parent (klass);
}

static void
gnome_pie_news_window_instance_init (GnomePieNewsWindow * self,
                                     gpointer klass)
{
}

static GType
gnome_pie_news_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GnomePieNewsWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gnome_pie_news_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GnomePieNewsWindow), 0, (GInstanceInitFunc) gnome_pie_news_window_instance_init, NULL };
	GType gnome_pie_news_window_type_id;
	gnome_pie_news_window_type_id = g_type_register_static (gtk_dialog_get_type (), "GnomePieNewsWindow", &g_define_type_info, 0);
	return gnome_pie_news_window_type_id;
}

GType
gnome_pie_news_window_get_type (void)
{
	static volatile gsize gnome_pie_news_window_type_id__once = 0;
	if (g_once_init_enter (&gnome_pie_news_window_type_id__once)) {
		GType gnome_pie_news_window_type_id;
		gnome_pie_news_window_type_id = gnome_pie_news_window_get_type_once ();
		g_once_init_leave (&gnome_pie_news_window_type_id__once, gnome_pie_news_window_type_id);
	}
	return gnome_pie_news_window_type_id__once;
}

