Mercurial > mplayer.hg
diff Gui/mplayer/gtk/url.c @ 8299:5b67aed0fc28
- remove some unused/nonusable variables
- remove unneded gtk function
- replace some gtk function
- small bug fixes
author | pontscho |
---|---|
date | Wed, 27 Nov 2002 22:48:56 +0000 |
parents | e5dda05f9aab |
children | dc27303ae528 |
line wrap: on
line diff
--- a/Gui/mplayer/gtk/url.c Wed Nov 27 22:45:54 2002 +0000 +++ b/Gui/mplayer/gtk/url.c Wed Nov 27 22:48:56 2002 +0000 @@ -10,13 +10,13 @@ #include <gtk/gtk.h> #include "url.h" +#include "common.h" #include "../../interface.h" #include "../../app.h" #include "../widgets.h" #include "../../help_mp.h" -GtkWidget * URL; -int gtkVURLDialogBox = 0; +GtkWidget * URL = NULL; static GtkWidget * URLCombo; static GtkWidget * URLEntry; @@ -24,7 +24,7 @@ void ShowURLDialogBox( void ) { - if ( gtkVURLDialogBox ) gtkActive( URL ); + if ( URL ) gtkActive( URL ); else URL=create_URL(); if ( URLList ) @@ -46,21 +46,14 @@ } gtk_widget_show( URL ); - gtkVURLDialogBox=1; } void HideURLDialogBox( void ) { - if ( !gtkVURLDialogBox ) return; + if ( !URL ) return; gtk_widget_hide( URL ); gtk_widget_destroy( URL ); - gtkVURLDialogBox=0; -} - -static gboolean on_URL_destroy_event( GtkWidget * widget,GdkEvent * event,gpointer user_data ) -{ - HideURLDialogBox(); - return FALSE; + URL=0; } static void on_Button_pressed( GtkButton * button,gpointer user_data ) @@ -93,19 +86,10 @@ HideURLDialogBox(); } -static void ab_URL_show( GtkButton * button,gpointer user_data ) -{ gtkVURLDialogBox=(int)user_data; } - GtkWidget * create_URL( void ) { - GtkWidget * frame1; - GtkWidget * frame2; - GtkWidget * frame3; - GtkWidget * frame4; GtkWidget * vbox1; GtkWidget * hbox1; - GtkWidget * label1; - GtkWidget * hsep; GtkWidget * hbuttonbox1; GtkWidget * Ok; GtkWidget * Cancel; @@ -121,128 +105,41 @@ gtk_window_set_title( GTK_WINDOW( URL ),MSGTR_Network ); gtk_window_set_position( GTK_WINDOW( URL ),GTK_WIN_POS_CENTER ); gtk_window_set_policy( GTK_WINDOW( URL ),TRUE,TRUE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( URL ),MSGTR_Network,"MPlayer" ); + gtk_window_set_wmclass( GTK_WINDOW( URL ),"Network","MPlayer" ); gtk_widget_realize( URL ); gtkAddIcon( URL ); - frame1=gtk_frame_new( NULL ); - gtk_widget_set_name( frame1,"frame1" ); - gtk_widget_ref( frame1 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"frame1",frame1,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( frame1 ); - gtk_container_add( GTK_CONTAINER( URL ),frame1 ); - gtk_container_set_border_width( GTK_CONTAINER( frame1 ),1 ); - gtk_frame_set_shadow_type( GTK_FRAME( frame1 ),GTK_SHADOW_IN ); - - frame2=gtk_frame_new( NULL ); - gtk_widget_set_name( frame2,"frame2" ); - gtk_widget_ref( frame2 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"frame2",frame2,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( frame2 ); - gtk_container_add( GTK_CONTAINER( frame1 ),frame2 ); - gtk_container_set_border_width( GTK_CONTAINER( frame2 ),1 ); - gtk_frame_set_shadow_type( GTK_FRAME( frame2 ),GTK_SHADOW_NONE ); - - frame3=gtk_frame_new( NULL ); - gtk_widget_set_name( frame3,"frame3" ); - gtk_widget_ref( frame3 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"frame3",frame3,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( frame3 ); - gtk_container_add( GTK_CONTAINER( frame2 ),frame3 ); - gtk_frame_set_shadow_type( GTK_FRAME( frame3 ),GTK_SHADOW_ETCHED_OUT ); + vbox1=AddVBox( AddDialogFrame( URL ),0 ); + hbox1=AddHBox( vbox1,1 ); + AddLabel( "URL: ",hbox1 ); - frame4=gtk_frame_new( NULL ); - gtk_widget_set_name( frame4,"frame4" ); - gtk_widget_ref( frame4 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"frame4",frame4,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( frame4 ); - gtk_container_add( GTK_CONTAINER( frame3 ),frame4 ); - gtk_frame_set_shadow_type( GTK_FRAME( frame4 ),GTK_SHADOW_NONE ); - - vbox1=gtk_vbox_new( FALSE,0 ); - gtk_widget_set_name( vbox1,"vbox1" ); - gtk_widget_ref( vbox1 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"vbox1",vbox1,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( vbox1 ); - gtk_container_add( GTK_CONTAINER( frame4 ),vbox1 ); - - hbox1=gtk_hbox_new( FALSE,0 ); - gtk_widget_set_name( hbox1,"hbox1" ); - gtk_widget_ref( hbox1 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"hbox1",hbox1,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( hbox1 ); - gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 ); - - label1=gtk_label_new( "URL: " ); - gtk_widget_set_name( label1,"label1" ); - gtk_widget_ref( label1 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"label1",label1,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( label1 ); - gtk_box_pack_start( GTK_BOX( hbox1 ),label1,FALSE,FALSE,0 ); - gtk_widget_set_usize( label1,38,-2 ); - gtk_label_set_justify( GTK_LABEL( label1 ),GTK_JUSTIFY_FILL ); - gtk_misc_set_alignment( GTK_MISC( label1 ),0.5,0.49 ); - - URLCombo=gtk_combo_new(); + URLCombo=AddComboBox( hbox1 ); +/* + gtk_combo_new(); gtk_widget_set_name( URLCombo,"URLCombo" ); - gtk_widget_ref( URLCombo ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"URLCombo",URLCombo,(GtkDestroyNotify)gtk_widget_unref ); gtk_widget_show( URLCombo ); gtk_box_pack_start( GTK_BOX( hbox1 ),URLCombo,TRUE,TRUE,0 ); - +*/ URLEntry=GTK_COMBO( URLCombo )->entry; gtk_widget_set_name( URLEntry,"URLEntry" ); - gtk_widget_ref( URLEntry ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"URLEntry",URLEntry,(GtkDestroyNotify)gtk_widget_unref ); gtk_widget_show( URLEntry ); - hsep=gtk_hseparator_new(); - gtk_widget_set_name( hsep,"hsep" ); - gtk_widget_ref( hsep ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"hsep",hsep,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( hsep ); - gtk_box_pack_start( GTK_BOX( vbox1 ),hsep,FALSE,TRUE,0 ); - gtk_widget_set_usize( hsep,-2,8 ); + AddHSeparator( vbox1 ); - hbuttonbox1=gtk_hbutton_box_new(); - gtk_widget_set_name( hbuttonbox1,"hbuttonbox1" ); - gtk_widget_ref( hbuttonbox1 ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"hbuttonbox1",hbuttonbox1,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( hbuttonbox1 ); - gtk_box_pack_start( GTK_BOX( vbox1 ),hbuttonbox1,FALSE,FALSE,0 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox1 ),85,20 ); - gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox1 ),0,0 ); + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - Ok=gtk_button_new_with_label( MSGTR_Ok ); - gtk_widget_set_name( Ok,"Ok" ); - gtk_widget_ref( Ok ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"Ok",Ok,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( Ok ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Ok ); - - Cancel=gtk_button_new_with_label( MSGTR_Cancel ); - gtk_widget_set_name( Cancel,"Cancel" ); - gtk_widget_ref( Cancel ); - gtk_object_set_data_full( GTK_OBJECT( URL ),"Cancel",Cancel,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( Cancel ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Cancel ); + Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); + Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); - gtk_widget_add_accelerator( Ok,"pressed",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); -// gtk_widget_add_accelerator( Ok,"pressed",accel_group,GDK_O,GDK_MOD1_MASK,GTK_ACCEL_VISIBLE ); -// gtk_widget_add_accelerator( Ok,"pressed",accel_group,GDK_o,GDK_MOD1_MASK,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( Cancel,"pressed",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); -// gtk_widget_add_accelerator( Cancel,"pressed",accel_group,GDK_C,GDK_MOD1_MASK,GTK_ACCEL_VISIBLE ); -// gtk_widget_add_accelerator( Cancel,"pressed",accel_group,GDK_c,GDK_MOD1_MASK,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( on_URL_destroy_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( URL ),"show",GTK_SIGNAL_FUNC( ab_URL_show ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( URL ),"hide",GTK_SIGNAL_FUNC( ab_URL_show ),0 ); - - gtk_signal_connect( GTK_OBJECT( Ok ),"pressed",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( Cancel ),"pressed",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL ); + gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&URL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL ); gtk_widget_grab_focus( URLEntry ); gtk_window_add_accel_group( GTK_WINDOW( URL ),accel_group );