/* AppChooser.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from AppChooser.vala, do not modify */

/* SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2013-2023 elementary, Inc. (https://elementary.io)
 *
 * Authored by: Julien Spautz <spautz.julien@gmail.com>
 */

#include "applications.h"
#include <gtk/gtk.h>
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <granite-7.h>
#include <glib/gi18n-lib.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  {
	STARTUP_WIDGETS_APP_CHOOSER_0_PROPERTY,
	STARTUP_WIDGETS_APP_CHOOSER_NUM_PROPERTIES
};
static GParamSpec* startup_widgets_app_chooser_properties[STARTUP_WIDGETS_APP_CHOOSER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _startup_entity_app_info_free0(var) ((var == NULL) ? NULL : (var = (startup_entity_app_info_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	STARTUP_WIDGETS_APP_CHOOSER_APP_CHOSEN_SIGNAL,
	STARTUP_WIDGETS_APP_CHOOSER_CUSTOM_COMMAND_CHOSEN_SIGNAL,
	STARTUP_WIDGETS_APP_CHOOSER_NUM_SIGNALS
};
static guint startup_widgets_app_chooser_signals[STARTUP_WIDGETS_APP_CHOOSER_NUM_SIGNALS] = {0};

struct _StartupWidgetsAppChooserPrivate {
	GtkListBox* list;
	GtkSearchEntry* search_entry;
	GtkEntry* custom_entry;
};

static gint StartupWidgetsAppChooser_private_offset;
static gpointer startup_widgets_app_chooser_parent_class = NULL;

static gint startup_widgets_app_chooser_sort_function (StartupWidgetsAppChooser* self,
                                                GtkListBoxRow* row1,
                                                GtkListBoxRow* row2);
static gboolean startup_widgets_app_chooser_filter_function (StartupWidgetsAppChooser* self,
                                                      GtkListBoxRow* list_box_row);
static void startup_widgets_app_chooser_on_app_selected (StartupWidgetsAppChooser* self,
                                                  GtkListBoxRow* list_box_row);
static void startup_widgets_app_chooser_on_custom_command_entered (StartupWidgetsAppChooser* self);
static GObject * startup_widgets_app_chooser_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
static gint _startup_widgets_app_chooser_sort_function_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                        GtkListBoxRow* row2,
                                                                        gpointer self);
static gboolean _startup_widgets_app_chooser_filter_function_gtk_list_box_filter_func (GtkListBoxRow* row,
                                                                                gpointer self);
static void _startup_widgets_app_chooser___lambda29_ (StartupWidgetsAppChooser* self);
static void __startup_widgets_app_chooser___lambda29__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                gpointer self);
static void _gtk_widget_hide_gtk_dialog_response (GtkDialog* _sender,
                                           gint response_id,
                                           gpointer self);
static void _startup_widgets_app_chooser_on_app_selected_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                              GtkListBoxRow* row,
                                                                              gpointer self);
static void _startup_widgets_app_chooser_on_custom_command_entered_gtk_entry_activate (GtkEntry* _sender,
                                                                                gpointer self);
static void startup_widgets_app_chooser_finalize (GObject * obj);
static GType startup_widgets_app_chooser_get_type_once (void);

static inline gpointer
startup_widgets_app_chooser_get_instance_private (StartupWidgetsAppChooser* self)
{
	return G_STRUCT_MEMBER_P (self, StartupWidgetsAppChooser_private_offset);
}

void
startup_widgets_app_chooser_init_list (StartupWidgetsAppChooser* self,
                                       GeeCollection* app_infos)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_infos != NULL);
	{
		GeeIterator* _app_info_it = NULL;
		GeeIterator* _tmp0_;
		_tmp0_ = gee_iterable_iterator ((GeeIterable*) app_infos);
		_app_info_it = _tmp0_;
		while (TRUE) {
			GeeIterator* _tmp1_;
			StartupEntityAppInfo* app_info = NULL;
			GeeIterator* _tmp2_;
			gpointer _tmp3_;
			StartupWidgetsAppChooserRow* app_row = NULL;
			StartupEntityAppInfo* _tmp4_;
			StartupEntityAppInfo _tmp5_;
			StartupWidgetsAppChooserRow* _tmp6_;
			GtkListBox* _tmp7_;
			StartupWidgetsAppChooserRow* _tmp8_;
			_tmp1_ = _app_info_it;
			if (!gee_iterator_next (_tmp1_)) {
				break;
			}
			_tmp2_ = _app_info_it;
			_tmp3_ = gee_iterator_get (_tmp2_);
			app_info = (StartupEntityAppInfo*) _tmp3_;
			_tmp4_ = app_info;
			_tmp5_ = *_tmp4_;
			_tmp6_ = startup_widgets_app_chooser_row_new (&_tmp5_);
			g_object_ref_sink (_tmp6_);
			app_row = _tmp6_;
			_tmp7_ = self->priv->list;
			_tmp8_ = app_row;
			gtk_list_box_prepend (_tmp7_, (GtkWidget*) _tmp8_);
			_g_object_unref0 (app_row);
			_startup_entity_app_info_free0 (app_info);
		}
		_g_object_unref0 (_app_info_it);
	}
}

static gint
startup_widgets_app_chooser_sort_function (StartupWidgetsAppChooser* self,
                                           GtkListBoxRow* row1,
                                           GtkListBoxRow* row2)
{
	StartupWidgetsAppChooserRow* row_1 = NULL;
	GtkWidget* _tmp0_;
	StartupWidgetsAppChooserRow* row_2 = NULL;
	GtkWidget* _tmp1_;
	gchar* name_1 = NULL;
	StartupEntityAppInfo _tmp2_ = {0};
	StartupEntityAppInfo _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* name_2 = NULL;
	StartupEntityAppInfo _tmp6_ = {0};
	StartupEntityAppInfo _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (row1 != NULL, 0);
	g_return_val_if_fail (row2 != NULL, 0);
	_tmp0_ = gtk_list_box_row_get_child (row1);
	row_1 = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, STARTUP_WIDGETS_TYPE_APP_CHOOSER_ROW, StartupWidgetsAppChooserRow);
	_tmp1_ = gtk_list_box_row_get_child (row2);
	row_2 = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, STARTUP_WIDGETS_TYPE_APP_CHOOSER_ROW, StartupWidgetsAppChooserRow);
	startup_widgets_app_chooser_row_get_app_info (row_1, &_tmp2_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_.name;
	_tmp5_ = g_strdup (_tmp4_);
	name_1 = _tmp5_;
	startup_widgets_app_chooser_row_get_app_info (row_2, &_tmp6_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_.name;
	_tmp9_ = g_strdup (_tmp8_);
	name_2 = _tmp9_;
	result = g_utf8_collate (name_1, name_2);
	_g_free0 (name_2);
	_g_free0 (name_1);
	return result;
}

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

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
startup_widgets_app_chooser_filter_function (StartupWidgetsAppChooser* self,
                                             GtkListBoxRow* list_box_row)
{
	StartupWidgetsAppChooserRow* app_row = NULL;
	GtkWidget* _tmp0_;
	StartupWidgetsAppChooserRow* _tmp1_;
	gboolean _tmp2_ = FALSE;
	StartupWidgetsAppChooserRow* _tmp3_;
	StartupEntityAppInfo _tmp4_ = {0};
	StartupEntityAppInfo _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GtkSearchEntry* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gboolean _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (list_box_row != NULL, FALSE);
	_tmp0_ = gtk_list_box_row_get_child (list_box_row);
	_tmp1_ = _g_object_ref0 (STARTUP_WIDGETS_IS_APP_CHOOSER_ROW (_tmp0_) ? ((StartupWidgetsAppChooserRow*) _tmp0_) : NULL);
	app_row = _tmp1_;
	_tmp3_ = app_row;
	startup_widgets_app_chooser_row_get_app_info (_tmp3_, &_tmp4_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_.name;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->search_entry;
	_tmp10_ = gtk_editable_get_text ((GtkEditable*) _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_utf8_strdown (_tmp11_, (gssize) -1);
	_tmp13_ = _tmp12_;
	_tmp14_ = string_contains (_tmp8_, _tmp13_);
	_g_free0 (_tmp13_);
	_g_free0 (_tmp8_);
	if (_tmp14_) {
		_tmp2_ = TRUE;
	} else {
		StartupWidgetsAppChooserRow* _tmp15_;
		StartupEntityAppInfo _tmp16_ = {0};
		StartupEntityAppInfo _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		GtkSearchEntry* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp15_ = app_row;
		startup_widgets_app_chooser_row_get_app_info (_tmp15_, &_tmp16_);
		_tmp17_ = _tmp16_;
		_tmp18_ = _tmp17_.comment;
		_tmp19_ = g_utf8_strdown (_tmp18_, (gssize) -1);
		_tmp20_ = _tmp19_;
		_tmp21_ = self->priv->search_entry;
		_tmp22_ = gtk_editable_get_text ((GtkEditable*) _tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_utf8_strdown (_tmp23_, (gssize) -1);
		_tmp25_ = _tmp24_;
		_tmp2_ = string_contains (_tmp20_, _tmp25_);
		_g_free0 (_tmp25_);
		_g_free0 (_tmp20_);
	}
	result = _tmp2_;
	_g_object_unref0 (app_row);
	return result;
}

static void
startup_widgets_app_chooser_on_app_selected (StartupWidgetsAppChooser* self,
                                             GtkListBoxRow* list_box_row)
{
	StartupWidgetsAppChooserRow* app_row = NULL;
	GtkWidget* _tmp0_;
	StartupWidgetsAppChooserRow* _tmp1_;
	StartupEntityAppInfo _tmp2_ = {0};
	StartupEntityAppInfo _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (list_box_row != NULL);
	_tmp0_ = gtk_list_box_row_get_child (list_box_row);
	_tmp1_ = _g_object_ref0 (STARTUP_WIDGETS_IS_APP_CHOOSER_ROW (_tmp0_) ? ((StartupWidgetsAppChooserRow*) _tmp0_) : NULL);
	app_row = _tmp1_;
	startup_widgets_app_chooser_row_get_app_info (app_row, &_tmp2_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_.path;
	g_signal_emit (self, startup_widgets_app_chooser_signals[STARTUP_WIDGETS_APP_CHOOSER_APP_CHOSEN_SIGNAL], 0, _tmp4_);
	gtk_widget_hide ((GtkWidget*) self);
	_g_object_unref0 (app_row);
}

static void
startup_widgets_app_chooser_on_custom_command_entered (StartupWidgetsAppChooser* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->custom_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_emit (self, startup_widgets_app_chooser_signals[STARTUP_WIDGETS_APP_CHOOSER_CUSTOM_COMMAND_CHOSEN_SIGNAL], 0, _tmp2_);
	gtk_widget_hide ((GtkWidget*) self);
}

StartupWidgetsAppChooser*
startup_widgets_app_chooser_construct (GType object_type)
{
	StartupWidgetsAppChooser * self = NULL;
	self = (StartupWidgetsAppChooser*) granite_dialog_construct (object_type);
	return self;
}

StartupWidgetsAppChooser*
startup_widgets_app_chooser_new (void)
{
	return startup_widgets_app_chooser_construct (STARTUP_WIDGETS_TYPE_APP_CHOOSER);
}

static gint
_startup_widgets_app_chooser_sort_function_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                   GtkListBoxRow* row2,
                                                                   gpointer self)
{
	gint result;
	result = startup_widgets_app_chooser_sort_function ((StartupWidgetsAppChooser*) self, row1, row2);
	return result;
}

static gboolean
_startup_widgets_app_chooser_filter_function_gtk_list_box_filter_func (GtkListBoxRow* row,
                                                                       gpointer self)
{
	gboolean result;
	result = startup_widgets_app_chooser_filter_function ((StartupWidgetsAppChooser*) self, row);
	return result;
}

static void
_startup_widgets_app_chooser___lambda29_ (StartupWidgetsAppChooser* self)
{
	GtkListBox* _tmp0_;
	_tmp0_ = self->priv->list;
	gtk_list_box_invalidate_filter (_tmp0_);
}

static void
__startup_widgets_app_chooser___lambda29__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                           gpointer self)
{
	_startup_widgets_app_chooser___lambda29_ ((StartupWidgetsAppChooser*) self);
}

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

static void
_startup_widgets_app_chooser_on_app_selected_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                         GtkListBoxRow* row,
                                                                         gpointer self)
{
	startup_widgets_app_chooser_on_app_selected ((StartupWidgetsAppChooser*) self, row);
}

static void
_startup_widgets_app_chooser_on_custom_command_entered_gtk_entry_activate (GtkEntry* _sender,
                                                                           gpointer self)
{
	startup_widgets_app_chooser_on_custom_command_entered ((StartupWidgetsAppChooser*) self);
}

static GObject *
startup_widgets_app_chooser_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	StartupWidgetsAppChooser * self;
	gchar* _tmp0_;
	GtkSearchEntry* _tmp1_ = NULL;
	GtkListBox* _tmp2_ = NULL;
	GtkListBox* _tmp3_;
	GtkListBox* _tmp4_;
	GtkListBox* _tmp5_;
	GtkScrolledWindow* scrolled = NULL;
	GtkListBox* _tmp6_;
	GtkWidget* _tmp7_;
	GtkScrolledWindow* _tmp8_ = NULL;
	GtkFrame* frame = NULL;
	GtkScrolledWindow* _tmp9_;
	GtkWidget* _tmp10_;
	GtkFrame* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GtkEntry* _tmp14_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp15_;
	GtkBox* _tmp16_;
	GtkSearchEntry* _tmp17_;
	GtkBox* _tmp18_;
	GtkFrame* _tmp19_;
	GtkBox* _tmp20_;
	GtkEntry* _tmp21_;
	GtkBox* _tmp22_;
	GtkBox* _tmp23_;
	GtkSearchEntry* _tmp24_;
	GtkSearchEntry* _tmp25_;
	GtkListBox* _tmp26_;
	GtkEntry* _tmp27_;
	parent_class = G_OBJECT_CLASS (startup_widgets_app_chooser_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, STARTUP_WIDGETS_TYPE_APP_CHOOSER, StartupWidgetsAppChooser);
	_tmp0_ = g_strdup (_ ("Search Applications"));
	_tmp1_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_set (_tmp1_, "placeholder-text", _tmp0_, NULL);
	_g_free0 (_tmp0_);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->search_entry);
	self->priv->search_entry = _tmp1_;
	_tmp2_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->list);
	self->priv->list = _tmp2_;
	_tmp3_ = self->priv->list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp3_, GRANITE_STYLE_CLASS_RICH_LIST);
	_tmp4_ = self->priv->list;
	gtk_list_box_set_sort_func (_tmp4_, _startup_widgets_app_chooser_sort_function_gtk_list_box_sort_func, g_object_ref (self), g_object_unref);
	_tmp5_ = self->priv->list;
	gtk_list_box_set_filter_func (_tmp5_, _startup_widgets_app_chooser_filter_function_gtk_list_box_filter_func, g_object_ref (self), g_object_unref);
	_tmp6_ = self->priv->list;
	_tmp7_ = _g_object_ref0 ((GtkWidget*) _tmp6_);
	_tmp8_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_child (_tmp8_, _tmp7_);
	_g_object_unref0 (_tmp7_);
	g_object_ref_sink (_tmp8_);
	scrolled = _tmp8_;
	_tmp9_ = scrolled;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = (GtkFrame*) gtk_frame_new (NULL);
	gtk_frame_set_child (_tmp11_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	frame = _tmp11_;
	_tmp12_ = g_strdup (_ ("Type in a custom command"));
	_tmp13_ = g_strdup ("utilities-terminal-symbolic");
	_tmp14_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_placeholder_text (_tmp14_, _tmp12_);
	_g_free0 (_tmp12_);
	g_object_set (_tmp14_, "primary-icon-activatable", FALSE, NULL);
	g_object_set (_tmp14_, "primary-icon-name", _tmp13_, NULL);
	_g_free0 (_tmp13_);
	g_object_ref_sink (_tmp14_);
	_g_object_unref0 (self->priv->custom_entry);
	self->priv->custom_entry = _tmp14_;
	_tmp15_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	g_object_ref_sink (_tmp15_);
	box = _tmp15_;
	_tmp16_ = box;
	_tmp17_ = self->priv->search_entry;
	gtk_box_append (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = box;
	_tmp19_ = frame;
	gtk_box_append (_tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = box;
	_tmp21_ = self->priv->custom_entry;
	gtk_box_append (_tmp20_, (GtkWidget*) _tmp21_);
	g_object_set ((GtkWindow*) self, "default-height", 500, NULL);
	g_object_set ((GtkWindow*) self, "default-width", 400, NULL);
	_tmp22_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp23_ = box;
	gtk_box_append (_tmp22_, (GtkWidget*) _tmp23_);
	granite_dialog_add_button ((GraniteDialog*) self, _ ("Cancel"), (gint) GTK_RESPONSE_CANCEL);
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_LABEL, _ ("Select startup app"), -1, -1);
	_tmp24_ = self->priv->search_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp24_);
	_tmp25_ = self->priv->search_entry;
	g_signal_connect_object (_tmp25_, "search-changed", (GCallback) __startup_widgets_app_chooser___lambda29__gtk_search_entry_search_changed, self, 0);
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _gtk_widget_hide_gtk_dialog_response, (GtkWidget*) self, 0);
	_tmp26_ = self->priv->list;
	g_signal_connect_object (_tmp26_, "row-activated", (GCallback) _startup_widgets_app_chooser_on_app_selected_gtk_list_box_row_activated, self, 0);
	_tmp27_ = self->priv->custom_entry;
	g_signal_connect_object (_tmp27_, "activate", (GCallback) _startup_widgets_app_chooser_on_custom_command_entered_gtk_entry_activate, self, 0);
	_g_object_unref0 (box);
	_g_object_unref0 (frame);
	_g_object_unref0 (scrolled);
	return obj;
}

static void
startup_widgets_app_chooser_class_init (StartupWidgetsAppChooserClass * klass,
                                        gpointer klass_data)
{
	startup_widgets_app_chooser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &StartupWidgetsAppChooser_private_offset);
	G_OBJECT_CLASS (klass)->constructor = startup_widgets_app_chooser_constructor;
	G_OBJECT_CLASS (klass)->finalize = startup_widgets_app_chooser_finalize;
	startup_widgets_app_chooser_signals[STARTUP_WIDGETS_APP_CHOOSER_APP_CHOSEN_SIGNAL] = g_signal_new ("app-chosen", STARTUP_WIDGETS_TYPE_APP_CHOOSER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	startup_widgets_app_chooser_signals[STARTUP_WIDGETS_APP_CHOOSER_CUSTOM_COMMAND_CHOSEN_SIGNAL] = g_signal_new ("custom-command-chosen", STARTUP_WIDGETS_TYPE_APP_CHOOSER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
startup_widgets_app_chooser_instance_init (StartupWidgetsAppChooser * self,
                                           gpointer klass)
{
	self->priv = startup_widgets_app_chooser_get_instance_private (self);
}

static void
startup_widgets_app_chooser_finalize (GObject * obj)
{
	StartupWidgetsAppChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, STARTUP_WIDGETS_TYPE_APP_CHOOSER, StartupWidgetsAppChooser);
	_g_object_unref0 (self->priv->list);
	_g_object_unref0 (self->priv->search_entry);
	_g_object_unref0 (self->priv->custom_entry);
	G_OBJECT_CLASS (startup_widgets_app_chooser_parent_class)->finalize (obj);
}

static GType
startup_widgets_app_chooser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (StartupWidgetsAppChooserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) startup_widgets_app_chooser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (StartupWidgetsAppChooser), 0, (GInstanceInitFunc) startup_widgets_app_chooser_instance_init, NULL };
	GType startup_widgets_app_chooser_type_id;
	startup_widgets_app_chooser_type_id = g_type_register_static (GRANITE_TYPE_DIALOG, "StartupWidgetsAppChooser", &g_define_type_info, 0);
	StartupWidgetsAppChooser_private_offset = g_type_add_instance_private (startup_widgets_app_chooser_type_id, sizeof (StartupWidgetsAppChooserPrivate));
	return startup_widgets_app_chooser_type_id;
}

GType
startup_widgets_app_chooser_get_type (void)
{
	static volatile gsize startup_widgets_app_chooser_type_id__once = 0;
	if (g_once_init_enter (&startup_widgets_app_chooser_type_id__once)) {
		GType startup_widgets_app_chooser_type_id;
		startup_widgets_app_chooser_type_id = startup_widgets_app_chooser_get_type_once ();
		g_once_init_leave (&startup_widgets_app_chooser_type_id__once, startup_widgets_app_chooser_type_id);
	}
	return startup_widgets_app_chooser_type_id__once;
}

