/* launchpad-plugin.c generated by valac 0.56.17, the Vala compiler
 * generated from launchpad-plugin.vala, do not modify */

/*
 * Copyright (C) 2011 Michal Hruby <michal.mhr@gmail.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 2 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, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 *
 * Authored by Michal Hruby <michal.mhr@gmail.com>
 *
 */

#include "plugins.h"
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <synapse-core.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>

#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT_CONSUMER_KEY "Synapse.LaunchpadPlugin"
#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

#define SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT (synapse_launchpad_plugin_launchpad_auth_object_get_type ())
#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT, SynapseLaunchpadPluginLaunchpadAuthObject))
#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT, SynapseLaunchpadPluginLaunchpadAuthObjectClass))
#define SYNAPSE_LAUNCHPAD_PLUGIN_IS_LAUNCHPAD_AUTH_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT))
#define SYNAPSE_LAUNCHPAD_PLUGIN_IS_LAUNCHPAD_AUTH_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT))
#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT, SynapseLaunchpadPluginLaunchpadAuthObjectClass))

typedef struct _SynapseLaunchpadPluginLaunchpadAuthObject SynapseLaunchpadPluginLaunchpadAuthObject;
typedef struct _SynapseLaunchpadPluginLaunchpadAuthObjectClass SynapseLaunchpadPluginLaunchpadAuthObjectClass;
enum  {
	SYNAPSE_LAUNCHPAD_PLUGIN_0_PROPERTY,
	SYNAPSE_LAUNCHPAD_PLUGIN_ENABLED_PROPERTY,
	SYNAPSE_LAUNCHPAD_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* synapse_launchpad_plugin_properties[SYNAPSE_LAUNCHPAD_PLUGIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))

#define SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT (synapse_launchpad_plugin_launchpad_object_get_type ())
#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT, SynapseLaunchpadPluginLaunchpadObject))
#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT, SynapseLaunchpadPluginLaunchpadObjectClass))
#define SYNAPSE_LAUNCHPAD_PLUGIN_IS_LAUNCHPAD_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT))
#define SYNAPSE_LAUNCHPAD_PLUGIN_IS_LAUNCHPAD_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT))
#define SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT, SynapseLaunchpadPluginLaunchpadObjectClass))

typedef struct _SynapseLaunchpadPluginLaunchpadObject SynapseLaunchpadPluginLaunchpadObject;
typedef struct _SynapseLaunchpadPluginLaunchpadObjectClass SynapseLaunchpadPluginLaunchpadObjectClass;
typedef struct _SynapseLaunchpadPluginSearchData SynapseLaunchpadPluginSearchData;
typedef struct _SynapseLaunchpadPluginLaunchpadAuthObjectPrivate SynapseLaunchpadPluginLaunchpadAuthObjectPrivate;
enum  {
	SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT_0_PROPERTY,
	SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT_NUM_PROPERTIES
};
static GParamSpec* synapse_launchpad_plugin_launchpad_auth_object_properties[SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_AUTH_OBJECT_NUM_PROPERTIES];
typedef struct _SynapseLaunchpadPluginLaunchpadObjectPrivate SynapseLaunchpadPluginLaunchpadObjectPrivate;
enum  {
	SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_OBJECT_0_PROPERTY,
	SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_OBJECT_NUM_PROPERTIES
};
static GParamSpec* synapse_launchpad_plugin_launchpad_object_properties[SYNAPSE_LAUNCHPAD_PLUGIN_LAUNCHPAD_OBJECT_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _SynapseLaunchpadPluginPrivate {
	gboolean _enabled;
	SynapseLaunchpadPluginLaunchpadAuthObject* auth_object;
	GRegex* bug_regex;
	GRegex* branch_regex;
};

struct _SynapseLaunchpadPluginSearchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SynapseLaunchpadPlugin* self;
	SynapseQuery q;
	SynapseResultSet* result;
	gchar* uri;
	gchar* title;
	gchar* description;
	SynapseResultSet* _result_;
	SynapseResultSet* _tmp0_;
	gchar* stripped;
	SynapseQuery _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	GMatchInfo* mi;
	GRegex* _tmp5_;
	const gchar* _tmp6_;
	GMatchInfo* _tmp7_;
	gboolean _tmp8_;
	gchar* branch;
	GMatchInfo* _tmp9_;
	gchar* _tmp10_;
	gchar** groups;
	const gchar* _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	gint groups_length1;
	gint _groups_size_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gboolean _tmp21_;
	gchar** _tmp22_;
	gint _tmp22__length1;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar** _tmp26_;
	gint _tmp26__length1;
	const gchar* _tmp27_;
	gchar** _tmp28_;
	gint _tmp28__length1;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	const gchar* _tmp40_;
	SynapseResultSet* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	SynapseLaunchpadPluginLaunchpadObject* _tmp45_;
	SynapseLaunchpadPluginLaunchpadObject* _tmp46_;
	GRegex* _tmp47_;
	const gchar* _tmp48_;
	GMatchInfo* _tmp49_;
	gboolean _tmp50_;
	gchar* bug_num;
	GMatchInfo* _tmp51_;
	gchar* _tmp52_;
	const gchar* _tmp53_;
	gchar* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	const gchar* _tmp57_;
	gchar* _tmp58_;
	SynapseResultSet* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	SynapseLaunchpadPluginLaunchpadObject* _tmp63_;
	SynapseLaunchpadPluginLaunchpadObject* _tmp64_;
	GError* _inner_error0_;
};

struct _SynapseLaunchpadPluginLaunchpadAuthObject {
	GObject parent_instance;
	SynapseLaunchpadPluginLaunchpadAuthObjectPrivate * priv;
};

struct _SynapseLaunchpadPluginLaunchpadAuthObjectClass {
	GObjectClass parent_class;
};

struct _SynapseLaunchpadPluginLaunchpadObject {
	SynapseUriMatch parent_instance;
	SynapseLaunchpadPluginLaunchpadObjectPrivate * priv;
};

struct _SynapseLaunchpadPluginLaunchpadObjectClass {
	SynapseUriMatchClass parent_class;
};

static gint SynapseLaunchpadPlugin_private_offset;
static gpointer synapse_launchpad_plugin_parent_class = NULL;
static gpointer synapse_launchpad_plugin_launchpad_auth_object_parent_class = NULL;
static gpointer synapse_launchpad_plugin_launchpad_object_parent_class = NULL;
static SynapseActivatableIface * synapse_launchpad_plugin_synapse_activatable_parent_iface = NULL;
static SynapseItemProviderIface * synapse_launchpad_plugin_synapse_item_provider_parent_iface = NULL;

static GType synapse_launchpad_plugin_launchpad_auth_object_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void synapse_launchpad_plugin_real_activate (SynapseActivatable* base);
static void synapse_launchpad_plugin_real_deactivate (SynapseActivatable* base);
static void synapse_launchpad_plugin_register_plugin (void);
static void _synapse_launchpad_plugin_register_plugin_synapse_plugin_register_func (void);
static gboolean synapse_launchpad_plugin_real_handles_query (SynapseItemProvider* base,
                                                      SynapseQuery* q);
static void synapse_launchpad_plugin_real_search_data_free (gpointer _data);
static void synapse_launchpad_plugin_real_search (SynapseItemProvider* base,
                                           SynapseQuery* q,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static gboolean synapse_launchpad_plugin_real_search_co (SynapseLaunchpadPluginSearchData* _data_);
static SynapseLaunchpadPluginLaunchpadObject* synapse_launchpad_plugin_launchpad_object_new (const gchar* title,
                                                                                      const gchar* desc,
                                                                                      const gchar* uri);
static SynapseLaunchpadPluginLaunchpadObject* synapse_launchpad_plugin_launchpad_object_construct (GType object_type,
                                                                                            const gchar* title,
                                                                                            const gchar* desc,
                                                                                            const gchar* uri);
static GType synapse_launchpad_plugin_launchpad_object_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SynapseLaunchpadPluginLaunchpadAuthObject* synapse_launchpad_plugin_launchpad_auth_object_new (void);
static SynapseLaunchpadPluginLaunchpadAuthObject* synapse_launchpad_plugin_launchpad_auth_object_construct (GType object_type);
static GType synapse_launchpad_plugin_launchpad_auth_object_get_type_once (void);
static GType synapse_launchpad_plugin_launchpad_object_get_type_once (void);
static GObject * synapse_launchpad_plugin_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void synapse_launchpad_plugin_finalize (GObject * obj);
static GType synapse_launchpad_plugin_get_type_once (void);
static void _vala_synapse_launchpad_plugin_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_synapse_launchpad_plugin_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
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 inline gpointer
synapse_launchpad_plugin_get_instance_private (SynapseLaunchpadPlugin* self)
{
	return G_STRUCT_MEMBER_P (self, SynapseLaunchpadPlugin_private_offset);
}

static void
synapse_launchpad_plugin_real_activate (SynapseActivatable* base)
{
	SynapseLaunchpadPlugin * self;
#line 30 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) base;
#line 271 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_real_deactivate (SynapseActivatable* base)
{
	SynapseLaunchpadPlugin * self;
#line 35 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) base;
#line 37 "launchpad-plugin.vala"
	_g_object_unref0 (self->priv->auth_object);
#line 37 "launchpad-plugin.vala"
	self->priv->auth_object = NULL;
#line 284 "launchpad-plugin.c"
}

GtkWidget*
synapse_launchpad_plugin_create_config_widget (SynapseLaunchpadPlugin* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkButton* authorize_button = NULL;
	GtkButton* _tmp1_;
	GtkSpinner* spinner = NULL;
	GtkSpinner* _tmp2_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp3_;
	GtkButton* proceed_button = NULL;
	GtkButton* _tmp4_;
	GtkWidget* result;
#line 40 "launchpad-plugin.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 42 "launchpad-plugin.vala"
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#line 42 "launchpad-plugin.vala"
	g_object_ref_sink (_tmp0_);
#line 42 "launchpad-plugin.vala"
	box = _tmp0_;
#line 43 "launchpad-plugin.vala"
	gtk_widget_show ((GtkWidget*) box);
#line 45 "launchpad-plugin.vala"
	_tmp1_ = (GtkButton*) gtk_button_new_with_label (_ ("Authorize with Launchpad"));
#line 45 "launchpad-plugin.vala"
	g_object_ref_sink (_tmp1_);
#line 45 "launchpad-plugin.vala"
	authorize_button = _tmp1_;
#line 46 "launchpad-plugin.vala"
	gtk_widget_show ((GtkWidget*) authorize_button);
#line 47 "launchpad-plugin.vala"
	gtk_box_pack_start (box, (GtkWidget*) authorize_button, TRUE, FALSE, (guint) 0);
#line 49 "launchpad-plugin.vala"
	_tmp2_ = (GtkSpinner*) gtk_spinner_new ();
#line 49 "launchpad-plugin.vala"
	g_object_ref_sink (_tmp2_);
#line 49 "launchpad-plugin.vala"
	spinner = _tmp2_;
#line 50 "launchpad-plugin.vala"
	gtk_box_pack_start (box, (GtkWidget*) spinner, TRUE, TRUE, (guint) 0);
#line 52 "launchpad-plugin.vala"
	_tmp3_ = (GtkLabel*) gtk_label_new (_ ("Please press the Finish button once you login to Launchpad with your w" \
"eb browser"));
#line 52 "launchpad-plugin.vala"
	g_object_ref_sink (_tmp3_);
#line 52 "launchpad-plugin.vala"
	label = _tmp3_;
#line 53 "launchpad-plugin.vala"
	gtk_label_set_width_chars (label, 40);
#line 54 "launchpad-plugin.vala"
	gtk_label_set_line_wrap (label, TRUE);
#line 55 "launchpad-plugin.vala"
	_tmp4_ = (GtkButton*) gtk_button_new_with_label (_ ("Finish authorization"));
#line 55 "launchpad-plugin.vala"
	g_object_ref_sink (_tmp4_);
#line 55 "launchpad-plugin.vala"
	proceed_button = _tmp4_;
#line 56 "launchpad-plugin.vala"
	gtk_box_pack_start (box, (GtkWidget*) label, TRUE, TRUE, (guint) 0);
#line 57 "launchpad-plugin.vala"
	gtk_box_pack_start (box, (GtkWidget*) proceed_button, TRUE, FALSE, (guint) 0);
#line 109 "launchpad-plugin.vala"
	result = (GtkWidget*) box;
#line 109 "launchpad-plugin.vala"
	_g_object_unref0 (proceed_button);
#line 109 "launchpad-plugin.vala"
	_g_object_unref0 (label);
#line 109 "launchpad-plugin.vala"
	_g_object_unref0 (spinner);
#line 109 "launchpad-plugin.vala"
	_g_object_unref0 (authorize_button);
#line 109 "launchpad-plugin.vala"
	return result;
#line 361 "launchpad-plugin.c"
}

static void
_synapse_launchpad_plugin_register_plugin_synapse_plugin_register_func (void)
{
#line 237 "launchpad-plugin.vala"
	synapse_launchpad_plugin_register_plugin ();
#line 369 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_register_plugin (void)
{
	SynapsePluginRegistry* _tmp0_;
	SynapsePluginRegistry* _tmp1_;
#line 237 "launchpad-plugin.vala"
	_tmp0_ = synapse_plugin_registry_get_default ();
#line 237 "launchpad-plugin.vala"
	_tmp1_ = _tmp0_;
#line 237 "launchpad-plugin.vala"
	synapse_plugin_registry_register_plugin (_tmp1_, SYNAPSE_TYPE_LAUNCHPAD_PLUGIN, "Launchpad", _ ("Find bugs and branches on Launchpad."), "applications-internet", _synapse_launchpad_plugin_register_plugin_synapse_plugin_register_func, TRUE, "");
#line 237 "launchpad-plugin.vala"
	_g_object_unref0 (_tmp1_);
#line 385 "launchpad-plugin.c"
}

static gboolean
synapse_launchpad_plugin_real_handles_query (SynapseItemProvider* base,
                                             SynapseQuery* q)
{
	SynapseLaunchpadPlugin * self;
	gboolean _tmp0_ = FALSE;
	SynapseQuery _tmp1_;
	gboolean result;
#line 267 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) base;
#line 267 "launchpad-plugin.vala"
	g_return_val_if_fail (q != NULL, FALSE);
#line 269 "launchpad-plugin.vala"
	_tmp1_ = *q;
#line 269 "launchpad-plugin.vala"
	if ((_tmp1_.query_type & SYNAPSE_QUERY_FLAGS_INTERNET) == SYNAPSE_QUERY_FLAGS_INTERNET) {
#line 269 "launchpad-plugin.vala"
		_tmp0_ = TRUE;
#line 406 "launchpad-plugin.c"
	} else {
		SynapseQuery _tmp2_;
#line 269 "launchpad-plugin.vala"
		_tmp2_ = *q;
#line 269 "launchpad-plugin.vala"
		_tmp0_ = (_tmp2_.query_type & SYNAPSE_QUERY_FLAGS_ACTIONS) == SYNAPSE_QUERY_FLAGS_ACTIONS;
#line 413 "launchpad-plugin.c"
	}
#line 269 "launchpad-plugin.vala"
	result = _tmp0_;
#line 269 "launchpad-plugin.vala"
	return result;
#line 419 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_real_search_data_free (gpointer _data)
{
	SynapseLaunchpadPluginSearchData* _data_;
	_data_ = _data;
#line 24 "launchpad-plugin.vala"
	synapse_query_destroy (&_data_->q);
#line 24 "launchpad-plugin.vala"
	_g_object_unref0 (_data_->result);
#line 24 "launchpad-plugin.vala"
	_g_object_unref0 (_data_->self);
#line 24 "launchpad-plugin.vala"
	g_slice_free (SynapseLaunchpadPluginSearchData, _data_);
#line 435 "launchpad-plugin.c"
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 24 "launchpad-plugin.vala"
	return self ? g_object_ref (self) : NULL;
#line 443 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_real_search (SynapseItemProvider* base,
                                      SynapseQuery* q,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	SynapseLaunchpadPlugin * self;
	SynapseLaunchpadPluginSearchData* _data_;
	SynapseLaunchpadPlugin* _tmp0_;
	SynapseQuery _tmp1_;
	SynapseQuery _tmp2_;
	SynapseQuery _tmp3_ = {0};
#line 24 "launchpad-plugin.vala"
	g_return_if_fail (q != NULL);
#line 24 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) base;
#line 24 "launchpad-plugin.vala"
	_data_ = g_slice_new0 (SynapseLaunchpadPluginSearchData);
#line 24 "launchpad-plugin.vala"
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
#line 24 "launchpad-plugin.vala"
	g_task_set_task_data (_data_->_async_result, _data_, synapse_launchpad_plugin_real_search_data_free);
#line 24 "launchpad-plugin.vala"
	_tmp0_ = _g_object_ref0 (self);
#line 24 "launchpad-plugin.vala"
	_data_->self = _tmp0_;
#line 24 "launchpad-plugin.vala"
	_tmp1_ = *q;
#line 24 "launchpad-plugin.vala"
	_tmp2_ = _tmp1_;
#line 24 "launchpad-plugin.vala"
	synapse_query_copy (&_tmp2_, &_tmp3_);
#line 24 "launchpad-plugin.vala"
	synapse_query_destroy (&_data_->q);
#line 24 "launchpad-plugin.vala"
	_data_->q = _tmp3_;
#line 24 "launchpad-plugin.vala"
	synapse_launchpad_plugin_real_search_co (_data_);
#line 484 "launchpad-plugin.c"
}

static SynapseResultSet*
synapse_launchpad_plugin_search_finish (SynapseItemProvider* base,
                                        GAsyncResult* _res_,
                                        GError** error)
{
	SynapseResultSet* result;
	SynapseLaunchpadPluginSearchData* _data_;
#line 24 "launchpad-plugin.vala"
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
#line 24 "launchpad-plugin.vala"
	if (NULL == _data_) {
#line 24 "launchpad-plugin.vala"
		return NULL;
#line 500 "launchpad-plugin.c"
	}
#line 24 "launchpad-plugin.vala"
	result = _data_->result;
#line 24 "launchpad-plugin.vala"
	_data_->result = NULL;
#line 24 "launchpad-plugin.vala"
	return result;
#line 508 "launchpad-plugin.c"
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
#line 1413 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1414 "glib-2.0.vapi"
	_tmp0_ = g_strdup (self);
#line 1414 "glib-2.0.vapi"
	_result_ = _tmp0_;
#line 1415 "glib-2.0.vapi"
	g_strstrip (_result_);
#line 1416 "glib-2.0.vapi"
	result = _result_;
#line 1416 "glib-2.0.vapi"
	return result;
#line 529 "launchpad-plugin.c"
}

static gboolean
synapse_launchpad_plugin_real_search_co (SynapseLaunchpadPluginSearchData* _data_)
{
#line 272 "launchpad-plugin.vala"
	switch (_data_->_state_) {
#line 272 "launchpad-plugin.vala"
		case 0:
#line 539 "launchpad-plugin.c"
		goto _state_0;
		default:
#line 272 "launchpad-plugin.vala"
		g_assert_not_reached ();
#line 544 "launchpad-plugin.c"
	}
	_state_0:
#line 274 "launchpad-plugin.vala"
	_data_->uri = NULL;
#line 275 "launchpad-plugin.vala"
	_data_->title = NULL;
#line 276 "launchpad-plugin.vala"
	_data_->description = NULL;
#line 277 "launchpad-plugin.vala"
	_data_->_tmp0_ = synapse_result_set_new ();
#line 277 "launchpad-plugin.vala"
	_data_->_result_ = _data_->_tmp0_;
#line 279 "launchpad-plugin.vala"
	_data_->_tmp1_ = _data_->q;
#line 279 "launchpad-plugin.vala"
	_data_->_tmp2_ = _data_->_tmp1_.query_string;
#line 279 "launchpad-plugin.vala"
	_data_->_tmp3_ = string_strip (_data_->_tmp2_);
#line 279 "launchpad-plugin.vala"
	_data_->stripped = _data_->_tmp3_;
#line 280 "launchpad-plugin.vala"
	_data_->_tmp4_ = _data_->stripped;
#line 280 "launchpad-plugin.vala"
	if (g_strcmp0 (_data_->_tmp4_, "") == 0) {
#line 280 "launchpad-plugin.vala"
		_data_->result = NULL;
#line 280 "launchpad-plugin.vala"
		_g_free0 (_data_->stripped);
#line 280 "launchpad-plugin.vala"
		_g_object_unref0 (_data_->_result_);
#line 280 "launchpad-plugin.vala"
		_g_free0 (_data_->description);
#line 280 "launchpad-plugin.vala"
		_g_free0 (_data_->title);
#line 280 "launchpad-plugin.vala"
		_g_free0 (_data_->uri);
#line 280 "launchpad-plugin.vala"
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
#line 280 "launchpad-plugin.vala"
		if (_data_->_state_ != 0) {
#line 280 "launchpad-plugin.vala"
			while (!g_task_get_completed (_data_->_async_result)) {
#line 280 "launchpad-plugin.vala"
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
#line 589 "launchpad-plugin.c"
			}
		}
#line 280 "launchpad-plugin.vala"
		g_object_unref (_data_->_async_result);
#line 280 "launchpad-plugin.vala"
		return FALSE;
#line 596 "launchpad-plugin.c"
	}
#line 283 "launchpad-plugin.vala"
	_data_->_tmp5_ = _data_->self->priv->branch_regex;
#line 283 "launchpad-plugin.vala"
	_data_->_tmp6_ = _data_->stripped;
#line 283 "launchpad-plugin.vala"
	_data_->_tmp7_ = NULL;
#line 283 "launchpad-plugin.vala"
	_data_->_tmp8_ = g_regex_match (_data_->_tmp5_, _data_->_tmp6_, 0, &_data_->_tmp7_);
#line 283 "launchpad-plugin.vala"
	_g_match_info_unref0 (_data_->mi);
#line 283 "launchpad-plugin.vala"
	_data_->mi = _data_->_tmp7_;
#line 283 "launchpad-plugin.vala"
	if (_data_->_tmp8_) {
#line 285 "launchpad-plugin.vala"
		_data_->_tmp9_ = _data_->mi;
#line 285 "launchpad-plugin.vala"
		_data_->_tmp10_ = g_match_info_fetch (_data_->_tmp9_, 1);
#line 285 "launchpad-plugin.vala"
		_data_->branch = _data_->_tmp10_;
#line 286 "launchpad-plugin.vala"
		_data_->_tmp11_ = _data_->branch;
#line 286 "launchpad-plugin.vala"
		_data_->_tmp13_ = _data_->_tmp12_ = g_strsplit (_data_->_tmp11_, "/", 0);
#line 286 "launchpad-plugin.vala"
		_data_->groups = _data_->_tmp13_;
#line 286 "launchpad-plugin.vala"
		_data_->groups_length1 = _vala_array_length (_data_->_tmp12_);
#line 286 "launchpad-plugin.vala"
		_data_->_groups_size_ = _data_->groups_length1;
#line 287 "launchpad-plugin.vala"
		_data_->_tmp14_ = _data_->groups;
#line 287 "launchpad-plugin.vala"
		_data_->_tmp14__length1 = _data_->groups_length1;
#line 287 "launchpad-plugin.vala"
		if (_data_->_tmp14__length1 == 1) {
#line 290 "launchpad-plugin.vala"
			_data_->_tmp15_ = _data_->branch;
#line 290 "launchpad-plugin.vala"
			_data_->_tmp16_ = g_strconcat ("https://code.launchpad.net/", _data_->_tmp15_, NULL);
#line 290 "launchpad-plugin.vala"
			_g_free0 (_data_->uri);
#line 290 "launchpad-plugin.vala"
			_data_->uri = _data_->_tmp16_;
#line 291 "launchpad-plugin.vala"
			_data_->_tmp17_ = _data_->branch;
#line 291 "launchpad-plugin.vala"
			_data_->_tmp18_ = g_strdup_printf (_ ("Launchpad: Bazaar branches for %s"), _data_->_tmp17_);
#line 291 "launchpad-plugin.vala"
			_g_free0 (_data_->title);
#line 291 "launchpad-plugin.vala"
			_data_->title = _data_->_tmp18_;
#line 292 "launchpad-plugin.vala"
			_data_->_tmp19_ = _data_->uri;
#line 292 "launchpad-plugin.vala"
			_data_->_tmp20_ = g_strdup (_data_->_tmp19_);
#line 292 "launchpad-plugin.vala"
			_g_free0 (_data_->description);
#line 292 "launchpad-plugin.vala"
			_data_->description = _data_->_tmp20_;
#line 658 "launchpad-plugin.c"
		} else {
#line 294 "launchpad-plugin.vala"
			_data_->_tmp22_ = _data_->groups;
#line 294 "launchpad-plugin.vala"
			_data_->_tmp22__length1 = _data_->groups_length1;
#line 294 "launchpad-plugin.vala"
			if (_data_->_tmp22__length1 == 2) {
#line 294 "launchpad-plugin.vala"
				_data_->_tmp23_ = _data_->branch;
#line 294 "launchpad-plugin.vala"
				_data_->_tmp21_ = !g_str_has_prefix (_data_->_tmp23_, "~");
#line 670 "launchpad-plugin.c"
			} else {
#line 294 "launchpad-plugin.vala"
				_data_->_tmp21_ = FALSE;
#line 674 "launchpad-plugin.c"
			}
#line 294 "launchpad-plugin.vala"
			if (_data_->_tmp21_) {
#line 297 "launchpad-plugin.vala"
				_data_->_tmp24_ = _data_->branch;
#line 297 "launchpad-plugin.vala"
				_data_->_tmp25_ = g_strconcat ("https://code.launchpad.net/", _data_->_tmp24_, NULL);
#line 297 "launchpad-plugin.vala"
				_g_free0 (_data_->uri);
#line 297 "launchpad-plugin.vala"
				_data_->uri = _data_->_tmp25_;
#line 298 "launchpad-plugin.vala"
				_data_->_tmp26_ = _data_->groups;
#line 298 "launchpad-plugin.vala"
				_data_->_tmp26__length1 = _data_->groups_length1;
#line 298 "launchpad-plugin.vala"
				_data_->_tmp27_ = _data_->_tmp26_[1];
#line 298 "launchpad-plugin.vala"
				_data_->_tmp28_ = _data_->groups;
#line 298 "launchpad-plugin.vala"
				_data_->_tmp28__length1 = _data_->groups_length1;
#line 298 "launchpad-plugin.vala"
				_data_->_tmp29_ = _data_->_tmp28_[0];
#line 298 "launchpad-plugin.vala"
				_data_->_tmp30_ = g_strdup_printf (_ ("Launchpad: Series %s for Project %s"), _data_->_tmp27_, _data_->_tmp29_);
#line 298 "launchpad-plugin.vala"
				_g_free0 (_data_->title);
#line 298 "launchpad-plugin.vala"
				_data_->title = _data_->_tmp30_;
#line 299 "launchpad-plugin.vala"
				_data_->_tmp31_ = _data_->uri;
#line 299 "launchpad-plugin.vala"
				_data_->_tmp32_ = g_strdup (_data_->_tmp31_);
#line 299 "launchpad-plugin.vala"
				_g_free0 (_data_->description);
#line 299 "launchpad-plugin.vala"
				_data_->description = _data_->_tmp32_;
#line 712 "launchpad-plugin.c"
			} else {
#line 301 "launchpad-plugin.vala"
				_data_->_tmp33_ = _data_->branch;
#line 301 "launchpad-plugin.vala"
				if (g_str_has_prefix (_data_->_tmp33_, "~")) {
#line 304 "launchpad-plugin.vala"
					_data_->_tmp34_ = _data_->branch;
#line 304 "launchpad-plugin.vala"
					_data_->_tmp35_ = g_strconcat ("https://code.launchpad.net/", _data_->_tmp34_, NULL);
#line 304 "launchpad-plugin.vala"
					_g_free0 (_data_->uri);
#line 304 "launchpad-plugin.vala"
					_data_->uri = _data_->_tmp35_;
#line 305 "launchpad-plugin.vala"
					_data_->_tmp36_ = _data_->branch;
#line 305 "launchpad-plugin.vala"
					_data_->_tmp37_ = g_strdup_printf (_ ("Launchpad: Bazaar branch %s"), _data_->_tmp36_);
#line 305 "launchpad-plugin.vala"
					_g_free0 (_data_->title);
#line 305 "launchpad-plugin.vala"
					_data_->title = _data_->_tmp37_;
#line 306 "launchpad-plugin.vala"
					_data_->_tmp38_ = _data_->uri;
#line 306 "launchpad-plugin.vala"
					_data_->_tmp39_ = g_strdup (_data_->_tmp38_);
#line 306 "launchpad-plugin.vala"
					_g_free0 (_data_->description);
#line 306 "launchpad-plugin.vala"
					_data_->description = _data_->_tmp39_;
#line 742 "launchpad-plugin.c"
				}
			}
		}
#line 309 "launchpad-plugin.vala"
		_data_->_tmp40_ = _data_->uri;
#line 309 "launchpad-plugin.vala"
		if (_data_->_tmp40_ != NULL) {
#line 311 "launchpad-plugin.vala"
			_data_->_tmp41_ = _data_->_result_;
#line 311 "launchpad-plugin.vala"
			_data_->_tmp42_ = _data_->title;
#line 311 "launchpad-plugin.vala"
			_data_->_tmp43_ = _data_->description;
#line 311 "launchpad-plugin.vala"
			_data_->_tmp44_ = _data_->uri;
#line 311 "launchpad-plugin.vala"
			_data_->_tmp45_ = synapse_launchpad_plugin_launchpad_object_new (_data_->_tmp42_, _data_->_tmp43_, _data_->_tmp44_);
#line 311 "launchpad-plugin.vala"
			_data_->_tmp46_ = _data_->_tmp45_;
#line 311 "launchpad-plugin.vala"
			synapse_result_set_add (_data_->_tmp41_, (SynapseMatch*) _data_->_tmp46_, (gint) SYNAPSE_MATCH_SCORE_EXCELLENT);
#line 311 "launchpad-plugin.vala"
			_g_object_unref0 (_data_->_tmp46_);
#line 766 "launchpad-plugin.c"
		}
#line 283 "launchpad-plugin.vala"
		_data_->groups = (_vala_array_free (_data_->groups, _data_->groups_length1, (GDestroyNotify) g_free), NULL);
#line 283 "launchpad-plugin.vala"
		_g_free0 (_data_->branch);
#line 772 "launchpad-plugin.c"
	} else {
#line 315 "launchpad-plugin.vala"
		_data_->_tmp47_ = _data_->self->priv->bug_regex;
#line 315 "launchpad-plugin.vala"
		_data_->_tmp48_ = _data_->stripped;
#line 315 "launchpad-plugin.vala"
		_data_->_tmp49_ = NULL;
#line 315 "launchpad-plugin.vala"
		_data_->_tmp50_ = g_regex_match (_data_->_tmp47_, _data_->_tmp48_, 0, &_data_->_tmp49_);
#line 315 "launchpad-plugin.vala"
		_g_match_info_unref0 (_data_->mi);
#line 315 "launchpad-plugin.vala"
		_data_->mi = _data_->_tmp49_;
#line 315 "launchpad-plugin.vala"
		if (_data_->_tmp50_) {
#line 317 "launchpad-plugin.vala"
			_data_->_tmp51_ = _data_->mi;
#line 317 "launchpad-plugin.vala"
			_data_->_tmp52_ = g_match_info_fetch (_data_->_tmp51_, 1);
#line 317 "launchpad-plugin.vala"
			_data_->bug_num = _data_->_tmp52_;
#line 319 "launchpad-plugin.vala"
			_data_->_tmp53_ = _data_->bug_num;
#line 319 "launchpad-plugin.vala"
			_data_->_tmp54_ = g_strconcat ("https://bugs.launchpad.net/bugs/", _data_->_tmp53_, NULL);
#line 319 "launchpad-plugin.vala"
			_g_free0 (_data_->uri);
#line 319 "launchpad-plugin.vala"
			_data_->uri = _data_->_tmp54_;
#line 320 "launchpad-plugin.vala"
			_data_->_tmp55_ = _data_->bug_num;
#line 320 "launchpad-plugin.vala"
			_data_->_tmp56_ = g_strdup_printf (_ ("Launchpad: Bug #%s"), _data_->_tmp55_);
#line 320 "launchpad-plugin.vala"
			_g_free0 (_data_->title);
#line 320 "launchpad-plugin.vala"
			_data_->title = _data_->_tmp56_;
#line 321 "launchpad-plugin.vala"
			_data_->_tmp57_ = _data_->uri;
#line 321 "launchpad-plugin.vala"
			_data_->_tmp58_ = g_strdup (_data_->_tmp57_);
#line 321 "launchpad-plugin.vala"
			_g_free0 (_data_->description);
#line 321 "launchpad-plugin.vala"
			_data_->description = _data_->_tmp58_;
#line 322 "launchpad-plugin.vala"
			_data_->_tmp59_ = _data_->_result_;
#line 322 "launchpad-plugin.vala"
			_data_->_tmp60_ = _data_->title;
#line 322 "launchpad-plugin.vala"
			_data_->_tmp61_ = _data_->description;
#line 322 "launchpad-plugin.vala"
			_data_->_tmp62_ = _data_->uri;
#line 322 "launchpad-plugin.vala"
			_data_->_tmp63_ = synapse_launchpad_plugin_launchpad_object_new (_data_->_tmp60_, _data_->_tmp61_, _data_->_tmp62_);
#line 322 "launchpad-plugin.vala"
			_data_->_tmp64_ = _data_->_tmp63_;
#line 322 "launchpad-plugin.vala"
			synapse_result_set_add (_data_->_tmp59_, (SynapseMatch*) _data_->_tmp64_, (gint) SYNAPSE_MATCH_SCORE_ABOVE_AVERAGE);
#line 322 "launchpad-plugin.vala"
			_g_object_unref0 (_data_->_tmp64_);
#line 315 "launchpad-plugin.vala"
			_g_free0 (_data_->bug_num);
#line 836 "launchpad-plugin.c"
		}
	}
#line 326 "launchpad-plugin.vala"
	synapse_query_check_cancellable (&_data_->q, &_data_->_inner_error0_);
#line 326 "launchpad-plugin.vala"
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
#line 326 "launchpad-plugin.vala"
		if (_data_->_inner_error0_->domain == SYNAPSE_SEARCH_ERROR) {
#line 326 "launchpad-plugin.vala"
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
#line 326 "launchpad-plugin.vala"
			_g_match_info_unref0 (_data_->mi);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->stripped);
#line 326 "launchpad-plugin.vala"
			_g_object_unref0 (_data_->_result_);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->description);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->title);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->uri);
#line 326 "launchpad-plugin.vala"
			g_object_unref (_data_->_async_result);
#line 326 "launchpad-plugin.vala"
			return FALSE;
#line 863 "launchpad-plugin.c"
		} else {
#line 326 "launchpad-plugin.vala"
			_g_match_info_unref0 (_data_->mi);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->stripped);
#line 326 "launchpad-plugin.vala"
			_g_object_unref0 (_data_->_result_);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->description);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->title);
#line 326 "launchpad-plugin.vala"
			_g_free0 (_data_->uri);
#line 326 "launchpad-plugin.vala"
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
#line 326 "launchpad-plugin.vala"
			g_clear_error (&_data_->_inner_error0_);
#line 326 "launchpad-plugin.vala"
			g_object_unref (_data_->_async_result);
#line 326 "launchpad-plugin.vala"
			return FALSE;
#line 885 "launchpad-plugin.c"
		}
	}
#line 327 "launchpad-plugin.vala"
	_data_->result = _data_->_result_;
#line 327 "launchpad-plugin.vala"
	_g_match_info_unref0 (_data_->mi);
#line 327 "launchpad-plugin.vala"
	_g_free0 (_data_->stripped);
#line 327 "launchpad-plugin.vala"
	_g_free0 (_data_->description);
#line 327 "launchpad-plugin.vala"
	_g_free0 (_data_->title);
#line 327 "launchpad-plugin.vala"
	_g_free0 (_data_->uri);
#line 327 "launchpad-plugin.vala"
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
#line 327 "launchpad-plugin.vala"
	if (_data_->_state_ != 0) {
#line 327 "launchpad-plugin.vala"
		while (!g_task_get_completed (_data_->_async_result)) {
#line 327 "launchpad-plugin.vala"
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
#line 908 "launchpad-plugin.c"
		}
	}
#line 327 "launchpad-plugin.vala"
	g_object_unref (_data_->_async_result);
#line 327 "launchpad-plugin.vala"
	return FALSE;
#line 915 "launchpad-plugin.c"
}

SynapseResultSet*
synapse_launchpad_plugin_find_for_match (SynapseLaunchpadPlugin* self,
                                         SynapseQuery* query,
                                         SynapseMatch* match)
{
	SynapseResultSet* result;
#line 330 "launchpad-plugin.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 330 "launchpad-plugin.vala"
	g_return_val_if_fail (query != NULL, NULL);
#line 330 "launchpad-plugin.vala"
	g_return_val_if_fail (match != NULL, NULL);
#line 332 "launchpad-plugin.vala"
	result = NULL;
#line 332 "launchpad-plugin.vala"
	return result;
#line 934 "launchpad-plugin.c"
}

SynapseLaunchpadPlugin*
synapse_launchpad_plugin_construct (GType object_type)
{
	SynapseLaunchpadPlugin * self = NULL;
#line 24 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) g_object_new (object_type, NULL);
#line 24 "launchpad-plugin.vala"
	return self;
#line 945 "launchpad-plugin.c"
}

SynapseLaunchpadPlugin*
synapse_launchpad_plugin_new (void)
{
#line 24 "launchpad-plugin.vala"
	return synapse_launchpad_plugin_construct (SYNAPSE_TYPE_LAUNCHPAD_PLUGIN);
#line 953 "launchpad-plugin.c"
}

static gboolean
synapse_launchpad_plugin_real_get_enabled (SynapseActivatable* base)
{
	gboolean result;
	SynapseLaunchpadPlugin* self;
#line 26 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) base;
#line 26 "launchpad-plugin.vala"
	result = self->priv->_enabled;
#line 26 "launchpad-plugin.vala"
	return result;
#line 967 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_real_set_enabled (SynapseActivatable* base,
                                           gboolean value)
{
	SynapseLaunchpadPlugin* self;
	gboolean old_value;
#line 26 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPlugin*) base;
#line 26 "launchpad-plugin.vala"
	old_value = synapse_launchpad_plugin_real_get_enabled (base);
#line 26 "launchpad-plugin.vala"
	if (old_value != value) {
#line 26 "launchpad-plugin.vala"
		self->priv->_enabled = value;
#line 26 "launchpad-plugin.vala"
		g_object_notify_by_pspec ((GObject *) self, synapse_launchpad_plugin_properties[SYNAPSE_LAUNCHPAD_PLUGIN_ENABLED_PROPERTY]);
#line 986 "launchpad-plugin.c"
	}
}

static SynapseLaunchpadPluginLaunchpadAuthObject*
synapse_launchpad_plugin_launchpad_auth_object_construct (GType object_type)
{
	SynapseLaunchpadPluginLaunchpadAuthObject * self = NULL;
#line 112 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPluginLaunchpadAuthObject*) g_object_new (object_type, NULL);
#line 112 "launchpad-plugin.vala"
	return self;
#line 998 "launchpad-plugin.c"
}

static SynapseLaunchpadPluginLaunchpadAuthObject*
synapse_launchpad_plugin_launchpad_auth_object_new (void)
{
#line 112 "launchpad-plugin.vala"
	return synapse_launchpad_plugin_launchpad_auth_object_construct (SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_AUTH_OBJECT);
#line 1006 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_launchpad_auth_object_class_init (SynapseLaunchpadPluginLaunchpadAuthObjectClass * klass,
                                                           gpointer klass_data)
{
#line 112 "launchpad-plugin.vala"
	synapse_launchpad_plugin_launchpad_auth_object_parent_class = g_type_class_peek_parent (klass);
#line 1015 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_launchpad_auth_object_instance_init (SynapseLaunchpadPluginLaunchpadAuthObject * self,
                                                              gpointer klass)
{
}

static GType
synapse_launchpad_plugin_launchpad_auth_object_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseLaunchpadPluginLaunchpadAuthObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_launchpad_plugin_launchpad_auth_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseLaunchpadPluginLaunchpadAuthObject), 0, (GInstanceInitFunc) synapse_launchpad_plugin_launchpad_auth_object_instance_init, NULL };
	GType synapse_launchpad_plugin_launchpad_auth_object_type_id;
	synapse_launchpad_plugin_launchpad_auth_object_type_id = g_type_register_static (G_TYPE_OBJECT, "SynapseLaunchpadPluginLaunchpadAuthObject", &g_define_type_info, 0);
	return synapse_launchpad_plugin_launchpad_auth_object_type_id;
}

static GType
synapse_launchpad_plugin_launchpad_auth_object_get_type (void)
{
	static volatile gsize synapse_launchpad_plugin_launchpad_auth_object_type_id__once = 0;
	if (g_once_init_enter (&synapse_launchpad_plugin_launchpad_auth_object_type_id__once)) {
		GType synapse_launchpad_plugin_launchpad_auth_object_type_id;
		synapse_launchpad_plugin_launchpad_auth_object_type_id = synapse_launchpad_plugin_launchpad_auth_object_get_type_once ();
		g_once_init_leave (&synapse_launchpad_plugin_launchpad_auth_object_type_id__once, synapse_launchpad_plugin_launchpad_auth_object_type_id);
	}
	return synapse_launchpad_plugin_launchpad_auth_object_type_id__once;
}

static SynapseLaunchpadPluginLaunchpadObject*
synapse_launchpad_plugin_launchpad_object_construct (GType object_type,
                                                     const gchar* title,
                                                     const gchar* desc,
                                                     const gchar* uri)
{
	SynapseLaunchpadPluginLaunchpadObject * self = NULL;
	GIcon* _tmp0_;
	GIcon* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
#line 226 "launchpad-plugin.vala"
	g_return_val_if_fail (title != NULL, NULL);
#line 226 "launchpad-plugin.vala"
	g_return_val_if_fail (desc != NULL, NULL);
#line 226 "launchpad-plugin.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 228 "launchpad-plugin.vala"
	_tmp0_ = g_content_type_get_icon ("text/html");
#line 228 "launchpad-plugin.vala"
	_tmp1_ = _tmp0_;
#line 228 "launchpad-plugin.vala"
	_tmp2_ = g_icon_to_string (_tmp1_);
#line 228 "launchpad-plugin.vala"
	_tmp3_ = _tmp2_;
#line 228 "launchpad-plugin.vala"
	self = (SynapseLaunchpadPluginLaunchpadObject*) g_object_new (object_type, "title", title, "description", desc, "icon-name", _tmp3_, "uri", uri, "mime-type", "text/html", "file-type", SYNAPSE_QUERY_FLAGS_INTERNET, NULL);
#line 228 "launchpad-plugin.vala"
	_g_free0 (_tmp3_);
#line 228 "launchpad-plugin.vala"
	_g_object_unref0 (_tmp1_);
#line 226 "launchpad-plugin.vala"
	return self;
#line 1078 "launchpad-plugin.c"
}

static SynapseLaunchpadPluginLaunchpadObject*
synapse_launchpad_plugin_launchpad_object_new (const gchar* title,
                                               const gchar* desc,
                                               const gchar* uri)
{
#line 226 "launchpad-plugin.vala"
	return synapse_launchpad_plugin_launchpad_object_construct (SYNAPSE_LAUNCHPAD_PLUGIN_TYPE_LAUNCHPAD_OBJECT, title, desc, uri);
#line 1088 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_launchpad_object_class_init (SynapseLaunchpadPluginLaunchpadObjectClass * klass,
                                                      gpointer klass_data)
{
#line 224 "launchpad-plugin.vala"
	synapse_launchpad_plugin_launchpad_object_parent_class = g_type_class_peek_parent (klass);
#line 1097 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_launchpad_object_instance_init (SynapseLaunchpadPluginLaunchpadObject * self,
                                                         gpointer klass)
{
}

static GType
synapse_launchpad_plugin_launchpad_object_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseLaunchpadPluginLaunchpadObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_launchpad_plugin_launchpad_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseLaunchpadPluginLaunchpadObject), 0, (GInstanceInitFunc) synapse_launchpad_plugin_launchpad_object_instance_init, NULL };
	GType synapse_launchpad_plugin_launchpad_object_type_id;
	synapse_launchpad_plugin_launchpad_object_type_id = g_type_register_static (SYNAPSE_TYPE_URI_MATCH, "SynapseLaunchpadPluginLaunchpadObject", &g_define_type_info, 0);
	return synapse_launchpad_plugin_launchpad_object_type_id;
}

static GType
synapse_launchpad_plugin_launchpad_object_get_type (void)
{
	static volatile gsize synapse_launchpad_plugin_launchpad_object_type_id__once = 0;
	if (g_once_init_enter (&synapse_launchpad_plugin_launchpad_object_type_id__once)) {
		GType synapse_launchpad_plugin_launchpad_object_type_id;
		synapse_launchpad_plugin_launchpad_object_type_id = synapse_launchpad_plugin_launchpad_object_get_type_once ();
		g_once_init_leave (&synapse_launchpad_plugin_launchpad_object_type_id__once, synapse_launchpad_plugin_launchpad_object_type_id);
	}
	return synapse_launchpad_plugin_launchpad_object_type_id__once;
}

static GObject *
synapse_launchpad_plugin_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SynapseLaunchpadPlugin * self;
	GError* _inner_error0_ = NULL;
#line 254 "launchpad-plugin.vala"
	parent_class = G_OBJECT_CLASS (synapse_launchpad_plugin_parent_class);
#line 254 "launchpad-plugin.vala"
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
#line 254 "launchpad-plugin.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_LAUNCHPAD_PLUGIN, SynapseLaunchpadPlugin);
#line 1142 "launchpad-plugin.c"
	{
		GRegex* _tmp0_ = NULL;
		GRegex* _tmp1_;
		GRegex* _tmp2_;
		GRegex* _tmp3_ = NULL;
		GRegex* _tmp4_;
		GRegex* _tmp5_;
#line 258 "launchpad-plugin.vala"
		_tmp1_ = g_regex_new ("(?:bug|lp|#):?\\s*#?\\s*(\\d+)$", G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, &_inner_error0_);
#line 258 "launchpad-plugin.vala"
		_tmp0_ = _tmp1_;
#line 258 "launchpad-plugin.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 258 "launchpad-plugin.vala"
			if (_inner_error0_->domain == G_REGEX_ERROR) {
#line 1158 "launchpad-plugin.c"
				goto __catch0_g_regex_error;
			}
#line 258 "launchpad-plugin.vala"
			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);
#line 258 "launchpad-plugin.vala"
			g_clear_error (&_inner_error0_);
#line 1165 "launchpad-plugin.c"
		}
#line 258 "launchpad-plugin.vala"
		_tmp2_ = _tmp0_;
#line 258 "launchpad-plugin.vala"
		_tmp0_ = NULL;
#line 258 "launchpad-plugin.vala"
		_g_regex_unref0 (self->priv->bug_regex);
#line 258 "launchpad-plugin.vala"
		self->priv->bug_regex = _tmp2_;
#line 259 "launchpad-plugin.vala"
		_tmp4_ = g_regex_new ("lp:(~?[a-z]+[+-/_a-z0-9]*)", G_REGEX_OPTIMIZE, 0, &_inner_error0_);
#line 259 "launchpad-plugin.vala"
		_tmp3_ = _tmp4_;
#line 259 "launchpad-plugin.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 259 "launchpad-plugin.vala"
			_g_regex_unref0 (_tmp0_);
#line 259 "launchpad-plugin.vala"
			if (_inner_error0_->domain == G_REGEX_ERROR) {
#line 1185 "launchpad-plugin.c"
				goto __catch0_g_regex_error;
			}
#line 259 "launchpad-plugin.vala"
			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);
#line 259 "launchpad-plugin.vala"
			g_clear_error (&_inner_error0_);
#line 1192 "launchpad-plugin.c"
		}
#line 259 "launchpad-plugin.vala"
		_tmp5_ = _tmp3_;
#line 259 "launchpad-plugin.vala"
		_tmp3_ = NULL;
#line 259 "launchpad-plugin.vala"
		_g_regex_unref0 (self->priv->branch_regex);
#line 259 "launchpad-plugin.vala"
		self->priv->branch_regex = _tmp5_;
#line 256 "launchpad-plugin.vala"
		_g_regex_unref0 (_tmp3_);
#line 256 "launchpad-plugin.vala"
		_g_regex_unref0 (_tmp0_);
#line 1206 "launchpad-plugin.c"
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		GError* err = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
#line 256 "launchpad-plugin.vala"
		err = _inner_error0_;
#line 256 "launchpad-plugin.vala"
		_inner_error0_ = NULL;
#line 263 "launchpad-plugin.vala"
		_tmp6_ = err;
#line 263 "launchpad-plugin.vala"
		_tmp7_ = _tmp6_->message;
#line 263 "launchpad-plugin.vala"
		g_warning ("launchpad-plugin.vala:263: Unable to construct regex: %s", _tmp7_);
#line 256 "launchpad-plugin.vala"
		_g_error_free0 (err);
#line 1226 "launchpad-plugin.c"
	}
	__finally0:
#line 256 "launchpad-plugin.vala"
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 256 "launchpad-plugin.vala"
		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);
#line 256 "launchpad-plugin.vala"
		g_clear_error (&_inner_error0_);
#line 1235 "launchpad-plugin.c"
	}
#line 254 "launchpad-plugin.vala"
	return obj;
#line 1239 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_class_init (SynapseLaunchpadPluginClass * klass,
                                     gpointer klass_data)
{
#line 24 "launchpad-plugin.vala"
	synapse_launchpad_plugin_parent_class = g_type_class_peek_parent (klass);
#line 24 "launchpad-plugin.vala"
	g_type_class_adjust_private_offset (klass, &SynapseLaunchpadPlugin_private_offset);
#line 24 "launchpad-plugin.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_synapse_launchpad_plugin_get_property;
#line 24 "launchpad-plugin.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_synapse_launchpad_plugin_set_property;
#line 24 "launchpad-plugin.vala"
	G_OBJECT_CLASS (klass)->constructor = synapse_launchpad_plugin_constructor;
#line 24 "launchpad-plugin.vala"
	G_OBJECT_CLASS (klass)->finalize = synapse_launchpad_plugin_finalize;
#line 24 "launchpad-plugin.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_LAUNCHPAD_PLUGIN_ENABLED_PROPERTY, synapse_launchpad_plugin_properties[SYNAPSE_LAUNCHPAD_PLUGIN_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 248 "launchpad-plugin.vala"
	synapse_launchpad_plugin_register_plugin ();
#line 1262 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_synapse_activatable_interface_init (SynapseActivatableIface * iface,
                                                             gpointer iface_data)
{
#line 24 "launchpad-plugin.vala"
	synapse_launchpad_plugin_synapse_activatable_parent_iface = g_type_interface_peek_parent (iface);
#line 24 "launchpad-plugin.vala"
	iface->activate = (void (*) (SynapseActivatable*)) synapse_launchpad_plugin_real_activate;
#line 24 "launchpad-plugin.vala"
	iface->deactivate = (void (*) (SynapseActivatable*)) synapse_launchpad_plugin_real_deactivate;
#line 24 "launchpad-plugin.vala"
	iface->get_enabled = synapse_launchpad_plugin_real_get_enabled;
#line 24 "launchpad-plugin.vala"
	iface->set_enabled = synapse_launchpad_plugin_real_set_enabled;
#line 1279 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_synapse_item_provider_interface_init (SynapseItemProviderIface * iface,
                                                               gpointer iface_data)
{
#line 24 "launchpad-plugin.vala"
	synapse_launchpad_plugin_synapse_item_provider_parent_iface = g_type_interface_peek_parent (iface);
#line 24 "launchpad-plugin.vala"
	iface->handles_query = (gboolean (*) (SynapseItemProvider*, SynapseQuery*)) synapse_launchpad_plugin_real_handles_query;
#line 24 "launchpad-plugin.vala"
	iface->search = (void (*) (SynapseItemProvider*, SynapseQuery*, GAsyncReadyCallback, gpointer)) synapse_launchpad_plugin_real_search;
#line 24 "launchpad-plugin.vala"
	iface->search_finish = (SynapseResultSet* (*) (SynapseItemProvider*, GAsyncResult*, GError**)) synapse_launchpad_plugin_search_finish;
#line 1294 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_instance_init (SynapseLaunchpadPlugin * self,
                                        gpointer klass)
{
#line 24 "launchpad-plugin.vala"
	self->priv = synapse_launchpad_plugin_get_instance_private (self);
#line 26 "launchpad-plugin.vala"
	self->priv->_enabled = TRUE;
#line 1305 "launchpad-plugin.c"
}

static void
synapse_launchpad_plugin_finalize (GObject * obj)
{
	SynapseLaunchpadPlugin * self;
#line 24 "launchpad-plugin.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_LAUNCHPAD_PLUGIN, SynapseLaunchpadPlugin);
#line 28 "launchpad-plugin.vala"
	_g_object_unref0 (self->priv->auth_object);
#line 251 "launchpad-plugin.vala"
	_g_regex_unref0 (self->priv->bug_regex);
#line 252 "launchpad-plugin.vala"
	_g_regex_unref0 (self->priv->branch_regex);
#line 24 "launchpad-plugin.vala"
	G_OBJECT_CLASS (synapse_launchpad_plugin_parent_class)->finalize (obj);
#line 1322 "launchpad-plugin.c"
}

static GType
synapse_launchpad_plugin_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseLaunchpadPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_launchpad_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseLaunchpadPlugin), 0, (GInstanceInitFunc) synapse_launchpad_plugin_instance_init, NULL };
	static const GInterfaceInfo synapse_activatable_info = { (GInterfaceInitFunc) synapse_launchpad_plugin_synapse_activatable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo synapse_item_provider_info = { (GInterfaceInitFunc) synapse_launchpad_plugin_synapse_item_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType synapse_launchpad_plugin_type_id;
	synapse_launchpad_plugin_type_id = g_type_register_static (G_TYPE_OBJECT, "SynapseLaunchpadPlugin", &g_define_type_info, 0);
	g_type_add_interface_static (synapse_launchpad_plugin_type_id, SYNAPSE_TYPE_ACTIVATABLE, &synapse_activatable_info);
	g_type_add_interface_static (synapse_launchpad_plugin_type_id, SYNAPSE_TYPE_ITEM_PROVIDER, &synapse_item_provider_info);
	SynapseLaunchpadPlugin_private_offset = g_type_add_instance_private (synapse_launchpad_plugin_type_id, sizeof (SynapseLaunchpadPluginPrivate));
	return synapse_launchpad_plugin_type_id;
}

GType
synapse_launchpad_plugin_get_type (void)
{
	static volatile gsize synapse_launchpad_plugin_type_id__once = 0;
	if (g_once_init_enter (&synapse_launchpad_plugin_type_id__once)) {
		GType synapse_launchpad_plugin_type_id;
		synapse_launchpad_plugin_type_id = synapse_launchpad_plugin_get_type_once ();
		g_once_init_leave (&synapse_launchpad_plugin_type_id__once, synapse_launchpad_plugin_type_id);
	}
	return synapse_launchpad_plugin_type_id__once;
}

static void
_vala_synapse_launchpad_plugin_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	SynapseLaunchpadPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_LAUNCHPAD_PLUGIN, SynapseLaunchpadPlugin);
#line 24 "launchpad-plugin.vala"
	switch (property_id) {
#line 24 "launchpad-plugin.vala"
		case SYNAPSE_LAUNCHPAD_PLUGIN_ENABLED_PROPERTY:
#line 24 "launchpad-plugin.vala"
		g_value_set_boolean (value, synapse_activatable_get_enabled ((SynapseActivatable*) self));
#line 24 "launchpad-plugin.vala"
		break;
#line 1367 "launchpad-plugin.c"
		default:
#line 24 "launchpad-plugin.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 24 "launchpad-plugin.vala"
		break;
#line 1373 "launchpad-plugin.c"
	}
}

static void
_vala_synapse_launchpad_plugin_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	SynapseLaunchpadPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_LAUNCHPAD_PLUGIN, SynapseLaunchpadPlugin);
#line 24 "launchpad-plugin.vala"
	switch (property_id) {
#line 24 "launchpad-plugin.vala"
		case SYNAPSE_LAUNCHPAD_PLUGIN_ENABLED_PROPERTY:
#line 24 "launchpad-plugin.vala"
		synapse_activatable_set_enabled ((SynapseActivatable*) self, g_value_get_boolean (value));
#line 24 "launchpad-plugin.vala"
		break;
#line 1393 "launchpad-plugin.c"
		default:
#line 24 "launchpad-plugin.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 24 "launchpad-plugin.vala"
		break;
#line 1399 "launchpad-plugin.c"
	}
}

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;
}

