/* daemon.c generated by valac 0.56.19, the Vala compiler
 * generated from daemon.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.*/
/*///////////////////////////////////////////////////////////////////////*/

#define _GNU_SOURCE

#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <libwnck/libwnck.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <signal.h>
#include <stdio.h>
#include <glib/gstdio.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 GNOME_PIE_TYPE_DAEMON (gnome_pie_daemon_get_type ())
#define GNOME_PIE_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_DAEMON, GnomePieDaemon))
#define GNOME_PIE_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_DAEMON, GnomePieDaemonClass))
#define GNOME_PIE_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_DAEMON))
#define GNOME_PIE_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_DAEMON))
#define GNOME_PIE_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_DAEMON, GnomePieDaemonClass))

typedef struct _GnomePieDaemon GnomePieDaemon;
typedef struct _GnomePieDaemonClass GnomePieDaemonClass;
typedef struct _GnomePieDaemonPrivate GnomePieDaemonPrivate;

#define GNOME_PIE_TYPE_INDICATOR (gnome_pie_indicator_get_type ())
#define GNOME_PIE_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_INDICATOR, GnomePieIndicator))
#define GNOME_PIE_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_INDICATOR, GnomePieIndicatorClass))
#define GNOME_PIE_IS_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_INDICATOR))
#define GNOME_PIE_IS_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_INDICATOR))
#define GNOME_PIE_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_INDICATOR, GnomePieIndicatorClass))

typedef struct _GnomePieIndicator GnomePieIndicator;
typedef struct _GnomePieIndicatorClass GnomePieIndicatorClass;
enum  {
	GNOME_PIE_DAEMON_0_PROPERTY,
	GNOME_PIE_DAEMON_NUM_PROPERTIES
};
static GParamSpec* gnome_pie_daemon_properties[GNOME_PIE_DAEMON_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))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GnomePieDaemon {
	GApplication parent_instance;
	GnomePieDaemonPrivate * priv;
};

struct _GnomePieDaemonClass {
	GApplicationClass parent_class;
};

struct _GnomePieDaemonPrivate {
	gboolean initialized;
	GnomePieIndicator* indicator;
};

static gint GnomePieDaemon_private_offset;
static gpointer gnome_pie_daemon_parent_class = NULL;
static gchar* gnome_pie_daemon_open_pie;
static gboolean gnome_pie_daemon_reset;
VALA_EXTERN gboolean gnome_pie_daemon_disable_header_bar;
VALA_EXTERN gboolean gnome_pie_daemon_disable_stack_switcher;
static gboolean gnome_pie_daemon_print_ids;
VALA_EXTERN gchar* gnome_pie_daemon_version;
gchar* gnome_pie_daemon_version = NULL;
gboolean gnome_pie_daemon_disable_header_bar = FALSE;
gboolean gnome_pie_daemon_disable_stack_switcher = FALSE;
static gchar* gnome_pie_daemon_open_pie = NULL;
static gboolean gnome_pie_daemon_reset = FALSE;
static gboolean gnome_pie_daemon_print_ids = FALSE;
static gboolean gnome_pie_daemon_handled_local_args;
static gboolean gnome_pie_daemon_handled_local_args = FALSE;

VALA_EXTERN GType gnome_pie_daemon_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieDaemon, g_object_unref)
VALA_EXTERN GType gnome_pie_indicator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieIndicator, g_object_unref)
static gint gnome_pie_daemon_main (gchar** args,
                            gint args_length1);
VALA_EXTERN void gnome_pie_logger_init (void);
VALA_EXTERN void gnome_pie_paths_init (void);
VALA_EXTERN GnomePieDaemon* gnome_pie_daemon_new (void);
VALA_EXTERN GnomePieDaemon* gnome_pie_daemon_construct (GType object_type);
VALA_EXTERN const gchar* gnome_pie_paths_get_locales (void);
static void gnome_pie_daemon_sig_handler (gint sig);
static void _gnome_pie_daemon_sig_handler_sighandler_t (gint signal);
static void __lambda100_ (GnomePieDaemon* self);
static void gnome_pie_daemon_init_pies (GnomePieDaemon* self);
VALA_EXTERN GnomePieIndicator* gnome_pie_indicator_new (void);
VALA_EXTERN GnomePieIndicator* gnome_pie_indicator_construct (GType object_type);
VALA_EXTERN void gnome_pie_pie_manager_open_pie (const gchar* id);
static void ___lambda100__g_application_startup (GApplication* _sender,
                                          gpointer self);
static gboolean gnome_pie_daemon_real_local_command_line (GApplication* base,
                                                   gchar*** args,
                                                   gint* exit_status);
static gboolean gnome_pie_daemon_handle_command_line (GnomePieDaemon* self,
                                               gchar** args,
                                               gint args_length1,
                                               gboolean called_from_remote);
static gint gnome_pie_daemon_real_command_line (GApplication* base,
                                         GApplicationCommandLine* cmd);
VALA_EXTERN void gnome_pie_action_registry_init (void);
VALA_EXTERN void gnome_pie_group_registry_init (void);
VALA_EXTERN void gnome_pie_pie_manager_init (void);
VALA_EXTERN void gnome_pie_icon_init (void);
VALA_EXTERN const gchar* gnome_pie_paths_get_pie_config (void);
VALA_EXTERN const gchar* gnome_pie_paths_get_settings (void);
VALA_EXTERN void gnome_pie_pie_manager_print_ids (void);
VALA_EXTERN void gnome_pie_indicator_show_preferences (GnomePieIndicator* self);
static void gnome_pie_daemon_finalize (GObject * obj);
static GType gnome_pie_daemon_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 gssize _vala_array_length (gpointer array);

static const GOptionEntry GNOME_PIE_DAEMON_options[6] = {{"open", 'o', (gint) 0, G_OPTION_ARG_STRING, &gnome_pie_daemon_open_pie, "Open the Pie with the given ID", "ID"}, {"reset", 'r', (gint) 0, G_OPTION_ARG_NONE, &gnome_pie_daemon_reset, "Reset all options to default values"}, {"no-header-bar", 'b', (gint) 0, G_OPTION_ARG_NONE, &gnome_pie_daemon_disable_header_bar, "Disables the usage of GTK.HeaderBar"}, {"no-stack-switcher", 's', (gint) 0, G_OPTION_ARG_NONE, &gnome_pie_daemon_disable_stack_switcher, "Disables the usage of GTK.StackSwitcher"}, {"print-ids", 'p', (gint) 0, G_OPTION_ARG_NONE, &gnome_pie_daemon_print_ids, "Prints all Pie names with their according IDs"}, {NULL}};

static inline gpointer
gnome_pie_daemon_get_instance_private (GnomePieDaemon* self)
{
	return G_STRUCT_MEMBER_P (self, GnomePieDaemon_private_offset);
}

static gint
gnome_pie_daemon_main (gchar** args,
                       gint args_length1)
{
	gchar* _tmp0_;
	GnomePieDaemon* deamon = NULL;
	GnomePieDaemon* _tmp1_;
	gint result;
	_tmp0_ = g_strdup ("0.7.3");
	_g_free0 (gnome_pie_daemon_version);
	gnome_pie_daemon_version = _tmp0_;
	g_setenv ("LIBOVERLAY_SCROLLBAR", "0", TRUE);
	wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
	gnome_pie_logger_init ();
	gtk_init ((gint*) (&args_length1), &args);
	gnome_pie_paths_init ();
	_tmp1_ = gnome_pie_daemon_new ();
	deamon = _tmp1_;
	g_application_run ((GApplication*) deamon, (gint) args_length1, args);
	result = 0;
	_g_object_unref0 (deamon);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return gnome_pie_daemon_main (argv, argc);
}

static void
_gnome_pie_daemon_sig_handler_sighandler_t (gint signal)
{
	gnome_pie_daemon_sig_handler (signal);
}

static void
__lambda100_ (GnomePieDaemon* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	GnomePieIndicator* _tmp6_;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	_tmp0_ = gnome_pie_daemon_version;
	_tmp1_ = g_strconcat ("Welcome to Gnome-Pie ", _tmp0_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat (_tmp2_, "!", NULL);
	_tmp4_ = _tmp3_;
	g_message ("daemon.vala:140: %s", _tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	_tmp5_ = g_getenv ("XDG_SESSION_TYPE");
	if (g_strcmp0 (_tmp5_, "wayland") == 0) {
		g_warning ("daemon.vala:143: Running on Wayland - running with limited options.");
	}
	gnome_pie_daemon_init_pies (self);
	_tmp6_ = gnome_pie_indicator_new ();
	_g_object_unref0 (self->priv->indicator);
	self->priv->indicator = _tmp6_;
	_tmp8_ = gnome_pie_daemon_open_pie;
	if (_tmp8_ != NULL) {
		const gchar* _tmp9_;
		_tmp9_ = gnome_pie_daemon_open_pie;
		_tmp7_ = g_strcmp0 (_tmp9_, "") != 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = gnome_pie_daemon_open_pie;
		gnome_pie_pie_manager_open_pie (_tmp10_);
		_tmp11_ = g_strdup ("");
		_g_free0 (gnome_pie_daemon_open_pie);
		gnome_pie_daemon_open_pie = _tmp11_;
	}
	g_message ("daemon.vala:157: Started happily...");
	g_application_hold ((GApplication*) self);
}

static void
___lambda100__g_application_startup (GApplication* _sender,
                                     gpointer self)
{
	__lambda100_ ((GnomePieDaemon*) self);
}

GnomePieDaemon*
gnome_pie_daemon_construct (GType object_type)
{
	GnomePieDaemon * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	self = (GnomePieDaemon*) g_object_new (object_type, "application-id", "org.gnome.gnomepie", "flags", G_APPLICATION_HANDLES_COMMAND_LINE, NULL);
	_tmp0_ = gnome_pie_paths_get_locales ();
	_tmp1_ = _tmp0_;
	bindtextdomain ("gnomepie", _tmp1_);
	textdomain ("gnomepie");
	signal ((gint) SIGINT, _gnome_pie_daemon_sig_handler_sighandler_t);
	signal ((gint) SIGTERM, _gnome_pie_daemon_sig_handler_sighandler_t);
	g_signal_connect_object ((GApplication*) self, "startup", (GCallback) ___lambda100__g_application_startup, self, 0);
	return self;
}

GnomePieDaemon*
gnome_pie_daemon_new (void)
{
	return gnome_pie_daemon_construct (GNOME_PIE_TYPE_DAEMON);
}

static gboolean
gnome_pie_daemon_real_local_command_line (GApplication* base,
                                          gchar*** args,
                                          gint* exit_status)
{
	GnomePieDaemon * self;
	gint _vala_exit_status = 0;
	const gchar** _args = NULL;
	gchar** _tmp0_;
	gint _args_length1;
	gint __args_size_;
	const gchar** _tmp5_;
	gint _tmp5__length1;
	gboolean result;
	self = (GnomePieDaemon*) base;
	_vala_exit_status = 0;
	_tmp0_ = g_new0 (gchar*, _vala_array_length (*args) + 1);
	_args = _tmp0_;
	_args_length1 = _vala_array_length (*args);
	__args_size_ = _args_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				const gchar** _tmp3_;
				gint _tmp3__length1;
				const gchar* _tmp4_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < _vala_array_length (*args))) {
					break;
				}
				_tmp3_ = _args;
				_tmp3__length1 = _args_length1;
				_tmp4_ = (*args)[i];
				_tmp3_[i] = _tmp4_;
			}
		}
	}
	_tmp5_ = _args;
	_tmp5__length1 = _args_length1;
	result = gnome_pie_daemon_handle_command_line (self, _tmp5_, (gint) _tmp5__length1, FALSE);
	_args = (g_free (_args), NULL);
	if (exit_status) {
		*exit_status = _vala_exit_status;
	}
	return result;
}

static gint
gnome_pie_daemon_real_command_line (GApplication* base,
                                    GApplicationCommandLine* cmd)
{
	GnomePieDaemon * self;
	gint result;
	self = (GnomePieDaemon*) base;
	g_return_val_if_fail (cmd != NULL, -1);
	if (gnome_pie_daemon_handled_local_args) {
		gchar** tmp = NULL;
		gint _tmp0_ = 0;
		gchar** _tmp1_;
		gint tmp_length1;
		gint _tmp_size_;
		gchar** remote_args = NULL;
		gchar** _tmp2_;
		gint _tmp2__length1;
		gint remote_args_length1;
		gint _remote_args_size_;
		gchar** _tmp3_;
		gint _tmp3__length1;
		_tmp1_ = g_application_command_line_get_arguments (cmd, &_tmp0_);
		tmp = _tmp1_;
		tmp_length1 = _tmp0_;
		_tmp_size_ = tmp_length1;
		_tmp2_ = tmp;
		_tmp2__length1 = tmp_length1;
		remote_args = _tmp2_;
		remote_args_length1 = _tmp2__length1;
		_remote_args_size_ = remote_args_length1;
		_tmp3_ = remote_args;
		_tmp3__length1 = remote_args_length1;
		gnome_pie_daemon_handle_command_line (self, _tmp3_, (gint) _tmp3__length1, TRUE);
		tmp = (_vala_array_free (tmp, tmp_length1, (GDestroyNotify) g_free), NULL);
	}
	gnome_pie_daemon_handled_local_args = TRUE;
	result = 0;
	return result;
}

static void
gnome_pie_daemon_sig_handler (gint sig)
{
	FILE* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GApplication* _tmp3_;
	_tmp0_ = stdout;
	fprintf (_tmp0_, "\n");
	_tmp1_ = g_strdup_printf ("Caught signal (%d), bye!", sig);
	_tmp2_ = _tmp1_;
	g_message ("daemon.vala:199: %s", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = g_application_get_default ();
	g_application_release (_tmp3_);
}

static void
gnome_pie_daemon_init_pies (GnomePieDaemon* self)
{
	g_return_if_fail (self != NULL);
	if (!self->priv->initialized) {
		gnome_pie_action_registry_init ();
		gnome_pie_group_registry_init ();
		gnome_pie_pie_manager_init ();
		gnome_pie_icon_init ();
		self->priv->initialized = TRUE;
	}
}

static gboolean
gnome_pie_daemon_handle_command_line (GnomePieDaemon* self,
                                      gchar** args,
                                      gint args_length1,
                                      gboolean called_from_remote)
{
	GOptionContext* context = NULL;
	GOptionContext* _tmp0_;
	GOptionContext* _tmp1_;
	GOptionContext* _tmp2_;
	GOptionGroup* _tmp3_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = g_option_context_new (" - Launches the pie menu for linux.");
	context = _tmp0_;
	_tmp1_ = context;
	g_option_context_add_main_entries (_tmp1_, GNOME_PIE_DAEMON_options, NULL);
	_tmp2_ = context;
	_tmp3_ = gtk_get_option_group (FALSE);
	g_option_context_add_group (_tmp2_, _tmp3_);
	{
		GOptionContext* _tmp4_;
		_tmp4_ = context;
		g_option_context_parse (_tmp4_, (gint*) (&args_length1), &args, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp5_ = FALSE;
			if (_inner_error0_->domain == G_OPTION_ERROR) {
				goto __catch0_g_option_error;
			}
			_g_option_context_free0 (context);
			g_critical ("file %s: line %d: unexpected 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 _tmp5_;
		}
	}
	goto __finally0;
	__catch0_g_option_error:
	{
		GError* _error_ = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = _error_;
		_tmp7_ = _tmp6_->message;
		g_warning ("daemon.vala:237: %s", _tmp7_);
		_tmp8_ = args[0];
		_tmp9_ = args[0];
		g_message ("Run '%s' to launch Gnome-Pie or run '%s --help' to" " see a full list of available command line options.\n", _tmp8_, _tmp9_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp10_ = FALSE;
		_g_option_context_free0 (context);
		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 _tmp10_;
	}
	if (gnome_pie_daemon_reset) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp11_ = gnome_pie_paths_get_pie_config ();
		_tmp12_ = _tmp11_;
		if (g_remove (_tmp12_) == 0) {
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			_tmp13_ = gnome_pie_paths_get_pie_config ();
			_tmp14_ = _tmp13_;
			g_message ("daemon.vala:245: Removed file \"%s\"", _tmp14_);
		}
		_tmp15_ = gnome_pie_paths_get_settings ();
		_tmp16_ = _tmp15_;
		if (g_remove (_tmp16_) == 0) {
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			_tmp17_ = gnome_pie_paths_get_settings ();
			_tmp18_ = _tmp17_;
			g_message ("daemon.vala:248: Removed file \"%s\"", _tmp18_);
		}
		result = TRUE;
		_g_option_context_free0 (context);
		return result;
	}
	if (gnome_pie_daemon_print_ids) {
		gnome_pie_daemon_init_pies (self);
		gnome_pie_pie_manager_print_ids ();
		gnome_pie_daemon_print_ids = FALSE;
		result = TRUE;
		_g_option_context_free0 (context);
		return result;
	}
	if (called_from_remote) {
		gboolean _tmp19_ = FALSE;
		const gchar* _tmp20_;
		_tmp20_ = gnome_pie_daemon_open_pie;
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = gnome_pie_daemon_open_pie;
			_tmp19_ = g_strcmp0 (_tmp21_, "") != 0;
		} else {
			_tmp19_ = FALSE;
		}
		if (_tmp19_) {
			const gchar* _tmp22_;
			gchar* _tmp23_;
			_tmp22_ = gnome_pie_daemon_open_pie;
			gnome_pie_pie_manager_open_pie (_tmp22_);
			_tmp23_ = g_strdup ("");
			_g_free0 (gnome_pie_daemon_open_pie);
			gnome_pie_daemon_open_pie = _tmp23_;
		} else {
			GnomePieIndicator* _tmp24_;
			_tmp24_ = self->priv->indicator;
			gnome_pie_indicator_show_preferences (_tmp24_);
		}
	}
	result = FALSE;
	_g_option_context_free0 (context);
	return result;
}

static void
gnome_pie_daemon_class_init (GnomePieDaemonClass * klass,
                             gpointer klass_data)
{
	gnome_pie_daemon_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GnomePieDaemon_private_offset);
	((GApplicationClass *) klass)->local_command_line = (gboolean (*) (GApplication*, gchar***, gint*)) gnome_pie_daemon_real_local_command_line;
	((GApplicationClass *) klass)->command_line = (gint (*) (GApplication*, GApplicationCommandLine*)) gnome_pie_daemon_real_command_line;
	G_OBJECT_CLASS (klass)->finalize = gnome_pie_daemon_finalize;
}

static void
gnome_pie_daemon_instance_init (GnomePieDaemon * self,
                                gpointer klass)
{
	self->priv = gnome_pie_daemon_get_instance_private (self);
	self->priv->initialized = FALSE;
	self->priv->indicator = NULL;
}

static void
gnome_pie_daemon_finalize (GObject * obj)
{
	GnomePieDaemon * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GNOME_PIE_TYPE_DAEMON, GnomePieDaemon);
	_g_object_unref0 (self->priv->indicator);
	G_OBJECT_CLASS (gnome_pie_daemon_parent_class)->finalize (obj);
}

static GType
gnome_pie_daemon_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GnomePieDaemonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gnome_pie_daemon_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GnomePieDaemon), 0, (GInstanceInitFunc) gnome_pie_daemon_instance_init, NULL };
	GType gnome_pie_daemon_type_id;
	gnome_pie_daemon_type_id = g_type_register_static (g_application_get_type (), "GnomePieDaemon", &g_define_type_info, 0);
	GnomePieDaemon_private_offset = g_type_add_instance_private (gnome_pie_daemon_type_id, sizeof (GnomePieDaemonPrivate));
	return gnome_pie_daemon_type_id;
}

GType
gnome_pie_daemon_get_type (void)
{
	static volatile gsize gnome_pie_daemon_type_id__once = 0;
	if (g_once_init_enter (&gnome_pie_daemon_type_id__once)) {
		GType gnome_pie_daemon_type_id;
		gnome_pie_daemon_type_id = gnome_pie_daemon_get_type_once ();
		g_once_init_leave (&gnome_pie_daemon_type_id__once, gnome_pie_daemon_type_id);
	}
	return gnome_pie_daemon_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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

