summaryrefslogtreecommitdiff
path: root/sys/sunaudio
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2007-03-09 19:44:30 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-03-09 19:44:30 +0000
commitc3e99dd86c97c58019571fa012c85f40fda8a80f (patch)
tree33ad746a89bdf5437b21be5a5475768a76234ae0 /sys/sunaudio
parentd44570cfdd842176ae0168a50171d3c1232e9d0d (diff)
sys/sunaudio/: Actually translate sunaudio mixer track labels instead of just marking the strings as translatable (#3...
Original commit message from CVS: * sys/sunaudio/gstsunaudio.c: (plugin_init): * sys/sunaudio/gstsunaudiomixertrack.c: (gst_sunaudiomixer_track_new): Actually translate sunaudio mixer track labels instead of just marking the strings as translatable (#377306); clean up weird label string mapping code that serves no apparent purpose. Also set the 'untranslated-label' property when creating mixer tracks if the GstMixerTrack base class supports this. * tests/check/Makefile.am: * tests/check/elements/.cvsignore: * tests/check/elements/sunaudio.c: (GST_START_TEST), (sunaudio_suite): Very minimalistic unit test for sunaudiomixer element (compiles, but not actually tested on a system where sunaudiomixer is available).
Diffstat (limited to 'sys/sunaudio')
-rw-r--r--sys/sunaudio/gstsunaudio.c1
-rw-r--r--sys/sunaudio/gstsunaudiomixertrack.c51
2 files changed, 20 insertions, 32 deletions
diff --git a/sys/sunaudio/gstsunaudio.c b/sys/sunaudio/gstsunaudio.c
index bdf33716c..b06bf1529 100644
--- a/sys/sunaudio/gstsunaudio.c
+++ b/sys/sunaudio/gstsunaudio.c
@@ -49,6 +49,7 @@ plugin_init (GstPlugin * plugin)
#ifdef ENABLE_NLS
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
return TRUE;
diff --git a/sys/sunaudio/gstsunaudiomixertrack.c b/sys/sunaudio/gstsunaudiomixertrack.c
index 87883ae91..e108695f9 100644
--- a/sys/sunaudio/gstsunaudiomixertrack.c
+++ b/sys/sunaudio/gstsunaudiomixertrack.c
@@ -57,48 +57,35 @@ gst_sunaudiomixer_track_init (GstSunAudioMixerTrack * track)
track->track_num = 0;
}
-static const gchar **labels = NULL;
-
-static void
-fill_labels (void)
-{
- int i;
- struct
- {
- gchar *given, *wanted;
- }
- cases[] = {
- {
- "Vol ", N_("Volume")}
- , {
- "Gain ", N_("Gain")}
- , {
- "Mon ", N_("Monitor")}
- , {
- NULL, NULL}
- };
-
- labels = g_malloc (sizeof (gchar *) * MIXER_DEVICES);
-
- for (i = 0; i < MIXER_DEVICES; i++) {
- labels[i] = g_strdup (cases[i].wanted);
- }
-}
-
GstMixerTrack *
gst_sunaudiomixer_track_new (GstSunAudioTrackType track_num,
gint max_chans, gint flags)
{
+ const gchar *labels[] = { N_("Volume"), N_("Gain"), N_("Monitor") };
+
GstSunAudioMixerTrack *sunaudiotrack;
GstMixerTrack *track;
+ GObjectClass *klass;
+ const gchar *untranslated_label;
gint volume;
- if (!labels)
- fill_labels ();
+ if ((guint) track_num < G_N_ELEMENTS (labels))
+ untranslated_label = labels[track_num];
+ else
+ untranslated_label = NULL;
+
+ /* FIXME: remove this check once we depend on -base >= 0.10.12.1 */
+ klass = G_OBJECT_CLASS (g_type_class_ref (GST_TYPE_SUNAUDIO_MIXER_TRACK));
+ if (g_object_class_find_property (klass, "untranslated-label")) {
+ sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIO_MIXER_TRACK,
+ "untranslated-label", untranslated_label, NULL);
+ } else {
+ sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIO_MIXER_TRACK, NULL);
+ }
+ g_type_class_unref (klass);
- sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIO_MIXER_TRACK, NULL);
track = GST_MIXER_TRACK (sunaudiotrack);
- track->label = g_strdup (labels[track_num]);
+ track->label = g_strdup (_(untranslated_label));
track->num_channels = max_chans;
track->flags = flags;
track->min_volume = 0;