Don't display the Play button if we're not built with the RTP player.

In tests for whether we're built with the RTP player, test
HAVE_LIBPORTAUDIO first - hopefully we can eventually get rid of the
test for the GTK+ version number.

svn path=/trunk/; revision=19641
This commit is contained in:
Guy Harris 2006-10-20 20:05:27 +00:00
parent df360ddc8c
commit 58bbda182a
2 changed files with 27 additions and 12 deletions

View File

@ -65,11 +65,11 @@
#include "alert_box.h"
#include "simple_dialog.h"
#if GTK_MAJOR_VERSION >= 2
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
#include "rtp_player.h"
#endif /* HAVE_LIBPORTAUDIO */
#endif /* GTK_MAJOR_VERSION >= 2 */
#endif /* HAVE_LIBPORTAUDIO */
const char *voip_call_state_name[7]={
"CALL SETUP",
@ -130,9 +130,9 @@ void voip_calls_reset(voip_calls_tapinfo_t *tapinfo)
GList* list;
GList* list2;
/* reset the RTP player */
#if GTK_MAJOR_VERSION >= 2
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
/* reset the RTP player */
reset_rtp_player();
#endif
#endif

View File

@ -90,7 +90,11 @@ static GtkWidget *label_fwd = NULL;
/*static GtkWidet *bt_unselect = NULL;*/
static GtkWidget *bt_filter = NULL;
static GtkWidget *bt_graph = NULL;
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
static GtkWidget *bt_player = NULL;
#endif
#endif /* HAVE_LIBPORTAUDIO */
static voip_calls_info_t* selected_call_fwd = NULL; /* current selection */
static GList *last_list = NULL;
@ -247,7 +251,11 @@ voip_calls_on_unselect (GtkButton *button _U_,
/*gtk_widget_set_sensitive(bt_unselect, FALSE);*/
gtk_widget_set_sensitive(bt_filter, FALSE);
gtk_widget_set_sensitive(bt_graph, FALSE);
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
gtk_widget_set_sensitive(bt_player, FALSE);
#endif
#endif /* HAVE_LIBPORTAUDIO */
}
@ -411,17 +419,17 @@ on_graph_bt_clicked (GtkButton *button _U_,
graph_analysis_update(graph_analysis_data); /* refresh it */
}
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
/****************************************************************************/
static void
on_player_bt_clicked (GtkButton *button _U_,
gpointer user_data _U_)
{
#if GTK_MAJOR_VERSION >= 2
#ifdef HAVE_LIBPORTAUDIO
rtp_player_init(voip_calls_get_info());
#endif /* HAVE_LIBPORTAUDIO */
#endif
rtp_player_init(voip_calls_get_info());
}
#endif
#endif /* HAVE_LIBPORTAUDIO */
/****************************************************************************/
/* when the user selects a row in the calls list */
@ -472,16 +480,19 @@ voip_calls_on_select_row(GtkCList *clist,
if (calls_ns > 0) {
gtk_widget_set_sensitive(bt_filter, TRUE);
gtk_widget_set_sensitive(bt_graph, TRUE);
gtk_widget_set_sensitive(bt_player, FALSE);
#if GTK_MAJOR_VERSION >= 2
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
gtk_widget_set_sensitive(bt_player, TRUE);
#endif /* HAVE_LIBPORTAUDIO */
#endif
#endif /* HAVE_LIBPORTAUDIO */
} else {
gtk_widget_set_sensitive(bt_filter, FALSE);
gtk_widget_set_sensitive(bt_graph, FALSE);
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
gtk_widget_set_sensitive(bt_player, FALSE);
#endif
#endif /* HAVE_LIBPORTAUDIO */
}
/* TODO: activate other buttons when implemented */
@ -686,11 +697,15 @@ static void voip_calls_dlg_create (void)
SIGNAL_CONNECT(bt_graph, "clicked", on_graph_bt_clicked, NULL);
gtk_tooltips_set_tip (tooltips, bt_graph, "Show a flow graph of the selected calls.", NULL);
#ifdef HAVE_LIBPORTAUDIO
#if GTK_MAJOR_VERSION >= 2
bt_player = gtk_button_new_with_label("Player");
gtk_container_add(GTK_CONTAINER(hbuttonbox), bt_player);
gtk_widget_show(bt_player);
SIGNAL_CONNECT(bt_player, "clicked", on_player_bt_clicked, NULL);
gtk_tooltips_set_tip (tooltips, bt_player, "Launch the RTP player to listen the selected calls.", NULL);
#endif
#endif /* HAVE_LIBPORTAUDIO */
bt_close = BUTTON_NEW_FROM_STOCK(GTK_STOCK_CLOSE);
gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_close);