]> git.sesse.net Git - vlc/blob - plugins/gtk/gtk_callbacks.c
Hurg !
[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     on_generic_drop_data_received( p_intf, data, info, 0);
481      if( p_intf->p_input != NULL )
482      {
483         /* FIXME: temporary hack */
484         p_intf->p_input->b_eof = 1;
485      }
486      
487     intf_PlstJumpto( p_main->p_playlist, -1 );
488
489 }
490
491
492 void
493 on_about_ok_clicked                    (GtkButton       *button,
494                                         gpointer         user_data)
495 {
496     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_about" );
497
498     gtk_widget_hide( p_intf->p_sys->p_about );
499 }
500
501
502 void
503 on_menubar_disc_activate               (GtkMenuItem     *menuitem,
504                                         gpointer         user_data)
505 {
506     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
507
508     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
509     {
510         p_intf->p_sys->p_disc = create_intf_disc();
511         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
512                              "p_intf", p_intf );
513     }
514     gtk_widget_show( p_intf->p_sys->p_disc );
515     gdk_window_raise( p_intf->p_sys->p_disc->window );
516 }
517
518
519 void
520 on_toolbar_disc_clicked                (GtkButton       *button,
521                                         gpointer         user_data)
522 {
523     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
524
525     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
526     {
527         p_intf->p_sys->p_disc = create_intf_disc();
528         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
529                              "p_intf", p_intf );
530     }
531     gtk_widget_show( p_intf->p_sys->p_disc );
532     gdk_window_raise( p_intf->p_sys->p_disc->window );
533 }
534
535
536 void
537 on_disc_ok_clicked                     (GtkButton       *button,
538                                         gpointer         user_data)
539 {
540     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
541     char *psz_device, *psz_source, *psz_method;
542
543     psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
544                                          GTK_WIDGET(button), "disc_name" ) ) );
545
546     /* "dvd:foo" has size 5 + strlen(foo) */
547     psz_source = malloc( 5 + strlen( psz_device ) );
548     if( psz_source == NULL )
549     {
550         return;
551     }
552
553     /* Check which method was activated */
554     if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
555                                           "disc_dvd" ) )->active )
556     {
557         psz_method = "dvd";
558     }
559     else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
560                                                "disc_vcd" ) )->active )
561     {
562         psz_method = "vcd";
563     }
564     else
565     {
566         intf_ErrMsg( "intf error: unknown toggle button configuration" );
567         free( psz_source );
568         return;
569     }
570     
571     /* Select title and chapter */
572     main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
573                               GTK_SPIN_BUTTON( lookup_widget(
574                                   GTK_WIDGET(button), "disc_title" ) ) ) );
575
576     main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
577                               GTK_SPIN_BUTTON( lookup_widget(
578                                   GTK_WIDGET(button), "disc_chapter" ) ) ) );
579
580     /* Build source name and add it to playlist */
581     sprintf( psz_source, "%s:%s", psz_method, psz_device );
582     intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
583
584     gtk_widget_hide( p_intf->p_sys->p_disc );
585 }
586
587
588 void
589 on_disc_cancel_clicked                 (GtkButton       *button,
590                                         gpointer         user_data)
591 {
592     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
593
594     gtk_widget_hide( p_intf->p_sys->p_disc );
595 }
596
597
598 void
599 on_disc_dvd_toggled                    (GtkToggleButton *togglebutton,
600                                         gpointer         user_data)
601 {
602     if( togglebutton->active )
603     {
604         gtk_entry_set_text( GTK_ENTRY( lookup_widget(
605             GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
606     }
607 }
608
609
610 void
611 on_disc_vcd_toggled                    (GtkToggleButton *togglebutton,
612                                         gpointer         user_data)
613 {
614     if( togglebutton->active )
615     {
616         gtk_entry_set_text( GTK_ENTRY( lookup_widget(
617             GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
618     }
619 }
620
621
622 void
623 on_popup_disc_activate                 (GtkMenuItem     *menuitem,
624                                         gpointer         user_data)
625 {
626     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
627
628     if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
629     {
630         p_intf->p_sys->p_disc = create_intf_disc();
631         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
632                              "p_intf", p_intf );
633     }
634     gtk_widget_show( p_intf->p_sys->p_disc );
635     gdk_window_raise( p_intf->p_sys->p_disc->window );
636 }
637
638 void
639 on_popup_audio_activate                (GtkMenuItem     *menuitem,
640                                         gpointer         user_data)
641 {
642     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
643     es_descriptor_t *       p_es;
644
645     p_es = (es_descriptor_t*)user_data;
646
647     input_ChangeES( p_intf->p_input, p_es, 1 );
648 }
649
650
651 void
652 on_popup_subpictures_activate          (GtkMenuItem     *menuitem,
653                                         gpointer         user_data)
654 {
655     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
656     es_descriptor_t *       p_es;
657
658     p_es = (es_descriptor_t*)user_data;
659
660     input_ChangeES( p_intf->p_input, p_es, 2 );
661 }
662
663
664 void
665 on_menubar_audio_activate              (GtkMenuItem     *menuitem,
666                                         gpointer         user_data)
667 {
668     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
669     es_descriptor_t *       p_es;
670
671     p_es = (es_descriptor_t*)user_data;
672
673     input_ChangeES( p_intf->p_input, p_es, 1 );
674 }
675
676
677 void
678 on_menubar_subpictures_activate        (GtkMenuItem     *menuitem,
679                                         gpointer         user_data)
680 {
681     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
682     es_descriptor_t *       p_es;
683
684     p_es = (es_descriptor_t*)user_data;
685
686     input_ChangeES( p_intf->p_input, p_es, 2 );
687 }
688
689
690 void
691 on_popup_navigation_activate           (GtkMenuItem     *menuitem,
692                                         gpointer         user_data)
693 {
694     intf_thread_t * p_intf    = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
695     input_area_t *  p_area;
696     gint            i_title;
697     gint            i_chapter;
698
699     i_title   = (gint)(user_data) / 100 ;
700     i_chapter = (gint)(user_data) - ( 100 * i_title );
701     p_area    = p_intf->p_input->stream.pp_areas[i_title];
702     p_area->i_part = i_chapter;
703
704     p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
705     input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
706 }
707
708
709 void
710 on_menubar_title_activate              (GtkMenuItem     *menuitem,
711                                         gpointer         user_data)
712 {
713     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
714
715     p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)user_data );
716     p_intf->p_sys->b_menus_update = 1;
717     input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
718 }
719
720
721 void
722 on_menubar_chapter_activate            (GtkMenuItem     *menuitem,
723                                         gpointer         user_data)
724 {
725     intf_thread_t * p_intf    = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
726     input_area_t *  p_area    = p_intf->p_input->stream.p_selected_area;
727     gint            i_chapter = (gint)user_data;
728
729     p_area->i_part = i_chapter;
730
731     p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
732     input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
733 }
734
735 gboolean
736 on_intf_window_destroy                 (GtkWidget       *widget,
737                                         GdkEvent        *event,
738                                         gpointer         user_data)
739 {
740     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget),  "intf_window" );
741     /* is there an output thread ? */
742     if(p_main->b_video == 1)
743     {
744         gtk_widget_hide(widget);
745     } else {
746         p_intf->b_die = 1;
747         gtk_widget_destroy(widget);
748     }
749   return TRUE;
750 }
751
752
753 void
754 on_main_window_toggle                  (GtkMenuItem     *menuitem,
755                                         gpointer         user_data)
756 {
757     intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem),  "intf_popup" );
758     
759     if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_window) ) {
760         gtk_widget_hide( p_intf->p_sys->p_window);
761
762     } else {
763         gtk_widget_show( p_intf->p_sys->p_window );
764     }
765 }
766