pidgin.vv: 76290f7a: Separate PidginMedia from PidginConversa...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Fri Jan 30 04:05:36 EST 2009
-----------------------------------------------------------------
Revision: 76290f7a280d917adb6873ecf15868453f80d73e
Ancestor: a0c6aa53b880390b36c5ce3fd75ed437a0446a28
Author: maiku at soc.pidgin.im
Date: 2009-01-30T04:40:54
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/76290f7a280d917adb6873ecf15868453f80d73e
Modified files:
libpurple/media.c libpurple/protocols/jabber/jabber.c
pidgin/gtkconv.c pidgin/gtkconv.h pidgin/gtkmain.c
pidgin/gtkmedia.c pidgin/gtkmedia.h
ChangeLog:
Separate PidginMedia from PidginConversation.
-------------- next part --------------
============================================================
--- libpurple/media.c 18aa07d3d24a72dcb4670dbfad6127612b52804e
+++ libpurple/media.c 44623d4b75f3579dda7eb7e2e5e51e2467c241fa
@@ -1271,10 +1271,12 @@ purple_media_end(PurpleMedia *media,
purple_media_end(PurpleMedia *media,
const gchar *session_id, const gchar *participant)
{
- if (session_id == NULL && participant == NULL)
+ if (session_id == NULL && participant == NULL) {
g_signal_emit(media, purple_media_signals[STATE_CHANGED],
0, PURPLE_MEDIA_STATE_CHANGED_END,
NULL, NULL);
+ g_object_unref(media);
+ }
}
GList*
============================================================
--- libpurple/protocols/jabber/jabber.c 80cbb4ee0c99b407941df51d7a30f3a2e9f17867
+++ libpurple/protocols/jabber/jabber.c 3b96839f0dda90301d9d21414b48da32c590dd29
@@ -2067,9 +2067,6 @@ void jabber_convo_closed(PurpleConnectio
if(!(jid = jabber_id_new(who)))
return;
-#ifdef USE_VV
- jingle_rtp_terminate_session(js, who);
-#endif
if((jb = jabber_buddy_find(js, who, TRUE)) &&
(jbr = jabber_buddy_find_resource(jb, jid->resource))) {
if(jbr->thread_id) {
============================================================
--- pidgin/gtkconv.c 3c5f73f90d1ea356651b1ab0173df32131cf39b0
+++ pidgin/gtkconv.c d142505dd08c1b156efd693faff433a141e57b35
@@ -48,7 +48,6 @@
#include "idle.h"
#include "imgstore.h"
#include "log.h"
-#include "mediamanager.h"
#include "notify.h"
#include "prpl.h"
#include "request.h"
@@ -63,7 +62,6 @@
#include "gtkimhtml.h"
#include "gtkimhtmltoolbar.h"
#include "gtklog.h"
-#include "gtkmedia.h"
#include "gtkmenutray.h"
#include "gtkpounce.h"
#include "gtkprefs.h"
@@ -4818,10 +4816,7 @@ setup_common_pane(PidginConversation *gt
int buddyicon_size = 0;
/* Setup the top part of the pane */
- gtkconv->tophbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
- gtk_widget_show(gtkconv->tophbox);
vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
- gtk_box_pack_start(GTK_BOX(gtkconv->tophbox), vbox, TRUE, TRUE, 0);
gtk_widget_show(vbox);
/* Setup the info pane */
@@ -4970,7 +4965,7 @@ setup_common_pane(PidginConversation *gt
default_formatize(gtkconv);
g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear",
G_CALLBACK(clear_formatting_cb), gtkconv);
- return gtkconv->tophbox;
+ return vbox;
}
static void
@@ -6450,8 +6445,7 @@ gray_stuff_out(PidginConversation *gtkco
/* check if account support voice calls, and if the current buddy
supports it */
if (account != NULL && purple_conversation_get_type(conv)
- == PURPLE_CONV_TYPE_IM
- && gtkconv->gtkmedia == NULL) {
+ == PURPLE_CONV_TYPE_IM) {
gboolean audio = purple_prpl_can_do_media(account,
purple_conversation_get_name(conv),
PURPLE_MEDIA_AUDIO);
@@ -7753,64 +7747,6 @@ gboolean pidgin_conv_attach_to_conversat
return TRUE;
}
-
-#ifdef USE_VV
-
-static void
-pidgin_gtkmedia_message_cb(PidginMedia *media, const char *msg, PurpleConversation *conv)
-{
- purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
-}
-
-static void
-pidgin_gtkmedia_error_cb(PidginMedia *media, const char *msg, PurpleConversation *conv)
-{
- purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, msg, PURPLE_MESSAGE_ERROR, time(NULL));
-}
-
-static void
-pidgin_conv_gtkmedia_destroyed(GtkWidget *widget, PidginConversation *gtkconv)
-{
- gtk_widget_destroyed(widget, &(gtkconv->gtkmedia));
- pidgin_conv_update_buttons_by_protocol(gtkconv->active_conv);
-}
-
-static gboolean
-pidgin_conv_new_media_cb(PurpleMediaManager *manager, PurpleMedia *media,
- PurpleConnection *gc, gchar *screenname, gpointer nul)
-{
- GtkWidget *gtkmedia;
- PurpleConversation *conv;
- PidginConversation *gtkconv;
-
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
- purple_connection_get_account(gc), screenname);
-
- gtkconv = PIDGIN_CONVERSATION(conv);
-
- if (gtkconv->gtkmedia) {
- purple_debug_info("gtkconv", "Media session exists for this conversation.\n");
- return FALSE;
- }
-
- gtkmedia = pidgin_media_new(media, screenname);
- g_object_unref(media);
-
- gtk_box_pack_start(GTK_BOX(gtkconv->tophbox), gtkmedia, FALSE, FALSE, 0);
- gtk_widget_show(gtkmedia);
- g_signal_connect(G_OBJECT(gtkmedia), "message", G_CALLBACK(pidgin_gtkmedia_message_cb), conv);
- g_signal_connect(G_OBJECT(gtkmedia), "error", G_CALLBACK(pidgin_gtkmedia_error_cb), conv);
-
- gtkconv->gtkmedia = gtkmedia;
- g_signal_connect(G_OBJECT(gtkmedia), "destroy", G_CALLBACK(
- pidgin_conv_gtkmedia_destroyed), gtkconv);
-
- pidgin_conv_update_buttons_by_protocol(conv);
- return TRUE;
-}
-
-#endif
-
void *
pidgin_conversations_get_handle(void)
{
@@ -7911,10 +7847,6 @@ pidgin_conversations_init(void)
show_protocol_icons_pref_cb, NULL);
purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new",
hide_new_pref_cb, NULL);
-#ifdef USE_VV
- g_signal_connect(G_OBJECT(purple_media_manager_get()), "init-media",
- G_CALLBACK(pidgin_conv_new_media_cb), NULL);
-#endif
/**********************************************************************
============================================================
--- pidgin/gtkconv.h 51b68e5d5cd5c87af82ee72cc070977815795f5b
+++ pidgin/gtkconv.h 87813d273d8cdf6d1def152c675db1fce58301c6
@@ -169,8 +169,6 @@ struct _PidginConversation
GtkWidget *infopane;
GtkListStore *infopane_model;
GtkTreeIter infopane_iter;
- GtkWidget *tophbox;
- GtkWidget *gtkmedia;
/* Used when attaching a PidginConversation to a PurpleConversation
* with message history */
============================================================
--- pidgin/gtkmain.c 2668e844ffc992c38cdf4bfc848fb870cd56328c
+++ pidgin/gtkmain.c 0efb4e4e1584295994c281620d74556be2e2996b
@@ -53,6 +53,7 @@
#include "gtkft.h"
#include "gtkidle.h"
#include "gtklog.h"
+#include "gtkmedia.h"
#include "gtknotify.h"
#include "gtkplugin.h"
#include "gtkpounce.h"
@@ -310,6 +311,7 @@ pidgin_ui_init(void)
pidgin_log_init();
pidgin_docklet_init();
pidgin_smileys_init();
+ pidgin_medias_init();
}
static GHashTable *ui_info = NULL;
============================================================
--- pidgin/gtkmedia.c 9e4e4388b60fe21ee73f140a0ea9a4f79f172caa
+++ pidgin/gtkmedia.c 48569fe415614652ed13f93815a41e5a82b440d5
@@ -28,6 +28,7 @@
#include "internal.h"
#include "connection.h"
#include "media.h"
+#include "mediamanager.h"
#include "pidgin.h"
#include "gtkmedia.h"
@@ -71,6 +72,7 @@ struct _PidginMediaPrivate
GtkWidget *recv_widget;
GtkWidget *local_video;
GtkWidget *remote_video;
+ PurpleConnection *pc;
};
#define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate))
@@ -83,16 +85,15 @@ static void pidgin_media_set_state(Pidgi
static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state);
-static GtkHBoxClass *parent_class = NULL;
+static GtkWindowClass *parent_class = NULL;
-
+#if 0
enum {
- MESSAGE,
- ERROR,
LAST_SIGNAL
};
static guint pidgin_media_signals[LAST_SIGNAL] = {0};
+#endif
enum {
PROP_0,
@@ -120,7 +121,7 @@ pidgin_media_get_type(void)
(GInstanceInitFunc) pidgin_media_init,
NULL
};
- type = g_type_register_static(GTK_TYPE_VBOX, "PidginMedia", &info, 0);
+ type = g_type_register_static(GTK_TYPE_WINDOW, "PidginMedia", &info, 0);
}
return type;
}
@@ -163,15 +164,6 @@ pidgin_media_class_init (PidginMediaClas
GST_TYPE_ELEMENT,
G_PARAM_READWRITE));
- pidgin_media_signals[MESSAGE] = g_signal_new("message", G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
- pidgin_media_signals[ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
g_type_class_add_private(klass, sizeof(PidginMediaPrivate));
}
@@ -182,10 +174,24 @@ pidgin_media_mute_toggled(GtkToggleButto
gtk_toggle_button_get_active(toggle));
}
+static gboolean
+pidgin_media_delete_event_cb(GtkWidget *widget,
+ GdkEvent *event, PidginMedia *media)
+{
+ if (media->priv->media)
+ purple_media_hangup(media->priv->media);
+ return FALSE;
+}
+
static void
pidgin_media_init (PidginMedia *media)
{
+ GtkWidget *vbox;
media->priv = PIDGIN_MEDIA_GET_PRIVATE(media);
+
+ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
+ gtk_container_add(GTK_CONTAINER(media), vbox);
+
media->priv->calling = gtk_label_new("Calling...");
media->priv->hangup = gtk_button_new_with_mnemonic("_Hangup");
media->priv->accept = gtk_button_new_with_mnemonic("_Accept");
@@ -195,18 +201,24 @@ pidgin_media_init (PidginMedia *media)
g_signal_connect(media->priv->mute, "toggled",
G_CALLBACK(pidgin_media_mute_toggled), media);
- gtk_box_pack_end(GTK_BOX(media), media->priv->reject, FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(media), media->priv->accept, FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(media), media->priv->hangup, FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(media), media->priv->mute, FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(media), media->priv->calling, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox), media->priv->reject, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox), media->priv->accept, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox), media->priv->hangup, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox), media->priv->mute, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox), media->priv->calling, FALSE, FALSE, 0);
gtk_widget_show_all(media->priv->accept);
gtk_widget_show_all(media->priv->reject);
media->priv->display = gtk_vbox_new(TRUE, PIDGIN_HIG_BOX_SPACE);
- gtk_box_pack_start(GTK_BOX(media), media->priv->display,
+ gtk_box_pack_start(GTK_BOX(vbox), media->priv->display,
TRUE, TRUE, PIDGIN_HIG_BOX_SPACE);
+ gtk_widget_show(vbox);
+
+ g_signal_connect(G_OBJECT(media), "delete-event",
+ G_CALLBACK(pidgin_media_delete_event_cb), media);
+
+ gtk_widget_show(GTK_WIDGET(media));
}
static gboolean
@@ -315,7 +327,12 @@ pidgin_media_emit_message(PidginMedia *g
static void
pidgin_media_emit_message(PidginMedia *gtkmedia, const char *msg)
{
- g_signal_emit(gtkmedia, pidgin_media_signals[MESSAGE], 0, msg);
+ PurpleConversation *conv = purple_find_conversation_with_account(
+ PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname,
+ purple_connection_get_account(gtkmedia->priv->pc));
+ if (conv != NULL)
+ purple_conversation_write(conv, NULL, msg,
+ PURPLE_MESSAGE_SYSTEM, time(NULL));
}
typedef struct
@@ -354,7 +371,12 @@ pidgin_media_error_cb(PidginMedia *media
static void
pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia)
{
- g_signal_emit(gtkmedia, pidgin_media_signals[ERROR], 0, error);
+ PurpleConversation *conv = purple_find_conversation_with_account(
+ PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname,
+ purple_connection_get_account(gtkmedia->priv->pc));
+ if (conv != NULL)
+ purple_conversation_write(conv, NULL, error,
+ PURPLE_MESSAGE_ERROR, time(NULL));
}
static void
@@ -723,4 +745,22 @@ pidgin_media_set_state(PidginMedia *gtkm
}
}
+static gboolean
+pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media,
+ PurpleConnection *pc, gchar *screenname, gpointer nul)
+{
+ PidginMedia *gtkmedia = PIDGIN_MEDIA(
+ pidgin_media_new(media, screenname));
+ gtkmedia->priv->pc = pc;
+
+ return TRUE;
+}
+
+void
+pidgin_medias_init(void)
+{
+ g_signal_connect(G_OBJECT(purple_media_manager_get()), "init-media",
+ G_CALLBACK(pidgin_media_new_cb), NULL);
+}
+
#endif /* USE_VV */
============================================================
--- pidgin/gtkmedia.h 2a37e04664bdb5a4dadc026f2d95b6a8aecc4db9
+++ pidgin/gtkmedia.h a0ce94b6d0b55aed579d31d3925d724d7ae9d643
@@ -48,17 +48,19 @@ struct _PidginMediaClass
struct _PidginMediaClass
{
- GtkHBoxClass parent_class;
+ GtkWindowClass parent_class;
};
struct _PidginMedia
{
- GtkHBox parent;
+ GtkWindow parent;
PidginMediaPrivate *priv;
};
GType pidgin_media_get_type(void);
+void pidgin_medias_init(void);
+
GtkWidget *pidgin_media_new(PurpleMedia *media, const gchar *screenname);
G_END_DECLS
More information about the Commits
mailing list