comparison pidgin/gtkconv.c @ 25632:f5bcb58bdf56

propagate from branch 'im.pidgin.pidgin' (head 16d99d9757384d801e4f13d991cb769a71f9c190) to branch 'im.pidgin.pidgin.vv' (head 6fc5d53de8bd73364b370627020563c614fe6e0a)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 06 Feb 2008 19:44:41 +0000
parents 6d9757319bf6 1ec6a26cfefc
children efaecb71baad
comparison
equal deleted inserted replaced
22270:762174f38807 25632:f5bcb58bdf56
44 #include "cmds.h" 44 #include "cmds.h"
45 #include "debug.h" 45 #include "debug.h"
46 #include "idle.h" 46 #include "idle.h"
47 #include "imgstore.h" 47 #include "imgstore.h"
48 #include "log.h" 48 #include "log.h"
49 #include "mediamanager.h"
49 #include "notify.h" 50 #include "notify.h"
50 #include "prpl.h" 51 #include "prpl.h"
51 #include "request.h" 52 #include "request.h"
52 #include "util.h" 53 #include "util.h"
53 #include "version.h" 54 #include "version.h"
58 #include "gtkconvwin.h" 59 #include "gtkconvwin.h"
59 #include "gtkdialogs.h" 60 #include "gtkdialogs.h"
60 #include "gtkimhtml.h" 61 #include "gtkimhtml.h"
61 #include "gtkimhtmltoolbar.h" 62 #include "gtkimhtmltoolbar.h"
62 #include "gtklog.h" 63 #include "gtklog.h"
64 #include "gtkmedia.h"
63 #include "gtkmenutray.h" 65 #include "gtkmenutray.h"
64 #include "gtkpounce.h" 66 #include "gtkpounce.h"
65 #include "gtkprefs.h" 67 #include "gtkprefs.h"
66 #include "gtkprivacy.h" 68 #include "gtkprivacy.h"
67 #include "gtkthemes.h" 69 #include "gtkthemes.h"
4606 PurpleConversation *conv = gtkconv->active_conv; 4608 PurpleConversation *conv = gtkconv->active_conv;
4607 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); 4609 gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT);
4608 GtkPolicyType imhtml_sw_hscroll; 4610 GtkPolicyType imhtml_sw_hscroll;
4609 4611
4610 /* Setup the top part of the pane */ 4612 /* Setup the top part of the pane */
4611 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); 4613 gtkconv->topvbox = vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
4612 gtk_widget_show(vbox); 4614 gtk_widget_show(vbox);
4613 4615
4614 /* Setup the info pane */ 4616 /* Setup the info pane */
4615 event_box = gtk_event_box_new(); 4617 event_box = gtk_event_box_new();
4616 #if GTK_CHECK_VERSION(2,4,0) 4618 #if GTK_CHECK_VERSION(2,4,0)
7577 } 7579 }
7578 7580
7579 return TRUE; 7581 return TRUE;
7580 } 7582 }
7581 7583
7584 static void
7585 pidgin_gtkmedia_message_cb(PidginMedia *media, const char *msg, PurpleConversation *conv)
7586 {
7587 purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
7588 }
7589
7590 static void
7591 pidgin_conv_new_media_cb(PurpleMediaManager *manager, PurpleMedia *media, gpointer nul)
7592 {
7593 GstElement *sendbin, *src, *sendlevel;
7594 GstElement *recvbin, *sink, *recvlevel;
7595 GstPad *pad, *ghost;
7596
7597 GtkWidget *gtkmedia;
7598 PurpleConversation *conv;
7599 PidginConversation *gtkconv;
7600
7601 sendbin = gst_bin_new("sendbin");
7602 src = gst_element_factory_make("alsasrc", "asrc");
7603 sendlevel = gst_element_factory_make("level", "sendlevel");
7604 gst_bin_add_many(GST_BIN(sendbin), src, sendlevel, NULL);
7605 gst_element_link(src, sendlevel); //, gst_caps_new_simple("audio/x-raw-int", "rate", G_TYPE_INT, 8000, NULL));
7606 pad = gst_element_get_pad(sendlevel, "src");
7607 ghost = gst_ghost_pad_new("ghostsrc", pad);
7608 gst_element_add_pad(sendbin, ghost);
7609 g_object_set(G_OBJECT(sendlevel), "message", TRUE, NULL);
7610
7611 recvbin = gst_bin_new("pidginrecvbin");
7612 sink = gst_element_factory_make("alsasink", "asink");
7613 g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
7614 recvlevel = gst_element_factory_make("level", "recvlevel");
7615 gst_bin_add_many(GST_BIN(recvbin), sink, recvlevel, NULL);
7616 gst_element_link(recvlevel, sink);
7617 pad = gst_element_get_pad(recvlevel, "sink");
7618 ghost = gst_ghost_pad_new("ghostsink", pad);
7619 gst_element_add_pad(recvbin, ghost);
7620 g_object_set(G_OBJECT(recvlevel), "message", TRUE, NULL);
7621
7622 purple_media_set_audio_src(media, sendbin);
7623 purple_media_set_audio_sink(media, recvbin);
7624
7625 gtkmedia = pidgin_media_new(media, sendlevel, recvlevel);
7626 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
7627 purple_connection_get_account(purple_media_get_connection(media)),
7628 purple_media_get_screenname(media));
7629 gtkconv = PIDGIN_CONVERSATION(conv);
7630 gtk_box_pack_start(GTK_BOX(gtkconv->topvbox), gtkmedia, FALSE, FALSE, 0);
7631 gtk_widget_show(gtkmedia);
7632 g_signal_connect_swapped(G_OBJECT(media), "got-hangup", G_CALLBACK(gtk_widget_destroy), gtkmedia);
7633 g_signal_connect(G_OBJECT(gtkmedia), "message", G_CALLBACK(pidgin_gtkmedia_message_cb), conv);
7634 }
7635
7582 void * 7636 void *
7583 pidgin_conversations_get_handle(void) 7637 pidgin_conversations_get_handle(void)
7584 { 7638 {
7585 static int handle; 7639 static int handle;
7586 7640
7673 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/show_protocol_icons", 7727 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/show_protocol_icons",
7674 show_protocol_icons_pref_cb, NULL); 7728 show_protocol_icons_pref_cb, NULL);
7675 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new", 7729 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new",
7676 hide_new_pref_cb, NULL); 7730 hide_new_pref_cb, NULL);
7677 7731
7732 g_signal_connect(G_OBJECT(purple_media_manager_get()), "init-media",
7733 G_CALLBACK(pidgin_conv_new_media_cb), NULL);
7678 7734
7679 7735
7680 /********************************************************************** 7736 /**********************************************************************
7681 * Register signals 7737 * Register signals
7682 **********************************************************************/ 7738 **********************************************************************/