/* gitg-ext-action.c generated by valac 0.27.1.26-9b1a5-dirty, the Vala compiler
 * generated from gitg-ext-action.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2014 - Jesse van den Kieboom
 *
 * gitg 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 2 of the License, or
 * (at your option) any later version.
 *
 * gitg 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 gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgit2-glib/ggit.h>
#include "libgitg/libgitg.h"
#include <gee.h>


#define GITG_EXT_TYPE_UI_ELEMENT (gitg_ext_ui_element_get_type ())
#define GITG_EXT_UI_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_UI_ELEMENT, GitgExtUIElement))
#define GITG_EXT_IS_UI_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_UI_ELEMENT))
#define GITG_EXT_UI_ELEMENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_EXT_TYPE_UI_ELEMENT, GitgExtUIElementIface))

typedef struct _GitgExtUIElement GitgExtUIElement;
typedef struct _GitgExtUIElementIface GitgExtUIElementIface;

#define GITG_EXT_TYPE_APPLICATION (gitg_ext_application_get_type ())
#define GITG_EXT_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_APPLICATION, GitgExtApplication))
#define GITG_EXT_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_APPLICATION))
#define GITG_EXT_APPLICATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_EXT_TYPE_APPLICATION, GitgExtApplicationIface))

typedef struct _GitgExtApplication GitgExtApplication;
typedef struct _GitgExtApplicationIface GitgExtApplicationIface;

#define GITG_EXT_TYPE_ACTIVITY (gitg_ext_activity_get_type ())
#define GITG_EXT_ACTIVITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_ACTIVITY, GitgExtActivity))
#define GITG_EXT_IS_ACTIVITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_ACTIVITY))
#define GITG_EXT_ACTIVITY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_EXT_TYPE_ACTIVITY, GitgExtActivityIface))

typedef struct _GitgExtActivity GitgExtActivity;
typedef struct _GitgExtActivityIface GitgExtActivityIface;

#define GITG_EXT_TYPE_USER_QUERY (gitg_ext_user_query_get_type ())
#define GITG_EXT_USER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_USER_QUERY, GitgExtUserQuery))
#define GITG_EXT_USER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_EXT_TYPE_USER_QUERY, GitgExtUserQueryClass))
#define GITG_EXT_IS_USER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_USER_QUERY))
#define GITG_EXT_IS_USER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_EXT_TYPE_USER_QUERY))
#define GITG_EXT_USER_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_EXT_TYPE_USER_QUERY, GitgExtUserQueryClass))

typedef struct _GitgExtUserQuery GitgExtUserQuery;
typedef struct _GitgExtUserQueryClass GitgExtUserQueryClass;

#define GITG_EXT_TYPE_MESSAGE_BUS (gitg_ext_message_bus_get_type ())
#define GITG_EXT_MESSAGE_BUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_MESSAGE_BUS, GitgExtMessageBus))
#define GITG_EXT_MESSAGE_BUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_EXT_TYPE_MESSAGE_BUS, GitgExtMessageBusClass))
#define GITG_EXT_IS_MESSAGE_BUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_MESSAGE_BUS))
#define GITG_EXT_IS_MESSAGE_BUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_EXT_TYPE_MESSAGE_BUS))
#define GITG_EXT_MESSAGE_BUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_EXT_TYPE_MESSAGE_BUS, GitgExtMessageBusClass))

typedef struct _GitgExtMessageBus GitgExtMessageBus;
typedef struct _GitgExtMessageBusClass GitgExtMessageBusClass;

#define GITG_EXT_TYPE_NOTIFICATIONS (gitg_ext_notifications_get_type ())
#define GITG_EXT_NOTIFICATIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_NOTIFICATIONS, GitgExtNotifications))
#define GITG_EXT_IS_NOTIFICATIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_NOTIFICATIONS))
#define GITG_EXT_NOTIFICATIONS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_EXT_TYPE_NOTIFICATIONS, GitgExtNotificationsIface))

typedef struct _GitgExtNotifications GitgExtNotifications;
typedef struct _GitgExtNotificationsIface GitgExtNotificationsIface;

#define GITG_EXT_TYPE_REMOTE_LOOKUP (gitg_ext_remote_lookup_get_type ())
#define GITG_EXT_REMOTE_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_REMOTE_LOOKUP, GitgExtRemoteLookup))
#define GITG_EXT_IS_REMOTE_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_REMOTE_LOOKUP))
#define GITG_EXT_REMOTE_LOOKUP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_EXT_TYPE_REMOTE_LOOKUP, GitgExtRemoteLookupIface))

typedef struct _GitgExtRemoteLookup GitgExtRemoteLookup;
typedef struct _GitgExtRemoteLookupIface GitgExtRemoteLookupIface;

#define GITG_EXT_TYPE_ACTION (gitg_ext_action_get_type ())
#define GITG_EXT_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_EXT_TYPE_ACTION, GitgExtAction))
#define GITG_EXT_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_EXT_TYPE_ACTION))
#define GITG_EXT_ACTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_EXT_TYPE_ACTION, GitgExtActionIface))

typedef struct _GitgExtAction GitgExtAction;
typedef struct _GitgExtActionIface GitgExtActionIface;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GitgExtActivityIface {
	GTypeInterface parent_iface;
	gboolean (*is_default_for) (GitgExtActivity* self, const gchar* action);
};

struct _GitgExtNotificationsIface {
	GTypeInterface parent_iface;
	void (*add) (GitgExtNotifications* self, GtkWidget* widget);
	void (*remove) (GitgExtNotifications* self, GtkWidget* widget, guint delay);
};

struct _GitgExtRemoteLookupIface {
	GTypeInterface parent_iface;
	GitgRemote* (*lookup) (GitgExtRemoteLookup* self, const gchar* name);
};

struct _GitgExtApplicationIface {
	GTypeInterface parent_iface;
	GitgExtActivity* (*activity) (GitgExtApplication* self, const gchar* id);
	void (*user_query) (GitgExtApplication* self, GitgExtUserQuery* query);
	void (*show_infobar) (GitgExtApplication* self, const gchar* primary_msg, const gchar* secondary_msg, GtkMessageType type);
	GitgExtApplication* (*open_new) (GitgExtApplication* self, GgitRepository* repository, const gchar* hint);
	GitgRepository* (*get_repository) (GitgExtApplication* self);
	void (*set_repository) (GitgExtApplication* self, GitgRepository* value);
	GitgExtMessageBus* (*get_message_bus) (GitgExtApplication* self);
	GitgExtActivity* (*get_current_activity) (GitgExtApplication* self);
	GeeMap* (*get_environment) (GitgExtApplication* self);
	GitgExtNotifications* (*get_notifications) (GitgExtApplication* self);
	gboolean (*get_busy) (GitgExtApplication* self);
	void (*set_busy) (GitgExtApplication* self, gboolean value);
	GitgExtRemoteLookup* (*get_remote_lookup) (GitgExtApplication* self);
};

struct _GitgExtUIElementIface {
	GTypeInterface parent_iface;
	gint (*negotiate_order) (GitgExtUIElement* self, GitgExtUIElement* other);
	void (*activate) (GitgExtUIElement* self);
	GitgExtApplication* (*get_application) (GitgExtUIElement* self);
	void (*set_application) (GitgExtUIElement* self, GitgExtApplication* value);
	gchar* (*get_id) (GitgExtUIElement* self);
	gchar* (*get_display_name) (GitgExtUIElement* self);
	gchar* (*get_description) (GitgExtUIElement* self);
	gchar* (*get_icon) (GitgExtUIElement* self);
	GtkWidget* (*get_widget) (GitgExtUIElement* self);
	gboolean (*get_available) (GitgExtUIElement* self);
	gboolean (*get_enabled) (GitgExtUIElement* self);
};

struct _GitgExtActionIface {
	GTypeInterface parent_iface;
	void (*populate_menu) (GitgExtAction* self, GtkMenu* menu);
};



GType gitg_ext_activity_get_type (void) G_GNUC_CONST;
GType gitg_ext_user_query_get_type (void) G_GNUC_CONST;
GType gitg_ext_message_bus_get_type (void) G_GNUC_CONST;
GType gitg_ext_notifications_get_type (void) G_GNUC_CONST;
GType gitg_ext_remote_lookup_get_type (void) G_GNUC_CONST;
GType gitg_ext_application_get_type (void) G_GNUC_CONST;
GType gitg_ext_ui_element_get_type (void) G_GNUC_CONST;
GType gitg_ext_action_get_type (void) G_GNUC_CONST;
void gitg_ext_action_populate_menu (GitgExtAction* self, GtkMenu* menu);
static void gitg_ext_action_real_populate_menu (GitgExtAction* self, GtkMenu* menu);
gboolean gitg_ext_ui_element_get_available (GitgExtUIElement* self);
gchar* gitg_ext_ui_element_get_display_name (GitgExtUIElement* self);
gchar* gitg_ext_ui_element_get_description (GitgExtUIElement* self);
gboolean gitg_ext_ui_element_get_enabled (GitgExtUIElement* self);
static void ___lambda5_ (GitgExtAction* self);
static void ____lambda5__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);


static void ___lambda5_ (GitgExtAction* self) {
#line 38 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	g_signal_emit_by_name ((GitgExtUIElement*) self, "activate");
#line 180 "gitg-ext-action.c"
}


static void ____lambda5__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
#line 37 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	___lambda5_ ((GitgExtAction*) self);
#line 187 "gitg-ext-action.c"
}


static void gitg_ext_action_real_populate_menu (GitgExtAction* self, GtkMenu* menu) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GtkMenuItem* item = NULL;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GtkMenuItem* _tmp5_ = NULL;
	GtkMenuItem* _tmp6_ = NULL;
	GtkMenuItem* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_ = NULL;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	GtkMenuItem* _tmp15_ = NULL;
	GtkMenu* _tmp16_ = NULL;
	GtkMenuItem* _tmp17_ = NULL;
#line 25 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	g_return_if_fail (menu != NULL);
#line 27 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp0_ = gitg_ext_ui_element_get_available ((GitgExtUIElement*) self);
#line 27 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp1_ = _tmp0_;
#line 27 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	if (!_tmp1_) {
#line 29 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		return;
#line 219 "gitg-ext-action.c"
	}
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp2_ = gitg_ext_ui_element_get_display_name ((GitgExtUIElement*) self);
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp3_ = _tmp2_;
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp4_ = _tmp3_;
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp5_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_tmp4_);
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	g_object_ref_sink (_tmp5_);
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp6_ = _tmp5_;
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_g_free0 (_tmp4_);
#line 32 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	item = _tmp6_;
#line 33 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp7_ = item;
#line 33 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp8_ = gitg_ext_ui_element_get_description ((GitgExtUIElement*) self);
#line 33 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp9_ = _tmp8_;
#line 33 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp10_ = _tmp9_;
#line 33 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, _tmp10_);
#line 33 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_g_free0 (_tmp10_);
#line 35 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp11_ = gitg_ext_ui_element_get_enabled ((GitgExtUIElement*) self);
#line 35 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp12_ = _tmp11_;
#line 35 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	if (_tmp12_) {
#line 255 "gitg-ext-action.c"
		GtkMenuItem* _tmp13_ = NULL;
#line 37 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		_tmp13_ = item;
#line 37 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		g_signal_connect_object (_tmp13_, "activate", (GCallback) ____lambda5__gtk_menu_item_activate, self, 0);
#line 261 "gitg-ext-action.c"
	} else {
		GtkMenuItem* _tmp14_ = NULL;
#line 43 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		_tmp14_ = item;
#line 43 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		gtk_widget_set_sensitive ((GtkWidget*) _tmp14_, FALSE);
#line 268 "gitg-ext-action.c"
	}
#line 46 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp15_ = item;
#line 46 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	gtk_widget_show ((GtkWidget*) _tmp15_);
#line 47 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp16_ = menu;
#line 47 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_tmp17_ = item;
#line 47 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	gtk_menu_shell_append ((GtkMenuShell*) _tmp16_, (GtkWidget*) _tmp17_);
#line 25 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	_g_object_unref0 (item);
#line 282 "gitg-ext-action.c"
}


void gitg_ext_action_populate_menu (GitgExtAction* self, GtkMenu* menu) {
#line 25 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	g_return_if_fail (self != NULL);
#line 25 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	GITG_EXT_ACTION_GET_INTERFACE (self)->populate_menu (self, menu);
#line 291 "gitg-ext-action.c"
}


static void gitg_ext_action_base_init (GitgExtActionIface * iface) {
#line 23 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	static gboolean initialized = FALSE;
#line 23 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
	if (!initialized) {
#line 23 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		initialized = TRUE;
#line 23 "/home/garrett/hacking/gnome/gitg/libgitg-ext/gitg-ext-action.vala"
		iface->populate_menu = gitg_ext_action_real_populate_menu;
#line 304 "gitg-ext-action.c"
	}
}


GType gitg_ext_action_get_type (void) {
	static volatile gsize gitg_ext_action_type_id__volatile = 0;
	if (g_once_init_enter (&gitg_ext_action_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GitgExtActionIface), (GBaseInitFunc) gitg_ext_action_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType gitg_ext_action_type_id;
		gitg_ext_action_type_id = g_type_register_static (G_TYPE_INTERFACE, "GitgExtAction", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (gitg_ext_action_type_id, GITG_EXT_TYPE_UI_ELEMENT);
		g_once_init_leave (&gitg_ext_action_type_id__volatile, gitg_ext_action_type_id);
	}
	return gitg_ext_action_type_id__volatile;
}



