changeset 26203:7738f530a967

Added the connection property back to PurpleMedia.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 25 Feb 2009 01:58:57 +0000
parents dfb6fbd89ac2
children e411aad4346b
files libpurple/media.c libpurple/media.h libpurple/mediamanager.c
diffstat 3 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Tue Feb 24 23:42:38 2009 +0000
+++ b/libpurple/media.c	Wed Feb 25 01:58:57 2009 +0000
@@ -87,6 +87,7 @@
 struct _PurpleMediaPrivate
 {
 	PurpleMediaManager *manager;
+	PurpleConnection *pc;
 	FsConference *conference;
 	gboolean initiator;
 
@@ -135,6 +136,7 @@
 enum {
 	PROP_0,
 	PROP_MANAGER,
+	PROP_CONNECTION,
 	PROP_CONFERENCE,
 	PROP_INITIATOR,
 };
@@ -196,6 +198,12 @@
 			PURPLE_TYPE_MEDIA_MANAGER,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 
+	g_object_class_install_property(gobject_class, PROP_CONNECTION,
+			g_param_spec_pointer("connection",
+			"PurpleConnection",
+			"The connection this media session is on.",
+			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
 	g_object_class_install_property(gobject_class, PROP_CONFERENCE,
 			g_param_spec_object("conference",
 			"Farsight conference",
@@ -407,6 +415,9 @@
 
 			purple_media_setup_pipeline(media);
 			break;
+		case PROP_CONNECTION:
+			media->priv->pc = g_value_get_pointer(value);
+			break;
 		case PROP_CONFERENCE: {
 			if (media->priv->conference)
 				gst_object_unref(media->priv->conference);
@@ -437,6 +448,9 @@
 		case PROP_MANAGER:
 			g_value_set_object(value, media->priv->manager);
 			break;
+		case PROP_CONNECTION:
+			g_value_set_pointer(value, media->priv->pc);
+			break;
 		case PROP_CONFERENCE:
 			g_value_set_object(value, media->priv->conference);
 			break;
@@ -1360,6 +1374,15 @@
 	return purple_media_manager_get_pipeline(media->priv->manager);
 }
 
+PurpleConnection *
+purple_media_get_connection(PurpleMedia *media)
+{
+	PurpleConnection *pc;
+	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
+	g_object_get(G_OBJECT(media), "connection", &pc, NULL);
+	return pc;
+}
+
 void
 purple_media_error(PurpleMedia *media, const gchar *error, ...)
 {
--- a/libpurple/media.h	Tue Feb 24 23:42:38 2009 +0000
+++ b/libpurple/media.h	Wed Feb 25 01:58:57 2009 +0000
@@ -383,6 +383,15 @@
 GstElement *purple_media_get_pipeline(PurpleMedia *media);
 
 /**
+ * Gets the PurpleConnection this media session is on.
+ *
+ * @param media The media session to retrieve the connection from.
+ *
+ * @return The connection retrieved.
+ */
+PurpleConnection *purple_media_get_connection(PurpleMedia *media);
+
+/**
  * Signals an error in the media session.
  *
  * @param media The media object to set the state on.
--- a/libpurple/mediamanager.c	Tue Feb 24 23:42:38 2009 +0000
+++ b/libpurple/mediamanager.c	Wed Feb 25 01:58:57 2009 +0000
@@ -239,6 +239,7 @@
 
 	media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
 			     "manager", manager,
+			     "connection", gc,
 			     "conference", conference,
 			     "initiator", initiator,
 			     NULL));