annotate Gui/mplayer/gtk/url.c @ 9625:bc24dd70c6e2

many 10l for me ...
author pontscho
date Thu, 20 Mar 2003 12:42:16 +0000
parents dc27303ae528
children ad75409ed15e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
1
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
2 #include <sys/types.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
3 #include <sys/stat.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
4 #include <unistd.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
5 #include <stdlib.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
6 #include <stdio.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
7 #include <string.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
8
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
9 #include <gdk/gdkkeysyms.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
10 #include <gtk/gtk.h>
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
11
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
12 #include "url.h"
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
13 #include "common.h"
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
14 #include "../../interface.h"
8043
e5dda05f9aab cleanup
pontscho
parents: 7287
diff changeset
15 #include "../../app.h"
6335
e9bd97d5c5cc warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 6298
diff changeset
16 #include "../widgets.h"
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
17 #include "../../help_mp.h"
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
18
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
19 GtkWidget * URL = NULL;
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
20
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
21 static GtkWidget * URLCombo;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
22 static GtkWidget * URLEntry;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
23 static GList * URLComboEntrys = NULL;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
24
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
25 void ShowURLDialogBox( void )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
26 {
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
27 if ( URL ) gtkActive( URL );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
28 else URL=create_URL();
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
29
7092
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
30 if ( URLList )
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
31 {
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
32 URLItem * item = URLList;
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
33 g_list_free( URLComboEntrys );
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
34 URLComboEntrys=NULL;
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
35 while( item )
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
36 {
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
37 URLComboEntrys=g_list_append( URLComboEntrys,(gchar *)item->url );
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
38 item=item->next;
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
39 }
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
40 }
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
41
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
42 if ( URLComboEntrys )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
43 {
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
44 gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
45 gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
46 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
47
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
48 gtk_widget_show( URL );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
49 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
50
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
51 void HideURLDialogBox( void )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
52 {
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
53 if ( !URL ) return;
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
54 gtk_widget_hide( URL );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
55 gtk_widget_destroy( URL );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
56 URL=0;
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
57 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
58
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
59 static void on_Button_pressed( GtkButton * button,gpointer user_data )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
60 {
7092
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
61 URLItem * item;
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
62
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
63 if ( (int)user_data )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
64 {
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
65 gchar * str= strdup( gtk_entry_get_text( GTK_ENTRY( URLEntry ) ) );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
66
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
67 if ( str )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
68 {
7287
pontscho
parents: 7092
diff changeset
69 if ( strncmp( str,"http://",7 ) && strncmp( str,"ftp://",6 ) && strncmp( str,"mms://",6 ) )
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
70 {
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
71 gchar * tmp;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
72 tmp=malloc( strlen( str ) + 8 );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
73 sprintf( tmp,"http://%s",str );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
74 free( str ); str=tmp;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
75 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
76 URLComboEntrys=g_list_prepend( URLComboEntrys,(gchar *)str );
7092
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
77
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
78 item=calloc( 1,sizeof( URLItem ) );
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
79 item->url=gstrdup( str );
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6903
diff changeset
80 gtkSet( gtkAddURLItem,0,(void *)item );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
81
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
82 guiSetFilename( guiIntfStruct.Filename,str ); guiIntfStruct.FilenameChanged=1;
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
83 mplEventHandling( evPlayNetwork,0 );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
84 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
85 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
86 HideURLDialogBox();
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
87 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
88
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
89 GtkWidget * create_URL( void )
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
90 {
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
91 GtkWidget * vbox1;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
92 GtkWidget * hbox1;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
93 GtkWidget * hbuttonbox1;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
94 GtkWidget * Ok;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
95 GtkWidget * Cancel;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
96 GtkAccelGroup * accel_group;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
97
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
98 accel_group=gtk_accel_group_new();
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
99
8043
e5dda05f9aab cleanup
pontscho
parents: 7287
diff changeset
100 URL=gtk_window_new( GTK_WINDOW_TOPLEVEL );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
101 gtk_widget_set_name( URL,"URL" );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
102 gtk_object_set_data( GTK_OBJECT( URL ),"URL",URL );
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
103 gtk_widget_set_usize( URL,384,70 );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
104 GTK_WIDGET_SET_FLAGS( URL,GTK_CAN_DEFAULT );
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
105 gtk_window_set_title( GTK_WINDOW( URL ),MSGTR_Network );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
106 gtk_window_set_position( GTK_WINDOW( URL ),GTK_WIN_POS_CENTER );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
107 gtk_window_set_policy( GTK_WINDOW( URL ),TRUE,TRUE,FALSE );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
108 gtk_window_set_wmclass( GTK_WINDOW( URL ),"Network","MPlayer" );
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
109
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
110 gtk_widget_realize( URL );
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
111 gtkAddIcon( URL );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
112
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
113 vbox1=AddVBox( AddDialogFrame( URL ),0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
114 hbox1=AddHBox( vbox1,1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
115 AddLabel( "URL: ",hbox1 );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
116
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
117 URLCombo=AddComboBox( hbox1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
118 /*
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
119 gtk_combo_new();
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
120 gtk_widget_set_name( URLCombo,"URLCombo" );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
121 gtk_widget_show( URLCombo );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
122 gtk_box_pack_start( GTK_BOX( hbox1 ),URLCombo,TRUE,TRUE,0 );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
123 */
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
124 URLEntry=GTK_COMBO( URLCombo )->entry;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
125 gtk_widget_set_name( URLEntry,"URLEntry" );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
126 gtk_widget_show( URLEntry );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
127
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
128 AddHSeparator( vbox1 );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
129
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
130 hbuttonbox1=AddHButtonBox( vbox1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
131 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
132 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
133
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
134 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
135 Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
136
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
137 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
138 gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
139
8719
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
140 gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&URL );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
141 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
142 gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
143
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6335
diff changeset
144 gtk_widget_grab_focus( URLEntry );
6298
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
145 gtk_window_add_accel_group( GTK_WINDOW( URL ),accel_group );
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
146
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
147 return URL;
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
148 }
d42cb911d7f7 add network streaming support for gui
pontscho
parents:
diff changeset
149