annotate gui/ui/gtk/playlist.c @ 35486:7b090d0f253b

Only ask for playlist position if there is an item.
author ib
date Mon, 03 Dec 2012 14:40:20 +0000
parents 8ac7761bcb7c
children 9ef9131adfe5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
1 /*
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
2 * This file is part of MPlayer.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
3 *
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
7 * (at your option) any later version.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
8 *
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
12 * GNU General Public License for more details.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
13 *
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
17 */
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
18
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
19 #include <sys/types.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
20 #include <sys/stat.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
21 #include <string.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
22 #include <dirent.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
23 #include <unistd.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
24 #include <stdio.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
25 #include <stdlib.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
26
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
27 #include <gdk/gdkkeysyms.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
28 #include <gtk/gtk.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
29
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
30 #include "help_mp.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
31 #include "stream/stream.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
32
33750
8b5898908212 Remove variable holding history of selected files from interface.[ch].
ib
parents: 33742
diff changeset
33 #include "gui/cfg.h"
35429
3a9048421524 Create new header file gui.h.
ib
parents: 35403
diff changeset
34 #include "gui/gui.h"
35381
746e2e0577b2 Without current playlist item, reset guiInfo's Filename and StreamType.
ib
parents: 34681
diff changeset
35 #include "gui/interface.h"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
36 #include "gui/ui/widgets.h"
33742
e1539e14d60f Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents: 33740
diff changeset
37 #include "gui/util/list.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33575
diff changeset
38 #include "gui/util/mem.h"
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
39 #include "gui/util/string.h"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
40 #include "playlist.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
41 #include "tools.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
42
33575
052789583781 Remove xpm definitions inside source file.
ib
parents: 33572
diff changeset
43 #include "gui/ui/pixmaps/open2.xpm"
052789583781 Remove xpm definitions inside source file.
ib
parents: 33572
diff changeset
44 #include "gui/ui/pixmaps/dir2.xpm"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
45
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
46 GtkWidget * PlayList = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
47 static GtkWidget * CTDirTree;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
48 static GtkWidget * CLFiles;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
49 static GtkWidget * CLSelected;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
50 static GtkWidget * Add;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
51 static GtkWidget * Remove;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
52 static GtkWidget * Ok;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
53 static GtkWidget * Cancel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
54 static GdkPixmap * pxOpenedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
55 static GdkPixmap * pxClosedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
56 static GdkBitmap * msOpenedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
57 static GdkBitmap * msClosedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
58
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
59 static int NrOfEntrys = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
60 static int NrOfSelected = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
61 static int * CLFileSelected = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
62 static int * CLListSelected = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
63
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
64 static int sigSel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
65 static int sigUnsel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
66 static int sigEvent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
67
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
68 typedef struct
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
69 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
70 int scaned;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
71 char * path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
72 } DirNodeType;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
73
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
74 static GtkCTreeNode * sibling;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
75 static GtkCTreeNode * parent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
76 static gchar * current_path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
77 static gchar * old_path = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
78
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
79 static int compare_func(const void *a, const void *b)
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
80 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
81 char * tmp;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
82 int i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
83 if ( !a || !b || !( (DirNodeType *)a )->path ) return -1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
84 tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
85 i=strcmp( ( (DirNodeType *)a )->path,tmp );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
86 free( tmp );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
87 return i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
88 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
89
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
90 static void scan_dir( char * path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
91
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
92 void ShowPlayList( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
93 {
34667
7c447e9db447 Remove global variable pointing to top of playlist.
ib
parents: 34666
diff changeset
94 plItem * next;
7c447e9db447 Remove global variable pointing to top of playlist.
ib
parents: 34666
diff changeset
95
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
96 if ( PlayList ) gtkActive( PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
97 else PlayList=create_PlayList();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
98
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
99 if ( old_path && *old_path )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
100 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
101 char * currentdir = strdup( old_path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
102 char * tpath,* pos;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
103 GtkCTreeNode * node,* nextnode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
104 gboolean leaf;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
105 tpath=strdup( "/" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
106 pos=strtok( currentdir,"/" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
107 node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
108 do
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
109 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
110 char * tpathnew = g_strconcat( tpath,pos,"/",NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
111 free( tpath ); tpath=tpathnew;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
112 nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
113 if ( !nextnode ) break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
114 node=nextnode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
115 pos=strtok( NULL,"/" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
116 gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
117 if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
118 else
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
119 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
120 DirNodeType * DirNode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
121 gtk_ctree_select( GTK_CTREE( CTDirTree ),node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
122 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
123 current_path=DirNode->path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
124 scan_dir( DirNode->path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
125 free( CLFileSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
126 CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
127 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
128 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
129 } while( pos );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
130 free( tpath );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
131 free( currentdir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
132 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
133 else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
134
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
135 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
136 gtk_clist_clear( GTK_CLIST( CLSelected ) );
34667
7c447e9db447 Remove global variable pointing to top of playlist.
ib
parents: 34666
diff changeset
137 next = listMgr( PLAYLIST_GET,0 );
7c447e9db447 Remove global variable pointing to top of playlist.
ib
parents: 34666
diff changeset
138 if ( next )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
139 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
140 gchar * name, * path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
141 while ( next || next->next )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
142 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
143 char * text[1][3]; text[0][2]="";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
144 name = g_filename_to_utf8( next->name, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
145 path = g_filename_to_utf8( next->path, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
146 text[0][0]=name ? name : next->name;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
147 text[0][1]=path ? path : next->path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
148 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
149 g_free( path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
150 g_free( name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
151 NrOfSelected++;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
152 if ( next->next ) next=next->next; else break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
153 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
154 CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
155 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
156 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
157
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
158 gtk_widget_show( PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
159 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
160
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
161 void HidePlayList( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
162 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
163 if ( !PlayList ) return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
164 NrOfSelected=NrOfEntrys=0;
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33575
diff changeset
165 nfree( CLListSelected ); nfree( CLFileSelected );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
166 free( old_path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
167 old_path=strdup( current_path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
168 gtk_widget_hide( PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
169 gtk_widget_destroy( PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
170 PlayList=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
171 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
172
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
173 static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
174 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
175 switch ( (int) user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
176 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
177 case 0: CLFileSelected[row]=1; break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
178 case 1: CLListSelected[row]=1; break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
179 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
180 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
181
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
182 static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
183 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
184 switch ( (int) user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
185 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
186 case 0: CLFileSelected[row]=0; break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
187 case 1: CLListSelected[row]=0; break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
188 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
189 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
190
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
191 static void plButtonReleased( GtkButton * button,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
192 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
193 switch ( (int) user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
194 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
195 case 1: // ok
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
196 {
35486
7b090d0f253b Only ask for playlist position if there is an item.
ib
parents: 35483
diff changeset
197 int pos = 0, i;
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
198 plItem curr, * item, * old;
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
199 item = listMgr( PLAYLIST_ITEM_GET_CURR,0 );
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
200 if (item)
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
201 {
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
202 curr.path = gstrdup(item->path);
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
203 curr.name = gstrdup(item->name);
35486
7b090d0f253b Only ask for playlist position if there is an item.
ib
parents: 35483
diff changeset
204 pos = (int) listMgr( PLAYLIST_ITEM_GET_POS,item );
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
205 }
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
206 else curr.path = curr.name = NULL;
34666
a5c69b91ff2c Remove unnecessary condition.
ib
parents: 34664
diff changeset
207 listMgr( PLAYLIST_DELETE,0 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
208 for ( i=0;i<NrOfSelected;i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
209 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
210 char * text[3];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
211 item=calloc( 1,sizeof( plItem ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
212 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
213 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
214 item->name=g_filename_from_utf8( text[0], -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
215 if ( !item->name ) item->name = strdup( text[0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
216 item->path=g_filename_from_utf8( text[1], -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
217 if ( !item->path ) item->path = strdup( text[1] );
34681
42fa91951bd2 Rename PLAYLIST_ITEM_ADD PLAYLIST_ITEM_APPEND.
ib
parents: 34667
diff changeset
218 listMgr( PLAYLIST_ITEM_APPEND,item );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
219 }
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
220 item = listMgr( PLAYLIST_GET,0 );
34664
4df4d842d5fb Remove global variable pointing to current playlist item.
ib
parents: 34663
diff changeset
221 if ( item )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
222 {
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
223 if ( guiInfo.Playing && curr.name && pos )
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
224 {
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
225 old = listMgr( PLAYLIST_ITEM_FIND,&curr );
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
226 if ( old && ( pos == (int) listMgr( PLAYLIST_ITEM_GET_POS,old ) ) )
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
227 {
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
228 listMgr( PLAYLIST_ITEM_SET_CURR,old );
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
229 item = NULL;
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
230 }
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
231 }
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
232 if ( item )
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
233 {
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
234 uiSetFile( item->path,item->name,STREAMTYPE_FILE );
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
235 guiInfo.NewPlay = GUI_FILE_NEW;
35466
0583b12e11d7 Fix bug with playlist.
ib
parents: 35461
diff changeset
236 guiInfo.PlaylistNext = (curr.name ? 0 : 1);
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
237 guiInfo.Track = 1;
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
238 }
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
239 }
35455
c9c79a011f6f Fix bug with wrong track number after playlist has been cleared.
ib
parents: 35452
diff changeset
240 else if (isPlaylistStreamtype && !guiInfo.Playing) uiUnsetFile();
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
241 free(curr.path);
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
242 free(curr.name);
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
243 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
244 case 0: // cancel
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
245 HidePlayList();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
246 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
247 case 2: // remove
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
248 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
249 int i; int j; int c=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
250
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
251 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
252 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
253 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigEvent );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
254
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
255 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
256 for ( i=0;i<NrOfSelected-c;i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
257 if ( CLListSelected[i] )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
258 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
259 gtk_clist_remove( GTK_CLIST( CLSelected ),i - c );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
260 c++;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
261 for ( j=i;j<NrOfSelected-c;j++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
262 CLListSelected[i] = CLListSelected[i+1];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
263 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
264 NrOfSelected-=c;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
265 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
266
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
267 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
268 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
269 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigEvent );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
270
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
271 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
272 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
273 case 3: // add
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
274 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
275 int i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
276 void *p;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
277 char * itext[1][2];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
278 gchar * cpath;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
279 char * text[1][3]; text[0][2]="";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
280 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
281 for ( i=0;i<NrOfEntrys;i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
282 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
283 if ( CLFileSelected[i] )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
284 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
285 NrOfSelected++;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
286 p=realloc( CLListSelected,NrOfSelected * sizeof( int ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
287 if ( !p ) NrOfSelected--;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
288 else
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
289 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
290 CLListSelected=p;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
291 CLListSelected[NrOfSelected - 1]=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
292 gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
293 cpath=g_filename_to_utf8( current_path, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
294 text[0][0]=itext[0][0]; text[0][1]=cpath ? cpath : current_path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
295 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
296 g_free( cpath );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
297 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
298 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
299 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
300 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
301 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
302 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
303 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
304 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
305
34348
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
306 static gboolean plKeyReleased( GtkWidget * widget,
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
307 GdkEventKey * event,
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
308 gpointer user_data )
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
309 {
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
310 if (event->keyval == GDK_Return)
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
311 {
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
312 if ( GTK_WIDGET_TYPE( widget ) == GTK_TYPE_BUTTON ) plButtonReleased( NULL, user_data );
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
313 else
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
314 {
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
315 switch ( (int) user_data )
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
316 {
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
317 case 0:
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
318 plButtonReleased( NULL, (void *) 3 );
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
319 break;
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
320 case 1:
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
321 plButtonReleased( NULL, (void *) 2 );
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
322 break;
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
323 }
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
324 }
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
325 }
34348
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
326 return FALSE;
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
327 }
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
328
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
329 static gboolean plEvent ( GtkWidget * widget,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
330 GdkEvent * event,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
331 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
332 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
333 GdkEventButton *bevent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
334 gint row, col;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
335
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
336 bevent = (GdkEventButton *) event;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
337
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
338 if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
339 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
340 if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
341 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
342 switch ( (int) user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
343 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
344 case 0:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
345 CLFileSelected[row] = 1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
346 plButtonReleased( NULL, (void *) 3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
347 CLFileSelected[row] = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
348 return TRUE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
349
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
350 case 1:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
351 CLListSelected[row] = 1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
352 plButtonReleased( NULL, (void *) 2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
353 return TRUE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
354 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
355 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
356 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
357
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
358 return FALSE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
359 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
360
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
361 static int check_for_subdir( gchar * path )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
362 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
363 DIR * dir;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
364 struct dirent * dirent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
365 struct stat statbuf;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
366 gchar * npath;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
367
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
368 if ( (dir=opendir( path )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
369 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
370 while ( (dirent=readdir( dir )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
371 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
372 if ( dirent->d_name[0] != '.' )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
373 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
374 npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
375 sprintf( npath,"%s/%s",path,dirent->d_name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
376 if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
377 { free( npath ); closedir( dir ); return 1; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
378 free( npath );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
379 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
380 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
381 closedir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
382 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
383 return 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
384 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
385
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
386 static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
387 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
388 GtkCTreeNode * node;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
389 DirNodeType * DirNode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
390 gchar * text, * name = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
391 gchar * dummy = "dummy";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
392 int subdir = 1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
393 DIR * dir = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
394 struct dirent * dirent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
395 gchar * path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
396 struct stat statbuf;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
397
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
398 DirNode=gtk_ctree_node_get_row_data( ctree,parent_node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
399 if ( !DirNode->scaned )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
400 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
401 DirNode->scaned=1; current_path=DirNode->path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
402 gtk_clist_freeze( GTK_CLIST( ctree ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
403 node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
404 gtk_ctree_remove_node( ctree,node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
405
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
406 if ( (dir=opendir( DirNode->path ) ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
407 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
408 while( (dirent=readdir( dir )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
409 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
410 path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
411 if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
412 else sprintf( path,"%s/%s",current_path,dirent->d_name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
413 text=dirent->d_name;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
414 g_free( name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
415 name=g_filename_to_utf8( text, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
416
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
417 if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
418 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
419 DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
420 subdir=check_for_subdir( path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
421 node=gtk_ctree_insert_node( ctree,parent_node,NULL,(name ? &name : &text ),4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
422 gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
35403
e93282a4e332 Remove variable assignment.
ib
parents: 35390
diff changeset
423 if ( subdir ) gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
424 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
425 free( path ); path=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
426 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
427 closedir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
428 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
429
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
430 gtk_ctree_sort_node( ctree,parent_node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
431 gtk_clist_thaw( GTK_CLIST( ctree ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
432 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
433
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
434 g_free( name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
435 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
436
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
437 static void scan_dir( char * path )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
438 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
439 DIR * dir = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
440 char * curr;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
441 struct dirent * dirent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
442 struct stat statbuf;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
443 gchar * name;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
444 char * text[1][2]; text[0][1]="";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
445
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
446 gtk_clist_clear( GTK_CLIST( CLFiles ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
447 if ( (dir=opendir( path )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
448 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
449 NrOfEntrys=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
450 while( (dirent=readdir( dir )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
451 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
452 curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
453 if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
454 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
455 name=g_filename_to_utf8( dirent->d_name, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
456 text[0][0]=name ? name : dirent->d_name;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
457 gtk_clist_append( GTK_CLIST( CLFiles ), text[0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
458 g_free( name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
459 NrOfEntrys++;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
460 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
461 free( curr );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
462 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
463 closedir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
464 gtk_clist_sort( GTK_CLIST( CLFiles ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
465 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
466 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
467
34466
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
468 static void plCTRow(GtkCList * clist, gint row, gint column, GdkEvent * event, gpointer user_data)
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
469 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
470 DirNodeType * DirNode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
471 GtkCTreeNode * node;
34466
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
472 node=gtk_ctree_node_nth( GTK_CTREE( clist ),row );
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
473 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( clist ),node );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
474 current_path=DirNode->path;
34466
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
475 gtk_ctree_expand( GTK_CTREE( clist ),node );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
476 scan_dir( DirNode->path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
477 free( CLFileSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
478 CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
479 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
480
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
481 GtkWidget * create_PlayList( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
482 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
483 GtkWidget * vbox1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
484 GtkWidget * hbox1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
485 GtkWidget * scrolledwindow1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
486 GtkWidget * vbox2;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
487 GtkWidget * scrolledwindow2;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
488 GtkWidget * scrolledwindow3;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
489 GtkWidget * hbuttonbox1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
490 GtkAccelGroup * accel_group;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
491 GdkColor transparent = { 0,0,0,0 };
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
492 gchar * root = "/";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
493 gchar * dummy = "dummy";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
494 DirNodeType * DirNode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
495
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
496 accel_group=gtk_accel_group_new();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
497
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
498 PlayList=gtk_window_new( GTK_WINDOW_TOPLEVEL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
499 gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
500 gtk_widget_set_usize( PlayList,512,384 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
501 gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
502 gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
503 // gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
504 gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
505
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
506 gtk_widget_realize( PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
507 gtkAddIcon( PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
508
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
509 vbox1=AddVBox( AddDialogFrame( PlayList ),0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
510 hbox1=AddHBox( NULL,1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
511 gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
512
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
513 scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
514 gtk_widget_show( scrolledwindow1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
515 gtk_container_add( GTK_CONTAINER(
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
516 AddFrame( NULL,0,hbox1,1 ) ),scrolledwindow1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
517 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
518
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
519 CTDirTree=gtk_ctree_new( 1,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
520 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
521 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
522 gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
523 gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
524 gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
525 gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
526 gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
527 gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
528 gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
529
33575
052789583781 Remove xpm definitions inside source file.
ib
parents: 33572
diff changeset
530 if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,(gchar **)dir2_xpm );
052789583781 Remove xpm definitions inside source file.
ib
parents: 33572
diff changeset
531 if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,(gchar **)open2_xpm );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
532
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
533 parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
534 DirNode=malloc( sizeof( DirNodeType ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
535 DirNode->scaned=0; DirNode->path=strdup( root );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
536 gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
537 sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
538 gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
539 gtk_widget_show( CTDirTree );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
540
33873
983ffb8be5bd Check directory history entry prior to its usage.
ib
parents: 33788
diff changeset
541 if ( fsHistory[0] ) old_path = g_filename_from_utf8( fsHistory[0], -1, NULL, NULL, NULL );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
542
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
543 gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
544 AddLabel( MSGTR_PLAYLIST_DirectoryTree,NULL ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
545
34347
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
546 gtk_clist_column_title_passive( GTK_CLIST( CTDirTree ),0 );
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
547
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
548 vbox2=AddVBox(
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
549 AddFrame( NULL,1,hbox1,1 ),0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
550
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
551 scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
552 gtk_widget_show( scrolledwindow2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
553 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
554 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
555
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
556 CLFiles=gtk_clist_new( 1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
557 gtk_widget_show( CLFiles );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
558 gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
559 gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
560 gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
561 gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
562 gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
563
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
564 gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
565 AddLabel( MSGTR_PLAYLIST_Files,NULL ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
566
34347
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
567 gtk_clist_column_title_passive( GTK_CLIST( CLFiles ),0 );
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
568
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
569 AddHSeparator( vbox2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
570
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
571 scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
572 gtk_widget_show( scrolledwindow3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
573 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
574 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
575
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
576 CLSelected=gtk_clist_new( 2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
577 gtk_widget_show( CLSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
578 gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
579 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
580 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
581 gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
582 gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
583 gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
584
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
585 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
586 AddLabel( MSGTR_PLAYLIST_Selected,NULL ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
587
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
588 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
589 AddLabel( MSGTR_PLAYLIST_Path,NULL ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
590
34347
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
591 gtk_clist_column_title_passive( GTK_CLIST( CLSelected ),0 );
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
592
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
593 AddHSeparator( vbox1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
594
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
595 hbuttonbox1=AddHButtonBox( vbox1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
596 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
597 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
598
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
599 Add=AddButton( MSGTR_Add,hbuttonbox1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
600 Remove=AddButton( MSGTR_Remove,hbuttonbox1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
601 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
602 Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
603
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
604 gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
605
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
606 gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&PlayList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
607
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
608 gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
609 gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
610 gtk_signal_connect( GTK_OBJECT( CLFiles ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)0 );
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
611 gtk_signal_connect( GTK_OBJECT( CLFiles ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void *)0 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
612 sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
613 sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
614 sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)1 );
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
615 gtk_signal_connect( GTK_OBJECT( CLSelected ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void *)1 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
616
34348
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
617 gtk_signal_connect( GTK_OBJECT( Add ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
618 gtk_signal_connect( GTK_OBJECT( Add ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)3 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
619 gtk_signal_connect( GTK_OBJECT( Remove ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
620 gtk_signal_connect( GTK_OBJECT( Remove ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)2 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
621 gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
622 gtk_signal_connect( GTK_OBJECT( Ok ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)1 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
623 gtk_signal_connect( GTK_OBJECT( Cancel ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 );
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
624 gtk_signal_connect( GTK_OBJECT( Cancel ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)0 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
625
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
626 gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
627
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
628 return PlayList;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
629 }