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