Mercurial > pidgin.yaz
changeset 26060:0829a08038c6
Remove the screenname attribute from PurpleMedia.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Tue, 16 Dec 2008 02:06:55 +0000 |
parents | 18b71033ea6e |
children | ee2a2a9dda01 |
files | libpurple/media.c libpurple/media.h libpurple/mediamanager.c pidgin/gtkconv.c pidgin/gtkmedia.c pidgin/gtkmedia.h |
diffstat | 6 files changed, 25 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/media.c Tue Dec 16 01:27:51 2008 +0000 +++ b/libpurple/media.c Tue Dec 16 02:06:55 2008 +0000 @@ -74,8 +74,6 @@ { FsConference *conference; - char *name; - GHashTable *sessions; /* PurpleMediaSession table */ GHashTable *participants; /* FsParticipant table */ @@ -126,7 +124,6 @@ enum { PROP_0, PROP_FS_CONFERENCE, - PROP_NAME, }; GType @@ -169,13 +166,6 @@ 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_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 @@ 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 @@ 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 @@ { 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 @@ 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, ...) {
--- a/libpurple/media.h Tue Dec 16 01:27:51 2008 +0000 +++ b/libpurple/media.h Tue Dec 16 02:06:55 2008 +0000 @@ -214,15 +214,6 @@ 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.
--- a/libpurple/mediamanager.c Tue Dec 16 01:27:51 2008 +0000 +++ b/libpurple/mediamanager.c Tue Dec 16 02:06:55 2008 +0000 @@ -156,7 +156,6 @@ } media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), - "screenname", remote_user, "farsight-conference", conference, NULL));
--- a/pidgin/gtkconv.c Tue Dec 16 01:27:51 2008 +0000 +++ b/pidgin/gtkconv.c Tue Dec 16 02:06:55 2008 +0000 @@ -7831,7 +7831,7 @@ 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);
--- a/pidgin/gtkmedia.c Tue Dec 16 01:27:51 2008 +0000 +++ b/pidgin/gtkmedia.c Tue Dec 16 02:06:55 2008 +0000 @@ -51,6 +51,7 @@ struct _PidginMediaPrivate { PurpleMedia *media; + gchar *screenname; GstElement *send_level; GstElement *recv_level; @@ -93,6 +94,7 @@ enum { PROP_0, PROP_MEDIA, + PROP_SCREENNAME, PROP_SEND_LEVEL, PROP_RECV_LEVEL }; @@ -138,6 +140,12 @@ "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 @@ { 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 @@ 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 @@ 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 * -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); }
--- a/pidgin/gtkmedia.h Tue Dec 16 01:27:51 2008 +0000 +++ b/pidgin/gtkmedia.h Tue Dec 16 02:06:55 2008 +0000 @@ -59,7 +59,7 @@ 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