changeset 26062:2091094745d9

Simplify the media menu callbacks.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Fri, 30 Jan 2009 01:23:35 +0000
parents f6a98b2b8d92
children 685c8f5f85c7
files pidgin/gtkconv.c
diffstat 1 files changed, 16 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Tue Jan 27 22:18:01 2009 +0000
+++ b/pidgin/gtkconv.c	Fri Jan 30 01:23:35 2009 +0000
@@ -1202,15 +1202,20 @@
 }
 
 #ifdef USE_VV
-/* Forward declare this here, because I want to keep VV-related stuff together
-for now */
 static void 
-menu_initiate_audio_call_cb(gpointer data, guint action, GtkWidget *widget);
-static void 
-menu_initiate_video_call_cb(gpointer data, guint action, GtkWidget *widget);
-static void 
-menu_initiate_audio_video_call_cb(gpointer data, guint action, GtkWidget *widget);
-
+menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget)
+{
+	PidginWindow *win = (PidginWindow *)data;
+	PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
+	PurpleAccount *account = purple_conversation_get_account(conv);
+
+	purple_prpl_initiate_media(account,
+			purple_conversation_get_name(conv),
+			action == 0 ? PURPLE_MEDIA_AUDIO :
+			action == 1 ? PURPLE_MEDIA_VIDEO :
+			action == 2 ? PURPLE_MEDIA_AUDIO |
+			PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE);
+}
 #endif
 
 static void
@@ -3126,11 +3131,11 @@
 #ifdef USE_VV
 	{ N_("/Conversation/M_edia"), NULL, NULL, 0, "<Branch>", NULL },
 
-	{ N_("/Conversation/Media/_Audio Call"), NULL, menu_initiate_audio_call_cb, 0,
+	{ N_("/Conversation/Media/_Audio Call"), NULL, menu_initiate_media_call_cb, 0,
 		"<StockItem>", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL },
-	{ N_("/Conversation/Media/_Video Call"), NULL, menu_initiate_video_call_cb, 0,
+	{ N_("/Conversation/Media/_Video Call"), NULL, menu_initiate_media_call_cb, 1,
 		"<StockItem>", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL },
-	{ N_("/Conversation/Media/Audio\\/Video _Call"), NULL, menu_initiate_audio_video_call_cb, 0,
+	{ N_("/Conversation/Media/Audio\\/Video _Call"), NULL, menu_initiate_media_call_cb, 2,
 		"<StockItem>", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL },
 #endif
 
@@ -7764,42 +7769,6 @@
 }
 
 static void
-menu_initiate_audio_call_cb(gpointer data, guint action, GtkWidget *widget)
-{
-	PidginWindow *win = (PidginWindow *)data;
-	PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
-	PurpleAccount *account = purple_conversation_get_account(conv);
-
-	purple_prpl_initiate_media(account,
-			purple_conversation_get_name(conv),
-			PURPLE_MEDIA_AUDIO);
-}
-
-static void
-menu_initiate_video_call_cb(gpointer data, guint action, GtkWidget *widget)
-{
-	PidginWindow *win = (PidginWindow *)data;
-	PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
-	PurpleAccount *account = purple_conversation_get_account(conv);
-
-	purple_prpl_initiate_media(account,
-			purple_conversation_get_name(conv),
-			PURPLE_MEDIA_VIDEO);
-}
-
-static void
-menu_initiate_audio_video_call_cb(gpointer data, guint action, GtkWidget *widget)
-{
-	PidginWindow *win = (PidginWindow *)data;
-	PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
-	PurpleAccount *account = purple_conversation_get_account(conv);
-
-	purple_prpl_initiate_media(account,
-			purple_conversation_get_name(conv),
-			PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO);
-}
-
-static void
 pidgin_conv_gtkmedia_destroyed(GtkWidget *widget, PidginConversation *gtkconv)
 {
 	gtk_widget_destroyed(widget, &(gtkconv->gtkmedia));