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