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

/*
    AyatanaIndicatorService.vala
    Copyright (C) 2010 Maia Kozheva <sikon@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <libappindicator/app-indicator.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 STEADYFLOW_UI_TYPE_IINDICATOR_SERVICE (steadyflow_ui_iindicator_service_get_type ())
#define STEADYFLOW_UI_IINDICATOR_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_UI_TYPE_IINDICATOR_SERVICE, SteadyflowUIIIndicatorService))
#define STEADYFLOW_UI_IS_IINDICATOR_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_UI_TYPE_IINDICATOR_SERVICE))
#define STEADYFLOW_UI_IINDICATOR_SERVICE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), STEADYFLOW_UI_TYPE_IINDICATOR_SERVICE, SteadyflowUIIIndicatorServiceIface))

typedef struct _SteadyflowUIIIndicatorService SteadyflowUIIIndicatorService;
typedef struct _SteadyflowUIIIndicatorServiceIface SteadyflowUIIIndicatorServiceIface;

#define STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE (steadyflow_ui_ayatana_indicator_service_get_type ())
#define STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, SteadyflowUIAyatanaIndicatorService))
#define STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, SteadyflowUIAyatanaIndicatorServiceClass))
#define STEADYFLOW_UI_IS_AYATANA_INDICATOR_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE))
#define STEADYFLOW_UI_IS_AYATANA_INDICATOR_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE))
#define STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, SteadyflowUIAyatanaIndicatorServiceClass))

typedef struct _SteadyflowUIAyatanaIndicatorService SteadyflowUIAyatanaIndicatorService;
typedef struct _SteadyflowUIAyatanaIndicatorServiceClass SteadyflowUIAyatanaIndicatorServiceClass;
typedef struct _SteadyflowUIAyatanaIndicatorServicePrivate SteadyflowUIAyatanaIndicatorServicePrivate;
enum  {
	STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_0_PROPERTY,
	STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_ICON_NAME_PROPERTY,
	STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_VISIBLE_PROPERTY,
	STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_NUM_PROPERTIES
};
static GParamSpec* steadyflow_ui_ayatana_indicator_service_properties[STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_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))

struct _SteadyflowUIIIndicatorServiceIface {
	GTypeInterface parent_iface;
	void (*set_menu) (SteadyflowUIIIndicatorService* self, GtkMenu* menu);
	gchar* (*get_icon_name) (SteadyflowUIIIndicatorService* self);
	void (*set_icon_name) (SteadyflowUIIIndicatorService* self, const gchar* value);
	gboolean (*get_visible) (SteadyflowUIIIndicatorService* self);
	void (*set_visible) (SteadyflowUIIIndicatorService* self, gboolean value);
};

struct _SteadyflowUIAyatanaIndicatorService {
	GObject parent_instance;
	SteadyflowUIAyatanaIndicatorServicePrivate * priv;
};

struct _SteadyflowUIAyatanaIndicatorServiceClass {
	GObjectClass parent_class;
};

struct _SteadyflowUIAyatanaIndicatorServicePrivate {
	AppIndicator* indicator;
};

static gint SteadyflowUIAyatanaIndicatorService_private_offset;
static gpointer steadyflow_ui_ayatana_indicator_service_parent_class = NULL;
static SteadyflowUIIIndicatorServiceIface * steadyflow_ui_ayatana_indicator_service_steadyflow_ui_iindicator_service_parent_iface = NULL;

VALA_EXTERN GType steadyflow_ui_iindicator_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowUIIIndicatorService, g_object_unref)
VALA_EXTERN GType steadyflow_ui_ayatana_indicator_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowUIAyatanaIndicatorService, g_object_unref)
VALA_EXTERN SteadyflowUIAyatanaIndicatorService* steadyflow_ui_ayatana_indicator_service_new (const gchar* id,
                                                                                  const gchar* icon_name,
                                                                                  const gchar* icon_theme_path);
VALA_EXTERN SteadyflowUIAyatanaIndicatorService* steadyflow_ui_ayatana_indicator_service_construct (GType object_type,
                                                                                        const gchar* id,
                                                                                        const gchar* icon_name,
                                                                                        const gchar* icon_theme_path);
static void steadyflow_ui_ayatana_indicator_service_real_set_menu (SteadyflowUIIIndicatorService* base,
                                                            GtkMenu* value);
VALA_EXTERN void steadyflow_ui_iindicator_service_set_menu (SteadyflowUIIIndicatorService* self,
                                                GtkMenu* menu);
VALA_EXTERN gchar* steadyflow_ui_iindicator_service_get_icon_name (SteadyflowUIIIndicatorService* self);
VALA_EXTERN void steadyflow_ui_iindicator_service_set_icon_name (SteadyflowUIIIndicatorService* self,
                                                     const gchar* value);
VALA_EXTERN gboolean steadyflow_ui_iindicator_service_get_visible (SteadyflowUIIIndicatorService* self);
VALA_EXTERN void steadyflow_ui_iindicator_service_set_visible (SteadyflowUIIIndicatorService* self,
                                                   gboolean value);
static void steadyflow_ui_ayatana_indicator_service_finalize (GObject * obj);
static GType steadyflow_ui_ayatana_indicator_service_get_type_once (void);
static void _vala_steadyflow_ui_ayatana_indicator_service_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_steadyflow_ui_ayatana_indicator_service_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);
VALA_EXTERN SteadyflowUIIIndicatorService* steadyflow_core_app_config_create_indicator (void);
VALA_EXTERN gboolean steadyflow_core_util_is_local_install (void);
VALA_EXTERN gchar* steadyflow_core_util_resolve_path (const gchar* rel_path);

static inline gpointer
steadyflow_ui_ayatana_indicator_service_get_instance_private (SteadyflowUIAyatanaIndicatorService* self)
{
	return G_STRUCT_MEMBER_P (self, SteadyflowUIAyatanaIndicatorService_private_offset);
}

SteadyflowUIAyatanaIndicatorService*
steadyflow_ui_ayatana_indicator_service_construct (GType object_type,
                                                   const gchar* id,
                                                   const gchar* icon_name,
                                                   const gchar* icon_theme_path)
{
	SteadyflowUIAyatanaIndicatorService * self = NULL;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (icon_name != NULL, NULL);
	self = (SteadyflowUIAyatanaIndicatorService*) g_object_new (object_type, NULL);
	if (icon_theme_path == NULL) {
		AppIndicator* _tmp0_;
		_tmp0_ = app_indicator_new (id, icon_name, APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
		_g_object_unref0 (self->priv->indicator);
		self->priv->indicator = _tmp0_;
	} else {
		GFile* _tmp1_;
		GFile* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		AppIndicator* _tmp5_;
		_tmp1_ = g_file_new_for_path (icon_theme_path);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_file_get_path (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = app_indicator_new_with_path (id, icon_name, APP_INDICATOR_CATEGORY_APPLICATION_STATUS, _tmp4_);
		_g_object_unref0 (self->priv->indicator);
		self->priv->indicator = _tmp5_;
		_g_free0 (_tmp4_);
		_g_object_unref0 (_tmp2_);
	}
	return self;
}

SteadyflowUIAyatanaIndicatorService*
steadyflow_ui_ayatana_indicator_service_new (const gchar* id,
                                             const gchar* icon_name,
                                             const gchar* icon_theme_path)
{
	return steadyflow_ui_ayatana_indicator_service_construct (STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, id, icon_name, icon_theme_path);
}

static void
steadyflow_ui_ayatana_indicator_service_real_set_menu (SteadyflowUIIIndicatorService* base,
                                                       GtkMenu* value)
{
	SteadyflowUIAyatanaIndicatorService * self;
	AppIndicator* _tmp0_;
	self = (SteadyflowUIAyatanaIndicatorService*) base;
	g_return_if_fail (value != NULL);
	_tmp0_ = self->priv->indicator;
	app_indicator_set_menu (_tmp0_, value);
}

static gchar*
steadyflow_ui_ayatana_indicator_service_real_get_icon_name (SteadyflowUIIIndicatorService* base)
{
	gchar* result;
	SteadyflowUIAyatanaIndicatorService* self;
	AppIndicator* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (SteadyflowUIAyatanaIndicatorService*) base;
	_tmp0_ = self->priv->indicator;
	_tmp1_ = app_indicator_get_icon (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

static void
steadyflow_ui_ayatana_indicator_service_real_set_icon_name (SteadyflowUIIIndicatorService* base,
                                                            const gchar* value)
{
	SteadyflowUIAyatanaIndicatorService* self;
	AppIndicator* _tmp0_;
	self = (SteadyflowUIAyatanaIndicatorService*) base;
	_tmp0_ = self->priv->indicator;
	app_indicator_set_icon (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, steadyflow_ui_ayatana_indicator_service_properties[STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_ICON_NAME_PROPERTY]);
}

static gboolean
steadyflow_ui_ayatana_indicator_service_real_get_visible (SteadyflowUIIIndicatorService* base)
{
	gboolean result;
	SteadyflowUIAyatanaIndicatorService* self;
	AppIndicator* _tmp0_;
	self = (SteadyflowUIAyatanaIndicatorService*) base;
	_tmp0_ = self->priv->indicator;
	result = app_indicator_get_status (_tmp0_) != APP_INDICATOR_STATUS_PASSIVE;
	return result;
}

static void
steadyflow_ui_ayatana_indicator_service_real_set_visible (SteadyflowUIIIndicatorService* base,
                                                          gboolean value)
{
	SteadyflowUIAyatanaIndicatorService* self;
	AppIndicatorStatus _tmp0_ = 0;
	AppIndicator* _tmp1_;
	self = (SteadyflowUIAyatanaIndicatorService*) base;
	if (value) {
		_tmp0_ = APP_INDICATOR_STATUS_ACTIVE;
	} else {
		_tmp0_ = APP_INDICATOR_STATUS_PASSIVE;
	}
	_tmp1_ = self->priv->indicator;
	app_indicator_set_status (_tmp1_, _tmp0_);
	g_object_notify_by_pspec ((GObject *) self, steadyflow_ui_ayatana_indicator_service_properties[STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_VISIBLE_PROPERTY]);
}

static void
steadyflow_ui_ayatana_indicator_service_class_init (SteadyflowUIAyatanaIndicatorServiceClass * klass,
                                                    gpointer klass_data)
{
	steadyflow_ui_ayatana_indicator_service_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SteadyflowUIAyatanaIndicatorService_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_steadyflow_ui_ayatana_indicator_service_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_steadyflow_ui_ayatana_indicator_service_set_property;
	G_OBJECT_CLASS (klass)->finalize = steadyflow_ui_ayatana_indicator_service_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_ICON_NAME_PROPERTY, steadyflow_ui_ayatana_indicator_service_properties[STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_VISIBLE_PROPERTY, steadyflow_ui_ayatana_indicator_service_properties[STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
steadyflow_ui_ayatana_indicator_service_steadyflow_ui_iindicator_service_interface_init (SteadyflowUIIIndicatorServiceIface * iface,
                                                                                         gpointer iface_data)
{
	steadyflow_ui_ayatana_indicator_service_steadyflow_ui_iindicator_service_parent_iface = g_type_interface_peek_parent (iface);
	iface->set_menu = (void (*) (SteadyflowUIIIndicatorService*, GtkMenu*)) steadyflow_ui_ayatana_indicator_service_real_set_menu;
	iface->get_icon_name = steadyflow_ui_ayatana_indicator_service_real_get_icon_name;
	iface->set_icon_name = steadyflow_ui_ayatana_indicator_service_real_set_icon_name;
	iface->get_visible = steadyflow_ui_ayatana_indicator_service_real_get_visible;
	iface->set_visible = steadyflow_ui_ayatana_indicator_service_real_set_visible;
}

static void
steadyflow_ui_ayatana_indicator_service_instance_init (SteadyflowUIAyatanaIndicatorService * self,
                                                       gpointer klass)
{
	self->priv = steadyflow_ui_ayatana_indicator_service_get_instance_private (self);
}

static void
steadyflow_ui_ayatana_indicator_service_finalize (GObject * obj)
{
	SteadyflowUIAyatanaIndicatorService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, SteadyflowUIAyatanaIndicatorService);
	_g_object_unref0 (self->priv->indicator);
	G_OBJECT_CLASS (steadyflow_ui_ayatana_indicator_service_parent_class)->finalize (obj);
}

static GType
steadyflow_ui_ayatana_indicator_service_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SteadyflowUIAyatanaIndicatorServiceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) steadyflow_ui_ayatana_indicator_service_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SteadyflowUIAyatanaIndicatorService), 0, (GInstanceInitFunc) steadyflow_ui_ayatana_indicator_service_instance_init, NULL };
	static const GInterfaceInfo steadyflow_ui_iindicator_service_info = { (GInterfaceInitFunc) steadyflow_ui_ayatana_indicator_service_steadyflow_ui_iindicator_service_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType steadyflow_ui_ayatana_indicator_service_type_id;
	steadyflow_ui_ayatana_indicator_service_type_id = g_type_register_static (G_TYPE_OBJECT, "SteadyflowUIAyatanaIndicatorService", &g_define_type_info, 0);
	g_type_add_interface_static (steadyflow_ui_ayatana_indicator_service_type_id, STEADYFLOW_UI_TYPE_IINDICATOR_SERVICE, &steadyflow_ui_iindicator_service_info);
	SteadyflowUIAyatanaIndicatorService_private_offset = g_type_add_instance_private (steadyflow_ui_ayatana_indicator_service_type_id, sizeof (SteadyflowUIAyatanaIndicatorServicePrivate));
	return steadyflow_ui_ayatana_indicator_service_type_id;
}

GType
steadyflow_ui_ayatana_indicator_service_get_type (void)
{
	static volatile gsize steadyflow_ui_ayatana_indicator_service_type_id__once = 0;
	if (g_once_init_enter (&steadyflow_ui_ayatana_indicator_service_type_id__once)) {
		GType steadyflow_ui_ayatana_indicator_service_type_id;
		steadyflow_ui_ayatana_indicator_service_type_id = steadyflow_ui_ayatana_indicator_service_get_type_once ();
		g_once_init_leave (&steadyflow_ui_ayatana_indicator_service_type_id__once, steadyflow_ui_ayatana_indicator_service_type_id);
	}
	return steadyflow_ui_ayatana_indicator_service_type_id__once;
}

static void
_vala_steadyflow_ui_ayatana_indicator_service_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	SteadyflowUIAyatanaIndicatorService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, SteadyflowUIAyatanaIndicatorService);
	switch (property_id) {
		case STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_ICON_NAME_PROPERTY:
		g_value_take_string (value, steadyflow_ui_iindicator_service_get_icon_name ((SteadyflowUIIIndicatorService*) self));
		break;
		case STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_VISIBLE_PROPERTY:
		g_value_set_boolean (value, steadyflow_ui_iindicator_service_get_visible ((SteadyflowUIIIndicatorService*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_steadyflow_ui_ayatana_indicator_service_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	SteadyflowUIAyatanaIndicatorService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, STEADYFLOW_UI_TYPE_AYATANA_INDICATOR_SERVICE, SteadyflowUIAyatanaIndicatorService);
	switch (property_id) {
		case STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_ICON_NAME_PROPERTY:
		steadyflow_ui_iindicator_service_set_icon_name ((SteadyflowUIIIndicatorService*) self, g_value_get_string (value));
		break;
		case STEADYFLOW_UI_AYATANA_INDICATOR_SERVICE_VISIBLE_PROPERTY:
		steadyflow_ui_iindicator_service_set_visible ((SteadyflowUIIIndicatorService*) self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

SteadyflowUIIIndicatorService*
steadyflow_core_app_config_create_indicator (void)
{
	gchar* _tmp0_ = NULL;
	gchar* iconpath = NULL;
	gchar* _tmp2_;
	SteadyflowUIAyatanaIndicatorService* _tmp3_;
	SteadyflowUIIIndicatorService* result;
	if (steadyflow_core_util_is_local_install ()) {
		gchar* _tmp1_;
		_tmp1_ = steadyflow_core_util_resolve_path ("img");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		_g_free0 (_tmp0_);
		_tmp0_ = NULL;
	}
	_tmp2_ = _tmp0_;
	_tmp0_ = NULL;
	iconpath = _tmp2_;
	_tmp3_ = steadyflow_ui_ayatana_indicator_service_new ("steadyflow", "steadyflow", iconpath);
	result = (SteadyflowUIIIndicatorService*) _tmp3_;
	_g_free0 (iconpath);
	_g_free0 (_tmp0_);
	return result;
}

