pidgin.vv: 0d1fd3b7: Remove the screenname attribute from Pur...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Mon Dec 15 21:15:56 EST 2008


-----------------------------------------------------------------
Revision: 0d1fd3b70254200426c628d04e9eaebbb230254f
Ancestor: e2b82dc35cc71671c51ab9fc8140a4d0e4a9abb7
Author: maiku at soc.pidgin.im
Date: 2008-12-16T02:06:55
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/0d1fd3b70254200426c628d04e9eaebbb230254f

Modified files:
        libpurple/media.c libpurple/media.h libpurple/mediamanager.c
        pidgin/gtkconv.c pidgin/gtkmedia.c pidgin/gtkmedia.h

ChangeLog: 

Remove the screenname attribute from PurpleMedia.

-------------- next part --------------
============================================================
--- libpurple/media.c	2e728256716a40be071042891b3d73f44888fced
+++ libpurple/media.c	352193d70fd61649fefed086020fb57ff23c478e
@@ -74,8 +74,6 @@ struct _PurpleMediaPrivate
 {
 	FsConference *conference;
 
-	char *name;
-
 	GHashTable *sessions;	/* PurpleMediaSession table */
 	GHashTable *participants; /* FsParticipant table */
 
@@ -126,7 +124,6 @@ enum {
 enum {
 	PROP_0,
 	PROP_FS_CONFERENCE,
-	PROP_NAME,
 };
 
 GType
@@ -169,13 +166,6 @@ purple_media_class_init (PurpleMediaClas
 			FS_TYPE_CONFERENCE,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 
-	g_object_class_install_property(gobject_class, PROP_NAME,
-			g_param_spec_string("screenname",
-			"Screenname",
-			"The screenname of the remote user",
-			NULL,
-			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
 	purple_media_signals[ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 g_cclosure_marshal_VOID__STRING,
@@ -275,8 +265,6 @@ purple_media_finalize (GObject *media)
 	purple_media_manager_remove_media(purple_media_manager_get(),
 			PURPLE_MEDIA(media));
 
-	g_free(priv->name);
-
 	for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams))
 		purple_media_stream_free(priv->streams->data);
 
@@ -323,10 +311,6 @@ purple_media_set_property (GObject *obje
 			media->priv->conference = g_value_get_object(value);
 			g_object_ref(media->priv->conference);
 			break;
-		case PROP_NAME:
-			g_free(media->priv->name);
-			media->priv->name = g_value_dup_string(value);
-			break;
 		default:	
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 			break;
@@ -345,9 +329,6 @@ purple_media_get_property (GObject *obje
 		case PROP_FS_CONFERENCE:
 			g_value_set_object(value, media->priv->conference);
 			break;
-		case PROP_NAME:
-			g_value_set_string(value, media->priv->name);
-			break;
 		default:	
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);	
 			break;
@@ -725,7 +706,7 @@ purple_media_get_pipeline(PurpleMedia *m
 {
 	if (!media->priv->pipeline) {
 		GstBus *bus;
-		media->priv->pipeline = gst_pipeline_new(media->priv->name);
+		media->priv->pipeline = gst_pipeline_new(NULL);
 		bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
 		gst_bus_add_signal_watch(GST_BUS(bus));
 		g_signal_connect(G_OBJECT(bus), "message",
@@ -739,14 +720,6 @@ purple_media_get_pipeline(PurpleMedia *m
 	return media->priv->pipeline;
 }
 
-char *
-purple_media_get_screenname(PurpleMedia *media)
-{
-	char *ret;
-	g_object_get(G_OBJECT(media), "screenname", &ret, NULL);
-	return ret;
-}
-
 void
 purple_media_error(PurpleMedia *media, const gchar *error, ...)
 {
============================================================
--- libpurple/media.h	43e49a3946de6f54da5c8cfa06d78f4622ad3ac9
+++ libpurple/media.h	fe482bfe9372a3eba8a6092cae59b509a39bf6d7
@@ -214,15 +214,6 @@ GstElement *purple_media_get_pipeline(Pu
 GstElement *purple_media_get_pipeline(PurpleMedia *media);
 
 /**
- * Gets the screenname of the remote user.
- *
- * @param media The media object to retrieve the remote user from.
- *
- * @return The retrieved screenname.
- */
-char *purple_media_get_screenname(PurpleMedia *media);
-
-/**
  * Signals an error in the media session.
  *
  * @param media The media object to set the state on.
============================================================
--- libpurple/mediamanager.c	e138dccca97dc56f9d3d4d448ab1f32c7f9424d0
+++ libpurple/mediamanager.c	6a2f4353b7992e17a93b0257a6b8b38fb2e45bd5
@@ -156,7 +156,6 @@ purple_media_manager_create_media(Purple
 	}
 
 	media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
-			     "screenname", remote_user,
 			     "farsight-conference", conference,
 			     NULL));
 
============================================================
--- pidgin/gtkconv.c	ec421fcf4473b602811067fd09ab9bee087d6ec5
+++ pidgin/gtkconv.c	3c055b742a3ab65512b9d377548fa612cd410bc5
@@ -7831,7 +7831,7 @@ pidgin_conv_new_media_cb(PurpleMediaMana
 		return FALSE;
 	}
 
-	gtkmedia = pidgin_media_new(media);
+	gtkmedia = pidgin_media_new(media, screenname);
 	g_object_unref(media);
 
 	gtk_box_pack_start(GTK_BOX(gtkconv->topvbox), gtkmedia, FALSE, FALSE, 0);
============================================================
--- pidgin/gtkmedia.c	5d8420ac559e9452e7ecc13a66075a30d5288487
+++ pidgin/gtkmedia.c	67c08a6910c349ee060c7d905308c6bf440154a5
@@ -51,6 +51,7 @@ struct _PidginMediaPrivate
 struct _PidginMediaPrivate
 {
 	PurpleMedia *media;
+	gchar *screenname;
 	GstElement *send_level;
 	GstElement *recv_level;
 
@@ -93,6 +94,7 @@ enum {
 enum {
 	PROP_0,
 	PROP_MEDIA,
+	PROP_SCREENNAME,
 	PROP_SEND_LEVEL,
 	PROP_RECV_LEVEL
 };
@@ -138,6 +140,12 @@ pidgin_media_class_init (PidginMediaClas
 			"The PurpleMedia associated with this media.",
 			PURPLE_TYPE_MEDIA,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+	g_object_class_install_property(gobject_class, PROP_SCREENNAME,
+			g_param_spec_string("screenname",
+			"Screenname",
+			"The screenname of the user this session is with.",
+			NULL,
+			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 	g_object_class_install_property(gobject_class, PROP_SEND_LEVEL,
 			g_param_spec_object("send-level",
 			"Send level",
@@ -473,23 +481,20 @@ pidgin_media_got_request_cb(PurpleMedia 
 {
 	PurpleMediaSessionType type = purple_media_get_overall_type(media);
 	gchar *message;
-	gchar *name = purple_media_get_screenname(media);
 
 	if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) {
 		message = g_strdup_printf(_("%s wishes to start an audio/video session with you."),
-					  name);
+					  gtkmedia->priv->screenname);
 	} else if (type & PURPLE_MEDIA_AUDIO) {
 		message = g_strdup_printf(_("%s wishes to start an audio session with you."),
-					  name);
+					  gtkmedia->priv->screenname);
 	} else if (type & PURPLE_MEDIA_VIDEO) {
 		message = g_strdup_printf(_("%s wishes to start a video session with you."),
-					  name);
+					  gtkmedia->priv->screenname);
 	} else {
-		g_free(name);
 		return;
 	}
 
-	g_free(name);
 	pidgin_media_emit_message(gtkmedia, message);
 	g_free(message);
 }
@@ -547,6 +552,11 @@ pidgin_media_set_property (GObject *obje
 			g_signal_connect(G_OBJECT(media->priv->media), "got-accept",
 				G_CALLBACK(pidgin_media_accept_cb), media);
 			break;
+		case PROP_SCREENNAME:
+			if (media->priv->screenname)
+				g_free(media->priv->screenname);
+			media->priv->screenname = g_value_dup_string(value);
+			break;
 		case PROP_SEND_LEVEL:
 			if (media->priv->send_level)
 				gst_object_unref(media->priv->send_level);
@@ -577,6 +587,9 @@ pidgin_media_get_property (GObject *obje
 		case PROP_MEDIA:
 			g_value_set_object(value, media->priv->media);
 			break;
+		case PROP_SCREENNAME:
+			g_value_set_string(value, media->priv->screenname);
+			break;
 		case PROP_SEND_LEVEL:
 			g_value_set_object(value, media->priv->send_level);
 			break;
@@ -590,10 +603,11 @@ GtkWidget *
 }
 
 GtkWidget *
-pidgin_media_new(PurpleMedia *media)
+pidgin_media_new(PurpleMedia *media, const gchar *screenname)
 {
 	PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(),
-					     "media", media, NULL);
+					     "media", media,
+					     "screenname", screenname, NULL);
 	return GTK_WIDGET(gtkmedia);
 }
 
============================================================
--- pidgin/gtkmedia.h	c1e4ba66efda8001b5f97304072a6f51f5765adb
+++ pidgin/gtkmedia.h	2857089ab28c0737d1e4abf550249aec84c00cec
@@ -59,7 +59,7 @@ GType pidgin_media_get_type(void);
 
 GType pidgin_media_get_type(void);
 
-GtkWidget *pidgin_media_new(PurpleMedia *media);
+GtkWidget *pidgin_media_new(PurpleMedia *media, const gchar *screenname);
 GtkWidget *pidgin_media_get_display_widget(GtkWidget *gtkmedia);
 
 G_END_DECLS


More information about the Commits mailing list