/soc/2013/ankitkv/gobjectification: 8ac1510a27ae: media: Use G_P...
Ankit Vani
a at nevitus.org
Sat Nov 16 17:54:33 EST 2013
Changeset: 8ac1510a27ae1b1d624ab3f0767a4352f8244014
Author: Ankit Vani <a at nevitus.org>
Date: 2013-11-17 04:17 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/8ac1510a27ae
Description:
media: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
diffstat:
libpurple/media.c | 16 ++++++++++------
libpurple/media/backend-iface.c | 6 ++++--
libpurple/media/candidate.c | 24 ++++++++++++------------
libpurple/media/codec.c | 19 +++++++++++++------
libpurple/mediamanager.c | 12 ++++++++----
5 files changed, 47 insertions(+), 30 deletions(-)
diffs (290 lines):
diff --git a/libpurple/media.c b/libpurple/media.c
--- a/libpurple/media.c
+++ b/libpurple/media.c
@@ -184,7 +184,8 @@ purple_media_class_init (PurpleMediaClas
"Purple Media Manager",
"The media manager that contains this media session.",
PURPLE_TYPE_MEDIA_MANAGER,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
/*
* This one should be PURPLE_TYPE_MEDIA_BACKEND, but it doesn't
@@ -195,12 +196,13 @@ purple_media_class_init (PurpleMediaClas
"Purple Media Backend",
"The backend object this media object uses.",
G_TYPE_OBJECT,
- G_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_ACCOUNT,
g_param_spec_pointer("account", "PurpleAccount",
"The account this media session is on.",
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_CONFERENCE_TYPE,
g_param_spec_string("conference-type",
@@ -208,20 +210,22 @@ purple_media_class_init (PurpleMediaClas
"The type of conference that this media object "
"has been created to provide.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_INITIATOR,
g_param_spec_boolean("initiator",
"initiator",
"If the local user initiated the conference.",
FALSE,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_PRPL_DATA,
g_param_spec_pointer("prpl-data",
"gpointer",
"Data the prpl plugin set on the media session.",
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
purple_media_signals[S_ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
diff --git a/libpurple/media/backend-iface.c b/libpurple/media/backend-iface.c
--- a/libpurple/media/backend-iface.c
+++ b/libpurple/media/backend-iface.c
@@ -53,13 +53,15 @@ purple_media_backend_base_init(gpointer
"The type of conference that this backend "
"has been created to provide.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_interface_install_property(iface,
g_param_spec_object("media",
"Purple Media",
"The media object that this backend is bound to.",
PURPLE_TYPE_MEDIA,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
purple_media_backend_signals[S_ERROR] =
g_signal_new("error", G_TYPE_FROM_CLASS(iface),
diff --git a/libpurple/media/candidate.c b/libpurple/media/candidate.c
--- a/libpurple/media/candidate.c
+++ b/libpurple/media/candidate.c
@@ -237,42 +237,42 @@ purple_media_candidate_class_init(Purple
"Foundation",
"The foundation of the candidate.",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_COMPONENT_ID,
g_param_spec_uint("component-id",
"Component ID",
"The component id of the candidate.",
0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_IP,
g_param_spec_string("ip",
"IP Address",
"The IP address of the candidate.",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_PORT,
g_param_spec_uint("port",
"Port",
"The port of the candidate.",
0, G_MAXUINT16, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_BASE_IP,
g_param_spec_string("base-ip",
"Base IP",
"The internal IP address of the candidate.",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_BASE_PORT,
g_param_spec_uint("base-port",
"Base Port",
"The internal port of the candidate.",
0, G_MAXUINT16, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_PROTOCOL,
g_param_spec_enum("protocol",
@@ -280,14 +280,14 @@ purple_media_candidate_class_init(Purple
"The protocol of the candidate.",
PURPLE_TYPE_MEDIA_NETWORK_PROTOCOL,
PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_PRIORITY,
g_param_spec_uint("priority",
"Priority",
"The priority of the candidate.",
0, G_MAXUINT32, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_TYPE,
g_param_spec_enum("type",
@@ -295,28 +295,28 @@ purple_media_candidate_class_init(Purple
"The type of the candidate.",
PURPLE_TYPE_MEDIA_CANDIDATE_TYPE,
PURPLE_MEDIA_CANDIDATE_TYPE_HOST,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_USERNAME,
g_param_spec_string("username",
"Username",
"The username used to connect to the candidate.",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_PASSWORD,
g_param_spec_string("password",
"Password",
"The password use to connect to the candidate.",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_TTL,
g_param_spec_uint("ttl",
"TTL",
"The TTL of the candidate.",
0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private(klass, sizeof(PurpleMediaCandidatePrivate));
}
diff --git a/libpurple/media/codec.c b/libpurple/media/codec.c
--- a/libpurple/media/codec.c
+++ b/libpurple/media/codec.c
@@ -176,14 +176,16 @@ purple_media_codec_class_init(PurpleMedi
"ID",
"The numeric identifier of the codec.",
0, G_MAXUINT, 0,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_ENCODING_NAME,
g_param_spec_string("encoding-name",
"Encoding Name",
"The name of the codec.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE,
g_param_spec_flags("media-type",
@@ -191,26 +193,27 @@ purple_media_codec_class_init(PurpleMedi
"Whether this is an audio of video codec.",
PURPLE_TYPE_MEDIA_SESSION_TYPE,
PURPLE_MEDIA_NONE,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_CLOCK_RATE,
g_param_spec_uint("clock-rate",
"Create Callback",
"The function called to create this element.",
0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_CHANNELS,
g_param_spec_uint("channels",
"Channels",
"The number of channels in this codec.",
0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_OPTIONAL_PARAMS,
g_param_spec_pointer("optional-params",
"Optional Params",
"A list of optional parameters for the codec.",
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private(klass, sizeof(PurpleMediaCodecPrivate));
}
@@ -290,6 +293,8 @@ purple_media_codec_add_optional_paramete
new_param->value = g_strdup(value);
priv->optional_params = g_list_append(
priv->optional_params, new_param);
+
+ g_object_notify(G_OBJECT(codec), "optional-params");
}
void
@@ -308,6 +313,8 @@ purple_media_codec_remove_optional_param
priv->optional_params =
g_list_remove(priv->optional_params, param);
g_free(param);
+
+ g_object_notify(G_OBJECT(codec), "optional-params");
}
PurpleKeyValuePair *
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -1204,14 +1204,16 @@ purple_media_element_info_class_init(Pur
"ID",
"The unique identifier of the element.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_NAME,
g_param_spec_string("name",
"Name",
"The friendly/display name of this element.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_TYPE,
g_param_spec_flags("type",
@@ -1219,13 +1221,15 @@ purple_media_element_info_class_init(Pur
"The type of element this is.",
PURPLE_TYPE_MEDIA_ELEMENT_TYPE,
PURPLE_MEDIA_ELEMENT_NONE,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(gobject_class, PROP_CREATE_CB,
g_param_spec_pointer("create-cb",
"Create Callback",
"The function called to create this element.",
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
g_type_class_add_private(klass, sizeof(PurpleMediaElementInfoPrivate));
}
More information about the Commits
mailing list