1 /*****************************************************************************
2 * gtk_control.c : functions to handle stream control buttons.
3 *****************************************************************************
4 * Copyright (C) 2000, 2001 VideoLAN
5 * $Id: gtk_control.c,v 1.12 2002/06/07 14:30:41 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Stéphane Borel <stef@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <sys/types.h> /* off_t */
34 #ifdef MODULE_NAME_IS_gnome
42 #include "gtk_callbacks.h"
43 #include "gtk_interface.h"
44 #include "gtk_support.h"
45 #include "gtk_playlist.h"
46 #include "gtk_common.h"
48 /****************************************************************************
49 * Control functions: this is where the functions are defined
50 ****************************************************************************
51 * These functions are button-items callbacks, and are used
53 ****************************************************************************/
54 gboolean GtkControlBack( GtkWidget *widget,
61 gboolean GtkControlStop( GtkWidget *widget,
64 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
65 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
67 if( p_playlist == NULL )
72 playlist_Stop( p_playlist );
73 vlc_object_release( p_playlist );
79 gboolean GtkControlPlay( GtkWidget *widget,
82 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
83 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
85 if( p_playlist == NULL )
87 GtkFileOpenShow( widget, user_data );
91 /* If the playlist is empty, open a file requester instead */
92 vlc_mutex_lock( &p_playlist->object_lock );
93 if( p_playlist->i_size )
95 vlc_mutex_unlock( &p_playlist->object_lock );
96 playlist_Play( p_playlist );
97 vlc_object_release( p_playlist );
101 vlc_mutex_unlock( &p_playlist->object_lock );
102 vlc_object_release( p_playlist );
103 GtkFileOpenShow( widget, user_data );
110 gboolean GtkControlPause( GtkWidget *widget,
113 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
115 if( p_intf->p_sys->p_input == NULL )
120 input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
126 gboolean GtkControlSlow( GtkWidget *widget,
129 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
131 if( p_intf->p_sys->p_input == NULL )
136 input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
142 gboolean GtkControlFast( GtkWidget *widget,
145 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
147 if( p_intf->p_sys->p_input == NULL )
152 input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );