]> git.sesse.net Git - vlc/blob - plugins/gtk/gtk_callbacks.c
4ecdcf3a83d32084d5ca5ce0c576f745fe54775a
[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 <string.h>
37
38 #include "config.h"
39 #include "common.h"
40 #include "threads.h"
41 #include "mtime.h"
42
43 #include "stream_control.h"
44 #include "input_ext-intf.h"
45
46 #include "interface.h"
47 #include "intf_plst.h"
48 #include "intf_msg.h"
49
50 #include "gtk_sys.h"
51 #include "gtk_callbacks.h"
52 #include "gtk_interface.h"
53 #include "gtk_support.h"
54
55 #include "main.h"
56
57 /****************************************************************************
58  * External function
59  */
60 void on_generic_drop_data_received( intf_thread_t * p_intf,
61                         GtkSelectionData *data, guint info, int position);
62
63
64
65 /*****************************************************************************
66  * Inline function to retrieve the interface structure
67  *****************************************************************************/
68 static __inline__ intf_thread_t * GetIntf( GtkWidget *item, char * psz_parent )
69 {
70     return( gtk_object_get_data( GTK_OBJECT( lookup_widget(item, psz_parent) ),
71                                  "p_intf" ) );
72 }
73
74 /*****************************************************************************
75  * Callbacks
76  ******************************************************************************/
77 void
78 on_menubar_open_activate               (GtkMenuItem     *menuitem,
79                                         gpointer         user_data)
80 {
81     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
82
83     /* If we have never used the file selector, open it */
84     if( p_intf->p_sys->p_fileopen == NULL)
85     {
86         p_intf->p_sys->p_fileopen = create_intf_fileopen();
87         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
88                              "p_intf", p_intf );
89     }
90
91     gtk_widget_show( p_intf->p_sys->p_fileopen );
92     gdk_window_raise( p_intf->p_sys->p_fileopen->window );
93 }
94
95
96 void
97 on_menubar_exit_activate               (GtkMenuItem     *menuitem,
98                                         gpointer         user_data)
99 {
100     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
101
102     p_intf->b_die = 1;
103 }
104
105 void
106 on_menubar_preferences_activate        (GtkMenuItem     *menuitem,
107                                         gpointer         user_data)
108 {
109
110 }
111
112
113 void
114 on_menubar_about_activate              (GtkMenuItem     *menuitem,
115                                         gpointer         user_data)
116 {
117     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
118
119     if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
120     {
121         p_intf->p_sys->p_about = create_intf_about();
122         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
123                              "p_intf", p_intf );
124     }
125     gtk_widget_show( p_intf->p_sys->p_about );
126     gdk_window_raise( p_intf->p_sys->p_about->window );
127 }
128
129
130 void
131 on_toolbar_open_clicked                (GtkButton       *button,
132                                         gpointer         user_data)
133 {
134     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
135
136     /* If we have never used the file selector, open it */
137     if( p_intf->p_sys->p_fileopen == NULL)
138     {
139         p_intf->p_sys->p_fileopen = create_intf_fileopen();
140         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
141                              "p_intf", p_intf );
142     }
143
144     gtk_widget_show( p_intf->p_sys->p_fileopen );
145     gdk_window_raise( p_intf->p_sys->p_fileopen->window );
146 }
147
148
149 void
150 on_toolbar_back_clicked                (GtkButton       *button,
151                                         gpointer         user_data)
152 {
153
154 }
155
156
157 void
158 on_toolbar_stop_clicked                (GtkButton       *button,
159                                         gpointer         user_data)
160 {
161
162 }
163
164
165 void
166 on_toolbar_play_clicked                (GtkButton       *button,
167                                         gpointer         user_data)
168 {
169     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
170
171     if( p_intf->p_input != NULL )
172     {
173         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
174     }
175 }
176
177
178 void
179 on_toolbar_pause_clicked               (GtkButton       *button,
180                                         gpointer         user_data)
181 {
182     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
183
184     if( p_intf->p_input != NULL )
185     {
186         input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
187     }
188 }
189
190 void
191 on_toolbar_prev_clicked                (GtkButton       *button,
192                                         gpointer         user_data)
193 {
194     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
195
196     if( p_intf->p_input != NULL )
197     {
198         /* FIXME: temporary hack */
199         intf_PlstPrev( p_main->p_playlist );
200         intf_PlstPrev( p_main->p_playlist );
201         p_intf->p_input->b_eof = 1;
202     }
203 }
204
205
206 void
207 on_toolbar_next_clicked                (GtkButton       *button,
208                                         gpointer         user_data)
209 {
210     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
211
212     if( p_intf->p_input != NULL )
213     {
214         /* FIXME: temporary hack */
215         p_intf->p_input->b_eof = 1;
216     }
217 }
218
219
220 void
221 on_popup_play_activate                 (GtkMenuItem     *menuitem,
222                                         gpointer         user_data)
223 {
224     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
225
226     if( p_intf->p_input != NULL )
227     {
228         input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
229     }
230 }
231
232
233 void
234 on_popup_pause_activate                (GtkMenuItem     *menuitem,
235                                         gpointer         user_data)
236 {
237     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
238
239     if( p_intf->p_input != NULL )
240     {
241         input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
242     }
243 }
244
245
246 void
247 on_popup_exit_activate                 (GtkMenuItem     *menuitem,
248                                         gpointer         user_data)
249 {
250     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
251
252     p_intf->b_die = 1;
253 }
254
255 void
256 on_fileopen_ok_clicked                 (GtkButton       *button,
257                                         gpointer         user_data)
258 {
259     GtkWidget *filesel;
260     gchar *filename;
261
262     filesel = gtk_widget_get_toplevel (GTK_WIDGET (button));
263     gtk_widget_hide (filesel);
264     filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
265
266     intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
267 }
268
269
270 void
271 on_fileopen_cancel_clicked             (GtkButton       *button,
272                                         gpointer         user_data)
273 {
274     gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
275 }
276
277
278 void
279 on_intf_fileopen_destroy               (GtkObject       *object,
280                                         gpointer         user_data)
281 {
282     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_fileopen" );
283
284     p_intf->p_sys->p_fileopen = NULL;
285 }
286
287
288 void
289 on_popup_open_activate                 (GtkMenuItem     *menuitem,
290                                         gpointer         user_data)
291 {
292     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
293
294     /* If we have never used the file selector, open it */
295     if( p_intf->p_sys->p_fileopen == NULL)
296     {
297         p_intf->p_sys->p_fileopen = create_intf_fileopen();
298         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
299                              "p_intf", p_intf );
300     }
301
302     gtk_widget_show( p_intf->p_sys->p_fileopen );
303     gdk_window_raise( p_intf->p_sys->p_fileopen->window );
304 }
305
306
307 void
308 on_popup_about_activate                (GtkMenuItem     *menuitem,
309                                         gpointer         user_data)
310 {
311     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
312
313     if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
314     {
315         p_intf->p_sys->p_about = create_intf_about();
316         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
317                              "p_intf", p_intf );
318     }
319     gtk_widget_show( p_intf->p_sys->p_about );
320     gdk_window_raise( p_intf->p_sys->p_about->window );
321 }
322 void
323 on_popup_slow_activate                 (GtkMenuItem     *menuitem,
324                                         gpointer         user_data)
325 {
326     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
327
328     if( p_intf->p_input != NULL )
329     {
330         input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
331     }
332 }
333
334
335 void
336 on_popup_fast_activate                 (GtkMenuItem     *menuitem,
337                                         gpointer         user_data)
338 {
339     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
340
341     if( p_intf->p_input != NULL )
342     {
343         input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
344     }
345 }
346
347
348 void
349 on_toolbar_slow_clicked                (GtkButton       *button,
350                                         gpointer         user_data)
351 {
352     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
353
354     if( p_intf->p_input != NULL )
355     {
356         input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
357     }
358 }
359
360
361 void
362 on_toolbar_fast_clicked                (GtkButton       *button,
363                                         gpointer         user_data)
364 {
365     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
366
367     if( p_intf->p_input != NULL )
368     {
369         input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
370     }
371 }
372
373
374 gboolean
375 on_hscale_button_release_event         (GtkWidget       *widget,
376                                         GdkEventButton  *event,
377                                         gpointer         user_data)
378 {
379     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
380
381     GtkAdjustment *p_adj = gtk_range_get_adjustment( GTK_RANGE(widget) );
382     off_t i_seek;
383
384     vlc_mutex_lock( &p_intf->p_sys->change_lock );
385
386     if( p_intf->p_input != NULL )
387     {
388         i_seek = (p_adj->value *
389                   p_intf->p_input->stream.p_selected_area->i_size) / 100;
390         input_Seek( p_intf->p_input, i_seek );
391     }
392     p_intf->p_sys->b_scale_isfree = 1;
393
394     vlc_mutex_unlock( &p_intf->p_sys->change_lock );
395
396     return FALSE;
397 }
398
399
400 gboolean
401 on_hscale_button_press_event           (GtkWidget       *widget,
402                                         GdkEventButton  *event,
403                                         gpointer         user_data)
404 {
405     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
406
407     vlc_mutex_lock( &p_intf->p_sys->change_lock );
408     p_intf->p_sys->b_scale_isfree = 0;
409     vlc_mutex_unlock( &p_intf->p_sys->change_lock );
410
411     return FALSE;
412 }
413
414
415
416 void
417 on_intf_modules_destroy                (GtkObject       *object,
418                                         gpointer         user_data)
419 {
420
421 }
422
423
424 void
425 on_modules_ok_clicked                  (GtkButton       *button,
426                                         gpointer         user_data)
427 {
428     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
429
430     gtk_widget_hide( p_intf->p_sys->p_modules );
431
432 }
433
434
435 void
436 on_modules_apply_clicked               (GtkButton       *button,
437                                         gpointer         user_data)
438 {
439
440 }
441
442
443 void
444 on_modules_cancel_clicked              (GtkButton       *button,
445                                         gpointer         user_data)
446 {
447     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
448
449     gtk_widget_hide( p_intf->p_sys->p_modules );
450 }
451
452 void
453 on_menubar_modules_activate            (GtkMenuItem     *menuitem,
454                                         gpointer         user_data)
455 {
456     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
457
458     if( !GTK_IS_WIDGET( p_intf->p_sys->p_modules ) )
459     {
460 //        p_intf->p_sys->p_modules = create_intf_modules();
461         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_modules ),
462                              "p_intf", p_intf );
463     }
464     gtk_widget_show( p_intf->p_sys->p_modules );
465     gdk_window_raise( p_intf->p_sys->p_modules->window );
466 }
467
468
469 void
470 on_intf_window_drag_data_received      (GtkWidget       *widget,
471                                         GdkDragContext  *drag_context,
472                                         gint             x,
473                                         gint             y,
474                                         GtkSelectionData *data,
475                                         guint            info,
476                                         guint            time,
477                                         gpointer         user_data)
478 {
479     intf_thread_t * p_intf =  GetIntf( GTK_WIDGET(widget), "intf_window" );
480     int end = p_main->p_playlist->i_size;
481     on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END);
482
483      if( p_intf->p_input != NULL )
484      {
485         /* FIXME: temporary hack */
486         p_intf->p_input->b_eof = 1;
487      }
488      
489     intf_PlstJumpto( p_main->p_playlist, end-1 );
490
491 }
492
493
494 void
495 on_about_ok_clicked                    (GtkButton       *button,
496                                         gpointer         user_data)
497 {
498     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_about" );
499
500     gtk_widget_hide( p_intf->p_sys->p_about );
501 }
502
503
504 void
505 on_menubar_disc_activate               (GtkMenuItem     *menuitem,
506                                         gpointer         user_data)
507 {
508     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
509
510     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
511     {
512         p_intf->p_sys->p_disc = create_intf_disc();
513         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
514                              "p_intf", p_intf );
515     }
516     gtk_widget_show( p_intf->p_sys->p_disc );
517     gdk_window_raise( p_intf->p_sys->p_disc->window );
518 }
519
520
521 void
522 on_toolbar_disc_clicked                (GtkButton       *button,
523                                         gpointer         user_data)
524 {
525     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
526
527     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
528     {
529         p_intf->p_sys->p_disc = create_intf_disc();
530         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
531                              "p_intf", p_intf );
532     }
533     gtk_widget_show( p_intf->p_sys->p_disc );
534     gdk_window_raise( p_intf->p_sys->p_disc->window );
535 }
536
537
538 void
539 on_disc_ok_clicked                     (GtkButton       *button,
540                                         gpointer         user_data)
541 {
542     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
543     char *psz_device, *psz_source, *psz_method;
544
545     psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
546                                          GTK_WIDGET(button), "disc_name" ) ) );
547
548     /* "dvd:foo" has size 5 + strlen(foo) */
549     psz_source = malloc( 5 + strlen( psz_device ) );
550     if( psz_source == NULL )
551     {
552         return;
553     }
554
555     /* Check which method was activated */
556     if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
557                                           "disc_dvd" ) )->active )
558     {
559         psz_method = "dvd";
560     }
561     else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
562                                                "disc_vcd" ) )->active )
563     {
564         psz_method = "vcd";
565     }
566     else
567     {
568         intf_ErrMsg( "intf error: unknown toggle button configuration" );
569         free( psz_source );
570         return;
571     }
572     
573     /* Select title and chapter */
574     main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
575                               GTK_SPIN_BUTTON( lookup_widget(
576                                   GTK_WIDGET(button), "disc_title" ) ) ) );
577
578     main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
579                               GTK_SPIN_BUTTON( lookup_widget(
580                                   GTK_WIDGET(button), "disc_chapter" ) ) ) );
581
582     /* Build source name and add it to playlist */
583     sprintf( psz_source, "%s:%s", psz_method, psz_device );
584     intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
585
586     gtk_widget_hide( p_intf->p_sys->p_disc );
587 }
588
589
590 void
591 on_disc_cancel_clicked                 (GtkButton       *button,
592                                         gpointer         user_data)
593 {
594     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
595
596     gtk_widget_hide( p_intf->p_sys->p_disc );
597 }
598
599
600 void
601 on_disc_dvd_toggled                    (GtkToggleButton *togglebutton,
602                                         gpointer         user_data)
603 {
604     if( togglebutton->active )
605     {
606         gtk_entry_set_text( GTK_ENTRY( lookup_widget(
607             GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
608     }
609 }
610
611
612 void
613 on_disc_vcd_toggled                    (GtkToggleButton *togglebutton,
614                                         gpointer         user_data)
615 {
616     if( togglebutton->active )
617     {
618         gtk_entry_set_text( GTK_ENTRY( lookup_widget(
619             GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
620     }
621 }
622
623
624 void
625 on_popup_disc_activate                 (GtkMenuItem     *menuitem,
626                                         gpointer         user_data)
627 {
628     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
629
630     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
631     {
632         p_intf->p_sys->p_disc = create_intf_disc();
633         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
634                              "p_intf", p_intf );
635     }
636     gtk_widget_show( p_intf->p_sys->p_disc );
637     gdk_window_raise( p_intf->p_sys->p_disc->window );
638 }
639
640 void
641 on_popup_audio_activate                (GtkMenuItem     *menuitem,
642                                         gpointer         user_data)
643 {
644     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
645     es_descriptor_t *       p_es;
646
647     p_es = (es_descriptor_t*)user_data;
648
649     input_ChangeES( p_intf->p_input, p_es, 1 );
650 }
651
652
653 void
654 on_popup_subpictures_activate          (GtkMenuItem     *menuitem,
655                                         gpointer         user_data)
656 {
657     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
658     es_descriptor_t *       p_es;
659
660     p_es = (es_descriptor_t*)user_data;
661
662     input_ChangeES( p_intf->p_input, p_es, 2 );
663 }
664
665
666 void
667 on_menubar_audio_activate              (GtkMenuItem     *menuitem,
668                                         gpointer         user_data)
669 {
670     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
671     es_descriptor_t *       p_es;
672
673     p_es = (es_descriptor_t*)user_data;
674
675     input_ChangeES( p_intf->p_input, p_es, 1 );
676 }
677
678
679 void
680 on_menubar_subpictures_activate        (GtkMenuItem     *menuitem,
681                                         gpointer         user_data)
682 {
683     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
684     es_descriptor_t *       p_es;
685
686     p_es = (es_descriptor_t*)user_data;
687
688     input_ChangeES( p_intf->p_input, p_es, 2 );
689 }
690
691
692 void
693 on_popup_navigation_activate           (GtkMenuItem     *menuitem,
694                                         gpointer         user_data)
695 {
696     intf_thread_t * p_intf    = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
697     input_area_t *  p_area;
698     gint            i_title;
699     gint            i_chapter;
700
701     i_title   = (gint)(user_data) / 100 ;
702     i_chapter = (gint)(user_data) - ( 100 * i_title );
703     p_area    = p_intf->p_input->stream.pp_areas[i_title];
704     p_area->i_part = i_chapter;
705
706     p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
707     input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
708 }
709
710
711 void
712 on_menubar_title_activate              (GtkMenuItem     *menuitem,
713                                         gpointer         user_data)
714 {
715     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
716
717     p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)user_data );
718     p_intf->p_sys->b_menus_update = 1;
719     input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
720 }
721
722
723 void
724 on_menubar_chapter_activate            (GtkMenuItem     *menuitem,
725                                         gpointer         user_data)
726 {
727     intf_thread_t * p_intf    = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
728     input_area_t *  p_area    = p_intf->p_input->stream.p_selected_area;
729     gint            i_chapter = (gint)user_data;
730
731     p_area->i_part = i_chapter;
732
733     p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
734     input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
735 }
736
737 gboolean
738 on_intf_window_destroy                 (GtkWidget       *widget,
739                                         GdkEvent        *event,
740                                         gpointer         user_data)
741 {
742     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget),  "intf_window" );
743     p_intf->b_die = 1;
744     return TRUE;
745 }
746
747
748 void
749 on_main_window_toggle                  (GtkMenuItem     *menuitem,
750                                         gpointer         user_data)
751 {
752     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem),  "intf_popup" );
753     
754     if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_window) ) {
755         gtk_widget_hide( p_intf->p_sys->p_window);
756
757     } else {
758         gtk_widget_show( p_intf->p_sys->p_window );
759     }
760 }
761