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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <pango/pango.h>
#include <gdk/gdk.h>
#include <cairo-gobject.h>
#include <adwaita.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gio/gio.h>
#include <glib/gstdio.h>

#define DC_COMPOSE_BAR_EMOJI_TRIGGER_START_MARK "parla-emoji-trigger-start"
#define DC_COMPOSE_BAR_EMOJI_TRIGGER_END_MARK "parla-emoji-trigger-end"
#define DC_COMPOSE_BAR_MENTION_ANCHOR_MARK "parla-mention-anchor"
#define DC_COMPOSE_BAR_VOICE_FILE_NAME "voice-message.m4a"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DC_TYPE_COMPOSE_BAR (dc_compose_bar_get_type ())
#define DC_COMPOSE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_COMPOSE_BAR, DcComposeBar))
#define DC_COMPOSE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_COMPOSE_BAR, DcComposeBarClass))
#define DC_IS_COMPOSE_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_COMPOSE_BAR))
#define DC_IS_COMPOSE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_COMPOSE_BAR))
#define DC_COMPOSE_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_COMPOSE_BAR, DcComposeBarClass))

typedef struct _DcComposeBar DcComposeBar;
typedef struct _DcComposeBarClass DcComposeBarClass;
typedef struct _DcComposeBarPrivate DcComposeBarPrivate;

#define DC_TYPE_AUDIO_RECORDER (dc_audio_recorder_get_type ())
#define DC_AUDIO_RECORDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_RECORDER, DcAudioRecorder))
#define DC_AUDIO_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_RECORDER, DcAudioRecorderClass))
#define DC_IS_AUDIO_RECORDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_RECORDER))
#define DC_IS_AUDIO_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_RECORDER))
#define DC_AUDIO_RECORDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_RECORDER, DcAudioRecorderClass))

typedef struct _DcAudioRecorder DcAudioRecorder;
typedef struct _DcAudioRecorderClass DcAudioRecorderClass;

#define DC_TYPE_MENTION_ROSTER (dc_mention_roster_get_type ())
#define DC_MENTION_ROSTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MENTION_ROSTER, DcMentionRoster))
#define DC_MENTION_ROSTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MENTION_ROSTER, DcMentionRosterClass))
#define DC_IS_MENTION_ROSTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MENTION_ROSTER))
#define DC_IS_MENTION_ROSTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MENTION_ROSTER))
#define DC_MENTION_ROSTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MENTION_ROSTER, DcMentionRosterClass))

typedef struct _DcMentionRoster DcMentionRoster;
typedef struct _DcMentionRosterClass DcMentionRosterClass;
enum  {
	DC_COMPOSE_BAR_0_PROPERTY,
	DC_COMPOSE_BAR_SHIFT_ENTER_SENDS_PROPERTY,
	DC_COMPOSE_BAR_CLEAN_PASTED_LINKS_PROPERTY,
	DC_COMPOSE_BAR_LINK_PREVIEWS_PROPERTY,
	DC_COMPOSE_BAR_NUM_PROPERTIES
};
static GParamSpec* dc_compose_bar_properties[DC_COMPOSE_BAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))

#define DC_TYPE_STICKER_PICKER (dc_sticker_picker_get_type ())
#define DC_STICKER_PICKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_STICKER_PICKER, DcStickerPicker))
#define DC_STICKER_PICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_STICKER_PICKER, DcStickerPickerClass))
#define DC_IS_STICKER_PICKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_STICKER_PICKER))
#define DC_IS_STICKER_PICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_STICKER_PICKER))
#define DC_STICKER_PICKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_STICKER_PICKER, DcStickerPickerClass))

typedef struct _DcStickerPicker DcStickerPicker;
typedef struct _DcStickerPickerClass DcStickerPickerClass;

#define DC_TYPE_STICKER (dc_sticker_get_type ())
#define DC_STICKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_STICKER, DcSticker))
#define DC_STICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_STICKER, DcStickerClass))
#define DC_IS_STICKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_STICKER))
#define DC_IS_STICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_STICKER))
#define DC_STICKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_STICKER, DcStickerClass))

typedef struct _DcSticker DcSticker;
typedef struct _DcStickerClass DcStickerClass;

#define DC_TYPE_TRANSCRIBER (dc_transcriber_get_type ())
#define DC_TRANSCRIBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_TRANSCRIBER, DcTranscriber))
#define DC_TRANSCRIBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_TRANSCRIBER, DcTranscriberClass))
#define DC_IS_TRANSCRIBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_TRANSCRIBER))
#define DC_IS_TRANSCRIBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_TRANSCRIBER))
#define DC_TRANSCRIBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_TRANSCRIBER, DcTranscriberClass))

typedef struct _DcTranscriber DcTranscriber;
typedef struct _DcTranscriberClass DcTranscriberClass;

#define DC_TYPE_MENTION_MEMBER (dc_mention_member_get_type ())
#define DC_MENTION_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MENTION_MEMBER, DcMentionMember))
#define DC_MENTION_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MENTION_MEMBER, DcMentionMemberClass))
#define DC_IS_MENTION_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MENTION_MEMBER))
#define DC_IS_MENTION_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MENTION_MEMBER))
#define DC_MENTION_MEMBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MENTION_MEMBER, DcMentionMemberClass))

typedef struct _DcMentionMember DcMentionMember;
typedef struct _DcMentionMemberClass DcMentionMemberClass;
typedef struct _DcMentionRosterPrivate DcMentionRosterPrivate;
typedef struct _DcStickerPrivate DcStickerPrivate;
typedef struct _Block33Data Block33Data;

#define DC_TYPE_AUDIO_PLAYBACK (dc_audio_playback_get_type ())
#define DC_AUDIO_PLAYBACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlayback))
#define DC_AUDIO_PLAYBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlaybackClass))
#define DC_IS_AUDIO_PLAYBACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYBACK))
#define DC_IS_AUDIO_PLAYBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYBACK))
#define DC_AUDIO_PLAYBACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlaybackClass))

typedef struct _DcAudioPlayback DcAudioPlayback;
typedef struct _DcAudioPlaybackClass DcAudioPlaybackClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define DC_TYPE_WINDOW (dc_window_get_type ())
#define DC_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_WINDOW, DcWindow))
#define DC_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_WINDOW, DcWindowClass))
#define DC_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_WINDOW))
#define DC_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_WINDOW))
#define DC_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_WINDOW, DcWindowClass))

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;

#define DC_TYPE_MESSAGE (dc_message_get_type ())
#define DC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE, DcMessage))
#define DC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE, DcMessageClass))
#define DC_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE))
#define DC_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE))
#define DC_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE, DcMessageClass))

typedef struct _DcMessage DcMessage;
typedef struct _DcMessageClass DcMessageClass;
typedef struct _Block34Data Block34Data;
#define _gdk_content_formats_unref0(var) ((var == NULL) ? NULL : (var = (gdk_content_formats_unref (var), NULL)))
#define __vala_GdkFileList_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkFileList_free (var), NULL)))
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
typedef struct _DcComposeBarPasteFromClipboardData DcComposeBarPasteFromClipboardData;
enum  {
	DC_COMPOSE_BAR_LINK_PREVIEWS_REQUESTED_SIGNAL,
	DC_COMPOSE_BAR_SEND_MESSAGE_SIGNAL,
	DC_COMPOSE_BAR_SEND_VOICE_MESSAGE_SIGNAL,
	DC_COMPOSE_BAR_EDIT_MESSAGE_SIGNAL,
	DC_COMPOSE_BAR_EDIT_LAST_REQUESTED_SIGNAL,
	DC_COMPOSE_BAR_DRAFT_CHANGED_SIGNAL,
	DC_COMPOSE_BAR_NUM_SIGNALS
};
static guint dc_compose_bar_signals[DC_COMPOSE_BAR_NUM_SIGNALS] = {0};

struct _DcComposeBar {
	GtkBox parent_instance;
	DcComposeBarPrivate * priv;
};

struct _DcComposeBarClass {
	GtkBoxClass parent_class;
};

struct _DcComposeBarPrivate {
	gboolean _shift_enter_sends;
	gboolean _clean_pasted_links;
	gboolean _link_previews;
	GtkTextView* text_view;
	GtkLabel* placeholder_label;
	gchar* placeholder_default;
	GtkButton* attach_button;
	GtkMenuButton* emoji_button;
	GtkButton* cancel_attach_button;
	GtkButton* cancel_edit_button;
	GtkStack* send_stack;
	GtkMenuButton* sticker_button;
	GtkStack* compose_mode_stack;
	GtkLabel* recording_time_label;
	GtkStack* recording_action_stack;
	GtkButton* recording_stop_button;
	GtkButton* transcribe_button;
	DcAudioRecorder* audio_recorder;
	gchar* transcribing_path;
	gulong transcriber_handler;
	gint64 recording_started_us;
	guint recording_timer;
	GtkLabel* reply_label;
	GtkBox* reply_bar;
	GtkBox* attachment_bar;
	GtkBox* long_msg_bar;
	GtkPicture* attachment_picture;
	GtkImage* attachment_icon;
	GtkLabel* attachment_name_label;
	GtkLabel* attachment_meta_label;
	gchar* pending_file;
	gchar* pending_file_name;
	gboolean pending_file_is_temp;
	gboolean pending_file_is_voice;
	gchar** extra_pending_files;
	gint extra_pending_files_length1;
	gint _extra_pending_files_size_;
	gchar** extra_pending_file_names;
	gint extra_pending_file_names_length1;
	gint _extra_pending_file_names_size_;
	gchar** extra_pending_temp_files;
	gint extra_pending_temp_files_length1;
	gint _extra_pending_temp_files_size_;
	gchar** extra_pending_captions;
	gint extra_pending_captions_length1;
	gint _extra_pending_captions_size_;
	guint preview_generation;
	gchar** previewed_urls;
	gint previewed_urls_length1;
	gint _previewed_urls_size_;
	gint editing_msg_id;
	gint replying_msg_id;
	DcMentionRoster* mention_roster;
	GtkPopover* mention_popover;
	GtkListBox* mention_list;
	gboolean mention_popup_visible;
	gint mention_index;
	GPtrArray* mention_tokens;
	gboolean suppress_draft_signal;
	gboolean has_suspended_draft;
	gchar* suspended_draft_text;
	gchar* suspended_draft_file;
	gchar* suspended_draft_file_name;
	gboolean suspended_draft_file_is_temp;
	gboolean suspended_draft_file_is_voice;
	gchar** suspended_extra_draft_files;
	gint suspended_extra_draft_files_length1;
	gint _suspended_extra_draft_files_size_;
	gchar** suspended_extra_draft_file_names;
	gint suspended_extra_draft_file_names_length1;
	gint _suspended_extra_draft_file_names_size_;
	gchar** suspended_extra_draft_captions;
	gint suspended_extra_draft_captions_length1;
	gint _suspended_extra_draft_captions_size_;
	gint suspended_replying_msg_id;
	gchar* suspended_reply_label;
	gboolean closed;
};

struct _DcMentionRoster {
	GObject parent_instance;
	DcMentionRosterPrivate * priv;
	GPtrArray* members;
};

struct _DcMentionRosterClass {
	GObjectClass parent_class;
};

struct _DcSticker {
	GObject parent_instance;
	DcStickerPrivate * priv;
	gchar* file_name;
	gchar* pack;
	gchar* emoji;
	gchar* display_name;
};

struct _DcStickerClass {
	GObjectClass parent_class;
};

struct _Block33Data {
	int _ref_count_;
	DcComposeBar* self;
	DcAudioRecorder* recorder;
};

struct _Block34Data {
	int _ref_count_;
	DcComposeBar* self;
	GtkFileDialog* dialog;
};

struct _DcComposeBarPasteFromClipboardData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcComposeBar* self;
	GdkClipboard* clipboard;
	gboolean try_files;
	gboolean try_texture;
	gboolean replace_selection;
	GValue* value;
	GValue* _tmp0_;
	GdkFileList* _tmp1_;
	GValue* _tmp2_;
	GValue* _tmp3_;
	void* _tmp4_;
	GdkFileList* fl;
	GdkFileList* _tmp5_;
	GFile* _tmp6_;
	gboolean _tmp7_;
	GdkFileList* _tmp8_;
	GdkFileList* _tmp9_;
	GSList* _tmp10_;
	GSList* _tmp11_;
	GdkFileList* _tmp12_;
	GSList* _tmp13_;
	GSList* _tmp14_;
	gconstpointer _tmp15_;
	GFile* gf;
	GFile* _tmp16_;
	gchar* _tmp17_;
	GFile* _tmp18_;
	GFile* _tmp19_;
	gchar* _tmp20_;
	gchar* path;
	gchar* _tmp21_;
	gboolean _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	GFile* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* tmp_path;
	GdkTexture* texture;
	GdkTexture* _tmp29_;
	GdkTexture* _tmp30_;
	GFileIOStream* stream;
	GFile* tmp;
	GFileIOStream* _tmp31_;
	GFile* _tmp32_;
	GFile* _tmp33_;
	gchar* _tmp34_;
	GFileIOStream* _tmp35_;
	GdkTexture* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	gchar* text;
	gchar* _tmp41_;
	gboolean _tmp42_;
	gboolean _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	gint _tmp46_;
	gint _tmp47_;
	GtkTextView* _tmp48_;
	gboolean _tmp49_;
	gboolean _tmp50_;
	gboolean _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gboolean _tmp54_;
	gboolean _tmp55_;
	const gchar* _tmp56_;
	GtkTextBuffer* buffer;
	GtkTextView* _tmp57_;
	GtkTextBuffer* _tmp58_;
	GtkTextBuffer* _tmp59_;
	GtkTextBuffer* _tmp60_;
	GtkTextBuffer* _tmp61_;
	GtkTextBuffer* _tmp62_;
	GtkTextView* _tmp63_;
	gboolean _tmp64_;
	gboolean _tmp65_;
	GtkTextBuffer* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	gint _tmp69_;
	gint _tmp70_;
	GtkTextBuffer* _tmp71_;
	GtkTextView* _tmp72_;
	GtkTextBuffer* _tmp73_;
	GtkTextMark* _tmp74_;
	GError* _inner_error0_;
};

static gint DcComposeBar_private_offset;
static gpointer dc_compose_bar_parent_class = NULL;
VALA_EXTERN gboolean dc_audio_player_prefer_system;

VALA_EXTERN GType dc_compose_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcComposeBar, g_object_unref)
VALA_EXTERN GType dc_audio_recorder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioRecorder, g_object_unref)
VALA_EXTERN GType dc_mention_roster_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMentionRoster, g_object_unref)
static void _g_free0_ (gpointer var);
VALA_EXTERN DcComposeBar* dc_compose_bar_new (void);
VALA_EXTERN DcComposeBar* dc_compose_bar_construct (GType object_type);
static GtkButton* dc_compose_bar_icon_button (DcComposeBar* self,
                                       const gchar* icon_name,
                                       const gchar* tooltip,
                                       gboolean circular,
                                       const gchar* style);
static void dc_compose_bar_cancel_reply (DcComposeBar* self);
static void _dc_compose_bar_cancel_reply_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self);
static void dc_compose_bar_clear_attachment (DcComposeBar* self);
static void _dc_compose_bar_clear_attachment_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self);
static void dc_compose_bar_on_attach_clicked (DcComposeBar* self);
static void _dc_compose_bar_on_attach_clicked_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
VALA_EXTERN GtkEmojiChooser* dc_create_emoji_chooser (void);
static void dc_compose_bar_on_emoji_picked (DcComposeBar* self,
                                     const gchar* emoji);
static void _dc_compose_bar_on_emoji_picked_gtk_emoji_chooser_emoji_picked (GtkEmojiChooser* _sender,
                                                                     const gchar* text,
                                                                     gpointer self);
static void ___lambda22_ (DcComposeBar* self);
static gboolean __lambda23_ (DcComposeBar* self);
static void dc_compose_bar_clear_emoji_trigger_marks (DcComposeBar* self);
static gboolean ___lambda23__gsource_func (gpointer self);
static void ____lambda22__gtk_popover_closed (GtkPopover* _sender,
                                       gpointer self);
static void dc_compose_bar_cancel_edit (DcComposeBar* self);
static void _dc_compose_bar_cancel_edit_gtk_button_clicked (GtkButton* _sender,
                                                     gpointer self);
static void __lambda24_ (DcComposeBar* self);
static void dc_compose_bar_update_placeholder (DcComposeBar* self);
static void dc_compose_bar_update_send_stack (DcComposeBar* self);
static void dc_compose_bar_notify_draft_changed (DcComposeBar* self);
static void dc_compose_bar_update_mention_popup (DcComposeBar* self);
static void dc_compose_bar_update_long_message_hint (DcComposeBar* self);
static void ___lambda24__gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                           gpointer self);
static void dc_compose_bar_on_paste_clipboard (DcComposeBar* self);
static void _dc_compose_bar_on_paste_clipboard_gtk_text_view_paste_clipboard (GtkTextView* _sender,
                                                                       gpointer self);
static void __lambda25_ (DcComposeBar* self);
static void dc_compose_bar_set_entry_active (DcComposeBar* self,
                                      gboolean active);
static void ___lambda25__gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                    gpointer self);
static void __lambda26_ (DcComposeBar* self);
static void dc_compose_bar_hide_mention_popup (DcComposeBar* self);
static void ___lambda26__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                    gpointer self);
static gboolean dc_compose_bar_on_entry_key_pressed (DcComposeBar* self,
                                              guint keyval,
                                              guint keycode,
                                              GdkModifierType state);
static gboolean _dc_compose_bar_on_entry_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                    guint keyval,
                                                                                    guint keycode,
                                                                                    GdkModifierType state,
                                                                                    gpointer self);
static void dc_compose_bar_on_send (DcComposeBar* self);
static void _dc_compose_bar_on_send_gtk_button_clicked (GtkButton* _sender,
                                                 gpointer self);
VALA_EXTERN GType dc_sticker_picker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcStickerPicker, g_object_unref)
VALA_EXTERN DcStickerPicker* dc_sticker_picker_new (void);
VALA_EXTERN DcStickerPicker* dc_sticker_picker_construct (GType object_type);
VALA_EXTERN GType dc_sticker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSticker, g_object_unref)
static void dc_compose_bar_on_sticker_picked (DcComposeBar* self,
                                       DcSticker* sticker);
static void _dc_compose_bar_on_sticker_picked_dc_sticker_picker_sticker_picked (DcStickerPicker* _sender,
                                                                         DcSticker* sticker,
                                                                         gpointer self);
static void dc_compose_bar_start_audio_recording (DcComposeBar* self);
static void _dc_compose_bar_start_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self);
static void dc_compose_bar_cancel_audio_recording (DcComposeBar* self);
static void _dc_compose_bar_cancel_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                                gpointer self);
static void dc_compose_bar_stop_audio_recording (DcComposeBar* self);
static void _dc_compose_bar_stop_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self);
static void dc_compose_bar_transcribe_audio_recording (DcComposeBar* self);
static void _dc_compose_bar_transcribe_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                                    gpointer self);
static void dc_compose_bar_send_audio_recording (DcComposeBar* self);
static void _dc_compose_bar_send_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self);
static void dc_compose_bar_build_mention_popover (DcComposeBar* self);
VALA_EXTERN void dc_compose_bar_close (DcComposeBar* self);
static void dc_compose_bar_stop_recording_timer (DcComposeBar* self);
VALA_EXTERN GType dc_transcriber_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcTranscriber, g_object_unref)
VALA_EXTERN DcTranscriber* dc_transcriber_shared (void);
VALA_EXTERN void dc_audio_recorder_cancel (DcAudioRecorder* self);
static void dc_compose_bar_real_dispose (GObject* base);
static void __lambda37_ (DcComposeBar* self,
                  GtkListBoxRow* row);
static void dc_compose_bar_accept_mention (DcComposeBar* self);
static void ___lambda37__gtk_list_box_row_activated (GtkListBox* _sender,
                                              GtkListBoxRow* row,
                                              gpointer self);
VALA_EXTERN void dc_compose_bar_set_mention_roster (DcComposeBar* self,
                                        DcMentionRoster* roster);
VALA_EXTERN gboolean dc_mention_roster_has_members (DcMentionRoster* self);
static void dc_compose_bar_populate_mention_list (DcComposeBar* self,
                                           const gchar* query);
static void dc_compose_bar_position_and_show_mention_popup (DcComposeBar* self,
                                                     GtkTextIter* cursor);
VALA_EXTERN void dc_clear_listbox (GtkListBox* lb);
VALA_EXTERN GType dc_mention_member_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMentionMember, g_object_unref)
VALA_EXTERN gboolean dc_mention_member_get_is_self (DcMentionMember* self);
VALA_EXTERN const gchar* dc_mention_member_get_display_name (DcMentionMember* self);
VALA_EXTERN const gchar* dc_mention_member_get_address (DcMentionMember* self);
static void dc_compose_bar_add_mention_row (DcComposeBar* self,
                                     const gchar* title,
                                     const gchar* subtitle,
                                     const gchar* token,
                                     const gchar* avatar_path,
                                     const gchar* avatar_text);
VALA_EXTERN const gchar* dc_mention_member_get_avatar_path (DcMentionMember* self);
static void dc_compose_bar_select_mention_index (DcComposeBar* self);
VALA_EXTERN GtkWidget* dc_presence_avatar (gint size,
                               const gchar* text,
                               const gchar* path,
                               gboolean online,
                               const gchar* avatar_css,
                               const gchar* ring_css);
static void dc_compose_bar_move_mention_selection (DcComposeBar* self,
                                            gint delta);
VALA_EXTERN void dc_compose_bar_grab_entry_focus (DcComposeBar* self);
static gboolean dc_compose_bar_is_recording_mode (DcComposeBar* self);
static gboolean __lambda21_ (DcComposeBar* self);
static gboolean ___lambda21__gsource_func (gpointer self);
VALA_EXTERN void dc_compose_bar_type_text (DcComposeBar* self,
                               const gchar* text);
static gboolean dc_compose_bar_previous_char_is_colon (DcComposeBar* self);
static void dc_compose_bar_open_emoji_picker_after_typed_colon (DcComposeBar* self);
static void dc_compose_bar_set_entry_text (DcComposeBar* self,
                                    const gchar* text);
static gboolean __lambda36_ (DcComposeBar* self);
static gboolean ___lambda36__gsource_func (gpointer self);
static gchar* dc_compose_bar_get_text (DcComposeBar* self);
VALA_EXTERN gchar* dc_sticker_store_sticker_path (const gchar* file_name);
static Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_data_unref (void * _userdata_);
VALA_EXTERN GType dc_audio_playback_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlayback, g_object_unref)
VALA_EXTERN DcAudioPlayback* dc_audio_playback_shared (void);
VALA_EXTERN void dc_audio_playback_stop (DcAudioPlayback* self);
VALA_EXTERN gboolean dc_platform_is_macos (void);
VALA_EXTERN DcAudioRecorder* dc_audio_recorder_new (gboolean prefer_external);
VALA_EXTERN DcAudioRecorder* dc_audio_recorder_construct (GType object_type,
                                              gboolean prefer_external);
static void __lambda34_ (Block33Data* _data33_);
VALA_EXTERN gboolean dc_transcriber_available (void);
static void ___lambda34__dc_audio_recorder_completed (DcAudioRecorder* _sender,
                                               gpointer self);
static void __lambda35_ (Block33Data* _data33_,
                  const gchar* message);
static void dc_compose_bar_leave_audio_recording_mode (DcComposeBar* self);
static void dc_compose_bar_show_recording_error (DcComposeBar* self,
                                          const gchar* message);
static void ___lambda35__dc_audio_recorder_failed (DcAudioRecorder* _sender,
                                            const gchar* message,
                                            gpointer self);
VALA_EXTERN void dc_audio_recorder_start (DcAudioRecorder* self,
                              GError** error);
static gboolean dc_compose_bar_update_recording_time (DcComposeBar* self);
static gboolean _dc_compose_bar_update_recording_time_gsource_func (gpointer self);
VALA_EXTERN void dc_audio_recorder_stop (DcAudioRecorder* self);
VALA_EXTERN const gchar* dc_audio_recorder_get_output_path (DcAudioRecorder* self);
static void dc_compose_bar_on_transcription_updated (DcComposeBar* self,
                                              const gchar* path);
static void _dc_compose_bar_on_transcription_updated_dc_transcriber_updated (DcTranscriber* _sender,
                                                                      const gchar* path,
                                                                      gpointer self);
VALA_EXTERN void dc_transcriber_transcribe (DcTranscriber* self,
                                const gchar* path);
VALA_EXTERN gboolean dc_transcriber_is_running (DcTranscriber* self,
                                    const gchar* path);
VALA_EXTERN gchar* dc_transcriber_result_for (DcTranscriber* self,
                                  const gchar* path);
static void dc_compose_bar_reset_transcribe_button (DcComposeBar* self);
static void dc_compose_bar_show_compose_toast (DcComposeBar* self,
                                        const gchar* message);
static void dc_compose_bar_attach_recording_with_text (DcComposeBar* self,
                                                const gchar* text);
VALA_EXTERN gchar* dc_audio_recorder_take_output (DcAudioRecorder* self);
VALA_EXTERN void dc_compose_bar_set_pending_attachment (DcComposeBar* self,
                                            const gchar* file_path,
                                            const gchar* file_name,
                                            gboolean is_temp,
                                            const gchar* caption);
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
VALA_EXTERN gboolean dc_compose_bar_can_accept_attachment (DcComposeBar* self);
static void dc_compose_bar_populate_attachment_preview (DcComposeBar* self,
                                                 const gchar* file_path,
                                                 const gchar* file_name);
static void _vala_array_add19 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_array_add20 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_array_add21 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_array_add22 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN guint dc_compose_bar_current_preview_generation (DcComposeBar* self);
VALA_EXTERN gboolean dc_compose_bar_add_link_preview (DcComposeBar* self,
                                          guint generation,
                                          const gchar* image_path,
                                          const gchar* file_name,
                                          const gchar* title,
                                          const gchar* description);
static void dc_compose_bar_request_link_previews (DcComposeBar* self,
                                           const gchar* text);
VALA_EXTERN gchar** dc_link_preview_pick_urls (const gchar* text,
                                   gint* result_length1);
static void _vala_array_add23 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_array_add24 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static gchar* dc_compose_bar_guess_mime (const gchar* file_path);
VALA_EXTERN GdkTexture* dc_texture_from_pixbuf (GdkPixbuf* pixbuf);
static gchar* dc_compose_bar_mime_icon_name (const gchar* mime,
                                      const gchar* file_path);
static gchar* dc_compose_bar_format_size (gint64 bytes);
static gint64 dc_compose_bar_file_size_or_zero (const gchar* file_path);
static gboolean dc_compose_bar_message_would_be_truncated (DcComposeBar* self,
                                                    const gchar* text);
VALA_EXTERN void dc_compose_bar_begin_reply (DcComposeBar* self,
                                 gint msg_id,
                                 const gchar* sender_name,
                                 const gchar* preview);
static gchar* dc_compose_bar_shorten_preview (const gchar* text);
VALA_EXTERN gchar* dc_markdown_preview (const gchar* input,
                            gint max_lines,
                            gint max_chars);
VALA_EXTERN void dc_compose_bar_begin_edit (DcComposeBar* self,
                                gint msg_id,
                                const gchar* current_text);
static void dc_compose_bar_suspend_current_draft (DcComposeBar* self);
static void dc_compose_bar_restore_suspended_draft (DcComposeBar* self);
VALA_EXTERN gboolean dc_compose_bar_has_unsent_content (DcComposeBar* self);
static gchar** _vala_array_dup10 (gchar** self,
                           gssize length);
static gchar** _vala_array_dup11 (gchar** self,
                           gssize length);
static gchar** _vala_array_dup12 (gchar** self,
                           gssize length);
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN void dc_compose_bar_restore_draft (DcComposeBar* self,
                                   DcMessage* draft);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_view_type (DcMessage* self);
VALA_EXTERN gint dc_message_get_quote_msg_id (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_quote_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_quote_text (DcMessage* self);
VALA_EXTERN gboolean dc_compose_bar_has_active_mode (DcComposeBar* self);
VALA_EXTERN gboolean dc_compose_bar_entry_has_focus (DcComposeBar* self);
VALA_EXTERN void dc_compose_bar_cancel_active_mode (DcComposeBar* self);
static gboolean dc_compose_bar_replace_emoji_trigger (DcComposeBar* self,
                                               const gchar* emoji);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
static void __lambda20_ (Block34Data* _data34_,
                  GObject* obj,
                  GAsyncResult* res);
VALA_EXTERN gboolean dc_is_dialog_dismissal (GError* _error_);
static void ___lambda20__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static gboolean dc_compose_bar_is_plain_colon_key (guint keyval,
                                            GdkModifierType state);
VALA_EXTERN gboolean dc_compose_bar_get_shift_enter_sends (DcComposeBar* self);
VALA_EXTERN gboolean dc_platform_has_primary_modifier (GdkModifierType state);
static void dc_compose_bar_start_clipboard_paste (DcComposeBar* self);
static void dc_compose_bar_paste_from_clipboard (DcComposeBar* self,
                                          GdkClipboard* clipboard,
                                          gboolean try_files,
                                          gboolean try_texture,
                                          gboolean replace_selection,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_compose_bar_paste_from_clipboard_finish (DcComposeBar* self,
                                                 GAsyncResult* _res_);
static gboolean __lambda27_ (DcComposeBar* self);
static gboolean dc_compose_bar_remember_typed_colon_trigger (DcComposeBar* self);
static gboolean ___lambda27__gsource_func (gpointer self);
static void dc_compose_bar_paste_from_clipboard_data_free (gpointer _data);
static gboolean dc_compose_bar_paste_from_clipboard_co (DcComposeBarPasteFromClipboardData* _data_);
static void dc_compose_bar_paste_from_clipboard_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static GValue* _g_value_dup (GValue* self);
static GdkFileList* _vala_GdkFileList_copy (GdkFileList* self);
static void _vala_GdkFileList_free (GdkFileList* self);
static void _vala_GValue_free (GValue* self);
VALA_EXTERN gboolean dc_compose_bar_get_clean_pasted_links (DcComposeBar* self);
VALA_EXTERN gchar* dc_link_cleaner_clean_text (const gchar* text);
VALA_EXTERN gboolean dc_compose_bar_get_link_previews (DcComposeBar* self);
VALA_EXTERN void dc_compose_bar_set_shift_enter_sends (DcComposeBar* self,
                                           gboolean value);
VALA_EXTERN void dc_compose_bar_set_clean_pasted_links (DcComposeBar* self,
                                            gboolean value);
VALA_EXTERN void dc_compose_bar_set_link_previews (DcComposeBar* self,
                                       gboolean value);
static void g_cclosure_user_marshal_VOID__BOXED_INT_UINT (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING_INT (GClosure * closure,
                                                             GValue * return_value,
                                                             guint n_param_values,
                                                             const GValue * param_values,
                                                             gpointer invocation_hint,
                                                             gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__STRING_STRING_INT_BOOLEAN (GClosure * closure,
                                                              GValue * return_value,
                                                              guint n_param_values,
                                                              const GValue * param_values,
                                                              gpointer invocation_hint,
                                                              gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__INT_STRING (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING_INT_BOOLEAN (GClosure * closure,
                                                                     GValue * return_value,
                                                                     guint n_param_values,
                                                                     const GValue * param_values,
                                                                     gpointer invocation_hint,
                                                                     gpointer marshal_data);
static void dc_compose_bar_finalize (GObject * obj);
static GType dc_compose_bar_get_type_once (void);
static void _vala_dc_compose_bar_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_dc_compose_bar_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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dc_compose_bar_get_instance_private (DcComposeBar* self)
{
	return G_STRUCT_MEMBER_P (self, DcComposeBar_private_offset);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_dc_compose_bar_cancel_reply_gtk_button_clicked (GtkButton* _sender,
                                                 gpointer self)
{
	dc_compose_bar_cancel_reply ((DcComposeBar*) self);
}

static void
_dc_compose_bar_clear_attachment_gtk_button_clicked (GtkButton* _sender,
                                                     gpointer self)
{
	dc_compose_bar_clear_attachment ((DcComposeBar*) self);
}

static void
_dc_compose_bar_on_attach_clicked_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	dc_compose_bar_on_attach_clicked ((DcComposeBar*) self);
}

static void
_dc_compose_bar_on_emoji_picked_gtk_emoji_chooser_emoji_picked (GtkEmojiChooser* _sender,
                                                                const gchar* text,
                                                                gpointer self)
{
	dc_compose_bar_on_emoji_picked ((DcComposeBar*) self, text);
}

static gboolean
__lambda23_ (DcComposeBar* self)
{
	gboolean result;
	dc_compose_bar_clear_emoji_trigger_marks (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda23__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda23_ ((DcComposeBar*) self);
	return result;
}

static void
___lambda22_ (DcComposeBar* self)
{
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda23__gsource_func, g_object_ref (self), g_object_unref);
}

static void
____lambda22__gtk_popover_closed (GtkPopover* _sender,
                                  gpointer self)
{
	___lambda22_ ((DcComposeBar*) self);
}

static void
_dc_compose_bar_cancel_edit_gtk_button_clicked (GtkButton* _sender,
                                                gpointer self)
{
	dc_compose_bar_cancel_edit ((DcComposeBar*) self);
}

static void
__lambda24_ (DcComposeBar* self)
{
	dc_compose_bar_update_placeholder (self);
	dc_compose_bar_update_send_stack (self);
	dc_compose_bar_notify_draft_changed (self);
	dc_compose_bar_update_mention_popup (self);
	dc_compose_bar_update_long_message_hint (self);
}

static void
___lambda24__gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                      gpointer self)
{
	__lambda24_ ((DcComposeBar*) self);
}

static void
_dc_compose_bar_on_paste_clipboard_gtk_text_view_paste_clipboard (GtkTextView* _sender,
                                                                  gpointer self)
{
	dc_compose_bar_on_paste_clipboard ((DcComposeBar*) self);
}

static void
__lambda25_ (DcComposeBar* self)
{
	dc_compose_bar_set_entry_active (self, TRUE);
}

static void
___lambda25__gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                               gpointer self)
{
	__lambda25_ ((DcComposeBar*) self);
}

static void
__lambda26_ (DcComposeBar* self)
{
	dc_compose_bar_set_entry_active (self, FALSE);
	dc_compose_bar_hide_mention_popup (self);
}

static void
___lambda26__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                               gpointer self)
{
	__lambda26_ ((DcComposeBar*) self);
}

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

static gboolean
_dc_compose_bar_on_entry_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                           guint keyval,
                                                                           guint keycode,
                                                                           GdkModifierType state,
                                                                           gpointer self)
{
	gboolean result;
	result = dc_compose_bar_on_entry_key_pressed ((DcComposeBar*) self, keyval, keycode, state);
	return result;
}

static void
_dc_compose_bar_on_send_gtk_button_clicked (GtkButton* _sender,
                                            gpointer self)
{
	dc_compose_bar_on_send ((DcComposeBar*) self);
}

static void
_dc_compose_bar_on_sticker_picked_dc_sticker_picker_sticker_picked (DcStickerPicker* _sender,
                                                                    DcSticker* sticker,
                                                                    gpointer self)
{
	dc_compose_bar_on_sticker_picked ((DcComposeBar*) self, sticker);
}

static void
_dc_compose_bar_start_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self)
{
	dc_compose_bar_start_audio_recording ((DcComposeBar*) self);
}

static void
_dc_compose_bar_cancel_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self)
{
	dc_compose_bar_cancel_audio_recording ((DcComposeBar*) self);
}

static void
_dc_compose_bar_stop_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self)
{
	dc_compose_bar_stop_audio_recording ((DcComposeBar*) self);
}

static void
_dc_compose_bar_transcribe_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self)
{
	dc_compose_bar_transcribe_audio_recording ((DcComposeBar*) self);
}

static void
_dc_compose_bar_send_audio_recording_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self)
{
	dc_compose_bar_send_audio_recording ((DcComposeBar*) self);
}

DcComposeBar*
dc_compose_bar_construct (GType object_type)
{
	DcComposeBar * self = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkLabel* _tmp6_;
	GtkLabel* _tmp7_;
	GtkLabel* _tmp8_;
	GtkLabel* _tmp9_;
	GtkLabel* _tmp10_;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkBox* _tmp13_;
	GtkLabel* _tmp14_;
	GtkButton* cancel_reply_button = NULL;
	GtkButton* _tmp15_;
	GtkButton* _tmp16_;
	GtkBox* _tmp17_;
	GtkButton* _tmp18_;
	GtkBox* _tmp19_;
	GtkBox* _tmp20_;
	GtkBox* _tmp21_;
	GtkBox* _tmp22_;
	GtkPicture* _tmp23_;
	GtkPicture* _tmp24_;
	GtkPicture* _tmp25_;
	GtkPicture* _tmp26_;
	GtkPicture* _tmp27_;
	GtkBox* _tmp28_;
	GtkPicture* _tmp29_;
	GtkImage* _tmp30_;
	GtkImage* _tmp31_;
	GtkImage* _tmp32_;
	GtkImage* _tmp33_;
	GtkBox* _tmp34_;
	GtkImage* _tmp35_;
	GtkBox* attachment_info = NULL;
	GtkBox* _tmp36_;
	GtkBox* _tmp37_;
	GtkBox* _tmp38_;
	GtkLabel* _tmp39_;
	GtkLabel* _tmp40_;
	GtkLabel* _tmp41_;
	GtkLabel* _tmp42_;
	GtkLabel* _tmp43_;
	GtkLabel* _tmp44_;
	GtkLabel* _tmp45_;
	GtkBox* _tmp46_;
	GtkLabel* _tmp47_;
	GtkLabel* _tmp48_;
	GtkLabel* _tmp49_;
	GtkLabel* _tmp50_;
	GtkLabel* _tmp51_;
	GtkLabel* _tmp52_;
	GtkBox* _tmp53_;
	GtkLabel* _tmp54_;
	GtkBox* _tmp55_;
	GtkBox* _tmp56_;
	GtkButton* remove_attachment_button = NULL;
	GtkButton* _tmp57_;
	GtkButton* _tmp58_;
	GtkBox* _tmp59_;
	GtkButton* _tmp60_;
	GtkBox* _tmp61_;
	GtkBox* _tmp62_;
	GtkBox* _tmp63_;
	GtkBox* _tmp64_;
	GtkImage* long_msg_icon = NULL;
	GtkImage* _tmp65_;
	GtkBox* _tmp66_;
	GtkImage* _tmp67_;
	GtkLabel* long_msg_label = NULL;
	GtkLabel* _tmp68_;
	GtkLabel* _tmp69_;
	GtkLabel* _tmp70_;
	GtkLabel* _tmp71_;
	GtkLabel* _tmp72_;
	GtkBox* _tmp73_;
	GtkLabel* _tmp74_;
	GtkBox* _tmp75_;
	GtkBox* input_row = NULL;
	GtkBox* _tmp76_;
	GtkBox* _tmp77_;
	GtkBox* _tmp78_;
	GtkButton* _tmp79_;
	GtkButton* _tmp80_;
	GtkButton* _tmp81_;
	GtkBox* _tmp82_;
	GtkButton* _tmp83_;
	GtkMenuButton* _tmp84_;
	GtkMenuButton* _tmp85_;
	GtkMenuButton* _tmp86_;
	GtkMenuButton* _tmp87_;
	GtkMenuButton* _tmp88_;
	GtkEmojiChooser* emoji_chooser = NULL;
	GtkEmojiChooser* _tmp89_;
	GtkEmojiChooser* _tmp90_;
	GtkBox* _tmp97_;
	GtkMenuButton* _tmp98_;
	GtkButton* _tmp99_;
	GtkButton* _tmp100_;
	GtkButton* _tmp101_;
	GtkButton* _tmp102_;
	GtkBox* _tmp103_;
	GtkButton* _tmp104_;
	GtkButton* _tmp105_;
	GtkButton* _tmp106_;
	GtkButton* _tmp107_;
	GtkButton* _tmp108_;
	GtkBox* _tmp109_;
	GtkButton* _tmp110_;
	GtkTextView* _tmp111_;
	GtkTextView* _tmp112_;
	GtkTextView* _tmp113_;
	GtkTextView* _tmp114_;
	GtkTextView* _tmp115_;
	GtkTextView* _tmp116_;
	GtkTextView* _tmp117_;
	GtkTextView* _tmp118_;
	GtkTextView* _tmp119_;
	GtkTextView* _tmp120_;
	GtkTextView* _tmp121_;
	GtkTextView* _tmp122_;
	GtkTextView* _tmp123_;
	const gchar* _tmp124_;
	GtkLabel* _tmp125_;
	GtkLabel* _tmp126_;
	GtkLabel* _tmp127_;
	GtkLabel* _tmp128_;
	GtkLabel* _tmp129_;
	GtkLabel* _tmp130_;
	GtkLabel* _tmp131_;
	GtkLabel* _tmp132_;
	GtkScrolledWindow* entry_scroll = NULL;
	GtkScrolledWindow* _tmp133_;
	GtkTextView* _tmp134_;
	GtkOverlay* entry_overlay = NULL;
	GtkOverlay* _tmp135_;
	GtkLabel* _tmp136_;
	GtkTextView* _tmp137_;
	GtkTextBuffer* _tmp138_;
	GtkTextBuffer* _tmp139_;
	GtkTextView* _tmp140_;
	GtkEventControllerFocus* focus_ctrl = NULL;
	GtkEventControllerFocus* _tmp141_;
	GtkTextView* _tmp142_;
	GtkEventController* _tmp143_;
	GtkEventControllerKey* key_ctrl = NULL;
	GtkEventControllerKey* _tmp144_;
	GtkTextView* _tmp145_;
	GtkEventController* _tmp146_;
	GtkBox* _tmp147_;
	GtkButton* send_button = NULL;
	GtkButton* _tmp148_;
	GtkMenuButton* _tmp149_;
	GtkMenuButton* _tmp150_;
	GtkMenuButton* _tmp151_;
	GtkMenuButton* _tmp152_;
	GtkMenuButton* _tmp153_;
	GtkMenuButton* _tmp154_;
	DcStickerPicker* sticker_picker = NULL;
	DcStickerPicker* _tmp155_;
	GtkMenuButton* _tmp156_;
	GtkBox* idle_actions = NULL;
	GtkBox* _tmp157_;
	GtkMenuButton* _tmp158_;
	GtkButton* record_button = NULL;
	GtkButton* _tmp159_;
	GtkStack* _tmp160_;
	GtkStack* _tmp161_;
	GtkStack* _tmp162_;
	GtkStack* _tmp163_;
	GtkStack* _tmp164_;
	GtkBox* _tmp165_;
	GtkStack* _tmp166_;
	GtkBox* recording_row = NULL;
	GtkBox* _tmp167_;
	GtkButton* cancel_recording_button = NULL;
	GtkButton* _tmp168_;
	GtkLabel* _tmp169_;
	GtkLabel* _tmp170_;
	GtkLabel* _tmp171_;
	GtkLabel* _tmp172_;
	GtkButton* _tmp173_;
	GtkButton* _tmp174_;
	GtkButton* _tmp175_;
	GtkButton* _tmp176_;
	GtkButton* _tmp177_;
	GtkButton* _tmp178_;
	GtkButton* _tmp179_;
	GtkButton* _tmp180_;
	GtkButton* _tmp181_;
	GtkButton* recording_send_button = NULL;
	GtkButton* _tmp182_;
	GtkStack* _tmp183_;
	GtkStack* _tmp184_;
	GtkStack* _tmp185_;
	GtkButton* _tmp186_;
	GtkStack* _tmp187_;
	GtkStack* _tmp188_;
	GtkStack* _tmp189_;
	GtkStack* _tmp190_;
	GtkBox* _tmp191_;
	GtkStack* _tmp192_;
	GtkStack* _tmp193_;
	GtkStack* _tmp194_;
	self = (DcComposeBar*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 0, NULL);
	gtk_widget_add_css_class ((GtkWidget*) self, "compose-bar");
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_FILL);
	gtk_widget_set_margin_start ((GtkWidget*) self, 8);
	gtk_widget_set_margin_end ((GtkWidget*) self, 8);
	gtk_widget_set_margin_top ((GtkWidget*) self, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 6);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->reply_bar);
	self->priv->reply_bar = _tmp0_;
	_tmp1_ = self->priv->reply_bar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "reply-bar");
	_tmp2_ = self->priv->reply_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, FALSE);
	_tmp3_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->reply_label);
	self->priv->reply_label = _tmp3_;
	_tmp4_ = self->priv->reply_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "reply-label");
	_tmp5_ = self->priv->reply_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp5_, GTK_ALIGN_START);
	_tmp6_ = self->priv->reply_label;
	gtk_widget_set_valign ((GtkWidget*) _tmp6_, GTK_ALIGN_START);
	_tmp7_ = self->priv->reply_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp7_, TRUE);
	_tmp8_ = self->priv->reply_label;
	gtk_label_set_xalign (_tmp8_, (gfloat) 0);
	_tmp9_ = self->priv->reply_label;
	gtk_label_set_wrap (_tmp9_, TRUE);
	_tmp10_ = self->priv->reply_label;
	gtk_label_set_wrap_mode (_tmp10_, PANGO_WRAP_WORD_CHAR);
	_tmp11_ = self->priv->reply_label;
	gtk_label_set_lines (_tmp11_, 3);
	_tmp12_ = self->priv->reply_label;
	gtk_label_set_ellipsize (_tmp12_, PANGO_ELLIPSIZE_END);
	_tmp13_ = self->priv->reply_bar;
	_tmp14_ = self->priv->reply_label;
	gtk_box_append (_tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = dc_compose_bar_icon_button (self, "window-close-symbolic", "Cancel reply", TRUE, "flat");
	cancel_reply_button = _tmp15_;
	_tmp16_ = cancel_reply_button;
	g_signal_connect_object (_tmp16_, "clicked", (GCallback) _dc_compose_bar_cancel_reply_gtk_button_clicked, self, 0);
	_tmp17_ = self->priv->reply_bar;
	_tmp18_ = cancel_reply_button;
	gtk_box_append (_tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = self->priv->reply_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp19_);
	_tmp20_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp20_);
	_g_object_unref0 (self->priv->attachment_bar);
	self->priv->attachment_bar = _tmp20_;
	_tmp21_ = self->priv->attachment_bar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp21_, "attachment-bar");
	_tmp22_ = self->priv->attachment_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp22_, FALSE);
	_tmp23_ = (GtkPicture*) gtk_picture_new ();
	g_object_ref_sink (_tmp23_);
	_g_object_unref0 (self->priv->attachment_picture);
	self->priv->attachment_picture = _tmp23_;
	_tmp24_ = self->priv->attachment_picture;
	gtk_widget_add_css_class ((GtkWidget*) _tmp24_, "attachment-preview-image");
	_tmp25_ = self->priv->attachment_picture;
	gtk_picture_set_content_fit (_tmp25_, GTK_CONTENT_FIT_COVER);
	_tmp26_ = self->priv->attachment_picture;
	gtk_widget_set_size_request ((GtkWidget*) _tmp26_, 72, 72);
	_tmp27_ = self->priv->attachment_picture;
	gtk_picture_set_can_shrink (_tmp27_, TRUE);
	_tmp28_ = self->priv->attachment_bar;
	_tmp29_ = self->priv->attachment_picture;
	gtk_box_append (_tmp28_, (GtkWidget*) _tmp29_);
	_tmp30_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp30_);
	_g_object_unref0 (self->priv->attachment_icon);
	self->priv->attachment_icon = _tmp30_;
	_tmp31_ = self->priv->attachment_icon;
	gtk_widget_add_css_class ((GtkWidget*) _tmp31_, "attachment-preview-icon");
	_tmp32_ = self->priv->attachment_icon;
	gtk_image_set_pixel_size (_tmp32_, 36);
	_tmp33_ = self->priv->attachment_icon;
	gtk_widget_set_valign ((GtkWidget*) _tmp33_, GTK_ALIGN_CENTER);
	_tmp34_ = self->priv->attachment_bar;
	_tmp35_ = self->priv->attachment_icon;
	gtk_box_append (_tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	g_object_ref_sink (_tmp36_);
	attachment_info = _tmp36_;
	_tmp37_ = attachment_info;
	gtk_widget_set_valign ((GtkWidget*) _tmp37_, GTK_ALIGN_CENTER);
	_tmp38_ = attachment_info;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp38_, TRUE);
	_tmp39_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp39_);
	_g_object_unref0 (self->priv->attachment_name_label);
	self->priv->attachment_name_label = _tmp39_;
	_tmp40_ = self->priv->attachment_name_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp40_, "attachment-preview-name");
	_tmp41_ = self->priv->attachment_name_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp41_, GTK_ALIGN_START);
	_tmp42_ = self->priv->attachment_name_label;
	gtk_label_set_xalign (_tmp42_, (gfloat) 0);
	_tmp43_ = self->priv->attachment_name_label;
	gtk_label_set_ellipsize (_tmp43_, PANGO_ELLIPSIZE_MIDDLE);
	_tmp44_ = self->priv->attachment_name_label;
	gtk_label_set_max_width_chars (_tmp44_, 40);
	_tmp45_ = self->priv->attachment_name_label;
	gtk_label_set_single_line_mode (_tmp45_, TRUE);
	_tmp46_ = attachment_info;
	_tmp47_ = self->priv->attachment_name_label;
	gtk_box_append (_tmp46_, (GtkWidget*) _tmp47_);
	_tmp48_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp48_);
	_g_object_unref0 (self->priv->attachment_meta_label);
	self->priv->attachment_meta_label = _tmp48_;
	_tmp49_ = self->priv->attachment_meta_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp49_, "attachment-preview-meta");
	_tmp50_ = self->priv->attachment_meta_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp50_, GTK_ALIGN_START);
	_tmp51_ = self->priv->attachment_meta_label;
	gtk_label_set_xalign (_tmp51_, (gfloat) 0);
	_tmp52_ = self->priv->attachment_meta_label;
	gtk_label_set_ellipsize (_tmp52_, PANGO_ELLIPSIZE_END);
	_tmp53_ = attachment_info;
	_tmp54_ = self->priv->attachment_meta_label;
	gtk_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = self->priv->attachment_bar;
	_tmp56_ = attachment_info;
	gtk_box_append (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = dc_compose_bar_icon_button (self, "window-close-symbolic", "Remove attachment", TRUE, "flat");
	remove_attachment_button = _tmp57_;
	_tmp58_ = remove_attachment_button;
	g_signal_connect_object (_tmp58_, "clicked", (GCallback) _dc_compose_bar_clear_attachment_gtk_button_clicked, self, 0);
	_tmp59_ = self->priv->attachment_bar;
	_tmp60_ = remove_attachment_button;
	gtk_box_append (_tmp59_, (GtkWidget*) _tmp60_);
	_tmp61_ = self->priv->attachment_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp61_);
	_tmp62_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (self->priv->long_msg_bar);
	self->priv->long_msg_bar = _tmp62_;
	_tmp63_ = self->priv->long_msg_bar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp63_, "long-message-bar");
	_tmp64_ = self->priv->long_msg_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp64_, FALSE);
	_tmp65_ = (GtkImage*) gtk_image_new_from_icon_name ("dialog-information-symbolic");
	g_object_ref_sink (_tmp65_);
	long_msg_icon = _tmp65_;
	_tmp66_ = self->priv->long_msg_bar;
	_tmp67_ = long_msg_icon;
	gtk_box_append (_tmp66_, (GtkWidget*) _tmp67_);
	_tmp68_ = (GtkLabel*) gtk_label_new ("Long message: recipients get a shortened preview with a " "“Show Full Message” button, and it cannot be " "edited after sending");
	g_object_ref_sink (_tmp68_);
	long_msg_label = _tmp68_;
	_tmp69_ = long_msg_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp69_, "long-message-label");
	_tmp70_ = long_msg_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp70_, GTK_ALIGN_START);
	_tmp71_ = long_msg_label;
	gtk_label_set_xalign (_tmp71_, (gfloat) 0);
	_tmp72_ = long_msg_label;
	gtk_label_set_wrap (_tmp72_, TRUE);
	_tmp73_ = self->priv->long_msg_bar;
	_tmp74_ = long_msg_label;
	gtk_box_append (_tmp73_, (GtkWidget*) _tmp74_);
	_tmp75_ = self->priv->long_msg_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp75_);
	_tmp76_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp76_);
	input_row = _tmp76_;
	_tmp77_ = input_row;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp77_, TRUE);
	_tmp78_ = input_row;
	gtk_widget_set_halign ((GtkWidget*) _tmp78_, GTK_ALIGN_FILL);
	_tmp79_ = dc_compose_bar_icon_button (self, "mail-attachment-symbolic", "Attach file", FALSE, "flat");
	_g_object_unref0 (self->priv->attach_button);
	self->priv->attach_button = _tmp79_;
	_tmp80_ = self->priv->attach_button;
	g_signal_connect_object (_tmp80_, "clicked", (GCallback) _dc_compose_bar_on_attach_clicked_gtk_button_clicked, self, 0);
	_tmp81_ = self->priv->attach_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp81_, GTK_ALIGN_END);
	_tmp82_ = input_row;
	_tmp83_ = self->priv->attach_button;
	gtk_box_append (_tmp82_, (GtkWidget*) _tmp83_);
	_tmp84_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp84_);
	_g_object_unref0 (self->priv->emoji_button);
	self->priv->emoji_button = _tmp84_;
	_tmp85_ = self->priv->emoji_button;
	gtk_menu_button_set_icon_name (_tmp85_, "face-smile-symbolic");
	_tmp86_ = self->priv->emoji_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp86_, "flat");
	_tmp87_ = self->priv->emoji_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp87_, "Insert emoji");
	_tmp88_ = self->priv->emoji_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp88_, GTK_ALIGN_END);
	_tmp89_ = dc_create_emoji_chooser ();
	emoji_chooser = _tmp89_;
	_tmp90_ = emoji_chooser;
	if (_tmp90_ != NULL) {
		GtkEmojiChooser* _tmp91_;
		GtkEmojiChooser* _tmp92_;
		GtkMenuButton* _tmp93_;
		GtkEmojiChooser* _tmp94_;
		_tmp91_ = emoji_chooser;
		g_signal_connect_object (_tmp91_, "emoji-picked", (GCallback) _dc_compose_bar_on_emoji_picked_gtk_emoji_chooser_emoji_picked, self, 0);
		_tmp92_ = emoji_chooser;
		g_signal_connect_object ((GtkPopover*) _tmp92_, "closed", (GCallback) ____lambda22__gtk_popover_closed, self, 0);
		_tmp93_ = self->priv->emoji_button;
		_tmp94_ = emoji_chooser;
		gtk_menu_button_set_popover (_tmp93_, (GtkPopover*) _tmp94_);
	} else {
		GtkMenuButton* _tmp95_;
		GtkMenuButton* _tmp96_;
		_tmp95_ = self->priv->emoji_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp95_, FALSE);
		_tmp96_ = self->priv->emoji_button;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp96_, "Emoji picker unavailable");
	}
	_tmp97_ = input_row;
	_tmp98_ = self->priv->emoji_button;
	gtk_box_append (_tmp97_, (GtkWidget*) _tmp98_);
	_tmp99_ = dc_compose_bar_icon_button (self, "edit-clear-symbolic", "Remove attachment", FALSE, "flat");
	_g_object_unref0 (self->priv->cancel_attach_button);
	self->priv->cancel_attach_button = _tmp99_;
	_tmp100_ = self->priv->cancel_attach_button;
	g_signal_connect_object (_tmp100_, "clicked", (GCallback) _dc_compose_bar_clear_attachment_gtk_button_clicked, self, 0);
	_tmp101_ = self->priv->cancel_attach_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp101_, FALSE);
	_tmp102_ = self->priv->cancel_attach_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp102_, GTK_ALIGN_END);
	_tmp103_ = input_row;
	_tmp104_ = self->priv->cancel_attach_button;
	gtk_box_append (_tmp103_, (GtkWidget*) _tmp104_);
	_tmp105_ = dc_compose_bar_icon_button (self, "edit-undo-symbolic", "Cancel editing", FALSE, "flat");
	_g_object_unref0 (self->priv->cancel_edit_button);
	self->priv->cancel_edit_button = _tmp105_;
	_tmp106_ = self->priv->cancel_edit_button;
	g_signal_connect_object (_tmp106_, "clicked", (GCallback) _dc_compose_bar_cancel_edit_gtk_button_clicked, self, 0);
	_tmp107_ = self->priv->cancel_edit_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp107_, FALSE);
	_tmp108_ = self->priv->cancel_edit_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp108_, GTK_ALIGN_END);
	_tmp109_ = input_row;
	_tmp110_ = self->priv->cancel_edit_button;
	gtk_box_append (_tmp109_, (GtkWidget*) _tmp110_);
	_tmp111_ = (GtkTextView*) gtk_text_view_new ();
	g_object_ref_sink (_tmp111_);
	_g_object_unref0 (self->priv->text_view);
	self->priv->text_view = _tmp111_;
	_tmp112_ = self->priv->text_view;
	gtk_text_view_set_wrap_mode (_tmp112_, GTK_WRAP_WORD_CHAR);
	_tmp113_ = self->priv->text_view;
	gtk_text_view_set_accepts_tab (_tmp113_, FALSE);
	_tmp114_ = self->priv->text_view;
	gtk_text_view_set_top_margin (_tmp114_, 8);
	_tmp115_ = self->priv->text_view;
	gtk_text_view_set_bottom_margin (_tmp115_, 8);
	_tmp116_ = self->priv->text_view;
	gtk_text_view_set_left_margin (_tmp116_, 12);
	_tmp117_ = self->priv->text_view;
	gtk_text_view_set_right_margin (_tmp117_, 12);
	_tmp118_ = self->priv->text_view;
	gtk_text_view_set_pixels_above_lines (_tmp118_, 0);
	_tmp119_ = self->priv->text_view;
	gtk_text_view_set_pixels_below_lines (_tmp119_, 0);
	_tmp120_ = self->priv->text_view;
	gtk_text_view_set_pixels_inside_wrap (_tmp120_, 0);
	_tmp121_ = self->priv->text_view;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp121_, TRUE);
	_tmp122_ = self->priv->text_view;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp122_, FALSE);
	_tmp123_ = self->priv->text_view;
	gtk_widget_add_css_class ((GtkWidget*) _tmp123_, "compose-entry");
	_tmp124_ = self->priv->placeholder_default;
	_tmp125_ = (GtkLabel*) gtk_label_new (_tmp124_);
	g_object_ref_sink (_tmp125_);
	_g_object_unref0 (self->priv->placeholder_label);
	self->priv->placeholder_label = _tmp125_;
	_tmp126_ = self->priv->placeholder_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp126_, "compose-placeholder");
	_tmp127_ = self->priv->placeholder_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp127_, GTK_ALIGN_START);
	_tmp128_ = self->priv->placeholder_label;
	gtk_widget_set_valign ((GtkWidget*) _tmp128_, GTK_ALIGN_START);
	_tmp129_ = self->priv->placeholder_label;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp129_, 12);
	_tmp130_ = self->priv->placeholder_label;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp130_, 8);
	_tmp131_ = self->priv->placeholder_label;
	gtk_widget_set_can_target ((GtkWidget*) _tmp131_, FALSE);
	_tmp132_ = self->priv->placeholder_label;
	gtk_label_set_ellipsize (_tmp132_, PANGO_ELLIPSIZE_END);
	_tmp133_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp133_);
	entry_scroll = _tmp133_;
	g_object_set (entry_scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set (entry_scroll, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	gtk_scrolled_window_set_propagate_natural_height (entry_scroll, TRUE);
	gtk_scrolled_window_set_min_content_height (entry_scroll, 36);
	gtk_scrolled_window_set_max_content_height (entry_scroll, 220);
	gtk_widget_add_css_class ((GtkWidget*) entry_scroll, "compose-entry-scroll");
	_tmp134_ = self->priv->text_view;
	gtk_scrolled_window_set_child (entry_scroll, (GtkWidget*) _tmp134_);
	_tmp135_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp135_);
	entry_overlay = _tmp135_;
	gtk_overlay_set_child (entry_overlay, (GtkWidget*) entry_scroll);
	_tmp136_ = self->priv->placeholder_label;
	gtk_overlay_add_overlay (entry_overlay, (GtkWidget*) _tmp136_);
	gtk_widget_set_hexpand ((GtkWidget*) entry_overlay, TRUE);
	gtk_widget_set_halign ((GtkWidget*) entry_overlay, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) entry_overlay, GTK_ALIGN_CENTER);
	_tmp137_ = self->priv->text_view;
	_tmp138_ = gtk_text_view_get_buffer (_tmp137_);
	_tmp139_ = _tmp138_;
	g_signal_connect_object (_tmp139_, "changed", (GCallback) ___lambda24__gtk_text_buffer_changed, self, 0);
	_tmp140_ = self->priv->text_view;
	g_signal_connect_object (_tmp140_, "paste-clipboard", (GCallback) _dc_compose_bar_on_paste_clipboard_gtk_text_view_paste_clipboard, self, 0);
	dc_compose_bar_update_placeholder (self);
	_tmp141_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	focus_ctrl = _tmp141_;
	g_signal_connect_object (focus_ctrl, "enter", (GCallback) ___lambda25__gtk_event_controller_focus_enter, self, 0);
	g_signal_connect_object (focus_ctrl, "leave", (GCallback) ___lambda26__gtk_event_controller_focus_leave, self, 0);
	_tmp142_ = self->priv->text_view;
	_tmp143_ = _g_object_ref0 ((GtkEventController*) focus_ctrl);
	gtk_widget_add_controller ((GtkWidget*) _tmp142_, _tmp143_);
	_tmp144_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key_ctrl = _tmp144_;
	g_signal_connect_object (key_ctrl, "key-pressed", (GCallback) _dc_compose_bar_on_entry_key_pressed_gtk_event_controller_key_key_pressed, self, 0);
	_tmp145_ = self->priv->text_view;
	_tmp146_ = _g_object_ref0 ((GtkEventController*) key_ctrl);
	gtk_widget_add_controller ((GtkWidget*) _tmp145_, _tmp146_);
	_tmp147_ = input_row;
	gtk_box_append (_tmp147_, (GtkWidget*) entry_overlay);
	_tmp148_ = dc_compose_bar_icon_button (self, "go-up-symbolic", "Send message", TRUE, "suggested-action");
	send_button = _tmp148_;
	g_signal_connect_object (send_button, "clicked", (GCallback) _dc_compose_bar_on_send_gtk_button_clicked, self, 0);
	_tmp149_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp149_);
	_g_object_unref0 (self->priv->sticker_button);
	self->priv->sticker_button = _tmp149_;
	_tmp150_ = self->priv->sticker_button;
	gtk_menu_button_set_icon_name (_tmp150_, "sticker-symbolic");
	_tmp151_ = self->priv->sticker_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp151_, "flat");
	_tmp152_ = self->priv->sticker_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp152_, "circular");
	_tmp153_ = self->priv->sticker_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp153_, "Send a sticker");
	_tmp154_ = self->priv->sticker_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp154_, GTK_ALIGN_CENTER);
	_tmp155_ = dc_sticker_picker_new ();
	g_object_ref_sink (_tmp155_);
	sticker_picker = _tmp155_;
	g_signal_connect_object (sticker_picker, "sticker-picked", (GCallback) _dc_compose_bar_on_sticker_picked_dc_sticker_picker_sticker_picked, self, 0);
	_tmp156_ = self->priv->sticker_button;
	gtk_menu_button_set_popover (_tmp156_, (GtkPopover*) sticker_picker);
	_tmp157_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp157_);
	idle_actions = _tmp157_;
	_tmp158_ = self->priv->sticker_button;
	gtk_box_append (idle_actions, (GtkWidget*) _tmp158_);
	_tmp159_ = dc_compose_bar_icon_button (self, "audio-input-microphone-symbolic", "Record a voice message", TRUE, "flat");
	record_button = _tmp159_;
	g_signal_connect_object (record_button, "clicked", (GCallback) _dc_compose_bar_start_audio_recording_gtk_button_clicked, self, 0);
	gtk_box_append (idle_actions, (GtkWidget*) record_button);
	_tmp160_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp160_);
	_g_object_unref0 (self->priv->send_stack);
	self->priv->send_stack = _tmp160_;
	_tmp161_ = self->priv->send_stack;
	gtk_widget_set_valign ((GtkWidget*) _tmp161_, GTK_ALIGN_END);
	_tmp162_ = self->priv->send_stack;
	gtk_stack_set_hhomogeneous (_tmp162_, FALSE);
	_tmp163_ = self->priv->send_stack;
	gtk_stack_add_named (_tmp163_, (GtkWidget*) send_button, "send");
	_tmp164_ = self->priv->send_stack;
	gtk_stack_add_named (_tmp164_, (GtkWidget*) idle_actions, "idle");
	_tmp165_ = input_row;
	_tmp166_ = self->priv->send_stack;
	gtk_box_append (_tmp165_, (GtkWidget*) _tmp166_);
	dc_compose_bar_update_send_stack (self);
	_tmp167_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp167_);
	recording_row = _tmp167_;
	gtk_widget_set_hexpand ((GtkWidget*) recording_row, TRUE);
	_tmp168_ = dc_compose_bar_icon_button (self, "window-close-symbolic", "Cancel voice message", TRUE, "flat");
	cancel_recording_button = _tmp168_;
	g_signal_connect_object (cancel_recording_button, "clicked", (GCallback) _dc_compose_bar_cancel_audio_recording_gtk_button_clicked, self, 0);
	gtk_box_append (recording_row, (GtkWidget*) cancel_recording_button);
	_tmp169_ = (GtkLabel*) gtk_label_new ("00:00");
	g_object_ref_sink (_tmp169_);
	_g_object_unref0 (self->priv->recording_time_label);
	self->priv->recording_time_label = _tmp169_;
	_tmp170_ = self->priv->recording_time_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp170_, TRUE);
	_tmp171_ = self->priv->recording_time_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp171_, GTK_ALIGN_CENTER);
	_tmp172_ = self->priv->recording_time_label;
	gtk_box_append (recording_row, (GtkWidget*) _tmp172_);
	_tmp173_ = dc_compose_bar_icon_button (self, "media-playback-stop-symbolic", "Stop recording", TRUE, "destructive-action");
	_g_object_unref0 (self->priv->recording_stop_button);
	self->priv->recording_stop_button = _tmp173_;
	_tmp174_ = self->priv->recording_stop_button;
	g_signal_connect_object (_tmp174_, "clicked", (GCallback) _dc_compose_bar_stop_audio_recording_gtk_button_clicked, self, 0);
	_tmp175_ = (GtkButton*) gtk_button_new_with_label ("Transcribe");
	g_object_ref_sink (_tmp175_);
	_g_object_unref0 (self->priv->transcribe_button);
	self->priv->transcribe_button = _tmp175_;
	_tmp176_ = self->priv->transcribe_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp176_, "flat");
	_tmp177_ = self->priv->transcribe_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp177_, GTK_ALIGN_CENTER);
	_tmp178_ = self->priv->transcribe_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp178_, "Transcribe the recording into the message text");
	_tmp179_ = self->priv->transcribe_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp179_, FALSE);
	_tmp180_ = self->priv->transcribe_button;
	g_signal_connect_object (_tmp180_, "clicked", (GCallback) _dc_compose_bar_transcribe_audio_recording_gtk_button_clicked, self, 0);
	_tmp181_ = self->priv->transcribe_button;
	gtk_box_append (recording_row, (GtkWidget*) _tmp181_);
	_tmp182_ = dc_compose_bar_icon_button (self, "go-up-symbolic", "Send voice message", TRUE, "suggested-action");
	recording_send_button = _tmp182_;
	g_signal_connect_object (recording_send_button, "clicked", (GCallback) _dc_compose_bar_send_audio_recording_gtk_button_clicked, self, 0);
	_tmp183_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp183_);
	_g_object_unref0 (self->priv->recording_action_stack);
	self->priv->recording_action_stack = _tmp183_;
	_tmp184_ = self->priv->recording_action_stack;
	gtk_widget_set_valign ((GtkWidget*) _tmp184_, GTK_ALIGN_CENTER);
	_tmp185_ = self->priv->recording_action_stack;
	_tmp186_ = self->priv->recording_stop_button;
	gtk_stack_add_named (_tmp185_, (GtkWidget*) _tmp186_, "stop");
	_tmp187_ = self->priv->recording_action_stack;
	gtk_stack_add_named (_tmp187_, (GtkWidget*) recording_send_button, "send");
	_tmp188_ = self->priv->recording_action_stack;
	gtk_box_append (recording_row, (GtkWidget*) _tmp188_);
	_tmp189_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp189_);
	_g_object_unref0 (self->priv->compose_mode_stack);
	self->priv->compose_mode_stack = _tmp189_;
	_tmp190_ = self->priv->compose_mode_stack;
	_tmp191_ = input_row;
	gtk_stack_add_named (_tmp190_, (GtkWidget*) _tmp191_, "compose");
	_tmp192_ = self->priv->compose_mode_stack;
	gtk_stack_add_named (_tmp192_, (GtkWidget*) recording_row, "recording");
	_tmp193_ = self->priv->compose_mode_stack;
	gtk_stack_set_visible_child_name (_tmp193_, "compose");
	_tmp194_ = self->priv->compose_mode_stack;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp194_);
	dc_compose_bar_build_mention_popover (self);
	_g_object_unref0 (recording_send_button);
	_g_object_unref0 (cancel_recording_button);
	_g_object_unref0 (recording_row);
	_g_object_unref0 (record_button);
	_g_object_unref0 (idle_actions);
	_g_object_unref0 (sticker_picker);
	_g_object_unref0 (send_button);
	_g_object_unref0 (key_ctrl);
	_g_object_unref0 (focus_ctrl);
	_g_object_unref0 (entry_overlay);
	_g_object_unref0 (entry_scroll);
	_g_object_unref0 (emoji_chooser);
	_g_object_unref0 (input_row);
	_g_object_unref0 (long_msg_label);
	_g_object_unref0 (long_msg_icon);
	_g_object_unref0 (remove_attachment_button);
	_g_object_unref0 (attachment_info);
	_g_object_unref0 (cancel_reply_button);
	return self;
}

DcComposeBar*
dc_compose_bar_new (void)
{
	return dc_compose_bar_construct (DC_TYPE_COMPOSE_BAR);
}

/** Release resources that are parented outside the normal box tree or
            connected to process-wide helpers. ConversationView calls this
            before removing an evicted chat from its GtkStack. */
void
dc_compose_bar_close (DcComposeBar* self)
{
	DcAudioRecorder* _tmp2_;
	GtkPopover* _tmp4_;
	GtkPopover* _tmp5_;
	GtkWidget* _tmp6_;
	g_return_if_fail (self != NULL);
	if (self->priv->closed) {
		return;
	}
	self->priv->closed = TRUE;
	dc_compose_bar_stop_recording_timer (self);
	if (self->priv->transcriber_handler != ((gulong) 0)) {
		DcTranscriber* _tmp0_;
		DcTranscriber* _tmp1_;
		_tmp0_ = dc_transcriber_shared ();
		_tmp1_ = _tmp0_;
		g_signal_handler_disconnect ((GObject*) _tmp1_, self->priv->transcriber_handler);
		_g_object_unref0 (_tmp1_);
		self->priv->transcriber_handler = (gulong) 0;
	}
	_tmp2_ = self->priv->audio_recorder;
	if (_tmp2_ != NULL) {
		DcAudioRecorder* _tmp3_;
		_tmp3_ = self->priv->audio_recorder;
		dc_audio_recorder_cancel (_tmp3_);
		_g_object_unref0 (self->priv->audio_recorder);
		self->priv->audio_recorder = NULL;
	}
	self->priv->mention_popup_visible = FALSE;
	_tmp4_ = self->priv->mention_popover;
	gtk_popover_popdown (_tmp4_);
	_tmp5_ = self->priv->mention_popover;
	_tmp6_ = gtk_widget_get_parent ((GtkWidget*) _tmp5_);
	if (_tmp6_ != NULL) {
		GtkPopover* _tmp7_;
		_tmp7_ = self->priv->mention_popover;
		gtk_widget_unparent ((GtkWidget*) _tmp7_);
	}
}

static void
dc_compose_bar_real_dispose (GObject* base)
{
	DcComposeBar * self;
	self = (DcComposeBar*) base;
	dc_compose_bar_close (self);
	G_OBJECT_CLASS (dc_compose_bar_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
}

static void
__lambda37_ (DcComposeBar* self,
             GtkListBoxRow* row)
{
	g_return_if_fail (row != NULL);
	self->priv->mention_index = gtk_list_box_row_get_index (row);
	dc_compose_bar_accept_mention (self);
}

static void
___lambda37__gtk_list_box_row_activated (GtkListBox* _sender,
                                         GtkListBoxRow* row,
                                         gpointer self)
{
	__lambda37_ ((DcComposeBar*) self, row);
}

static void
dc_compose_bar_build_mention_popover (DcComposeBar* self)
{
	GtkListBox* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	GtkListBox* _tmp3_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp4_;
	GtkListBox* _tmp5_;
	GtkPopover* _tmp6_;
	GtkPopover* _tmp7_;
	GtkPopover* _tmp8_;
	GtkPopover* _tmp9_;
	GtkPopover* _tmp10_;
	GtkPopover* _tmp11_;
	GtkPopover* _tmp12_;
	GtkTextView* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->mention_list);
	self->priv->mention_list = _tmp0_;
	_tmp1_ = self->priv->mention_list;
	gtk_list_box_set_selection_mode (_tmp1_, GTK_SELECTION_SINGLE);
	_tmp2_ = self->priv->mention_list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "menu");
	_tmp3_ = self->priv->mention_list;
	g_signal_connect_object (_tmp3_, "row-activated", (GCallback) ___lambda37__gtk_list_box_row_activated, self, 0);
	_tmp4_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp4_);
	scroll = _tmp4_;
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	gtk_scrolled_window_set_propagate_natural_height (scroll, TRUE);
	gtk_scrolled_window_set_propagate_natural_width (scroll, TRUE);
	gtk_scrolled_window_set_max_content_height (scroll, 260);
	gtk_scrolled_window_set_min_content_width (scroll, 260);
	gtk_scrolled_window_set_max_content_width (scroll, 360);
	_tmp5_ = self->priv->mention_list;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp5_);
	_tmp6_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->mention_popover);
	self->priv->mention_popover = _tmp6_;
	_tmp7_ = self->priv->mention_popover;
	gtk_popover_set_autohide (_tmp7_, FALSE);
	_tmp8_ = self->priv->mention_popover;
	gtk_popover_set_has_arrow (_tmp8_, FALSE);
	_tmp9_ = self->priv->mention_popover;
	gtk_popover_set_position (_tmp9_, GTK_POS_TOP);
	_tmp10_ = self->priv->mention_popover;
	gtk_widget_add_css_class ((GtkWidget*) _tmp10_, "mention-popover");
	_tmp11_ = self->priv->mention_popover;
	gtk_popover_set_child (_tmp11_, (GtkWidget*) scroll);
	_tmp12_ = self->priv->mention_popover;
	_tmp13_ = self->priv->text_view;
	gtk_widget_set_parent ((GtkWidget*) _tmp12_, (GtkWidget*) _tmp13_);
	_g_object_unref0 (scroll);
}

static GtkButton*
dc_compose_bar_icon_button (DcComposeBar* self,
                            const gchar* icon_name,
                            const gchar* tooltip,
                            gboolean circular,
                            const gchar* style)
{
	GtkButton* button = NULL;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (icon_name != NULL, NULL);
	g_return_val_if_fail (tooltip != NULL, NULL);
	g_return_val_if_fail (style != NULL, NULL);
	_tmp0_ = (GtkButton*) gtk_button_new_from_icon_name (icon_name);
	g_object_ref_sink (_tmp0_);
	button = _tmp0_;
	_tmp1_ = button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, style);
	if (circular) {
		GtkButton* _tmp2_;
		_tmp2_ = button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "circular");
	}
	_tmp3_ = button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp3_, tooltip);
	_tmp4_ = button;
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_CENTER);
	result = button;
	return result;
}

void
dc_compose_bar_set_mention_roster (DcComposeBar* self,
                                   DcMentionRoster* roster)
{
	DcMentionRoster* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (roster);
	_g_object_unref0 (self->priv->mention_roster);
	self->priv->mention_roster = _tmp0_;
	if (roster == NULL) {
		dc_compose_bar_hide_mention_popup (self);
	}
}

static gint
vala_g_ptr_array_get_length (GPtrArray* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) self->len;
	return result;
}

static void
dc_compose_bar_update_mention_popup (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	DcMentionRoster* _tmp2_;
	GtkTextIter cursor = {0};
	GtkTextView* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextView* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkTextBuffer* _tmp9_;
	GtkTextMark* _tmp10_;
	GtkTextIter _tmp11_ = {0};
	GtkTextIter at_iter = {0};
	GtkTextIter _tmp12_;
	gboolean found = FALSE;
	GtkTextIter probe = {0};
	GtkTextIter _tmp13_;
	gint steps = 0;
	GtkTextIter q = {0};
	GtkTextIter _tmp18_;
	gchar* query = NULL;
	GtkTextView* _tmp19_;
	GtkTextBuffer* _tmp20_;
	GtkTextBuffer* _tmp21_;
	GtkTextIter _tmp22_;
	GtkTextIter _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	GPtrArray* _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	GtkTextBuffer* buf = NULL;
	GtkTextView* _tmp29_;
	GtkTextBuffer* _tmp30_;
	GtkTextBuffer* _tmp31_;
	GtkTextBuffer* _tmp32_;
	GtkTextMark* mark = NULL;
	GtkTextBuffer* _tmp33_;
	GtkTextMark* _tmp34_;
	GtkTextMark* _tmp35_;
	GtkTextMark* _tmp36_;
	GtkTextIter _tmp42_;
	g_return_if_fail (self != NULL);
	_tmp2_ = self->priv->mention_roster;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		DcMentionRoster* _tmp3_;
		_tmp3_ = self->priv->mention_roster;
		_tmp1_ = !dc_mention_roster_has_members (_tmp3_);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->editing_msg_id > 0;
	}
	if (_tmp0_) {
		dc_compose_bar_hide_mention_popup (self);
		return;
	}
	_tmp4_ = self->priv->text_view;
	_tmp5_ = gtk_text_view_get_buffer (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->text_view;
	_tmp8_ = gtk_text_view_get_buffer (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = gtk_text_buffer_get_insert (_tmp9_);
	gtk_text_buffer_get_iter_at_mark (_tmp6_, &_tmp11_, _tmp10_);
	cursor = _tmp11_;
	_tmp12_ = cursor;
	at_iter = _tmp12_;
	found = FALSE;
	_tmp13_ = cursor;
	probe = _tmp13_;
	steps = 0;
	while (TRUE) {
		gunichar ch = 0U;
		gint _tmp17_;
		if (!gtk_text_iter_backward_char (&probe)) {
			break;
		}
		ch = gtk_text_iter_get_char (&probe);
		if (ch == ((gunichar) '@')) {
			GtkTextIter before = {0};
			GtkTextIter _tmp14_;
			gboolean _tmp15_ = FALSE;
			gboolean boundary = FALSE;
			_tmp14_ = probe;
			before = _tmp14_;
			if (!gtk_text_iter_backward_char (&before)) {
				_tmp15_ = TRUE;
			} else {
				_tmp15_ = g_unichar_isspace (gtk_text_iter_get_char (&before));
			}
			boundary = _tmp15_;
			if (boundary) {
				GtkTextIter _tmp16_;
				found = TRUE;
				_tmp16_ = probe;
				at_iter = _tmp16_;
			}
			break;
		}
		if (g_unichar_isspace (ch)) {
			break;
		}
		steps = steps + 1;
		_tmp17_ = steps;
		if (_tmp17_ > 64) {
			break;
		}
	}
	if (!found) {
		dc_compose_bar_hide_mention_popup (self);
		return;
	}
	_tmp18_ = at_iter;
	q = _tmp18_;
	gtk_text_iter_forward_char (&q);
	_tmp19_ = self->priv->text_view;
	_tmp20_ = gtk_text_view_get_buffer (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = q;
	_tmp23_ = cursor;
	_tmp24_ = gtk_text_buffer_get_text (_tmp21_, &_tmp22_, &_tmp23_, FALSE);
	query = _tmp24_;
	_tmp25_ = query;
	dc_compose_bar_populate_mention_list (self, _tmp25_);
	_tmp26_ = self->priv->mention_tokens;
	_tmp27_ = vala_g_ptr_array_get_length (_tmp26_);
	_tmp28_ = _tmp27_;
	if (_tmp28_ == 0) {
		dc_compose_bar_hide_mention_popup (self);
		_g_free0 (query);
		return;
	}
	_tmp29_ = self->priv->text_view;
	_tmp30_ = gtk_text_view_get_buffer (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = _g_object_ref0 (_tmp31_);
	buf = _tmp32_;
	_tmp33_ = buf;
	_tmp34_ = gtk_text_buffer_get_mark (_tmp33_, DC_COMPOSE_BAR_MENTION_ANCHOR_MARK);
	_tmp35_ = _g_object_ref0 (_tmp34_);
	mark = _tmp35_;
	_tmp36_ = mark;
	if (_tmp36_ != NULL) {
		GtkTextBuffer* _tmp37_;
		GtkTextMark* _tmp38_;
		GtkTextIter _tmp39_;
		_tmp37_ = buf;
		_tmp38_ = mark;
		_tmp39_ = at_iter;
		gtk_text_buffer_move_mark (_tmp37_, _tmp38_, &_tmp39_);
	} else {
		GtkTextBuffer* _tmp40_;
		GtkTextIter _tmp41_;
		_tmp40_ = buf;
		_tmp41_ = at_iter;
		gtk_text_buffer_create_mark (_tmp40_, DC_COMPOSE_BAR_MENTION_ANCHOR_MARK, &_tmp41_, TRUE);
	}
	_tmp42_ = cursor;
	dc_compose_bar_position_and_show_mention_popup (self, &_tmp42_);
	_g_object_unref0 (mark);
	_g_object_unref0 (buf);
	_g_free0 (query);
}

static gpointer
_g_ptr_array_ref0 (gpointer self)
{
	return self ? g_ptr_array_ref (self) : NULL;
}

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 void
dc_compose_bar_populate_mention_list (DcComposeBar* self,
                                      const gchar* query)
{
	GtkListBox* _tmp0_;
	GPtrArray* _tmp1_;
	gchar* q = NULL;
	gchar* _tmp2_;
	GPtrArray* members = NULL;
	DcMentionRoster* _tmp3_;
	GPtrArray* _tmp4_;
	GPtrArray* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (query != NULL);
	_tmp0_ = self->priv->mention_list;
	dc_clear_listbox (_tmp0_);
	_tmp1_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	_g_ptr_array_unref0 (self->priv->mention_tokens);
	self->priv->mention_tokens = _tmp1_;
	_tmp2_ = g_utf8_strdown (query, (gssize) -1);
	q = _tmp2_;
	_tmp3_ = self->priv->mention_roster;
	_tmp4_ = _tmp3_->members;
	_tmp5_ = _g_ptr_array_ref0 (_tmp4_);
	members = _tmp5_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				gboolean _tmp8_ = FALSE;
				GPtrArray* _tmp9_;
				gint _tmp10_;
				gint _tmp11_;
				DcMentionMember* m = NULL;
				GPtrArray* _tmp15_;
				gconstpointer _tmp16_;
				DcMentionMember* _tmp17_;
				DcMentionMember* _tmp18_;
				gboolean _tmp19_;
				gboolean _tmp20_;
				gchar* name = NULL;
				DcMentionMember* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				gchar* _tmp24_;
				gboolean _tmp25_ = FALSE;
				const gchar* _tmp26_;
				gint _tmp27_;
				gint _tmp28_;
				gboolean _tmp52_ = FALSE;
				gboolean _tmp53_ = FALSE;
				DcMentionMember* _tmp54_;
				const gchar* _tmp55_;
				const gchar* _tmp56_;
				gint _tmp57_;
				gint _tmp58_;
				if (!_tmp6_) {
					gint _tmp7_;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp6_ = FALSE;
				_tmp9_ = members;
				_tmp10_ = vala_g_ptr_array_get_length (_tmp9_);
				_tmp11_ = _tmp10_;
				if (i < _tmp11_) {
					GPtrArray* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = self->priv->mention_tokens;
					_tmp13_ = vala_g_ptr_array_get_length (_tmp12_);
					_tmp14_ = _tmp13_;
					_tmp8_ = _tmp14_ < 12;
				} else {
					_tmp8_ = FALSE;
				}
				if (!_tmp8_) {
					break;
				}
				_tmp15_ = members;
				_tmp16_ = g_ptr_array_index (_tmp15_, (guint) i);
				_tmp17_ = _g_object_ref0 ((DcMentionMember*) _tmp16_);
				m = _tmp17_;
				_tmp18_ = m;
				_tmp19_ = dc_mention_member_get_is_self (_tmp18_);
				_tmp20_ = _tmp19_;
				if (_tmp20_) {
					_g_object_unref0 (m);
					continue;
				}
				_tmp21_ = m;
				_tmp22_ = dc_mention_member_get_display_name (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_strdup (_tmp23_);
				name = _tmp24_;
				_tmp26_ = name;
				_tmp27_ = strlen (_tmp26_);
				_tmp28_ = _tmp27_;
				if (_tmp28_ > 0) {
					gboolean _tmp29_ = FALSE;
					const gchar* _tmp30_;
					gint _tmp31_;
					gint _tmp32_;
					_tmp30_ = q;
					_tmp31_ = strlen (_tmp30_);
					_tmp32_ = _tmp31_;
					if (_tmp32_ == 0) {
						_tmp29_ = TRUE;
					} else {
						const gchar* _tmp33_;
						gchar* _tmp34_;
						gchar* _tmp35_;
						const gchar* _tmp36_;
						_tmp33_ = name;
						_tmp34_ = g_utf8_strdown (_tmp33_, (gssize) -1);
						_tmp35_ = _tmp34_;
						_tmp36_ = q;
						_tmp29_ = string_contains (_tmp35_, _tmp36_);
						_g_free0 (_tmp35_);
					}
					_tmp25_ = _tmp29_;
				} else {
					_tmp25_ = FALSE;
				}
				if (_tmp25_) {
					const gchar* _tmp37_ = NULL;
					DcMentionMember* _tmp38_;
					const gchar* _tmp39_;
					const gchar* _tmp40_;
					gint _tmp41_;
					gint _tmp42_;
					const gchar* _tmp46_;
					const gchar* _tmp47_;
					DcMentionMember* _tmp48_;
					const gchar* _tmp49_;
					const gchar* _tmp50_;
					const gchar* _tmp51_;
					_tmp38_ = m;
					_tmp39_ = dc_mention_member_get_address (_tmp38_);
					_tmp40_ = _tmp39_;
					_tmp41_ = strlen (_tmp40_);
					_tmp42_ = _tmp41_;
					if (_tmp42_ > 0) {
						DcMentionMember* _tmp43_;
						const gchar* _tmp44_;
						const gchar* _tmp45_;
						_tmp43_ = m;
						_tmp44_ = dc_mention_member_get_address (_tmp43_);
						_tmp45_ = _tmp44_;
						_tmp37_ = _tmp45_;
					} else {
						_tmp37_ = NULL;
					}
					_tmp46_ = name;
					_tmp47_ = name;
					_tmp48_ = m;
					_tmp49_ = dc_mention_member_get_avatar_path (_tmp48_);
					_tmp50_ = _tmp49_;
					_tmp51_ = name;
					dc_compose_bar_add_mention_row (self, _tmp46_, _tmp37_, _tmp47_, _tmp50_, _tmp51_);
				}
				_tmp54_ = m;
				_tmp55_ = dc_mention_member_get_address (_tmp54_);
				_tmp56_ = _tmp55_;
				_tmp57_ = strlen (_tmp56_);
				_tmp58_ = _tmp57_;
				if (_tmp58_ > 0) {
					GPtrArray* _tmp59_;
					gint _tmp60_;
					gint _tmp61_;
					_tmp59_ = self->priv->mention_tokens;
					_tmp60_ = vala_g_ptr_array_get_length (_tmp59_);
					_tmp61_ = _tmp60_;
					_tmp53_ = _tmp61_ < 12;
				} else {
					_tmp53_ = FALSE;
				}
				if (_tmp53_) {
					gboolean _tmp62_ = FALSE;
					const gchar* _tmp63_;
					gint _tmp64_;
					gint _tmp65_;
					_tmp63_ = q;
					_tmp64_ = strlen (_tmp63_);
					_tmp65_ = _tmp64_;
					if (_tmp65_ == 0) {
						_tmp62_ = TRUE;
					} else {
						DcMentionMember* _tmp66_;
						const gchar* _tmp67_;
						const gchar* _tmp68_;
						gchar* _tmp69_;
						gchar* _tmp70_;
						const gchar* _tmp71_;
						_tmp66_ = m;
						_tmp67_ = dc_mention_member_get_address (_tmp66_);
						_tmp68_ = _tmp67_;
						_tmp69_ = g_utf8_strdown (_tmp68_, (gssize) -1);
						_tmp70_ = _tmp69_;
						_tmp71_ = q;
						_tmp62_ = string_contains (_tmp70_, _tmp71_);
						_g_free0 (_tmp70_);
					}
					_tmp52_ = _tmp62_;
				} else {
					_tmp52_ = FALSE;
				}
				if (_tmp52_) {
					const gchar* _tmp72_ = NULL;
					const gchar* _tmp73_;
					gint _tmp74_;
					gint _tmp75_;
					const gchar* _tmp77_ = NULL;
					const gchar* _tmp78_;
					gint _tmp79_;
					gint _tmp80_;
					DcMentionMember* _tmp85_;
					const gchar* _tmp86_;
					const gchar* _tmp87_;
					DcMentionMember* _tmp88_;
					const gchar* _tmp89_;
					const gchar* _tmp90_;
					DcMentionMember* _tmp91_;
					const gchar* _tmp92_;
					const gchar* _tmp93_;
					_tmp73_ = name;
					_tmp74_ = strlen (_tmp73_);
					_tmp75_ = _tmp74_;
					if (_tmp75_ > 0) {
						const gchar* _tmp76_;
						_tmp76_ = name;
						_tmp72_ = _tmp76_;
					} else {
						_tmp72_ = NULL;
					}
					_tmp78_ = name;
					_tmp79_ = strlen (_tmp78_);
					_tmp80_ = _tmp79_;
					if (_tmp80_ > 0) {
						const gchar* _tmp81_;
						_tmp81_ = name;
						_tmp77_ = _tmp81_;
					} else {
						DcMentionMember* _tmp82_;
						const gchar* _tmp83_;
						const gchar* _tmp84_;
						_tmp82_ = m;
						_tmp83_ = dc_mention_member_get_address (_tmp82_);
						_tmp84_ = _tmp83_;
						_tmp77_ = _tmp84_;
					}
					_tmp85_ = m;
					_tmp86_ = dc_mention_member_get_address (_tmp85_);
					_tmp87_ = _tmp86_;
					_tmp88_ = m;
					_tmp89_ = dc_mention_member_get_address (_tmp88_);
					_tmp90_ = _tmp89_;
					_tmp91_ = m;
					_tmp92_ = dc_mention_member_get_avatar_path (_tmp91_);
					_tmp93_ = _tmp92_;
					dc_compose_bar_add_mention_row (self, _tmp87_, _tmp72_, _tmp90_, _tmp93_, _tmp77_);
				}
				_g_free0 (name);
				_g_object_unref0 (m);
			}
		}
	}
	self->priv->mention_index = 0;
	dc_compose_bar_select_mention_index (self);
	_g_ptr_array_unref0 (members);
	_g_free0 (q);
}

static void
dc_compose_bar_add_mention_row (DcComposeBar* self,
                                const gchar* title,
                                const gchar* subtitle,
                                const gchar* token,
                                const gchar* avatar_path,
                                const gchar* avatar_text)
{
	GtkBox* row_box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkWidget* _tmp7_;
	GtkWidget* _tmp8_;
	GtkBox* text_box = NULL;
	GtkBox* _tmp9_;
	GtkBox* _tmp10_;
	GtkBox* _tmp11_;
	GtkLabel* t = NULL;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkLabel* _tmp14_;
	GtkLabel* _tmp15_;
	GtkLabel* _tmp16_;
	GtkBox* _tmp17_;
	GtkLabel* _tmp18_;
	gboolean _tmp19_ = FALSE;
	GtkBox* _tmp31_;
	GtkBox* _tmp32_;
	GtkListBoxRow* row = NULL;
	GtkListBoxRow* _tmp33_;
	GtkBox* _tmp34_;
	GtkListBox* _tmp35_;
	GPtrArray* _tmp36_;
	gchar* _tmp37_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	g_return_if_fail (token != NULL);
	g_return_if_fail (avatar_text != NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp0_);
	row_box = _tmp0_;
	_tmp1_ = row_box;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 8);
	_tmp2_ = row_box;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp2_, 8);
	_tmp3_ = row_box;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp3_, 4);
	_tmp4_ = row_box;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp4_, 4);
	_tmp5_ = row_box;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = row_box;
	_tmp7_ = dc_presence_avatar (28, avatar_text, avatar_path, FALSE, NULL, NULL);
	_tmp8_ = _tmp7_;
	gtk_box_append (_tmp6_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp9_);
	text_box = _tmp9_;
	_tmp10_ = text_box;
	gtk_widget_set_valign ((GtkWidget*) _tmp10_, GTK_ALIGN_CENTER);
	_tmp11_ = text_box;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp11_, TRUE);
	_tmp12_ = (GtkLabel*) gtk_label_new (title);
	g_object_ref_sink (_tmp12_);
	t = _tmp12_;
	_tmp13_ = t;
	gtk_label_set_xalign (_tmp13_, (gfloat) 0);
	_tmp14_ = t;
	gtk_widget_set_halign ((GtkWidget*) _tmp14_, GTK_ALIGN_START);
	_tmp15_ = t;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp15_, TRUE);
	_tmp16_ = t;
	gtk_label_set_ellipsize (_tmp16_, PANGO_ELLIPSIZE_END);
	_tmp17_ = text_box;
	_tmp18_ = t;
	gtk_box_append (_tmp17_, (GtkWidget*) _tmp18_);
	if (subtitle != NULL) {
		gint _tmp20_;
		gint _tmp21_;
		_tmp20_ = strlen (subtitle);
		_tmp21_ = _tmp20_;
		_tmp19_ = _tmp21_ > 0;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		GtkLabel* s = NULL;
		GtkLabel* _tmp22_;
		GtkLabel* _tmp23_;
		GtkLabel* _tmp24_;
		GtkLabel* _tmp25_;
		GtkLabel* _tmp26_;
		GtkLabel* _tmp27_;
		GtkLabel* _tmp28_;
		GtkBox* _tmp29_;
		GtkLabel* _tmp30_;
		_tmp22_ = (GtkLabel*) gtk_label_new (subtitle);
		g_object_ref_sink (_tmp22_);
		s = _tmp22_;
		_tmp23_ = s;
		gtk_widget_add_css_class ((GtkWidget*) _tmp23_, "dim-label");
		_tmp24_ = s;
		gtk_widget_add_css_class ((GtkWidget*) _tmp24_, "caption");
		_tmp25_ = s;
		gtk_label_set_xalign (_tmp25_, (gfloat) 0);
		_tmp26_ = s;
		gtk_widget_set_halign ((GtkWidget*) _tmp26_, GTK_ALIGN_START);
		_tmp27_ = s;
		gtk_widget_set_hexpand ((GtkWidget*) _tmp27_, TRUE);
		_tmp28_ = s;
		gtk_label_set_ellipsize (_tmp28_, PANGO_ELLIPSIZE_END);
		_tmp29_ = text_box;
		_tmp30_ = s;
		gtk_box_append (_tmp29_, (GtkWidget*) _tmp30_);
		_g_object_unref0 (s);
	}
	_tmp31_ = row_box;
	_tmp32_ = text_box;
	gtk_box_append (_tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = (GtkListBoxRow*) gtk_list_box_row_new ();
	g_object_ref_sink (_tmp33_);
	row = _tmp33_;
	_tmp34_ = row_box;
	gtk_list_box_row_set_child (row, (GtkWidget*) _tmp34_);
	_tmp35_ = self->priv->mention_list;
	gtk_list_box_append (_tmp35_, (GtkWidget*) row);
	_tmp36_ = self->priv->mention_tokens;
	_tmp37_ = g_strdup (token);
	g_ptr_array_add (_tmp36_, _tmp37_);
	_g_object_unref0 (row);
	_g_object_unref0 (t);
	_g_object_unref0 (text_box);
	_g_object_unref0 (row_box);
}

static void
dc_compose_bar_position_and_show_mention_popup (DcComposeBar* self,
                                                GtkTextIter* cursor)
{
	GdkRectangle loc = {0};
	GtkTextView* _tmp0_;
	GtkTextIter _tmp1_;
	GdkRectangle _tmp2_ = {0};
	gint wx = 0;
	gint wy = 0;
	GtkTextView* _tmp3_;
	GdkRectangle _tmp4_;
	GdkRectangle _tmp5_;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	GdkRectangle r = {0};
	GdkRectangle _tmp8_;
	GdkRectangle _tmp9_ = {0};
	GtkPopover* _tmp10_;
	GdkRectangle _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cursor != NULL);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = *cursor;
	gtk_text_view_get_iter_location (_tmp0_, &_tmp1_, &_tmp2_);
	loc = _tmp2_;
	_tmp3_ = self->priv->text_view;
	_tmp4_ = loc;
	_tmp5_ = loc;
	gtk_text_view_buffer_to_window_coords (_tmp3_, GTK_TEXT_WINDOW_WIDGET, _tmp4_.x, _tmp5_.y, &_tmp6_, &_tmp7_);
	wx = _tmp6_;
	wy = _tmp7_;
	_tmp8_ = loc;
	_tmp9_.x = wx;
	_tmp9_.y = wy;
	_tmp9_.width = 1;
	_tmp9_.height = _tmp8_.height;
	r = _tmp9_;
	_tmp10_ = self->priv->mention_popover;
	_tmp11_ = r;
	gtk_popover_set_pointing_to (_tmp10_, &_tmp11_);
	if (!self->priv->mention_popup_visible) {
		GtkPopover* _tmp12_;
		_tmp12_ = self->priv->mention_popover;
		gtk_popover_popup (_tmp12_);
		self->priv->mention_popup_visible = TRUE;
	}
}

static void
dc_compose_bar_select_mention_index (DcComposeBar* self)
{
	GtkListBoxRow* row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	GtkListBoxRow* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mention_list;
	_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, self->priv->mention_index);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	row = _tmp2_;
	_tmp3_ = row;
	if (_tmp3_ != NULL) {
		GtkListBox* _tmp4_;
		GtkListBoxRow* _tmp5_;
		_tmp4_ = self->priv->mention_list;
		_tmp5_ = row;
		gtk_list_box_select_row (_tmp4_, _tmp5_);
	}
	_g_object_unref0 (row);
}

static void
dc_compose_bar_move_mention_selection (DcComposeBar* self,
                                       gint delta)
{
	gint n = 0;
	GPtrArray* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mention_tokens;
	_tmp1_ = vala_g_ptr_array_get_length (_tmp0_);
	_tmp2_ = _tmp1_;
	n = (gint) _tmp2_;
	if (n == 0) {
		return;
	}
	self->priv->mention_index = MIN (n - 1, MAX (0, self->priv->mention_index + delta));
	dc_compose_bar_select_mention_index (self);
}

static void
dc_compose_bar_accept_mention (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gchar* token = NULL;
	GPtrArray* _tmp4_;
	gconstpointer _tmp5_;
	gchar* _tmp6_;
	GtkTextBuffer* buf = NULL;
	GtkTextView* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkTextBuffer* _tmp9_;
	GtkTextBuffer* _tmp10_;
	GtkTextMark* mark = NULL;
	GtkTextBuffer* _tmp11_;
	GtkTextMark* _tmp12_;
	GtkTextMark* _tmp13_;
	GtkTextMark* _tmp14_;
	GtkTextIter at_iter = {0};
	GtkTextIter cursor = {0};
	GtkTextBuffer* _tmp15_;
	GtkTextMark* _tmp16_;
	GtkTextIter _tmp17_ = {0};
	GtkTextBuffer* _tmp18_;
	GtkTextBuffer* _tmp19_;
	GtkTextMark* _tmp20_;
	GtkTextIter _tmp21_ = {0};
	GtkTextBuffer* _tmp22_;
	gchar* insert = NULL;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GtkTextBuffer* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	gint _tmp31_;
	gint _tmp32_;
	GtkTextView* _tmp33_;
	g_return_if_fail (self != NULL);
	if (self->priv->mention_index < 0) {
		_tmp0_ = TRUE;
	} else {
		GPtrArray* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		_tmp1_ = self->priv->mention_tokens;
		_tmp2_ = vala_g_ptr_array_get_length (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp0_ = self->priv->mention_index >= _tmp3_;
	}
	if (_tmp0_) {
		dc_compose_bar_hide_mention_popup (self);
		return;
	}
	_tmp4_ = self->priv->mention_tokens;
	_tmp5_ = g_ptr_array_index (_tmp4_, (guint) self->priv->mention_index);
	_tmp6_ = g_strdup ((const gchar*) _tmp5_);
	token = _tmp6_;
	_tmp7_ = self->priv->text_view;
	_tmp8_ = gtk_text_view_get_buffer (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	buf = _tmp10_;
	_tmp11_ = buf;
	_tmp12_ = gtk_text_buffer_get_mark (_tmp11_, DC_COMPOSE_BAR_MENTION_ANCHOR_MARK);
	_tmp13_ = _g_object_ref0 (_tmp12_);
	mark = _tmp13_;
	_tmp14_ = mark;
	if (_tmp14_ == NULL) {
		dc_compose_bar_hide_mention_popup (self);
		_g_object_unref0 (mark);
		_g_object_unref0 (buf);
		_g_free0 (token);
		return;
	}
	_tmp15_ = buf;
	_tmp16_ = mark;
	gtk_text_buffer_get_iter_at_mark (_tmp15_, &_tmp17_, _tmp16_);
	at_iter = _tmp17_;
	_tmp18_ = buf;
	_tmp19_ = buf;
	_tmp20_ = gtk_text_buffer_get_insert (_tmp19_);
	gtk_text_buffer_get_iter_at_mark (_tmp18_, &_tmp21_, _tmp20_);
	cursor = _tmp21_;
	_tmp22_ = buf;
	gtk_text_buffer_delete (_tmp22_, &at_iter, &cursor);
	_tmp23_ = token;
	_tmp24_ = g_strconcat ("@", _tmp23_, NULL);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strconcat (_tmp25_, " ", NULL);
	_tmp27_ = _tmp26_;
	_g_free0 (_tmp25_);
	insert = _tmp27_;
	_tmp28_ = buf;
	_tmp29_ = insert;
	_tmp30_ = insert;
	_tmp31_ = strlen (_tmp30_);
	_tmp32_ = _tmp31_;
	gtk_text_buffer_insert (_tmp28_, &at_iter, _tmp29_, _tmp32_);
	dc_compose_bar_hide_mention_popup (self);
	_tmp33_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp33_);
	_g_free0 (insert);
	_g_object_unref0 (mark);
	_g_object_unref0 (buf);
	_g_free0 (token);
}

static void
dc_compose_bar_hide_mention_popup (DcComposeBar* self)
{
	GtkTextMark* mark = NULL;
	GtkTextView* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextMark* _tmp4_;
	GtkTextMark* _tmp5_;
	GtkTextMark* _tmp6_;
	g_return_if_fail (self != NULL);
	if (self->priv->mention_popup_visible) {
		GtkPopover* _tmp0_;
		_tmp0_ = self->priv->mention_popover;
		gtk_popover_popdown (_tmp0_);
		self->priv->mention_popup_visible = FALSE;
	}
	_tmp1_ = self->priv->text_view;
	_tmp2_ = gtk_text_view_get_buffer (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gtk_text_buffer_get_mark (_tmp3_, DC_COMPOSE_BAR_MENTION_ANCHOR_MARK);
	_tmp5_ = _g_object_ref0 (_tmp4_);
	mark = _tmp5_;
	_tmp6_ = mark;
	if (_tmp6_ != NULL) {
		GtkTextView* _tmp7_;
		GtkTextBuffer* _tmp8_;
		GtkTextBuffer* _tmp9_;
		GtkTextMark* _tmp10_;
		_tmp7_ = self->priv->text_view;
		_tmp8_ = gtk_text_view_get_buffer (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = mark;
		gtk_text_buffer_delete_mark (_tmp9_, _tmp10_);
	}
	_g_object_unref0 (mark);
}

static gboolean
__lambda21_ (DcComposeBar* self)
{
	GtkTextView* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda21__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda21_ ((DcComposeBar*) self);
	return result;
}

void
dc_compose_bar_grab_entry_focus (DcComposeBar* self)
{
	GtkTextView* _tmp0_;
	g_return_if_fail (self != NULL);
	if (dc_compose_bar_is_recording_mode (self)) {
		return;
	}
	_tmp0_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda21__gsource_func, g_object_ref (self), g_object_unref);
}

void
dc_compose_bar_type_text (DcComposeBar* self,
                          const gchar* text)
{
	gboolean _tmp0_ = FALSE;
	gboolean open_emoji = FALSE;
	GtkTextView* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	GtkTextView* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	if (dc_compose_bar_is_recording_mode (self)) {
		return;
	}
	if (g_strcmp0 (text, ":") == 0) {
		_tmp0_ = dc_compose_bar_previous_char_is_colon (self);
	} else {
		_tmp0_ = FALSE;
	}
	open_emoji = _tmp0_;
	_tmp1_ = self->priv->text_view;
	_tmp2_ = gtk_text_view_get_buffer (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = strlen (text);
	_tmp5_ = _tmp4_;
	gtk_text_buffer_insert_at_cursor (_tmp3_, text, _tmp5_);
	_tmp6_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp6_);
	if (open_emoji) {
		dc_compose_bar_open_emoji_picker_after_typed_colon (self);
	}
}

static gboolean
__lambda36_ (DcComposeBar* self)
{
	GtkTextView* _tmp0_;
	GtkTextView* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextMark* _tmp4_;
	gboolean result;
	_tmp0_ = self->priv->text_view;
	_tmp1_ = self->priv->text_view;
	_tmp2_ = gtk_text_view_get_buffer (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gtk_text_buffer_get_insert (_tmp3_);
	gtk_text_view_scroll_mark_onscreen (_tmp0_, _tmp4_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda36__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda36_ ((DcComposeBar*) self);
	return result;
}

static void
dc_compose_bar_set_entry_text (DcComposeBar* self,
                               const gchar* text)
{
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter end_iter = {0};
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextIter _tmp6_ = {0};
	GtkTextView* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkTextBuffer* _tmp9_;
	GtkTextIter _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	g_object_set (_tmp2_, "text", text, NULL);
	_tmp3_ = self->priv->text_view;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	gtk_text_buffer_get_end_iter (_tmp5_, &_tmp6_);
	end_iter = _tmp6_;
	_tmp7_ = self->priv->text_view;
	_tmp8_ = gtk_text_view_get_buffer (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = end_iter;
	gtk_text_buffer_place_cursor (_tmp9_, &_tmp10_);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda36__gsource_func, g_object_ref (self), g_object_unref);
}

static gchar*
dc_compose_bar_get_text (DcComposeBar* self)
{
	GtkTextIter start = {0};
	GtkTextIter end = {0};
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter _tmp3_ = {0};
	GtkTextIter _tmp4_ = {0};
	GtkTextView* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextIter _tmp8_;
	GtkTextIter _tmp9_;
	gchar* _tmp10_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_text_buffer_get_bounds (_tmp2_, &_tmp3_, &_tmp4_);
	start = _tmp3_;
	end = _tmp4_;
	_tmp5_ = self->priv->text_view;
	_tmp6_ = gtk_text_view_get_buffer (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = start;
	_tmp9_ = end;
	_tmp10_ = gtk_text_buffer_get_text (_tmp7_, &_tmp8_, &_tmp9_, FALSE);
	result = _tmp10_;
	return result;
}

static void
dc_compose_bar_notify_draft_changed (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	if (self->priv->suppress_draft_signal) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->editing_msg_id > 0;
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = dc_compose_bar_get_text (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->pending_file;
	_tmp4_ = self->priv->pending_file_name;
	g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_DRAFT_CHANGED_SIGNAL], 0, _tmp2_, _tmp3_, _tmp4_, self->priv->replying_msg_id, self->priv->pending_file_is_voice);
	_g_free0 (_tmp2_);
}

static void
dc_compose_bar_update_placeholder (DcComposeBar* self)
{
	GtkLabel* _tmp0_;
	GtkTextView* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->placeholder_label;
	_tmp1_ = self->priv->text_view;
	_tmp2_ = gtk_text_view_get_buffer (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, gtk_text_buffer_get_char_count (_tmp3_) == 0);
}

static void
dc_compose_bar_update_send_stack (DcComposeBar* self)
{
	GtkStack* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	gboolean idle = FALSE;
	const gchar* _tmp7_ = NULL;
	GtkStack* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->send_stack;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp3_ = self->priv->text_view;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	if (gtk_text_buffer_get_char_count (_tmp5_) == 0) {
		const gchar* _tmp6_;
		_tmp6_ = self->priv->pending_file;
		_tmp2_ = _tmp6_ == NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = self->priv->editing_msg_id == 0;
	} else {
		_tmp1_ = FALSE;
	}
	idle = _tmp1_;
	if (idle) {
		_tmp7_ = "idle";
	} else {
		_tmp7_ = "send";
	}
	_tmp8_ = self->priv->send_stack;
	gtk_stack_set_visible_child_name (_tmp8_, _tmp7_);
}

static void
dc_compose_bar_on_sticker_picked (DcComposeBar* self,
                                  DcSticker* sticker)
{
	gint qid = 0;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	GtkTextView* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sticker != NULL);
	if (self->priv->editing_msg_id > 0) {
		return;
	}
	qid = self->priv->replying_msg_id;
	_tmp0_ = sticker->file_name;
	_tmp1_ = dc_sticker_store_sticker_path (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = sticker->display_name;
	g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_MESSAGE_SIGNAL], 0, "", _tmp2_, _tmp3_, qid);
	_g_free0 (_tmp2_);
	self->priv->suppress_draft_signal = TRUE;
	dc_compose_bar_cancel_reply (self);
	self->priv->suppress_draft_signal = FALSE;
	dc_compose_bar_notify_draft_changed (self);
	_tmp4_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp4_);
}

static Block33Data*
block33_data_ref (Block33Data* _data33_)
{
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}

static void
block33_data_unref (void * _userdata_)
{
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		DcComposeBar* self;
		self = _data33_->self;
		_g_object_unref0 (_data33_->recorder);
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}

static void
__lambda34_ (Block33Data* _data33_)
{
	DcComposeBar* self;
	DcAudioRecorder* _tmp0_;
	DcAudioRecorder* _tmp1_;
	GtkStack* _tmp2_;
	GtkButton* _tmp3_;
	self = _data33_->self;
	_tmp0_ = self->priv->audio_recorder;
	_tmp1_ = _data33_->recorder;
	if (_tmp0_ != _tmp1_) {
		return;
	}
	_tmp2_ = self->priv->recording_action_stack;
	gtk_stack_set_visible_child_name (_tmp2_, "send");
	_tmp3_ = self->priv->transcribe_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, dc_transcriber_available ());
}

static void
___lambda34__dc_audio_recorder_completed (DcAudioRecorder* _sender,
                                          gpointer self)
{
	__lambda34_ (self);
}

static void
__lambda35_ (Block33Data* _data33_,
             const gchar* message)
{
	DcComposeBar* self;
	DcAudioRecorder* _tmp0_;
	DcAudioRecorder* _tmp1_;
	self = _data33_->self;
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->audio_recorder;
	_tmp1_ = _data33_->recorder;
	if (_tmp0_ != _tmp1_) {
		return;
	}
	dc_compose_bar_leave_audio_recording_mode (self);
	dc_compose_bar_show_recording_error (self, message);
}

static void
___lambda35__dc_audio_recorder_failed (DcAudioRecorder* _sender,
                                       const gchar* message,
                                       gpointer self)
{
	__lambda35_ (self, message);
}

static gboolean
_dc_compose_bar_update_recording_time_gsource_func (gpointer self)
{
	gboolean result;
	result = dc_compose_bar_update_recording_time ((DcComposeBar*) self);
	return result;
}

static void
dc_compose_bar_start_audio_recording (DcComposeBar* self)
{
	Block33Data* _data33_;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	DcAudioPlayback* _tmp7_;
	DcAudioPlayback* _tmp8_;
	gboolean _tmp9_ = FALSE;
	DcAudioRecorder* _tmp10_;
	DcAudioRecorder* _tmp11_;
	DcAudioRecorder* _tmp12_;
	DcAudioRecorder* _tmp17_;
	DcAudioRecorder* _tmp18_;
	GtkLabel* _tmp19_;
	GtkStack* _tmp20_;
	GtkButton* _tmp21_;
	GtkButton* _tmp22_;
	GtkStack* _tmp23_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_data33_ = g_slice_new0 (Block33Data);
	_data33_->_ref_count_ = 1;
	_data33_->self = g_object_ref (self);
	if (dc_compose_bar_is_recording_mode (self)) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = self->priv->editing_msg_id > 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->pending_file;
		_tmp1_ = _tmp3_ != NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GtkTextView* _tmp4_;
		GtkTextBuffer* _tmp5_;
		GtkTextBuffer* _tmp6_;
		_tmp4_ = self->priv->text_view;
		_tmp5_ = gtk_text_view_get_buffer (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = gtk_text_buffer_get_char_count (_tmp6_) > 0;
	}
	if (_tmp0_) {
		block33_data_unref (_data33_);
		_data33_ = NULL;
		return;
	}
	_tmp7_ = dc_audio_playback_shared ();
	_tmp8_ = _tmp7_;
	dc_audio_playback_stop (_tmp8_);
	_g_object_unref0 (_tmp8_);
	if (dc_audio_player_prefer_system) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = dc_platform_is_macos ();
	}
	_tmp10_ = dc_audio_recorder_new (_tmp9_);
	_data33_->recorder = _tmp10_;
	_tmp11_ = _data33_->recorder;
	g_signal_connect_data (_tmp11_, "completed", (GCallback) ___lambda34__dc_audio_recorder_completed, block33_data_ref (_data33_), (GClosureNotify) block33_data_unref, 0);
	_tmp12_ = _data33_->recorder;
	g_signal_connect_data (_tmp12_, "failed", (GCallback) ___lambda35__dc_audio_recorder_failed, block33_data_ref (_data33_), (GClosureNotify) block33_data_unref, 0);
	{
		DcAudioRecorder* _tmp13_;
		_tmp13_ = _data33_->recorder;
		dc_audio_recorder_start (_tmp13_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		DcAudioRecorder* _tmp14_;
		GError* _tmp15_;
		const gchar* _tmp16_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp14_ = _data33_->recorder;
		dc_audio_recorder_cancel (_tmp14_);
		_tmp15_ = e;
		_tmp16_ = _tmp15_->message;
		dc_compose_bar_show_recording_error (self, _tmp16_);
		_g_error_free0 (e);
		block33_data_unref (_data33_);
		_data33_ = NULL;
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		block33_data_unref (_data33_);
		_data33_ = 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;
	}
	_tmp17_ = _data33_->recorder;
	_tmp18_ = _g_object_ref0 (_tmp17_);
	_g_object_unref0 (self->priv->audio_recorder);
	self->priv->audio_recorder = _tmp18_;
	self->priv->recording_started_us = g_get_monotonic_time ();
	_tmp19_ = self->priv->recording_time_label;
	gtk_label_set_label (_tmp19_, "00:00");
	_tmp20_ = self->priv->recording_action_stack;
	gtk_stack_set_visible_child_name (_tmp20_, "stop");
	_tmp21_ = self->priv->recording_stop_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp21_, TRUE);
	_tmp22_ = self->priv->recording_stop_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp22_, "Stop recording");
	_tmp23_ = self->priv->compose_mode_stack;
	gtk_stack_set_visible_child_name (_tmp23_, "recording");
	self->priv->recording_timer = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, _dc_compose_bar_update_recording_time_gsource_func, g_object_ref (self), g_object_unref);
	block33_data_unref (_data33_);
	_data33_ = NULL;
}

static gboolean
dc_compose_bar_update_recording_time (DcComposeBar* self)
{
	gint elapsed = 0;
	GtkLabel* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	elapsed = (gint) ((g_get_monotonic_time () - self->priv->recording_started_us) / 1000000);
	_tmp0_ = self->priv->recording_time_label;
	_tmp1_ = g_strdup_printf ("%02d:%02d", elapsed / 60, elapsed % 60);
	_tmp2_ = _tmp1_;
	gtk_label_set_label (_tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	result = G_SOURCE_CONTINUE;
	return result;
}

static void
dc_compose_bar_stop_audio_recording (DcComposeBar* self)
{
	DcAudioRecorder* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	DcAudioRecorder* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->audio_recorder;
	if (_tmp0_ == NULL) {
		return;
	}
	dc_compose_bar_stop_recording_timer (self);
	dc_compose_bar_update_recording_time (self);
	_tmp1_ = self->priv->recording_stop_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, FALSE);
	_tmp2_ = self->priv->recording_stop_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp2_, "Finishing recording…");
	_tmp3_ = self->priv->audio_recorder;
	dc_audio_recorder_stop (_tmp3_);
}

static void
_dc_compose_bar_on_transcription_updated_dc_transcriber_updated (DcTranscriber* _sender,
                                                                 const gchar* path,
                                                                 gpointer self)
{
	dc_compose_bar_on_transcription_updated ((DcComposeBar*) self, path);
}

static void
dc_compose_bar_transcribe_audio_recording (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	DcAudioRecorder* _tmp1_;
	gchar* path = NULL;
	DcAudioRecorder* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	DcTranscriber* transcriber = NULL;
	DcTranscriber* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	GtkButton* _tmp13_;
	GtkButton* _tmp14_;
	DcTranscriber* _tmp17_;
	const gchar* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->audio_recorder;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->transcribing_path;
		_tmp0_ = _tmp2_ != NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->audio_recorder;
	_tmp4_ = dc_audio_recorder_get_output_path (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup (_tmp5_);
	path = _tmp6_;
	_tmp7_ = path;
	_tmp8_ = strlen (_tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == 0) {
		_g_free0 (path);
		return;
	}
	_tmp10_ = dc_transcriber_shared ();
	transcriber = _tmp10_;
	_tmp11_ = path;
	_tmp12_ = g_strdup (_tmp11_);
	_g_free0 (self->priv->transcribing_path);
	self->priv->transcribing_path = _tmp12_;
	_tmp13_ = self->priv->transcribe_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, FALSE);
	_tmp14_ = self->priv->transcribe_button;
	gtk_button_set_label (_tmp14_, "Transcribing…");
	if (self->priv->transcriber_handler == ((gulong) 0)) {
		DcTranscriber* _tmp15_;
		gulong _tmp16_;
		_tmp15_ = transcriber;
		_tmp16_ = g_signal_connect_object (_tmp15_, "updated", (GCallback) _dc_compose_bar_on_transcription_updated_dc_transcriber_updated, self, 0);
		self->priv->transcriber_handler = _tmp16_;
	}
	_tmp17_ = transcriber;
	_tmp18_ = path;
	dc_transcriber_transcribe (_tmp17_, _tmp18_);
	_g_object_unref0 (transcriber);
	_g_free0 (path);
}

static void
dc_compose_bar_on_transcription_updated (DcComposeBar* self,
                                         const gchar* path)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	DcTranscriber* transcriber = NULL;
	DcTranscriber* _tmp3_;
	DcTranscriber* _tmp4_;
	gchar* text = NULL;
	DcTranscriber* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp1_ = self->priv->transcribing_path;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->transcribing_path;
		_tmp0_ = g_strcmp0 (path, _tmp2_) != 0;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = dc_transcriber_shared ();
	transcriber = _tmp3_;
	_tmp4_ = transcriber;
	if (dc_transcriber_is_running (_tmp4_, path)) {
		_g_object_unref0 (transcriber);
		return;
	}
	_tmp5_ = transcriber;
	_tmp6_ = dc_transcriber_result_for (_tmp5_, path);
	text = _tmp6_;
	_g_free0 (self->priv->transcribing_path);
	self->priv->transcribing_path = NULL;
	dc_compose_bar_reset_transcribe_button (self);
	_tmp7_ = text;
	if (_tmp7_ == NULL) {
		dc_compose_bar_show_compose_toast (self, "Transcription is unavailable");
		_g_free0 (text);
		_g_object_unref0 (transcriber);
		return;
	}
	_tmp8_ = text;
	dc_compose_bar_attach_recording_with_text (self, _tmp8_);
	_g_free0 (text);
	_g_object_unref0 (transcriber);
}

static void
dc_compose_bar_attach_recording_with_text (DcComposeBar* self,
                                           const gchar* text)
{
	DcAudioRecorder* _tmp0_;
	gchar* path = NULL;
	DcAudioRecorder* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	const gchar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	GtkTextView* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->audio_recorder;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->audio_recorder;
	_tmp2_ = dc_audio_recorder_take_output (_tmp1_);
	path = _tmp2_;
	dc_compose_bar_leave_audio_recording_mode (self);
	_tmp3_ = path;
	_tmp4_ = strlen (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == 0) {
		_g_free0 (path);
		return;
	}
	self->priv->suppress_draft_signal = TRUE;
	_tmp6_ = path;
	dc_compose_bar_set_pending_attachment (self, _tmp6_, DC_COMPOSE_BAR_VOICE_FILE_NAME, TRUE, "");
	self->priv->pending_file_is_voice = TRUE;
	_tmp7_ = strlen (text);
	_tmp8_ = _tmp7_;
	if (_tmp8_ > 0) {
		dc_compose_bar_set_entry_text (self, text);
	}
	self->priv->suppress_draft_signal = FALSE;
	dc_compose_bar_notify_draft_changed (self);
	_tmp9_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp9_);
	_tmp10_ = strlen (text);
	_tmp11_ = _tmp10_;
	if (_tmp11_ == 0) {
		dc_compose_bar_show_compose_toast (self, "No speech detected; the voice message is still attached");
	}
	_g_free0 (path);
}

static void
dc_compose_bar_reset_transcribe_button (DcComposeBar* self)
{
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->transcribe_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, TRUE);
	_tmp1_ = self->priv->transcribe_button;
	gtk_button_set_label (_tmp1_, "Transcribe");
}

static void
dc_compose_bar_send_audio_recording (DcComposeBar* self)
{
	DcAudioRecorder* _tmp0_;
	DcAudioRecorder* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->audio_recorder;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->audio_recorder;
	_tmp2_ = dc_audio_recorder_take_output (_tmp1_);
	_tmp3_ = _tmp2_;
	g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_VOICE_MESSAGE_SIGNAL], 0, _tmp3_, "", self->priv->replying_msg_id, TRUE);
	_g_free0 (_tmp3_);
	dc_compose_bar_leave_audio_recording_mode (self);
	self->priv->suppress_draft_signal = TRUE;
	dc_compose_bar_cancel_reply (self);
	self->priv->suppress_draft_signal = FALSE;
	dc_compose_bar_notify_draft_changed (self);
}

static void
dc_compose_bar_cancel_audio_recording (DcComposeBar* self)
{
	g_return_if_fail (self != NULL);
	if (!dc_compose_bar_is_recording_mode (self)) {
		return;
	}
	dc_compose_bar_leave_audio_recording_mode (self);
}

static void
dc_compose_bar_leave_audio_recording_mode (DcComposeBar* self)
{
	GtkButton* _tmp0_;
	DcAudioRecorder* _tmp1_;
	GtkStack* _tmp3_;
	g_return_if_fail (self != NULL);
	dc_compose_bar_stop_recording_timer (self);
	_g_free0 (self->priv->transcribing_path);
	self->priv->transcribing_path = NULL;
	dc_compose_bar_reset_transcribe_button (self);
	_tmp0_ = self->priv->transcribe_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, FALSE);
	_tmp1_ = self->priv->audio_recorder;
	if (_tmp1_ != NULL) {
		DcAudioRecorder* _tmp2_;
		_tmp2_ = self->priv->audio_recorder;
		dc_audio_recorder_cancel (_tmp2_);
		_g_object_unref0 (self->priv->audio_recorder);
		self->priv->audio_recorder = NULL;
	}
	_tmp3_ = self->priv->compose_mode_stack;
	gtk_stack_set_visible_child_name (_tmp3_, "compose");
	dc_compose_bar_update_send_stack (self);
}

static void
dc_compose_bar_stop_recording_timer (DcComposeBar* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->recording_timer == ((guint) 0)) {
		return;
	}
	g_source_remove (self->priv->recording_timer);
	self->priv->recording_timer = (guint) 0;
}

static gboolean
dc_compose_bar_is_recording_mode (DcComposeBar* self)
{
	GtkStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->compose_mode_stack;
	_tmp1_ = gtk_stack_get_visible_child_name (_tmp0_);
	_tmp2_ = _tmp1_;
	result = g_strcmp0 (_tmp2_, "recording") == 0;
	return result;
}

static void
dc_compose_bar_show_recording_error (DcComposeBar* self,
                                     const gchar* message)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = g_strconcat ("Recording failed: ", message, NULL);
	_tmp1_ = _tmp0_;
	dc_compose_bar_show_compose_toast (self, _tmp1_);
	_g_free0 (_tmp1_);
}

static void
dc_compose_bar_show_compose_toast (DcComposeBar* self,
                                   const gchar* message)
{
	DcWindow* window = NULL;
	GtkRoot* _tmp0_;
	DcWindow* _tmp1_;
	DcWindow* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (DC_IS_WINDOW (_tmp0_) ? ((DcWindow*) _tmp0_) : NULL);
	window = _tmp1_;
	_tmp2_ = window;
	if (_tmp2_ != NULL) {
		DcWindow* _tmp3_;
		_tmp3_ = window;
		dc_window_show_toast (_tmp3_, message);
	} else {
		g_warning ("compose_bar.vala:909: compose bar: %s", message);
	}
	_g_object_unref0 (window);
}

static void
dc_compose_bar_set_entry_active (DcComposeBar* self,
                                 gboolean active)
{
	g_return_if_fail (self != NULL);
	if (active) {
		GtkTextView* _tmp0_;
		_tmp0_ = self->priv->text_view;
		gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "compose-entry-active");
	} else {
		GtkTextView* _tmp1_;
		_tmp1_ = self->priv->text_view;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp1_, "compose-entry-active");
	}
}

gboolean
dc_compose_bar_can_accept_attachment (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->editing_msg_id == 0) {
		_tmp0_ = !dc_compose_bar_is_recording_mode (self);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
_vala_array_add19 (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 void
_vala_array_add20 (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 void
_vala_array_add21 (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 void
_vala_array_add22 (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;
}

void
dc_compose_bar_set_pending_attachment (DcComposeBar* self,
                                       const gchar* file_path,
                                       const gchar* file_name,
                                       gboolean is_temp,
                                       const gchar* caption)
{
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* name = NULL;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	GtkButton* _tmp27_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file_path != NULL);
	g_return_if_fail (caption != NULL);
	_tmp1_ = g_strdup (file_name);
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		gchar* _tmp2_;
		_tmp2_ = g_path_get_basename (file_path);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	name = _tmp3_;
	_tmp4_ = self->priv->pending_file;
	if (_tmp4_ == NULL) {
		gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp5_ = g_strdup (file_path);
		_g_free0 (self->priv->pending_file);
		self->priv->pending_file = _tmp5_;
		_tmp6_ = name;
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (self->priv->pending_file_name);
		self->priv->pending_file_name = _tmp7_;
		self->priv->pending_file_is_temp = is_temp;
		_tmp8_ = name;
		dc_compose_bar_populate_attachment_preview (self, file_path, _tmp8_);
	} else {
		gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gint count = 0;
		gchar** _tmp14_;
		gint _tmp14__length1;
		GtkPicture* _tmp15_;
		GtkPicture* _tmp16_;
		GtkImage* _tmp17_;
		GtkImage* _tmp18_;
		GtkLabel* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		GtkLabel* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		GtkBox* _tmp26_;
		_tmp9_ = g_strdup (file_path);
		_vala_array_add19 (&self->priv->extra_pending_files, &self->priv->extra_pending_files_length1, &self->priv->_extra_pending_files_size_, _tmp9_);
		_tmp10_ = name;
		_tmp11_ = g_strdup (_tmp10_);
		_vala_array_add20 (&self->priv->extra_pending_file_names, &self->priv->extra_pending_file_names_length1, &self->priv->_extra_pending_file_names_size_, _tmp11_);
		_tmp12_ = g_strdup (caption);
		_vala_array_add21 (&self->priv->extra_pending_captions, &self->priv->extra_pending_captions_length1, &self->priv->_extra_pending_captions_size_, _tmp12_);
		if (is_temp) {
			gchar* _tmp13_;
			_tmp13_ = g_strdup (file_path);
			_vala_array_add22 (&self->priv->extra_pending_temp_files, &self->priv->extra_pending_temp_files_length1, &self->priv->_extra_pending_temp_files_size_, _tmp13_);
		}
		_tmp14_ = self->priv->extra_pending_files;
		_tmp14__length1 = self->priv->extra_pending_files_length1;
		count = 1 + _tmp14__length1;
		_tmp15_ = self->priv->attachment_picture;
		gtk_picture_set_paintable (_tmp15_, NULL);
		_tmp16_ = self->priv->attachment_picture;
		gtk_widget_set_visible ((GtkWidget*) _tmp16_, FALSE);
		_tmp17_ = self->priv->attachment_icon;
		g_object_set (_tmp17_, "icon-name", "mail-attachment-symbolic", NULL);
		_tmp18_ = self->priv->attachment_icon;
		gtk_widget_set_visible ((GtkWidget*) _tmp18_, TRUE);
		_tmp19_ = self->priv->attachment_name_label;
		_tmp20_ = g_strdup_printf ("%d attachments", count);
		_tmp21_ = _tmp20_;
		gtk_label_set_label (_tmp19_, _tmp21_);
		_g_free0 (_tmp21_);
		_tmp22_ = self->priv->attachment_meta_label;
		_tmp23_ = self->priv->pending_file_name;
		_tmp24_ = g_strdup_printf ("%s + %d more", _tmp23_, count - 1);
		_tmp25_ = _tmp24_;
		gtk_label_set_label (_tmp22_, _tmp25_);
		_g_free0 (_tmp25_);
		_tmp26_ = self->priv->attachment_bar;
		gtk_widget_set_visible ((GtkWidget*) _tmp26_, TRUE);
	}
	_tmp27_ = self->priv->cancel_attach_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp27_, TRUE);
	dc_compose_bar_update_send_stack (self);
	dc_compose_bar_notify_draft_changed (self);
	_g_free0 (name);
	_g_free0 (_tmp0_);
}

/** State token to pass along with link_previews_requested. */
guint
dc_compose_bar_current_preview_generation (DcComposeBar* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->preview_generation;
	return result;
}

/** Attaches a fetched link preview image. Returns false (and
            takes no ownership of `image_path`) when the composer has
            moved on since `generation` was issued or cannot take
            attachments any more. */
gboolean
dc_compose_bar_add_link_preview (DcComposeBar* self,
                                 guint generation,
                                 const gchar* image_path,
                                 const gchar* file_name,
                                 const gchar* title,
                                 const gchar* description)
{
	const gchar* _tmp0_ = NULL;
	gchar* caption = NULL;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean primary = FALSE;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (image_path != NULL, FALSE);
	g_return_val_if_fail (file_name != NULL, FALSE);
	if (generation != self->priv->preview_generation) {
		result = FALSE;
		return result;
	}
	if (!dc_compose_bar_can_accept_attachment (self)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = title;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp1_ = g_strdup (_tmp0_);
	caption = _tmp1_;
	if (description != NULL) {
		gint _tmp3_;
		gint _tmp4_;
		_tmp3_ = strlen (description);
		_tmp4_ = _tmp3_;
		_tmp2_ = _tmp4_ > 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gchar* _tmp5_ = NULL;
		const gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gchar* _tmp12_;
		_tmp6_ = caption;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ > 0) {
			const gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp9_ = caption;
			_tmp10_ = g_strdup_printf ("%s\n%s", _tmp9_, description);
			_g_free0 (_tmp5_);
			_tmp5_ = _tmp10_;
		} else {
			gchar* _tmp11_;
			_tmp11_ = g_strdup (description);
			_g_free0 (_tmp5_);
			_tmp5_ = _tmp11_;
		}
		_tmp12_ = _tmp5_;
		_tmp5_ = NULL;
		_g_free0 (caption);
		caption = _tmp12_;
		_g_free0 (_tmp5_);
	}
	_tmp13_ = self->priv->pending_file;
	primary = _tmp13_ == NULL;
	_tmp14_ = caption;
	dc_compose_bar_set_pending_attachment (self, image_path, file_name, TRUE, _tmp14_);
	if (primary) {
		gboolean _tmp15_ = FALSE;
		gboolean _tmp19_ = FALSE;
		if (title != NULL) {
			gint _tmp16_;
			gint _tmp17_;
			_tmp16_ = strlen (title);
			_tmp17_ = _tmp16_;
			_tmp15_ = _tmp17_ > 0;
		} else {
			_tmp15_ = FALSE;
		}
		if (_tmp15_) {
			GtkLabel* _tmp18_;
			_tmp18_ = self->priv->attachment_name_label;
			gtk_label_set_label (_tmp18_, title);
		}
		if (description != NULL) {
			gint _tmp20_;
			gint _tmp21_;
			_tmp20_ = strlen (description);
			_tmp21_ = _tmp20_;
			_tmp19_ = _tmp21_ > 0;
		} else {
			_tmp19_ = FALSE;
		}
		if (_tmp19_) {
			GtkLabel* _tmp22_;
			_tmp22_ = self->priv->attachment_meta_label;
			gtk_label_set_label (_tmp22_, description);
		} else {
			gboolean _tmp23_ = FALSE;
			if (title != NULL) {
				gint _tmp24_;
				gint _tmp25_;
				_tmp24_ = strlen (title);
				_tmp25_ = _tmp24_;
				_tmp23_ = _tmp25_ > 0;
			} else {
				_tmp23_ = FALSE;
			}
			if (_tmp23_) {
				GtkLabel* _tmp26_;
				_tmp26_ = self->priv->attachment_meta_label;
				gtk_label_set_label (_tmp26_, "Link preview");
			}
		}
	}
	result = TRUE;
	_g_free0 (caption);
	return result;
}

static void
_vala_array_add23 (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 void
_vala_array_add24 (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 void
dc_compose_bar_request_link_previews (DcComposeBar* self,
                                      const gchar* text)
{
	gchar** fresh = NULL;
	gchar** _tmp0_;
	gint fresh_length1;
	gint _fresh_size_;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	fresh = _tmp0_;
	fresh_length1 = 0;
	_fresh_size_ = fresh_length1;
	_tmp2_ = dc_link_preview_pick_urls (text, &_tmp1_);
	{
		gchar** url_collection = NULL;
		gint url_collection_length1 = 0;
		gint _url_collection_size_ = 0;
		gint url_it = 0;
		url_collection = _tmp2_;
		url_collection_length1 = _tmp1_;
		for (url_it = 0; url_it < url_collection_length1; url_it = url_it + 1) {
			gchar* _tmp3_;
			gchar* url = NULL;
			_tmp3_ = g_strdup (url_collection[url_it]);
			url = _tmp3_;
			{
				gboolean seen = FALSE;
				gchar** _tmp4_;
				gint _tmp4__length1;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				seen = FALSE;
				_tmp4_ = self->priv->previewed_urls;
				_tmp4__length1 = self->priv->previewed_urls_length1;
				{
					gchar** u_collection = NULL;
					gint u_collection_length1 = 0;
					gint _u_collection_size_ = 0;
					gint u_it = 0;
					u_collection = _tmp4_;
					u_collection_length1 = _tmp4__length1;
					for (u_it = 0; u_it < u_collection_length1; u_it = u_it + 1) {
						gchar* _tmp5_;
						gchar* u = NULL;
						_tmp5_ = g_strdup (u_collection[u_it]);
						u = _tmp5_;
						{
							const gchar* _tmp6_;
							const gchar* _tmp7_;
							_tmp6_ = u;
							_tmp7_ = url;
							if (g_strcmp0 (_tmp6_, _tmp7_) == 0) {
								seen = TRUE;
								_g_free0 (u);
								break;
							}
							_g_free0 (u);
						}
					}
				}
				if (seen) {
					_g_free0 (url);
					continue;
				}
				_tmp8_ = url;
				_tmp9_ = g_strdup (_tmp8_);
				_vala_array_add23 (&self->priv->previewed_urls, &self->priv->previewed_urls_length1, &self->priv->_previewed_urls_size_, _tmp9_);
				_tmp10_ = url;
				_tmp11_ = g_strdup (_tmp10_);
				_vala_array_add24 (&fresh, &fresh_length1, &_fresh_size_, _tmp11_);
				_g_free0 (url);
			}
		}
		url_collection = (_vala_array_free (url_collection, url_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = fresh;
	_tmp12__length1 = fresh_length1;
	if (_tmp12__length1 > 0) {
		gchar** _tmp13_;
		gint _tmp13__length1;
		_tmp13_ = fresh;
		_tmp13__length1 = fresh_length1;
		g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_LINK_PREVIEWS_REQUESTED_SIGNAL], 0, _tmp13_, (gint) _tmp13__length1, self->priv->preview_generation);
	}
	fresh = (_vala_array_free (fresh, fresh_length1, (GDestroyNotify) g_free), NULL);
}

static void
dc_compose_bar_populate_attachment_preview (DcComposeBar* self,
                                            const gchar* file_path,
                                            const gchar* file_name)
{
	gchar* mime = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gboolean is_image = FALSE;
	GtkPicture* _tmp4_;
	GtkImage* _tmp5_;
	GtkLabel* _tmp17_;
	gchar* size_str = NULL;
	gchar* _tmp18_;
	gchar* _tmp19_ = NULL;
	const gchar* _tmp20_;
	GtkLabel* _tmp26_;
	GtkBox* _tmp27_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file_path != NULL);
	g_return_if_fail (file_name != NULL);
	_tmp0_ = dc_compose_bar_guess_mime (file_path);
	mime = _tmp0_;
	_tmp2_ = mime;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		_tmp3_ = mime;
		_tmp1_ = g_str_has_prefix (_tmp3_, "image/");
	} else {
		_tmp1_ = FALSE;
	}
	is_image = _tmp1_;
	_tmp4_ = self->priv->attachment_picture;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, FALSE);
	_tmp5_ = self->priv->attachment_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp5_, FALSE);
	if (is_image) {
		{
			GdkPixbuf* pixbuf = NULL;
			GdkPixbuf* _tmp6_;
			GdkTexture* texture = NULL;
			GdkPixbuf* _tmp7_;
			GdkTexture* _tmp8_;
			GtkPicture* _tmp9_;
			GdkTexture* _tmp10_;
			GtkPicture* _tmp11_;
			_tmp6_ = gdk_pixbuf_new_from_file_at_scale (file_path, 256, 256, TRUE, &_inner_error0_);
			pixbuf = _tmp6_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp7_ = pixbuf;
			_tmp8_ = dc_texture_from_pixbuf (_tmp7_);
			texture = _tmp8_;
			_tmp9_ = self->priv->attachment_picture;
			_tmp10_ = texture;
			gtk_picture_set_paintable (_tmp9_, (GdkPaintable*) _tmp10_);
			_tmp11_ = self->priv->attachment_picture;
			gtk_widget_set_visible ((GtkWidget*) _tmp11_, TRUE);
			_g_object_unref0 (texture);
			_g_object_unref0 (pixbuf);
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_inner_error0_);
			is_image = FALSE;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (mime);
			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;
		}
	}
	if (!is_image) {
		GtkImage* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		GtkImage* _tmp16_;
		_tmp12_ = self->priv->attachment_icon;
		_tmp13_ = mime;
		_tmp14_ = dc_compose_bar_mime_icon_name (_tmp13_, file_path);
		_tmp15_ = _tmp14_;
		g_object_set (_tmp12_, "icon-name", _tmp15_, NULL);
		_g_free0 (_tmp15_);
		_tmp16_ = self->priv->attachment_icon;
		gtk_widget_set_visible ((GtkWidget*) _tmp16_, TRUE);
	}
	_tmp17_ = self->priv->attachment_name_label;
	gtk_label_set_label (_tmp17_, file_name);
	_tmp18_ = dc_compose_bar_format_size (dc_compose_bar_file_size_or_zero (file_path));
	size_str = _tmp18_;
	_tmp20_ = mime;
	if (_tmp20_ != NULL) {
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		_tmp21_ = mime;
		_tmp22_ = size_str;
		_tmp23_ = g_strdup_printf ("%s · %s", _tmp21_, _tmp22_);
		_g_free0 (_tmp19_);
		_tmp19_ = _tmp23_;
	} else {
		const gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp24_ = size_str;
		_tmp25_ = g_strdup (_tmp24_);
		_g_free0 (_tmp19_);
		_tmp19_ = _tmp25_;
	}
	_tmp26_ = self->priv->attachment_meta_label;
	gtk_label_set_label (_tmp26_, _tmp19_);
	_tmp27_ = self->priv->attachment_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp27_, TRUE);
	_g_free0 (_tmp19_);
	_g_free0 (size_str);
	_g_free0 (mime);
}

static gchar*
dc_compose_bar_guess_mime (const gchar* file_path)
{
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (file_path != NULL, NULL);
	{
		GFileInfo* info = NULL;
		GFile* _tmp0_;
		GFile* _tmp1_;
		GFileInfo* _tmp2_;
		GFileInfo* _tmp3_;
		gchar* ct = NULL;
		GFileInfo* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp0_ = g_file_new_for_path (file_path);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_file_query_info (_tmp1_, "standard::content-type", G_FILE_QUERY_INFO_NONE, NULL, &_inner_error0_);
		_tmp3_ = _tmp2_;
		_g_object_unref0 (_tmp1_);
		info = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = info;
		_tmp5_ = g_file_info_get_content_type (_tmp4_);
		_tmp6_ = g_strdup (_tmp5_);
		ct = _tmp6_;
		_tmp7_ = ct;
		if (_tmp7_ != NULL) {
			gchar* mime = NULL;
			const gchar* _tmp8_;
			gchar* _tmp9_;
			gboolean _tmp10_ = FALSE;
			const gchar* _tmp11_;
			_tmp8_ = ct;
			_tmp9_ = g_content_type_get_mime_type (_tmp8_);
			mime = _tmp9_;
			_tmp11_ = mime;
			if (_tmp11_ != NULL) {
				const gchar* _tmp12_;
				gint _tmp13_;
				gint _tmp14_;
				_tmp12_ = mime;
				_tmp13_ = strlen (_tmp12_);
				_tmp14_ = _tmp13_;
				_tmp10_ = _tmp14_ > 0;
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				result = mime;
				_g_free0 (ct);
				_g_object_unref0 (info);
				return result;
			}
			_g_free0 (mime);
		}
		_g_free0 (ct);
		_g_object_unref0 (info);
	}
	goto __finally0;
	__catch0_g_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 NULL;
	}
	result = NULL;
	return result;
}

static gchar*
dc_compose_bar_mime_icon_name (const gchar* mime,
                               const gchar* file_path)
{
	gchar* lower = NULL;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
	gboolean _tmp18_ = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	const gchar* _tmp21_;
	gchar* _tmp29_;
	gchar* result;
	g_return_val_if_fail (file_path != NULL, NULL);
	if (mime != NULL) {
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		gboolean _tmp9_ = FALSE;
		gboolean _tmp10_ = FALSE;
		if (g_str_has_prefix (mime, "video/")) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("video-x-generic-symbolic");
			result = _tmp0_;
			return result;
		}
		if (g_str_has_prefix (mime, "audio/")) {
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("audio-x-generic-symbolic");
			result = _tmp1_;
			return result;
		}
		if (g_str_has_prefix (mime, "image/")) {
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("image-x-generic-symbolic");
			result = _tmp2_;
			return result;
		}
		if (g_strcmp0 (mime, "application/pdf") == 0) {
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("x-office-document-symbolic");
			result = _tmp3_;
			return result;
		}
		if (g_str_has_prefix (mime, "text/")) {
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("text-x-generic-symbolic");
			result = _tmp4_;
			return result;
		}
		if (g_strcmp0 (mime, "application/zip") == 0) {
			_tmp10_ = TRUE;
		} else {
			_tmp10_ = g_strcmp0 (mime, "application/x-tar") == 0;
		}
		if (_tmp10_) {
			_tmp9_ = TRUE;
		} else {
			_tmp9_ = g_strcmp0 (mime, "application/gzip") == 0;
		}
		if (_tmp9_) {
			_tmp8_ = TRUE;
		} else {
			_tmp8_ = g_strcmp0 (mime, "application/x-7z-compressed") == 0;
		}
		if (_tmp8_) {
			_tmp7_ = TRUE;
		} else {
			_tmp7_ = g_strcmp0 (mime, "application/x-rar-compressed") == 0;
		}
		if (_tmp7_) {
			_tmp6_ = TRUE;
		} else {
			_tmp6_ = g_strcmp0 (mime, "application/x-bzip") == 0;
		}
		if (_tmp6_) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = g_strcmp0 (mime, "application/x-bzip2") == 0;
		}
		if (_tmp5_) {
			gchar* _tmp11_;
			_tmp11_ = g_strdup ("package-x-generic-symbolic");
			result = _tmp11_;
			return result;
		}
	}
	_tmp12_ = g_utf8_strdown (file_path, (gssize) -1);
	lower = _tmp12_;
	_tmp13_ = lower;
	if (g_str_has_suffix (_tmp13_, ".pdf")) {
		gchar* _tmp14_;
		_tmp14_ = g_strdup ("x-office-document-symbolic");
		result = _tmp14_;
		_g_free0 (lower);
		return result;
	}
	_tmp21_ = lower;
	if (g_str_has_suffix (_tmp21_, ".zip")) {
		_tmp20_ = TRUE;
	} else {
		const gchar* _tmp22_;
		_tmp22_ = lower;
		_tmp20_ = g_str_has_suffix (_tmp22_, ".tar");
	}
	if (_tmp20_) {
		_tmp19_ = TRUE;
	} else {
		const gchar* _tmp23_;
		_tmp23_ = lower;
		_tmp19_ = g_str_has_suffix (_tmp23_, ".tgz");
	}
	if (_tmp19_) {
		_tmp18_ = TRUE;
	} else {
		const gchar* _tmp24_;
		_tmp24_ = lower;
		_tmp18_ = g_str_has_suffix (_tmp24_, ".gz");
	}
	if (_tmp18_) {
		_tmp17_ = TRUE;
	} else {
		const gchar* _tmp25_;
		_tmp25_ = lower;
		_tmp17_ = g_str_has_suffix (_tmp25_, ".7z");
	}
	if (_tmp17_) {
		_tmp16_ = TRUE;
	} else {
		const gchar* _tmp26_;
		_tmp26_ = lower;
		_tmp16_ = g_str_has_suffix (_tmp26_, ".rar");
	}
	if (_tmp16_) {
		_tmp15_ = TRUE;
	} else {
		const gchar* _tmp27_;
		_tmp27_ = lower;
		_tmp15_ = g_str_has_suffix (_tmp27_, ".bz2");
	}
	if (_tmp15_) {
		gchar* _tmp28_;
		_tmp28_ = g_strdup ("package-x-generic-symbolic");
		result = _tmp28_;
		_g_free0 (lower);
		return result;
	}
	_tmp29_ = g_strdup ("mail-attachment-symbolic");
	result = _tmp29_;
	_g_free0 (lower);
	return result;
}

static gint64
dc_compose_bar_file_size_or_zero (const gchar* file_path)
{
	gint64 _tmp4_ = -1LL;
	GError* _inner_error0_ = NULL;
	gint64 result;
	g_return_val_if_fail (file_path != NULL, -1LL);
	{
		GFileInfo* info = NULL;
		GFile* _tmp0_;
		GFile* _tmp1_;
		GFileInfo* _tmp2_;
		GFileInfo* _tmp3_;
		_tmp0_ = g_file_new_for_path (file_path);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_file_query_info (_tmp1_, "standard::size", G_FILE_QUERY_INFO_NONE, NULL, &_inner_error0_);
		_tmp3_ = _tmp2_;
		_g_object_unref0 (_tmp1_);
		info = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		result = g_file_info_get_size (info);
		_g_object_unref0 (info);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		result = (gint64) 0;
		return result;
	}
	__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 _tmp4_;
}

static gchar*
dc_compose_bar_format_size (gint64 bytes)
{
	gdouble v = 0.0;
	gchar** units = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gint units_length1;
	gint _units_size_;
	gint u = 0;
	gchar** _tmp15_;
	gint _tmp15__length1;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* result;
	if (bytes <= ((gint64) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("—");
		result = _tmp0_;
		return result;
	}
	v = (gdouble) bytes;
	_tmp1_ = g_strdup ("B");
	_tmp2_ = g_strdup ("KB");
	_tmp3_ = g_strdup ("MB");
	_tmp4_ = g_strdup ("GB");
	_tmp5_ = g_new0 (gchar*, 4 + 1);
	_tmp5_[0] = _tmp1_;
	_tmp5_[1] = _tmp2_;
	_tmp5_[2] = _tmp3_;
	_tmp5_[3] = _tmp4_;
	units = _tmp5_;
	units_length1 = 4;
	_units_size_ = units_length1;
	u = 0;
	while (TRUE) {
		gboolean _tmp6_ = FALSE;
		gint _tmp8_;
		if (v >= 1024.0) {
			gchar** _tmp7_;
			gint _tmp7__length1;
			_tmp7_ = units;
			_tmp7__length1 = units_length1;
			_tmp6_ = u < (_tmp7__length1 - 1);
		} else {
			_tmp6_ = FALSE;
		}
		if (!_tmp6_) {
			break;
		}
		v /= 1024.0;
		_tmp8_ = u;
		u = _tmp8_ + 1;
	}
	if (u == 0) {
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar** _tmp11_;
		gint _tmp11__length1;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		_tmp9_ = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) v);
		_tmp10_ = _tmp9_;
		_tmp11_ = units;
		_tmp11__length1 = units_length1;
		_tmp12_ = _tmp11_[u];
		_tmp13_ = g_strdup_printf ("%s %s", _tmp10_, _tmp12_);
		_tmp14_ = _tmp13_;
		_g_free0 (_tmp10_);
		result = _tmp14_;
		units = (_vala_array_free (units, units_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp15_ = units;
	_tmp15__length1 = units_length1;
	_tmp16_ = _tmp15_[u];
	_tmp17_ = g_strdup_printf ("%.1f %s", v, _tmp16_);
	result = _tmp17_;
	units = (_vala_array_free (units, units_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static void
dc_compose_bar_clear_attachment (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar** _tmp10_;
	gchar** _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	guint _tmp14_;
	gchar** _tmp15_;
	GtkButton* _tmp16_;
	GtkBox* _tmp17_;
	GtkPicture* _tmp18_;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkLabel* _tmp21_;
	const gchar* _tmp22_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (self->priv->pending_file_is_temp) {
		const gchar* _tmp1_;
		_tmp1_ = self->priv->pending_file;
		_tmp0_ = _tmp1_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		{
			GFile* f = NULL;
			const gchar* _tmp2_;
			GFile* _tmp3_;
			GFile* _tmp4_;
			_tmp2_ = self->priv->pending_file;
			_tmp3_ = g_file_new_for_path (_tmp2_);
			f = _tmp3_;
			_tmp4_ = f;
			g_file_delete (_tmp4_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (f);
				goto __catch0_g_error;
			}
			_g_object_unref0 (f);
		}
		goto __finally0;
		__catch0_g_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;
		}
	}
	_g_free0 (self->priv->pending_file);
	self->priv->pending_file = NULL;
	_g_free0 (self->priv->pending_file_name);
	self->priv->pending_file_name = NULL;
	self->priv->pending_file_is_temp = FALSE;
	self->priv->pending_file_is_voice = FALSE;
	_tmp5_ = self->priv->extra_pending_temp_files;
	_tmp5__length1 = self->priv->extra_pending_temp_files_length1;
	{
		gchar** path_collection = NULL;
		gint path_collection_length1 = 0;
		gint _path_collection_size_ = 0;
		gint path_it = 0;
		path_collection = _tmp5_;
		path_collection_length1 = _tmp5__length1;
		for (path_it = 0; path_it < path_collection_length1; path_it = path_it + 1) {
			gchar* _tmp6_;
			gchar* path = NULL;
			_tmp6_ = g_strdup (path_collection[path_it]);
			path = _tmp6_;
			{
				{
					GFile* f = NULL;
					const gchar* _tmp7_;
					GFile* _tmp8_;
					GFile* _tmp9_;
					_tmp7_ = path;
					_tmp8_ = g_file_new_for_path (_tmp7_);
					f = _tmp8_;
					_tmp9_ = f;
					g_file_delete (_tmp9_, NULL, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_object_unref0 (f);
						goto __catch1_g_error;
					}
					_g_object_unref0 (f);
				}
				goto __finally1;
				__catch1_g_error:
				{
					g_clear_error (&_inner_error0_);
				}
				__finally1:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_free0 (path);
					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;
				}
				_g_free0 (path);
			}
		}
	}
	_tmp10_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_files = (_vala_array_free (self->priv->extra_pending_files, self->priv->extra_pending_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_files = _tmp10_;
	self->priv->extra_pending_files_length1 = 0;
	self->priv->_extra_pending_files_size_ = self->priv->extra_pending_files_length1;
	_tmp11_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_file_names = (_vala_array_free (self->priv->extra_pending_file_names, self->priv->extra_pending_file_names_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_file_names = _tmp11_;
	self->priv->extra_pending_file_names_length1 = 0;
	self->priv->_extra_pending_file_names_size_ = self->priv->extra_pending_file_names_length1;
	_tmp12_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_temp_files = (_vala_array_free (self->priv->extra_pending_temp_files, self->priv->extra_pending_temp_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_temp_files = _tmp12_;
	self->priv->extra_pending_temp_files_length1 = 0;
	self->priv->_extra_pending_temp_files_size_ = self->priv->extra_pending_temp_files_length1;
	_tmp13_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_captions = (_vala_array_free (self->priv->extra_pending_captions, self->priv->extra_pending_captions_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_captions = _tmp13_;
	self->priv->extra_pending_captions_length1 = 0;
	self->priv->_extra_pending_captions_size_ = self->priv->extra_pending_captions_length1;
	_tmp14_ = self->priv->preview_generation;
	self->priv->preview_generation = _tmp14_ + 1;
	_tmp15_ = g_new0 (gchar*, 0 + 1);
	self->priv->previewed_urls = (_vala_array_free (self->priv->previewed_urls, self->priv->previewed_urls_length1, (GDestroyNotify) g_free), NULL);
	self->priv->previewed_urls = _tmp15_;
	self->priv->previewed_urls_length1 = 0;
	self->priv->_previewed_urls_size_ = self->priv->previewed_urls_length1;
	_tmp16_ = self->priv->cancel_attach_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp16_, FALSE);
	_tmp17_ = self->priv->attachment_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp17_, FALSE);
	_tmp18_ = self->priv->attachment_picture;
	gtk_picture_set_paintable (_tmp18_, NULL);
	_tmp19_ = self->priv->attachment_name_label;
	gtk_label_set_label (_tmp19_, "");
	_tmp20_ = self->priv->attachment_meta_label;
	gtk_label_set_label (_tmp20_, "");
	_tmp21_ = self->priv->placeholder_label;
	_tmp22_ = self->priv->placeholder_default;
	gtk_label_set_label (_tmp21_, _tmp22_);
	dc_compose_bar_update_send_stack (self);
	dc_compose_bar_notify_draft_changed (self);
}

static gboolean
string_get_next_char (const gchar* self,
                      gint* index,
                      gunichar* c)
{
	gunichar _vala_c = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_c = g_utf8_get_char (((gchar*) self) + (*index));
	if (_vala_c != ((gunichar) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_utf8_next_char (((gchar*) self) + (*index));
		*index = (gint) (_tmp0_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
}

static gboolean
dc_compose_bar_message_would_be_truncated (DcComposeBar* self,
                                           const gchar* text)
{
	static const gint MAX_LINES = 38;
	static const gint MAX_LINE_LEN = 100;
	gint lines = 0;
	gint line_chars = 0;
	gint i = 0;
	gunichar c = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (text != NULL, FALSE);
	lines = 0;
	line_chars = 0;
	i = 0;
	while (TRUE) {
		gunichar _tmp0_ = 0U;
		gboolean _tmp1_;
		_tmp1_ = string_get_next_char (text, &i, &_tmp0_);
		c = _tmp0_;
		if (!_tmp1_) {
			break;
		}
		if (c == ((gunichar) '\n')) {
			gint _tmp2_;
			line_chars = 0;
			_tmp2_ = lines;
			lines = _tmp2_ + 1;
		} else {
			gint _tmp3_;
			_tmp3_ = line_chars;
			line_chars = _tmp3_ + 1;
			if (line_chars > MAX_LINE_LEN) {
				gint _tmp4_;
				line_chars = 1;
				_tmp4_ = lines;
				lines = _tmp4_ + 1;
			}
		}
		if (lines == MAX_LINES) {
			result = TRUE;
			return result;
		}
	}
	result = FALSE;
	return result;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
dc_compose_bar_update_long_message_hint (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	GtkBox* _tmp5_;
	g_return_if_fail (self != NULL);
	if (self->priv->editing_msg_id == 0) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = dc_compose_bar_get_text (self);
		_tmp2_ = _tmp1_;
		_tmp3_ = string_strip (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = dc_compose_bar_message_would_be_truncated (self, _tmp4_);
		_g_free0 (_tmp4_);
		_g_free0 (_tmp2_);
	} else {
		_tmp0_ = FALSE;
	}
	_tmp5_ = self->priv->long_msg_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp5_, _tmp0_);
}

static void
dc_compose_bar_on_send (DcComposeBar* self)
{
	gchar* text = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint qid = 0;
	gboolean _tmp13_ = FALSE;
	const gchar* _tmp14_;
	gchar** _tmp37_;
	GtkTextView* _tmp38_;
	GtkTextBuffer* _tmp39_;
	GtkTextBuffer* _tmp40_;
	g_return_if_fail (self != NULL);
	dc_compose_bar_hide_mention_popup (self);
	_tmp0_ = dc_compose_bar_get_text (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_strip (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	text = _tmp3_;
	if (self->priv->editing_msg_id > 0) {
		const gchar* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		const gchar* _tmp7_;
		_tmp4_ = text;
		_tmp5_ = strlen (_tmp4_);
		_tmp6_ = _tmp5_;
		if (_tmp6_ == 0) {
			_g_free0 (text);
			return;
		}
		_tmp7_ = text;
		g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_EDIT_MESSAGE_SIGNAL], 0, self->priv->editing_msg_id, _tmp7_);
		dc_compose_bar_cancel_edit (self);
		_g_free0 (text);
		return;
	}
	_tmp9_ = text;
	_tmp10_ = strlen (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_ == 0) {
		const gchar* _tmp12_;
		_tmp12_ = self->priv->pending_file;
		_tmp8_ = _tmp12_ == NULL;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		_g_free0 (text);
		return;
	}
	qid = self->priv->replying_msg_id;
	_tmp14_ = self->priv->pending_file;
	if (_tmp14_ != NULL) {
		_tmp13_ = self->priv->pending_file_is_voice;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp15_ = self->priv->pending_file;
		_tmp16_ = text;
		g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_VOICE_MESSAGE_SIGNAL], 0, _tmp15_, _tmp16_, qid, self->priv->pending_file_is_temp);
	} else {
		const gchar* _tmp17_;
		_tmp17_ = self->priv->pending_file;
		if (_tmp17_ != NULL) {
			gchar* _tmp18_ = NULL;
			const gchar* _tmp19_;
			gchar* _tmp20_;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			_tmp19_ = self->priv->pending_file_name;
			_tmp20_ = g_strdup (_tmp19_);
			_tmp18_ = _tmp20_;
			if (_tmp18_ == NULL) {
				const gchar* _tmp21_;
				gchar* _tmp22_;
				_tmp21_ = self->priv->pending_file;
				_tmp22_ = g_path_get_basename (_tmp21_);
				_g_free0 (_tmp18_);
				_tmp18_ = _tmp22_;
			}
			_tmp23_ = text;
			_tmp24_ = self->priv->pending_file;
			g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_MESSAGE_SIGNAL], 0, _tmp23_, _tmp24_, _tmp18_, qid);
			_g_free0 (_tmp18_);
		} else {
			const gchar* _tmp25_;
			_tmp25_ = text;
			g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_MESSAGE_SIGNAL], 0, _tmp25_, NULL, NULL, qid);
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp26_ = FALSE;
			_tmp26_ = TRUE;
			while (TRUE) {
				gchar** _tmp28_;
				gint _tmp28__length1;
				const gchar* _tmp29_ = NULL;
				gchar** _tmp30_;
				gint _tmp30__length1;
				gchar** _tmp33_;
				gint _tmp33__length1;
				const gchar* _tmp34_;
				gchar** _tmp35_;
				gint _tmp35__length1;
				const gchar* _tmp36_;
				if (!_tmp26_) {
					gint _tmp27_;
					_tmp27_ = i;
					i = _tmp27_ + 1;
				}
				_tmp26_ = FALSE;
				_tmp28_ = self->priv->extra_pending_files;
				_tmp28__length1 = self->priv->extra_pending_files_length1;
				if (!(i < _tmp28__length1)) {
					break;
				}
				_tmp30_ = self->priv->extra_pending_captions;
				_tmp30__length1 = self->priv->extra_pending_captions_length1;
				if (i < _tmp30__length1) {
					gchar** _tmp31_;
					gint _tmp31__length1;
					const gchar* _tmp32_;
					_tmp31_ = self->priv->extra_pending_captions;
					_tmp31__length1 = self->priv->extra_pending_captions_length1;
					_tmp32_ = _tmp31_[i];
					_tmp29_ = _tmp32_;
				} else {
					_tmp29_ = "";
				}
				_tmp33_ = self->priv->extra_pending_files;
				_tmp33__length1 = self->priv->extra_pending_files_length1;
				_tmp34_ = _tmp33_[i];
				_tmp35_ = self->priv->extra_pending_file_names;
				_tmp35__length1 = self->priv->extra_pending_file_names_length1;
				_tmp36_ = _tmp35_[i];
				g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_MESSAGE_SIGNAL], 0, _tmp29_, _tmp34_, _tmp36_, 0);
			}
		}
	}
	self->priv->suppress_draft_signal = TRUE;
	dc_compose_bar_cancel_reply (self);
	self->priv->pending_file_is_temp = FALSE;
	_tmp37_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_temp_files = (_vala_array_free (self->priv->extra_pending_temp_files, self->priv->extra_pending_temp_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_temp_files = _tmp37_;
	self->priv->extra_pending_temp_files_length1 = 0;
	self->priv->_extra_pending_temp_files_size_ = self->priv->extra_pending_temp_files_length1;
	_tmp38_ = self->priv->text_view;
	_tmp39_ = gtk_text_view_get_buffer (_tmp38_);
	_tmp40_ = _tmp39_;
	g_object_set (_tmp40_, "text", "", NULL);
	dc_compose_bar_clear_attachment (self);
	self->priv->suppress_draft_signal = FALSE;
	dc_compose_bar_notify_draft_changed (self);
	_g_free0 (text);
}

void
dc_compose_bar_begin_reply (DcComposeBar* self,
                            gint msg_id,
                            const gchar* sender_name,
                            const gchar* preview)
{
	GtkLabel* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkBox* _tmp5_;
	GtkTextView* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender_name != NULL);
	g_return_if_fail (preview != NULL);
	dc_compose_bar_cancel_edit (self);
	self->priv->replying_msg_id = msg_id;
	_tmp0_ = self->priv->reply_label;
	_tmp1_ = dc_compose_bar_shorten_preview (preview);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("%s: %s", sender_name, _tmp2_);
	_tmp4_ = _tmp3_;
	gtk_label_set_label (_tmp0_, _tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	_tmp5_ = self->priv->reply_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp6_);
	dc_compose_bar_notify_draft_changed (self);
}

static gchar*
dc_compose_bar_shorten_preview (const gchar* text)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = dc_markdown_preview (text, 3, 240);
	result = _tmp0_;
	return result;
}

static void
dc_compose_bar_cancel_reply (DcComposeBar* self)
{
	GtkBox* _tmp0_;
	GtkLabel* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->replying_msg_id = 0;
	_tmp0_ = self->priv->reply_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, FALSE);
	_tmp1_ = self->priv->reply_label;
	gtk_label_set_label (_tmp1_, "");
	dc_compose_bar_notify_draft_changed (self);
}

void
dc_compose_bar_begin_edit (DcComposeBar* self,
                           gint msg_id,
                           const gchar* current_text)
{
	GtkLabel* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkTextView* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_text != NULL);
	dc_compose_bar_cancel_audio_recording (self);
	dc_compose_bar_suspend_current_draft (self);
	self->priv->suppress_draft_signal = TRUE;
	dc_compose_bar_cancel_reply (self);
	dc_compose_bar_clear_attachment (self);
	self->priv->editing_msg_id = msg_id;
	dc_compose_bar_set_entry_text (self, current_text);
	self->priv->suppress_draft_signal = FALSE;
	_tmp0_ = self->priv->placeholder_label;
	gtk_label_set_label (_tmp0_, "Edit message…");
	_tmp1_ = self->priv->cancel_edit_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, TRUE);
	_tmp2_ = self->priv->attach_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, FALSE);
	dc_compose_bar_update_send_stack (self);
	_tmp3_ = self->priv->text_view;
	gtk_widget_grab_focus ((GtkWidget*) _tmp3_);
}

static void
dc_compose_bar_cancel_edit (DcComposeBar* self)
{
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkLabel* _tmp3_;
	const gchar* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	g_return_if_fail (self != NULL);
	if (self->priv->editing_msg_id == 0) {
		return;
	}
	self->priv->suppress_draft_signal = TRUE;
	self->priv->editing_msg_id = 0;
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	g_object_set (_tmp2_, "text", "", NULL);
	_tmp3_ = self->priv->placeholder_label;
	_tmp4_ = self->priv->placeholder_default;
	gtk_label_set_label (_tmp3_, _tmp4_);
	_tmp5_ = self->priv->cancel_edit_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp5_, FALSE);
	_tmp6_ = self->priv->attach_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, TRUE);
	dc_compose_bar_restore_suspended_draft (self);
	self->priv->suppress_draft_signal = FALSE;
	dc_compose_bar_update_send_stack (self);
	dc_compose_bar_notify_draft_changed (self);
}

static gchar**
_vala_array_dup10 (gchar** self,
                   gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static gchar**
_vala_array_dup11 (gchar** self,
                   gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static gchar**
_vala_array_dup12 (gchar** self,
                   gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
dc_compose_bar_suspend_current_draft (DcComposeBar* self)
{
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gchar** _tmp9_;
	gint _tmp9__length1;
	gchar** _tmp10_;
	gint _tmp10__length1;
	GtkLabel* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	g_return_if_fail (self != NULL);
	self->priv->has_suspended_draft = dc_compose_bar_has_unsent_content (self);
	if (!self->priv->has_suspended_draft) {
		return;
	}
	_tmp0_ = dc_compose_bar_get_text (self);
	_g_free0 (self->priv->suspended_draft_text);
	self->priv->suspended_draft_text = _tmp0_;
	_tmp1_ = self->priv->pending_file;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->suspended_draft_file);
	self->priv->suspended_draft_file = _tmp2_;
	_tmp3_ = self->priv->pending_file_name;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (self->priv->suspended_draft_file_name);
	self->priv->suspended_draft_file_name = _tmp4_;
	self->priv->suspended_draft_file_is_temp = self->priv->pending_file_is_temp;
	self->priv->suspended_draft_file_is_voice = self->priv->pending_file_is_voice;
	_tmp5_ = self->priv->extra_pending_files;
	_tmp5__length1 = self->priv->extra_pending_files_length1;
	_tmp6_ = (_tmp5_ != NULL) ? _vala_array_dup10 (_tmp5_, _tmp5__length1) : _tmp5_;
	_tmp6__length1 = _tmp5__length1;
	self->priv->suspended_extra_draft_files = (_vala_array_free (self->priv->suspended_extra_draft_files, self->priv->suspended_extra_draft_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_files = _tmp6_;
	self->priv->suspended_extra_draft_files_length1 = _tmp6__length1;
	self->priv->_suspended_extra_draft_files_size_ = self->priv->suspended_extra_draft_files_length1;
	_tmp7_ = self->priv->extra_pending_file_names;
	_tmp7__length1 = self->priv->extra_pending_file_names_length1;
	_tmp8_ = (_tmp7_ != NULL) ? _vala_array_dup11 (_tmp7_, _tmp7__length1) : _tmp7_;
	_tmp8__length1 = _tmp7__length1;
	self->priv->suspended_extra_draft_file_names = (_vala_array_free (self->priv->suspended_extra_draft_file_names, self->priv->suspended_extra_draft_file_names_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_file_names = _tmp8_;
	self->priv->suspended_extra_draft_file_names_length1 = _tmp8__length1;
	self->priv->_suspended_extra_draft_file_names_size_ = self->priv->suspended_extra_draft_file_names_length1;
	_tmp9_ = self->priv->extra_pending_captions;
	_tmp9__length1 = self->priv->extra_pending_captions_length1;
	_tmp10_ = (_tmp9_ != NULL) ? _vala_array_dup12 (_tmp9_, _tmp9__length1) : _tmp9_;
	_tmp10__length1 = _tmp9__length1;
	self->priv->suspended_extra_draft_captions = (_vala_array_free (self->priv->suspended_extra_draft_captions, self->priv->suspended_extra_draft_captions_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_captions = _tmp10_;
	self->priv->suspended_extra_draft_captions_length1 = _tmp10__length1;
	self->priv->_suspended_extra_draft_captions_size_ = self->priv->suspended_extra_draft_captions_length1;
	self->priv->suspended_replying_msg_id = self->priv->replying_msg_id;
	_tmp11_ = self->priv->reply_label;
	_tmp12_ = gtk_label_get_label (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strdup (_tmp13_);
	_g_free0 (self->priv->suspended_reply_label);
	self->priv->suspended_reply_label = _tmp14_;
}

static void
dc_compose_bar_restore_suspended_draft (DcComposeBar* self)
{
	guint _tmp0_;
	gchar** _tmp1_;
	GtkTextView* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	const gchar* _tmp5_;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_;
	gchar* _tmp33_;
	gchar** _tmp34_;
	gchar** _tmp35_;
	gchar** _tmp36_;
	gchar* _tmp37_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->preview_generation;
	self->priv->preview_generation = _tmp0_ + 1;
	_tmp1_ = g_new0 (gchar*, 0 + 1);
	self->priv->previewed_urls = (_vala_array_free (self->priv->previewed_urls, self->priv->previewed_urls_length1, (GDestroyNotify) g_free), NULL);
	self->priv->previewed_urls = _tmp1_;
	self->priv->previewed_urls_length1 = 0;
	self->priv->_previewed_urls_size_ = self->priv->previewed_urls_length1;
	if (!self->priv->has_suspended_draft) {
		return;
	}
	_tmp2_ = self->priv->text_view;
	_tmp3_ = gtk_text_view_get_buffer (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->suspended_draft_text;
	g_object_set (_tmp4_, "text", _tmp5_, NULL);
	_tmp7_ = self->priv->suspended_draft_file;
	if (_tmp7_ != NULL) {
		const gchar* _tmp8_;
		_tmp8_ = self->priv->suspended_draft_file;
		_tmp6_ = g_file_test (_tmp8_, G_FILE_TEST_EXISTS);
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp9_ = self->priv->suspended_draft_file;
		_tmp10_ = self->priv->suspended_draft_file_name;
		dc_compose_bar_set_pending_attachment (self, _tmp9_, _tmp10_, self->priv->suspended_draft_file_is_temp, "");
		self->priv->pending_file_is_voice = self->priv->suspended_draft_file_is_voice;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp11_ = FALSE;
			_tmp11_ = TRUE;
			while (TRUE) {
				gchar** _tmp13_;
				gint _tmp13__length1;
				gchar* path = NULL;
				gchar** _tmp14_;
				gint _tmp14__length1;
				const gchar* _tmp15_;
				gchar* _tmp16_;
				const gchar* _tmp17_;
				gchar* _tmp18_ = NULL;
				gchar** _tmp19_;
				gint _tmp19__length1;
				const gchar* _tmp25_ = NULL;
				gchar** _tmp26_;
				gint _tmp26__length1;
				const gchar* _tmp29_;
				if (!_tmp11_) {
					gint _tmp12_;
					_tmp12_ = i;
					i = _tmp12_ + 1;
				}
				_tmp11_ = FALSE;
				_tmp13_ = self->priv->suspended_extra_draft_files;
				_tmp13__length1 = self->priv->suspended_extra_draft_files_length1;
				if (!(i < _tmp13__length1)) {
					break;
				}
				_tmp14_ = self->priv->suspended_extra_draft_files;
				_tmp14__length1 = self->priv->suspended_extra_draft_files_length1;
				_tmp15_ = _tmp14_[i];
				_tmp16_ = g_strdup (_tmp15_);
				path = _tmp16_;
				_tmp17_ = path;
				if (!g_file_test (_tmp17_, G_FILE_TEST_EXISTS)) {
					_g_free0 (path);
					continue;
				}
				_tmp19_ = self->priv->suspended_extra_draft_file_names;
				_tmp19__length1 = self->priv->suspended_extra_draft_file_names_length1;
				if (i < _tmp19__length1) {
					gchar** _tmp20_;
					gint _tmp20__length1;
					const gchar* _tmp21_;
					gchar* _tmp22_;
					_tmp20_ = self->priv->suspended_extra_draft_file_names;
					_tmp20__length1 = self->priv->suspended_extra_draft_file_names_length1;
					_tmp21_ = _tmp20_[i];
					_tmp22_ = g_strdup (_tmp21_);
					_g_free0 (_tmp18_);
					_tmp18_ = _tmp22_;
				} else {
					const gchar* _tmp23_;
					gchar* _tmp24_;
					_tmp23_ = path;
					_tmp24_ = g_path_get_basename (_tmp23_);
					_g_free0 (_tmp18_);
					_tmp18_ = _tmp24_;
				}
				_tmp26_ = self->priv->suspended_extra_draft_captions;
				_tmp26__length1 = self->priv->suspended_extra_draft_captions_length1;
				if (i < _tmp26__length1) {
					gchar** _tmp27_;
					gint _tmp27__length1;
					const gchar* _tmp28_;
					_tmp27_ = self->priv->suspended_extra_draft_captions;
					_tmp27__length1 = self->priv->suspended_extra_draft_captions_length1;
					_tmp28_ = _tmp27_[i];
					_tmp25_ = _tmp28_;
				} else {
					_tmp25_ = "";
				}
				_tmp29_ = path;
				dc_compose_bar_set_pending_attachment (self, _tmp29_, _tmp18_, FALSE, _tmp25_);
				_g_free0 (_tmp18_);
				_g_free0 (path);
			}
		}
	}
	if (self->priv->suspended_replying_msg_id > 0) {
		GtkLabel* _tmp30_;
		const gchar* _tmp31_;
		GtkBox* _tmp32_;
		self->priv->replying_msg_id = self->priv->suspended_replying_msg_id;
		_tmp30_ = self->priv->reply_label;
		_tmp31_ = self->priv->suspended_reply_label;
		gtk_label_set_label (_tmp30_, _tmp31_);
		_tmp32_ = self->priv->reply_bar;
		gtk_widget_set_visible ((GtkWidget*) _tmp32_, TRUE);
	}
	self->priv->has_suspended_draft = FALSE;
	_tmp33_ = g_strdup ("");
	_g_free0 (self->priv->suspended_draft_text);
	self->priv->suspended_draft_text = _tmp33_;
	_g_free0 (self->priv->suspended_draft_file);
	self->priv->suspended_draft_file = NULL;
	_g_free0 (self->priv->suspended_draft_file_name);
	self->priv->suspended_draft_file_name = NULL;
	_tmp34_ = g_new0 (gchar*, 0 + 1);
	self->priv->suspended_extra_draft_files = (_vala_array_free (self->priv->suspended_extra_draft_files, self->priv->suspended_extra_draft_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_files = _tmp34_;
	self->priv->suspended_extra_draft_files_length1 = 0;
	self->priv->_suspended_extra_draft_files_size_ = self->priv->suspended_extra_draft_files_length1;
	_tmp35_ = g_new0 (gchar*, 0 + 1);
	self->priv->suspended_extra_draft_file_names = (_vala_array_free (self->priv->suspended_extra_draft_file_names, self->priv->suspended_extra_draft_file_names_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_file_names = _tmp35_;
	self->priv->suspended_extra_draft_file_names_length1 = 0;
	self->priv->_suspended_extra_draft_file_names_size_ = self->priv->suspended_extra_draft_file_names_length1;
	_tmp36_ = g_new0 (gchar*, 0 + 1);
	self->priv->suspended_extra_draft_captions = (_vala_array_free (self->priv->suspended_extra_draft_captions, self->priv->suspended_extra_draft_captions_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_captions = _tmp36_;
	self->priv->suspended_extra_draft_captions_length1 = 0;
	self->priv->_suspended_extra_draft_captions_size_ = self->priv->suspended_extra_draft_captions_length1;
	self->priv->suspended_replying_msg_id = 0;
	_tmp37_ = g_strdup ("");
	_g_free0 (self->priv->suspended_reply_label);
	self->priv->suspended_reply_label = _tmp37_;
}

void
dc_compose_bar_restore_draft (DcComposeBar* self,
                              DcMessage* draft)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp25_;
	gint _tmp26_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (draft != NULL);
	if (self->priv->editing_msg_id > 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = dc_compose_bar_has_unsent_content (self);
	}
	if (_tmp0_) {
		return;
	}
	self->priv->suppress_draft_signal = TRUE;
	dc_compose_bar_cancel_reply (self);
	dc_compose_bar_clear_attachment (self);
	_tmp2_ = dc_message_get_text (draft);
	_tmp3_ = _tmp2_;
	_tmp1_ = _tmp3_;
	if (_tmp1_ == NULL) {
		_tmp1_ = "";
	}
	dc_compose_bar_set_entry_text (self, _tmp1_);
	_tmp6_ = dc_message_get_file_path (draft);
	_tmp7_ = _tmp6_;
	if (_tmp7_ != NULL) {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp8_ = dc_message_get_file_path (draft);
		_tmp9_ = _tmp8_;
		_tmp10_ = strlen (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp5_ = _tmp11_ > 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp12_ = dc_message_get_file_path (draft);
		_tmp13_ = _tmp12_;
		_tmp4_ = g_file_test (_tmp13_, G_FILE_TEST_EXISTS);
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gboolean _tmp18_ = FALSE;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		_tmp14_ = dc_message_get_file_path (draft);
		_tmp15_ = _tmp14_;
		_tmp16_ = dc_message_get_file_name (draft);
		_tmp17_ = _tmp16_;
		dc_compose_bar_set_pending_attachment (self, _tmp15_, _tmp17_, FALSE, "");
		_tmp19_ = dc_message_get_view_type (draft);
		_tmp20_ = _tmp19_;
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			gchar* _tmp23_;
			gchar* _tmp24_;
			_tmp21_ = dc_message_get_view_type (draft);
			_tmp22_ = _tmp21_;
			_tmp23_ = g_utf8_strdown (_tmp22_, (gssize) -1);
			_tmp24_ = _tmp23_;
			_tmp18_ = g_strcmp0 (_tmp24_, "voice") == 0;
			_g_free0 (_tmp24_);
		} else {
			_tmp18_ = FALSE;
		}
		self->priv->pending_file_is_voice = _tmp18_;
	}
	_tmp25_ = dc_message_get_quote_msg_id (draft);
	_tmp26_ = _tmp25_;
	if (_tmp26_ > 0) {
		gint _tmp27_;
		gint _tmp28_;
		const gchar* _tmp29_ = NULL;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		gchar* sender = NULL;
		gchar* _tmp32_;
		gchar* _tmp33_ = NULL;
		const gchar* _tmp34_;
		const gchar* _tmp35_;
		gchar* _tmp36_;
		gchar* preview = NULL;
		gchar* _tmp40_;
		GtkLabel* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		gchar* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		gchar* _tmp47_;
		GtkBox* _tmp48_;
		_tmp27_ = dc_message_get_quote_msg_id (draft);
		_tmp28_ = _tmp27_;
		self->priv->replying_msg_id = _tmp28_;
		_tmp30_ = dc_message_get_quote_sender_name (draft);
		_tmp31_ = _tmp30_;
		_tmp29_ = _tmp31_;
		if (_tmp29_ == NULL) {
			_tmp29_ = "Message";
		}
		_tmp32_ = g_strdup (_tmp29_);
		sender = _tmp32_;
		_tmp34_ = dc_message_get_quote_text (draft);
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strdup (_tmp35_);
		_tmp33_ = _tmp36_;
		if (_tmp33_ == NULL) {
			gint _tmp37_;
			gint _tmp38_;
			gchar* _tmp39_;
			_tmp37_ = dc_message_get_quote_msg_id (draft);
			_tmp38_ = _tmp37_;
			_tmp39_ = g_strdup_printf ("%i", _tmp38_);
			_g_free0 (_tmp33_);
			_tmp33_ = _tmp39_;
		}
		_tmp40_ = _tmp33_;
		_tmp33_ = NULL;
		preview = _tmp40_;
		_tmp41_ = self->priv->reply_label;
		_tmp42_ = sender;
		_tmp43_ = preview;
		_tmp44_ = dc_compose_bar_shorten_preview (_tmp43_);
		_tmp45_ = _tmp44_;
		_tmp46_ = g_strdup_printf ("%s: %s", _tmp42_, _tmp45_);
		_tmp47_ = _tmp46_;
		gtk_label_set_label (_tmp41_, _tmp47_);
		_g_free0 (_tmp47_);
		_g_free0 (_tmp45_);
		_tmp48_ = self->priv->reply_bar;
		gtk_widget_set_visible ((GtkWidget*) _tmp48_, TRUE);
		_g_free0 (preview);
		_g_free0 (_tmp33_);
		_g_free0 (sender);
	}
	self->priv->suppress_draft_signal = FALSE;
	dc_compose_bar_update_placeholder (self);
}

gboolean
dc_compose_bar_has_active_mode (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->editing_msg_id != 0) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = self->priv->replying_msg_id != 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->pending_file;
		_tmp1_ = _tmp3_ != NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = dc_compose_bar_is_recording_mode (self);
	}
	result = _tmp0_;
	return result;
}

gboolean
dc_compose_bar_has_unsent_content (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp3_ = self->priv->text_view;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	if (gtk_text_buffer_get_char_count (_tmp5_) > 0) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = self->priv->replying_msg_id != 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = self->priv->pending_file;
		_tmp1_ = _tmp6_ != NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = dc_compose_bar_is_recording_mode (self);
	}
	result = _tmp0_;
	return result;
}

gboolean
dc_compose_bar_entry_has_focus (DcComposeBar* self)
{
	GtkWindow* root = NULL;
	GtkRoot* _tmp0_;
	GtkWindow* _tmp1_;
	GtkWindow* _tmp2_;
	GtkWidget* fw = NULL;
	GtkWindow* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	gboolean _tmp6_ = FALSE;
	GtkWidget* _tmp7_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_window_get_type ()) ? ((GtkWindow*) _tmp0_) : NULL);
	root = _tmp1_;
	_tmp2_ = root;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_object_unref0 (root);
		return result;
	}
	_tmp3_ = root;
	_tmp4_ = gtk_window_get_focus (_tmp3_);
	_tmp5_ = _g_object_ref0 (_tmp4_);
	fw = _tmp5_;
	_tmp7_ = fw;
	if (_tmp7_ != NULL) {
		gboolean _tmp8_ = FALSE;
		GtkWidget* _tmp9_;
		GtkTextView* _tmp10_;
		_tmp9_ = fw;
		_tmp10_ = self->priv->text_view;
		if (_tmp9_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_widget_get_type (), GtkWidget)) {
			_tmp8_ = TRUE;
		} else {
			GtkWidget* _tmp11_;
			GtkTextView* _tmp12_;
			_tmp11_ = fw;
			_tmp12_ = self->priv->text_view;
			_tmp8_ = gtk_widget_is_ancestor (_tmp11_, (GtkWidget*) _tmp12_);
		}
		_tmp6_ = _tmp8_;
	} else {
		_tmp6_ = FALSE;
	}
	result = _tmp6_;
	_g_object_unref0 (fw);
	_g_object_unref0 (root);
	return result;
}

void
dc_compose_bar_cancel_active_mode (DcComposeBar* self)
{
	g_return_if_fail (self != NULL);
	if (dc_compose_bar_is_recording_mode (self)) {
		dc_compose_bar_cancel_audio_recording (self);
		return;
	}
	dc_compose_bar_cancel_edit (self);
	dc_compose_bar_cancel_reply (self);
	dc_compose_bar_clear_attachment (self);
}

static void
dc_compose_bar_on_emoji_picked (DcComposeBar* self,
                                const gchar* emoji)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (emoji != NULL);
	if (!dc_compose_bar_replace_emoji_trigger (self, emoji)) {
		GtkTextView* _tmp0_;
		GtkTextBuffer* _tmp1_;
		GtkTextBuffer* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp0_ = self->priv->text_view;
		_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = strlen (emoji);
		_tmp4_ = _tmp3_;
		gtk_text_buffer_insert_at_cursor (_tmp2_, emoji, _tmp4_);
	}
	dc_compose_bar_grab_entry_focus (self);
}

static Block34Data*
block34_data_ref (Block34Data* _data34_)
{
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}

static void
block34_data_unref (void * _userdata_)
{
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		DcComposeBar* self;
		self = _data34_->self;
		_g_object_unref0 (_data34_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}

static void
__lambda20_ (Block34Data* _data34_,
             GObject* obj,
             GAsyncResult* res)
{
	DcComposeBar* self;
	GError* _inner_error0_ = NULL;
	self = _data34_->self;
	g_return_if_fail (res != NULL);
	{
		GListModel* files = NULL;
		GListModel* _tmp0_;
		_tmp0_ = gtk_file_dialog_open_multiple_finish (_data34_->dialog, res, &_inner_error0_);
		files = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		{
			guint i = 0U;
			i = (guint) 0;
			{
				gboolean _tmp1_ = FALSE;
				_tmp1_ = TRUE;
				while (TRUE) {
					GListModel* _tmp3_;
					GFile* file = NULL;
					GListModel* _tmp4_;
					GObject* _tmp5_;
					GFile* _tmp6_;
					GFile* _tmp7_;
					gchar* path = NULL;
					GFile* _tmp8_;
					gchar* _tmp9_;
					const gchar* _tmp10_;
					if (!_tmp1_) {
						guint _tmp2_;
						_tmp2_ = i;
						i = _tmp2_ + 1;
					}
					_tmp1_ = FALSE;
					_tmp3_ = files;
					if (!(i < g_list_model_get_n_items (_tmp3_))) {
						break;
					}
					_tmp4_ = files;
					_tmp5_ = g_list_model_get_item (_tmp4_, i);
					_tmp6_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, g_file_get_type ()) ? ((GFile*) _tmp5_) : NULL;
					if (_tmp6_ == NULL) {
						_g_object_unref0 (_tmp5_);
					}
					file = _tmp6_;
					_tmp7_ = file;
					if (_tmp7_ == NULL) {
						_g_object_unref0 (file);
						continue;
					}
					_tmp8_ = file;
					_tmp9_ = g_file_get_path (_tmp8_);
					path = _tmp9_;
					_tmp10_ = path;
					if (_tmp10_ != NULL) {
						const gchar* _tmp11_;
						GFile* _tmp12_;
						gchar* _tmp13_;
						gchar* _tmp14_;
						_tmp11_ = path;
						_tmp12_ = file;
						_tmp13_ = g_file_get_basename (_tmp12_);
						_tmp14_ = _tmp13_;
						dc_compose_bar_set_pending_attachment (self, _tmp11_, _tmp14_, FALSE, "");
						_g_free0 (_tmp14_);
					}
					_g_free0 (path);
					_g_object_unref0 (file);
				}
			}
		}
		_g_object_unref0 (files);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp15_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp15_ = e;
		if (!dc_is_dialog_dismissal (_tmp15_)) {
			GError* _tmp16_;
			const gchar* _tmp17_;
			_tmp16_ = e;
			_tmp17_ = _tmp16_->message;
			g_warning ("compose_bar.vala:1392: attachment picker: %s", _tmp17_);
		}
		_g_error_free0 (e);
	}
	__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
___lambda20__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda20_ (self, source_object, res);
	block34_data_unref (self);
}

static void
dc_compose_bar_on_attach_clicked (DcComposeBar* self)
{
	Block34Data* _data34_;
	GtkFileDialog* _tmp0_;
	GtkWindow* window = NULL;
	GtkRoot* _tmp1_;
	GtkWindow* _tmp2_;
	GtkWindow* _tmp3_;
	g_return_if_fail (self != NULL);
	_data34_ = g_slice_new0 (Block34Data);
	_data34_->_ref_count_ = 1;
	_data34_->self = g_object_ref (self);
	_tmp0_ = gtk_file_dialog_new ();
	_data34_->dialog = _tmp0_;
	gtk_file_dialog_set_title (_data34_->dialog, "Select files to attach");
	_tmp1_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow));
	window = _tmp2_;
	_tmp3_ = window;
	gtk_file_dialog_open_multiple (_data34_->dialog, _tmp3_, NULL, ___lambda20__gasync_ready_callback, block34_data_ref (_data34_));
	_g_object_unref0 (window);
	block34_data_unref (_data34_);
	_data34_ = NULL;
}

static gboolean
dc_compose_bar_on_entry_key_pressed (DcComposeBar* self,
                                     guint keyval,
                                     guint keycode,
                                     GdkModifierType state)
{
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean shift = FALSE;
	gboolean _tmp13_ = FALSE;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp17_ = FALSE;
	gboolean primary_v = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->mention_popup_visible) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_ = FALSE;
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_ = FALSE;
		gboolean _tmp4_ = FALSE;
		if (keyval == GDK_KEY_Down) {
			_tmp0_ = TRUE;
		} else {
			_tmp0_ = keyval == GDK_KEY_KP_Down;
		}
		if (_tmp0_) {
			dc_compose_bar_move_mention_selection (self, 1);
			result = TRUE;
			return result;
		}
		if (keyval == GDK_KEY_Up) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = keyval == GDK_KEY_KP_Up;
		}
		if (_tmp1_) {
			dc_compose_bar_move_mention_selection (self, -1);
			result = TRUE;
			return result;
		}
		if (keyval == GDK_KEY_Return) {
			_tmp4_ = TRUE;
		} else {
			_tmp4_ = keyval == GDK_KEY_KP_Enter;
		}
		if (_tmp4_) {
			_tmp3_ = TRUE;
		} else {
			_tmp3_ = keyval == GDK_KEY_ISO_Enter;
		}
		if (_tmp3_) {
			_tmp2_ = TRUE;
		} else {
			_tmp2_ = keyval == GDK_KEY_Tab;
		}
		if (_tmp2_) {
			dc_compose_bar_accept_mention (self);
			result = TRUE;
			return result;
		}
		if (keyval == GDK_KEY_Escape) {
			dc_compose_bar_hide_mention_popup (self);
			result = TRUE;
			return result;
		}
	}
	if (dc_compose_bar_is_plain_colon_key (keyval, state)) {
		_tmp5_ = dc_compose_bar_previous_char_is_colon (self);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		dc_compose_bar_open_emoji_picker_after_typed_colon (self);
		result = FALSE;
		return result;
	}
	if (keyval == GDK_KEY_Up) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = keyval == GDK_KEY_KP_Up;
	}
	if (_tmp9_) {
		_tmp8_ = (state & ((GDK_SHIFT_MASK | GDK_CONTROL_MASK) | GDK_ALT_MASK)) == 0;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		GtkTextView* _tmp10_;
		GtkTextBuffer* _tmp11_;
		GtkTextBuffer* _tmp12_;
		_tmp10_ = self->priv->text_view;
		_tmp11_ = gtk_text_view_get_buffer (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp7_ = gtk_text_buffer_get_char_count (_tmp12_) == 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		_tmp6_ = !dc_compose_bar_has_active_mode (self);
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		g_signal_emit (self, dc_compose_bar_signals[DC_COMPOSE_BAR_EDIT_LAST_REQUESTED_SIGNAL], 0);
		result = TRUE;
		return result;
	}
	shift = (state & GDK_SHIFT_MASK) != 0;
	if (keyval == GDK_KEY_Return) {
		_tmp14_ = TRUE;
	} else {
		_tmp14_ = keyval == GDK_KEY_KP_Enter;
	}
	if (_tmp14_) {
		_tmp13_ = TRUE;
	} else {
		_tmp13_ = keyval == GDK_KEY_ISO_Enter;
	}
	if (_tmp13_) {
		gboolean _tmp15_ = FALSE;
		gboolean _tmp16_;
		gboolean should_send = FALSE;
		_tmp16_ = self->priv->_shift_enter_sends;
		if (_tmp16_) {
			_tmp15_ = shift;
		} else {
			_tmp15_ = !shift;
		}
		should_send = _tmp15_;
		if (!should_send) {
			result = FALSE;
			return result;
		}
		dc_compose_bar_on_send (self);
		result = TRUE;
		return result;
	}
	if (dc_platform_has_primary_modifier (state)) {
		gboolean _tmp18_ = FALSE;
		if (keyval == GDK_KEY_v) {
			_tmp18_ = TRUE;
		} else {
			_tmp18_ = keyval == GDK_KEY_V;
		}
		_tmp17_ = _tmp18_;
	} else {
		_tmp17_ = FALSE;
	}
	primary_v = _tmp17_;
	if (!primary_v) {
		gboolean _tmp20_ = FALSE;
		if (shift) {
			_tmp20_ = keyval == GDK_KEY_Insert;
		} else {
			_tmp20_ = FALSE;
		}
		_tmp19_ = !_tmp20_;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		result = FALSE;
		return result;
	}
	dc_compose_bar_start_clipboard_paste (self);
	result = TRUE;
	return result;
}

static void
dc_compose_bar_on_paste_clipboard (DcComposeBar* self)
{
	GtkTextView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->text_view;
	g_signal_stop_emission_by_name (_tmp0_, "paste-clipboard");
	dc_compose_bar_start_clipboard_paste (self);
}

static gpointer
_gdk_content_formats_ref0 (gpointer self)
{
	return self ? gdk_content_formats_ref (self) : NULL;
}

static void
dc_compose_bar_start_clipboard_paste (DcComposeBar* self)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	gboolean replace_selection = FALSE;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean has_files = FALSE;
	gboolean has_texture = FALSE;
	GdkClipboard* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_display ((GtkWidget*) self);
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = self->priv->text_view;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = gtk_text_buffer_get_has_selection (_tmp5_);
	_tmp7_ = _tmp6_;
	replace_selection = _tmp7_;
	has_files = FALSE;
	has_texture = FALSE;
	if (dc_compose_bar_can_accept_attachment (self)) {
		GdkContentFormats* formats = NULL;
		GdkClipboard* _tmp8_;
		GdkContentFormats* _tmp9_;
		GdkContentFormats* _tmp10_;
		GdkContentFormats* _tmp11_;
		GdkContentFormats* _tmp12_;
		_tmp8_ = clipboard;
		_tmp9_ = gdk_clipboard_get_formats (_tmp8_);
		_tmp10_ = _gdk_content_formats_ref0 (_tmp9_);
		formats = _tmp10_;
		_tmp11_ = formats;
		has_files = gdk_content_formats_contain_gtype (_tmp11_, gdk_file_list_get_type ());
		_tmp12_ = formats;
		has_texture = gdk_content_formats_contain_gtype (_tmp12_, gdk_texture_get_type ());
		_gdk_content_formats_unref0 (formats);
	}
	_tmp13_ = clipboard;
	dc_compose_bar_paste_from_clipboard (self, _tmp13_, has_files, has_texture, replace_selection, NULL, NULL);
	_g_object_unref0 (clipboard);
}

static gboolean
dc_compose_bar_is_plain_colon_key (guint keyval,
                                   GdkModifierType state)
{
	GdkModifierType mods = 0U;
	gboolean result;
	if (keyval != GDK_KEY_colon) {
		result = FALSE;
		return result;
	}
	mods = state & (((GDK_CONTROL_MASK | GDK_ALT_MASK) | GDK_SUPER_MASK) | GDK_META_MASK);
	result = mods == 0;
	return result;
}

static gboolean
dc_compose_bar_previous_char_is_colon (DcComposeBar* self)
{
	GtkTextIter cursor = {0};
	GtkTextIter selection_start = {0};
	GtkTextIter selection_end = {0};
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter _tmp3_ = {0};
	GtkTextIter _tmp4_ = {0};
	gboolean _tmp5_;
	GtkTextIter previous = {0};
	GtkTextIter _tmp15_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp5_ = gtk_text_buffer_get_selection_bounds (_tmp2_, &_tmp3_, &_tmp4_);
	selection_start = _tmp3_;
	selection_end = _tmp4_;
	if (_tmp5_) {
		GtkTextIter _tmp6_;
		_tmp6_ = selection_start;
		cursor = _tmp6_;
	} else {
		GtkTextView* _tmp7_;
		GtkTextBuffer* _tmp8_;
		GtkTextBuffer* _tmp9_;
		GtkTextView* _tmp10_;
		GtkTextBuffer* _tmp11_;
		GtkTextBuffer* _tmp12_;
		GtkTextMark* _tmp13_;
		GtkTextIter _tmp14_ = {0};
		_tmp7_ = self->priv->text_view;
		_tmp8_ = gtk_text_view_get_buffer (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = self->priv->text_view;
		_tmp11_ = gtk_text_view_get_buffer (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = gtk_text_buffer_get_insert (_tmp12_);
		gtk_text_buffer_get_iter_at_mark (_tmp9_, &_tmp14_, _tmp13_);
		cursor = _tmp14_;
	}
	_tmp15_ = cursor;
	previous = _tmp15_;
	if (!gtk_text_iter_backward_char (&previous)) {
		result = FALSE;
		return result;
	}
	result = gtk_text_iter_get_char (&previous) == ((gunichar) ':');
	return result;
}

static gboolean
__lambda27_ (DcComposeBar* self)
{
	gboolean _tmp0_ = FALSE;
	GtkMenuButton* _tmp1_;
	GtkPopover* _tmp2_;
	gboolean result;
	_tmp1_ = self->priv->emoji_button;
	_tmp2_ = gtk_menu_button_get_popover (_tmp1_);
	if (_tmp2_ != NULL) {
		_tmp0_ = dc_compose_bar_remember_typed_colon_trigger (self);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkMenuButton* _tmp3_;
		_tmp3_ = self->priv->emoji_button;
		gtk_menu_button_popup (_tmp3_);
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda27__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda27_ ((DcComposeBar*) self);
	return result;
}

static void
dc_compose_bar_open_emoji_picker_after_typed_colon (DcComposeBar* self)
{
	g_return_if_fail (self != NULL);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda27__gsource_func, g_object_ref (self), g_object_unref);
}

static gboolean
dc_compose_bar_remember_typed_colon_trigger (DcComposeBar* self)
{
	GtkTextIter end = {0};
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextMark* _tmp6_;
	GtkTextIter _tmp7_ = {0};
	GtkTextIter start = {0};
	GtkTextIter _tmp8_;
	gboolean _tmp9_ = FALSE;
	GtkTextView* _tmp10_;
	GtkTextBuffer* _tmp11_;
	GtkTextBuffer* _tmp12_;
	GtkTextIter _tmp13_;
	GtkTextIter _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gboolean _tmp17_;
	GtkTextView* _tmp18_;
	GtkTextBuffer* _tmp19_;
	GtkTextBuffer* _tmp20_;
	GtkTextIter _tmp21_;
	GtkTextView* _tmp22_;
	GtkTextBuffer* _tmp23_;
	GtkTextBuffer* _tmp24_;
	GtkTextIter _tmp25_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	dc_compose_bar_clear_emoji_trigger_marks (self);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->text_view;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = gtk_text_buffer_get_insert (_tmp5_);
	gtk_text_buffer_get_iter_at_mark (_tmp2_, &_tmp7_, _tmp6_);
	end = _tmp7_;
	_tmp8_ = end;
	start = _tmp8_;
	if (!gtk_text_iter_backward_char (&start)) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = !gtk_text_iter_backward_char (&start);
	}
	if (_tmp9_) {
		result = FALSE;
		return result;
	}
	_tmp10_ = self->priv->text_view;
	_tmp11_ = gtk_text_view_get_buffer (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = start;
	_tmp14_ = end;
	_tmp15_ = gtk_text_buffer_get_text (_tmp12_, &_tmp13_, &_tmp14_, FALSE);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strcmp0 (_tmp16_, "::") != 0;
	_g_free0 (_tmp16_);
	if (_tmp17_) {
		result = FALSE;
		return result;
	}
	_tmp18_ = self->priv->text_view;
	_tmp19_ = gtk_text_view_get_buffer (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = start;
	gtk_text_buffer_create_mark (_tmp20_, DC_COMPOSE_BAR_EMOJI_TRIGGER_START_MARK, &_tmp21_, TRUE);
	_tmp22_ = self->priv->text_view;
	_tmp23_ = gtk_text_view_get_buffer (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = end;
	gtk_text_buffer_create_mark (_tmp24_, DC_COMPOSE_BAR_EMOJI_TRIGGER_END_MARK, &_tmp25_, FALSE);
	result = TRUE;
	return result;
}

static gboolean
dc_compose_bar_replace_emoji_trigger (DcComposeBar* self,
                                      const gchar* emoji)
{
	GtkTextMark* start_mark = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextMark* _tmp3_;
	GtkTextMark* _tmp4_;
	GtkTextMark* end_mark = NULL;
	GtkTextView* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextMark* _tmp8_;
	GtkTextMark* _tmp9_;
	gboolean _tmp10_ = FALSE;
	GtkTextMark* _tmp11_;
	GtkTextIter start = {0};
	GtkTextIter end = {0};
	GtkTextView* _tmp13_;
	GtkTextBuffer* _tmp14_;
	GtkTextBuffer* _tmp15_;
	GtkTextMark* _tmp16_;
	GtkTextIter _tmp17_ = {0};
	GtkTextView* _tmp18_;
	GtkTextBuffer* _tmp19_;
	GtkTextBuffer* _tmp20_;
	GtkTextMark* _tmp21_;
	GtkTextIter _tmp22_ = {0};
	gboolean _tmp23_ = FALSE;
	GtkTextIter _tmp24_;
	GtkTextView* _tmp32_;
	GtkTextBuffer* _tmp33_;
	GtkTextBuffer* _tmp34_;
	GtkTextView* _tmp35_;
	GtkTextBuffer* _tmp36_;
	GtkTextBuffer* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (emoji != NULL, FALSE);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_text_buffer_get_mark (_tmp2_, DC_COMPOSE_BAR_EMOJI_TRIGGER_START_MARK);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	start_mark = _tmp4_;
	_tmp5_ = self->priv->text_view;
	_tmp6_ = gtk_text_view_get_buffer (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = gtk_text_buffer_get_mark (_tmp7_, DC_COMPOSE_BAR_EMOJI_TRIGGER_END_MARK);
	_tmp9_ = _g_object_ref0 (_tmp8_);
	end_mark = _tmp9_;
	_tmp11_ = start_mark;
	if (_tmp11_ == NULL) {
		_tmp10_ = TRUE;
	} else {
		GtkTextMark* _tmp12_;
		_tmp12_ = end_mark;
		_tmp10_ = _tmp12_ == NULL;
	}
	if (_tmp10_) {
		result = FALSE;
		_g_object_unref0 (end_mark);
		_g_object_unref0 (start_mark);
		return result;
	}
	_tmp13_ = self->priv->text_view;
	_tmp14_ = gtk_text_view_get_buffer (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = start_mark;
	gtk_text_buffer_get_iter_at_mark (_tmp15_, &_tmp17_, _tmp16_);
	start = _tmp17_;
	_tmp18_ = self->priv->text_view;
	_tmp19_ = gtk_text_view_get_buffer (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = end_mark;
	gtk_text_buffer_get_iter_at_mark (_tmp20_, &_tmp22_, _tmp21_);
	end = _tmp22_;
	_tmp24_ = end;
	if (gtk_text_iter_compare (&start, &_tmp24_) >= 0) {
		_tmp23_ = TRUE;
	} else {
		GtkTextView* _tmp25_;
		GtkTextBuffer* _tmp26_;
		GtkTextBuffer* _tmp27_;
		GtkTextIter _tmp28_;
		GtkTextIter _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		_tmp25_ = self->priv->text_view;
		_tmp26_ = gtk_text_view_get_buffer (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = start;
		_tmp29_ = end;
		_tmp30_ = gtk_text_buffer_get_text (_tmp27_, &_tmp28_, &_tmp29_, FALSE);
		_tmp31_ = _tmp30_;
		_tmp23_ = g_strcmp0 (_tmp31_, "::") != 0;
		_g_free0 (_tmp31_);
	}
	if (_tmp23_) {
		dc_compose_bar_clear_emoji_trigger_marks (self);
		result = FALSE;
		_g_object_unref0 (end_mark);
		_g_object_unref0 (start_mark);
		return result;
	}
	_tmp32_ = self->priv->text_view;
	_tmp33_ = gtk_text_view_get_buffer (_tmp32_);
	_tmp34_ = _tmp33_;
	gtk_text_buffer_delete (_tmp34_, &start, &end);
	_tmp35_ = self->priv->text_view;
	_tmp36_ = gtk_text_view_get_buffer (_tmp35_);
	_tmp37_ = _tmp36_;
	_tmp38_ = strlen (emoji);
	_tmp39_ = _tmp38_;
	gtk_text_buffer_insert (_tmp37_, &start, emoji, _tmp39_);
	dc_compose_bar_clear_emoji_trigger_marks (self);
	result = TRUE;
	_g_object_unref0 (end_mark);
	_g_object_unref0 (start_mark);
	return result;
}

static void
dc_compose_bar_clear_emoji_trigger_marks (DcComposeBar* self)
{
	GtkTextMark* start_mark = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextMark* _tmp3_;
	GtkTextMark* _tmp4_;
	GtkTextMark* _tmp5_;
	GtkTextMark* end_mark = NULL;
	GtkTextView* _tmp10_;
	GtkTextBuffer* _tmp11_;
	GtkTextBuffer* _tmp12_;
	GtkTextMark* _tmp13_;
	GtkTextMark* _tmp14_;
	GtkTextMark* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->text_view;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_text_buffer_get_mark (_tmp2_, DC_COMPOSE_BAR_EMOJI_TRIGGER_START_MARK);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	start_mark = _tmp4_;
	_tmp5_ = start_mark;
	if (_tmp5_ != NULL) {
		GtkTextView* _tmp6_;
		GtkTextBuffer* _tmp7_;
		GtkTextBuffer* _tmp8_;
		GtkTextMark* _tmp9_;
		_tmp6_ = self->priv->text_view;
		_tmp7_ = gtk_text_view_get_buffer (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = start_mark;
		gtk_text_buffer_delete_mark (_tmp8_, _tmp9_);
	}
	_tmp10_ = self->priv->text_view;
	_tmp11_ = gtk_text_view_get_buffer (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = gtk_text_buffer_get_mark (_tmp12_, DC_COMPOSE_BAR_EMOJI_TRIGGER_END_MARK);
	_tmp14_ = _g_object_ref0 (_tmp13_);
	end_mark = _tmp14_;
	_tmp15_ = end_mark;
	if (_tmp15_ != NULL) {
		GtkTextView* _tmp16_;
		GtkTextBuffer* _tmp17_;
		GtkTextBuffer* _tmp18_;
		GtkTextMark* _tmp19_;
		_tmp16_ = self->priv->text_view;
		_tmp17_ = gtk_text_view_get_buffer (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = end_mark;
		gtk_text_buffer_delete_mark (_tmp18_, _tmp19_);
	}
	_g_object_unref0 (end_mark);
	_g_object_unref0 (start_mark);
}

static void
dc_compose_bar_paste_from_clipboard_data_free (gpointer _data)
{
	DcComposeBarPasteFromClipboardData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->clipboard);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcComposeBarPasteFromClipboardData, _data_);
}

static void
dc_compose_bar_paste_from_clipboard (DcComposeBar* self,
                                     GdkClipboard* clipboard,
                                     gboolean try_files,
                                     gboolean try_texture,
                                     gboolean replace_selection,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcComposeBarPasteFromClipboardData* _data_;
	DcComposeBar* _tmp0_;
	GdkClipboard* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (clipboard != NULL);
	_data_ = g_slice_new0 (DcComposeBarPasteFromClipboardData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_compose_bar_paste_from_clipboard_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (clipboard);
	_g_object_unref0 (_data_->clipboard);
	_data_->clipboard = _tmp1_;
	_data_->try_files = try_files;
	_data_->try_texture = try_texture;
	_data_->replace_selection = replace_selection;
	dc_compose_bar_paste_from_clipboard_co (_data_);
}

static void
dc_compose_bar_paste_from_clipboard_finish (DcComposeBar* self,
                                            GAsyncResult* _res_)
{
	DcComposeBarPasteFromClipboardData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_compose_bar_paste_from_clipboard_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcComposeBarPasteFromClipboardData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_compose_bar_paste_from_clipboard_co (_data_);
}

static GValue*
_g_value_dup (GValue* self)
{
	return g_boxed_copy (G_TYPE_VALUE, self);
}

static gpointer
__g_value_dup0 (gpointer self)
{
	return self ? _g_value_dup (self) : NULL;
}

static GdkFileList*
_vala_GdkFileList_copy (GdkFileList* self)
{
	return g_boxed_copy (gdk_file_list_get_type (), self);
}

static gpointer
__vala_GdkFileList_copy0 (gpointer self)
{
	return self ? _vala_GdkFileList_copy (self) : NULL;
}

static void
_vala_GdkFileList_free (GdkFileList* self)
{
	g_boxed_free (gdk_file_list_get_type (), self);
}

static void
_vala_GValue_free (GValue* self)
{
	g_boxed_free (G_TYPE_VALUE, self);
}

static gboolean
dc_compose_bar_paste_from_clipboard_co (DcComposeBarPasteFromClipboardData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->try_files) {
		{
			_data_->_state_ = 1;
			gdk_clipboard_read_value_async (_data_->clipboard, gdk_file_list_get_type (), G_PRIORITY_DEFAULT, NULL, dc_compose_bar_paste_from_clipboard_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp0_ = __g_value_dup0 (gdk_clipboard_read_value_finish (_data_->clipboard, _data_->_res_, &_data_->_inner_error0_));
			_data_->value = _data_->_tmp0_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp2_ = _data_->value;
			if (((gpointer) _data_->_tmp2_) == NULL) {
				_data_->_tmp1_ = NULL;
			} else {
				_data_->_tmp3_ = _data_->value;
				_data_->_tmp4_ = g_value_get_boxed (_data_->_tmp3_);
				_data_->_tmp1_ = (GdkFileList*) _data_->_tmp4_;
			}
			_data_->_tmp5_ = __vala_GdkFileList_copy0 (_data_->_tmp1_);
			_data_->fl = _data_->_tmp5_;
			_data_->_tmp8_ = _data_->fl;
			if (_data_->_tmp8_ == NULL) {
				_data_->_tmp7_ = TRUE;
			} else {
				_data_->_tmp9_ = _data_->fl;
				_data_->_tmp10_ = gdk_file_list_get_files (_data_->_tmp9_);
				_data_->_tmp11_ = _data_->_tmp10_;
				_data_->_tmp7_ = _data_->_tmp11_ == NULL;
				(_data_->_tmp11_ == NULL) ? NULL : (_data_->_tmp11_ = (g_slist_free (_data_->_tmp11_), NULL));
			}
			if (_data_->_tmp7_) {
				_data_->_tmp6_ = NULL;
			} else {
				_data_->_tmp12_ = _data_->fl;
				_data_->_tmp13_ = gdk_file_list_get_files (_data_->_tmp12_);
				_data_->_tmp14_ = _data_->_tmp13_;
				_data_->_tmp15_ = _data_->_tmp14_->data;
				_data_->_tmp6_ = (GFile*) _data_->_tmp15_;
				(_data_->_tmp14_ == NULL) ? NULL : (_data_->_tmp14_ = (g_slist_free (_data_->_tmp14_), NULL));
			}
			_data_->_tmp16_ = _g_object_ref0 (_data_->_tmp6_);
			_data_->gf = _data_->_tmp16_;
			_data_->_tmp18_ = _data_->gf;
			if (_data_->_tmp18_ == NULL) {
				_g_free0 (_data_->_tmp17_);
				_data_->_tmp17_ = NULL;
			} else {
				_data_->_tmp19_ = _data_->gf;
				_data_->_tmp20_ = g_file_get_path (_data_->_tmp19_);
				_g_free0 (_data_->_tmp17_);
				_data_->_tmp17_ = _data_->_tmp20_;
			}
			_data_->_tmp21_ = _data_->_tmp17_;
			_data_->_tmp17_ = NULL;
			_data_->path = _data_->_tmp21_;
			_data_->_tmp23_ = _data_->path;
			if (_data_->_tmp23_ != NULL) {
				_data_->_tmp24_ = _data_->path;
				_data_->_tmp22_ = g_file_test (_data_->_tmp24_, G_FILE_TEST_EXISTS);
			} else {
				_data_->_tmp22_ = FALSE;
			}
			if (_data_->_tmp22_) {
				_data_->_tmp25_ = _data_->path;
				_data_->_tmp26_ = _data_->gf;
				_data_->_tmp27_ = g_file_get_basename (_data_->_tmp26_);
				_data_->_tmp28_ = _data_->_tmp27_;
				dc_compose_bar_set_pending_attachment (_data_->self, _data_->_tmp25_, _data_->_tmp28_, FALSE, "");
				_g_free0 (_data_->_tmp28_);
				_g_free0 (_data_->path);
				_g_free0 (_data_->_tmp17_);
				_g_object_unref0 (_data_->gf);
				__vala_GdkFileList_free0 (_data_->fl);
				__vala_GValue_free0 (_data_->value);
				g_task_return_pointer (_data_->_async_result, _data_, NULL);
				if (_data_->_state_ != 0) {
					while (!g_task_get_completed (_data_->_async_result)) {
						g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
					}
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_g_free0 (_data_->path);
			_g_free0 (_data_->_tmp17_);
			_g_object_unref0 (_data_->gf);
			__vala_GdkFileList_free0 (_data_->fl);
			__vala_GValue_free0 (_data_->value);
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			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);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	if (_data_->try_texture) {
		_data_->tmp_path = NULL;
		{
			_data_->_state_ = 2;
			gdk_clipboard_read_texture_async (_data_->clipboard, NULL, dc_compose_bar_paste_from_clipboard_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp29_ = gdk_clipboard_read_texture_finish (_data_->clipboard, _data_->_res_, &_data_->_inner_error0_);
			_data_->texture = _data_->_tmp29_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
			_data_->_tmp30_ = _data_->texture;
			if (_data_->_tmp30_ != NULL) {
				_data_->_tmp31_ = NULL;
				_data_->_tmp32_ = g_file_new_tmp ("parla-XXXXXX.png", &_data_->_tmp31_, &_data_->_inner_error0_);
				_g_object_unref0 (_data_->stream);
				_data_->stream = _data_->_tmp31_;
				_data_->tmp = _data_->_tmp32_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->stream);
					_g_object_unref0 (_data_->texture);
					goto __catch1_g_error;
				}
				_data_->_tmp33_ = _data_->tmp;
				_data_->_tmp34_ = g_file_get_path (_data_->_tmp33_);
				_g_free0 (_data_->tmp_path);
				_data_->tmp_path = _data_->_tmp34_;
				_data_->_tmp35_ = _data_->stream;
				g_io_stream_close ((GIOStream*) _data_->_tmp35_, NULL, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->tmp);
					_g_object_unref0 (_data_->stream);
					_g_object_unref0 (_data_->texture);
					goto __catch1_g_error;
				}
				_data_->_tmp36_ = _data_->texture;
				_data_->_tmp37_ = _data_->tmp_path;
				if (gdk_texture_save_to_png (_data_->_tmp36_, _data_->_tmp37_)) {
					_data_->_tmp38_ = _data_->tmp_path;
					dc_compose_bar_set_pending_attachment (_data_->self, _data_->_tmp38_, "pasted-image.png", TRUE, "");
					_g_object_unref0 (_data_->tmp);
					_g_object_unref0 (_data_->stream);
					_g_object_unref0 (_data_->texture);
					_g_free0 (_data_->tmp_path);
					g_task_return_pointer (_data_->_async_result, _data_, NULL);
					if (_data_->_state_ != 0) {
						while (!g_task_get_completed (_data_->_async_result)) {
							g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
						}
					}
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_object_unref0 (_data_->tmp);
				_g_object_unref0 (_data_->stream);
			}
			_g_object_unref0 (_data_->texture);
		}
		goto __finally1;
		__catch1_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
		}
		__finally1:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->tmp_path);
			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);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp39_ = _data_->tmp_path;
		if (_data_->_tmp39_ != NULL) {
			_data_->_tmp40_ = _data_->tmp_path;
			g_unlink (_data_->_tmp40_);
		}
		_g_free0 (_data_->tmp_path);
	}
	{
		_data_->_state_ = 3;
		gdk_clipboard_read_text_async (_data_->clipboard, NULL, dc_compose_bar_paste_from_clipboard_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp41_ = gdk_clipboard_read_text_finish (_data_->clipboard, _data_->_res_, &_data_->_inner_error0_);
		_data_->text = _data_->_tmp41_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch2_g_error;
		}
		_data_->_tmp44_ = _data_->text;
		if (_data_->_tmp44_ == NULL) {
			_data_->_tmp43_ = TRUE;
		} else {
			_data_->_tmp45_ = _data_->text;
			_data_->_tmp46_ = strlen (_data_->_tmp45_);
			_data_->_tmp47_ = _data_->_tmp46_;
			_data_->_tmp43_ = _data_->_tmp47_ == 0;
		}
		if (_data_->_tmp43_) {
			_data_->_tmp42_ = TRUE;
		} else {
			_data_->_tmp48_ = _data_->self->priv->text_view;
			_data_->_tmp49_ = gtk_text_view_get_editable (_data_->_tmp48_);
			_data_->_tmp50_ = _data_->_tmp49_;
			_data_->_tmp42_ = !_data_->_tmp50_;
		}
		if (_data_->_tmp42_) {
			_g_free0 (_data_->text);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp51_ = _data_->self->priv->_clean_pasted_links;
		if (_data_->_tmp51_) {
			_data_->_tmp52_ = _data_->text;
			_data_->_tmp53_ = dc_link_cleaner_clean_text (_data_->_tmp52_);
			_g_free0 (_data_->text);
			_data_->text = _data_->_tmp53_;
		}
		_data_->_tmp55_ = _data_->self->priv->_link_previews;
		if (_data_->_tmp55_) {
			_data_->_tmp54_ = dc_compose_bar_can_accept_attachment (_data_->self);
		} else {
			_data_->_tmp54_ = FALSE;
		}
		if (_data_->_tmp54_) {
			_data_->_tmp56_ = _data_->text;
			dc_compose_bar_request_link_previews (_data_->self, _data_->_tmp56_);
		}
		_data_->_tmp57_ = _data_->self->priv->text_view;
		_data_->_tmp58_ = gtk_text_view_get_buffer (_data_->_tmp57_);
		_data_->_tmp59_ = _data_->_tmp58_;
		_data_->_tmp60_ = _g_object_ref0 (_data_->_tmp59_);
		_data_->buffer = _data_->_tmp60_;
		_data_->_tmp61_ = _data_->buffer;
		gtk_text_buffer_begin_user_action (_data_->_tmp61_);
		if (_data_->replace_selection) {
			_data_->_tmp62_ = _data_->buffer;
			_data_->_tmp63_ = _data_->self->priv->text_view;
			_data_->_tmp64_ = gtk_text_view_get_editable (_data_->_tmp63_);
			_data_->_tmp65_ = _data_->_tmp64_;
			gtk_text_buffer_delete_selection (_data_->_tmp62_, TRUE, _data_->_tmp65_);
		}
		_data_->_tmp66_ = _data_->buffer;
		_data_->_tmp67_ = _data_->text;
		_data_->_tmp68_ = _data_->text;
		_data_->_tmp69_ = strlen (_data_->_tmp68_);
		_data_->_tmp70_ = _data_->_tmp69_;
		gtk_text_buffer_insert_at_cursor (_data_->_tmp66_, _data_->_tmp67_, _data_->_tmp70_);
		_data_->_tmp71_ = _data_->buffer;
		gtk_text_buffer_end_user_action (_data_->_tmp71_);
		_data_->_tmp72_ = _data_->self->priv->text_view;
		_data_->_tmp73_ = _data_->buffer;
		_data_->_tmp74_ = gtk_text_buffer_get_insert (_data_->_tmp73_);
		gtk_text_view_scroll_mark_onscreen (_data_->_tmp72_, _data_->_tmp74_);
		_g_object_unref0 (_data_->buffer);
		_g_free0 (_data_->text);
	}
	goto __finally2;
	__catch2_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally2:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		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);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gboolean
dc_compose_bar_get_shift_enter_sends (DcComposeBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_shift_enter_sends;
	return result;
}

void
dc_compose_bar_set_shift_enter_sends (DcComposeBar* self,
                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_compose_bar_get_shift_enter_sends (self);
	if (old_value != value) {
		self->priv->_shift_enter_sends = value;
		g_object_notify_by_pspec ((GObject *) self, dc_compose_bar_properties[DC_COMPOSE_BAR_SHIFT_ENTER_SENDS_PROPERTY]);
	}
}

gboolean
dc_compose_bar_get_clean_pasted_links (DcComposeBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_clean_pasted_links;
	return result;
}

void
dc_compose_bar_set_clean_pasted_links (DcComposeBar* self,
                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_compose_bar_get_clean_pasted_links (self);
	if (old_value != value) {
		self->priv->_clean_pasted_links = value;
		g_object_notify_by_pspec ((GObject *) self, dc_compose_bar_properties[DC_COMPOSE_BAR_CLEAN_PASTED_LINKS_PROPERTY]);
	}
}

gboolean
dc_compose_bar_get_link_previews (DcComposeBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_link_previews;
	return result;
}

void
dc_compose_bar_set_link_previews (DcComposeBar* self,
                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_compose_bar_get_link_previews (self);
	if (old_value != value) {
		self->priv->_link_previews = value;
		g_object_notify_by_pspec ((GObject *) self, dc_compose_bar_properties[DC_COMPOSE_BAR_LINK_PREVIEWS_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__BOXED_INT_UINT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__BOXED_INT_UINT) (gpointer data1, gpointer arg_1, gint arg_2, guint arg_3, gpointer data2);
	register GMarshalFunc_VOID__BOXED_INT_UINT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__BOXED_INT_UINT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_boxed (param_values + 1), g_value_get_int (param_values + 2), g_value_get_uint (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING_STRING_INT (GClosure * closure,
                                                        GValue * return_value,
                                                        guint n_param_values,
                                                        const GValue * param_values,
                                                        gpointer invocation_hint,
                                                        gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING_INT) (gpointer data1, const char* arg_1, const char* arg_2, const char* arg_3, gint arg_4, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_STRING_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_STRING_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_string (param_values + 3), g_value_get_int (param_values + 4), data2);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING_INT_BOOLEAN (GClosure * closure,
                                                         GValue * return_value,
                                                         guint n_param_values,
                                                         const GValue * param_values,
                                                         gpointer invocation_hint,
                                                         gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING_INT_BOOLEAN) (gpointer data1, const char* arg_1, const char* arg_2, gint arg_3, gboolean arg_4, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_INT_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_INT_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_int (param_values + 3), g_value_get_boolean (param_values + 4), data2);
}

static void
g_cclosure_user_marshal_VOID__INT_STRING (GClosure * closure,
                                          GValue * return_value,
                                          guint n_param_values,
                                          const GValue * param_values,
                                          gpointer invocation_hint,
                                          gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__INT_STRING) (gpointer data1, gint arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__INT_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__INT_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING_STRING_INT_BOOLEAN (GClosure * closure,
                                                                GValue * return_value,
                                                                guint n_param_values,
                                                                const GValue * param_values,
                                                                gpointer invocation_hint,
                                                                gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING_INT_BOOLEAN) (gpointer data1, const char* arg_1, const char* arg_2, const char* arg_3, gint arg_4, gboolean arg_5, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_STRING_INT_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 6);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_STRING_INT_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_string (param_values + 3), g_value_get_int (param_values + 4), g_value_get_boolean (param_values + 5), data2);
}

static void
dc_compose_bar_class_init (DcComposeBarClass * klass,
                           gpointer klass_data)
{
	dc_compose_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcComposeBar_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dc_compose_bar_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_compose_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_compose_bar_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_compose_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_COMPOSE_BAR_SHIFT_ENTER_SENDS_PROPERTY, dc_compose_bar_properties[DC_COMPOSE_BAR_SHIFT_ENTER_SENDS_PROPERTY] = g_param_spec_boolean ("shift-enter-sends", "shift-enter-sends", "shift-enter-sends", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_COMPOSE_BAR_CLEAN_PASTED_LINKS_PROPERTY, dc_compose_bar_properties[DC_COMPOSE_BAR_CLEAN_PASTED_LINKS_PROPERTY] = g_param_spec_boolean ("clean-pasted-links", "clean-pasted-links", "clean-pasted-links", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_COMPOSE_BAR_LINK_PREVIEWS_PROPERTY, dc_compose_bar_properties[DC_COMPOSE_BAR_LINK_PREVIEWS_PROPERTY] = g_param_spec_boolean ("link-previews", "link-previews", "link-previews", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dc_compose_bar_signals[DC_COMPOSE_BAR_LINK_PREVIEWS_REQUESTED_SIGNAL] = g_signal_new ("link-previews-requested", DC_TYPE_COMPOSE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED_INT_UINT, G_TYPE_NONE, 3, G_TYPE_STRV, G_TYPE_INT, G_TYPE_UINT);
	dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_MESSAGE_SIGNAL] = g_signal_new ("send-message", DC_TYPE_COMPOSE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_STRING_INT, G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
	dc_compose_bar_signals[DC_COMPOSE_BAR_SEND_VOICE_MESSAGE_SIGNAL] = g_signal_new ("send-voice-message", DC_TYPE_COMPOSE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_INT_BOOLEAN, G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
	dc_compose_bar_signals[DC_COMPOSE_BAR_EDIT_MESSAGE_SIGNAL] = g_signal_new ("edit-message", DC_TYPE_COMPOSE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_STRING, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING);
	dc_compose_bar_signals[DC_COMPOSE_BAR_EDIT_LAST_REQUESTED_SIGNAL] = g_signal_new ("edit-last-requested", DC_TYPE_COMPOSE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dc_compose_bar_signals[DC_COMPOSE_BAR_DRAFT_CHANGED_SIGNAL] = g_signal_new ("draft-changed", DC_TYPE_COMPOSE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_STRING_INT_BOOLEAN, G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
}

static void
dc_compose_bar_instance_init (DcComposeBar * self,
                              gpointer klass)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	GPtrArray* _tmp6_;
	gchar* _tmp7_;
	gchar** _tmp8_;
	gchar** _tmp9_;
	gchar** _tmp10_;
	gchar* _tmp11_;
	self->priv = dc_compose_bar_get_instance_private (self);
	self->priv->_shift_enter_sends = FALSE;
	self->priv->_clean_pasted_links = FALSE;
	self->priv->_link_previews = FALSE;
	_tmp0_ = g_strdup ("Type a message");
	self->priv->placeholder_default = _tmp0_;
	self->priv->audio_recorder = NULL;
	self->priv->transcribing_path = NULL;
	self->priv->transcriber_handler = (gulong) 0;
	self->priv->recording_started_us = (gint64) 0;
	self->priv->recording_timer = (guint) 0;
	self->priv->pending_file = NULL;
	self->priv->pending_file_name = NULL;
	self->priv->pending_file_is_temp = FALSE;
	self->priv->pending_file_is_voice = FALSE;
	_tmp1_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_files = _tmp1_;
	self->priv->extra_pending_files_length1 = 0;
	self->priv->_extra_pending_files_size_ = self->priv->extra_pending_files_length1;
	_tmp2_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_file_names = _tmp2_;
	self->priv->extra_pending_file_names_length1 = 0;
	self->priv->_extra_pending_file_names_size_ = self->priv->extra_pending_file_names_length1;
	_tmp3_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_temp_files = _tmp3_;
	self->priv->extra_pending_temp_files_length1 = 0;
	self->priv->_extra_pending_temp_files_size_ = self->priv->extra_pending_temp_files_length1;
	_tmp4_ = g_new0 (gchar*, 0 + 1);
	self->priv->extra_pending_captions = _tmp4_;
	self->priv->extra_pending_captions_length1 = 0;
	self->priv->_extra_pending_captions_size_ = self->priv->extra_pending_captions_length1;
	self->priv->preview_generation = (guint) 1;
	_tmp5_ = g_new0 (gchar*, 0 + 1);
	self->priv->previewed_urls = _tmp5_;
	self->priv->previewed_urls_length1 = 0;
	self->priv->_previewed_urls_size_ = self->priv->previewed_urls_length1;
	self->priv->editing_msg_id = 0;
	self->priv->replying_msg_id = 0;
	self->priv->mention_roster = NULL;
	self->priv->mention_popup_visible = FALSE;
	self->priv->mention_index = 0;
	_tmp6_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	self->priv->mention_tokens = _tmp6_;
	self->priv->suppress_draft_signal = FALSE;
	self->priv->has_suspended_draft = FALSE;
	_tmp7_ = g_strdup ("");
	self->priv->suspended_draft_text = _tmp7_;
	self->priv->suspended_draft_file = NULL;
	self->priv->suspended_draft_file_name = NULL;
	self->priv->suspended_draft_file_is_temp = FALSE;
	self->priv->suspended_draft_file_is_voice = FALSE;
	_tmp8_ = g_new0 (gchar*, 0 + 1);
	self->priv->suspended_extra_draft_files = _tmp8_;
	self->priv->suspended_extra_draft_files_length1 = 0;
	self->priv->_suspended_extra_draft_files_size_ = self->priv->suspended_extra_draft_files_length1;
	_tmp9_ = g_new0 (gchar*, 0 + 1);
	self->priv->suspended_extra_draft_file_names = _tmp9_;
	self->priv->suspended_extra_draft_file_names_length1 = 0;
	self->priv->_suspended_extra_draft_file_names_size_ = self->priv->suspended_extra_draft_file_names_length1;
	_tmp10_ = g_new0 (gchar*, 0 + 1);
	self->priv->suspended_extra_draft_captions = _tmp10_;
	self->priv->suspended_extra_draft_captions_length1 = 0;
	self->priv->_suspended_extra_draft_captions_size_ = self->priv->suspended_extra_draft_captions_length1;
	self->priv->suspended_replying_msg_id = 0;
	_tmp11_ = g_strdup ("");
	self->priv->suspended_reply_label = _tmp11_;
	self->priv->closed = FALSE;
}

static void
dc_compose_bar_finalize (GObject * obj)
{
	DcComposeBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_COMPOSE_BAR, DcComposeBar);
	_g_object_unref0 (self->priv->text_view);
	_g_object_unref0 (self->priv->placeholder_label);
	_g_free0 (self->priv->placeholder_default);
	_g_object_unref0 (self->priv->attach_button);
	_g_object_unref0 (self->priv->emoji_button);
	_g_object_unref0 (self->priv->cancel_attach_button);
	_g_object_unref0 (self->priv->cancel_edit_button);
	_g_object_unref0 (self->priv->send_stack);
	_g_object_unref0 (self->priv->sticker_button);
	_g_object_unref0 (self->priv->compose_mode_stack);
	_g_object_unref0 (self->priv->recording_time_label);
	_g_object_unref0 (self->priv->recording_action_stack);
	_g_object_unref0 (self->priv->recording_stop_button);
	_g_object_unref0 (self->priv->transcribe_button);
	_g_object_unref0 (self->priv->audio_recorder);
	_g_free0 (self->priv->transcribing_path);
	_g_object_unref0 (self->priv->reply_label);
	_g_object_unref0 (self->priv->reply_bar);
	_g_object_unref0 (self->priv->attachment_bar);
	_g_object_unref0 (self->priv->long_msg_bar);
	_g_object_unref0 (self->priv->attachment_picture);
	_g_object_unref0 (self->priv->attachment_icon);
	_g_object_unref0 (self->priv->attachment_name_label);
	_g_object_unref0 (self->priv->attachment_meta_label);
	_g_free0 (self->priv->pending_file);
	_g_free0 (self->priv->pending_file_name);
	self->priv->extra_pending_files = (_vala_array_free (self->priv->extra_pending_files, self->priv->extra_pending_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_file_names = (_vala_array_free (self->priv->extra_pending_file_names, self->priv->extra_pending_file_names_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_temp_files = (_vala_array_free (self->priv->extra_pending_temp_files, self->priv->extra_pending_temp_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->extra_pending_captions = (_vala_array_free (self->priv->extra_pending_captions, self->priv->extra_pending_captions_length1, (GDestroyNotify) g_free), NULL);
	self->priv->previewed_urls = (_vala_array_free (self->priv->previewed_urls, self->priv->previewed_urls_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->mention_roster);
	_g_object_unref0 (self->priv->mention_popover);
	_g_object_unref0 (self->priv->mention_list);
	_g_ptr_array_unref0 (self->priv->mention_tokens);
	_g_free0 (self->priv->suspended_draft_text);
	_g_free0 (self->priv->suspended_draft_file);
	_g_free0 (self->priv->suspended_draft_file_name);
	self->priv->suspended_extra_draft_files = (_vala_array_free (self->priv->suspended_extra_draft_files, self->priv->suspended_extra_draft_files_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_file_names = (_vala_array_free (self->priv->suspended_extra_draft_file_names, self->priv->suspended_extra_draft_file_names_length1, (GDestroyNotify) g_free), NULL);
	self->priv->suspended_extra_draft_captions = (_vala_array_free (self->priv->suspended_extra_draft_captions, self->priv->suspended_extra_draft_captions_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->priv->suspended_reply_label);
	G_OBJECT_CLASS (dc_compose_bar_parent_class)->finalize (obj);
}

/**
     * Compose bar at the bottom of the message view.
     * Contains a text entry, file attach button, and send button.
     */
static GType
dc_compose_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcComposeBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_compose_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcComposeBar), 0, (GInstanceInitFunc) dc_compose_bar_instance_init, NULL };
	GType dc_compose_bar_type_id;
	dc_compose_bar_type_id = g_type_register_static (gtk_box_get_type (), "DcComposeBar", &g_define_type_info, 0);
	DcComposeBar_private_offset = g_type_add_instance_private (dc_compose_bar_type_id, sizeof (DcComposeBarPrivate));
	return dc_compose_bar_type_id;
}

GType
dc_compose_bar_get_type (void)
{
	static volatile gsize dc_compose_bar_type_id__once = 0;
	if (g_once_init_enter (&dc_compose_bar_type_id__once)) {
		GType dc_compose_bar_type_id;
		dc_compose_bar_type_id = dc_compose_bar_get_type_once ();
		g_once_init_leave (&dc_compose_bar_type_id__once, dc_compose_bar_type_id);
	}
	return dc_compose_bar_type_id__once;
}

static void
_vala_dc_compose_bar_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	DcComposeBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_COMPOSE_BAR, DcComposeBar);
	switch (property_id) {
		case DC_COMPOSE_BAR_SHIFT_ENTER_SENDS_PROPERTY:
		g_value_set_boolean (value, dc_compose_bar_get_shift_enter_sends (self));
		break;
		case DC_COMPOSE_BAR_CLEAN_PASTED_LINKS_PROPERTY:
		g_value_set_boolean (value, dc_compose_bar_get_clean_pasted_links (self));
		break;
		case DC_COMPOSE_BAR_LINK_PREVIEWS_PROPERTY:
		g_value_set_boolean (value, dc_compose_bar_get_link_previews (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_compose_bar_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	DcComposeBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_COMPOSE_BAR, DcComposeBar);
	switch (property_id) {
		case DC_COMPOSE_BAR_SHIFT_ENTER_SENDS_PROPERTY:
		dc_compose_bar_set_shift_enter_sends (self, g_value_get_boolean (value));
		break;
		case DC_COMPOSE_BAR_CLEAN_PASTED_LINKS_PROPERTY:
		dc_compose_bar_set_clean_pasted_links (self, g_value_get_boolean (value));
		break;
		case DC_COMPOSE_BAR_LINK_PREVIEWS_PROPERTY:
		dc_compose_bar_set_link_previews (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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 inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

