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.1 2001/05/15 01:01:44 stef 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 #define MODULE_NAME gtk
26 #include "modules_inner.h"
28 /*****************************************************************************
30 *****************************************************************************/
32 #include <sys/types.h> /* off_t */
44 #include "stream_control.h"
45 #include "input_ext-intf.h"
47 #include "interface.h"
48 #include "intf_playlist.h"
51 #include "gtk_callbacks.h"
52 #include "gtk_interface.h"
53 #include "gtk_support.h"
54 #include "gtk_playlist.h"
59 /****************************************************************************
60 * Control functions: this is where the functions are defined
61 ****************************************************************************
62 * These functions are button-items callbacks, and are used
64 ****************************************************************************/
65 gboolean GtkControlBack( GtkWidget *widget,
66 GdkEventButton *event,
74 gboolean GtkControlStop( GtkWidget *widget,
75 GdkEventButton *event,
78 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
80 if( p_intf->p_input != NULL )
82 /* end playing item */
83 p_intf->p_input->b_eof = 1;
86 // vlc_mutex_lock( &p_main->p_playlist->change_lock );
88 p_main->p_playlist->i_index--;
89 p_main->p_playlist->b_stopped = 1;
91 // vlc_mutex_unlock( &p_main->p_playlist->change_lock );
99 gboolean GtkControlPlay( GtkWidget *widget,
100 GdkEventButton *event,
103 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
105 if( p_intf->p_input != NULL )
107 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
108 p_main->p_playlist->b_stopped = 0;
112 // vlc_mutex_lock( &p_main->p_playlist->change_lock );
114 if( p_main->p_playlist->b_stopped )
116 if( p_main->p_playlist->i_size )
118 intf_PlaylistJumpto( p_main->p_playlist,
119 p_main->p_playlist->i_index );
120 p_main->p_playlist->b_stopped = 0;
124 GtkFileOpenShow( widget, event, user_data );
128 // vlc_mutex_unlock( &p_main->p_playlist->change_lock );
135 gboolean GtkControlPause( GtkWidget *widget,
136 GdkEventButton *event,
139 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
141 if( p_intf->p_input != NULL )
143 input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
144 p_main->p_playlist->b_stopped = 0;
151 gboolean GtkControlSlow( GtkWidget *widget,
152 GdkEventButton *event,
155 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
157 if( p_intf->p_input != NULL )
159 input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
160 p_main->p_playlist->b_stopped = 0;
167 gboolean GtkControlFast( GtkWidget *widget,
168 GdkEventButton *event,
171 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
173 if( p_intf->p_input != NULL )
175 input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
176 p_main->p_playlist->b_stopped = 0;
183 /****************************************************************************
184 * Control callbacks for menuitems
185 ****************************************************************************
186 * We have different callaback for menuitem since we must use the
187 * activate signal toi popdown the menu automatically
188 ****************************************************************************/
189 void GtkPlayActivate( GtkMenuItem * menuitem, gpointer user_data )
191 GtkControlPlay( GTK_WIDGET( menuitem ), NULL, user_data );
195 void GtkPauseActivate( GtkMenuItem * menuitem, gpointer user_data )
197 GtkControlPause( GTK_WIDGET( menuitem ), NULL, user_data );
203 GtKStopActivate (GtkMenuItem *menuitem,
206 GtkControlStop( GTK_WIDGET( menuitem ), NULL, user_data );
212 GtkBackActivate (GtkMenuItem *menuitem,
215 GtkControlBack( GTK_WIDGET( menuitem ), NULL, user_data );
221 GtkSlowActivate (GtkMenuItem *menuitem,
224 GtkControlSlow( GTK_WIDGET( menuitem ), NULL, user_data );
230 GtkFastActivate (GtkMenuItem *menuitem,
233 GtkControlFast( GTK_WIDGET( menuitem ), NULL, user_data );