pidgin.vv.ticket34: 07cd1af3: Fine tune the media (audio) widget in fi...

sadrul at pidgin.im sadrul at pidgin.im
Sat Mar 22 05:36:25 EDT 2008


-----------------------------------------------------------------
Revision: 07cd1af3a923e3da16f08de8d030449ebf0d0edf
Ancestor: 15b32b8473cc77f98e14f53525b1eebb60c4eb84
Author: sadrul at pidgin.im
Date: 2008-03-22T09:36:22
Branch: im.pidgin.pidgin.vv.ticket34
URL: http://d.pidgin.im/viewmtn/revision/info/07cd1af3a923e3da16f08de8d030449ebf0d0edf

Modified files:
        finch/gntmedia.c

ChangeLog: 

Fine tune the media (audio) widget in finch.

-------------- next part --------------
============================================================
--- finch/gntmedia.c	00688148251fd3a1d6acec510a4eb28e355118a0
+++ finch/gntmedia.c	66bf4e18cac9a0eff3414498eeee5a70638de436
@@ -33,6 +33,7 @@
 #include "gnt.h"
 #include "gntbutton.h"
 #include "gntbox.h"
+#include "gntlabel.h"
 
 #include "cmds.h"
 #include "conversation.h"
@@ -54,6 +55,7 @@ struct _FinchMediaPrivate
 	GntWidget *accept;
 	GntWidget *reject;
 	GntWidget *hangup;
+	GntWidget *calling;
 
 	PurpleConversation *conv;
 };
@@ -148,9 +150,10 @@ finch_media_init (FinchMedia *media)
 {
 	media->priv = FINCH_MEDIA_GET_PRIVATE(media);
 
-	media->priv->hangup = gnt_button_new("Hangup");
-	media->priv->accept = gnt_button_new("Accept");
-	media->priv->reject = gnt_button_new("Reject");
+	media->priv->calling = gnt_label_new(_("Calling ... "));
+	media->priv->hangup = gnt_button_new(_("Hangup"));
+	media->priv->accept = gnt_button_new(_("Accept"));
+	media->priv->reject = gnt_button_new(_("Reject"));
 
 	gnt_box_set_alignment(GNT_BOX(media), GNT_ALIGN_MID);
 
@@ -230,12 +233,17 @@ finch_media_accept_cb(PurpleMedia *media
 
 	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->accept);
 	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->reject);
+	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->hangup);
+	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->calling);
+
 	gnt_box_add_widget(GNT_BOX(gntmedia), gntmedia->priv->hangup);
 
 	gnt_widget_destroy(gntmedia->priv->accept);
 	gnt_widget_destroy(gntmedia->priv->reject);
+	gnt_widget_destroy(gntmedia->priv->calling);
 	gntmedia->priv->accept = NULL;
 	gntmedia->priv->reject = NULL;
+	gntmedia->priv->calling = NULL;
 
 	parent = GNT_WIDGET(gntmedia);
 	while (parent->parent)
@@ -245,6 +253,31 @@ static void
 }
 
 static void
+finch_media_wait_cb(PurpleMedia *media, FinchMedia *gntmedia)
+{
+	GntWidget *parent;
+
+	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->accept);
+	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->reject);
+	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->hangup);
+	gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->calling);
+
+	gnt_box_add_widget(GNT_BOX(gntmedia), gntmedia->priv->calling);
+	gnt_box_add_widget(GNT_BOX(gntmedia), gntmedia->priv->hangup);
+
+	gnt_widget_destroy(gntmedia->priv->accept);
+	gnt_widget_destroy(gntmedia->priv->reject);
+	gntmedia->priv->accept = NULL;
+	gntmedia->priv->reject = NULL;
+
+	parent = GNT_WIDGET(gntmedia);
+	while (parent->parent)
+		parent = parent->parent;
+	gnt_box_readjust(GNT_BOX(parent));
+	gnt_widget_draw(parent);
+}
+
+static void
 finch_media_hangup_cb(PurpleMedia *media, FinchMedia *gntmedia)
 {
 	finch_media_emit_message(gntmedia, _("You have ended the call."));
@@ -292,12 +325,16 @@ finch_media_set_property (GObject *objec
 				G_CALLBACK(finch_media_accept_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media) ,"ready",
 				G_CALLBACK(finch_media_ready_cb), media);
+			g_signal_connect(G_OBJECT(media->priv->media), "wait",
+				G_CALLBACK(finch_media_wait_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media), "hangup",
 				G_CALLBACK(finch_media_hangup_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media), "reject",
 				G_CALLBACK(finch_media_reject_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media), "got-hangup",
 				G_CALLBACK(finch_media_got_hangup_cb), media);
+			g_signal_connect(G_OBJECT(media->priv->media), "got-accept",
+				G_CALLBACK(finch_media_accept_cb), media);
 			break;
 		case PROP_SEND_LEVEL:
 			if (media->priv->send_level)


More information about the Commits mailing list