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

#include <gio/gio.h>
#include <glib.h>
#include "budgie-recentlyused.h"
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <plugin.h>
#include <gee.h>
#include <config.h>
#include <locale.h>
#include <libpeas.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	RECENTLY_USED_APPLET_RECENTLY_USED_SETTINGS_0_PROPERTY,
	RECENTLY_USED_APPLET_RECENTLY_USED_SETTINGS_NUM_PROPERTIES
};
static GParamSpec* recently_used_applet_recently_used_settings_properties[RECENTLY_USED_APPLET_RECENTLY_USED_SETTINGS_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
enum  {
	RECENTLY_USED_APPLET_PLUGIN_0_PROPERTY,
	RECENTLY_USED_APPLET_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* recently_used_applet_plugin_properties[RECENTLY_USED_APPLET_PLUGIN_NUM_PROPERTIES];
enum  {
	RECENTLY_USED_APPLET_APPLET_0_PROPERTY,
	RECENTLY_USED_APPLET_APPLET_UUID_PROPERTY,
	RECENTLY_USED_APPLET_APPLET_NUM_PROPERTIES
};
static GParamSpec* recently_used_applet_applet_properties[RECENTLY_USED_APPLET_APPLET_NUM_PROPERTIES];
typedef struct _Block1Data Block1Data;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

struct _RecentlyUsedAppletAppletPrivate {
	GFile* infofile;
	GtkMenu* recent;
	GFileMonitor* monitor;
	GtkMenuButton* button;
	GtkEventBox* indicatorBox;
	gchar* _uuid;
};

struct _Block1Data {
	int _ref_count_;
	RecentlyUsedAppletApplet* self;
	gchar* command;
};

VALA_EXTERN GSettings* recently_used_applet_rused_settings;
GSettings* recently_used_applet_rused_settings = NULL;
VALA_EXTERN gint recently_used_applet_n_show;
gint recently_used_applet_n_show = 0;
VALA_EXTERN gboolean recently_used_applet_showtooltips;
gboolean recently_used_applet_showtooltips = FALSE;
VALA_EXTERN gboolean recently_used_applet_hidepath;
gboolean recently_used_applet_hidepath = FALSE;
static gpointer recently_used_applet_recently_used_settings_parent_class = NULL;
static GType recently_used_applet_recently_used_settings_type_id = 0;
static gpointer recently_used_applet_plugin_parent_class = NULL;
static BudgiePluginIface * recently_used_applet_plugin_budgie_plugin_parent_iface = NULL;
static GType recently_used_applet_plugin_type_id = 0;
static gint RecentlyUsedAppletApplet_private_offset;
static gpointer recently_used_applet_applet_parent_class = NULL;
static GType recently_used_applet_applet_type_id = 0;

static void recently_used_applet_recently_used_settings_update_n_show (RecentlyUsedAppletRecentlyUsedSettings* self,
                                                                GtkSpinButton* btn);
static void _recently_used_applet_recently_used_settings_update_n_show_gtk_spin_button_value_changed (GtkSpinButton* _sender,
                                                                                               gpointer self);
static void recently_used_applet_recently_used_settings_update_settootips (RecentlyUsedAppletRecentlyUsedSettings* self,
                                                                    GtkToggleButton* btn);
static void _recently_used_applet_recently_used_settings_update_settootips_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                               gpointer self);
static void recently_used_applet_recently_used_settings_update_hidepath (RecentlyUsedAppletRecentlyUsedSettings* self,
                                                                  GtkToggleButton* btn);
static void _recently_used_applet_recently_used_settings_update_hidepath_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                             gpointer self);
static GVariant* _variant_new1 (gint value);
static BudgieApplet* recently_used_applet_plugin_real_get_panel_widget (BudgiePlugin* base,
                                                                 const gchar* uuid);
static gboolean recently_used_applet_applet_real_supports_settings (BudgieApplet* base);
static GtkWidget* recently_used_applet_applet_real_get_settings_ui (BudgieApplet* base);
static void recently_used_applet_applet_update_menu (RecentlyUsedAppletApplet* self);
static void _recently_used_applet_applet_update_menu_g_settings_changed (GSettings* _sender,
                                                                  const gchar* key,
                                                                  gpointer self);
static void _recently_used_applet_applet_update_menu_g_file_monitor_changed (GFileMonitor* _sender,
                                                                      GFile* file,
                                                                      GFile* other_file,
                                                                      GFileMonitorEvent event_type,
                                                                      gpointer self);
static GtkMenu* recently_used_applet_applet_create_menu (RecentlyUsedAppletApplet* self,
                                                  GDataInputStream* xbelcontent);
static gchar* recently_used_applet_applet_replace (RecentlyUsedAppletApplet* self,
                                            const gchar* toreplace);
static gint __lambda4_ (RecentlyUsedAppletApplet* self,
                 const gchar* a,
                 const gchar* b);
static gint ___lambda4__gcompare_data_func (gconstpointer a,
                                     gconstpointer b,
                                     gpointer self);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void _vala_array_add1 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gchar* recently_used_applet_applet_getmenuname (RecentlyUsedAppletApplet* self,
                                                const gchar* longname);
static void ____lambda5_ (Block1Data* _data1_);
static void _____lambda5__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void recently_used_applet_applet_finalize (GObject * obj);
static void _vala_recently_used_applet_applet_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_recently_used_applet_applet_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 void
_recently_used_applet_recently_used_settings_update_n_show_gtk_spin_button_value_changed (GtkSpinButton* _sender,
                                                                                          gpointer self)
{
	recently_used_applet_recently_used_settings_update_n_show ((RecentlyUsedAppletRecentlyUsedSettings*) self, _sender);
}

static void
_recently_used_applet_recently_used_settings_update_settootips_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                          gpointer self)
{
	recently_used_applet_recently_used_settings_update_settootips ((RecentlyUsedAppletRecentlyUsedSettings*) self, _sender);
}

static void
_recently_used_applet_recently_used_settings_update_hidepath_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                        gpointer self)
{
	recently_used_applet_recently_used_settings_update_hidepath ((RecentlyUsedAppletRecentlyUsedSettings*) self, _sender);
}

RecentlyUsedAppletRecentlyUsedSettings*
recently_used_applet_recently_used_settings_construct (GType object_type,
                                                       GSettings* settings)
{
	RecentlyUsedAppletRecentlyUsedSettings * self = NULL;
	GtkLabel* spbuttonlabel = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkSpinButton* show_n = NULL;
	GtkSpinButton* _tmp6_;
	GtkLabel* distlabel = NULL;
	GtkLabel* _tmp7_;
	GtkCheckButton* set_tooltips = NULL;
	GtkCheckButton* _tmp8_;
	GtkLabel* distlabel2 = NULL;
	GtkLabel* _tmp9_;
	GtkCheckButton* set_hidepath = NULL;
	GtkCheckButton* _tmp10_;
	self = (RecentlyUsedAppletRecentlyUsedSettings*) g_object_new (object_type, NULL);
	_tmp0_ = g_strconcat ("\n", _ ("Show last used"), NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, ":\n", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	spbuttonlabel = _tmp5_;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) spbuttonlabel, 0, 0, 2, 1);
	gtk_label_set_xalign (spbuttonlabel, (gfloat) 0);
	_tmp6_ = (GtkSpinButton*) gtk_spin_button_new_with_range ((gdouble) 5, (gdouble) 30, (gdouble) 5);
	g_object_ref_sink (_tmp6_);
	show_n = _tmp6_;
	gtk_spin_button_set_value (show_n, (gdouble) recently_used_applet_n_show);
	g_signal_connect_object (show_n, "value-changed", (GCallback) _recently_used_applet_recently_used_settings_update_n_show_gtk_spin_button_value_changed, self, 0);
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) show_n, 0, 1, 1, 1);
	_tmp7_ = (GtkLabel*) gtk_label_new ("\n");
	g_object_ref_sink (_tmp7_);
	distlabel = _tmp7_;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) distlabel, 0, 2, 2, 1);
	_tmp8_ = (GtkCheckButton*) gtk_check_button_new_with_label (_ ("Show tooltips"));
	g_object_ref_sink (_tmp8_);
	set_tooltips = _tmp8_;
	gtk_toggle_button_set_active ((GtkToggleButton*) set_tooltips, recently_used_applet_showtooltips);
	g_signal_connect_object ((GtkToggleButton*) set_tooltips, "toggled", (GCallback) _recently_used_applet_recently_used_settings_update_settootips_gtk_toggle_button_toggled, self, 0);
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) set_tooltips, 0, 3, 2, 1);
	_tmp9_ = (GtkLabel*) gtk_label_new ("\n");
	g_object_ref_sink (_tmp9_);
	distlabel2 = _tmp9_;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) distlabel2, 0, 4, 2, 1);
	_tmp10_ = (GtkCheckButton*) gtk_check_button_new_with_label (_ ("Hide path in menu"));
	g_object_ref_sink (_tmp10_);
	set_hidepath = _tmp10_;
	gtk_toggle_button_set_active ((GtkToggleButton*) set_hidepath, recently_used_applet_hidepath);
	g_signal_connect_object ((GtkToggleButton*) set_hidepath, "toggled", (GCallback) _recently_used_applet_recently_used_settings_update_hidepath_gtk_toggle_button_toggled, self, 0);
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) set_hidepath, 0, 5, 2, 1);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (set_hidepath);
	_g_object_unref0 (distlabel2);
	_g_object_unref0 (set_tooltips);
	_g_object_unref0 (distlabel);
	_g_object_unref0 (show_n);
	_g_object_unref0 (spbuttonlabel);
	return self;
}

RecentlyUsedAppletRecentlyUsedSettings*
recently_used_applet_recently_used_settings_new (GSettings* settings)
{
	return recently_used_applet_recently_used_settings_construct (RECENTLY_USED_APPLET_TYPE_RECENTLY_USED_SETTINGS, settings);
}

static void
recently_used_applet_recently_used_settings_update_settootips (RecentlyUsedAppletRecentlyUsedSettings* self,
                                                               GtkToggleButton* btn)
{
	gboolean newval = FALSE;
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (btn != NULL);
	newval = gtk_toggle_button_get_active (btn);
	_tmp0_ = recently_used_applet_rused_settings;
	g_settings_set_boolean (_tmp0_, "showtooltips", newval);
}

static void
recently_used_applet_recently_used_settings_update_hidepath (RecentlyUsedAppletRecentlyUsedSettings* self,
                                                             GtkToggleButton* btn)
{
	gboolean newval = FALSE;
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (btn != NULL);
	newval = gtk_toggle_button_get_active (btn);
	_tmp0_ = recently_used_applet_rused_settings;
	g_settings_set_boolean (_tmp0_, "hidepath", newval);
}

static GVariant*
_variant_new1 (gint value)
{
	return g_variant_ref_sink (g_variant_new_int32 (value));
}

static void
recently_used_applet_recently_used_settings_update_n_show (RecentlyUsedAppletRecentlyUsedSettings* self,
                                                           GtkSpinButton* btn)
{
	gint newval = 0;
	GSettings* _tmp0_;
	GVariant* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (btn != NULL);
	newval = (gint) gtk_spin_button_get_value (btn);
	_tmp0_ = recently_used_applet_rused_settings;
	_tmp1_ = _variant_new1 (newval);
	g_settings_set_value (_tmp0_, "nitems", _tmp1_);
	_g_variant_unref0 (_tmp1_);
}

static void
recently_used_applet_recently_used_settings_class_init (RecentlyUsedAppletRecentlyUsedSettingsClass * klass,
                                                        gpointer klass_data)
{
	recently_used_applet_recently_used_settings_parent_class = g_type_class_peek_parent (klass);
}

static void
recently_used_applet_recently_used_settings_instance_init (RecentlyUsedAppletRecentlyUsedSettings * self,
                                                           gpointer klass)
{
}

GType
recently_used_applet_recently_used_settings_get_type (void)
{
	return recently_used_applet_recently_used_settings_type_id;
}

GType
recently_used_applet_recently_used_settings_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (RecentlyUsedAppletRecentlyUsedSettingsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) recently_used_applet_recently_used_settings_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RecentlyUsedAppletRecentlyUsedSettings), 0, (GInstanceInitFunc) recently_used_applet_recently_used_settings_instance_init, NULL };
	recently_used_applet_recently_used_settings_type_id = g_type_module_register_type (module, gtk_grid_get_type (), "RecentlyUsedAppletRecentlyUsedSettings", &g_define_type_info, 0);
	return recently_used_applet_recently_used_settings_type_id;
}

static BudgieApplet*
recently_used_applet_plugin_real_get_panel_widget (BudgiePlugin* base,
                                                   const gchar* uuid)
{
	RecentlyUsedAppletPlugin * self;
	RecentlyUsedAppletApplet* _tmp0_;
	BudgieApplet* result;
	self = (RecentlyUsedAppletPlugin*) base;
	g_return_val_if_fail (uuid != NULL, NULL);
	_tmp0_ = recently_used_applet_applet_new ();
	g_object_ref_sink (_tmp0_);
	result = (BudgieApplet*) _tmp0_;
	return result;
}

RecentlyUsedAppletPlugin*
recently_used_applet_plugin_construct (GType object_type)
{
	RecentlyUsedAppletPlugin * self = NULL;
	self = (RecentlyUsedAppletPlugin*) g_object_new (object_type, NULL);
	return self;
}

RecentlyUsedAppletPlugin*
recently_used_applet_plugin_new (void)
{
	return recently_used_applet_plugin_construct (RECENTLY_USED_APPLET_TYPE_PLUGIN);
}

static void
recently_used_applet_plugin_class_init (RecentlyUsedAppletPluginClass * klass,
                                        gpointer klass_data)
{
	recently_used_applet_plugin_parent_class = g_type_class_peek_parent (klass);
}

static void
recently_used_applet_plugin_budgie_plugin_interface_init (BudgiePluginIface * iface,
                                                          gpointer iface_data)
{
	recently_used_applet_plugin_budgie_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_panel_widget = (BudgieApplet* (*) (BudgiePlugin*, const gchar*)) recently_used_applet_plugin_real_get_panel_widget;
}

static void
recently_used_applet_plugin_instance_init (RecentlyUsedAppletPlugin * self,
                                           gpointer klass)
{
}

GType
recently_used_applet_plugin_get_type (void)
{
	return recently_used_applet_plugin_type_id;
}

GType
recently_used_applet_plugin_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (RecentlyUsedAppletPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) recently_used_applet_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RecentlyUsedAppletPlugin), 0, (GInstanceInitFunc) recently_used_applet_plugin_instance_init, NULL };
	static const GInterfaceInfo budgie_plugin_info = { (GInterfaceInitFunc) recently_used_applet_plugin_budgie_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	recently_used_applet_plugin_type_id = g_type_module_register_type (module, peas_extension_base_get_type (), "RecentlyUsedAppletPlugin", &g_define_type_info, 0);
	g_type_module_add_interface (module, recently_used_applet_plugin_type_id, budgie_plugin_get_type (), &budgie_plugin_info);
	return recently_used_applet_plugin_type_id;
}

static inline gpointer
recently_used_applet_applet_get_instance_private (RecentlyUsedAppletApplet* self)
{
	return G_STRUCT_MEMBER_P (self, RecentlyUsedAppletApplet_private_offset);
}

static gboolean
recently_used_applet_applet_real_supports_settings (BudgieApplet* base)
{
	RecentlyUsedAppletApplet * self;
	gboolean result;
	self = (RecentlyUsedAppletApplet*) base;
	result = TRUE;
	return result;
}

static GtkWidget*
recently_used_applet_applet_real_get_settings_ui (BudgieApplet* base)
{
	RecentlyUsedAppletApplet * self;
	const gchar* _tmp0_;
	GSettings* _tmp1_;
	GSettings* _tmp2_;
	RecentlyUsedAppletRecentlyUsedSettings* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* result;
	self = (RecentlyUsedAppletApplet*) base;
	_tmp0_ = self->priv->_uuid;
	_tmp1_ = budgie_applet_get_applet_settings ((BudgieApplet*) self, _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = recently_used_applet_recently_used_settings_new (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = (GtkWidget*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static void
_recently_used_applet_applet_update_menu_g_settings_changed (GSettings* _sender,
                                                             const gchar* key,
                                                             gpointer self)
{
	recently_used_applet_applet_update_menu ((RecentlyUsedAppletApplet*) self);
}

static void
_recently_used_applet_applet_update_menu_g_file_monitor_changed (GFileMonitor* _sender,
                                                                 GFile* file,
                                                                 GFile* other_file,
                                                                 GFileMonitorEvent event_type,
                                                                 gpointer self)
{
	recently_used_applet_applet_update_menu ((RecentlyUsedAppletApplet*) self);
}

RecentlyUsedAppletApplet*
recently_used_applet_applet_construct (GType object_type)
{
	RecentlyUsedAppletApplet * self = NULL;
	gchar* home = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* infosrc = NULL;
	gchar* _tmp2_;
	GFile* _tmp3_;
	GSettings* _tmp4_;
	GSettings* _tmp5_;
	GtkMenuButton* _tmp11_;
	GtkMenuButton* _tmp12_;
	GtkImage* indicatorIcon = NULL;
	GtkImage* _tmp13_;
	GtkMenuButton* _tmp14_;
	GtkEventBox* _tmp15_;
	GtkEventBox* _tmp16_;
	GtkEventBox* _tmp17_;
	GtkMenuButton* _tmp18_;
	GError* _inner_error0_ = NULL;
	self = (RecentlyUsedAppletApplet*) g_object_new (object_type, NULL);
	_tmp0_ = g_get_home_dir ();
	_tmp1_ = g_strdup (_tmp0_);
	home = _tmp1_;
	_tmp2_ = g_strconcat (home, "/.local/share/recently-used.xbel", NULL);
	infosrc = _tmp2_;
	_tmp3_ = g_file_new_for_path (infosrc);
	_g_object_unref0 (self->priv->infofile);
	self->priv->infofile = _tmp3_;
	_tmp4_ = g_settings_new ("org.ubuntubudgie.plugins.budgie-recentlyused");
	_g_object_unref0 (recently_used_applet_rused_settings);
	recently_used_applet_rused_settings = _tmp4_;
	_tmp5_ = recently_used_applet_rused_settings;
	g_signal_connect_object (_tmp5_, "changed", (GCallback) _recently_used_applet_applet_update_menu_g_settings_changed, self, 0);
	{
		GFileMonitor* _tmp6_ = NULL;
		GFile* _tmp7_;
		GFileMonitor* _tmp8_;
		GFileMonitor* _tmp9_;
		GFileMonitor* _tmp10_;
		_tmp7_ = self->priv->infofile;
		_tmp8_ = g_file_monitor (_tmp7_, G_FILE_MONITOR_NONE, NULL, &_inner_error0_);
		_tmp6_ = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp9_ = _tmp6_;
		_tmp6_ = NULL;
		_g_object_unref0 (self->priv->monitor);
		self->priv->monitor = _tmp9_;
		_tmp10_ = self->priv->monitor;
		g_signal_connect_object (_tmp10_, "changed", (GCallback) _recently_used_applet_applet_update_menu_g_file_monitor_changed, self, 0);
		_g_object_unref0 (_tmp6_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_print ("Unable to set up file monitor\n");
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (infosrc);
		_g_free0 (home);
		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 NULL;
	}
	_tmp11_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp11_;
	_tmp12_ = self->priv->button;
	gtk_button_set_relief ((GtkButton*) _tmp12_, GTK_RELIEF_NONE);
	_tmp13_ = (GtkImage*) gtk_image_new_from_icon_name ("document-open-recent-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp13_);
	indicatorIcon = _tmp13_;
	_tmp14_ = self->priv->button;
	gtk_button_set_image ((GtkButton*) _tmp14_, (GtkWidget*) indicatorIcon);
	recently_used_applet_applet_update_menu (self);
	recently_used_applet_applet_initialiseLocaleLanguageSupport (self);
	_tmp15_ = (GtkEventBox*) gtk_event_box_new ();
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->indicatorBox);
	self->priv->indicatorBox = _tmp15_;
	_tmp16_ = self->priv->indicatorBox;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp16_);
	_tmp17_ = self->priv->indicatorBox;
	_tmp18_ = self->priv->button;
	gtk_container_add ((GtkContainer*) _tmp17_, (GtkWidget*) _tmp18_);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (indicatorIcon);
	_g_free0 (infosrc);
	_g_free0 (home);
	return self;
}

RecentlyUsedAppletApplet*
recently_used_applet_applet_new (void)
{
	return recently_used_applet_applet_construct (RECENTLY_USED_APPLET_TYPE_APPLET);
}

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

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static gint
__lambda4_ (RecentlyUsedAppletApplet* self,
            const gchar* a,
            const gchar* b)
{
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	result = -g_utf8_collate (a, b);
	return result;
}

static gint
___lambda4__gcompare_data_func (gconstpointer a,
                                gconstpointer b,
                                gpointer self)
{
	gint result;
	result = __lambda4_ ((RecentlyUsedAppletApplet*) self, (const gchar*) a, (const gchar*) b);
	return result;
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
_vala_array_add1 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		RecentlyUsedAppletApplet* self;
		self = _data1_->self;
		_g_free0 (_data1_->command);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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 NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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 NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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 NULL;
}

static void
____lambda5_ (Block1Data* _data1_)
{
	RecentlyUsedAppletApplet* self;
	GError* _inner_error0_ = NULL;
	self = _data1_->self;
	{
		const gchar* _tmp0_;
		_tmp0_ = _data1_->command;
		g_spawn_command_line_async (_tmp0_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_SPAWN_ERROR) {
				goto __catch0_g_spawn_error;
			}
			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;
		}
	}
	goto __finally0;
	__catch0_g_spawn_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
_____lambda5__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	____lambda5_ (self);
}

static GtkMenu*
recently_used_applet_applet_create_menu (RecentlyUsedAppletApplet* self,
                                         GDataInputStream* xbelcontent)
{
	gchar* line = NULL;
	GeeArrayList* sortlist = NULL;
	GeeArrayList* _tmp0_;
	GeeHashMap* sortdict = NULL;
	GeeHashMap* _tmp1_;
	GeeArrayList* _tmp24_;
	gint n = 0;
	gchar** menu_source = NULL;
	gchar** _tmp25_;
	gint menu_source_length1;
	gint _menu_source_size_;
	GtkMenu* newmenu = NULL;
	GtkMenu* _tmp44_;
	gchar** _tmp45_;
	gint _tmp45__length1;
	GError* _inner_error0_ = NULL;
	GtkMenu* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (xbelcontent != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	sortlist = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	sortdict = _tmp1_;
	{
		while (TRUE) {
			gchar* _tmp2_ = NULL;
			gchar* _tmp3_;
			gchar* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			_tmp3_ = g_data_input_stream_read_line (xbelcontent, NULL, NULL, &_inner_error0_);
			_tmp2_ = _tmp3_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == G_IO_ERROR) {
					goto __catch0_g_io_error;
				}
				_g_object_unref0 (sortdict);
				_g_object_unref0 (sortlist);
				_g_free0 (line);
				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 NULL;
			}
			_tmp4_ = _tmp2_;
			_tmp2_ = NULL;
			_g_free0 (line);
			line = _tmp4_;
			_tmp5_ = line;
			if (!(_tmp5_ != NULL)) {
				_g_free0 (_tmp2_);
				break;
			}
			_tmp6_ = line;
			if (string_contains (_tmp6_, "<bookmark href=\"file://")) {
				gchar** subject = NULL;
				const gchar* _tmp7_;
				gchar** _tmp8_;
				gchar** _tmp9_;
				gint subject_length1;
				gint _subject_size_;
				gchar* timestamp = NULL;
				gchar** _tmp10_;
				gint _tmp10__length1;
				const gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* path = NULL;
				gchar** _tmp13_;
				gint _tmp13__length1;
				const gchar* _tmp14_;
				gchar* _tmp15_;
				gint len = 0;
				const gchar* _tmp16_;
				GeeHashMap* _tmp17_;
				const gchar* _tmp18_;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				GeeArrayList* _tmp22_;
				const gchar* _tmp23_;
				_tmp7_ = line;
				_tmp9_ = _tmp8_ = g_strsplit (_tmp7_, "=\"", 0);
				subject = _tmp9_;
				subject_length1 = _vala_array_length (_tmp8_);
				_subject_size_ = subject_length1;
				_tmp10_ = subject;
				_tmp10__length1 = subject_length1;
				_tmp11_ = _tmp10_[3];
				_tmp12_ = g_strdup (_tmp11_);
				timestamp = _tmp12_;
				_tmp13_ = subject;
				_tmp13__length1 = subject_length1;
				_tmp14_ = _tmp13_[1];
				_tmp15_ = recently_used_applet_applet_replace (self, _tmp14_);
				path = _tmp15_;
				_tmp16_ = path;
				len = g_utf8_strlen (_tmp16_, (gssize) -1);
				_tmp17_ = sortdict;
				_tmp18_ = timestamp;
				_tmp19_ = path;
				_tmp20_ = string_slice (_tmp19_, (glong) 0, (glong) (len - 7));
				_tmp21_ = _tmp20_;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp17_, _tmp18_, _tmp21_);
				_g_free0 (_tmp21_);
				_tmp22_ = sortlist;
				_tmp23_ = timestamp;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
				_g_free0 (path);
				_g_free0 (timestamp);
				subject = (_vala_array_free (subject, subject_length1, (GDestroyNotify) g_free), NULL);
			}
			_g_free0 (_tmp2_);
		}
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		g_clear_error (&_inner_error0_);
		g_print ("Read error\n");
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (sortdict);
		_g_object_unref0 (sortlist);
		_g_free0 (line);
		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 NULL;
	}
	_tmp24_ = sortlist;
	gee_list_sort ((GeeList*) _tmp24_, ___lambda4__gcompare_data_func, g_object_ref (self), g_object_unref);
	n = 0;
	_tmp25_ = g_new0 (gchar*, 0 + 1);
	menu_source = _tmp25_;
	menu_source_length1 = 0;
	_menu_source_size_ = menu_source_length1;
	{
		GeeArrayList* _s_list = NULL;
		GeeArrayList* _tmp26_;
		gint _s_size = 0;
		GeeArrayList* _tmp27_;
		gint _tmp28_;
		gint _tmp29_;
		gint _s_index = 0;
		_tmp26_ = sortlist;
		_s_list = _tmp26_;
		_tmp27_ = _s_list;
		_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp27_);
		_tmp29_ = _tmp28_;
		_s_size = _tmp29_;
		_s_index = -1;
		while (TRUE) {
			gint _tmp30_;
			gint _tmp31_;
			gchar* s = NULL;
			GeeArrayList* _tmp32_;
			gpointer _tmp33_;
			gchar* menuitem = NULL;
			GeeHashMap* _tmp34_;
			const gchar* _tmp35_;
			gpointer _tmp36_;
			GFile* checkexists = NULL;
			const gchar* _tmp37_;
			GFile* _tmp38_;
			const gchar* _tmp39_;
			gchar** _tmp40_;
			gint _tmp40__length1;
			_s_index = _s_index + 1;
			_tmp30_ = _s_index;
			_tmp31_ = _s_size;
			if (!(_tmp30_ < _tmp31_)) {
				break;
			}
			_tmp32_ = _s_list;
			_tmp33_ = gee_abstract_list_get ((GeeAbstractList*) _tmp32_, _s_index);
			s = (gchar*) _tmp33_;
			_tmp34_ = sortdict;
			_tmp35_ = s;
			_tmp36_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp34_, _tmp35_);
			menuitem = (gchar*) _tmp36_;
			_tmp37_ = menuitem;
			_tmp38_ = g_file_new_for_path (_tmp37_);
			checkexists = _tmp38_;
			_tmp39_ = menuitem;
			_tmp40_ = menu_source;
			_tmp40__length1 = menu_source_length1;
			if (_vala_string_array_contains (_tmp40_, _tmp40__length1, _tmp39_)) {
			} else {
				GFile* _tmp41_;
				_tmp41_ = checkexists;
				if (g_file_query_exists (_tmp41_, NULL) == TRUE) {
					const gchar* _tmp42_;
					gchar* _tmp43_;
					_tmp42_ = menuitem;
					_tmp43_ = g_strdup (_tmp42_);
					_vala_array_add1 (&menu_source, &menu_source_length1, &_menu_source_size_, _tmp43_);
					n += 1;
				}
			}
			if (n == recently_used_applet_n_show) {
				_g_object_unref0 (checkexists);
				_g_free0 (menuitem);
				_g_free0 (s);
				break;
			}
			_g_object_unref0 (checkexists);
			_g_free0 (menuitem);
			_g_free0 (s);
		}
	}
	_tmp44_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp44_);
	newmenu = _tmp44_;
	_tmp45_ = menu_source;
	_tmp45__length1 = menu_source_length1;
	{
		gchar** longname_collection = NULL;
		gint longname_collection_length1 = 0;
		gint _longname_collection_size_ = 0;
		gint longname_it = 0;
		longname_collection = _tmp45_;
		longname_collection_length1 = _tmp45__length1;
		for (longname_it = 0; longname_it < longname_collection_length1; longname_it = longname_it + 1) {
			gchar* _tmp46_;
			gchar* longname = NULL;
			_tmp46_ = g_strdup (longname_collection[longname_it]);
			longname = _tmp46_;
			{
				Block1Data* _data1_;
				gchar* menuname = NULL;
				const gchar* _tmp47_;
				gchar* _tmp48_;
				GtkMenuItem* newitem = NULL;
				const gchar* _tmp49_;
				GtkMenuItem* _tmp50_;
				const gchar* _tmp51_;
				gchar* _tmp52_;
				gchar* _tmp53_;
				gchar* _tmp54_;
				gchar* _tmp55_;
				gchar* _tmp56_;
				gchar* _tmp57_;
				gchar* tooltip = NULL;
				gchar* _tmp58_;
				gchar* _tmp59_;
				const gchar* _tmp60_;
				gchar* _tmp61_;
				gchar* _tmp62_;
				GtkMenu* _tmp65_;
				GtkMenuItem* _tmp66_;
				GtkMenuItem* _tmp67_;
				_data1_ = g_slice_new0 (Block1Data);
				_data1_->_ref_count_ = 1;
				_data1_->self = g_object_ref (self);
				_tmp47_ = longname;
				_tmp48_ = recently_used_applet_applet_getmenuname (self, _tmp47_);
				menuname = _tmp48_;
				_tmp49_ = menuname;
				_tmp50_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_tmp49_);
				g_object_ref_sink (_tmp50_);
				newitem = _tmp50_;
				_tmp51_ = longname;
				_tmp52_ = string_replace (_tmp51_, "'", "'\\''");
				_tmp53_ = _tmp52_;
				_tmp54_ = g_strconcat (PACKAGE_BINDIR "/xdg-open " "'", _tmp53_, NULL);
				_tmp55_ = _tmp54_;
				_tmp56_ = g_strconcat (_tmp55_, "'", NULL);
				_tmp57_ = _tmp56_;
				_g_free0 (_tmp55_);
				_g_free0 (_tmp53_);
				_data1_->command = _tmp57_;
				_tmp58_ = g_strconcat (_ ("Open"), ": ", NULL);
				_tmp59_ = _tmp58_;
				_tmp60_ = longname;
				_tmp61_ = g_strconcat (_tmp59_, _tmp60_, NULL);
				_tmp62_ = _tmp61_;
				_g_free0 (_tmp59_);
				tooltip = _tmp62_;
				if (recently_used_applet_showtooltips == TRUE) {
					GtkMenuItem* _tmp63_;
					const gchar* _tmp64_;
					_tmp63_ = newitem;
					_tmp64_ = tooltip;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp63_, _tmp64_);
				}
				_tmp65_ = newmenu;
				_tmp66_ = newitem;
				gtk_menu_shell_append ((GtkMenuShell*) _tmp65_, _tmp66_);
				_tmp67_ = newitem;
				g_signal_connect_data (_tmp67_, "activate", (GCallback) _____lambda5__gtk_menu_item_activate, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
				_g_free0 (tooltip);
				_g_object_unref0 (newitem);
				_g_free0 (menuname);
				_g_free0 (longname);
				block1_data_unref (_data1_);
				_data1_ = NULL;
			}
		}
	}
	result = newmenu;
	menu_source = (_vala_array_free (menu_source, menu_source_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (sortdict);
	_g_object_unref0 (sortlist);
	_g_free0 (line);
	return result;
}

static gchar*
recently_used_applet_applet_getmenuname (RecentlyUsedAppletApplet* self,
                                         const gchar* longname)
{
	gchar* _tmp6_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (longname != NULL, NULL);
	if (recently_used_applet_hidepath == TRUE) {
		gchar** filedata = NULL;
		gchar** _tmp0_;
		gchar** _tmp1_;
		gint filedata_length1;
		gint _filedata_size_;
		gint last = 0;
		gchar** _tmp2_;
		gint _tmp2__length1;
		gchar** _tmp3_;
		gint _tmp3__length1;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp1_ = _tmp0_ = g_strsplit (longname, "/", 0);
		filedata = _tmp1_;
		filedata_length1 = _vala_array_length (_tmp0_);
		_filedata_size_ = filedata_length1;
		_tmp2_ = filedata;
		_tmp2__length1 = filedata_length1;
		last = _tmp2__length1 - 1;
		_tmp3_ = filedata;
		_tmp3__length1 = filedata_length1;
		_tmp4_ = _tmp3_[last];
		_tmp5_ = g_strdup (_tmp4_);
		result = _tmp5_;
		filedata = (_vala_array_free (filedata, filedata_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp6_ = g_strdup (longname);
	result = _tmp6_;
	return result;
}

static gchar*
recently_used_applet_applet_replace (RecentlyUsedAppletApplet* self,
                                     const gchar* toreplace)
{
	gchar* output = NULL;
	gchar** replacements = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	gint replacements_length1;
	gint replacements_length2;
	gint lenrep = 0;
	gchar** _tmp13_;
	gint _tmp13__length1;
	gint _tmp13__length2;
	gint _tmp14_;
	gchar* _tmp15_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (toreplace != NULL, NULL);
	_tmp0_ = g_strdup ("%23");
	_tmp1_ = g_strdup ("#");
	_tmp2_ = g_strdup ("%5D");
	_tmp3_ = g_strdup ("]");
	_tmp4_ = g_strdup ("%5E");
	_tmp5_ = g_strdup ("^");
	_tmp6_ = g_strdup ("file://");
	_tmp7_ = g_strdup ("");
	_tmp8_ = g_strdup ("%20");
	_tmp9_ = g_strdup (" ");
	_tmp10_ = g_strdup ("&apos;");
	_tmp11_ = g_strdup ("'");
	_tmp12_ = g_new0 (gchar*, (6 * 2) + 1);
	_tmp12_[0] = _tmp0_;
	_tmp12_[1] = _tmp1_;
	_tmp12_[2] = _tmp2_;
	_tmp12_[3] = _tmp3_;
	_tmp12_[4] = _tmp4_;
	_tmp12_[5] = _tmp5_;
	_tmp12_[6] = _tmp6_;
	_tmp12_[7] = _tmp7_;
	_tmp12_[8] = _tmp8_;
	_tmp12_[9] = _tmp9_;
	_tmp12_[10] = _tmp10_;
	_tmp12_[11] = _tmp11_;
	replacements = _tmp12_;
	replacements_length1 = 6;
	replacements_length2 = 2;
	_tmp13_ = replacements;
	_tmp13__length1 = replacements_length1;
	_tmp13__length2 = replacements_length2;
	_tmp14_ = _tmp13__length1;
	lenrep = _tmp14_;
	_tmp15_ = g_strdup (toreplace);
	_g_free0 (output);
	output = _tmp15_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp16_ = FALSE;
			_tmp16_ = TRUE;
			while (TRUE) {
				gchar** _tmp18_;
				gint _tmp18__length1;
				gint _tmp18__length2;
				const gchar* _tmp19_;
				gchar** _tmp20_;
				gint _tmp20__length1;
				gint _tmp20__length2;
				const gchar* _tmp21_;
				gchar* _tmp22_;
				const gchar* _tmp23_;
				if (!_tmp16_) {
					gint _tmp17_;
					_tmp17_ = i;
					i = _tmp17_ + 1;
				}
				_tmp16_ = FALSE;
				if (!(i < lenrep)) {
					break;
				}
				_tmp18_ = replacements;
				_tmp18__length1 = replacements_length1;
				_tmp18__length2 = replacements_length2;
				_tmp19_ = _tmp18_[(i * _tmp18__length2) + 0];
				_tmp20_ = replacements;
				_tmp20__length1 = replacements_length1;
				_tmp20__length2 = replacements_length2;
				_tmp21_ = _tmp20_[(i * _tmp20__length2) + 1];
				_tmp22_ = string_replace (toreplace, _tmp19_, _tmp21_);
				_g_free0 (output);
				output = _tmp22_;
				_tmp23_ = output;
				toreplace = _tmp23_;
			}
		}
	}
	result = output;
	replacements = (_vala_array_free (replacements, replacements_length1 * replacements_length2, (GDestroyNotify) g_free), NULL);
	return result;
}

static void
recently_used_applet_applet_update_menu (RecentlyUsedAppletApplet* self)
{
	GtkMenu* _tmp0_;
	GSettings* _tmp2_;
	GSettings* _tmp3_;
	GSettings* _tmp4_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->recent;
	if (_tmp0_ != NULL) {
		GtkMenu* _tmp1_;
		_tmp1_ = self->priv->recent;
		gtk_widget_destroy ((GtkWidget*) _tmp1_);
	}
	_tmp2_ = recently_used_applet_rused_settings;
	recently_used_applet_showtooltips = g_settings_get_boolean (_tmp2_, "showtooltips");
	_tmp3_ = recently_used_applet_rused_settings;
	recently_used_applet_hidepath = g_settings_get_boolean (_tmp3_, "hidepath");
	_tmp4_ = recently_used_applet_rused_settings;
	recently_used_applet_n_show = g_settings_get_int (_tmp4_, "nitems");
	{
		GFileInputStream* _tmp5_ = NULL;
		GFile* _tmp6_;
		GFileInputStream* _tmp7_;
		GDataInputStream* dis = NULL;
		GDataInputStream* _tmp8_;
		GDataInputStream* _tmp9_;
		GtkMenu* _tmp10_;
		GtkMenu* _tmp11_;
		GtkMenuButton* _tmp12_;
		GtkMenu* _tmp13_;
		_tmp6_ = self->priv->infofile;
		_tmp7_ = g_file_read (_tmp6_, NULL, &_inner_error0_);
		_tmp5_ = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp8_ = g_data_input_stream_new ((GInputStream*) _tmp5_);
		dis = _tmp8_;
		_tmp9_ = dis;
		_tmp10_ = recently_used_applet_applet_create_menu (self, _tmp9_);
		_g_object_unref0 (self->priv->recent);
		self->priv->recent = _tmp10_;
		_tmp11_ = self->priv->recent;
		gtk_widget_show_all ((GtkWidget*) _tmp11_);
		_tmp12_ = self->priv->button;
		_tmp13_ = self->priv->recent;
		gtk_menu_button_set_popup (_tmp12_, (GtkWidget*) _tmp13_);
		_g_object_unref0 (dis);
		_g_object_unref0 (_tmp5_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_print ("Unable to read xbel file\n");
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

void
recently_used_applet_applet_initialiseLocaleLanguageSupport (RecentlyUsedAppletApplet* self)
{
	g_return_if_fail (self != NULL);
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
}

const gchar*
recently_used_applet_applet_get_uuid (RecentlyUsedAppletApplet* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uuid;
	result = _tmp0_;
	return result;
}

void
recently_used_applet_applet_set_uuid (RecentlyUsedAppletApplet* self,
                                      const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = recently_used_applet_applet_get_uuid (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_uuid);
		self->priv->_uuid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, recently_used_applet_applet_properties[RECENTLY_USED_APPLET_APPLET_UUID_PROPERTY]);
	}
}

static void
recently_used_applet_applet_class_init (RecentlyUsedAppletAppletClass * klass,
                                        gpointer klass_data)
{
	recently_used_applet_applet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RecentlyUsedAppletApplet_private_offset);
	((BudgieAppletClass *) klass)->supports_settings = (gboolean (*) (BudgieApplet*)) recently_used_applet_applet_real_supports_settings;
	((BudgieAppletClass *) klass)->get_settings_ui = (GtkWidget* (*) (BudgieApplet*)) recently_used_applet_applet_real_get_settings_ui;
	G_OBJECT_CLASS (klass)->get_property = _vala_recently_used_applet_applet_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_recently_used_applet_applet_set_property;
	G_OBJECT_CLASS (klass)->finalize = recently_used_applet_applet_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RECENTLY_USED_APPLET_APPLET_UUID_PROPERTY, recently_used_applet_applet_properties[RECENTLY_USED_APPLET_APPLET_UUID_PROPERTY] = g_param_spec_string ("uuid", "uuid", "uuid", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
recently_used_applet_applet_instance_init (RecentlyUsedAppletApplet * self,
                                           gpointer klass)
{
	self->priv = recently_used_applet_applet_get_instance_private (self);
}

static void
recently_used_applet_applet_finalize (GObject * obj)
{
	RecentlyUsedAppletApplet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RECENTLY_USED_APPLET_TYPE_APPLET, RecentlyUsedAppletApplet);
	_g_object_unref0 (self->priv->infofile);
	_g_object_unref0 (self->priv->recent);
	_g_object_unref0 (self->priv->monitor);
	_g_object_unref0 (self->priv->button);
	_g_object_unref0 (self->priv->indicatorBox);
	_g_free0 (self->priv->_uuid);
	G_OBJECT_CLASS (recently_used_applet_applet_parent_class)->finalize (obj);
}

GType
recently_used_applet_applet_get_type (void)
{
	return recently_used_applet_applet_type_id;
}

GType
recently_used_applet_applet_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (RecentlyUsedAppletAppletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) recently_used_applet_applet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RecentlyUsedAppletApplet), 0, (GInstanceInitFunc) recently_used_applet_applet_instance_init, NULL };
	recently_used_applet_applet_type_id = g_type_module_register_type (module, budgie_applet_get_type (), "RecentlyUsedAppletApplet", &g_define_type_info, 0);
	RecentlyUsedAppletApplet_private_offset = sizeof (RecentlyUsedAppletAppletPrivate);
	return recently_used_applet_applet_type_id;
}

static void
_vala_recently_used_applet_applet_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	RecentlyUsedAppletApplet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RECENTLY_USED_APPLET_TYPE_APPLET, RecentlyUsedAppletApplet);
	switch (property_id) {
		case RECENTLY_USED_APPLET_APPLET_UUID_PROPERTY:
		g_value_set_string (value, recently_used_applet_applet_get_uuid (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_recently_used_applet_applet_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	RecentlyUsedAppletApplet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RECENTLY_USED_APPLET_TYPE_APPLET, RecentlyUsedAppletApplet);
	switch (property_id) {
		case RECENTLY_USED_APPLET_APPLET_UUID_PROPERTY:
		recently_used_applet_applet_set_uuid (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

void
peas_register_types (GTypeModule* module)
{
	PeasObjectModule* objmodule = NULL;
	PeasObjectModule* _tmp0_;
	g_return_if_fail (module != NULL);
	recently_used_applet_recently_used_settings_register_type (module);
	recently_used_applet_plugin_register_type (module);
	recently_used_applet_applet_register_type (module);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (module, peas_object_module_get_type ()) ? ((PeasObjectModule*) module) : NULL);
	objmodule = _tmp0_;
	peas_object_module_register_extension_type (objmodule, budgie_plugin_get_type (), RECENTLY_USED_APPLET_TYPE_PLUGIN);
	_g_object_unref0 (objmodule);
}

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

