1 /*****************************************************************************
2 * gnome_callbacks.c : Callbacks for the Gnome plugin.
3 *****************************************************************************
4 * Copyright (C) 2000, 2001 VideoLAN
5 * $Id: gnome_callbacks.c,v 1.20 2001/04/03 03:39:41 stef Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Stéphane Borel <stef@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 #define MODULE_NAME gnome
26 #include "modules_inner.h"
28 /*****************************************************************************
30 *****************************************************************************/
40 #include "stream_control.h"
41 #include "input_ext-intf.h"
43 #include "interface.h"
44 #include "intf_playlist.h"
47 #include "gnome_callbacks.h"
48 #include "gnome_interface.h"
49 #include "gnome_support.h"
50 #include "intf_gnome.h"
54 /*****************************************************************************
55 * Inline function to retrieve the interface structure
56 *****************************************************************************/
57 static __inline__ intf_thread_t * GetIntf( GtkWidget *item, char * psz_parent )
59 return( gtk_object_get_data( GTK_OBJECT( lookup_widget(item, psz_parent) ),
64 /*****************************************************************************
66 *****************************************************************************
67 * The following callbacks are related to the main interface window.
68 *****************************************************************************/
70 on_intf_window_destroy (GtkObject *object,
73 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_window" );
75 vlc_mutex_lock( &p_intf->change_lock );
77 vlc_mutex_unlock( &p_intf->change_lock );
82 on_slider_button_press_event (GtkWidget *widget,
83 GdkEventButton *event,
86 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
88 vlc_mutex_lock( &p_intf->change_lock );
89 p_intf->p_sys->b_slider_free = 0;
90 vlc_mutex_unlock( &p_intf->change_lock );
97 on_slider_button_release_event (GtkWidget *widget,
98 GdkEventButton *event,
101 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
103 vlc_mutex_lock( &p_intf->change_lock );
104 p_intf->p_sys->b_slider_free = 1;
105 vlc_mutex_unlock( &p_intf->change_lock );
112 on_intf_window_drag_data_received (GtkWidget *widget,
113 GdkDragContext *drag_context,
116 GtkSelectionData *data,
121 char *psz_text = data->data;
122 int i_len = strlen( psz_text );
126 case DROP_ACCEPT_TEXT_PLAIN: /* FIXME: handle multiple files */
133 /* get rid of ' ' at the end */
134 *( psz_text + i_len - 1 ) = 0;
136 intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
137 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
141 case DROP_ACCEPT_TEXT_URI_LIST: /* FIXME: handle multiple files */
148 /* get rid of \r\n at the end */
149 *( psz_text + i_len - 2 ) = 0;
151 intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
152 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
157 intf_ErrMsg( "intf error: unknown dropped type");
164 on_button_chapter_prev_clicked (GtkButton *button,
167 intf_thread_t * p_intf;
168 input_area_t * p_area;
170 p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
171 p_area = p_intf->p_input->stream.p_selected_area;
173 if( p_area->i_part - 1 >= 0 )
176 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
177 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
183 on_button_chapter_next_clicked (GtkButton *button,
186 intf_thread_t * p_intf;
187 input_area_t * p_area;
189 p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
190 p_area = p_intf->p_input->stream.p_selected_area;
192 if( p_area->i_part + 1 < p_area->i_part_nb )
195 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
196 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
201 /*****************************************************************************
203 *****************************************************************************
204 * The following callbacks are related to the menubar of the main
206 *****************************************************************************/
208 on_menubar_open_activate (GtkMenuItem *menuitem,
211 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
213 /* If we have never used the file selector, open it */
214 if( p_intf->p_sys->p_fileopen == NULL)
216 p_intf->p_sys->p_fileopen = create_intf_fileopen();
217 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
221 gtk_widget_show( p_intf->p_sys->p_fileopen );
222 gdk_window_raise( p_intf->p_sys->p_fileopen->window );
227 on_menubar_disc_activate (GtkMenuItem *menuitem,
230 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
232 gtk_widget_show( p_intf->p_sys->p_disc );
233 gdk_window_raise( p_intf->p_sys->p_disc->window );
238 on_menubar_network_activate (GtkMenuItem *menuitem,
241 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
243 gtk_widget_show( p_intf->p_sys->p_network );
244 gdk_window_raise( p_intf->p_sys->p_network->window );
249 on_menubar_exit_activate (GtkMenuItem *menuitem,
252 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
254 vlc_mutex_lock( &p_intf->change_lock );
256 vlc_mutex_unlock( &p_intf->change_lock );
261 on_menubar_playlist_activate (GtkMenuItem *menuitem,
264 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
266 if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
268 p_intf->p_sys->p_playlist = create_intf_playlist();
269 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
272 gtk_widget_show( p_intf->p_sys->p_playlist );
273 gdk_window_raise( p_intf->p_sys->p_playlist->window );
278 on_menubar_audio_toggle (GtkCheckMenuItem *menuitem,
281 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
282 es_descriptor_t * p_es;
284 p_es = (es_descriptor_t*)user_data;
286 if( p_intf->p_sys->b_menus_ready )
288 input_ToggleES( p_intf->p_input, p_es, menuitem->active );
294 on_menubar_subtitle_toggle (GtkCheckMenuItem *menuitem,
297 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
298 es_descriptor_t * p_es;
300 p_es = (es_descriptor_t*)user_data;
302 if( p_intf->p_sys->b_menus_ready )
304 input_ToggleES( p_intf->p_input, p_es, menuitem->active );
310 on_menubar_title_toggle (GtkCheckMenuItem *menuitem,
313 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
315 if( menuitem->active && p_intf->p_sys->b_menus_ready )
317 p_intf->p_input->pf_set_area( p_intf->p_input,
318 (input_area_t*)user_data );
319 p_intf->p_sys->b_menus_update = 1;
320 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
326 on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem,
329 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
330 input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
331 gint i_chapter = (gint)user_data;
333 if( menuitem->active && p_intf->p_sys->b_menus_ready )
335 p_area->i_part = i_chapter;
336 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
339 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
343 on_menubar_modules_activate (GtkMenuItem *menuitem,
346 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
348 if( !GTK_IS_WIDGET( p_intf->p_sys->p_modules ) )
350 p_intf->p_sys->p_modules = create_intf_modules();
351 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_modules ),
354 gtk_widget_show( p_intf->p_sys->p_modules );
355 gdk_window_raise( p_intf->p_sys->p_modules->window );
360 on_menubar_preferences_activate (GtkMenuItem *menuitem,
368 on_menubar_about_activate (GtkMenuItem *menuitem,
371 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
373 if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
375 p_intf->p_sys->p_about = create_intf_about();
376 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
379 gtk_widget_show( p_intf->p_sys->p_about );
380 gdk_window_raise( p_intf->p_sys->p_about->window );
384 /*****************************************************************************
386 *****************************************************************************
387 * The following callbacks are related to the toolbar of the main
389 *****************************************************************************/
391 on_toolbar_open_clicked (GtkButton *button,
394 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
396 /* If we have never used the file selector, open it */
397 if( p_intf->p_sys->p_fileopen == NULL)
399 p_intf->p_sys->p_fileopen = create_intf_fileopen();
400 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
404 gtk_widget_show( p_intf->p_sys->p_fileopen );
405 gdk_window_raise( p_intf->p_sys->p_fileopen->window );
410 on_toolbar_disc_clicked (GtkButton *button,
413 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
415 gtk_widget_show( p_intf->p_sys->p_disc );
416 gdk_window_raise( p_intf->p_sys->p_disc->window );
421 on_toolbar_network_clicked (GtkButton *button,
424 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
426 gtk_widget_show( p_intf->p_sys->p_network );
427 gdk_window_raise( p_intf->p_sys->p_network->window );
432 on_toolbar_back_clicked (GtkButton *button,
440 on_toolbar_stop_clicked (GtkButton *button,
448 on_toolbar_play_clicked (GtkButton *button,
451 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
453 if( p_intf->p_input != NULL )
455 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
461 on_toolbar_pause_clicked (GtkButton *button,
464 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
466 if( p_intf->p_input != NULL )
468 input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
474 on_toolbar_slow_clicked (GtkButton *button,
477 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
479 if( p_intf->p_input != NULL )
481 input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
487 on_toolbar_fast_clicked (GtkButton *button,
490 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
492 if( p_intf->p_input != NULL )
494 input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
500 on_toolbar_playlist_clicked (GtkButton *button,
503 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
505 if( !GTK_IS_WIDGET( p_intf->p_sys->p_playlist ) )
507 p_intf->p_sys->p_playlist = create_intf_playlist();
508 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ),
511 gtk_widget_show( p_intf->p_sys->p_playlist );
512 gdk_window_raise( p_intf->p_sys->p_playlist->window );
517 on_toolbar_prev_clicked (GtkButton *button,
520 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
522 if( p_intf->p_input != NULL )
524 /* FIXME: temporary hack */
525 intf_PlaylistPrev( p_main->p_playlist );
526 intf_PlaylistPrev( p_main->p_playlist );
527 p_intf->p_input->b_eof = 1;
533 on_toolbar_next_clicked (GtkButton *button,
536 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
538 if( p_intf->p_input != NULL )
540 /* FIXME: temporary hack */
541 p_intf->p_input->b_eof = 1;
547 on_toolbar_prev_title_clicked (GtkButton *button,
550 intf_thread_t * p_intf;
551 input_area_t * p_area;
554 p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
555 i_id = p_intf->p_input->stream.p_selected_area->i_id - 1;
559 p_area = p_intf->p_input->stream.pp_areas[i_id];
560 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
561 p_intf->p_sys->b_menus_update = 1;
562 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
568 on_toolbar_next_title_clicked (GtkButton *button,
571 intf_thread_t * p_intf;
572 input_area_t * p_area;
575 p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
576 i_id = p_intf->p_input->stream.p_selected_area->i_id + 1;
578 if( i_id < p_intf->p_input->stream.i_area_nb )
580 p_area = p_intf->p_input->stream.pp_areas[i_id];
581 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
582 p_intf->p_sys->b_menus_update = 1;
583 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
588 /*****************************************************************************
590 *****************************************************************************
591 * The following callbacks are related to the popup menu. The popup
592 * menu is activated when right-clicking on the video output window.
593 *****************************************************************************/
595 on_popup_play_activate (GtkMenuItem *menuitem,
598 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
600 if( p_intf->p_input != NULL )
602 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
608 on_popup_pause_activate (GtkMenuItem *menuitem,
611 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
613 if( p_intf->p_input != NULL )
615 input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
621 on_popup_slow_activate (GtkMenuItem *menuitem,
624 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
626 if( p_intf->p_input != NULL )
628 input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
634 on_popup_fast_activate (GtkMenuItem *menuitem,
637 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
639 if( p_intf->p_input != NULL )
641 input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
647 on_popup_audio_toggle (GtkCheckMenuItem *menuitem,
650 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
651 es_descriptor_t * p_es;
653 p_es = (es_descriptor_t*)user_data;
655 if( p_intf->p_sys->b_menus_ready )
657 input_ToggleES( p_intf->p_input, p_es, menuitem->active );
663 on_popup_subtitle_toggle (GtkCheckMenuItem *menuitem,
666 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
667 es_descriptor_t * p_es;
669 p_es = (es_descriptor_t*)user_data;
671 if( p_intf->p_sys->b_menus_ready )
673 input_ToggleES( p_intf->p_input, p_es, menuitem->active );
679 on_popup_navigation_toggle (GtkCheckMenuItem *menuitem,
682 intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
684 if( menuitem->active && p_intf->p_sys->b_menus_ready )
686 input_area_t * p_area;
690 i_title = (gint)(user_data) / 100;
691 i_chapter = (gint)(user_data) - ( 100 * i_title );
693 if( i_title != p_intf->p_input->stream.p_selected_area->i_id )
695 p_intf->p_sys->b_menus_update = 1;
698 p_area = p_intf->p_input->stream.pp_areas[i_title];
699 p_area->i_part = i_chapter;
701 p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
702 input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
708 on_popup_open_activate (GtkMenuItem *menuitem,
711 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
713 /* If we have never used the file selector, open it */
714 if( p_intf->p_sys->p_fileopen == NULL)
716 p_intf->p_sys->p_fileopen = create_intf_fileopen();
717 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
721 gtk_widget_show( p_intf->p_sys->p_fileopen );
722 gdk_window_raise( p_intf->p_sys->p_fileopen->window );
727 on_popup_disc_activate (GtkMenuItem *menuitem,
730 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
732 gtk_widget_show( p_intf->p_sys->p_disc );
733 gdk_window_raise( p_intf->p_sys->p_disc->window );
738 on_popup_network_activate (GtkMenuItem *menuitem,
741 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
743 gtk_widget_show( p_intf->p_sys->p_network );
744 gdk_window_raise( p_intf->p_sys->p_network->window );
749 on_popup_about_activate (GtkMenuItem *menuitem,
752 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
754 if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
756 p_intf->p_sys->p_about = create_intf_about();
757 gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_about ),
760 gtk_widget_show( p_intf->p_sys->p_about );
761 gdk_window_raise( p_intf->p_sys->p_about->window );
766 on_popup_exit_activate (GtkMenuItem *menuitem,
769 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
771 vlc_mutex_lock( &p_intf->change_lock );
773 vlc_mutex_unlock( &p_intf->change_lock );
777 /*****************************************************************************
779 *****************************************************************************
780 * The following callbacks are related to the file requester.
781 *****************************************************************************/
783 on_intf_fileopen_destroy (GtkObject *object,
786 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_fileopen" );
788 p_intf->p_sys->p_fileopen = NULL;
793 on_fileopen_ok_clicked (GtkButton *button,
799 filesel = gtk_widget_get_toplevel (GTK_WIDGET (button));
800 gtk_widget_hide (filesel);
801 filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
803 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
808 on_fileopen_cancel_clicked (GtkButton *button,
811 gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
815 /*****************************************************************************
817 *****************************************************************************
818 * The following callbacks are related to the playlist.
819 *****************************************************************************/
821 on_intf_playlist_destroy (GtkObject *object,
824 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_playlist" );
826 p_intf->p_sys->p_playlist = NULL;
831 on_playlist_ok_clicked (GtkButton *button,
834 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_playlist" );
836 gtk_widget_hide( p_intf->p_sys->p_playlist );
841 on_playlist_close_clicked (GtkButton *button,
844 gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
849 /*****************************************************************************
850 * Module manager callbacks
851 *****************************************************************************
852 * The following callbacks are related to the module manager.
853 *****************************************************************************/
855 on_intf_modules_destroy (GtkObject *object,
863 on_modules_ok_clicked (GtkButton *button,
866 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_modules" );
868 gtk_widget_hide( p_intf->p_sys->p_modules );
873 on_modules_apply_clicked (GtkButton *button,
881 on_modules_cancel_clicked (GtkButton *button,
884 gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
888 /*****************************************************************************
889 * Open disc callbacks
890 *****************************************************************************
891 * The following callbacks are related to the disc manager.
892 *****************************************************************************/
894 on_disc_dvd_toggled (GtkToggleButton *togglebutton,
897 if( togglebutton->active )
899 gtk_entry_set_text( GTK_ENTRY( lookup_widget(
900 GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
906 on_disc_vcd_toggled (GtkToggleButton *togglebutton,
909 if( togglebutton->active )
911 gtk_entry_set_text( GTK_ENTRY( lookup_widget(
912 GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
918 on_disc_ok_clicked (GtkButton *button,
921 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
922 char *psz_device, *psz_source, *psz_method;
924 psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
925 GTK_WIDGET(button), "disc_name" ) ) );
927 /* "dvd:foo" has size 5 + strlen(foo) */
928 psz_source = malloc( 5 + strlen( psz_device ) );
929 if( psz_source == NULL )
934 /* Check which method was activated */
935 if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
936 "disc_dvd" ) )->active )
939 p_intf->p_sys->i_intf_mode = DVD_MODE;
940 p_intf->p_sys->b_mode_changed = 1;
942 else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
943 "disc_vcd" ) )->active )
949 intf_ErrMsg( "intf error: unknown disc type toggle button position" );
954 /* Select title and chapter */
955 main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
956 GTK_SPIN_BUTTON( lookup_widget(
957 GTK_WIDGET(button), "disc_title" ) ) ) );
959 main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
960 GTK_SPIN_BUTTON( lookup_widget(
961 GTK_WIDGET(button), "disc_chapter" ) ) ) );
963 /* Build source name and add it to playlist */
964 sprintf( psz_source, "%s:%s", psz_method, psz_device );
965 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
968 gtk_widget_hide( p_intf->p_sys->p_disc );
973 on_disc_cancel_clicked (GtkButton *button,
976 gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
980 /*****************************************************************************
981 * Network stream callbacks
982 *****************************************************************************
983 * The following callbacks are related to the network stream manager.
984 *****************************************************************************/
986 on_network_ok_clicked (GtkButton *button,
989 intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_network" );
990 char *psz_source, *psz_server, *psz_protocol;
993 psz_server = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
994 GTK_WIDGET(button), "network_server" ) ) );
996 /* Check which protocol was activated */
997 if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
998 "network_ts" ) )->active )
1000 psz_protocol = "ts";
1002 else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
1003 "network_rtp" ) )->active )
1005 psz_protocol = "rtp";
1009 intf_ErrMsg( "intf error: unknown protocol toggle button position" );
1013 /* Get the port number and make sure it will not overflow 5 characters */
1014 i_port = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(
1015 lookup_widget( GTK_WIDGET(button), "network_port" ) ) );
1016 if( i_port > 65535 )
1018 intf_ErrMsg( "intf error: invalid port %i", i_port );
1021 /* Allocate room for "protocol://server:port" */
1022 psz_source = malloc( strlen( psz_protocol ) + strlen( psz_server ) + 10 );
1023 if( psz_source == NULL )
1028 /* Build source name and add it to playlist */
1029 sprintf( psz_source, "%s://%s:%i", psz_protocol, psz_server, i_port );
1030 intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
1033 gtk_widget_hide( p_intf->p_sys->p_network );
1038 on_network_cancel_clicked (GtkButton *button,
1041 gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );