pidgin.vv: a0c6aa53: Simplify the media menu callbacks.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Jan 30 04:05:37 EST 2009


-----------------------------------------------------------------
Revision: a0c6aa53b880390b36c5ce3fd75ed437a0446a28
Ancestor: 7848b6ac84570c00ecd801a2123b9d6dba760a19
Author: maiku at soc.pidgin.im
Date: 2009-01-30T01:23:35
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/a0c6aa53b880390b36c5ce3fd75ed437a0446a28

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

Simplify the media menu callbacks.

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	5c151dae40ff47e875742381aeea81736470bd0a
+++ pidgin/gtkconv.c	3c5f73f90d1ea356651b1ab0173df32131cf39b0
@@ -1202,15 +1202,20 @@ menu_find_cb(gpointer data, guint action
 }
 
 #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 @@ static GtkItemFactoryEntry menu_items[] 
 #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
 }
 
 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));


More information about the Commits mailing list