summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-11-08 23:19:34 +0100
committerMichal Ratajsky <[email protected]>2014-11-08 23:19:34 +0100
commitfae2085e39de4e49b692e334c6482442f6c83007 (patch)
tree081dc44150eef7eb2b1f78e0b84ba0fccd803a06
parent44651c5d2334da5dd295eca9c2e530b99348bdd6 (diff)
downloadlibmatemixer-fae2085e39de4e49b692e334c6482442f6c83007.tar.bz2
libmatemixer-fae2085e39de4e49b692e334c6482442f6c83007.tar.xz
Return MateMixerDeviceSwitch and MateMixerStreamSwitch from functions when feasible and include docs of the new classes
-rw-r--r--docs/reference/libmatemixer-docs.xml2
-rw-r--r--libmatemixer/matemixer-device.c17
-rw-r--r--libmatemixer/matemixer-device.h32
-rw-r--r--libmatemixer/matemixer-stream.c13
-rw-r--r--libmatemixer/matemixer-stream.h4
5 files changed, 38 insertions, 30 deletions
diff --git a/docs/reference/libmatemixer-docs.xml b/docs/reference/libmatemixer-docs.xml
index 16c1a1f..615a67a 100644
--- a/docs/reference/libmatemixer-docs.xml
+++ b/docs/reference/libmatemixer-docs.xml
@@ -19,8 +19,10 @@
<xi:include href="xml/matemixer-app-info.xml"/>
<xi:include href="xml/matemixer-context.xml"/>
<xi:include href="xml/matemixer-device.xml"/>
+ <xi:include href="xml/matemixer-device-switch.xml"/>
<xi:include href="xml/matemixer-stream.xml"/>
<xi:include href="xml/matemixer-stream-control.xml"/>
+ <xi:include href="xml/matemixer-stream-switch.xml"/>
<xi:include href="xml/matemixer-stored-control.xml"/>
<xi:include href="xml/matemixer-switch.xml"/>
<xi:include href="xml/matemixer-switch-option.xml"/>
diff --git a/libmatemixer/matemixer-device.c b/libmatemixer/matemixer-device.c
index f9d368b..cda9657 100644
--- a/libmatemixer/matemixer-device.c
+++ b/libmatemixer/matemixer-device.c
@@ -20,6 +20,7 @@
#include <glib-object.h>
#include "matemixer-device.h"
+#include "matemixer-device-switch.h"
#include "matemixer-stream.h"
#include "matemixer-switch.h"
@@ -76,10 +77,10 @@ static void mate_mixer_device_finalize (GObject *object);
G_DEFINE_ABSTRACT_TYPE (MateMixerDevice, mate_mixer_device, G_TYPE_OBJECT)
-static MateMixerStream *mate_mixer_device_real_get_stream (MateMixerDevice *device,
- const gchar *name);
-static MateMixerSwitch *mate_mixer_device_real_get_switch (MateMixerDevice *device,
- const gchar *name);
+static MateMixerStream * mate_mixer_device_real_get_stream (MateMixerDevice *device,
+ const gchar *name);
+static MateMixerDeviceSwitch *mate_mixer_device_real_get_switch (MateMixerDevice *device,
+ const gchar *name);
static void
mate_mixer_device_class_init (MateMixerDeviceClass *klass)
@@ -398,9 +399,9 @@ mate_mixer_device_get_stream (MateMixerDevice *device, const gchar *name)
* To get a stream switch, rather than a device switch, use
* mate_mixer_stream_get_switch().
*
- * Returns: a #MateMixerSwitch or %NULL if there is no such device switch.
+ * Returns: a #MateMixerDeviceSwitch or %NULL if there is no such device switch.
*/
-MateMixerSwitch *
+MateMixerDeviceSwitch *
mate_mixer_device_get_switch (MateMixerDevice *device, const gchar *name)
{
return MATE_MIXER_DEVICE_GET_CLASS (device)->get_switch (device, name);
@@ -487,7 +488,7 @@ mate_mixer_device_real_get_stream (MateMixerDevice *device, const gchar *name)
return NULL;
}
-static MateMixerSwitch *
+static MateMixerDeviceSwitch *
mate_mixer_device_real_get_switch (MateMixerDevice *device, const gchar *name)
{
const GList *list;
@@ -500,7 +501,7 @@ mate_mixer_device_real_get_switch (MateMixerDevice *device, const gchar *name)
MateMixerSwitch *swtch = MATE_MIXER_SWITCH (list->data);
if (strcmp (name, mate_mixer_switch_get_name (swtch)) == 0)
- return swtch;
+ return MATE_MIXER_DEVICE_SWITCH (swtch);
list = list->next;
}
diff --git a/libmatemixer/matemixer-device.h b/libmatemixer/matemixer-device.h
index 49ac347..2ab4c06 100644
--- a/libmatemixer/matemixer-device.h
+++ b/libmatemixer/matemixer-device.h
@@ -66,13 +66,13 @@ struct _MateMixerDeviceClass
GObjectClass parent_class;
/*< private >*/
- MateMixerStream *(*get_stream) (MateMixerDevice *device,
- const gchar *name);
- MateMixerSwitch *(*get_switch) (MateMixerDevice *device,
- const gchar *name);
+ MateMixerStream *(*get_stream) (MateMixerDevice *device,
+ const gchar *name);
+ MateMixerDeviceSwitch *(*get_switch) (MateMixerDevice *device,
+ const gchar *name);
- const GList *(*list_streams) (MateMixerDevice *device);
- const GList *(*list_switches) (MateMixerDevice *device);
+ const GList *(*list_streams) (MateMixerDevice *device);
+ const GList *(*list_switches) (MateMixerDevice *device);
/* Signals */
void (*stream_added) (MateMixerDevice *device,
@@ -85,20 +85,20 @@ struct _MateMixerDeviceClass
const gchar *name);
};
-GType mate_mixer_device_get_type (void) G_GNUC_CONST;
+GType mate_mixer_device_get_type (void) G_GNUC_CONST;
-const gchar * mate_mixer_device_get_name (MateMixerDevice *device);
-const gchar * mate_mixer_device_get_label (MateMixerDevice *device);
-const gchar * mate_mixer_device_get_icon (MateMixerDevice *device);
+const gchar * mate_mixer_device_get_name (MateMixerDevice *device);
+const gchar * mate_mixer_device_get_label (MateMixerDevice *device);
+const gchar * mate_mixer_device_get_icon (MateMixerDevice *device);
-MateMixerStream *mate_mixer_device_get_stream (MateMixerDevice *device,
- const gchar *name);
+MateMixerStream * mate_mixer_device_get_stream (MateMixerDevice *device,
+ const gchar *name);
-MateMixerSwitch *mate_mixer_device_get_switch (MateMixerDevice *device,
- const gchar *name);
+MateMixerDeviceSwitch *mate_mixer_device_get_switch (MateMixerDevice *device,
+ const gchar *name);
-const GList * mate_mixer_device_list_streams (MateMixerDevice *device);
-const GList * mate_mixer_device_list_switches (MateMixerDevice *device);
+const GList * mate_mixer_device_list_streams (MateMixerDevice *device);
+const GList * mate_mixer_device_list_switches (MateMixerDevice *device);
G_END_DECLS
diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c
index 3d8b96e..b5db39a 100644
--- a/libmatemixer/matemixer-stream.c
+++ b/libmatemixer/matemixer-stream.c
@@ -25,6 +25,7 @@
#include "matemixer-stream.h"
#include "matemixer-stream-control.h"
#include "matemixer-stream-private.h"
+#include "matemixer-stream-switch.h"
#include "matemixer-switch.h"
/**
@@ -82,7 +83,7 @@ G_DEFINE_ABSTRACT_TYPE (MateMixerStream, mate_mixer_stream, G_TYPE_OBJECT)
static MateMixerStreamControl *mate_mixer_stream_real_get_control (MateMixerStream *stream,
const gchar *name);
-static MateMixerSwitch * mate_mixer_stream_real_get_switch (MateMixerStream *stream,
+static MateMixerStreamSwitch * mate_mixer_stream_real_get_switch (MateMixerStream *stream,
const gchar *name);
static void
@@ -371,8 +372,12 @@ mate_mixer_stream_get_control (MateMixerStream *stream, const gchar *name)
* mate_mixer_stream_get_switch:
* @stream: a #MateMixerStream
* @name: the name of a stream switch
+ *
+ * Gets the switch with the given name.
+ *
+ * Returns: a #MateMixerStreamSwitch or %NULL if there is no such switch.
*/
-MateMixerSwitch *
+MateMixerStreamSwitch *
mate_mixer_stream_get_switch (MateMixerStream *stream, const gchar *name)
{
g_return_val_if_fail (MATE_MIXER_IS_STREAM (stream), NULL);
@@ -451,7 +456,7 @@ mate_mixer_stream_real_get_control (MateMixerStream *stream, const gchar *name)
return NULL;
}
-static MateMixerSwitch *
+static MateMixerStreamSwitch *
mate_mixer_stream_real_get_switch (MateMixerStream *stream, const gchar *name)
{
const GList *list;
@@ -464,7 +469,7 @@ mate_mixer_stream_real_get_switch (MateMixerStream *stream, const gchar *name)
MateMixerSwitch *swtch = MATE_MIXER_SWITCH (list->data);
if (strcmp (name, mate_mixer_switch_get_name (swtch)) == 0)
- return swtch;
+ return MATE_MIXER_STREAM_SWITCH (swtch);
list = list->next;
}
diff --git a/libmatemixer/matemixer-stream.h b/libmatemixer/matemixer-stream.h
index 7f7c857..5744c04 100644
--- a/libmatemixer/matemixer-stream.h
+++ b/libmatemixer/matemixer-stream.h
@@ -69,7 +69,7 @@ struct _MateMixerStreamClass
/*< private >*/
MateMixerStreamControl *(*get_control) (MateMixerStream *stream,
const gchar *name);
- MateMixerSwitch *(*get_switch) (MateMixerStream *stream,
+ MateMixerStreamSwitch *(*get_switch) (MateMixerStream *stream,
const gchar *name);
const GList *(*list_controls) (MateMixerStream *stream);
@@ -97,7 +97,7 @@ MateMixerDirection mate_mixer_stream_get_direction (MateMixerStream *
MateMixerDevice * mate_mixer_stream_get_device (MateMixerStream *stream);
MateMixerStreamControl *mate_mixer_stream_get_control (MateMixerStream *stream,
const gchar *name);
-MateMixerSwitch * mate_mixer_stream_get_switch (MateMixerStream *stream,
+MateMixerStreamSwitch * mate_mixer_stream_get_switch (MateMixerStream *stream,
const gchar *name);
MateMixerStreamControl *mate_mixer_stream_get_default_control (MateMixerStream *stream);