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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <adwaita.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <pango/pango.h>
#include <gdk/gdk.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DC_TYPE_CONVERSATION_MEDIA_BAR (dc_conversation_media_bar_get_type ())
#define DC_CONVERSATION_MEDIA_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBar))
#define DC_CONVERSATION_MEDIA_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBarClass))
#define DC_IS_CONVERSATION_MEDIA_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONVERSATION_MEDIA_BAR))
#define DC_IS_CONVERSATION_MEDIA_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONVERSATION_MEDIA_BAR))
#define DC_CONVERSATION_MEDIA_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBarClass))

typedef struct _DcConversationMediaBar DcConversationMediaBar;
typedef struct _DcConversationMediaBarClass DcConversationMediaBarClass;
typedef struct _DcConversationMediaBarPrivate DcConversationMediaBarPrivate;

#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;
enum  {
	DC_CONVERSATION_MEDIA_BAR_0_PROPERTY,
	DC_CONVERSATION_MEDIA_BAR_MESSAGE_ID_PROPERTY,
	DC_CONVERSATION_MEDIA_BAR_NUM_PROPERTIES
};
static GParamSpec* dc_conversation_media_bar_properties[DC_CONVERSATION_MEDIA_BAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define DC_TYPE_AUDIO_PLAYBACK_ITEM (dc_audio_playback_item_get_type ())
#define DC_AUDIO_PLAYBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItem))
#define DC_AUDIO_PLAYBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItemClass))
#define DC_IS_AUDIO_PLAYBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM))
#define DC_IS_AUDIO_PLAYBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYBACK_ITEM))
#define DC_AUDIO_PLAYBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItemClass))

typedef struct _DcAudioPlaybackItem DcAudioPlaybackItem;
typedef struct _DcAudioPlaybackItemClass DcAudioPlaybackItemClass;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	DC_CONVERSATION_MEDIA_BAR_PREVIOUS_REQUESTED_SIGNAL,
	DC_CONVERSATION_MEDIA_BAR_NEXT_REQUESTED_SIGNAL,
	DC_CONVERSATION_MEDIA_BAR_MESSAGE_REQUESTED_SIGNAL,
	DC_CONVERSATION_MEDIA_BAR_NUM_SIGNALS
};
static guint dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_NUM_SIGNALS] = {0};

struct _DcConversationMediaBar {
	GtkBox parent_instance;
	DcConversationMediaBarPrivate * priv;
};

struct _DcConversationMediaBarClass {
	GtkBoxClass parent_class;
};

struct _DcConversationMediaBarPrivate {
	gint _message_id;
	DcAudioPlayback* playback;
	GtkRevealer* revealer;
	GtkBox* content;
	AdwAvatar* avatar;
	GtkButton* previous_button;
	GtkButton* play_button;
	GtkButton* next_button;
	GtkButton* close_button;
	GtkLabel* sender_label;
	GtkLabel* sent_label;
	GtkLabel* time_label;
	GtkScale* progress;
	GtkDropDown* speed_dropdown;
	gboolean syncing_speed;
	gulong current_handler;
	gulong item_handler;
	gulong playing_handler;
	gulong seekable_handler;
	gulong external_handler;
	gulong position_handler;
	gulong duration_handler;
	gulong rate_handler;
	gulong previous_handler;
	gulong next_handler;
};

static gint DcConversationMediaBar_private_offset;
static gpointer dc_conversation_media_bar_parent_class = NULL;

VALA_EXTERN GType dc_conversation_media_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcConversationMediaBar, g_object_unref)
VALA_EXTERN GType dc_audio_playback_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlayback, g_object_unref)
VALA_EXTERN DcConversationMediaBar* dc_conversation_media_bar_new (void);
VALA_EXTERN DcConversationMediaBar* dc_conversation_media_bar_construct (GType object_type);
VALA_EXTERN DcAudioPlayback* dc_audio_playback_shared (void);
static GtkButton* dc_conversation_media_bar_media_button (DcConversationMediaBar* self,
                                                   const gchar* icon_name,
                                                   const gchar* tooltip);
static void __lambda43_ (DcConversationMediaBar* self);
static void ___lambda43__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda44_ (DcConversationMediaBar* self);
VALA_EXTERN void dc_audio_playback_toggle (DcAudioPlayback* self);
static void ___lambda44__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda47_ (DcConversationMediaBar* self);
static void ___lambda47__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda48_ (DcConversationMediaBar* self);
VALA_EXTERN void dc_audio_playback_change_playback_rate (DcAudioPlayback* self,
                                             gdouble rate);
VALA_EXTERN gdouble dc_audio_playback_rate_for_index (guint index);
static void dc_conversation_media_bar_sync_speed (DcConversationMediaBar* self);
static void ___lambda48__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static gboolean __lambda49_ (DcConversationMediaBar* self,
                      GtkScrollType scroll,
                      gdouble value);
VALA_EXTERN void dc_audio_playback_seek_fraction (DcAudioPlayback* self,
                                      gdouble fraction);
static gboolean ___lambda49__gtk_range_change_value (GtkRange* _sender,
                                              GtkScrollType scroll,
                                              gdouble new_value,
                                              gpointer self);
static void __lambda50_ (DcConversationMediaBar* self);
VALA_EXTERN void dc_audio_playback_stop (DcAudioPlayback* self);
static void ___lambda50__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda51_ (DcConversationMediaBar* self);
static void ___lambda51__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void __lambda52_ (DcConversationMediaBar* self,
                  gint n_press,
                  gdouble x,
                  gdouble y);
VALA_EXTERN GType dc_audio_playback_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlaybackItem, g_object_unref)
VALA_EXTERN DcAudioPlaybackItem* dc_audio_playback_get_current_item (DcAudioPlayback* self);
static gboolean dc_conversation_media_bar_pointer_is_on_control (DcConversationMediaBar* self,
                                                          gdouble x,
                                                          gdouble y);
VALA_EXTERN gint dc_audio_playback_item_get_account_id (DcAudioPlaybackItem* self);
VALA_EXTERN gint dc_audio_playback_item_get_chat_id (DcAudioPlaybackItem* self);
VALA_EXTERN gint dc_audio_playback_item_get_message_id (DcAudioPlaybackItem* self);
static void ___lambda52__gtk_gesture_click_released (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void dc_conversation_media_bar_sync_item (DcConversationMediaBar* self);
static void _dc_conversation_media_bar_sync_item_g_object_notify (GObject* _sender,
                                                           GParamSpec* pspec,
                                                           gpointer self);
static void dc_conversation_media_bar_sync_playback (DcConversationMediaBar* self);
static void _dc_conversation_media_bar_sync_playback_g_object_notify (GObject* _sender,
                                                               GParamSpec* pspec,
                                                               gpointer self);
static void _dc_conversation_media_bar_sync_speed_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self);
static void dc_conversation_media_bar_sync_navigation (DcConversationMediaBar* self);
static void _dc_conversation_media_bar_sync_navigation_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
VALA_EXTERN gint dc_conversation_media_bar_get_message_id (DcConversationMediaBar* self);
VALA_EXTERN gint dc_audio_playback_get_current_message_id (DcAudioPlayback* self);
VALA_EXTERN gboolean dc_audio_playback_get_playing (DcAudioPlayback* self);
VALA_EXTERN gint64 dc_audio_playback_get_position_us (DcAudioPlayback* self);
VALA_EXTERN gint64 dc_audio_playback_get_duration_us (DcAudioPlayback* self);
VALA_EXTERN gboolean dc_audio_playback_get_external_backend (DcAudioPlayback* self);
VALA_EXTERN gboolean dc_audio_playback_get_can_seek (DcAudioPlayback* self);
VALA_EXTERN gchar* dc_conversation_media_bar_format_playing_time (gint64 position_us,
                                                      gint64 duration_us);
VALA_EXTERN guint dc_audio_playback_index_for_rate (gdouble rate);
VALA_EXTERN gdouble dc_audio_playback_get_playback_rate (DcAudioPlayback* self);
VALA_EXTERN gboolean dc_audio_playback_get_can_change_speed (DcAudioPlayback* self);
static void dc_conversation_media_bar_set_message_id (DcConversationMediaBar* self,
                                               gint value);
VALA_EXTERN const gchar* dc_audio_playback_item_get_sender_name (DcAudioPlaybackItem* self);
VALA_EXTERN GdkTexture* dc_load_avatar (const gchar* path);
VALA_EXTERN const gchar* dc_audio_playback_item_get_avatar_path (DcAudioPlaybackItem* self);
VALA_EXTERN const gchar* dc_audio_playback_item_get_sender_address (DcAudioPlaybackItem* self);
static gchar* dc_conversation_media_bar_format_sent_timestamp (gint64 timestamp);
VALA_EXTERN gint64 dc_audio_playback_item_get_sent_timestamp (DcAudioPlaybackItem* self);
VALA_EXTERN gboolean dc_audio_playback_get_has_previous (DcAudioPlayback* self);
VALA_EXTERN gboolean dc_audio_playback_get_has_next (DcAudioPlayback* self);
VALA_EXTERN gchar* dc_format_date_time (gint64 ts);
static gchar* dc_conversation_media_bar_format_duration (gint64 microseconds);
static void dc_conversation_media_bar_real_dispose (GObject* base);
static void g_cclosure_user_marshal_VOID__INT_INT_INT (GClosure * closure,
                                                GValue * return_value,
                                                guint n_param_values,
                                                const GValue * param_values,
                                                gpointer invocation_hint,
                                                gpointer marshal_data);
static void dc_conversation_media_bar_finalize (GObject * obj);
static GType dc_conversation_media_bar_get_type_once (void);
static void _vala_dc_conversation_media_bar_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_dc_conversation_media_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_conversation_media_bar_get_instance_private (DcConversationMediaBar* self)
{
	return G_STRUCT_MEMBER_P (self, DcConversationMediaBar_private_offset);
}

static void
__lambda43_ (DcConversationMediaBar* self)
{
	g_signal_emit (self, dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_PREVIOUS_REQUESTED_SIGNAL], 0);
}

static void
___lambda43__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda43_ ((DcConversationMediaBar*) self);
}

static void
__lambda44_ (DcConversationMediaBar* self)
{
	DcAudioPlayback* _tmp0_;
	_tmp0_ = self->priv->playback;
	dc_audio_playback_toggle (_tmp0_);
}

static void
___lambda44__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda44_ ((DcConversationMediaBar*) self);
}

static void
__lambda47_ (DcConversationMediaBar* self)
{
	g_signal_emit (self, dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_NEXT_REQUESTED_SIGNAL], 0);
}

static void
___lambda47__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda47_ ((DcConversationMediaBar*) self);
}

static void
__lambda48_ (DcConversationMediaBar* self)
{
	DcAudioPlayback* _tmp0_;
	GtkDropDown* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	if (self->priv->syncing_speed) {
		return;
	}
	_tmp0_ = self->priv->playback;
	_tmp1_ = self->priv->speed_dropdown;
	_tmp2_ = gtk_drop_down_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	dc_audio_playback_change_playback_rate (_tmp0_, dc_audio_playback_rate_for_index (_tmp3_));
	dc_conversation_media_bar_sync_speed (self);
}

static void
___lambda48__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda48_ ((DcConversationMediaBar*) self);
}

static gboolean
__lambda49_ (DcConversationMediaBar* self,
             GtkScrollType scroll,
             gdouble value)
{
	DcAudioPlayback* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->playback;
	dc_audio_playback_seek_fraction (_tmp0_, value);
	result = FALSE;
	return result;
}

static gboolean
___lambda49__gtk_range_change_value (GtkRange* _sender,
                                     GtkScrollType scroll,
                                     gdouble new_value,
                                     gpointer self)
{
	gboolean result;
	result = __lambda49_ ((DcConversationMediaBar*) self, scroll, new_value);
	return result;
}

static void
__lambda50_ (DcConversationMediaBar* self)
{
	DcAudioPlayback* _tmp0_;
	_tmp0_ = self->priv->playback;
	dc_audio_playback_stop (_tmp0_);
}

static void
___lambda50__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda50_ ((DcConversationMediaBar*) self);
}

static void
__lambda51_ (DcConversationMediaBar* self)
{
	gboolean _tmp0_ = FALSE;
	GtkRevealer* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	_tmp1_ = self->priv->revealer;
	_tmp2_ = gtk_revealer_get_reveal_child (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		GtkRevealer* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->priv->revealer;
		_tmp5_ = gtk_revealer_get_child_revealed (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = !_tmp6_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkBox* _tmp7_;
		_tmp7_ = self->priv->content;
		gtk_widget_set_visible ((GtkWidget*) _tmp7_, FALSE);
	}
}

static void
___lambda51__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda51_ ((DcConversationMediaBar*) self);
}

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

static void
__lambda52_ (DcConversationMediaBar* self,
             gint n_press,
             gdouble x,
             gdouble y)
{
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp0_;
	DcAudioPlaybackItem* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	gboolean _tmp4_ = FALSE;
	DcAudioPlaybackItem* _tmp5_;
	_tmp0_ = self->priv->playback;
	_tmp1_ = dc_audio_playback_get_current_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	item = _tmp3_;
	_tmp5_ = item;
	if (_tmp5_ != NULL) {
		_tmp4_ = !dc_conversation_media_bar_pointer_is_on_control (self, x, y);
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		DcAudioPlaybackItem* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		DcAudioPlaybackItem* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		DcAudioPlaybackItem* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		_tmp6_ = item;
		_tmp7_ = dc_audio_playback_item_get_account_id (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = item;
		_tmp10_ = dc_audio_playback_item_get_chat_id (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = item;
		_tmp13_ = dc_audio_playback_item_get_message_id (_tmp12_);
		_tmp14_ = _tmp13_;
		g_signal_emit (self, dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_MESSAGE_REQUESTED_SIGNAL], 0, _tmp8_, _tmp11_, _tmp14_);
	}
	_g_object_unref0 (item);
}

static void
___lambda52__gtk_gesture_click_released (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda52_ ((DcConversationMediaBar*) self, n_press, x, y);
}

static void
_dc_conversation_media_bar_sync_item_g_object_notify (GObject* _sender,
                                                      GParamSpec* pspec,
                                                      gpointer self)
{
	dc_conversation_media_bar_sync_item ((DcConversationMediaBar*) self);
}

static void
_dc_conversation_media_bar_sync_playback_g_object_notify (GObject* _sender,
                                                          GParamSpec* pspec,
                                                          gpointer self)
{
	dc_conversation_media_bar_sync_playback ((DcConversationMediaBar*) self);
}

static void
_dc_conversation_media_bar_sync_speed_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self)
{
	dc_conversation_media_bar_sync_speed ((DcConversationMediaBar*) self);
}

static void
_dc_conversation_media_bar_sync_navigation_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	dc_conversation_media_bar_sync_navigation ((DcConversationMediaBar*) self);
}

DcConversationMediaBar*
dc_conversation_media_bar_construct (GType object_type)
{
	DcConversationMediaBar * self = NULL;
	DcAudioPlayback* _tmp0_;
	GtkRevealer* _tmp1_;
	GtkRevealer* _tmp2_;
	GtkRevealer* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	AdwAvatar* _tmp9_;
	AdwAvatar* _tmp10_;
	GtkBox* _tmp11_;
	AdwAvatar* _tmp12_;
	GtkButton* _tmp13_;
	GtkButton* _tmp14_;
	GtkBox* _tmp15_;
	GtkButton* _tmp16_;
	GtkButton* _tmp17_;
	GtkButton* _tmp18_;
	GtkButton* _tmp19_;
	GtkBox* _tmp20_;
	GtkButton* _tmp21_;
	GtkButton* _tmp22_;
	GtkButton* _tmp23_;
	GtkBox* _tmp24_;
	GtkButton* _tmp25_;
	GtkBox* details = NULL;
	GtkBox* _tmp26_;
	GtkBox* metadata = NULL;
	GtkBox* _tmp27_;
	GtkLabel* _tmp28_;
	GtkLabel* _tmp29_;
	GtkLabel* _tmp30_;
	GtkLabel* _tmp31_;
	GtkLabel* _tmp32_;
	GtkLabel* _tmp33_;
	GtkLabel* _tmp34_;
	GtkLabel* _tmp35_;
	GtkLabel* _tmp36_;
	GtkLabel* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	gchar** _tmp47_;
	gchar** _tmp48_;
	gint _tmp48__length1;
	GtkDropDown* _tmp49_;
	GtkDropDown* _tmp50_;
	GtkDropDown* _tmp51_;
	GtkDropDown* _tmp52_;
	GtkDropDown* _tmp53_;
	GtkDropDown* _tmp54_;
	GtkDropDown* _tmp55_;
	GtkScale* _tmp56_;
	GtkScale* _tmp57_;
	GtkScale* _tmp58_;
	GtkScale* _tmp59_;
	GtkScale* _tmp60_;
	GtkScale* _tmp61_;
	GtkScale* _tmp62_;
	GtkBox* _tmp63_;
	GtkLabel* _tmp64_;
	GtkLabel* _tmp65_;
	GtkLabel* _tmp66_;
	GtkLabel* _tmp67_;
	GtkLabel* _tmp68_;
	GtkBox* _tmp69_;
	GtkLabel* _tmp70_;
	GtkButton* _tmp71_;
	GtkButton* _tmp72_;
	GtkBox* _tmp73_;
	GtkButton* _tmp74_;
	GtkRevealer* _tmp75_;
	GtkBox* _tmp76_;
	GtkBox* _tmp77_;
	GtkRevealer* _tmp78_;
	GtkRevealer* _tmp79_;
	GtkGestureClick* click = NULL;
	GtkGestureClick* _tmp80_;
	GtkEventController* _tmp81_;
	DcAudioPlayback* _tmp82_;
	gulong _tmp83_;
	DcAudioPlayback* _tmp84_;
	gulong _tmp85_;
	DcAudioPlayback* _tmp86_;
	gulong _tmp87_;
	DcAudioPlayback* _tmp88_;
	gulong _tmp89_;
	DcAudioPlayback* _tmp90_;
	gulong _tmp91_;
	DcAudioPlayback* _tmp92_;
	gulong _tmp93_;
	DcAudioPlayback* _tmp94_;
	gulong _tmp95_;
	DcAudioPlayback* _tmp96_;
	gulong _tmp97_;
	DcAudioPlayback* _tmp98_;
	gulong _tmp99_;
	DcAudioPlayback* _tmp100_;
	gulong _tmp101_;
	self = (DcConversationMediaBar*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 0, NULL);
	_tmp0_ = dc_audio_playback_shared ();
	_g_object_unref0 (self->priv->playback);
	self->priv->playback = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) self, "conversation-media-bar");
	_tmp1_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->revealer);
	self->priv->revealer = _tmp1_;
	_tmp2_ = self->priv->revealer;
	gtk_revealer_set_transition_type (_tmp2_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	_tmp3_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp3_, FALSE);
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->content);
	self->priv->content = _tmp4_;
	_tmp5_ = self->priv->content;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp5_, 10);
	_tmp6_ = self->priv->content;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp6_, 10);
	_tmp7_ = self->priv->content;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp7_, 6);
	_tmp8_ = self->priv->content;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp8_, 6);
	_tmp9_ = (AdwAvatar*) adw_avatar_new (40, "Voice message", TRUE);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->avatar);
	self->priv->avatar = _tmp9_;
	_tmp10_ = self->priv->avatar;
	gtk_widget_set_valign ((GtkWidget*) _tmp10_, GTK_ALIGN_CENTER);
	_tmp11_ = self->priv->content;
	_tmp12_ = self->priv->avatar;
	gtk_box_append (_tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = dc_conversation_media_bar_media_button (self, "media-skip-backward-symbolic", "Previous voice message");
	_g_object_unref0 (self->priv->previous_button);
	self->priv->previous_button = _tmp13_;
	_tmp14_ = self->priv->previous_button;
	g_signal_connect_object (_tmp14_, "clicked", (GCallback) ___lambda43__gtk_button_clicked, self, 0);
	_tmp15_ = self->priv->content;
	_tmp16_ = self->priv->previous_button;
	gtk_box_append (_tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = dc_conversation_media_bar_media_button (self, "media-playback-start-symbolic", "Play");
	_g_object_unref0 (self->priv->play_button);
	self->priv->play_button = _tmp17_;
	_tmp18_ = self->priv->play_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp18_, "suggested-action");
	_tmp19_ = self->priv->play_button;
	g_signal_connect_object (_tmp19_, "clicked", (GCallback) ___lambda44__gtk_button_clicked, self, 0);
	_tmp20_ = self->priv->content;
	_tmp21_ = self->priv->play_button;
	gtk_box_append (_tmp20_, (GtkWidget*) _tmp21_);
	_tmp22_ = dc_conversation_media_bar_media_button (self, "media-skip-forward-symbolic", "Next voice message");
	_g_object_unref0 (self->priv->next_button);
	self->priv->next_button = _tmp22_;
	_tmp23_ = self->priv->next_button;
	g_signal_connect_object (_tmp23_, "clicked", (GCallback) ___lambda47__gtk_button_clicked, self, 0);
	_tmp24_ = self->priv->content;
	_tmp25_ = self->priv->next_button;
	gtk_box_append (_tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
	g_object_ref_sink (_tmp26_);
	details = _tmp26_;
	gtk_widget_set_hexpand ((GtkWidget*) details, TRUE);
	gtk_widget_set_valign ((GtkWidget*) details, GTK_ALIGN_CENTER);
	_tmp27_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp27_);
	metadata = _tmp27_;
	_tmp28_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp28_);
	_g_object_unref0 (self->priv->sender_label);
	self->priv->sender_label = _tmp28_;
	_tmp29_ = self->priv->sender_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp29_, "conversation-media-sender");
	_tmp30_ = self->priv->sender_label;
	gtk_label_set_xalign (_tmp30_, (gfloat) 0);
	_tmp31_ = self->priv->sender_label;
	gtk_label_set_ellipsize (_tmp31_, PANGO_ELLIPSIZE_END);
	_tmp32_ = self->priv->sender_label;
	gtk_box_append (metadata, (GtkWidget*) _tmp32_);
	_tmp33_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->sent_label);
	self->priv->sent_label = _tmp33_;
	_tmp34_ = self->priv->sent_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp34_, "conversation-media-sent");
	_tmp35_ = self->priv->sent_label;
	gtk_label_set_xalign (_tmp35_, (gfloat) 0);
	_tmp36_ = self->priv->sent_label;
	gtk_label_set_ellipsize (_tmp36_, PANGO_ELLIPSIZE_END);
	_tmp37_ = self->priv->sent_label;
	gtk_box_append (metadata, (GtkWidget*) _tmp37_);
	_tmp38_ = g_strdup ("0.5×");
	_tmp39_ = g_strdup ("0.75×");
	_tmp40_ = g_strdup ("1×");
	_tmp41_ = g_strdup ("1.25×");
	_tmp42_ = g_strdup ("1.5×");
	_tmp43_ = g_strdup ("2×");
	_tmp44_ = g_strdup ("3×");
	_tmp45_ = g_strdup ("4×");
	_tmp46_ = g_strdup ("5×");
	_tmp47_ = g_new0 (gchar*, 9 + 1);
	_tmp47_[0] = _tmp38_;
	_tmp47_[1] = _tmp39_;
	_tmp47_[2] = _tmp40_;
	_tmp47_[3] = _tmp41_;
	_tmp47_[4] = _tmp42_;
	_tmp47_[5] = _tmp43_;
	_tmp47_[6] = _tmp44_;
	_tmp47_[7] = _tmp45_;
	_tmp47_[8] = _tmp46_;
	_tmp48_ = _tmp47_;
	_tmp48__length1 = 9;
	_tmp49_ = (GtkDropDown*) gtk_drop_down_new_from_strings (_tmp48_);
	g_object_ref_sink (_tmp49_);
	_g_object_unref0 (self->priv->speed_dropdown);
	self->priv->speed_dropdown = _tmp49_;
	_tmp48_ = (_vala_array_free (_tmp48_, _tmp48__length1, (GDestroyNotify) g_free), NULL);
	_tmp50_ = self->priv->speed_dropdown;
	gtk_widget_add_css_class ((GtkWidget*) _tmp50_, "conversation-media-speed");
	_tmp51_ = self->priv->speed_dropdown;
	gtk_widget_set_valign ((GtkWidget*) _tmp51_, GTK_ALIGN_CENTER);
	_tmp52_ = self->priv->speed_dropdown;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp52_, "Playback speed");
	_tmp53_ = self->priv->speed_dropdown;
	gtk_accessible_update_property ((GtkAccessible*) _tmp53_, GTK_ACCESSIBLE_PROPERTY_LABEL, "Playback speed", -1, -1);
	_tmp54_ = self->priv->speed_dropdown;
	g_signal_connect_object ((GObject*) _tmp54_, "notify::selected", (GCallback) ___lambda48__g_object_notify, self, 0);
	_tmp55_ = self->priv->speed_dropdown;
	gtk_box_append (metadata, (GtkWidget*) _tmp55_);
	gtk_box_append (details, (GtkWidget*) metadata);
	_tmp56_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.0, 1.0, 0.001);
	g_object_ref_sink (_tmp56_);
	_g_object_unref0 (self->priv->progress);
	self->priv->progress = _tmp56_;
	_tmp57_ = self->priv->progress;
	gtk_scale_set_draw_value (_tmp57_, FALSE);
	_tmp58_ = self->priv->progress;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp58_, TRUE);
	_tmp59_ = self->priv->progress;
	gtk_widget_set_valign ((GtkWidget*) _tmp59_, GTK_ALIGN_CENTER);
	_tmp60_ = self->priv->progress;
	gtk_widget_add_css_class ((GtkWidget*) _tmp60_, "conversation-media-progress");
	_tmp61_ = self->priv->progress;
	g_signal_connect_object ((GtkRange*) _tmp61_, "change-value", (GCallback) ___lambda49__gtk_range_change_value, self, 0);
	_tmp62_ = self->priv->progress;
	gtk_box_append (details, (GtkWidget*) _tmp62_);
	_tmp63_ = self->priv->content;
	gtk_box_append (_tmp63_, (GtkWidget*) details);
	_tmp64_ = (GtkLabel*) gtk_label_new ("0:00");
	g_object_ref_sink (_tmp64_);
	_g_object_unref0 (self->priv->time_label);
	self->priv->time_label = _tmp64_;
	_tmp65_ = self->priv->time_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp65_, "conversation-media-time");
	_tmp66_ = self->priv->time_label;
	gtk_label_set_width_chars (_tmp66_, 11);
	_tmp67_ = self->priv->time_label;
	gtk_label_set_xalign (_tmp67_, (gfloat) 1);
	_tmp68_ = self->priv->time_label;
	gtk_widget_set_valign ((GtkWidget*) _tmp68_, GTK_ALIGN_CENTER);
	_tmp69_ = self->priv->content;
	_tmp70_ = self->priv->time_label;
	gtk_box_append (_tmp69_, (GtkWidget*) _tmp70_);
	_tmp71_ = dc_conversation_media_bar_media_button (self, "window-close-symbolic", "Close player");
	_g_object_unref0 (self->priv->close_button);
	self->priv->close_button = _tmp71_;
	_tmp72_ = self->priv->close_button;
	g_signal_connect_object (_tmp72_, "clicked", (GCallback) ___lambda50__gtk_button_clicked, self, 0);
	_tmp73_ = self->priv->content;
	_tmp74_ = self->priv->close_button;
	gtk_box_append (_tmp73_, (GtkWidget*) _tmp74_);
	_tmp75_ = self->priv->revealer;
	_tmp76_ = self->priv->content;
	gtk_revealer_set_child (_tmp75_, (GtkWidget*) _tmp76_);
	_tmp77_ = self->priv->content;
	gtk_widget_set_visible ((GtkWidget*) _tmp77_, FALSE);
	_tmp78_ = self->priv->revealer;
	g_signal_connect_object ((GObject*) _tmp78_, "notify::child-revealed", (GCallback) ___lambda51__g_object_notify, self, 0);
	_tmp79_ = self->priv->revealer;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp79_);
	_tmp80_ = (GtkGestureClick*) gtk_gesture_click_new ();
	click = _tmp80_;
	gtk_gesture_single_set_button ((GtkGestureSingle*) click, (guint) GDK_BUTTON_PRIMARY);
	g_signal_connect_object (click, "released", (GCallback) ___lambda52__gtk_gesture_click_released, self, 0);
	_tmp81_ = _g_object_ref0 ((GtkEventController*) click);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp81_);
	_tmp82_ = self->priv->playback;
	_tmp83_ = g_signal_connect_object ((GObject*) _tmp82_, "notify::current-item", (GCallback) _dc_conversation_media_bar_sync_item_g_object_notify, self, 0);
	self->priv->item_handler = _tmp83_;
	_tmp84_ = self->priv->playback;
	_tmp85_ = g_signal_connect_object ((GObject*) _tmp84_, "notify::current-message-id", (GCallback) _dc_conversation_media_bar_sync_playback_g_object_notify, self, 0);
	self->priv->current_handler = _tmp85_;
	_tmp86_ = self->priv->playback;
	_tmp87_ = g_signal_connect_object ((GObject*) _tmp86_, "notify::playing", (GCallback) _dc_conversation_media_bar_sync_playback_g_object_notify, self, 0);
	self->priv->playing_handler = _tmp87_;
	_tmp88_ = self->priv->playback;
	_tmp89_ = g_signal_connect_object ((GObject*) _tmp88_, "notify::can-seek", (GCallback) _dc_conversation_media_bar_sync_playback_g_object_notify, self, 0);
	self->priv->seekable_handler = _tmp89_;
	_tmp90_ = self->priv->playback;
	_tmp91_ = g_signal_connect_object ((GObject*) _tmp90_, "notify::external-backend", (GCallback) _dc_conversation_media_bar_sync_playback_g_object_notify, self, 0);
	self->priv->external_handler = _tmp91_;
	_tmp92_ = self->priv->playback;
	_tmp93_ = g_signal_connect_object ((GObject*) _tmp92_, "notify::position-us", (GCallback) _dc_conversation_media_bar_sync_playback_g_object_notify, self, 0);
	self->priv->position_handler = _tmp93_;
	_tmp94_ = self->priv->playback;
	_tmp95_ = g_signal_connect_object ((GObject*) _tmp94_, "notify::duration-us", (GCallback) _dc_conversation_media_bar_sync_playback_g_object_notify, self, 0);
	self->priv->duration_handler = _tmp95_;
	_tmp96_ = self->priv->playback;
	_tmp97_ = g_signal_connect_object ((GObject*) _tmp96_, "notify::playback-rate", (GCallback) _dc_conversation_media_bar_sync_speed_g_object_notify, self, 0);
	self->priv->rate_handler = _tmp97_;
	_tmp98_ = self->priv->playback;
	_tmp99_ = g_signal_connect_object ((GObject*) _tmp98_, "notify::has-previous", (GCallback) _dc_conversation_media_bar_sync_navigation_g_object_notify, self, 0);
	self->priv->previous_handler = _tmp99_;
	_tmp100_ = self->priv->playback;
	_tmp101_ = g_signal_connect_object ((GObject*) _tmp100_, "notify::has-next", (GCallback) _dc_conversation_media_bar_sync_navigation_g_object_notify, self, 0);
	self->priv->next_handler = _tmp101_;
	dc_conversation_media_bar_sync_item (self);
	_g_object_unref0 (click);
	_g_object_unref0 (metadata);
	_g_object_unref0 (details);
	return self;
}

DcConversationMediaBar*
dc_conversation_media_bar_new (void)
{
	return dc_conversation_media_bar_construct (DC_TYPE_CONVERSATION_MEDIA_BAR);
}

static GtkButton*
dc_conversation_media_bar_media_button (DcConversationMediaBar* self,
                                        const gchar* icon_name,
                                        const gchar* tooltip)
{
	GtkButton* button = NULL;
	GtkButton* _tmp0_;
	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);
	_tmp0_ = (GtkButton*) gtk_button_new_from_icon_name (icon_name);
	g_object_ref_sink (_tmp0_);
	button = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) button, "flat");
	gtk_widget_add_css_class ((GtkWidget*) button, "circular");
	gtk_widget_set_valign ((GtkWidget*) button, GTK_ALIGN_CENTER);
	gtk_widget_set_tooltip_text ((GtkWidget*) button, tooltip);
	result = button;
	return result;
}

static void
dc_conversation_media_bar_sync_playback (DcConversationMediaBar* self)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gboolean matches = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean is_playing = FALSE;
	const gchar* _tmp10_ = NULL;
	GtkButton* _tmp11_;
	const gchar* _tmp12_ = NULL;
	GtkButton* _tmp13_;
	gint64 _tmp14_ = 0LL;
	gint64 position = 0LL;
	gint64 _tmp18_ = 0LL;
	gint64 duration = 0LL;
	gdouble _tmp22_ = 0.0;
	gdouble fraction = 0.0;
	GtkScale* _tmp23_;
	GtkScale* _tmp24_;
	DcAudioPlayback* _tmp25_;
	gboolean _tmp26_;
	gboolean _tmp27_;
	gboolean _tmp28_ = FALSE;
	GtkScale* _tmp32_;
	const gchar* _tmp33_ = NULL;
	GtkScale* _tmp34_;
	gboolean _tmp35_;
	gboolean _tmp36_;
	GtkScale* _tmp41_;
	GtkLabel* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_message_id;
	if (_tmp1_ > 0) {
		DcAudioPlayback* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		_tmp2_ = self->priv->playback;
		_tmp3_ = dc_audio_playback_get_current_message_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->_message_id;
		_tmp0_ = _tmp4_ == _tmp5_;
	} else {
		_tmp0_ = FALSE;
	}
	matches = _tmp0_;
	if (matches) {
		DcAudioPlayback* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = self->priv->playback;
		_tmp8_ = dc_audio_playback_get_playing (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp6_ = _tmp9_;
	} else {
		_tmp6_ = FALSE;
	}
	is_playing = _tmp6_;
	if (is_playing) {
		_tmp10_ = "media-playback-pause-symbolic";
	} else {
		_tmp10_ = "media-playback-start-symbolic";
	}
	_tmp11_ = self->priv->play_button;
	gtk_button_set_icon_name (_tmp11_, _tmp10_);
	if (is_playing) {
		_tmp12_ = "Pause";
	} else {
		_tmp12_ = "Play";
	}
	_tmp13_ = self->priv->play_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp13_, _tmp12_);
	if (matches) {
		DcAudioPlayback* _tmp15_;
		gint64 _tmp16_;
		gint64 _tmp17_;
		_tmp15_ = self->priv->playback;
		_tmp16_ = dc_audio_playback_get_position_us (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp14_ = _tmp17_;
	} else {
		_tmp14_ = (gint64) 0;
	}
	position = _tmp14_;
	if (matches) {
		DcAudioPlayback* _tmp19_;
		gint64 _tmp20_;
		gint64 _tmp21_;
		_tmp19_ = self->priv->playback;
		_tmp20_ = dc_audio_playback_get_duration_us (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp18_ = _tmp21_;
	} else {
		_tmp18_ = (gint64) 0;
	}
	duration = _tmp18_;
	if (duration > ((gint64) 0)) {
		_tmp22_ = MIN (1.0, ((gdouble) position) / ((gdouble) duration));
	} else {
		_tmp22_ = 0.0;
	}
	fraction = _tmp22_;
	_tmp23_ = self->priv->progress;
	gtk_range_set_value ((GtkRange*) _tmp23_, fraction);
	_tmp24_ = self->priv->progress;
	_tmp25_ = self->priv->playback;
	_tmp26_ = dc_audio_playback_get_external_backend (_tmp25_);
	_tmp27_ = _tmp26_;
	gtk_widget_set_visible ((GtkWidget*) _tmp24_, !_tmp27_);
	if (matches) {
		DcAudioPlayback* _tmp29_;
		gboolean _tmp30_;
		gboolean _tmp31_;
		_tmp29_ = self->priv->playback;
		_tmp30_ = dc_audio_playback_get_can_seek (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp28_ = _tmp31_;
	} else {
		_tmp28_ = FALSE;
	}
	_tmp32_ = self->priv->progress;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp32_, _tmp28_);
	_tmp34_ = self->priv->progress;
	_tmp35_ = gtk_widget_get_sensitive ((GtkWidget*) _tmp34_);
	_tmp36_ = _tmp35_;
	if (_tmp36_) {
		_tmp33_ = "Drag to seek";
	} else {
		const gchar* _tmp37_ = NULL;
		DcAudioPlayback* _tmp38_;
		gboolean _tmp39_;
		gboolean _tmp40_;
		_tmp38_ = self->priv->playback;
		_tmp39_ = dc_audio_playback_get_external_backend (_tmp38_);
		_tmp40_ = _tmp39_;
		if (_tmp40_) {
			_tmp37_ = "Seeking is unavailable with the system audio player";
		} else {
			_tmp37_ = "Seeking will be available after the audio loads";
		}
		_tmp33_ = _tmp37_;
	}
	_tmp41_ = self->priv->progress;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp41_, _tmp33_);
	_tmp42_ = self->priv->time_label;
	_tmp43_ = dc_conversation_media_bar_format_playing_time (position, duration);
	_tmp44_ = _tmp43_;
	gtk_label_set_label (_tmp42_, _tmp44_);
	_g_free0 (_tmp44_);
	dc_conversation_media_bar_sync_speed (self);
}

static void
dc_conversation_media_bar_sync_speed (DcConversationMediaBar* self)
{
	GtkDropDown* _tmp0_;
	DcAudioPlayback* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gboolean _tmp4_ = FALSE;
	gint _tmp5_;
	GtkDropDown* _tmp9_;
	const gchar* _tmp10_ = NULL;
	DcAudioPlayback* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	GtkDropDown* _tmp14_;
	g_return_if_fail (self != NULL);
	self->priv->syncing_speed = TRUE;
	_tmp0_ = self->priv->speed_dropdown;
	_tmp1_ = self->priv->playback;
	_tmp2_ = dc_audio_playback_get_playback_rate (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_drop_down_set_selected (_tmp0_, dc_audio_playback_index_for_rate (_tmp3_));
	self->priv->syncing_speed = FALSE;
	_tmp5_ = self->priv->_message_id;
	if (_tmp5_ > 0) {
		DcAudioPlayback* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = self->priv->playback;
		_tmp7_ = dc_audio_playback_get_can_change_speed (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_;
	} else {
		_tmp4_ = FALSE;
	}
	_tmp9_ = self->priv->speed_dropdown;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp9_, _tmp4_);
	_tmp11_ = self->priv->playback;
	_tmp12_ = dc_audio_playback_get_can_change_speed (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_) {
		_tmp10_ = "Playback speed";
	} else {
		_tmp10_ = "Install GstPlay, mpv, or ffplay to change playback speed";
	}
	_tmp14_ = self->priv->speed_dropdown;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp14_, _tmp10_);
}

static void
dc_conversation_media_bar_sync_item (DcConversationMediaBar* self)
{
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp0_;
	DcAudioPlaybackItem* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	DcAudioPlaybackItem* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	AdwAvatar* _tmp9_;
	DcAudioPlaybackItem* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	AdwAvatar* _tmp13_;
	DcAudioPlaybackItem* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GdkTexture* _tmp17_;
	GdkTexture* _tmp18_;
	AdwAvatar* _tmp19_;
	DcAudioPlaybackItem* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	GtkLabel* _tmp23_;
	DcAudioPlaybackItem* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_ = NULL;
	DcAudioPlaybackItem* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GtkLabel* _tmp34_;
	GtkLabel* _tmp35_;
	DcAudioPlaybackItem* _tmp36_;
	gint64 _tmp37_;
	gint64 _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	GtkLabel* _tmp41_;
	GtkLabel* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	GtkBox* _tmp45_;
	GtkRevealer* _tmp46_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->playback;
	_tmp1_ = dc_audio_playback_get_current_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	item = _tmp3_;
	_tmp4_ = item;
	if (_tmp4_ == NULL) {
		GtkRevealer* _tmp5_;
		dc_conversation_media_bar_set_message_id (self, 0);
		_tmp5_ = self->priv->revealer;
		gtk_revealer_set_reveal_child (_tmp5_, FALSE);
		_g_object_unref0 (item);
		return;
	}
	_tmp6_ = item;
	_tmp7_ = dc_audio_playback_item_get_message_id (_tmp6_);
	_tmp8_ = _tmp7_;
	dc_conversation_media_bar_set_message_id (self, _tmp8_);
	_tmp9_ = self->priv->avatar;
	_tmp10_ = item;
	_tmp11_ = dc_audio_playback_item_get_sender_name (_tmp10_);
	_tmp12_ = _tmp11_;
	adw_avatar_set_text (_tmp9_, _tmp12_);
	_tmp13_ = self->priv->avatar;
	_tmp14_ = item;
	_tmp15_ = dc_audio_playback_item_get_avatar_path (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = dc_load_avatar (_tmp16_);
	_tmp18_ = _tmp17_;
	adw_avatar_set_custom_image (_tmp13_, (GdkPaintable*) _tmp18_);
	_g_object_unref0 (_tmp18_);
	_tmp19_ = self->priv->avatar;
	_tmp20_ = item;
	_tmp21_ = dc_audio_playback_item_get_sender_name (_tmp20_);
	_tmp22_ = _tmp21_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp19_, _tmp22_);
	_tmp23_ = self->priv->sender_label;
	_tmp24_ = item;
	_tmp25_ = dc_audio_playback_item_get_sender_name (_tmp24_);
	_tmp26_ = _tmp25_;
	gtk_label_set_label (_tmp23_, _tmp26_);
	_tmp28_ = item;
	_tmp29_ = dc_audio_playback_item_get_sender_address (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp27_ = _tmp30_;
	if (_tmp27_ == NULL) {
		DcAudioPlaybackItem* _tmp31_;
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		_tmp31_ = item;
		_tmp32_ = dc_audio_playback_item_get_sender_name (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp27_ = _tmp33_;
	}
	_tmp34_ = self->priv->sender_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp34_, _tmp27_);
	_tmp35_ = self->priv->sent_label;
	_tmp36_ = item;
	_tmp37_ = dc_audio_playback_item_get_sent_timestamp (_tmp36_);
	_tmp38_ = _tmp37_;
	_tmp39_ = dc_conversation_media_bar_format_sent_timestamp (_tmp38_);
	_tmp40_ = _tmp39_;
	gtk_label_set_label (_tmp35_, _tmp40_);
	_g_free0 (_tmp40_);
	_tmp41_ = self->priv->sent_label;
	_tmp42_ = self->priv->sent_label;
	_tmp43_ = gtk_label_get_label (_tmp42_);
	_tmp44_ = _tmp43_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp41_, _tmp44_);
	_tmp45_ = self->priv->content;
	gtk_widget_set_visible ((GtkWidget*) _tmp45_, TRUE);
	_tmp46_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp46_, TRUE);
	dc_conversation_media_bar_sync_navigation (self);
	dc_conversation_media_bar_sync_playback (self);
	_g_object_unref0 (item);
}

static void
dc_conversation_media_bar_sync_navigation (DcConversationMediaBar* self)
{
	gboolean _tmp0_ = FALSE;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	GtkButton* _tmp7_;
	gboolean _tmp8_ = FALSE;
	DcAudioPlayback* _tmp9_;
	DcAudioPlaybackItem* _tmp10_;
	DcAudioPlaybackItem* _tmp11_;
	GtkButton* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->playback;
	_tmp2_ = dc_audio_playback_get_current_item (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		DcAudioPlayback* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->priv->playback;
		_tmp5_ = dc_audio_playback_get_has_previous (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp7_ = self->priv->previous_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, _tmp0_);
	_tmp9_ = self->priv->playback;
	_tmp10_ = dc_audio_playback_get_current_item (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_ != NULL) {
		DcAudioPlayback* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		_tmp12_ = self->priv->playback;
		_tmp13_ = dc_audio_playback_get_has_next (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp8_ = _tmp14_;
	} else {
		_tmp8_ = FALSE;
	}
	_tmp15_ = self->priv->next_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, _tmp8_);
}

static gboolean
dc_conversation_media_bar_pointer_is_on_control (DcConversationMediaBar* self,
                                                 gdouble x,
                                                 gdouble y)
{
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_widget_pick ((GtkWidget*) self, x, y, GTK_PICK_DEFAULT);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	widget = _tmp1_;
	while (TRUE) {
		gboolean _tmp2_ = FALSE;
		GtkWidget* _tmp3_;
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		gboolean _tmp9_ = FALSE;
		GtkWidget* _tmp10_;
		GtkButton* _tmp11_;
		GtkWidget* _tmp22_;
		GtkWidget* _tmp23_;
		GtkWidget* _tmp24_;
		_tmp3_ = widget;
		if (_tmp3_ != NULL) {
			GtkWidget* _tmp4_;
			_tmp4_ = widget;
			_tmp2_ = _tmp4_ != G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget);
		} else {
			_tmp2_ = FALSE;
		}
		if (!_tmp2_) {
			break;
		}
		_tmp10_ = widget;
		_tmp11_ = self->priv->previous_button;
		if (_tmp10_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_widget_get_type (), GtkWidget)) {
			_tmp9_ = TRUE;
		} else {
			GtkWidget* _tmp12_;
			GtkButton* _tmp13_;
			_tmp12_ = widget;
			_tmp13_ = self->priv->play_button;
			_tmp9_ = _tmp12_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, gtk_widget_get_type (), GtkWidget);
		}
		if (_tmp9_) {
			_tmp8_ = TRUE;
		} else {
			GtkWidget* _tmp14_;
			GtkButton* _tmp15_;
			_tmp14_ = widget;
			_tmp15_ = self->priv->next_button;
			_tmp8_ = _tmp14_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, gtk_widget_get_type (), GtkWidget);
		}
		if (_tmp8_) {
			_tmp7_ = TRUE;
		} else {
			GtkWidget* _tmp16_;
			GtkButton* _tmp17_;
			_tmp16_ = widget;
			_tmp17_ = self->priv->close_button;
			_tmp7_ = _tmp16_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, gtk_widget_get_type (), GtkWidget);
		}
		if (_tmp7_) {
			_tmp6_ = TRUE;
		} else {
			GtkWidget* _tmp18_;
			GtkScale* _tmp19_;
			_tmp18_ = widget;
			_tmp19_ = self->priv->progress;
			_tmp6_ = _tmp18_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, gtk_widget_get_type (), GtkWidget);
		}
		if (_tmp6_) {
			_tmp5_ = TRUE;
		} else {
			GtkWidget* _tmp20_;
			GtkDropDown* _tmp21_;
			_tmp20_ = widget;
			_tmp21_ = self->priv->speed_dropdown;
			_tmp5_ = _tmp20_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, gtk_widget_get_type (), GtkWidget);
		}
		if (_tmp5_) {
			result = TRUE;
			_g_object_unref0 (widget);
			return result;
		}
		_tmp22_ = widget;
		_tmp23_ = gtk_widget_get_parent (_tmp22_);
		_tmp24_ = _g_object_ref0 (_tmp23_);
		_g_object_unref0 (widget);
		widget = _tmp24_;
	}
	result = FALSE;
	_g_object_unref0 (widget);
	return result;
}

static gchar*
dc_conversation_media_bar_format_sent_timestamp (gint64 timestamp)
{
	gchar* when = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gchar* _tmp8_;
	gchar* result;
	_tmp0_ = dc_format_date_time (timestamp);
	when = _tmp0_;
	_tmp2_ = when;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ > 0) {
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = when;
		_tmp6_ = g_strconcat ("Sent ", _tmp5_, NULL);
		_g_free0 (_tmp1_);
		_tmp1_ = _tmp6_;
	} else {
		gchar* _tmp7_;
		_tmp7_ = g_strdup ("");
		_g_free0 (_tmp1_);
		_tmp1_ = _tmp7_;
	}
	_tmp8_ = _tmp1_;
	_tmp1_ = NULL;
	result = _tmp8_;
	_g_free0 (_tmp1_);
	_g_free0 (when);
	return result;
}

gchar*
dc_conversation_media_bar_format_playing_time (gint64 position_us,
                                               gint64 duration_us)
{
	gchar* position = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp8_;
	gchar* result;
	_tmp0_ = dc_conversation_media_bar_format_duration (position_us);
	position = _tmp0_;
	if (duration_us > ((gint64) 0)) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = position;
		_tmp3_ = dc_conversation_media_bar_format_duration (duration_us);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf ("%s / %s", _tmp2_, _tmp4_);
		_g_free0 (_tmp1_);
		_tmp1_ = _tmp5_;
		_g_free0 (_tmp4_);
	} else {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp6_ = position;
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (_tmp1_);
		_tmp1_ = _tmp7_;
	}
	_tmp8_ = _tmp1_;
	_tmp1_ = NULL;
	result = _tmp8_;
	_g_free0 (_tmp1_);
	_g_free0 (position);
	return result;
}

static gchar*
dc_conversation_media_bar_format_duration (gint64 microseconds)
{
	gint64 total_seconds = 0LL;
	gint64 hours = 0LL;
	gint64 minutes = 0LL;
	gint64 seconds = 0LL;
	gchar* minutes_text = NULL;
	gchar* _tmp0_;
	gchar* seconds_text = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* _tmp12_;
	gchar* result;
	total_seconds = MAX ((gint64) 0, microseconds) / 1000000;
	hours = total_seconds / 3600;
	minutes = (total_seconds % 3600) / 60;
	seconds = total_seconds % 60;
	_tmp0_ = g_strdup_printf ("%02" G_GINT64_FORMAT, minutes);
	minutes_text = _tmp0_;
	_tmp1_ = g_strdup_printf ("%02" G_GINT64_FORMAT, seconds);
	seconds_text = _tmp1_;
	if (hours > ((gint64) 0)) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp3_ = g_strdup_printf ("%" G_GINT64_FORMAT, hours);
		_tmp4_ = _tmp3_;
		_tmp5_ = minutes_text;
		_tmp6_ = seconds_text;
		_tmp7_ = g_strdup_printf ("%s:%s:%s", _tmp4_, _tmp5_, _tmp6_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp7_;
		_g_free0 (_tmp4_);
	} else {
		gchar* _tmp8_;
		gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp8_ = g_strdup_printf ("%" G_GINT64_FORMAT, minutes);
		_tmp9_ = _tmp8_;
		_tmp10_ = seconds_text;
		_tmp11_ = g_strdup_printf ("%s:%s", _tmp9_, _tmp10_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp11_;
		_g_free0 (_tmp9_);
	}
	_tmp12_ = _tmp2_;
	_tmp2_ = NULL;
	result = _tmp12_;
	_g_free0 (_tmp2_);
	_g_free0 (seconds_text);
	_g_free0 (minutes_text);
	return result;
}

static void
dc_conversation_media_bar_real_dispose (GObject* base)
{
	DcConversationMediaBar * self;
	gulong* handlers = NULL;
	gulong* _tmp0_;
	gint handlers_length1;
	gint _handlers_size_;
	gulong* _tmp1_;
	gint _tmp1__length1;
	self = (DcConversationMediaBar*) base;
	_tmp0_ = g_new0 (gulong, 10);
	_tmp0_[0] = self->priv->current_handler;
	_tmp0_[1] = self->priv->item_handler;
	_tmp0_[2] = self->priv->playing_handler;
	_tmp0_[3] = self->priv->seekable_handler;
	_tmp0_[4] = self->priv->external_handler;
	_tmp0_[5] = self->priv->position_handler;
	_tmp0_[6] = self->priv->duration_handler;
	_tmp0_[7] = self->priv->previous_handler;
	_tmp0_[8] = self->priv->next_handler;
	_tmp0_[9] = self->priv->rate_handler;
	handlers = _tmp0_;
	handlers_length1 = 10;
	_handlers_size_ = handlers_length1;
	_tmp1_ = handlers;
	_tmp1__length1 = handlers_length1;
	{
		gulong* handler_collection = NULL;
		gint handler_collection_length1 = 0;
		gint _handler_collection_size_ = 0;
		gint handler_it = 0;
		handler_collection = _tmp1_;
		handler_collection_length1 = _tmp1__length1;
		for (handler_it = 0; handler_it < handler_collection_length1; handler_it = handler_it + 1) {
			gulong handler = 0UL;
			handler = handler_collection[handler_it];
			{
				if (handler != ((gulong) 0)) {
					DcAudioPlayback* _tmp2_;
					_tmp2_ = self->priv->playback;
					g_signal_handler_disconnect ((GObject*) _tmp2_, handler);
				}
			}
		}
	}
	self->priv->playing_handler = (gulong) 0;
	self->priv->item_handler = self->priv->playing_handler;
	self->priv->current_handler = self->priv->item_handler;
	self->priv->next_handler = (gulong) 0;
	self->priv->previous_handler = self->priv->next_handler;
	self->priv->seekable_handler = self->priv->previous_handler;
	self->priv->duration_handler = (gulong) 0;
	self->priv->position_handler = self->priv->duration_handler;
	self->priv->external_handler = self->priv->position_handler;
	self->priv->rate_handler = (gulong) 0;
	G_OBJECT_CLASS (dc_conversation_media_bar_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
	handlers = (g_free (handlers), NULL);
}

gint
dc_conversation_media_bar_get_message_id (DcConversationMediaBar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_message_id;
	return result;
}

static void
dc_conversation_media_bar_set_message_id (DcConversationMediaBar* self,
                                          gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_conversation_media_bar_get_message_id (self);
	if (old_value != value) {
		self->priv->_message_id = value;
		g_object_notify_by_pspec ((GObject *) self, dc_conversation_media_bar_properties[DC_CONVERSATION_MEDIA_BAR_MESSAGE_ID_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__INT_INT_INT (GClosure * closure,
                                           GValue * return_value,
                                           guint n_param_values,
                                           const GValue * param_values,
                                           gpointer invocation_hint,
                                           gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__INT_INT_INT) (gpointer data1, gint arg_1, gint arg_2, gint arg_3, gpointer data2);
	register GMarshalFunc_VOID__INT_INT_INT 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__INT_INT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), g_value_get_int (param_values + 3), data2);
}

static void
dc_conversation_media_bar_class_init (DcConversationMediaBarClass * klass,
                                      gpointer klass_data)
{
	dc_conversation_media_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcConversationMediaBar_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dc_conversation_media_bar_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_conversation_media_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_conversation_media_bar_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_conversation_media_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_CONVERSATION_MEDIA_BAR_MESSAGE_ID_PROPERTY, dc_conversation_media_bar_properties[DC_CONVERSATION_MEDIA_BAR_MESSAGE_ID_PROPERTY] = g_param_spec_int ("message-id", "message-id", "message-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_PREVIOUS_REQUESTED_SIGNAL] = g_signal_new ("previous-requested", DC_TYPE_CONVERSATION_MEDIA_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_NEXT_REQUESTED_SIGNAL] = g_signal_new ("next-requested", DC_TYPE_CONVERSATION_MEDIA_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dc_conversation_media_bar_signals[DC_CONVERSATION_MEDIA_BAR_MESSAGE_REQUESTED_SIGNAL] = g_signal_new ("message-requested", DC_TYPE_CONVERSATION_MEDIA_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT_INT, G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
}

static void
dc_conversation_media_bar_instance_init (DcConversationMediaBar * self,
                                         gpointer klass)
{
	self->priv = dc_conversation_media_bar_get_instance_private (self);
	self->priv->_message_id = 0;
	self->priv->syncing_speed = FALSE;
	self->priv->current_handler = (gulong) 0;
	self->priv->item_handler = (gulong) 0;
	self->priv->playing_handler = (gulong) 0;
	self->priv->seekable_handler = (gulong) 0;
	self->priv->external_handler = (gulong) 0;
	self->priv->position_handler = (gulong) 0;
	self->priv->duration_handler = (gulong) 0;
	self->priv->rate_handler = (gulong) 0;
	self->priv->previous_handler = (gulong) 0;
	self->priv->next_handler = (gulong) 0;
}

static void
dc_conversation_media_bar_finalize (GObject * obj)
{
	DcConversationMediaBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBar);
	_g_object_unref0 (self->priv->playback);
	_g_object_unref0 (self->priv->revealer);
	_g_object_unref0 (self->priv->content);
	_g_object_unref0 (self->priv->avatar);
	_g_object_unref0 (self->priv->previous_button);
	_g_object_unref0 (self->priv->play_button);
	_g_object_unref0 (self->priv->next_button);
	_g_object_unref0 (self->priv->close_button);
	_g_object_unref0 (self->priv->sender_label);
	_g_object_unref0 (self->priv->sent_label);
	_g_object_unref0 (self->priv->time_label);
	_g_object_unref0 (self->priv->progress);
	_g_object_unref0 (self->priv->speed_dropdown);
	G_OBJECT_CLASS (dc_conversation_media_bar_parent_class)->finalize (obj);
}

/** Conversation-level controls for the currently selected voice note. */
static GType
dc_conversation_media_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcConversationMediaBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_conversation_media_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcConversationMediaBar), 0, (GInstanceInitFunc) dc_conversation_media_bar_instance_init, NULL };
	GType dc_conversation_media_bar_type_id;
	dc_conversation_media_bar_type_id = g_type_register_static (gtk_box_get_type (), "DcConversationMediaBar", &g_define_type_info, 0);
	DcConversationMediaBar_private_offset = g_type_add_instance_private (dc_conversation_media_bar_type_id, sizeof (DcConversationMediaBarPrivate));
	return dc_conversation_media_bar_type_id;
}

GType
dc_conversation_media_bar_get_type (void)
{
	static volatile gsize dc_conversation_media_bar_type_id__once = 0;
	if (g_once_init_enter (&dc_conversation_media_bar_type_id__once)) {
		GType dc_conversation_media_bar_type_id;
		dc_conversation_media_bar_type_id = dc_conversation_media_bar_get_type_once ();
		g_once_init_leave (&dc_conversation_media_bar_type_id__once, dc_conversation_media_bar_type_id);
	}
	return dc_conversation_media_bar_type_id__once;
}

static void
_vala_dc_conversation_media_bar_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	DcConversationMediaBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBar);
	switch (property_id) {
		case DC_CONVERSATION_MEDIA_BAR_MESSAGE_ID_PROPERTY:
		g_value_set_int (value, dc_conversation_media_bar_get_message_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_conversation_media_bar_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	DcConversationMediaBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBar);
	switch (property_id) {
		case DC_CONVERSATION_MEDIA_BAR_MESSAGE_ID_PROPERTY:
		dc_conversation_media_bar_set_message_id (self, g_value_get_int (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;
}

