/soc/2013/ankitkv/gobjectification: cadfc3f9a7cc: jabber: use g_...
Ankit Vani
a at nevitus.org
Tue Nov 19 16:42:34 EST 2013
Changeset: cadfc3f9a7ccc9707cca0ea43c2040763eeb46f5
Author: Ankit Vani <a at nevitus.org>
Date: 2013-11-20 03:12 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/cadfc3f9a7cc
Description:
jabber: use g_object_notify_by_pspec instead of g_object_notify
diffstat:
libpurple/protocols/jabber/google/google_p2p.c | 27 +++++---
libpurple/protocols/jabber/jingle/content.c | 62 ++++++++++++---------
libpurple/protocols/jabber/jingle/iceudp.c | 27 +++++---
libpurple/protocols/jabber/jingle/rawudp.c | 27 +++++---
libpurple/protocols/jabber/jingle/rtp.c | 27 ++++++---
libpurple/protocols/jabber/jingle/session.c | 73 ++++++++++++++-----------
6 files changed, 143 insertions(+), 100 deletions(-)
diffs (truncated from 634 to 300 lines):
diff --git a/libpurple/protocols/jabber/google/google_p2p.c b/libpurple/protocols/jabber/google/google_p2p.c
--- a/libpurple/protocols/jabber/google/google_p2p.c
+++ b/libpurple/protocols/jabber/google/google_p2p.c
@@ -23,6 +23,7 @@
*/
#include "internal.h"
+#include "glibcompat.h"
#include "google_p2p.h"
#include "jingle/jingle.h"
@@ -48,14 +49,16 @@ static PurpleXmlNode *jingle_google_p2p_
static void jingle_google_p2p_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate);
static GList *jingle_google_p2p_get_remote_candidates(JingleTransport *transport);
-static JingleTransportClass *parent_class = NULL;
-
enum {
PROP_0,
PROP_LOCAL_CANDIDATES,
PROP_REMOTE_CANDIDATES,
+ PROP_LAST
};
+static JingleTransportClass *parent_class = NULL;
+static GParamSpec *properties[PROP_LAST];
+
static JingleGoogleP2PCandidate *
jingle_google_p2p_candidate_copy(JingleGoogleP2PCandidate *candidate)
{
@@ -158,17 +161,19 @@ jingle_google_p2p_class_init(JingleGoogl
klass->parent_class.add_local_candidate = jingle_google_p2p_add_local_candidate;
klass->parent_class.get_remote_candidates = jingle_google_p2p_get_remote_candidates;
- g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
- g_param_spec_pointer("local-candidates",
+ properties[PROP_LOCAL_CANDIDATES] = g_param_spec_pointer("local-candidates",
"Local candidates",
"The local candidates for this transport.",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
+ properties[PROP_LOCAL_CANDIDATES]);
- g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
- g_param_spec_pointer("remote-candidates",
+ properties[PROP_REMOTE_CANDIDATES] = g_param_spec_pointer("remote-candidates",
"Remote candidates",
"The remote candidates for this transport.",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
+ properties[PROP_REMOTE_CANDIDATES]);
g_type_class_add_private(klass, sizeof(JingleGoogleP2PPrivate));
}
@@ -284,7 +289,7 @@ jingle_google_p2p_add_local_candidate(Ji
google_p2p->priv->local_candidates = g_list_append(
google_p2p->priv->local_candidates, candidate);
- g_object_notify(G_OBJECT(google_p2p), "local-candidates");
+ g_object_notify_by_pspec(G_OBJECT(google_p2p), properties[PROP_LOCAL_CANDIDATES]);
return;
}
@@ -293,7 +298,7 @@ jingle_google_p2p_add_local_candidate(Ji
google_p2p->priv->local_candidates = g_list_append(
google_p2p->priv->local_candidates, google_p2p_candidate);
- g_object_notify(G_OBJECT(google_p2p), "local-candidates");
+ g_object_notify_by_pspec(G_OBJECT(google_p2p), properties[PROP_LOCAL_CANDIDATES]);
}
static GList *
@@ -357,7 +362,7 @@ jingle_google_p2p_add_remote_candidate(J
}
priv->remote_candidates = g_list_append(priv->remote_candidates, candidate);
- g_object_notify(G_OBJECT(google_p2p), "remote-candidates");
+ g_object_notify_by_pspec(G_OBJECT(google_p2p), properties[PROP_REMOTE_CANDIDATES]);
}
static JingleTransport *
diff --git a/libpurple/protocols/jabber/jingle/content.c b/libpurple/protocols/jabber/jingle/content.c
--- a/libpurple/protocols/jabber/jingle/content.c
+++ b/libpurple/protocols/jabber/jingle/content.c
@@ -23,6 +23,7 @@
*/
#include "internal.h"
+#include "glibcompat.h"
#include "debug.h"
#include "content.h"
@@ -52,8 +53,6 @@ static void jingle_content_set_property
static PurpleXmlNode *jingle_content_to_xml_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action);
static JingleContent *jingle_content_parse_internal(PurpleXmlNode *content);
-static GObjectClass *parent_class = NULL;
-
enum {
PROP_0,
PROP_SESSION,
@@ -63,8 +62,12 @@ enum {
PROP_SENDERS,
PROP_TRANSPORT,
PROP_PENDING_TRANSPORT,
+ PROP_LAST
};
+static GObjectClass *parent_class = NULL;
+static GParamSpec *properties[PROP_LAST];
+
GType
jingle_content_get_type()
{
@@ -100,54 +103,61 @@ jingle_content_class_init (JingleContent
klass->to_xml = jingle_content_to_xml_internal;
klass->parse = jingle_content_parse_internal;
- g_object_class_install_property(gobject_class, PROP_SESSION,
- g_param_spec_object("session",
+ properties[PROP_SESSION] = g_param_spec_object("session",
"Jingle Session",
"The jingle session parent of this content.",
JINGLE_TYPE_SESSION,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_SESSION,
+ properties[PROP_SESSION]);
- g_object_class_install_property(gobject_class, PROP_CREATOR,
- g_param_spec_string("creator",
+ properties[PROP_CREATOR] = g_param_spec_string("creator",
"Creator",
"The participant that created this content.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_CREATOR,
+ properties[PROP_CREATOR]);
- g_object_class_install_property(gobject_class, PROP_DISPOSITION,
- g_param_spec_string("disposition",
+ properties[PROP_DISPOSITION] = g_param_spec_string("disposition",
"Disposition",
"The disposition of the content.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_DISPOSITION,
+ properties[PROP_DISPOSITION]);
- g_object_class_install_property(gobject_class, PROP_NAME,
- g_param_spec_string("name",
+ properties[PROP_NAME] = g_param_spec_string("name",
"Name",
"The name of this content.",
NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_NAME,
+ properties[PROP_NAME]);
- g_object_class_install_property(gobject_class, PROP_SENDERS,
- g_param_spec_string("senders",
+ properties[PROP_SENDERS] = g_param_spec_string("senders",
"Senders",
"The sender of this content.",
NULL,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_SENDERS,
+ properties[PROP_SENDERS]);
- g_object_class_install_property(gobject_class, PROP_TRANSPORT,
- g_param_spec_object("transport",
+ properties[PROP_TRANSPORT] = g_param_spec_object("transport",
"transport",
"The transport of this content.",
JINGLE_TYPE_TRANSPORT,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_TRANSPORT,
+ properties[PROP_TRANSPORT]);
- g_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT,
- g_param_spec_object("pending-transport",
+ properties[PROP_PENDING_TRANSPORT] = g_param_spec_object("pending-transport",
"Pending transport",
"The pending transport contained within this content",
JINGLE_TYPE_TRANSPORT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT,
+ properties[PROP_PENDING_TRANSPORT]);
g_type_class_add_private(klass, sizeof(JingleContentPrivate));
}
@@ -366,8 +376,8 @@ jingle_content_accept_transport(JingleCo
obj = G_OBJECT(content);
g_object_freeze_notify(obj);
- g_object_notify(obj, "transport");
- g_object_notify(obj, "pending-transport");
+ g_object_notify_by_pspec(obj, properties[PROP_TRANSPORT]);
+ g_object_notify_by_pspec(obj, properties[PROP_PENDING_TRANSPORT]);
g_object_thaw_notify(obj);
}
@@ -379,7 +389,7 @@ jingle_content_remove_pending_transport(
content->priv->pending_transport = NULL;
}
- g_object_notify(G_OBJECT(content), "pending-transport");
+ g_object_notify_by_pspec(G_OBJECT(content), properties[PROP_PENDING_TRANSPORT]);
}
void
diff --git a/libpurple/protocols/jabber/jingle/iceudp.c b/libpurple/protocols/jabber/jingle/iceudp.c
--- a/libpurple/protocols/jabber/jingle/iceudp.c
+++ b/libpurple/protocols/jabber/jingle/iceudp.c
@@ -23,6 +23,7 @@
*/
#include "internal.h"
+#include "glibcompat.h"
#include "iceudp.h"
#include "jingle.h"
@@ -48,14 +49,16 @@ static PurpleXmlNode *jingle_iceudp_to_x
static void jingle_iceudp_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate);
static GList *jingle_iceudp_get_remote_candidates(JingleTransport *transport);
-static JingleTransportClass *parent_class = NULL;
-
enum {
PROP_0,
PROP_LOCAL_CANDIDATES,
PROP_REMOTE_CANDIDATES,
+ PROP_LAST
};
+static JingleTransportClass *parent_class = NULL;
+static GParamSpec *properties[PROP_LAST];
+
static JingleIceUdpCandidate *
jingle_iceudp_candidate_copy(JingleIceUdpCandidate *candidate)
{
@@ -171,17 +174,19 @@ jingle_iceudp_class_init (JingleIceUdpCl
klass->parent_class.add_local_candidate = jingle_iceudp_add_local_candidate;
klass->parent_class.get_remote_candidates = jingle_iceudp_get_remote_candidates;
- g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
- g_param_spec_pointer("local-candidates",
+ properties[PROP_LOCAL_CANDIDATES] = g_param_spec_pointer("local-candidates",
"Local candidates",
"The local candidates for this transport.",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES,
+ properties[PROP_LOCAL_CANDIDATES]);
- g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
- g_param_spec_pointer("remote-candidates",
+ properties[PROP_REMOTE_CANDIDATES] = g_param_spec_pointer("remote-candidates",
"Remote candidates",
"The remote candidates for this transport.",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES,
+ properties[PROP_REMOTE_CANDIDATES]);
g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate));
}
@@ -299,7 +304,7 @@ jingle_iceudp_add_local_candidate(Jingle
iceudp->priv->local_candidates = g_list_append(
iceudp->priv->local_candidates, iceudp_candidate);
- g_object_notify(G_OBJECT(iceudp), "local-candidates");
+ g_object_notify_by_pspec(G_OBJECT(iceudp), properties[PROP_LOCAL_CANDIDATES]);
return;
}
@@ -308,7 +313,7 @@ jingle_iceudp_add_local_candidate(Jingle
iceudp->priv->local_candidates = g_list_append(
iceudp->priv->local_candidates, iceudp_candidate);
- g_object_notify(G_OBJECT(iceudp), "local-candidates");
+ g_object_notify_by_pspec(G_OBJECT(iceudp), properties[PROP_LOCAL_CANDIDATES]);
}
static GList *
@@ -373,7 +378,7 @@ jingle_iceudp_add_remote_candidate(Jingl
}
priv->remote_candidates = g_list_append(priv->remote_candidates, candidate);
- g_object_notify(G_OBJECT(iceudp), "remote-candidates");
+ g_object_notify_by_pspec(G_OBJECT(iceudp), properties[PROP_REMOTE_CANDIDATES]);
}
More information about the Commits
mailing list