* intf_gnome.c: Gnome interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gnome.c,v 1.33 2001/04/29 02:48:51 stef Exp $
+ * $Id: intf_gnome.c,v 1.34 2001/05/01 04:18:18 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
gint i_cat,
void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{
+#define GNOME_LANGUAGE_MENU_SIZE 64
intf_thread_t * p_intf;
GtkWidget * p_menu;
GtkWidget * p_separator;
GtkWidget * p_item;
GtkWidget * p_item_active;
GSList * p_group;
- char psz_name[12];
+ char psz_name[ GNOME_LANGUAGE_MENU_SIZE ];
gint i_item;
gint i;
p_menu = gtk_menu_new();
/* special case for "off" item */
- sprintf( psz_name, "Off" );
+ snprintf( psz_name, GNOME_LANGUAGE_MENU_SIZE, "Off" );
+ psz_name[ GNOME_LANGUAGE_MENU_SIZE - 1 ] = '\0';
p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
strcpy( psz_name, p_intf->p_input->stream.pp_es[i]->psz_desc );
if( psz_name[0] == '\0' )
{
- sprintf( psz_name, "Language %d", i_item );
+ snprintf( psz_name, GNOME_LANGUAGE_MENU_SIZE,
+ "Language %d", i_item );
+ psz_name[ GNOME_LANGUAGE_MENU_SIZE - 1 ] = '\0';
}
p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
static gint GnomeAngleMenu( gpointer p_data, GtkWidget * p_angle,
void(*pf_toggle)( GtkCheckMenuItem *, gpointer ) )
{
+#define GNOME_ANGLE_MENU_SIZE 64
intf_thread_t * p_intf;
- char psz_name[12];
+ char psz_name[ GNOME_ANGLE_MENU_SIZE ];
GtkWidget * p_angle_menu;
GSList * p_angle_group;
GtkWidget * p_item;
i_angle < p_intf->p_input->stream.p_selected_area->i_angle_nb ;
i_angle++ )
{
- sprintf( psz_name, "Angle %d", i_angle + 1 );
+ snprintf( psz_name, GNOME_ANGLE_MENU_SIZE, "Angle %d", i_angle + 1 );
+ psz_name[ GNOME_ANGLE_MENU_SIZE - 1 ] = '\0';
p_item = gtk_radio_menu_item_new_with_label( p_angle_group,
psz_name );
gtk_menu_append( GTK_MENU( p_chapter_menu ), p_menu_item );
}
- sprintf( psz_name, "%d - %d", i_chapter + 1, i_chapter + 10);
+ snprintf( psz_name, GNOME_ANGLE_MENU_SIZE,
+ "%d - %d", i_chapter + 1, i_chapter + 10);
+ psz_name[ GNOME_ANGLE_MENU_SIZE - 1 ] = '\0';
p_menu_item = gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_menu_item );
p_chapter_submenu = gtk_menu_new();
}
- sprintf( psz_name, "Chapter %d", i_chapter + 1 );
+ snprintf( psz_name, GNOME_ANGLE_MENU_SIZE,
+ "Chapter %d", i_chapter + 1 );
+ psz_name[ GNOME_ANGLE_MENU_SIZE - 1 ] = '\0';
p_item = gtk_radio_menu_item_new_with_label( p_chapter_group,
psz_name );
GtkWidget * p_navigation,
void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
{
+#define GNOME_TITLE_MENU_SIZE 64
intf_thread_t * p_intf;
- char psz_name[12];
+ char psz_name[ GNOME_TITLE_MENU_SIZE ];
GtkWidget * p_title_menu;
GtkWidget * p_title_submenu;
GtkWidget * p_title_item;
gtk_menu_append( GTK_MENU( p_title_menu ), p_title_menu_item );
}
- sprintf( psz_name, "%d - %d", i_title, i_title + 9 );
+ snprintf( psz_name, GNOME_TITLE_MENU_SIZE,
+ "%d - %d", i_title, i_title + 9 );
+ psz_name[ GNOME_TITLE_MENU_SIZE - 1 ] = '\0';
p_title_menu_item = gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_title_menu_item );
p_title_submenu = gtk_menu_new();
}
- sprintf( psz_name, "Title %d (%d)", i_title, p_intf->p_input->stream.pp_areas[i_title]->i_part_nb );
+ snprintf( psz_name, GNOME_TITLE_MENU_SIZE, "Title %d (%d)", i_title,
+ p_intf->p_input->stream.pp_areas[i_title]->i_part_nb );
+ psz_name[ GNOME_TITLE_MENU_SIZE - 1 ] = '\0';
if( pf_toggle == on_menubar_title_toggle )
{
p_chapter_menu_item );
}
- sprintf( psz_name, "%d - %d", i_chapter + 1,
- i_chapter + 10);
+ snprintf( psz_name, GNOME_TITLE_MENU_SIZE,
+ "%d - %d", i_chapter + 1, i_chapter + 10 );
+ psz_name[ GNOME_TITLE_MENU_SIZE - 1 ] = '\0';
p_chapter_menu_item =
gtk_menu_item_new_with_label( psz_name );
gtk_widget_show( p_chapter_menu_item );
p_chapter_submenu = gtk_menu_new();
}
- sprintf( psz_name, "Chapter %d", i_chapter + 1 );
+ snprintf( psz_name, GNOME_TITLE_MENU_SIZE,
+ "Chapter %d", i_chapter + 1 );
+ psz_name[ GNOME_TITLE_MENU_SIZE - 1 ] = '\0';
p_item = gtk_radio_menu_item_new_with_label(
p_chapter_group, psz_name );
TRUE );
}
-
return TRUE;
}
if( p_intf->p_sys->b_title_update )
{
- char psz_title[3];
+ char psz_title[5];
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_title" ) );
GnomeTitleMenu( p_intf, p_menubar_menu, on_menubar_title_toggle );
- snprintf( psz_title, 3, "%02d",
+ snprintf( psz_title, 5, "%d",
p_intf->p_input->stream.p_selected_area->i_id );
+ psz_title[ 4 ] = '\0';
gtk_label_set_text( p_intf->p_sys->p_label_title, psz_title );
p_intf->p_sys->b_title_update = 0;
if( p_intf->p_sys->b_chapter_update )
{
- char psz_chapter[3];
+ char psz_chapter[5];
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_navigation" ) );
p_intf->p_sys->p_window ), "menubar_chapter" ) );
GnomeChapterMenu( p_intf, p_menubar_menu, on_menubar_chapter_toggle );
- snprintf( psz_chapter, 3, "%02d",
+ snprintf( psz_chapter, 5, "%d",
p_intf->p_input->stream.p_selected_area->i_part );
+ psz_chapter[ 4 ] = '\0';
gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
p_intf->p_sys->i_part =