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