annotate gui/dialog/playlist.c @ 37028:7694f4226420

Make the current item string as currItem global. Utilize this variable instead of using string constants. This allows naming the particular potmeter now.
author ib
date Fri, 04 Apr 2014 13:55:57 +0000
parents 1236a692d0c6
children ae4f30c4ef02
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>
36772
0da6c7ff95d2 Revise code of listMgr() command PLAYLIST_ITEM_GET_POS.
ib
parents: 36762
diff changeset
24 #include <stdint.h>
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
25 #include <stdio.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
26 #include <stdlib.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
27
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
28 #include <gdk/gdkkeysyms.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
29 #include <gtk/gtk.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
30
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
31 #include "help_mp.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
32 #include "stream/stream.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
33
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35522
diff changeset
34 #include "gui/app/cfg.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35522
diff changeset
35 #include "gui/app/gui.h"
35381
746e2e0577b2 Without current playlist item, reset guiInfo's Filename and StreamType.
ib
parents: 34681
diff changeset
36 #include "gui/interface.h"
35529
8ad4d2fb46e8 Rebuild GUI directory structure.
ib
parents: 35526
diff changeset
37 #include "dialog.h"
36026
f96f37b4f5a1 Remove unnecessary #includes.
ib
parents: 36023
diff changeset
38 #include "gui/ui/actions.h"
33742
e1539e14d60f Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents: 33740
diff changeset
39 #include "gui/util/list.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33575
diff changeset
40 #include "gui/util/mem.h"
35461
b7696c82c72d Fix various issues with a playlist change.
ib
parents: 35455
diff changeset
41 #include "gui/util/string.h"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
42 #include "playlist.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
43 #include "tools.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
44
35526
3c901704a27c Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
45 #include "pixmaps/open2.xpm"
3c901704a27c Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
46 #include "pixmaps/dir2.xpm"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
47
36011
277882d42938 Remove pointless replacement lists.
ib
parents: 36010
diff changeset
48 #define CFG_OLD_PLAYLIST
35872
93ab56bda68a Utilize new cfg_old_filename_from_utf8() in playlist code.
ib
parents: 35578
diff changeset
49 #include "gui/app/cfg-old.c"
93ab56bda68a Utilize new cfg_old_filename_from_utf8() in playlist code.
ib
parents: 35578
diff changeset
50
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
51 GtkWidget * Playlist = NULL;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
52 static GtkWidget * CTDirTree;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
53 static GtkWidget * CLFiles;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
54 static GtkWidget * CLSelected;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
55 static GtkWidget * Add;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
56 static GtkWidget * Remove;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
57 static GtkWidget * Ok;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
58 static GtkWidget * Cancel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
59 static GdkPixmap * pxOpenedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
60 static GdkPixmap * pxClosedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
61 static GdkBitmap * msOpenedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
62 static GdkBitmap * msClosedBook;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
63
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
64 static int NrOfEntrys = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
65 static int NrOfSelected = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
66 static int * CLFileSelected = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
67 static int * CLListSelected = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
68
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
69 static int sigSel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
70 static int sigUnsel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
71 static int sigEvent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
72
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
73 typedef struct
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
74 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
75 int scaned;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
76 char * path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
77 } DirNodeType;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
78
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
79 static GtkCTreeNode * sibling;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
80 static GtkCTreeNode * parent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
81 static gchar * current_path;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
82 static gchar * old_path = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
83
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
84 static int compare_func(const void *a, const void *b)
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
85 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
86 char * tmp;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
87 int i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
88 if ( !a || !b || !( (DirNodeType *)a )->path ) return -1;
36842
d8b2651bfeab Remove unnecessary casts.
ib
parents: 36777
diff changeset
89 tmp=strdup( b ); tmp[strlen( tmp )-1]=0;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
90 i=strcmp( ( (DirNodeType *)a )->path,tmp );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
91 free( tmp );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
92 return i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
93 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
94
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
95 static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
96 {
36010
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
97 (void) clist;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
98 (void) column;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
99 (void) event;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
100
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
101 switch ( GPOINTER_TO_INT( user_data) )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
102 {
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
103 case 0: CLFileSelected[row]=True; break;
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
104 case 1: CLListSelected[row]=True; break;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
105 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
106 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
107
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
108 static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
109 {
36010
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
110 (void) clist;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
111 (void) column;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
112 (void) event;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
113
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
114 switch ( GPOINTER_TO_INT( user_data) )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
115 {
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
116 case 0: CLFileSelected[row]=False; break;
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
117 case 1: CLListSelected[row]=False; break;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
118 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
119 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
120
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
121 static void plButtonReleased( GtkButton * button,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
122 {
36010
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
123 (void) button;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
124
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
125 switch ( GPOINTER_TO_INT( user_data) )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
126 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
127 case 1: // ok
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
128 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
129 int i;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
130 plItem curr, * item, * old;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
131 item = listMgr( PLAYLIST_ITEM_GET_CURR,0 );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
132 if (item)
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
133 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
134 curr.path = gstrdup(item->path);
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
135 curr.name = gstrdup(item->name);
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
136 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
137 else
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
138 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
139 curr.path = NULL;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
140 curr.name = NULL;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
141 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
142 listMgr( PLAYLIST_DELETE,0 );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
143 for ( i=0;i<NrOfSelected;i++ )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
144 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
145 char * text[2];
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
146 item=calloc( 1,sizeof( plItem ) );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
147 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,2,&text[0] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
148 gtk_clist_get_text( GTK_CLIST( CLSelected ),i,3,&text[1] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
149 item->name = strdup( text[0] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
150 item->path = strdup( text[1] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
151 listMgr( PLAYLIST_ITEM_APPEND,item );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
152 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
153 item = listMgr( PLAYLIST_GET,0 );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
154 if ( item )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
155 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
156 if ( guiInfo.Playing )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
157 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
158 old = listMgr( PLAYLIST_ITEM_FIND,&curr );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
159 if ( old )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
160 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
161 listMgr( PLAYLIST_ITEM_SET_CURR,old );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
162 guiInfo.Track = (uintptr_t) listMgr( PLAYLIST_ITEM_GET_POS,old );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
163 item = NULL;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
164 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
165 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
166 if ( item )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
167 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
168 uiSetFile( item->path,item->name,STREAMTYPE_FILE );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
169 guiInfo.MediumChanged = GUI_MEDIUM_NEW;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
170 guiInfo.PlaylistNext = !guiInfo.Playing;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
171 guiInfo.Track = 1;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
172 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
173 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
174 else if (isPlaylistStreamtype && !guiInfo.Playing) uiUnsetFile();
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
175 guiInfo.Tracks = (uintptr_t) listMgr( PLAYLIST_ITEM_GET_POS,0 );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
176 free(curr.path);
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
177 free(curr.name);
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
178 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
179 case 0: // cancel
36000
9bdcd4ec73ae Remove HidePlaylist().
ib
parents: 35996
diff changeset
180 NrOfSelected=NrOfEntrys=0;
9bdcd4ec73ae Remove HidePlaylist().
ib
parents: 35996
diff changeset
181 nfree( CLListSelected );
9bdcd4ec73ae Remove HidePlaylist().
ib
parents: 35996
diff changeset
182 nfree( CLFileSelected );
9bdcd4ec73ae Remove HidePlaylist().
ib
parents: 35996
diff changeset
183 free( old_path );
9bdcd4ec73ae Remove HidePlaylist().
ib
parents: 35996
diff changeset
184 old_path=strdup( current_path );
9bdcd4ec73ae Remove HidePlaylist().
ib
parents: 35996
diff changeset
185 gtk_widget_destroy( Playlist );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
186 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
187 case 2: // remove
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
188 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
189 int i; int j;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
190
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
191 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
192 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
193 gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigEvent );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
194
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
195 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
35522
92809c17fc9d Fix bug with removing items from playlist.
ib
parents: 35493
diff changeset
196 i = 0;
92809c17fc9d Fix bug with removing items from playlist.
ib
parents: 35493
diff changeset
197 while ( i<NrOfSelected )
92809c17fc9d Fix bug with removing items from playlist.
ib
parents: 35493
diff changeset
198 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
199 if ( CLListSelected[i] )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
200 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
201 gtk_clist_remove( GTK_CLIST( CLSelected ),i );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
202 NrOfSelected--;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
203 for ( j=i;j<NrOfSelected;j++ )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
204 CLListSelected[j] = CLListSelected[j+1];
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
205 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
206 else i++;
35522
92809c17fc9d Fix bug with removing items from playlist.
ib
parents: 35493
diff changeset
207 }
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
208 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
209
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
210 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
211 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
212 gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigEvent );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
213
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
214 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
215 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
216 case 3: // add
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
217 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
218 int i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
219 void *p;
35927
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
220 char * itext[2];
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
221 char * text[1][5]; text[0][4]="";
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
222 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
223 for ( i=0;i<NrOfEntrys;i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
224 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
225 if ( CLFileSelected[i] )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
226 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
227 NrOfSelected++;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
228 p=realloc( CLListSelected,NrOfSelected * sizeof( int ) );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
229 if ( !p ) NrOfSelected--;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
230 else
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
231 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
232 CLListSelected=p;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
233 CLListSelected[NrOfSelected - 1]=False;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
234 gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,&itext[0] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
235 gtk_clist_get_text( GTK_CLIST( CLFiles ),i,1,&itext[1] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
236 text[0][0]=itext[0]; text[0][1]=g_filename_display_name( current_path );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
237 text[0][2]=itext[1]; text[0][3]=current_path;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
238 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
239 g_free( text[0][1] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
240 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
241 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
242 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
243 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
244 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
245 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
246 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
247 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
248
34348
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
249 static gboolean plKeyReleased( GtkWidget * widget,
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
250 GdkEventKey * event,
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
251 gpointer user_data )
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
252 {
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
253 if (event->keyval == GDK_Return)
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
254 {
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
255 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
256 else
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
257 {
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
258 switch ( GPOINTER_TO_INT( user_data) )
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
259 {
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
260 case 0:
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
261 plButtonReleased( NULL, GINT_TO_POINTER(3) );
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
262 break;
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
263 case 1:
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
264 plButtonReleased( NULL, GINT_TO_POINTER(2) );
34349
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
265 break;
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
266 }
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
267 }
6e4af5500f8f Add Return key events to playlist's file lists.
ib
parents: 34348
diff changeset
268 }
34348
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
269 return FALSE;
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
270 }
be4236a5186c Add Return key events to playlist buttons.
ib
parents: 34347
diff changeset
271
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
272 static gboolean plEvent ( GtkWidget * widget,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
273 GdkEvent * event,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
274 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
275 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
276 GdkEventButton *bevent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
277 gint row, col;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
278
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
279 bevent = (GdkEventButton *) event;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
280
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
281 if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
282 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
283 if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
284 {
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
285 switch ( GPOINTER_TO_INT( user_data) )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
286 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
287 case 0:
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
288 CLFileSelected[row] = True;
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
289 plButtonReleased( NULL, GINT_TO_POINTER(3) );
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
290 CLFileSelected[row] = False;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
291 return TRUE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
292
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
293 case 1:
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
294 CLListSelected[row] = True;
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
295 plButtonReleased( NULL, GINT_TO_POINTER(2) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
296 return TRUE;
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
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
301 return FALSE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
302 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
303
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
304 static int check_for_subdir( gchar * path )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
305 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
306 DIR * dir;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
307 struct dirent * dirent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
308 struct stat statbuf;
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
309 gchar * npath;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
310
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
311 if ( (dir=opendir( path )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
312 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
313 while ( (dirent=readdir( dir )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
314 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
315 if ( dirent->d_name[0] != '.' )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
316 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
317 npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
318 sprintf( npath,"%s/%s",path,dirent->d_name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
319 if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) )
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
320 { free( npath ); closedir( dir ); return True; }
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
321 free( npath );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
322 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
323 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
324 closedir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
325 }
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
326 return False;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
327 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
328
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
329 static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
330 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
331 GtkCTreeNode * node;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
332 DirNodeType * DirNode;
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
333 gchar * text, * utf8name = NULL;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
334 gchar * dummy = "dummy";
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
335 int subdir = True;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
336 DIR * dir = NULL;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
337 struct dirent * dirent;
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
338 gchar * path;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
339 struct stat statbuf;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
340
36010
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
341 (void) user_data;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
342
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
343 DirNode=gtk_ctree_node_get_row_data( ctree,parent_node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
344 if ( !DirNode->scaned )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
345 {
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
346 DirNode->scaned=True; current_path=DirNode->path;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
347 gtk_clist_freeze( GTK_CLIST( ctree ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
348 node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
349 gtk_ctree_remove_node( ctree,node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
350
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
351 if ( (dir=opendir( DirNode->path ) ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
352 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
353 while( (dirent=readdir( dir )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
354 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
355 path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
356 if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name );
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
357 else sprintf( path,"%s/%s",current_path,dirent->d_name );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
358 text=dirent->d_name;
35938
8515446e81c6 Cosmetic: Rename variables holding data in UTF-8 encoding.
ib
parents: 35927
diff changeset
359 g_free( utf8name );
8515446e81c6 Cosmetic: Rename variables holding data in UTF-8 encoding.
ib
parents: 35927
diff changeset
360 utf8name=g_filename_display_name( text );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
361
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
362 if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
363 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
364 DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=False; DirNode->path=strdup( path );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
365 subdir=check_for_subdir( path );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
366 node=gtk_ctree_insert_node( ctree,parent_node,NULL,&utf8name,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
367 gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
368 if ( subdir ) gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
369 }
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
370 free( path ); path=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
371 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
372 closedir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
373 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
374
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
375 gtk_ctree_sort_node( ctree,parent_node );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
376 gtk_clist_thaw( GTK_CLIST( ctree ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
377 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
378
35938
8515446e81c6 Cosmetic: Rename variables holding data in UTF-8 encoding.
ib
parents: 35927
diff changeset
379 g_free( utf8name );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
380 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
381
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
382 static void scan_dir( char * path )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
383 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
384 DIR * dir = NULL;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
385 char * curr;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
386 struct dirent * dirent;
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
387 struct stat statbuf;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
388 char * text[1][3]; text[0][2]="";
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
389
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
390 gtk_clist_clear( GTK_CLIST( CLFiles ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
391 if ( (dir=opendir( path )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
392 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
393 NrOfEntrys=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
394 while( (dirent=readdir( dir )) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
395 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
396 curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
397 if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) )
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
398 {
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
399 text[0][0]=g_filename_display_name( dirent->d_name );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
400 text[0][1]=dirent->d_name;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
401 gtk_clist_append( GTK_CLIST( CLFiles ), text[0] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
402 g_free( text[0][0] );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
403 NrOfEntrys++;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
404 }
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
405 free( curr );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
406 }
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
407 closedir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
408 gtk_clist_sort( GTK_CLIST( CLFiles ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
409 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
410 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
411
34466
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
412 static void plCTRow(GtkCList * clist, gint row, gint column, GdkEvent * event, gpointer user_data)
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
413 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
414 DirNodeType * DirNode;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
415 GtkCTreeNode * node;
36010
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
416
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
417 (void) column;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
418 (void) event;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
419 (void) user_data;
5c720c434d56 Silence "warning: unused parameter".
ib
parents: 36008
diff changeset
420
34466
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
421 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
422 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( clist ),node );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
423 current_path=DirNode->path;
34466
a650895d50a5 Use correct data types and common variable names in GTK callback functions.
ib
parents: 34349
diff changeset
424 gtk_ctree_expand( GTK_CTREE( clist ),node );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
425 scan_dir( DirNode->path );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
426 free( CLFileSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
427 CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
428 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
429
35996
6c891a0e3fea Cosmetic: Rename the functions creating the dialogs.
ib
parents: 35983
diff changeset
430 static GtkWidget * CreatePlaylist( void )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
431 {
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
432 GtkWidget * vbox1;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
433 GtkWidget * hbox1;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
434 GtkWidget * scrolledwindow1;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
435 GtkWidget * vbox2;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
436 GtkWidget * scrolledwindow2;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
437 GtkWidget * scrolledwindow3;
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
438 GtkWidget * hbuttonbox1;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
439 GtkAccelGroup * accel_group;
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
440 GdkColor transparent = { 0,0,0,0 };
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
441 gchar * root = "/";
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
442 gchar * dummy = "dummy";
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
443 DirNodeType * DirNode;
35963
db72a3183d41 Preselect current playlist directory from last playlist entry.
ib
parents: 35938
diff changeset
444 plItem * last;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
445
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
446 accel_group=gtk_accel_group_new();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
447
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
448 Playlist=gtk_window_new( GTK_WINDOW_TOPLEVEL );
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
449 gtk_widget_set_usize( Playlist,512,384 );
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
450 gtk_window_set_title( GTK_WINDOW( Playlist ),MSGTR_GUI_Playlist );
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
451 gtk_window_set_position( GTK_WINDOW( Playlist ),GTK_WIN_POS_CENTER );
36053
7affacef2f88 Define "MPlayer" string.
ib
parents: 36051
diff changeset
452 gtk_window_set_wmclass( GTK_WINDOW( Playlist ),"Playlist",MPlayer );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
453
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
454 gtk_widget_realize( Playlist );
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
455 gtkAddIcon( Playlist );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
456
36023
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
457 vbox1=gtkAddVBox( gtkAddDialogFrame( Playlist ),0 );
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
458 hbox1=gtkAddHBox( NULL,1 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
459 gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
460
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
461 scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
462 gtk_widget_show( scrolledwindow1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
463 gtk_container_add( GTK_CONTAINER(
36023
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
464 gtkAddFrame( NULL,0,hbox1,1 ) ),scrolledwindow1 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
465 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
466
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
467 CTDirTree=gtk_ctree_new( 1,0 );
36777
f53aa813deeb Prefer NULL.
ib
parents: 36776
diff changeset
468 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree-expand",GTK_SIGNAL_FUNC( plCTree ),NULL );
f53aa813deeb Prefer NULL.
ib
parents: 36776
diff changeset
469 gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select-row",GTK_SIGNAL_FUNC( plCTRow ),NULL );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
470 gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
471 gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
472 gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
473 gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
474 gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
475 gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
476 gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
477
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
478 if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( Playlist->window,&msOpenedBook,&transparent,(gchar **)dir2_xpm );
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
479 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
480
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
481 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
482 DirNode=malloc( sizeof( DirNodeType ) );
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35488
diff changeset
483 DirNode->scaned=False; DirNode->path=strdup( root );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
484 gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
485 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
486 gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
487 gtk_widget_show( CTDirTree );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
488
35963
db72a3183d41 Preselect current playlist directory from last playlist entry.
ib
parents: 35938
diff changeset
489 last=listMgr( PLAYLIST_ITEM_GET_LAST,0 );
db72a3183d41 Preselect current playlist directory from last playlist entry.
ib
parents: 35938
diff changeset
490
db72a3183d41 Preselect current playlist directory from last playlist entry.
ib
parents: 35938
diff changeset
491 if ( last && last->path ) old_path = strdup( last->path );
db72a3183d41 Preselect current playlist directory from last playlist entry.
ib
parents: 35938
diff changeset
492 else if ( fsHistory[0] ) old_path = strdup( cfg_old_filename_from_utf8( fsHistory[0] ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
493
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
494 gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0,
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
495 gtkAddLabel( MSGTR_GUI_DirectoryTree,NULL ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
496
34347
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
497 gtk_clist_column_title_passive( GTK_CLIST( CTDirTree ),0 );
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
498
36023
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
499 vbox2=gtkAddVBox(
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
500 gtkAddFrame( NULL,1,hbox1,1 ),0 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
501
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
502 scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
503 gtk_widget_show( scrolledwindow2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
504 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
505 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
506
35927
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
507 CLFiles=gtk_clist_new( 2 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
508 gtk_widget_show( CLFiles );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
509 gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
510 gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 );
35927
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
511 gtk_clist_set_column_visibility( GTK_CLIST( CLFiles ),1,FALSE );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
512 gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
513 gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
514 gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
515
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
516 gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0,
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
517 gtkAddLabel( MSGTR_GUI_Files,NULL ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
518
34347
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
519 gtk_clist_column_title_passive( GTK_CLIST( CLFiles ),0 );
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
520
36023
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
521 gtkAddHSeparator( vbox2 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
522
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
523 scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
524 gtk_widget_show( scrolledwindow3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
525 gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
526 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
527
35927
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
528 CLSelected=gtk_clist_new( 4 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
529 gtk_widget_show( CLSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
530 gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
531 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
532 gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 );
35927
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
533 gtk_clist_set_column_visibility( GTK_CLIST( CLSelected ),2,FALSE );
e43fa34e33cf Support mixed filename encodings.
ib
parents: 35872
diff changeset
534 gtk_clist_set_column_visibility( GTK_CLIST( CLSelected ),3,FALSE );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
535 gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
536 gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
537 gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
538
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
539 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0,
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
540 gtkAddLabel( MSGTR_GUI_SelectedFiles,NULL ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
541
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
542 gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1,
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
543 gtkAddLabel( MSGTR_GUI_Directory,NULL ) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
544
34347
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
545 gtk_clist_column_title_passive( GTK_CLIST( CLSelected ),0 );
8861ea3ec08c Make column titles in playlist passive.
ib
parents: 33894
diff changeset
546
36023
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
547 gtkAddHSeparator( vbox1 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
548
36023
a04e8798227b Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents: 36019
diff changeset
549 hbuttonbox1=gtkAddHButtonBox( vbox1 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
550 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
551 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
552
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
553 Add=gtkAddButton( MSGTR_GUI_Add,hbuttonbox1 );
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
554 Remove=gtkAddButton( MSGTR_GUI_Remove,hbuttonbox1 );
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
555 Ok=gtkAddButton( MSGTR_GUI_Ok,hbuttonbox1 );
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36101
diff changeset
556 Cancel=gtkAddButton( MSGTR_GUI_Cancel,hbuttonbox1 );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
557
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
558 gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
559
36008
d154d0035cb0 Don't use WidgetDestroy().
ib
parents: 36000
diff changeset
560 gtk_signal_connect( GTK_OBJECT( Playlist ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&Playlist );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
561
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
562 gtk_signal_connect( GTK_OBJECT( CLFiles ),"select-row",GTK_SIGNAL_FUNC( plRowSelect ),GINT_TO_POINTER(0) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
563 gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect-row",GTK_SIGNAL_FUNC( plUnRowSelect ),GINT_TO_POINTER(0) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
564 gtk_signal_connect( GTK_OBJECT( CLFiles ),"event",GTK_SIGNAL_FUNC( plEvent ),GINT_TO_POINTER(0) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
565 gtk_signal_connect( GTK_OBJECT( CLFiles ),"key-release-event",GTK_SIGNAL_FUNC( plKeyReleased ),GINT_TO_POINTER(0) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
566 sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select-row",GTK_SIGNAL_FUNC( plRowSelect ),GINT_TO_POINTER(1) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
567 sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect-row",GTK_SIGNAL_FUNC( plUnRowSelect ),GINT_TO_POINTER(1) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
568 sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),GINT_TO_POINTER(1) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
569 gtk_signal_connect( GTK_OBJECT( CLSelected ),"key-release-event",GTK_SIGNAL_FUNC( plKeyReleased ),GINT_TO_POINTER(1) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
570
36776
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
571 gtk_signal_connect( GTK_OBJECT( Add ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),GINT_TO_POINTER(3) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
572 gtk_signal_connect( GTK_OBJECT( Add ),"key-release-event",GTK_SIGNAL_FUNC( plKeyReleased ),GINT_TO_POINTER(3) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
573 gtk_signal_connect( GTK_OBJECT( Remove ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),GINT_TO_POINTER(2) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
574 gtk_signal_connect( GTK_OBJECT( Remove ),"key-release-event",GTK_SIGNAL_FUNC( plKeyReleased ),GINT_TO_POINTER(2) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
575 gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),GINT_TO_POINTER(1) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
576 gtk_signal_connect( GTK_OBJECT( Ok ),"key-release-event",GTK_SIGNAL_FUNC( plKeyReleased ),GINT_TO_POINTER(1) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
577 gtk_signal_connect( GTK_OBJECT( Cancel ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),GINT_TO_POINTER(0) );
5ea757ca6270 Fix careless pointer parameter handling.
ib
parents: 36772
diff changeset
578 gtk_signal_connect( GTK_OBJECT( Cancel ),"key-release-event",GTK_SIGNAL_FUNC( plKeyReleased ),GINT_TO_POINTER(0) );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
579
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
580 gtk_window_add_accel_group( GTK_WINDOW( Playlist ),accel_group );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
581
35981
1d11ed014a53 Cosmetic: Rename ShowPlayList() ShowPlaylist().
ib
parents: 35980
diff changeset
582 return Playlist;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
583 }
35982
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
584
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
585 void ShowPlaylist( void )
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
586 {
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
587 plItem * next;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
588
36019
d2d776c8e040 Cosmetic: Rename gtkActive() gtkRaise().
ib
parents: 36011
diff changeset
589 if ( Playlist ) gtkRaise( Playlist );
35996
6c891a0e3fea Cosmetic: Rename the functions creating the dialogs.
ib
parents: 35983
diff changeset
590 else Playlist=CreatePlaylist();
35982
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
591
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
592 if ( old_path && *old_path )
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
593 {
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
594 char * currentdir = strdup( old_path );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
595 char * tpath,* pos;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
596 GtkCTreeNode * node,* nextnode;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
597 gboolean leaf;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
598 tpath=strdup( "/" );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
599 pos=strtok( currentdir,"/" );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
600 node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
601 do
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
602 {
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
603 char * tpathnew = g_strconcat( tpath,pos,"/",NULL );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
604 free( tpath ); tpath=tpathnew;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
605 nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
606 if ( !nextnode ) break;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
607 node=nextnode;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
608 pos=strtok( NULL,"/" );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
609 gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
610 if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
611 else
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
612 {
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
613 DirNodeType * DirNode;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
614 gtk_ctree_select( GTK_CTREE( CTDirTree ),node );
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
615 DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
616 current_path=DirNode->path;
35982
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
617 scan_dir( DirNode->path );
37023
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
618 free( CLFileSelected );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
619 CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
1236a692d0c6 Cosmetic: Remove tabs.
ib
parents: 36937
diff changeset
620 break;
35982
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
621 }
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
622 } while( pos );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
623 free( tpath );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
624 free( currentdir );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
625 }
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
626 else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
627
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
628 gtk_clist_freeze( GTK_CLIST( CLSelected ) );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
629 gtk_clist_clear( GTK_CLIST( CLSelected ) );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
630 next = listMgr( PLAYLIST_GET,0 );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
631 if ( next )
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
632 {
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
633 while ( next || next->next )
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
634 {
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
635 char * text[1][5]; text[0][4]="";
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
636 text[0][0]=g_filename_display_name( next->name );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
637 text[0][1]=g_filename_display_name( next->path );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
638 text[0][2]=next->name;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
639 text[0][3]=next->path;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
640 gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
641 g_free( text[0][0] );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
642 g_free( text[0][1] );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
643 NrOfSelected++;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
644 if ( next->next ) next=next->next; else break;
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
645 }
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
646 CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
647 }
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
648 gtk_clist_thaw( GTK_CLIST( CLSelected ) );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
649
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
650 gtk_widget_show( Playlist );
3fbbee95fc22 Make create_PlayList() static.
ib
parents: 35981
diff changeset
651 }