annotate Gui/mplayer/gtk/pl.c @ 7250:27a1315d6af4

Checked if the connection succeeded before writing in the socket.
author bertrand
date Tue, 03 Sep 2002 01:25:31 +0000
parents 35bab6be713b
children e5dda05f9aab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
1
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
2 #include <sys/types.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
3 #include <sys/stat.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
4 #include <string.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
5 #include <dirent.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
6 #include <unistd.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
7 #include <stdio.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
8 #include <stdlib.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
9
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
10 #include <gdk/gdkkeysyms.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
11 #include <gtk/gtk.h>
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
12
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
13 #include "../../../config.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
14 #include "../../../help_mp.h"
7009
98bed9e12087 - add dxr3 gui support (dialogbox, etc.)
pontscho
parents: 6905
diff changeset
15 #include "../../libmpdemux/stream.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
16
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
17 #include "../../interface.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
18 #include "../widgets.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
19 #include "pl.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
20
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
21 static char * book_open_xpm[] = {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
22 "16 16 4 1",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
23 " c None s None",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
24 ". c black",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
25 "X c #808080",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
26 "o c white",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
27 " ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
28 " .. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
29 " .Xo. ... ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
30 " .Xoo. ..oo. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
31 " .Xooo.Xooo... ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
32 " .Xooo.oooo.X. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
33 " .Xooo.Xooo.X. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
34 " .Xooo.oooo.X. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
35 " .Xooo.Xooo.X. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
36 " .Xooo.oooo.X. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
37 " .Xoo.Xoo..X. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
38 " .Xo.o..ooX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
39 " .X..XXXXX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
40 " ..X....... ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
41 " .. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
42 " "};
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
43
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
44 static char * book_closed_xpm[] = {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
45 "16 16 6 1",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
46 " c None s None",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
47 ". c black",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
48 "X c red",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
49 "o c yellow",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
50 "O c #808080",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
51 "# c white",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
52 " ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
53 " .. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
54 " ..XX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
55 " ..XXXXX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
56 " ..XXXXXXXX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
57 ".ooXXXXXXXXX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
58 "..ooXXXXXXXXX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
59 ".X.ooXXXXXXXXX. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
60 ".XX.ooXXXXXX.. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
61 " .XX.ooXXX..#O ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
62 " .XX.oo..##OO. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
63 " .XX..##OO.. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
64 " .X.#OO.. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
65 " ..O.. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
66 " .. ",
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
67 " "};
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
68
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
69 GtkWidget * PlayList;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
70 static GtkWidget * CTDirTree;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
71 static GtkWidget * CLFiles;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
72 static GtkWidget * CLSelected;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
73 static GtkWidget * Add;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
74 static GtkWidget * Remove;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
75 static GtkWidget * Ok;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
76 static GtkWidget * Cancel;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
77 static GdkPixmap * pxOpenedBook;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
78 static GdkPixmap * pxClosedBook;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
79 static GdkBitmap * msOpenedBook;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
80 static GdkBitmap * msClosedBook;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
81
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
82 static int gtkVPlaylist = 0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
83 static int NrOfEntrys = 0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
84 static int NrOfSelected = 0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
85 static int * CLFileSelected = NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
86 static int * CLListSelected = NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
87
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
88 static int sigSel;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
89 static int sigUnsel;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
90
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
91 typedef struct
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
92 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
93 int scaned;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
94 char * path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
95 } DirNodeType;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
96
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
97 static GtkCTreeNode * sibling;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
98 static GtkCTreeNode * parent;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
99 static gchar * current_path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
100 static gchar * old_path = NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
101
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
102 static int compare_func(const void *a, const void *b)
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
103 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
104 char * tmp;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
105 int i;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
106 if ( !a || !b || !( (DirNodeType *)a )->path ) return -1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
107 tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
108 i=strcmp( ( (DirNodeType *)a )->path,tmp );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
109 free( tmp );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
110 return i;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
111 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
112
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
113 static void scan_dir( char * path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
114
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
115 void ShowPlayList( void )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
116 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
117 if ( gtkVPlaylist ) gtkActive( PlayList );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
118 else PlayList=create_PlayList();
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
119
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
120 if ( old_path && *old_path )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
121 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
122 char * currentdir = strdup( old_path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
123 char * tpath,* pos;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
124 GtkCTreeNode * node,* nextnode;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
125 gboolean leaf;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
126 tpath=strdup( "/" );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
127 pos=strtok( currentdir,"/" );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
128 node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
129 do
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
130 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
131 char * tpathnew = g_strconcat( tpath,pos,"/",NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
132 free( tpath ); tpath=tpathnew;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
133 nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
134 if ( !nextnode ) break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
135 node=nextnode;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
136 pos=strtok( NULL,"/" );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
137 gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
138 if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
139 else
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
140 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
141 DirNodeType * DirNode;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
142 gtk_ctree_select( GTK_CTREE( CTDirTree ),node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
143 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
144 current_path=DirNode->path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
145 scan_dir( DirNode->path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
146 if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
147 break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
148 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
149 } while( pos );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
150 free( tpath );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
151 free( currentdir );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
152 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
153 else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
154
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
155 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
156 gtk_clist_clear( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
157 if ( plList )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
158 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
159 plItem * next = plList;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
160 while ( next || next->next )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
161 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
162 char * text[1][3]; text[0][2]="";
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
163 text[0][0]=next->name;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
164 text[0][1]=next->path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
165 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
166 NrOfSelected++;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
167 if ( next->next ) next=next->next; else break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
168 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
169 CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
170 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
171 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
172
6903
c2d4100c964e - fix mixer handling
pontscho
parents: 6854
diff changeset
173 gtk_widget_show( PlayList );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
174 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
175
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
176 void HidePlayList( void )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
177 {
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6713
diff changeset
178 if ( !gtkVPlaylist ) return;
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
179 gtkVPlaylist=NrOfSelected=NrOfEntrys=0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
180 if ( CLListSelected ) free( CLListSelected ); CLListSelected=NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
181 if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
182 if ( old_path ) free( old_path ); old_path=strdup( current_path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
183 gtk_widget_hide( PlayList );
6903
c2d4100c964e - fix mixer handling
pontscho
parents: 6854
diff changeset
184 gtk_widget_destroy( PlayList );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
185 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
186
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
187 static void plDestroy( GtkObject * object,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
188 { HidePlayList(); }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
189
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
190 static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
191 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
192 switch ( (int) user_data )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
193 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
194 case 0: CLFileSelected[row]=1; break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
195 case 1: CLListSelected[row]=1; break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
196 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
197 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
198
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
199 static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
200 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
201 switch ( (int) user_data )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
202 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
203 case 0: CLFileSelected[row]=0; break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
204 case 1: CLListSelected[row]=0; break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
205 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
206 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
207
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
208 static void plButtonReleased( GtkButton * button,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
209 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
210 switch ( (int) user_data )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
211 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
212 case 1: // ok
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
213 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
214 int i;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
215 if ( plList ) gtkSet( gtkDelPl,0,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
216 for ( i=0;i<NrOfSelected;i++ )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
217 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
218 plItem * item;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
219 char * text[3];
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
220 item=calloc( 1,sizeof( plItem ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
221 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
222 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
223 item->name=strdup( text[0] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
224 item->path=strdup( text[1] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
225 gtkSet( gtkAddPlItem,0,(void*)item );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
226 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
227 if ( plCurrent )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
228 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
229 guiSetDF( guiIntfStruct.Filename,plCurrent->path,plCurrent->name );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
230 guiIntfStruct.FilenameChanged=1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
231 guiIntfStruct.StreamType=STREAMTYPE_FILE;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
232 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
233 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
234 case 0: // cancel
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
235 HidePlayList();
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
236 break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
237 case 2: // remove
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
238 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
239 int i; int c=0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
240
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
241 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
242 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
243
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
244 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
245 for ( i=0;i<NrOfSelected;i++ )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
246 if ( CLListSelected[i] )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
247 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
248 gtk_clist_remove( GTK_CLIST( CLSelected ),i - c );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
249 c++;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
250 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
251 NrOfSelected-=c;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
252 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
253
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
254 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
255 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
256
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
257 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
258 break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
259 case 3: // add
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
260 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
261 int i;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
262 char * itext[1][2];
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
263 char * text[1][3]; text[0][2]="";
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
264 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
265 for ( i=0;i<NrOfEntrys;i++ )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
266 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
267 if ( CLFileSelected[i] )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
268 {
7092
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 7009
diff changeset
269 gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
270 text[0][0]=itext[0][0]; text[0][1]=current_path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
271 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
272 NrOfSelected++;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
273 CLListSelected=realloc( CLListSelected,NrOfSelected * sizeof( int ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
274 CLListSelected[NrOfSelected - 1]=0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
275 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
276 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
277 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
278 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
279 break;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
280 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
281 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
282
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
283 static int check_for_subdir( gchar * path )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
284 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
285 DIR * dir;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
286 struct dirent * dirent;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
287 struct stat statbuf;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
288 gchar * npath;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
289
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
290 if ( (dir=opendir( path )) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
291 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
292 while ( (dirent=readdir( dir )) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
293 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
294 if ( dirent->d_name[0] != '.' )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
295 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
296 npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
297 sprintf( npath,"%s/%s",path,dirent->d_name );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
298 if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
299 { free( npath ); closedir( dir ); return 1; }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
300 free( npath );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
301 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
302 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
303 closedir( dir );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
304 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
305 return 0;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
306 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
307
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
308 static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
309 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
310 GtkCTreeNode * node;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
311 DirNodeType * DirNode;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
312 gchar * text;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
313 gchar * dummy = "dummy";
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
314 int subdir = 1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
315 DIR * dir = NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
316 struct dirent * dirent;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
317 gchar * path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
318 struct stat statbuf;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
319
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
320 DirNode=gtk_ctree_node_get_row_data( ctree,parent_node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
321 if ( !DirNode->scaned )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
322 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
323 DirNode->scaned=1; current_path=DirNode->path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
324 gtk_clist_freeze( GTK_CLIST( ctree ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
325 node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
326 gtk_ctree_remove_node( ctree,node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
327
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
328 if ( (dir=opendir( DirNode->path ) ) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
329 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
330 while( (dirent=readdir( dir )) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
331 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
332 path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
333 if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
334 else sprintf( path,"%s/%s",current_path,dirent->d_name );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
335 text=dirent->d_name;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
336
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
337 if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
338 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
339 DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
340 subdir=check_for_subdir( path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
341 node=gtk_ctree_insert_node( ctree,parent_node,NULL,&text,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
342 gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
343 if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
344 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
345 free( path ); path=NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
346 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
347 closedir( dir );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
348 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
349
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
350 gtk_ctree_sort_node( ctree,parent_node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
351 gtk_clist_thaw( GTK_CLIST( ctree ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
352 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
353 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
354
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
355 static void scan_dir( char * path )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
356 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
357 DIR * dir = NULL;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
358 char * curr;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
359 struct dirent * dirent;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
360 struct stat statbuf;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
361 char * text[1][2]; text[0][1]="";
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
362
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
363 gtk_clist_clear( GTK_CLIST( CLFiles ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
364 if ( (dir=opendir( path )) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
365 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
366 NrOfEntrys=0;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
367 while( (dirent=readdir( dir )) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
368 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
369 curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
370 if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
371 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
372 text[0][0]=dirent->d_name;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
373 gtk_clist_append( GTK_CLIST( CLFiles ),text[0] );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
374 NrOfEntrys++;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
375 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
376 free( curr );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
377 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
378 closedir( dir );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
379 gtk_clist_sort( GTK_CLIST( CLFiles ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
380 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
381 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
382
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
383 static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton * bevent, gpointer data)
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
384 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
385 DirNodeType * DirNode;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
386 GtkCTreeNode * node;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
387 node=gtk_ctree_node_nth( GTK_CTREE( widget ),row );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
388 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( widget ),node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
389 current_path=DirNode->path;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
390 gtk_ctree_expand( GTK_CTREE( widget ),node );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
391 scan_dir( DirNode->path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
392 if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
393 }
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
394
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
395 static void plShow( GtkWidget * widget,gpointer user_data )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
396 { gtkVPlaylist=(int)user_data; }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
397
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
398 GtkWidget * create_PlayList( void )
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
399 {
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
400 GtkWidget * frame1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
401 GtkWidget * frame2;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
402 GtkWidget * frame3;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
403 GtkWidget * frame4;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
404 GtkWidget * vbox1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
405 GtkWidget * hbox1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
406 GtkWidget * frame5;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
407 GtkWidget * scrolledwindow1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
408 GtkWidget * label2;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
409 GtkWidget * frame6;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
410 GtkWidget * vbox2;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
411 GtkWidget * scrolledwindow2;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
412 GtkWidget * label3;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
413 GtkWidget * hseparator2;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
414 GtkWidget * scrolledwindow3;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
415 GtkWidget * label5;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
416 GtkWidget * hseparator1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
417 GtkWidget * hbuttonbox1;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
418 GtkAccelGroup * accel_group;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
419 GdkColor transparent = { 0 };
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
420 gchar * root = "/";
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
421 gchar * dummy = "dummy";
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
422 DirNodeType * DirNode;
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
423
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
424 accel_group=gtk_accel_group_new();
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
425
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
426 PlayList=gtk_window_new( GTK_WINDOW_DIALOG );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
427 gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
428 gtk_widget_set_usize( PlayList,512,300 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
429 gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
430 gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
431 // gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
432 gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
433
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
434 gtk_widget_realize( PlayList );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
435 gtkAddIcon( PlayList );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
436
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
437 frame1=gtk_frame_new( NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
438 gtk_widget_ref( frame1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
439 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame1",frame1,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
440 gtk_widget_show( frame1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
441 gtk_container_add( GTK_CONTAINER( PlayList ),frame1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
442 gtk_container_set_border_width( GTK_CONTAINER( frame1 ),1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
443 gtk_frame_set_shadow_type( GTK_FRAME( frame1 ),GTK_SHADOW_IN );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
444
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
445 frame2=gtk_frame_new( NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
446 gtk_widget_ref( frame2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
447 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame2",frame2,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
448 gtk_widget_show( frame2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
449 gtk_container_add( GTK_CONTAINER( frame1 ),frame2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
450 gtk_frame_set_shadow_type( GTK_FRAME( frame2 ),GTK_SHADOW_NONE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
451
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
452 frame3=gtk_frame_new( NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
453 gtk_widget_ref( frame3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
454 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame3",frame3,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
455 gtk_widget_show( frame3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
456 gtk_container_add( GTK_CONTAINER( frame2 ),frame3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
457 gtk_frame_set_shadow_type( GTK_FRAME( frame3 ),GTK_SHADOW_ETCHED_OUT );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
458
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
459 frame4=gtk_frame_new( NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
460 gtk_widget_ref( frame4 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
461 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame4",frame4,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
462 gtk_widget_show( frame4 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
463 gtk_container_add( GTK_CONTAINER( frame3 ),frame4 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
464 gtk_frame_set_shadow_type( GTK_FRAME( frame4 ),GTK_SHADOW_NONE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
465
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
466 vbox1=gtk_vbox_new( FALSE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
467 gtk_widget_ref( vbox1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
468 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"vbox1",vbox1,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
469 gtk_widget_show( vbox1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
470 gtk_container_add( GTK_CONTAINER( frame4 ),vbox1 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
471
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
472 hbox1=gtk_hbox_new( FALSE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
473 gtk_widget_ref( hbox1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
474 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbox1",hbox1,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
475 gtk_widget_show( hbox1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
476 gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
477
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
478 frame5=gtk_frame_new( NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
479 gtk_widget_ref( frame5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
480 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame5",frame5,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
481 gtk_widget_show( frame5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
482 gtk_box_pack_start( GTK_BOX( hbox1 ),frame5,TRUE,TRUE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
483 gtk_frame_set_shadow_type( GTK_FRAME( frame5 ),GTK_SHADOW_ETCHED_OUT );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
484
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
485 scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
486 gtk_widget_ref( scrolledwindow1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
487 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
488 gtk_widget_show( scrolledwindow1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
489 gtk_container_add( GTK_CONTAINER( frame5 ),scrolledwindow1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
490 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
491
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
492 CTDirTree=gtk_ctree_new( 1,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
493 gtk_widget_ref( CTDirTree );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
494 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"CTDirTree",CTDirTree,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
495 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
496 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
497 gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
498 gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
499 gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
500 gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
501 gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
502 gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
503 gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
504
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
505 gtk_widget_realize( PlayList );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
506
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
507 if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,book_closed_xpm );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
508 if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,book_open_xpm );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
509
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
510 parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
511 DirNode=malloc( sizeof( DirNodeType ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
512 DirNode->scaned=0; DirNode->path=strdup( root );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
513 gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
514 sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
515 gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
516 gtk_widget_show( CTDirTree );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
517
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
518 label2=gtk_label_new( MSGTR_PLAYLIST_DirectoryTree );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
519 gtk_widget_ref( label2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
520 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label2",label2,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
521 gtk_widget_show( label2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
522 gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0,label2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
523 gtk_misc_set_alignment( GTK_MISC( label2 ),0.02,0.5 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
524
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
525 frame6=gtk_frame_new( NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
526 gtk_widget_ref( frame6 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
527 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame6",frame6,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
528 gtk_widget_show( frame6 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
529 gtk_box_pack_start( GTK_BOX( hbox1 ),frame6,TRUE,TRUE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
530 gtk_widget_set_usize( frame6,170,-2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
531 gtk_frame_set_shadow_type( GTK_FRAME( frame6 ),GTK_SHADOW_ETCHED_OUT );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
532
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
533 vbox2=gtk_vbox_new( FALSE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
534 gtk_widget_ref( vbox2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
535 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"vbox2",vbox2,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
536 gtk_widget_show( vbox2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
537 gtk_container_add( GTK_CONTAINER( frame6 ),vbox2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
538
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
539 scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
540 gtk_widget_ref( scrolledwindow2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
541 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"scrolledwindow2",scrolledwindow2,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
542 gtk_widget_show( scrolledwindow2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
543 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
544 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
545
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
546 CLFiles=gtk_clist_new( 1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
547 gtk_widget_ref( CLFiles );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
548 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"CLFiles",CLFiles,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
549 gtk_widget_show( CLFiles );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
550 gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
551 gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 );
6905
e32d3d0d8998 - fix playlist2dvd bug
pontscho
parents: 6903
diff changeset
552 gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
553 gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
554 gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
555
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
556 label3=gtk_label_new( MSGTR_PLAYLIST_Files );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
557 gtk_widget_ref( label3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
558 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label3",label3,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
559 gtk_widget_show( label3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
560 gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0,label3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
561 gtk_misc_set_alignment( GTK_MISC( label3 ),0.02,0.5 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
562
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
563 hseparator2=gtk_hseparator_new();
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
564 gtk_widget_ref( hseparator2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
565 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hseparator2",hseparator2,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
566 gtk_widget_show( hseparator2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
567 gtk_box_pack_start( GTK_BOX( vbox2 ),hseparator2,FALSE,FALSE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
568 gtk_widget_set_usize( hseparator2,-2,3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
569
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
570 scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
571 gtk_widget_ref( scrolledwindow3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
572 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"scrolledwindow3",scrolledwindow3,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
573 gtk_widget_show( scrolledwindow3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
574 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
575 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
576
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
577 CLSelected=gtk_clist_new( 2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
578 gtk_widget_ref( CLSelected );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
579 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"CLSelected",CLSelected,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
580 gtk_widget_show( CLSelected );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
581 gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
582 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
583 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
584 gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
585 gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
586 gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
587
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
588 label5=gtk_label_new( MSGTR_PLAYLIST_Selected );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
589 gtk_widget_ref( label5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
590 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label5",label5,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
591 gtk_widget_show( label5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
592 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0,label5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
593 gtk_misc_set_alignment( GTK_MISC( label5 ),0.02,0.5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
594
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
595 label5=gtk_label_new( MSGTR_PLAYLIST_Path );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
596 gtk_widget_ref( label5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
597 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label5",label5,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
598 gtk_widget_show( label5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
599 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1,label5 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
600 gtk_misc_set_alignment( GTK_MISC( label5 ),0.02,0.5 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
601
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
602 hseparator1=gtk_hseparator_new();
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
603 gtk_widget_ref( hseparator1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
604 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hseparator1",hseparator1,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
605 gtk_widget_show( hseparator1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
606 gtk_box_pack_start( GTK_BOX( vbox1 ),hseparator1,FALSE,FALSE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
607 gtk_widget_set_usize( hseparator1,-2,6 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
608
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
609 hbuttonbox1=gtk_hbutton_box_new();
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
610 gtk_widget_ref( hbuttonbox1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
611 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbuttonbox1",hbuttonbox1,(GtkDestroyNotify)gtk_widget_unref );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
612 gtk_widget_show( hbuttonbox1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
613 gtk_box_pack_start( GTK_BOX( vbox1 ),hbuttonbox1,FALSE,FALSE,0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
614 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
615 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
616 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox1 ),-1,20 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
617 gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox1 ),0,-1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
618
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
619 Add=gtk_button_new_with_label( MSGTR_Add );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
620 gtk_widget_ref( Add );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
621 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Add",Add,(GtkDestroyNotify)gtk_widget_unref );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
622 gtk_widget_show( Add );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
623 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Add );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
624 GTK_WIDGET_UNSET_FLAGS( Add,GTK_CAN_FOCUS );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
625
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
626 Remove=gtk_button_new_with_label( MSGTR_Remove );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
627 gtk_widget_ref( Remove );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
628 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Remove",Remove,(GtkDestroyNotify)gtk_widget_unref );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
629 gtk_widget_show( Remove );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
630 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Remove );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
631 GTK_WIDGET_UNSET_FLAGS( Remove,GTK_CAN_FOCUS );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
632
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
633 Ok=gtk_button_new_with_label( MSGTR_Ok );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
634 gtk_widget_ref( Ok );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
635 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Ok",Ok,(GtkDestroyNotify)gtk_widget_unref );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
636 gtk_widget_show( Ok );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
637 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Ok );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
638 GTK_WIDGET_UNSET_FLAGS( Ok,GTK_CAN_FOCUS );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
639 // gtk_widget_add_accelerator( Ok,"released",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
640
7169
35bab6be713b add subtitle dropping support
pontscho
parents: 7092
diff changeset
641 Cancel=gtk_button_new_with_label( MSGTR_Cancel );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
642 gtk_widget_ref( Cancel );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
643 gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Cancel",Cancel,(GtkDestroyNotify)gtk_widget_unref );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
644 gtk_widget_show( Cancel );
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
645 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Cancel );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
646 GTK_WIDGET_UNSET_FLAGS( Cancel,GTK_CAN_FOCUS );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
647 gtk_widget_add_accelerator( Cancel,"released",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
648
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
649 gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( plDestroy ),NULL );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
650 gtk_signal_connect( GTK_OBJECT( PlayList ),"show",GTK_SIGNAL_FUNC( plShow ),(void *)1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
651 gtk_signal_connect( GTK_OBJECT( PlayList ),"hide",GTK_SIGNAL_FUNC( plShow ),(void *)0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
652
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
653 gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
654 gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
655 sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
656 sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
657
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
658 gtk_signal_connect( GTK_OBJECT( Add ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
659 gtk_signal_connect( GTK_OBJECT( Remove ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
660 gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
661 gtk_signal_connect( GTK_OBJECT( Cancel ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 );
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
662
cc917a581b6e add simple playlist support
pontscho
parents: 6044
diff changeset
663 gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
664
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
665 return PlayList;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
666 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
667