23077
|
1
|
|
2 #include <sys/types.h>
|
|
3 #include <sys/stat.h>
|
|
4 #include <string.h>
|
|
5 #include <dirent.h>
|
|
6 #include <unistd.h>
|
|
7 #include <stdio.h>
|
|
8 #include <stdlib.h>
|
|
9
|
|
10 #include <gdk/gdkkeysyms.h>
|
|
11 #include <gtk/gtk.h>
|
|
12
|
|
13 #include "config.h"
|
|
14 #include "help_mp.h"
|
|
15 #include "stream/stream.h"
|
|
16
|
|
17 #include "interface.h"
|
|
18 #include "../widgets.h"
|
|
19 #include "pl.h"
|
|
20 #include "common.h"
|
|
21
|
|
22 static char * book_open_xpm[] = {
|
|
23 "16 16 4 1",
|
|
24 " c None s None",
|
|
25 ". c black",
|
|
26 "X c #808080",
|
|
27 "o c white",
|
|
28 " ",
|
|
29 " .. ",
|
|
30 " .Xo. ... ",
|
|
31 " .Xoo. ..oo. ",
|
|
32 " .Xooo.Xooo... ",
|
|
33 " .Xooo.oooo.X. ",
|
|
34 " .Xooo.Xooo.X. ",
|
|
35 " .Xooo.oooo.X. ",
|
|
36 " .Xooo.Xooo.X. ",
|
|
37 " .Xooo.oooo.X. ",
|
|
38 " .Xoo.Xoo..X. ",
|
|
39 " .Xo.o..ooX. ",
|
|
40 " .X..XXXXX. ",
|
|
41 " ..X....... ",
|
|
42 " .. ",
|
|
43 " "};
|
|
44
|
|
45 static char * book_closed_xpm[] = {
|
|
46 "16 16 6 1",
|
|
47 " c None s None",
|
|
48 ". c black",
|
|
49 "X c blue",
|
|
50 "o c yellow",
|
|
51 "O c #007FEA",
|
|
52 "# c white",
|
|
53 " ",
|
|
54 " .. ",
|
|
55 " ..XX. ",
|
|
56 " ..XXXXX. ",
|
|
57 " ..XXXXXXXX. ",
|
|
58 ".ooXXXXXXXXX. ",
|
|
59 "..ooXXXXXXXXX. ",
|
|
60 ".X.ooXXXXXXXXX. ",
|
|
61 ".XX.ooXXXXXX.. ",
|
|
62 " .XX.ooXXX..#O ",
|
|
63 " .XX.oo..##OO. ",
|
|
64 " .XX..##OO.. ",
|
|
65 " .X.#OO.. ",
|
|
66 " ..O.. ",
|
|
67 " .. ",
|
|
68 " "};
|
|
69
|
|
70 GtkWidget * PlayList = NULL;
|
|
71 static GtkWidget * CTDirTree;
|
|
72 static GtkWidget * CLFiles;
|
|
73 static GtkWidget * CLSelected;
|
|
74 static GtkWidget * Add;
|
|
75 static GtkWidget * Remove;
|
|
76 static GtkWidget * Ok;
|
|
77 static GtkWidget * Cancel;
|
|
78 static GdkPixmap * pxOpenedBook;
|
|
79 static GdkPixmap * pxClosedBook;
|
|
80 static GdkBitmap * msOpenedBook;
|
|
81 static GdkBitmap * msClosedBook;
|
|
82
|
|
83 static int NrOfEntrys = 0;
|
|
84 static int NrOfSelected = 0;
|
|
85 static int * CLFileSelected = NULL;
|
|
86 static int * CLListSelected = NULL;
|
|
87
|
|
88 static int sigSel;
|
|
89 static int sigUnsel;
|
|
90
|
|
91 typedef struct
|
|
92 {
|
|
93 int scaned;
|
|
94 char * path;
|
|
95 } DirNodeType;
|
|
96
|
|
97 static GtkCTreeNode * sibling;
|
|
98 static GtkCTreeNode * parent;
|
|
99 static gchar * current_path;
|
|
100 static gchar * old_path = NULL;
|
|
101
|
|
102 static int compare_func(const void *a, const void *b)
|
|
103 {
|
|
104 char * tmp;
|
|
105 int i;
|
|
106 if ( !a || !b || !( (DirNodeType *)a )->path ) return -1;
|
|
107 tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0;
|
|
108 i=strcmp( ( (DirNodeType *)a )->path,tmp );
|
|
109 free( tmp );
|
|
110 return i;
|
|
111 }
|
|
112
|
|
113 static void scan_dir( char * path );
|
|
114
|
|
115 void ShowPlayList( void )
|
|
116 {
|
|
117 if ( PlayList ) gtkActive( PlayList );
|
|
118 else PlayList=create_PlayList();
|
|
119
|
|
120 if ( old_path && *old_path )
|
|
121 {
|
|
122 char * currentdir = strdup( old_path );
|
|
123 char * tpath,* pos;
|
|
124 GtkCTreeNode * node,* nextnode;
|
|
125 gboolean leaf;
|
|
126 tpath=strdup( "/" );
|
|
127 pos=strtok( currentdir,"/" );
|
|
128 node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func );
|
|
129 do
|
|
130 {
|
|
131 char * tpathnew = g_strconcat( tpath,pos,"/",NULL );
|
|
132 free( tpath ); tpath=tpathnew;
|
|
133 nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func );
|
|
134 if ( !nextnode ) break;
|
|
135 node=nextnode;
|
|
136 pos=strtok( NULL,"/" );
|
|
137 gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL );
|
|
138 if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node );
|
|
139 else
|
|
140 {
|
|
141 DirNodeType * DirNode;
|
|
142 gtk_ctree_select( GTK_CTREE( CTDirTree ),node );
|
|
143 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
|
|
144 current_path=DirNode->path;
|
|
145 scan_dir( DirNode->path );
|
|
146 if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
|
|
147 break;
|
|
148 }
|
|
149 } while( pos );
|
|
150 free( tpath );
|
|
151 free( currentdir );
|
|
152 }
|
|
153 else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent );
|
|
154
|
|
155 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
|
|
156 gtk_clist_clear( GTK_CLIST( CLSelected ) );
|
|
157 if ( plList )
|
|
158 {
|
|
159 plItem * next = plList;
|
|
160 while ( next || next->next )
|
|
161 {
|
|
162 char * text[1][3]; text[0][2]="";
|
|
163 text[0][0]=next->name;
|
|
164 text[0][1]=next->path;
|
|
165 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
|
|
166 NrOfSelected++;
|
|
167 if ( next->next ) next=next->next; else break;
|
|
168 }
|
|
169 CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) );
|
|
170 }
|
|
171 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
|
|
172
|
|
173 gtk_widget_show( PlayList );
|
|
174 }
|
|
175
|
|
176 void HidePlayList( void )
|
|
177 {
|
|
178 if ( !PlayList ) return;
|
|
179 NrOfSelected=NrOfEntrys=0;
|
|
180 gfree( (void **)&CLListSelected ); gfree( (void **)&CLFileSelected );
|
|
181 if ( old_path ) free( old_path ); old_path=strdup( current_path );
|
|
182 gtk_widget_hide( PlayList );
|
|
183 gtk_widget_destroy( PlayList );
|
|
184 PlayList=NULL;
|
|
185 }
|
|
186
|
|
187 static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
|
|
188 {
|
|
189 switch ( (int) user_data )
|
|
190 {
|
|
191 case 0: CLFileSelected[row]=1; break;
|
|
192 case 1: CLListSelected[row]=1; break;
|
|
193 }
|
|
194 }
|
|
195
|
|
196 static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
|
|
197 {
|
|
198 switch ( (int) user_data )
|
|
199 {
|
|
200 case 0: CLFileSelected[row]=0; break;
|
|
201 case 1: CLListSelected[row]=0; break;
|
|
202 }
|
|
203 }
|
|
204
|
|
205 static void plButtonReleased( GtkButton * button,gpointer user_data )
|
|
206 {
|
|
207 switch ( (int) user_data )
|
|
208 {
|
|
209 case 1: // ok
|
|
210 {
|
|
211 int i;
|
|
212 if ( plList ) gtkSet( gtkDelPl,0,NULL );
|
|
213 for ( i=0;i<NrOfSelected;i++ )
|
|
214 {
|
|
215 plItem * item;
|
|
216 char * text[3];
|
|
217 item=calloc( 1,sizeof( plItem ) );
|
|
218 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] );
|
|
219 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] );
|
|
220 item->name=strdup( text[0] );
|
|
221 item->path=strdup( text[1] );
|
|
222 gtkSet( gtkAddPlItem,0,(void*)item );
|
|
223 }
|
|
224 if ( plCurrent )
|
|
225 {
|
|
226 mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
|
|
227 // guiSetDF( guiIntfStruct.Filename,plCurrent->path,plCurrent->name );
|
|
228 // guiIntfStruct.FilenameChanged=1;
|
|
229 // guiIntfStruct.StreamType=STREAMTYPE_FILE;
|
|
230 }
|
|
231 }
|
|
232 case 0: // cancel
|
|
233 HidePlayList();
|
|
234 break;
|
|
235 case 2: // remove
|
|
236 {
|
|
237 int i; int j; int c=0;
|
|
238
|
|
239 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
|
|
240 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
|
|
241
|
|
242 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
|
|
243 for ( i=0;i<NrOfSelected-c;i++ )
|
|
244 if ( CLListSelected[i] )
|
|
245 {
|
|
246 gtk_clist_remove( GTK_CLIST( CLSelected ),i - c );
|
|
247 c++;
|
|
248 for ( j=i;j<NrOfSelected-c;j++ )
|
|
249 CLListSelected[i] = CLListSelected[i+1];
|
|
250 }
|
|
251 NrOfSelected-=c;
|
|
252 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
|
|
253
|
|
254 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );
|
|
255 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel );
|
|
256
|
|
257 }
|
|
258 break;
|
|
259 case 3: // add
|
|
260 {
|
|
261 int i;
|
|
262 char * itext[1][2];
|
|
263 char * text[1][3]; text[0][2]="";
|
|
264 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
|
|
265 for ( i=0;i<NrOfEntrys;i++ )
|
|
266 {
|
|
267 if ( CLFileSelected[i] )
|
|
268 {
|
|
269 gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext );
|
|
270 text[0][0]=itext[0][0]; text[0][1]=current_path;
|
|
271 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
|
|
272 NrOfSelected++;
|
|
273 CLListSelected=realloc( CLListSelected,NrOfSelected * sizeof( int ) );
|
|
274 CLListSelected[NrOfSelected - 1]=0;
|
|
275 }
|
|
276 }
|
|
277 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
|
|
278 }
|
|
279 break;
|
|
280 }
|
|
281 }
|
|
282
|
|
283 static int check_for_subdir( gchar * path )
|
|
284 {
|
|
285 DIR * dir;
|
|
286 struct dirent * dirent;
|
|
287 struct stat statbuf;
|
|
288 gchar * npath;
|
|
289
|
|
290 if ( (dir=opendir( path )) )
|
|
291 {
|
|
292 while ( (dirent=readdir( dir )) )
|
|
293 {
|
|
294 if ( dirent->d_name[0] != '.' )
|
|
295 {
|
|
296 npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 );
|
|
297 sprintf( npath,"%s/%s",path,dirent->d_name );
|
|
298 if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) )
|
|
299 { free( npath ); closedir( dir ); return 1; }
|
|
300 free( npath );
|
|
301 }
|
|
302 }
|
|
303 closedir( dir );
|
|
304 }
|
|
305 return 0;
|
|
306 }
|
|
307
|
|
308 static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data )
|
|
309 {
|
|
310 GtkCTreeNode * node;
|
|
311 DirNodeType * DirNode;
|
|
312 gchar * text;
|
|
313 gchar * dummy = "dummy";
|
|
314 int subdir = 1;
|
|
315 DIR * dir = NULL;
|
|
316 struct dirent * dirent;
|
|
317 gchar * path;
|
|
318 struct stat statbuf;
|
|
319
|
|
320 DirNode=gtk_ctree_node_get_row_data( ctree,parent_node );
|
|
321 if ( !DirNode->scaned )
|
|
322 {
|
|
323 DirNode->scaned=1; current_path=DirNode->path;
|
|
324 gtk_clist_freeze( GTK_CLIST( ctree ) );
|
|
325 node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL );
|
|
326 gtk_ctree_remove_node( ctree,node );
|
|
327
|
|
328 if ( (dir=opendir( DirNode->path ) ) )
|
|
329 {
|
|
330 while( (dirent=readdir( dir )) )
|
|
331 {
|
|
332 path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 );
|
|
333 if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name );
|
|
334 else sprintf( path,"%s/%s",current_path,dirent->d_name );
|
|
335 text=dirent->d_name;
|
|
336
|
|
337 if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
|
|
338 {
|
|
339 DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path );
|
|
340 subdir=check_for_subdir( path );
|
|
341 node=gtk_ctree_insert_node( ctree,parent_node,NULL,&text,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
|
|
342 gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
|
|
343 if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE );
|
|
344 }
|
|
345 free( path ); path=NULL;
|
|
346 }
|
|
347 closedir( dir );
|
|
348 }
|
|
349
|
|
350 gtk_ctree_sort_node( ctree,parent_node );
|
|
351 gtk_clist_thaw( GTK_CLIST( ctree ) );
|
|
352 }
|
|
353 }
|
|
354
|
|
355 static void scan_dir( char * path )
|
|
356 {
|
|
357 DIR * dir = NULL;
|
|
358 char * curr;
|
|
359 struct dirent * dirent;
|
|
360 struct stat statbuf;
|
|
361 char * text[1][2]; text[0][1]="";
|
|
362
|
|
363 gtk_clist_clear( GTK_CLIST( CLFiles ) );
|
|
364 if ( (dir=opendir( path )) )
|
|
365 {
|
|
366 NrOfEntrys=0;
|
|
367 while( (dirent=readdir( dir )) )
|
|
368 {
|
|
369 curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name );
|
|
370 if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) )
|
|
371 {
|
|
372 text[0][0]=dirent->d_name;
|
|
373 gtk_clist_append( GTK_CLIST( CLFiles ),text[0] );
|
|
374 NrOfEntrys++;
|
|
375 }
|
|
376 free( curr );
|
|
377 }
|
|
378 closedir( dir );
|
|
379 gtk_clist_sort( GTK_CLIST( CLFiles ) );
|
|
380 }
|
|
381 }
|
|
382
|
|
383 static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton * bevent, gpointer data)
|
|
384 {
|
|
385 DirNodeType * DirNode;
|
|
386 GtkCTreeNode * node;
|
|
387 node=gtk_ctree_node_nth( GTK_CTREE( widget ),row );
|
|
388 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( widget ),node );
|
|
389 current_path=DirNode->path;
|
|
390 gtk_ctree_expand( GTK_CTREE( widget ),node );
|
|
391 scan_dir( DirNode->path );
|
|
392 if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
|
|
393 }
|
|
394
|
|
395 GtkWidget * create_PlayList( void )
|
|
396 {
|
|
397 GtkWidget * vbox1;
|
|
398 GtkWidget * hbox1;
|
|
399 GtkWidget * scrolledwindow1;
|
|
400 GtkWidget * vbox2;
|
|
401 GtkWidget * scrolledwindow2;
|
|
402 GtkWidget * scrolledwindow3;
|
|
403 GtkWidget * hbuttonbox1;
|
|
404 GtkAccelGroup * accel_group;
|
|
405 GdkColor transparent = { 0,0,0,0 };
|
|
406 gchar * root = "/";
|
|
407 gchar * dummy = "dummy";
|
|
408 DirNodeType * DirNode;
|
|
409
|
|
410 accel_group=gtk_accel_group_new();
|
|
411
|
|
412 PlayList=gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
|
413 gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList );
|
|
414 gtk_widget_set_usize( PlayList,512,384 );
|
|
415 gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList );
|
|
416 gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER );
|
|
417 // gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE );
|
|
418 gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" );
|
|
419
|
|
420 gtk_widget_realize( PlayList );
|
|
421 gtkAddIcon( PlayList );
|
|
422
|
|
423 vbox1=AddVBox( AddDialogFrame( PlayList ),0 );
|
|
424 hbox1=AddHBox( NULL,1 );
|
|
425 gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 );
|
|
426
|
|
427 scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
|
|
428 gtk_widget_show( scrolledwindow1 );
|
|
429 gtk_container_add( GTK_CONTAINER(
|
|
430 AddFrame( NULL,0,hbox1,1 ) ),scrolledwindow1 );
|
|
431 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
|
|
432
|
|
433 CTDirTree=gtk_ctree_new( 1,0 );
|
|
434 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 );
|
|
435 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 );
|
|
436 gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree );
|
|
437 gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE );
|
|
438 gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 );
|
|
439 gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE );
|
|
440 gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID );
|
|
441 gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
|
|
442 gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
|
|
443
|
|
444 if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,book_closed_xpm );
|
|
445 if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,book_open_xpm );
|
|
446
|
|
447 parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
|
|
448 DirNode=malloc( sizeof( DirNodeType ) );
|
|
449 DirNode->scaned=0; DirNode->path=strdup( root );
|
|
450 gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
|
|
451 sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE );
|
|
452 gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent );
|
|
453 gtk_widget_show( CTDirTree );
|
|
454
|
|
455
|
|
456 gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0,
|
|
457 AddLabel( MSGTR_PLAYLIST_DirectoryTree,NULL ) );
|
|
458
|
|
459 vbox2=AddVBox(
|
|
460 AddFrame( NULL,1,hbox1,1 ),0 );
|
|
461
|
|
462 scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
|
|
463 gtk_widget_show( scrolledwindow2 );
|
|
464 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 );
|
|
465 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
|
|
466
|
|
467 CLFiles=gtk_clist_new( 1 );
|
|
468 gtk_widget_show( CLFiles );
|
|
469 gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles );
|
|
470 gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 );
|
|
471 gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED );
|
|
472 gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) );
|
|
473 gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE );
|
|
474
|
|
475 gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0,
|
|
476 AddLabel( MSGTR_PLAYLIST_Files,NULL ) );
|
|
477
|
|
478 AddHSeparator( vbox2 );
|
|
479
|
|
480 scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
|
|
481 gtk_widget_show( scrolledwindow3 );
|
|
482 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
|
|
483 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
|
|
484
|
|
485 CLSelected=gtk_clist_new( 2 );
|
|
486 gtk_widget_show( CLSelected );
|
|
487 gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected );
|
|
488 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 );
|
|
489 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 );
|
|
490 gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE );
|
|
491 gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) );
|
|
492 gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE );
|
|
493
|
|
494 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0,
|
|
495 AddLabel( MSGTR_PLAYLIST_Selected,NULL ) );
|
|
496
|
|
497 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1,
|
|
498 AddLabel( MSGTR_PLAYLIST_Path,NULL ) );
|
|
499
|
|
500 AddHSeparator( vbox1 );
|
|
501
|
|
502 hbuttonbox1=AddHButtonBox( vbox1 );
|
|
503 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
|
|
504 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
|
|
505
|
|
506 Add=AddButton( MSGTR_Add,hbuttonbox1 );
|
|
507 Remove=AddButton( MSGTR_Remove,hbuttonbox1 );
|
|
508 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
|
|
509 Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
|
|
510
|
|
511 gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
|
|
512
|
|
513 gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&PlayList );
|
|
514
|
|
515 gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 );
|
|
516 gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 );
|
|
517 sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 );
|
|
518 sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 );
|
|
519
|
|
520 gtk_signal_connect( GTK_OBJECT( Add ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 );
|
|
521 gtk_signal_connect( GTK_OBJECT( Remove ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 );
|
|
522 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 );
|
|
523 gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 );
|
|
524
|
|
525 gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group );
|
|
526
|
|
527 return PlayList;
|
|
528 }
|
|
529
|