]> git.sesse.net Git - vlc/blob - plugins/gnome/gnome_callbacks.c
67465adef89deffd4682a71490d32f08854505a6
[vlc] / plugins / gnome / gnome_callbacks.c
1 /*****************************************************************************
2  * gnome_callbacks.c : Callbacks for the Gnome plugin.
3  *****************************************************************************
4  * Copyright (C) 2000, 2001 VideoLAN
5  *
6  * Authors: Samuel Hocevar <sam@zoy.org>
7  *      
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
21  *****************************************************************************/
22
23 #define MODULE_NAME gnome
24 #include "modules_inner.h"
25
26 /*****************************************************************************
27  * Preamble
28  *****************************************************************************/
29 #include "defs.h"
30
31 #include <gnome.h>
32
33 #include "config.h"
34 #include "common.h"
35 #include "threads.h"
36 #include "mtime.h"
37
38 #include "stream_control.h"
39 #include "input_ext-intf.h"
40
41 #include "interface.h"
42 #include "intf_plst.h"
43 #include "intf_msg.h"
44
45 #include "gnome_sys.h"
46 #include "gnome_callbacks.h"
47 #include "gnome_interface.h"
48 #include "gnome_support.h"
49
50 #include "main.h"
51
52 /*****************************************************************************
53  * Inline function to retrieve the interface structure
54  *****************************************************************************/
55 static __inline__ intf_thread_t * GetIntf( GtkWidget *item, char * psz_parent )
56 {
57     return( gtk_object_get_data( GTK_OBJECT( lookup_widget(item, psz_parent) ),
58                                  "p_intf" ) );
59 }
60
61 /*****************************************************************************
62  * Callbacks
63  ******************************************************************************/
64 void
65 on_menubar_open_activate               (GtkMenuItem     *menuitem,
66                                         gpointer         user_data)
67 {
68     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
69
70     /* If we have never used the file selector, open it */
71     if( p_intf->p_sys->p_fileopen == NULL)
72     {
73         p_intf->p_sys->p_fileopen = create_intf_fileopen();
74         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
75                              "p_intf", p_intf );
76     }
77
78     gtk_widget_show( p_intf->p_sys->p_fileopen );
79     gdk_window_raise( p_intf->p_sys->p_fileopen->window );
80 }
81
82
83 void
84 on_menubar_exit_activate               (GtkMenuItem     *menuitem,
85                                         gpointer         user_data)
86 {
87     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
88
89     p_intf->b_die = 1;
90 }
91
92
93 void
94 on_menubar_playlist_activate           (GtkMenuItem     *menuitem,
95                                         gpointer         user_data)
96 {
97     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
98
99     if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
100     {
101         p_intf->p_sys->p_playlist = create_intf_playlist();
102         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
103                              "p_intf", p_intf );
104     }
105     gtk_widget_show( p_intf->p_sys->p_playlist );
106     gdk_window_raise( p_intf->p_sys->p_playlist->window );
107 }
108
109
110 void
111 on_menubar_preferences_activate        (GtkMenuItem     *menuitem,
112                                         gpointer         user_data)
113 {
114
115 }
116
117
118 void
119 on_menubar_about_activate              (GtkMenuItem     *menuitem,
120                                         gpointer         user_data)
121 {
122     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
123
124     if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
125     {
126         p_intf->p_sys->p_about = create_intf_about();
127         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
128                              "p_intf", p_intf );
129     }
130     gtk_widget_show( p_intf->p_sys->p_about );
131     gdk_window_raise( p_intf->p_sys->p_about->window );
132 }
133
134
135 void
136 on_toolbar_open_clicked                (GtkButton       *button,
137                                         gpointer         user_data)
138 {
139     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
140
141     /* If we have never used the file selector, open it */
142     if( p_intf->p_sys->p_fileopen == NULL)
143     {
144         p_intf->p_sys->p_fileopen = create_intf_fileopen();
145         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
146                              "p_intf", p_intf );
147     }
148
149     gtk_widget_show( p_intf->p_sys->p_fileopen );
150     gdk_window_raise( p_intf->p_sys->p_fileopen->window );
151 }
152
153
154 void
155 on_toolbar_back_clicked                (GtkButton       *button,
156                                         gpointer         user_data)
157 {
158
159 }
160
161
162 void
163 on_toolbar_stop_clicked                (GtkButton       *button,
164                                         gpointer         user_data)
165 {
166
167 }
168
169
170 void
171 on_toolbar_play_clicked                (GtkButton       *button,
172                                         gpointer         user_data)
173 {
174     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
175
176     if( p_intf->p_input != NULL )
177     {
178         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
179     }
180 }
181
182
183 void
184 on_toolbar_pause_clicked               (GtkButton       *button,
185                                         gpointer         user_data)
186 {
187     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
188
189     if( p_intf->p_input != NULL )
190     {
191         input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
192     }
193 }
194
195
196 void
197 on_toolbar_playlist_clicked            (GtkButton       *button,
198                                         gpointer         user_data)
199 {
200     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
201
202     if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
203     {
204         p_intf->p_sys->p_playlist = create_intf_playlist();
205         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
206                              "p_intf", p_intf );
207     }
208     gtk_widget_show( p_intf->p_sys->p_playlist );
209     gdk_window_raise( p_intf->p_sys->p_playlist->window );
210 }
211
212
213 void
214 on_toolbar_prev_clicked                (GtkButton       *button,
215                                         gpointer         user_data)
216 {
217     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
218
219     if( p_intf->p_input != NULL )
220     {
221         /* FIXME: temporary hack */
222         intf_PlstPrev( p_main->p_playlist );
223         intf_PlstPrev( p_main->p_playlist );
224         p_intf->p_input->b_eof = 1;
225     }
226 }
227
228
229 void
230 on_toolbar_next_clicked                (GtkButton       *button,
231                                         gpointer         user_data)
232 {
233     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
234
235     if( p_intf->p_input != NULL )
236     {
237         /* FIXME: temporary hack */
238         p_intf->p_input->b_eof = 1;
239     }
240 }
241
242
243 void
244 on_popup_play_activate                 (GtkMenuItem     *menuitem,
245                                         gpointer         user_data)
246 {
247     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
248
249     if( p_intf->p_input != NULL )
250     {
251         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
252     }
253 }
254
255
256 void
257 on_popup_pause_activate                (GtkMenuItem     *menuitem,
258                                         gpointer         user_data)
259 {
260     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
261
262     if( p_intf->p_input != NULL )
263     {
264         input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
265     }
266 }
267
268
269 void
270 on_popup_exit_activate                 (GtkMenuItem     *menuitem,
271                                         gpointer         user_data)
272 {
273     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
274
275     p_intf->b_die = 1;
276 }
277
278
279 void
280 on_intf_window_destroy                 (GtkObject       *object,
281                                         gpointer         user_data)
282 {
283     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_window" );
284
285     /* FIXME don't destroy the window, just hide it */
286     p_intf->b_die = 1;
287     p_intf->p_sys->p_window = NULL;
288 }
289
290
291 void
292 on_fileopen_ok_clicked                 (GtkButton       *button,
293                                         gpointer         user_data)
294 {
295     GtkWidget *filesel;
296     gchar *filename;
297
298     filesel = gtk_widget_get_toplevel (GTK_WIDGET (button));
299     gtk_widget_hide (filesel);
300     filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
301
302     intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
303 }
304
305
306 void
307 on_fileopen_cancel_clicked             (GtkButton       *button,
308                                         gpointer         user_data)
309 {
310     gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
311 }
312
313
314 void
315 on_intf_fileopen_destroy               (GtkObject       *object,
316                                         gpointer         user_data)
317 {
318     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_fileopen" );
319
320     p_intf->p_sys->p_fileopen = NULL;
321 }
322
323
324 void
325 on_popup_open_activate                 (GtkMenuItem     *menuitem,
326                                         gpointer         user_data)
327 {
328     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
329
330     /* If we have never used the file selector, open it */
331     if( p_intf->p_sys->p_fileopen == NULL)
332     {
333         p_intf->p_sys->p_fileopen = create_intf_fileopen();
334         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
335                              "p_intf", p_intf );
336     }
337
338     gtk_widget_show( p_intf->p_sys->p_fileopen );
339     gdk_window_raise( p_intf->p_sys->p_fileopen->window );
340 }
341
342
343 void
344 on_popup_about_activate                (GtkMenuItem     *menuitem,
345                                         gpointer         user_data)
346 {
347     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
348
349     if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
350     {
351         p_intf->p_sys->p_about = create_intf_about();
352         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
353                              "p_intf", p_intf );
354     }
355     gtk_widget_show( p_intf->p_sys->p_about );
356     gdk_window_raise( p_intf->p_sys->p_about->window );
357 }
358
359
360 void
361 on_intf_playlist_destroy               (GtkObject       *object,
362                                         gpointer         user_data)
363 {
364     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_playlist" );
365
366     p_intf->p_sys->p_playlist = NULL;
367 }
368
369
370 void
371 on_playlist_close_clicked              (GtkButton       *button,
372                                         gpointer         user_data)
373 {
374     gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
375 }
376
377
378 void
379 on_popup_slow_activate                 (GtkMenuItem     *menuitem,
380                                         gpointer         user_data)
381 {
382     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
383
384     if( p_intf->p_input != NULL )
385     {
386         input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
387     }
388 }
389
390
391 void
392 on_popup_fast_activate                 (GtkMenuItem     *menuitem,
393                                         gpointer         user_data)
394 {
395     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
396
397     if( p_intf->p_input != NULL )
398     {
399         input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
400     }
401 }
402
403
404 void
405 on_toolbar_slow_clicked                (GtkButton       *button,
406                                         gpointer         user_data)
407 {
408     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
409
410     if( p_intf->p_input != NULL )
411     {
412         input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
413     }
414 }
415
416
417 void
418 on_toolbar_fast_clicked                (GtkButton       *button,
419                                         gpointer         user_data)
420 {
421     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
422
423     if( p_intf->p_input != NULL )
424     {
425         input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
426     }
427 }
428
429
430 gboolean
431 on_hscale_button_release_event         (GtkWidget       *widget,
432                                         GdkEventButton  *event,
433                                         gpointer         user_data)
434 {
435     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
436
437     GtkAdjustment *p_adj = gtk_range_get_adjustment( GTK_RANGE(widget) );
438     off_t i_seek;
439
440     vlc_mutex_lock( &p_intf->p_sys->change_lock );
441
442     if( p_intf->p_input != NULL )
443     {
444         i_seek = (p_adj->value *
445                   p_intf->p_input->stream.p_selected_area->i_size) / 100;
446         input_Seek( p_intf->p_input, i_seek );
447     }
448     p_intf->p_sys->b_scale_isfree = 1;
449
450     vlc_mutex_unlock( &p_intf->p_sys->change_lock );
451
452     return FALSE;
453 }
454
455
456 gboolean
457 on_hscale_button_press_event           (GtkWidget       *widget,
458                                         GdkEventButton  *event,
459                                         gpointer         user_data)
460 {
461     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
462
463     vlc_mutex_lock( &p_intf->p_sys->change_lock );
464     p_intf->p_sys->b_scale_isfree = 0;
465     vlc_mutex_unlock( &p_intf->p_sys->change_lock );
466
467     return FALSE;
468 }
469
470
471
472 void
473 on_intf_modules_destroy                (GtkObject       *object,
474                                         gpointer         user_data)
475 {
476
477 }
478
479
480 void
481 on_modules_ok_clicked                  (GtkButton       *button,
482                                         gpointer         user_data)
483 {
484     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
485
486     gtk_widget_hide( p_intf->p_sys->p_modules );
487
488 }
489
490
491 void
492 on_modules_apply_clicked               (GtkButton       *button,
493                                         gpointer         user_data)
494 {
495
496 }
497
498
499 void
500 on_modules_cancel_clicked              (GtkButton       *button,
501                                         gpointer         user_data)
502 {
503     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
504
505     gtk_widget_hide( p_intf->p_sys->p_modules );
506 }
507
508
509 void
510 on_playlist_ok_clicked                 (GtkButton       *button,
511                                         gpointer         user_data)
512 {
513     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_playlist" );
514
515     gtk_widget_hide( p_intf->p_sys->p_playlist );
516 }
517
518
519 void
520 on_menubar_modules_activate            (GtkMenuItem     *menuitem,
521                                         gpointer         user_data)
522 {
523     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
524
525     if( !GTK_IS_WIDGET( p_intf->p_sys->p_modules ) )
526     {
527         p_intf->p_sys->p_modules = create_intf_modules();
528         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_modules ),
529                              "p_intf", p_intf );
530     }
531     gtk_widget_show( p_intf->p_sys->p_modules );
532     gdk_window_raise( p_intf->p_sys->p_modules->window );
533 }
534
535
536 void
537 on_intf_window_drag_data_received      (GtkWidget       *widget,
538                                         GdkDragContext  *drag_context,
539                                         gint             x,
540                                         gint             y,
541                                         GtkSelectionData *data,
542                                         guint            info,
543                                         guint            time,
544                                         gpointer         user_data)
545 {
546     char *psz_text = data->data;
547     int i_len      = strlen( psz_text );
548
549     switch( info )
550     {
551     case DROP_ACCEPT_TEXT_PLAIN: /* FIXME: handle multiple files */
552
553         if( i_len < 1 )
554         {
555             return;
556         }
557
558         /* get rid of ' ' at the end */
559         *( psz_text + i_len - 1 ) = 0;
560
561         intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
562         intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
563
564         break;
565
566     case DROP_ACCEPT_TEXT_URI_LIST: /* FIXME: handle multiple files */
567
568         if( i_len < 2 )
569         {
570             return;
571         }
572
573         /* get rid of \r\n at the end */
574         *( psz_text + i_len - 2 ) = 0;
575
576         intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
577         intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
578         break;
579
580     default:
581
582         intf_ErrMsg( "intf error: unknown dropped type");
583         break;
584     }
585 }
586
587
588 void
589 on_menubar_disc_activate               (GtkMenuItem     *menuitem,
590                                         gpointer         user_data)
591 {
592     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
593
594     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
595     {
596         p_intf->p_sys->p_disc = create_intf_disc();
597         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
598                              "p_intf", p_intf );
599     }
600     gtk_widget_show( p_intf->p_sys->p_disc );
601     gdk_window_raise( p_intf->p_sys->p_disc->window );
602 }
603
604
605 void
606 on_toolbar_disc_clicked                (GtkButton       *button,
607                                         gpointer         user_data)
608 {
609     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
610
611     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
612     {
613         p_intf->p_sys->p_disc = create_intf_disc();
614         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
615                              "p_intf", p_intf );
616     }
617     gtk_widget_show( p_intf->p_sys->p_disc );
618     gdk_window_raise( p_intf->p_sys->p_disc->window );
619 }
620
621
622 void
623 on_disc_ok_clicked                     (GtkButton       *button,
624                                         gpointer         user_data)
625 {
626     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
627     char *psz_device, *psz_source, *psz_method;
628
629     psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
630                                          GTK_WIDGET(button), "disc_name" ) ) );
631
632     /* "dvd:foo" has size 5 + strlen(foo) */
633     psz_source = malloc( 5 + strlen( psz_device ) );
634     if( psz_source == NULL )
635     {
636         return;
637     }
638
639     /* Check which method was activated */
640     if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
641                                           "disc_dvd" ) )->active )
642     {
643         psz_method = "dvd";
644     }
645     else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
646                                                "disc_vcd" ) )->active )
647     {
648         psz_method = "vcd";
649     }
650     else
651     {
652         intf_ErrMsg( "intf error: unknown toggle button configuration" );
653         free( psz_source );
654         return;
655     }
656     
657     /* Select title and chapter */
658     main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
659                               GTK_SPIN_BUTTON( lookup_widget(
660                                   GTK_WIDGET(button), "disc_title" ) ) ) );
661
662     main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
663                               GTK_SPIN_BUTTON( lookup_widget(
664                                   GTK_WIDGET(button), "disc_chapter" ) ) ) );
665
666     /* Build source name and add it to playlist */
667     sprintf( psz_source, "%s:%s", psz_method, psz_device );
668     intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
669
670     gtk_widget_hide( p_intf->p_sys->p_disc );
671 }
672
673
674 void
675 on_disc_cancel_clicked                 (GtkButton       *button,
676                                         gpointer         user_data)
677 {
678     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
679
680     gtk_widget_hide( p_intf->p_sys->p_disc );
681 }
682
683
684 void
685 on_disc_dvd_toggled                    (GtkToggleButton *togglebutton,
686                                         gpointer         user_data)
687 {
688     if( togglebutton->active )
689     {
690         gtk_entry_set_text( GTK_ENTRY( lookup_widget(
691             GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
692     }
693 }
694
695
696 void
697 on_disc_vcd_toggled                    (GtkToggleButton *togglebutton,
698                                         gpointer         user_data)
699 {
700     if( togglebutton->active )
701     {
702         gtk_entry_set_text( GTK_ENTRY( lookup_widget(
703             GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
704     }
705 }
706
707
708 void
709 on_popup_disc_activate                 (GtkMenuItem     *menuitem,
710                                         gpointer         user_data)
711 {
712     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
713
714     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
715     {
716         p_intf->p_sys->p_disc = create_intf_disc();
717         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
718                              "p_intf", p_intf );
719     }
720     gtk_widget_show( p_intf->p_sys->p_disc );
721     gdk_window_raise( p_intf->p_sys->p_disc->window );
722 }
723
724
725 void
726 on_popup_audio_toggle                  (GtkCheckMenuItem    *menuitem,
727                                         gpointer            user_data)
728 {
729     if( menuitem->active )
730     {
731         intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
732         es_descriptor_t *       p_es;
733     
734         p_es = (es_descriptor_t*)user_data;
735     
736         input_ChangeES( p_intf->p_input, p_es, 1 );
737     }
738 }
739
740
741 void
742 on_popup_subtitle_toggle               (GtkCheckMenuItem     *menuitem,
743                                         gpointer             user_data)
744 {
745     if( menuitem->active )
746     {
747         intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
748         es_descriptor_t *       p_es;
749     
750         p_es = (es_descriptor_t*)user_data;
751     
752         input_ChangeES( p_intf->p_input, p_es, 2 );
753     }
754 }
755
756
757 void
758 on_menubar_audio_toggle                (GtkCheckMenuItem    *menuitem,
759                                         gpointer            user_data)
760 {
761     if( menuitem->active )
762     {
763         intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
764         es_descriptor_t *       p_es;
765
766         p_es = (es_descriptor_t*)user_data;
767
768         input_ChangeES( p_intf->p_input, p_es, 1 );
769     }
770 }
771
772
773 void
774 on_menubar_subtitle_toggle             (GtkCheckMenuItem     *menuitem,
775                                         gpointer             user_data)
776 {
777     if( menuitem->active )
778     {
779         intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
780         es_descriptor_t *       p_es;
781     
782         p_es = (es_descriptor_t*)user_data;
783     
784         input_ChangeES( p_intf->p_input, p_es, 2 );
785     }
786 }
787
788
789 void
790 on_popup_navigation_toggle             (GtkCheckMenuItem     *menuitem,
791                                         gpointer             user_data)
792 {
793     if( menuitem->active )
794     {
795         intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
796         input_area_t *  p_area;
797         gint            i_title;
798         gint            i_chapter;
799     
800         i_title   = (gint)(user_data) / 100 ;
801         i_chapter = (gint)(user_data) - ( 100 * i_title );
802
803         if( i_title != p_intf->p_input->stream.p_selected_area->i_id )
804         {
805             p_intf->p_sys->b_menus_update = 1;
806         }
807
808         p_area = p_intf->p_input->stream.pp_areas[i_title];
809         p_area->i_part = i_chapter;
810     
811         p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
812                 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
813     }
814 }
815
816
817 void
818 on_menubar_title_toggle                (GtkCheckMenuItem     *menuitem,
819                                         gpointer             user_data)
820 {
821     if( menuitem->active )
822     {
823         intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
824     
825         p_intf->p_input->pf_set_area( p_intf->p_input,
826                                       (input_area_t*)user_data );
827         p_intf->p_sys->b_menus_update = 1;
828         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
829     }
830 }
831
832
833 void
834 on_menubar_chapter_toggle              (GtkCheckMenuItem     *menuitem,
835                                         gpointer             user_data)
836 {
837     if( menuitem->active )
838     {
839         intf_thread_t * p_intf    = GetIntf( GTK_WIDGET(menuitem),
840                                              "intf_window" );
841         input_area_t *  p_area    = p_intf->p_input->stream.p_selected_area;
842         gint            i_chapter = (gint)user_data;
843     
844         p_area->i_part = i_chapter;
845     
846         p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
847         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
848     }
849 }