mirror of
https://gitlab.gnome.org/GNOME/libgnome-volume-control.git
synced 2024-11-21 08:20:40 -05:00
Gvc: make GvcMixerStreamPort a boxed type
It's a prerequisite for accessing it from JS https://bugzilla.gnome.org/show_bug.cgi?id=675902
This commit is contained in:
parent
eab2bf3eea
commit
740bab1714
@ -1470,7 +1470,7 @@ update_sink (GvcMixerControl *control,
|
||||
for (i = 0; i < info->n_ports; i++) {
|
||||
GvcMixerStreamPort *port;
|
||||
|
||||
port = g_new0 (GvcMixerStreamPort, 1);
|
||||
port = g_slice_new0 (GvcMixerStreamPort);
|
||||
port->port = g_strdup (info->ports[i]->name);
|
||||
port->human_port = g_strdup (info->ports[i]->description);
|
||||
port->priority = info->ports[i]->priority;
|
||||
@ -1598,7 +1598,7 @@ update_source (GvcMixerControl *control,
|
||||
for (i = 0; i < info->n_ports; i++) {
|
||||
GvcMixerStreamPort *port;
|
||||
|
||||
port = g_new0 (GvcMixerStreamPort, 1);
|
||||
port = g_slice_new0 (GvcMixerStreamPort);
|
||||
port->port = g_strdup (info->ports[i]->name);
|
||||
port->human_port = g_strdup (info->ports[i]->description);
|
||||
port->priority = info->ports[i]->priority;
|
||||
|
@ -88,6 +88,30 @@ static void gvc_mixer_stream_finalize (GObject *object);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GvcMixerStream, gvc_mixer_stream, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
free_port (GvcMixerStreamPort *p)
|
||||
{
|
||||
g_free (p->port);
|
||||
g_free (p->human_port);
|
||||
g_slice_free (GvcMixerStreamPort, p);
|
||||
}
|
||||
|
||||
static GvcMixerStreamPort *
|
||||
dup_port (GvcMixerStreamPort *p)
|
||||
{
|
||||
GvcMixerStreamPort *m;
|
||||
|
||||
m = g_slice_new (GvcMixerStreamPort);
|
||||
|
||||
*m = *p;
|
||||
m->port = g_strdup (p->port);
|
||||
m->human_port = g_strdup (p->human_port);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GvcMixerStreamPort, gvc_mixer_stream_port, dup_port, free_port)
|
||||
|
||||
static guint32
|
||||
get_next_stream_serial (void)
|
||||
{
|
||||
@ -945,14 +969,6 @@ gvc_mixer_stream_init (GvcMixerStream *stream)
|
||||
stream->priv = GVC_MIXER_STREAM_GET_PRIVATE (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
free_port (GvcMixerStreamPort *p)
|
||||
{
|
||||
g_free (p->port);
|
||||
g_free (p->human_port);
|
||||
g_free (p);
|
||||
}
|
||||
|
||||
static void
|
||||
gvc_mixer_stream_finalize (GObject *object)
|
||||
{
|
||||
|
@ -64,7 +64,8 @@ typedef struct
|
||||
gboolean available;
|
||||
} GvcMixerStreamPort;
|
||||
|
||||
GType gvc_mixer_stream_get_type (void);
|
||||
GType gvc_mixer_stream_port_get_type (void) G_GNUC_CONST;
|
||||
GType gvc_mixer_stream_get_type (void) G_GNUC_CONST;
|
||||
|
||||
guint gvc_mixer_stream_get_index (GvcMixerStream *stream);
|
||||
guint gvc_mixer_stream_get_id (GvcMixerStream *stream);
|
||||
|
Loading…
Reference in New Issue
Block a user