settings: Add GSetting for preferred audio codecs
This commit is contained in:
@@ -20,5 +20,11 @@
|
|||||||
<description>These plugins will be automatically loaded on application startup.</description>
|
<description>These plugins will be automatically loaded on application startup.</description>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
<key name="preferred-audio-codecs" type="as">
|
||||||
|
<default>["PCMA", "PCMU", "GSM", "G722"]</default>
|
||||||
|
<summary>Audio codecs to use for VoIP calls in order of preference</summary>
|
||||||
|
<description>The preferred audio codecs to use for VoIP calls (if available)</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
</schema>
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
@@ -41,6 +41,7 @@ enum {
|
|||||||
PROP_AUTO_USE_DEFAULT_ORIGINS,
|
PROP_AUTO_USE_DEFAULT_ORIGINS,
|
||||||
PROP_COUNTRY_CODE,
|
PROP_COUNTRY_CODE,
|
||||||
PROP_AUTOLOAD_PLUGINS,
|
PROP_AUTOLOAD_PLUGINS,
|
||||||
|
PROP_PREFERRED_AUDIO_CODECS,
|
||||||
PROP_LAST_PROP
|
PROP_LAST_PROP
|
||||||
};
|
};
|
||||||
static GParamSpec *props[PROP_LAST_PROP];
|
static GParamSpec *props[PROP_LAST_PROP];
|
||||||
@@ -75,6 +76,10 @@ calls_settings_set_property (GObject *object,
|
|||||||
calls_settings_set_autoload_plugins (self, g_value_get_boxed (value));
|
calls_settings_set_autoload_plugins (self, g_value_get_boxed (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PREFERRED_AUDIO_CODECS:
|
||||||
|
calls_settings_set_preferred_audio_codecs (self, g_value_get_boxed (value));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -103,6 +108,10 @@ calls_settings_get_property (GObject *object,
|
|||||||
g_value_set_boxed (value, calls_settings_get_autoload_plugins (self));
|
g_value_set_boxed (value, calls_settings_get_autoload_plugins (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PREFERRED_AUDIO_CODECS:
|
||||||
|
g_value_set_boxed (value, calls_settings_get_preferred_audio_codecs (self));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -123,6 +132,8 @@ calls_settings_constructed (GObject *object)
|
|||||||
self, "country-code", G_SETTINGS_BIND_DEFAULT);
|
self, "country-code", G_SETTINGS_BIND_DEFAULT);
|
||||||
g_settings_bind (self->settings, "autoload-plugins",
|
g_settings_bind (self->settings, "autoload-plugins",
|
||||||
self, "autoload-plugins", G_SETTINGS_BIND_DEFAULT);
|
self, "autoload-plugins", G_SETTINGS_BIND_DEFAULT);
|
||||||
|
g_settings_bind (self->settings, "preferred-audio-codecs",
|
||||||
|
self, "preferred-audio-codecs", G_SETTINGS_BIND_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -167,6 +178,13 @@ calls_settings_class_init (CallsSettingsClass *klass)
|
|||||||
G_TYPE_STRV,
|
G_TYPE_STRV,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
props[PROP_PREFERRED_AUDIO_CODECS] =
|
||||||
|
g_param_spec_boxed ("preferred-audio-codecs",
|
||||||
|
"Preferred audio codecs",
|
||||||
|
"The audio codecs to prefer for VoIP calls",
|
||||||
|
G_TYPE_STRV,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,3 +301,35 @@ calls_settings_set_autoload_plugins (CallsSettings *self,
|
|||||||
|
|
||||||
g_settings_set_strv (G_SETTINGS (self->settings), "autoload-plugins", plugins);
|
g_settings_set_strv (G_SETTINGS (self->settings), "autoload-plugins", plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* calls_settings_get_preferred_audio_codecs:
|
||||||
|
* @self: A #CallsSettings
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): List of preferred audio codecs for VoIP calls.
|
||||||
|
* Free with g_strfreev() when done.
|
||||||
|
*/
|
||||||
|
char **
|
||||||
|
calls_settings_get_preferred_audio_codecs (CallsSettings *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CALLS_IS_SETTINGS (self), NULL);
|
||||||
|
|
||||||
|
return g_settings_get_strv (self->settings, "preferred-audio-codecs");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* calls_settings_set_preferred_audio_codecs:
|
||||||
|
* @self: A #CallsSettings
|
||||||
|
* @codecs: (nullable) (array zero-terminated=1): The preferred codecs
|
||||||
|
*
|
||||||
|
* Set the preferred audio codecs for VoIP calls.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
calls_settings_set_preferred_audio_codecs (CallsSettings *self,
|
||||||
|
const char * const *codecs)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CALLS_IS_SETTINGS (self));
|
||||||
|
|
||||||
|
g_settings_set_strv (self->settings, "preferred-audio-codecs", codecs);
|
||||||
|
}
|
||||||
|
@@ -42,6 +42,9 @@ void calls_settings_set_country_code (CallsSettings
|
|||||||
char **calls_settings_get_autoload_plugins (CallsSettings *self);
|
char **calls_settings_get_autoload_plugins (CallsSettings *self);
|
||||||
void calls_settings_set_autoload_plugins (CallsSettings *self,
|
void calls_settings_set_autoload_plugins (CallsSettings *self,
|
||||||
const char * const *plugins);
|
const char * const *plugins);
|
||||||
|
char **calls_settings_get_preferred_audio_codecs (CallsSettings *self);
|
||||||
|
void calls_settings_set_preferred_audio_codecs (CallsSettings *self,
|
||||||
|
const char * const *codecs);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user