Commit bc2eeefc authored by Sam Hocevar's avatar Sam Hocevar

  * Added DVD/VCD button and menu for quick DVD device selection to the
    Gnome and Gtk+ interfaces, so that vlc can play a DVD even when
    launched from a GUI.
parent 28e3820e
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.26 2001/03/03 11:01:07 sam Exp $ * $Id: input_dvd.c,v 1.27 2001/03/04 03:12:00 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -601,7 +601,8 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -601,7 +601,8 @@ static int DVDSetArea( input_thread_t * p_input,
break; break;
default: default:
i_id = 0; i_id = 0;
intf_ErrMsg( "dvd error: unkown audio" ); intf_ErrMsg( "dvd error: unknown audio type %.2x",
p_method->ifo.vts.mat.p_audio_atrt[i].i_coding_mode );
} }
intf_WarnMsg( 1, "dvd info: audio stream %d %s\t(0x%x)", intf_WarnMsg( 1, "dvd info: audio stream %d %s\t(0x%x)",
......
...@@ -632,3 +632,131 @@ on_popup_subtitle_activate (GtkMenuItem *menuitem, ...@@ -632,3 +632,131 @@ on_popup_subtitle_activate (GtkMenuItem *menuitem,
} }
void
on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_toolbar_disc_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_disc_ok_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
char *psz_device, *psz_source, *psz_method;
psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(button), "disc_name" ) ) );
/* "dvd:foo" has size 5 + strlen(foo) */
psz_source = malloc( 5 + strlen( psz_device ) );
if( psz_source == NULL )
{
return;
}
/* Check which method was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_dvd" ) )->active )
{
psz_method = "dvd";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_vcd" ) )->active )
{
psz_method = "vcd";
}
else
{
intf_ErrMsg( "intf error: unknown toggle button configuration" );
free( psz_source );
return;
}
/* Build source name and add it to playlist */
sprintf( psz_source, "%s:%s", psz_method, psz_device );
intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
gtk_widget_hide( p_intf->p_sys->p_disc );
}
void
on_disc_cancel_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
gtk_widget_hide( p_intf->p_sys->p_disc );
}
void
on_disc_dvd_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
if( togglebutton->active )
{
gtk_entry_set_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
}
}
void
on_disc_vcd_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
if( togglebutton->active )
{
gtk_entry_set_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
}
}
void
on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
...@@ -221,3 +221,31 @@ on_popup_audio_activate (GtkMenuItem *menuitem, ...@@ -221,3 +221,31 @@ on_popup_audio_activate (GtkMenuItem *menuitem,
void void
on_popup_subtitle_activate (GtkMenuItem *menuitem, on_popup_subtitle_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void
on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbar_disc_clicked (GtkButton *button,
gpointer user_data);
void
on_disc_ok_clicked (GtkButton *button,
gpointer user_data);
void
on_disc_cancel_clicked (GtkButton *button,
gpointer user_data);
void
on_disc_dvd_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_disc_vcd_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
static GnomeUIInfo menubar_file_menu_uiinfo[] = static GnomeUIInfo menubar_file_menu_uiinfo[] =
{ {
GNOMEUIINFO_MENU_OPEN_ITEM (on_menubar_open_activate, NULL), GNOMEUIINFO_MENU_OPEN_ITEM (on_menubar_open_activate, NULL),
{
GNOME_APP_UI_ITEM, N_("Open _disc..."),
N_("Open a DVD or VCD"),
(gpointer) on_menubar_disc_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CDROM,
0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_EXIT_ITEM (on_menubar_exit_activate, NULL), GNOMEUIINFO_MENU_EXIT_ITEM (on_menubar_exit_activate, NULL),
GNOMEUIINFO_END GNOMEUIINFO_END
...@@ -88,6 +95,7 @@ create_intf_window (void) ...@@ -88,6 +95,7 @@ create_intf_window (void)
GtkWidget *toolbar; GtkWidget *toolbar;
GtkWidget *tmp_toolbar_icon; GtkWidget *tmp_toolbar_icon;
GtkWidget *toolbar_open; GtkWidget *toolbar_open;
GtkWidget *toolbar_disc;
GtkWidget *toolbar_back; GtkWidget *toolbar_back;
GtkWidget *toolbar_stop; GtkWidget *toolbar_stop;
GtkWidget *toolbar_play; GtkWidget *toolbar_play;
...@@ -126,15 +134,20 @@ create_intf_window (void) ...@@ -126,15 +134,20 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_file_menu_uiinfo[1].widget); gtk_widget_ref (menubar_file_menu_uiinfo[1].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator1", gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_disc",
menubar_file_menu_uiinfo[1].widget, menubar_file_menu_uiinfo[1].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_file_menu_uiinfo[2].widget); gtk_widget_ref (menubar_file_menu_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_exit", gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator1",
menubar_file_menu_uiinfo[2].widget, menubar_file_menu_uiinfo[2].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_file_menu_uiinfo[3].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_exit",
menubar_file_menu_uiinfo[3].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_uiinfo[1].widget); gtk_widget_ref (menubar_uiinfo[1].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_view", gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_view",
menubar_uiinfo[1].widget, menubar_uiinfo[1].widget,
...@@ -213,6 +226,18 @@ create_intf_window (void) ...@@ -213,6 +226,18 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_open); gtk_widget_show (toolbar_open);
tmp_toolbar_icon = gnome_stock_pixmap_widget (intf_window, GNOME_STOCK_PIXMAP_CDROM);
toolbar_disc = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Disc"),
NULL, NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_ref (toolbar_disc);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "toolbar_disc", toolbar_disc,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_disc);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
tmp_toolbar_icon = gnome_stock_pixmap_widget (intf_window, GNOME_STOCK_PIXMAP_BACK); tmp_toolbar_icon = gnome_stock_pixmap_widget (intf_window, GNOME_STOCK_PIXMAP_BACK);
...@@ -387,6 +412,9 @@ create_intf_window (void) ...@@ -387,6 +412,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked", gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_open_clicked), GTK_SIGNAL_FUNC (on_toolbar_open_clicked),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_disc), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_disc_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_back), "clicked", gtk_signal_connect (GTK_OBJECT (toolbar_back), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_back_clicked), GTK_SIGNAL_FUNC (on_toolbar_back_clicked),
NULL); NULL);
...@@ -468,6 +496,13 @@ static GnomeUIInfo intf_popup_uiinfo[] = ...@@ -468,6 +496,13 @@ static GnomeUIInfo intf_popup_uiinfo[] =
}, },
GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_OPEN_ITEM (on_popup_open_activate, NULL), GNOMEUIINFO_MENU_OPEN_ITEM (on_popup_open_activate, NULL),
{
GNOME_APP_UI_ITEM, N_("Open _disc..."),
N_("Open DVD or VCD"),
(gpointer) on_popup_disc_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CDROM,
0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SEPARATOR,
{ {
GNOME_APP_UI_SUBTREE, N_("_Title"), GNOME_APP_UI_SUBTREE, N_("_Title"),
...@@ -537,45 +572,50 @@ create_intf_popup (void) ...@@ -537,45 +572,50 @@ create_intf_popup (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[6].widget); gtk_widget_ref (intf_popup_uiinfo[6].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator3", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_disc",
intf_popup_uiinfo[6].widget, intf_popup_uiinfo[6].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[7].widget); gtk_widget_ref (intf_popup_uiinfo[7].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_title", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator3",
intf_popup_uiinfo[7].widget, intf_popup_uiinfo[7].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[8].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_title",
intf_popup_uiinfo[8].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (popup_title_menu_uiinfo[0].widget); gtk_widget_ref (popup_title_menu_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_chapter", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_chapter",
popup_title_menu_uiinfo[0].widget, popup_title_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[8].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio",
intf_popup_uiinfo[8].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[9].widget); gtk_widget_ref (intf_popup_uiinfo[9].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subtitle", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio",
intf_popup_uiinfo[9].widget, intf_popup_uiinfo[9].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[10].widget); gtk_widget_ref (intf_popup_uiinfo[10].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator4", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subtitle",
intf_popup_uiinfo[10].widget, intf_popup_uiinfo[10].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[11].widget); gtk_widget_ref (intf_popup_uiinfo[11].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_about", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator4",
intf_popup_uiinfo[11].widget, intf_popup_uiinfo[11].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[12].widget); gtk_widget_ref (intf_popup_uiinfo[12].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_exit", gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_about",
intf_popup_uiinfo[12].widget, intf_popup_uiinfo[12].widget,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[13].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_exit",
intf_popup_uiinfo[13].widget,
(GtkDestroyNotify) gtk_widget_unref);
return intf_popup; return intf_popup;
} }
...@@ -812,3 +852,118 @@ create_intf_playlist (void) ...@@ -812,3 +852,118 @@ create_intf_playlist (void)
return intf_playlist; return intf_playlist;
} }
GtkWidget*
create_intf_disc (void)
{
GtkWidget *intf_disc;
GtkWidget *dialog_vbox4;
GtkWidget *frame1;
GtkWidget *vbox4;
GSList *disc_group = NULL;
GtkWidget *disc_dvd;
GtkWidget *disc_vcd;
GtkWidget *hbox1;
GtkWidget *label14;
GtkWidget *disc_name;
GtkWidget *dialog_action_area4;
GtkWidget *disc_ok;
GtkWidget *disc_cancel;
intf_disc = gnome_dialog_new (_("Open disc"), NULL);
gtk_object_set_data (GTK_OBJECT (intf_disc), "intf_disc", intf_disc);
gtk_window_set_policy (GTK_WINDOW (intf_disc), FALSE, FALSE, FALSE);
dialog_vbox4 = GNOME_DIALOG (intf_disc)->vbox;
gtk_object_set_data (GTK_OBJECT (intf_disc), "dialog_vbox4", dialog_vbox4);
gtk_widget_show (dialog_vbox4);
frame1 = gtk_frame_new (_("Disc type"));
gtk_widget_ref (frame1);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "frame1", frame1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame1);
gtk_box_pack_start (GTK_BOX (dialog_vbox4), frame1, TRUE, TRUE, 0);
vbox4 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox4);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "vbox4", vbox4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox4);
gtk_container_add (GTK_CONTAINER (frame1), vbox4);
disc_dvd = gtk_radio_button_new_with_label (disc_group, _("DVD"));
disc_group = gtk_radio_button_group (GTK_RADIO_BUTTON (disc_dvd));
gtk_widget_ref (disc_dvd);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_dvd", disc_dvd,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_dvd);
gtk_box_pack_start (GTK_BOX (vbox4), disc_dvd, FALSE, FALSE, 0);
disc_vcd = gtk_radio_button_new_with_label (disc_group, _("VCD (unsupported yet)"));
disc_group = gtk_radio_button_group (GTK_RADIO_BUTTON (disc_vcd));
gtk_widget_ref (disc_vcd);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_vcd", disc_vcd,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_vcd);
gtk_box_pack_start (GTK_BOX (vbox4), disc_vcd, FALSE, FALSE, 0);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "hbox1", hbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (dialog_vbox4), hbox1, TRUE, TRUE, 0);
label14 = gtk_label_new (_("Device name (eg. /dev/cdrom or /dev/dvd): "));
gtk_widget_ref (label14);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "label14", label14,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label14);
gtk_box_pack_start (GTK_BOX (hbox1), label14, FALSE, FALSE, 0);
disc_name = gtk_entry_new ();
gtk_widget_ref (disc_name);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_name", disc_name,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_name);
gtk_box_pack_start (GTK_BOX (hbox1), disc_name, TRUE, TRUE, 0);
gtk_entry_set_text (GTK_ENTRY (disc_name), _("/dev/dvd"));
dialog_action_area4 = GNOME_DIALOG (intf_disc)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_disc), "dialog_action_area4", dialog_action_area4);
gtk_widget_show (dialog_action_area4);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area4), 8);
gnome_dialog_append_button (GNOME_DIALOG (intf_disc), GNOME_STOCK_BUTTON_OK);
disc_ok = GTK_WIDGET (g_list_last (GNOME_DIALOG (intf_disc)->buttons)->data);
gtk_widget_ref (disc_ok);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_ok", disc_ok,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_ok);
GTK_WIDGET_SET_FLAGS (disc_ok, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (intf_disc), GNOME_STOCK_BUTTON_CANCEL);
disc_cancel = GTK_WIDGET (g_list_last (GNOME_DIALOG (intf_disc)->buttons)->data);
gtk_widget_ref (disc_cancel);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_cancel", disc_cancel,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_cancel);
GTK_WIDGET_SET_FLAGS (disc_cancel, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (disc_dvd), "toggled",
GTK_SIGNAL_FUNC (on_disc_dvd_toggled),
NULL);
gtk_signal_connect (GTK_OBJECT (disc_vcd), "toggled",
GTK_SIGNAL_FUNC (on_disc_vcd_toggled),
NULL);
gtk_signal_connect (GTK_OBJECT (disc_ok), "clicked",
GTK_SIGNAL_FUNC (on_disc_ok_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (disc_cancel), "clicked",
GTK_SIGNAL_FUNC (on_disc_cancel_clicked),
NULL);
return intf_disc;
}
...@@ -8,3 +8,4 @@ GtkWidget* create_intf_about (void); ...@@ -8,3 +8,4 @@ GtkWidget* create_intf_about (void);
GtkWidget* create_intf_fileopen (void); GtkWidget* create_intf_fileopen (void);
GtkWidget* create_intf_modules (void); GtkWidget* create_intf_modules (void);
GtkWidget* create_intf_playlist (void); GtkWidget* create_intf_playlist (void);
GtkWidget* create_intf_disc (void);
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome_sys.h: private Gnome interface description * gnome_sys.h: private Gnome interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gnome_sys.h,v 1.5 2001/02/16 06:37:09 sam Exp $ * $Id: gnome_sys.h,v 1.6 2001/03/04 03:12:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -50,6 +50,7 @@ typedef struct intf_sys_s ...@@ -50,6 +50,7 @@ typedef struct intf_sys_s
GtkWidget * p_modules; /* module manager */ GtkWidget * p_modules; /* module manager */
GtkWidget * p_about; /* about window */ GtkWidget * p_about; /* about window */
GtkWidget * p_fileopen; /* file open window */ GtkWidget * p_fileopen; /* file open window */
GtkWidget * p_disc; /* disc selection window */
/* XXX: ugly kludge */ /* XXX: ugly kludge */
void ( *pf_gtk_callback ) ( void ); void ( *pf_gtk_callback ) ( void );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface * intf_gnome.c: Gnome interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gnome.c,v 1.18 2001/02/20 23:30:15 sam Exp $ * $Id: intf_gnome.c,v 1.19 2001/03/04 03:12:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -200,6 +200,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -200,6 +200,7 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_playlist = NULL; p_intf->p_sys->p_playlist = NULL;
p_intf->p_sys->p_modules = NULL; p_intf->p_sys->p_modules = NULL;
p_intf->p_sys->p_fileopen = NULL; p_intf->p_sys->p_fileopen = NULL;
p_intf->p_sys->p_disc = NULL;
/* Store p_intf to keep an eye on it */ /* Store p_intf to keep an eye on it */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
......
...@@ -93,6 +93,20 @@ ...@@ -93,6 +93,20 @@
<stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item> <stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item>
</widget> </widget>
<widget>
<class>GtkPixmapMenuItem</class>
<name>menubar_disc</name>
<tooltip>Open a DVD or VCD</tooltip>
<signal>
<name>activate</name>
<handler>on_menubar_disc_activate</handler>
<last_modification_time>Sun, 04 Mar 2001 01:28:32 GMT</last_modification_time>
</signal>
<label>Open _disc...</label>
<right_justify>False</right_justify>
<stock_icon>GNOME_STOCK_MENU_CDROM</stock_icon>
</widget>
<widget> <widget>
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>separator1</name> <name>separator1</name>
...@@ -272,6 +286,19 @@ ...@@ -272,6 +286,19 @@
<stock_pixmap>GNOME_STOCK_PIXMAP_OPEN</stock_pixmap> <stock_pixmap>GNOME_STOCK_PIXMAP_OPEN</stock_pixmap>
</widget> </widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_disc</name>
<signal>
<name>clicked</name>
<handler>on_toolbar_disc_clicked</handler>
<last_modification_time>Sun, 04 Mar 2001 01:27:51 GMT</last_modification_time>
</signal>
<label>Disc</label>
<stock_pixmap>GNOME_STOCK_PIXMAP_CDROM</stock_pixmap>
</widget>
<widget> <widget>
<class>GtkButton</class> <class>GtkButton</class>
<child_name>Toolbar:button</child_name> <child_name>Toolbar:button</child_name>
...@@ -585,6 +612,20 @@ ...@@ -585,6 +612,20 @@
<stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item> <stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item>
</widget> </widget>
<widget>
<class>GtkPixmapMenuItem</class>
<name>popup_disc</name>
<tooltip>Open DVD or VCD</tooltip>
<signal>
<name>activate</name>
<handler>on_popup_disc_activate</handler>
<last_modification_time>Sun, 04 Mar 2001 02:57:11 GMT</last_modification_time>
</signal>
<label>Open _disc...</label>
<right_justify>False</right_justify>
<stock_icon>GNOME_STOCK_MENU_CDROM</stock_icon>
</widget>
<widget> <widget>
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>separator3</name> <name>separator3</name>
...@@ -1001,4 +1042,179 @@ Henri Fallon &lt;henri@via.ecp.fr&gt; ...@@ -1001,4 +1042,179 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;
</widget> </widget>
</widget> </widget>
<widget>
<class>GnomeDialog</class>
<name>intf_disc</name>
<title>Open disc</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox4</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area4</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>disc_ok</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_disc_ok_clicked</handler>
<last_modification_time>Sun, 04 Mar 2001 01:33:55 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>disc_cancel</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_disc_cancel_clicked</handler>
<last_modification_time>Sun, 04 Mar 2001 01:33:50 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame1</name>
<label>Disc type</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox4</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>disc_dvd</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_disc_dvd_toggled</handler>
<last_modification_time>Sun, 04 Mar 2001 02:12:52 GMT</last_modification_time>
</signal>
<label>DVD</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>disc</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>disc_vcd</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_disc_vcd_toggled</handler>
<last_modification_time>Sun, 04 Mar 2001 02:12:58 GMT</last_modification_time>
</signal>
<label>VCD (unsupported yet)</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>disc</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox1</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label14</name>
<label>Device name (eg. /dev/cdrom or /dev/dvd): </label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>disc_name</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>/dev/dvd</text>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface> </GTK-Interface>
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <stdlib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "config.h" #include "config.h"
...@@ -594,3 +596,131 @@ on_about_ok_clicked (GtkButton *button, ...@@ -594,3 +596,131 @@ on_about_ok_clicked (GtkButton *button,
gtk_widget_hide( p_intf->p_sys->p_about ); gtk_widget_hide( p_intf->p_sys->p_about );
} }
void
on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_toolbar_disc_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_disc_ok_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
char *psz_device, *psz_source, *psz_method;
psz_device = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(button), "disc_name" ) ) );
/* "dvd:foo" has size 5 + strlen(foo) */
psz_source = malloc( 5 + strlen( psz_device ) );
if( psz_source == NULL )
{
return;
}
/* Check which method was activated */
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_dvd" ) )->active )
{
psz_method = "dvd";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"disc_vcd" ) )->active )
{
psz_method = "vcd";
}
else
{
intf_ErrMsg( "intf error: unknown toggle button configuration" );
free( psz_source );
return;
}
/* Build source name and add it to playlist */
sprintf( psz_source, "%s:%s", psz_method, psz_device );
intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_source );
gtk_widget_hide( p_intf->p_sys->p_disc );
}
void
on_disc_cancel_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_disc" );
gtk_widget_hide( p_intf->p_sys->p_disc );
}
void
on_disc_dvd_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
if( togglebutton->active )
{
gtk_entry_set_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/dvd" );
}
}
void
on_disc_vcd_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
if( togglebutton->active )
{
gtk_entry_set_text( GTK_ENTRY( lookup_widget(
GTK_WIDGET(togglebutton), "disc_name" ) ), "/dev/cdrom" );
}
}
void
on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_disc ) )
{
p_intf->p_sys->p_disc = create_intf_disc();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_disc ),
"p_intf", p_intf );
}
gtk_widget_show( p_intf->p_sys->p_disc );
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
...@@ -157,3 +157,31 @@ void ...@@ -157,3 +157,31 @@ void
on_about_ok_clicked (GtkButton *button, on_about_ok_clicked (GtkButton *button,
gpointer user_data); gpointer user_data);
void
on_disc_dvd_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_disc_vcd_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_disc_ok_clicked (GtkButton *button,
gpointer user_data);
void
on_disc_cancel_clicked (GtkButton *button,
gpointer user_data);
void
on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbar_disc_clicked (GtkButton *button,
gpointer user_data);
void
on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
...@@ -30,6 +30,7 @@ create_intf_window (void) ...@@ -30,6 +30,7 @@ create_intf_window (void)
GtkWidget *menubar_file_menu; GtkWidget *menubar_file_menu;
GtkAccelGroup *menubar_file_menu_accels; GtkAccelGroup *menubar_file_menu_accels;
GtkWidget *menubar_open; GtkWidget *menubar_open;
GtkWidget *menubar_disc;
GtkWidget *separator4; GtkWidget *separator4;
GtkWidget *menubar_exit; GtkWidget *menubar_exit;
GtkWidget *menubar_view; GtkWidget *menubar_view;
...@@ -48,6 +49,7 @@ create_intf_window (void) ...@@ -48,6 +49,7 @@ create_intf_window (void)
GtkWidget *handlebox1; GtkWidget *handlebox1;
GtkWidget *toolbar; GtkWidget *toolbar;
GtkWidget *toolbar_open; GtkWidget *toolbar_open;
GtkWidget *toolbar_disc;
GtkWidget *toolbar_back; GtkWidget *toolbar_back;
GtkWidget *toolbar_stop; GtkWidget *toolbar_stop;
GtkWidget *toolbar_play; GtkWidget *toolbar_play;
...@@ -127,6 +129,18 @@ create_intf_window (void) ...@@ -127,6 +129,18 @@ create_intf_window (void)
GDK_F3, 0, GDK_F3, 0,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
menubar_disc = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_disc)->child),
_("Open _disc..."));
gtk_widget_add_accelerator (menubar_disc, "activate_item", menubar_file_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (menubar_disc);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_disc", menubar_disc,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar_disc);
gtk_container_add (GTK_CONTAINER (menubar_file_menu), menubar_disc);
gtk_tooltips_set_tip (tooltips, menubar_disc, _("Open a DVD or VCD"), NULL);
separator4 = gtk_menu_item_new (); separator4 = gtk_menu_item_new ();
gtk_widget_ref (separator4); gtk_widget_ref (separator4);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator4", separator4, gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator4", separator4,
...@@ -284,6 +298,17 @@ create_intf_window (void) ...@@ -284,6 +298,17 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_open); gtk_widget_show (toolbar_open);
toolbar_disc = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Disc"),
_("Open File"), NULL,
NULL, NULL, NULL);
gtk_widget_ref (toolbar_disc);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "toolbar_disc", toolbar_disc,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_disc);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
toolbar_back = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar), toolbar_back = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
...@@ -441,6 +466,9 @@ create_intf_window (void) ...@@ -441,6 +466,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (menubar_open), "activate", gtk_signal_connect (GTK_OBJECT (menubar_open), "activate",
GTK_SIGNAL_FUNC (on_menubar_open_activate), GTK_SIGNAL_FUNC (on_menubar_open_activate),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (menubar_disc), "activate",
GTK_SIGNAL_FUNC (on_menubar_disc_activate),
NULL);
gtk_signal_connect (GTK_OBJECT (menubar_exit), "activate", gtk_signal_connect (GTK_OBJECT (menubar_exit), "activate",
GTK_SIGNAL_FUNC (on_menubar_exit_activate), GTK_SIGNAL_FUNC (on_menubar_exit_activate),
NULL); NULL);
...@@ -459,6 +487,9 @@ create_intf_window (void) ...@@ -459,6 +487,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked", gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_open_clicked), GTK_SIGNAL_FUNC (on_toolbar_open_clicked),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_disc), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_disc_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_back), "clicked", gtk_signal_connect (GTK_OBJECT (toolbar_back), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_back_clicked), GTK_SIGNAL_FUNC (on_toolbar_back_clicked),
NULL); NULL);
...@@ -512,9 +543,13 @@ create_intf_popup (void) ...@@ -512,9 +543,13 @@ create_intf_popup (void)
GtkWidget *popup_fast; GtkWidget *popup_fast;
GtkWidget *separator6; GtkWidget *separator6;
GtkWidget *popup_open; GtkWidget *popup_open;
GtkWidget *popup_disc;
GtkWidget *separator5; GtkWidget *separator5;
GtkWidget *popup_about; GtkWidget *popup_about;
GtkWidget *popup_exit; GtkWidget *popup_exit;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
intf_popup = gtk_menu_new (); intf_popup = gtk_menu_new ();
gtk_object_set_data (GTK_OBJECT (intf_popup), "intf_popup", intf_popup); gtk_object_set_data (GTK_OBJECT (intf_popup), "intf_popup", intf_popup);
...@@ -571,6 +606,18 @@ create_intf_popup (void) ...@@ -571,6 +606,18 @@ create_intf_popup (void)
gtk_widget_show (popup_open); gtk_widget_show (popup_open);
gtk_container_add (GTK_CONTAINER (intf_popup), popup_open); gtk_container_add (GTK_CONTAINER (intf_popup), popup_open);
popup_disc = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (popup_disc)->child),
_("Open _disc..."));
gtk_widget_add_accelerator (popup_disc, "activate_item", intf_popup_accels,
tmp_key, 0, 0);
gtk_widget_ref (popup_disc);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_disc", popup_disc,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (popup_disc);
gtk_container_add (GTK_CONTAINER (intf_popup), popup_disc);
gtk_tooltips_set_tip (tooltips, popup_disc, _("Open DVD or VCD"), NULL);
separator5 = gtk_menu_item_new (); separator5 = gtk_menu_item_new ();
gtk_widget_ref (separator5); gtk_widget_ref (separator5);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator5", separator5, gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator5", separator5,
...@@ -616,6 +663,9 @@ create_intf_popup (void) ...@@ -616,6 +663,9 @@ create_intf_popup (void)
gtk_signal_connect (GTK_OBJECT (popup_open), "activate", gtk_signal_connect (GTK_OBJECT (popup_open), "activate",
GTK_SIGNAL_FUNC (on_popup_open_activate), GTK_SIGNAL_FUNC (on_popup_open_activate),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (popup_disc), "activate",
GTK_SIGNAL_FUNC (on_popup_disc_activate),
NULL);
gtk_signal_connect (GTK_OBJECT (popup_about), "activate", gtk_signal_connect (GTK_OBJECT (popup_about), "activate",
GTK_SIGNAL_FUNC (on_popup_about_activate), GTK_SIGNAL_FUNC (on_popup_about_activate),
NULL); NULL);
...@@ -623,6 +673,8 @@ create_intf_popup (void) ...@@ -623,6 +673,8 @@ create_intf_popup (void)
GTK_SIGNAL_FUNC (on_popup_exit_activate), GTK_SIGNAL_FUNC (on_popup_exit_activate),
NULL); NULL);
gtk_object_set_data (GTK_OBJECT (intf_popup), "tooltips", tooltips);
return intf_popup; return intf_popup;
} }
...@@ -705,7 +757,6 @@ create_intf_about (void) ...@@ -705,7 +757,6 @@ create_intf_about (void)
dialog_action_area = GTK_DIALOG (intf_about)->action_area; dialog_action_area = GTK_DIALOG (intf_about)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_about), "dialog_action_area", dialog_action_area); gtk_object_set_data (GTK_OBJECT (intf_about), "dialog_action_area", dialog_action_area);
gtk_widget_show (dialog_action_area); gtk_widget_show (dialog_action_area);
gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area), 10);
about_ok = gtk_button_new_with_label (_("OK")); about_ok = gtk_button_new_with_label (_("OK"));
gtk_widget_ref (about_ok); gtk_widget_ref (about_ok);
...@@ -757,3 +808,134 @@ create_intf_fileopen (void) ...@@ -757,3 +808,134 @@ create_intf_fileopen (void)
return intf_fileopen; return intf_fileopen;
} }
GtkWidget*
create_intf_disc (void)
{
GtkWidget *intf_disc;
GtkWidget *dialog_vbox2;
GtkWidget *vbox4;
GtkWidget *frame2;
GtkWidget *vbox5;
GSList *disc_group = NULL;
GtkWidget *disc_dvd;
GtkWidget *disc_vcd;
GtkWidget *hbox2;
GtkWidget *label19;
GtkWidget *entry2;
GtkWidget *dialog_action_area1;
GtkWidget *hbox1;
GtkWidget *disc_ok;
GtkWidget *disc_cancel;
intf_disc = gtk_dialog_new ();
gtk_object_set_data (GTK_OBJECT (intf_disc), "intf_disc", intf_disc);
gtk_window_set_title (GTK_WINDOW (intf_disc), _("Open disc"));
gtk_window_set_policy (GTK_WINDOW (intf_disc), FALSE, FALSE, FALSE);
dialog_vbox2 = GTK_DIALOG (intf_disc)->vbox;
gtk_object_set_data (GTK_OBJECT (intf_disc), "dialog_vbox2", dialog_vbox2);
gtk_widget_show (dialog_vbox2);
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox2), 10);
vbox4 = gtk_vbox_new (FALSE, 5);
gtk_widget_ref (vbox4);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "vbox4", vbox4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox4);
gtk_box_pack_start (GTK_BOX (dialog_vbox2), vbox4, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox4), 5);
frame2 = gtk_frame_new (_("Disc type"));
gtk_widget_ref (frame2);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "frame2", frame2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame2);
gtk_box_pack_start (GTK_BOX (vbox4), frame2, TRUE, TRUE, 0);
vbox5 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox5);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "vbox5", vbox5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox5);
gtk_container_add (GTK_CONTAINER (frame2), vbox5);
disc_dvd = gtk_radio_button_new_with_label (disc_group, _("DVD"));
disc_group = gtk_radio_button_group (GTK_RADIO_BUTTON (disc_dvd));
gtk_widget_ref (disc_dvd);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_dvd", disc_dvd,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_dvd);
gtk_box_pack_start (GTK_BOX (vbox5), disc_dvd, FALSE, FALSE, 0);
disc_vcd = gtk_radio_button_new_with_label (disc_group, _("VCD (unsupported yet)"));
disc_group = gtk_radio_button_group (GTK_RADIO_BUTTON (disc_vcd));
gtk_widget_ref (disc_vcd);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_vcd", disc_vcd,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_vcd);
gtk_box_pack_start (GTK_BOX (vbox5), disc_vcd, FALSE, FALSE, 0);
hbox2 = gtk_hbox_new (FALSE, 5);
gtk_widget_ref (hbox2);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "hbox2", hbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox4), hbox2, TRUE, TRUE, 0);
label19 = gtk_label_new (_("Device name (eg. /dev/cdrom or /dev/dvd):"));
gtk_widget_ref (label19);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "label19", label19,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label19);
gtk_box_pack_start (GTK_BOX (hbox2), label19, FALSE, FALSE, 0);
entry2 = gtk_entry_new ();
gtk_widget_ref (entry2);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "entry2", entry2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (entry2);
gtk_box_pack_start (GTK_BOX (hbox2), entry2, TRUE, TRUE, 0);
gtk_entry_set_text (GTK_ENTRY (entry2), _("/dev/dvd"));
dialog_action_area1 = GTK_DIALOG (intf_disc)->action_area;
gtk_object_set_data (GTK_OBJECT (intf_disc), "dialog_action_area1", dialog_action_area1);
gtk_widget_show (dialog_action_area1);
hbox1 = gtk_hbox_new (TRUE, 5);
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "hbox1", hbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox1);
gtk_box_pack_end (GTK_BOX (dialog_action_area1), hbox1, FALSE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 10);
disc_ok = gtk_button_new_with_label (_("OK"));
gtk_widget_ref (disc_ok);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_ok", disc_ok,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_ok);
gtk_box_pack_start (GTK_BOX (hbox1), disc_ok, FALSE, TRUE, 0);
disc_cancel = gtk_button_new_with_label (_("Cancel"));
gtk_widget_ref (disc_cancel);
gtk_object_set_data_full (GTK_OBJECT (intf_disc), "disc_cancel", disc_cancel,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (disc_cancel);
gtk_box_pack_start (GTK_BOX (hbox1), disc_cancel, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (disc_dvd), "toggled",
GTK_SIGNAL_FUNC (on_disc_dvd_toggled),
NULL);
gtk_signal_connect (GTK_OBJECT (disc_vcd), "toggled",
GTK_SIGNAL_FUNC (on_disc_vcd_toggled),
NULL);
gtk_signal_connect (GTK_OBJECT (disc_ok), "clicked",
GTK_SIGNAL_FUNC (on_disc_ok_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (disc_cancel), "clicked",
GTK_SIGNAL_FUNC (on_disc_cancel_clicked),
NULL);
return intf_disc;
}
...@@ -6,3 +6,4 @@ GtkWidget* create_intf_window (void); ...@@ -6,3 +6,4 @@ GtkWidget* create_intf_window (void);
GtkWidget* create_intf_popup (void); GtkWidget* create_intf_popup (void);
GtkWidget* create_intf_about (void); GtkWidget* create_intf_about (void);
GtkWidget* create_intf_fileopen (void); GtkWidget* create_intf_fileopen (void);
GtkWidget* create_intf_disc (void);
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_sys.h: private Gtk+ interface description * gtk_sys.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_sys.h,v 1.1 2001/02/21 11:49:18 sam Exp $ * $Id: gtk_sys.h,v 1.2 2001/03/04 03:12:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -50,6 +50,7 @@ typedef struct intf_sys_s ...@@ -50,6 +50,7 @@ typedef struct intf_sys_s
GtkWidget * p_modules; /* module manager */ GtkWidget * p_modules; /* module manager */
GtkWidget * p_about; /* about window */ GtkWidget * p_about; /* about window */
GtkWidget * p_fileopen; /* file open window */ GtkWidget * p_fileopen; /* file open window */
GtkWidget * p_disc; /* disc selection window */
/* XXX: ugly kludge */ /* XXX: ugly kludge */
void ( *pf_gtk_callback ) ( void ); void ( *pf_gtk_callback ) ( void );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface * intf_gtk.c: Gtk+ interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.c,v 1.1 2001/02/21 11:49:18 sam Exp $ * $Id: intf_gtk.c,v 1.2 2001/03/04 03:12:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -202,6 +202,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -202,6 +202,7 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_playlist = NULL; p_intf->p_sys->p_playlist = NULL;
p_intf->p_sys->p_modules = NULL; p_intf->p_sys->p_modules = NULL;
p_intf->p_sys->p_fileopen = NULL; p_intf->p_sys->p_fileopen = NULL;
p_intf->p_sys->p_disc = NULL;
/* Store p_intf to keep an eye on it */ /* Store p_intf to keep an eye on it */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
......
...@@ -93,6 +93,19 @@ ...@@ -93,6 +93,19 @@
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_disc</name>
<tooltip>Open a DVD or VCD</tooltip>
<signal>
<name>activate</name>
<handler>on_menubar_disc_activate</handler>
<last_modification_time>Sun, 04 Mar 2001 02:53:25 GMT</last_modification_time>
</signal>
<label>Open _disc...</label>
<right_justify>False</right_justify>
</widget>
<widget> <widget>
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>separator4</name> <name>separator4</name>
...@@ -248,6 +261,19 @@ ...@@ -248,6 +261,19 @@
<label>Open</label> <label>Open</label>
</widget> </widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_disc</name>
<tooltip>Open File</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_disc_clicked</handler>
<last_modification_time>Sun, 04 Mar 2001 02:55:35 GMT</last_modification_time>
</signal>
<label>Disc</label>
</widget>
<widget> <widget>
<class>GtkButton</class> <class>GtkButton</class>
<child_name>Toolbar:button</child_name> <child_name>Toolbar:button</child_name>
...@@ -539,6 +565,19 @@ ...@@ -539,6 +565,19 @@
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_disc</name>
<tooltip>Open DVD or VCD</tooltip>
<signal>
<name>activate</name>
<handler>on_popup_disc_activate</handler>
<last_modification_time>Sun, 04 Mar 2001 03:04:11 GMT</last_modification_time>
</signal>
<label>Open _disc...</label>
<right_justify>False</right_justify>
</widget>
<widget> <widget>
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>separator5</name> <name>separator5</name>
...@@ -593,7 +632,6 @@ ...@@ -593,7 +632,6 @@
<class>GtkHBox</class> <class>GtkHBox</class>
<child_name>Dialog:action_area</child_name> <child_name>Dialog:action_area</child_name>
<name>dialog-action_area</name> <name>dialog-action_area</name>
<border_width>10</border_width>
<homogeneous>True</homogeneous> <homogeneous>True</homogeneous>
<spacing>5</spacing> <spacing>5</spacing>
<child> <child>
...@@ -780,4 +818,206 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;</label> ...@@ -780,4 +818,206 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;</label>
</widget> </widget>
</widget> </widget>
<widget>
<class>GtkDialog</class>
<name>intf_disc</name>
<title>Open disc</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<child_name>Dialog:vbox</child_name>
<name>dialog-vbox2</name>
<border_width>10</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<child_name>Dialog:action_area</child_name>
<name>dialog-action_area1</name>
<homogeneous>True</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox1</name>
<border_width>10</border_width>
<homogeneous>True</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>disc_ok</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_disc_ok_clicked</handler>
<last_modification_time>Sun, 04 Mar 2001 02:45:24 GMT</last_modification_time>
</signal>
<label>OK</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>disc_cancel</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_disc_cancel_clicked</handler>
<last_modification_time>Sun, 04 Mar 2001 02:45:45 GMT</last_modification_time>
</signal>
<label>Cancel</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox4</name>
<border_width>5</border_width>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkFrame</class>
<name>frame2</name>
<label>Disc type</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox5</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>disc_dvd</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_disc_dvd_toggled</handler>
<last_modification_time>Sun, 04 Mar 2001 02:50:56 GMT</last_modification_time>
</signal>
<label>DVD</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>disc</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>disc_vcd</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_disc_vcd_toggled</handler>
<last_modification_time>Sun, 04 Mar 2001 02:51:00 GMT</last_modification_time>
</signal>
<label>VCD (unsupported yet)</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>disc</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label19</name>
<label>Device name (eg. /dev/cdrom or /dev/dvd):</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry2</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>/dev/dvd</text>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface> </GTK-Interface>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment