#define BROWSE_TEXT N_("Filebrowser starting point")
#define BROWSE_LONGTEXT N_( \
- "This option allows you to specify directory the ncurses filebrowser" \
+ "This option allows you to specify the directory the ncurses filebrowser " \
"will show you initially.")
vlc_module_begin();
set_description( _("ncurses interface") );
set_capability( "interface", 10 );
+ set_category( CAT_INTERFACE );
+ set_subcategory( SUBCAT_INTERFACE_GENERAL );
set_callbacks( Open, Close );
add_shortcut( "curses" );
add_directory( "browse-dir", NULL, NULL, BROWSE_TEXT, BROWSE_LONGTEXT, VLC_FALSE );
int i_box_plidx; /* Playlist index */
int b_box_plidx_follow;
+ int i_box_bidx; /* browser index */
int b_box_cleared;
p_sys->b_box_plidx_follow = VLC_TRUE;
p_sys->b_box_cleared = VLC_FALSE;
p_sys->i_box_plidx = 0;
+ p_sys->i_box_bidx = 0;
p_sys->p_sub = msg_Subscribe( p_intf );
/* Initialize the curses library */
p_sys->i_box_plidx = p_sys->p_playlist->i_index;
}
-
while( ( i_key = getch()) != -1 )
{
/*
}
if( p_sys->i_box_type == BOX_BROWSE )
{
+ vlc_bool_t b_ret = VLC_TRUE;
/* Browser navigation */
switch( i_key )
{
case KEY_HOME:
- p_sys->i_box_plidx = 0;
+ p_sys->i_box_bidx = 0;
break;
case KEY_END:
- p_sys->i_box_plidx = p_sys->i_dir_entries - 1;
+ p_sys->i_box_bidx = p_sys->i_dir_entries - 1;
break;
case KEY_UP:
- p_sys->i_box_plidx--;
+ p_sys->i_box_bidx--;
break;
case KEY_DOWN:
- p_sys->i_box_plidx++;
+ p_sys->i_box_bidx++;
break;
case KEY_PPAGE:
- p_sys->i_box_plidx -= p_sys->i_box_lines;
+ p_sys->i_box_bidx -= p_sys->i_box_lines;
break;
case KEY_NPAGE:
- p_sys->i_box_plidx += p_sys->i_box_lines;
+ p_sys->i_box_bidx += p_sys->i_box_lines;
break;
case KEY_ENTER:
case 0x0d:
- if( p_sys->pp_dir_entries[p_sys->i_box_plidx]->b_file )
+ if( p_sys->pp_dir_entries[p_sys->i_box_bidx]->b_file )
{
int i_size_entry = strlen( p_sys->psz_current_dir ) +
- strlen( p_sys->pp_dir_entries[p_sys->i_box_plidx]->psz_path ) + 2;
+ strlen( p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path ) + 2;
char *psz_uri = (char *)malloc( sizeof(char)*i_size_entry);
- sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, p_sys->pp_dir_entries[p_sys->i_box_plidx]->psz_path );
+ sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path );
playlist_Add( p_sys->p_playlist, psz_uri,
psz_uri,
PLAYLIST_APPEND, PLAYLIST_END );
else
{
int i_size_entry = strlen( p_sys->psz_current_dir ) +
- strlen( p_sys->pp_dir_entries[p_sys->i_box_plidx]->psz_path ) + 2;
+ strlen( p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path ) + 2;
char *psz_uri = (char *)malloc( sizeof(char)*i_size_entry);
- sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, p_sys->pp_dir_entries[p_sys->i_box_plidx]->psz_path );
+ sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path );
p_sys->psz_current_dir = strdup( psz_uri );
ReadDir( p_intf );
}
break;
default:
+ b_ret = VLC_FALSE;
break;
-
- if( p_sys->i_box_plidx >= p_sys->i_dir_entries ) p_sys->i_box_plidx = p_sys->i_dir_entries - 1;
- if( p_sys->i_box_plidx < 0 ) p_sys->i_box_plidx = 0;
- if( p_sys->i_box_plidx == p_sys->i_dir_entries )
- p_sys->b_box_plidx_follow = VLC_TRUE;
- else
- p_sys->b_box_plidx_follow = VLC_FALSE;
+ }
+ if( b_ret )
+ {
+ if( p_sys->i_box_bidx >= p_sys->i_dir_entries ) p_sys->i_box_bidx = p_sys->i_dir_entries - 1;
+ if( p_sys->i_box_bidx < 0 ) p_sys->i_box_bidx = 0;
return 1;
}
}
}
else if( p_sys->i_box_type == BOX_OPEN && p_sys->psz_open_chain )
{
- int i_chain_len;
- i_chain_len = strlen( p_sys->psz_open_chain );
+ int i_chain_len = strlen( p_sys->psz_open_chain );
playlist_t *p_playlist = p_sys->p_playlist;
switch( i_key )
vlc_value_t val_list;
/* Source */
- mvnprintw( y++, 0, COLS, " Source : %s", p_input->psz_source );
+ mvnprintw( y++, 0, COLS, " Source : %s",
+ p_input->input.p_item->psz_uri );
/* State */
var_Get( p_input, "state", &val );
if( p_input )
{
int i,j;
- vlc_mutex_lock( &p_input->p_item->lock );
- for ( i = 0; i < p_input->p_item->i_categories; i++ )
+ vlc_mutex_lock( &p_input->input.p_item->lock );
+ for ( i = 0; i < p_input->input.p_item->i_categories; i++ )
{
- info_category_t *p_category = p_input->p_item->pp_categories[i];
+ info_category_t *p_category = p_input->input.p_item->pp_categories[i];
if( y >= y_end ) break;
MainBoxWrite( p_intf, l++, 1, " [%s]", p_category->psz_name );
for ( j = 0; j < p_category->i_infos; j++ )
MainBoxWrite( p_intf, l++, 1, " %s: %s", p_info->psz_name, p_info->psz_value );
}
}
- vlc_mutex_unlock( &p_input->p_item->lock );
+ vlc_mutex_unlock( &p_input->input.p_item->lock );
}
else
{
int i_item;
DrawBox( p_sys->w, y++, 0, h, COLS, " Browse " );
- if( p_sys->i_box_plidx >= p_sys->i_dir_entries ) p_sys->i_box_plidx = p_sys->i_dir_entries - 1;
- if( p_sys->i_box_plidx < 0 ) p_sys->i_box_plidx = 0;
+ if( p_sys->i_box_bidx >= p_sys->i_dir_entries ) p_sys->i_box_plidx = p_sys->i_dir_entries - 1;
+ if( p_sys->i_box_bidx < 0 ) p_sys->i_box_bidx = 0;
- if( p_sys->i_box_plidx < (h - 2)/2 )
+ if( p_sys->i_box_bidx < (h - 2)/2 )
{
i_start = 0;
i_stop = h - 2;
}
- else if( p_sys->i_dir_entries - p_sys->i_box_plidx > (h - 2)/2 )
+ else if( p_sys->i_dir_entries - p_sys->i_box_bidx > (h - 2)/2 )
{
- i_start = p_sys->i_box_plidx - (h - 2)/2;
+ i_start = p_sys->i_box_bidx - (h - 2)/2;
i_stop = i_start + h - 2;
}
else
for( i_item = i_start; i_item < i_stop; i_item++ )
{
- vlc_bool_t b_selected = ( p_sys->i_box_plidx == i_item );
+ vlc_bool_t b_selected = ( p_sys->i_box_bidx == i_item );
if( y >= y_end ) break;
if( b_selected )
/* while we still have entries in the directory */
while( p_dir_content != NULL )
{
+#if defined( S_ISDIR )
+ struct stat stat_data;
+#endif
struct dir_entry_t *p_dir_entry;
int i_size_entry = strlen( p_sys->psz_current_dir ) +
strlen( p_dir_content->d_name ) + 2;
char *psz_uri = (char *)malloc( sizeof(char)*i_size_entry);
- sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, p_dir_content->d_name );
+ sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir,
+ p_dir_content->d_name );
- if( ( p_dir_entry = malloc( sizeof( struct dir_entry_t) ) ) == NULL )
+ if( !( p_dir_entry = malloc( sizeof( struct dir_entry_t) ) ) )
{
free( psz_uri);
return;
}
#if defined( S_ISDIR )
- struct stat stat_data;
stat( psz_uri, &stat_data );
if( S_ISDIR(stat_data.st_mode) )
#elif defined( DT_DIR )
INSERT_ELEM( p_sys->pp_dir_entries, p_sys->i_dir_entries,
p_sys->i_dir_entries, p_dir_entry );
}
+
free( psz_uri );
/* Read next entry */
p_dir_content = readdir( p_current_dir );