~ubuntu-branches/ubuntu/maverick/gwhere/maverick

« back to all changes in this revision

Viewing changes to src/gui/gwnotebookcatalogcallback.c

  • Committer: Bazaar Package Importer
  • Author(s): Sébastien LECACHEUR
  • Date: 2004-09-27 00:41:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040927004100-q23139ty7b94kryi
Tags: upstream-0.1.6
Import upstream version 0.1.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  GWhere.
 
2
 *  Copyright (C) 2000  S�bastien LECACHEUR
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 *  You should have received a copy of the GNU General Public License
 
15
 *  along with this program; if not, write to the Free Software
 
16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
 
 
20
#include "../gwsupport.h"
 
21
#include "gwnotebookcatalogcallback.h"
 
22
 
 
23
#include <string.h> /* strcmp strlen */
 
24
 
 
25
#include "tools/gwtools.h"
 
26
#include "res/gwres.h"
 
27
#include "data/gwdata.h"
 
28
 
 
29
#include "gwstatusbar.h"
 
30
#include "gwstatusbarcallback.h"
 
31
#include "gwnotebookcatalog.h"
 
32
#include "gwnotebooksearch.h"
 
33
#include "gwnotebookmanagmentcallback.h"
 
34
#include "gwmenupopup.h"
 
35
 
 
36
#include "../gwapplicationmanager.h"
 
37
#include "../gwguimanager.h"
 
38
#include "../gwcatalogmanager.h"
 
39
 
 
40
 
 
41
gint gw_catalog_compare_disk_int ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
42
{
 
43
        struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
 
44
        int nb1 = -1, nb2 = -1;
 
45
 
 
46
 
 
47
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
48
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
49
#endif
 
50
 
 
51
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
52
        {
 
53
                disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
 
54
                disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
 
55
 
 
56
                if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
 
57
                {
 
58
                        switch ( clist->sort_column)
 
59
                        {
 
60
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NBARCHIVE_POSITION_DEFAULT:      nb1 = disk_info_get_num ( disk_info1);
 
61
                                                                                                        nb2 = disk_info_get_num ( disk_info2);
 
62
                                                                                                        break;
 
63
                        }
 
64
                }
 
65
        }
 
66
 
 
67
        return nb1 - nb2;
 
68
}
 
69
 
 
70
 
 
71
gint gw_catalog_compare_disk_gulong ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
72
{
 
73
        struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
 
74
        gulong nb1 = 0, nb2 = 0;
 
75
 
 
76
 
 
77
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
78
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
79
#endif
 
80
 
 
81
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
82
        {
 
83
                disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
 
84
                disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
 
85
 
 
86
                if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
 
87
                {
 
88
                        switch ( clist->sort_column)
 
89
                        {
 
90
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DATE_POSITION_DEFAULT:   nb1 = disk_info_get_date ( disk_info1);
 
91
                                                                                                nb2 = disk_info_get_date ( disk_info2);
 
92
                                                                                                break;
 
93
                        }
 
94
                }
 
95
        }
 
96
 
 
97
        return nb1 - nb2;
 
98
}
 
99
 
 
100
 
 
101
gint gw_catalog_compare_disk_guint64 ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
102
{
 
103
        struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
 
104
        guint64 nb1 = -1, nb2 = -1;
 
105
 
 
106
 
 
107
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
108
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
109
#endif
 
110
 
 
111
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
112
        {
 
113
                disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
 
114
                disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
 
115
 
 
116
                if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
 
117
                {
 
118
                        switch ( clist->sort_column)
 
119
                        {
 
120
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CAPACITY_POSITION_DEFAULT:       nb1 = disk_info_get_full ( disk_info1);
 
121
                                                                                                        nb2 = disk_info_get_full ( disk_info2);
 
122
                                                                                                        break;
 
123
 
 
124
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FREE_POSITION_DEFAULT:           nb1 = disk_info_get_free ( disk_info1);
 
125
                                                                                                        nb2 = disk_info_get_free ( disk_info2);
 
126
                                                                                                        break;
 
127
                        }
 
128
                }
 
129
        }
 
130
 
 
131
        return nb1 - nb2;
 
132
}
 
133
 
 
134
 
 
135
gint gw_catalog_compare_disk_str ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
136
{
 
137
        struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
 
138
        gchar *str1 = NULL, *str2 = NULL;
 
139
        gint result = 0;
 
140
 
 
141
 
 
142
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
143
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
144
#endif
 
145
 
 
146
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
147
        {
 
148
                disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
 
149
                disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
 
150
 
 
151
                if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
 
152
                {
 
153
                        switch ( clist->sort_column)
 
154
                        {
 
155
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NAME_POSITION_DEFAULT:           str1 = disk_info_get_name ( disk_info1);
 
156
                                                                                                        str2 = disk_info_get_name ( disk_info2);
 
157
                                                                                                        break;
 
158
 
 
159
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FSNAME_POSITION_DEFAULT:         str1 = disk_info_get_fsname ( disk_info1);
 
160
                                                                                                        str2 = disk_info_get_fsname ( disk_info2);
 
161
                                                                                                        break;
 
162
 
 
163
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_PATH_POSITION_DEFAULT:           str1 = disk_info_get_dir ( disk_info1);
 
164
                                                                                                        str2 = disk_info_get_dir ( disk_info2);
 
165
                                                                                                        break;
 
166
 
 
167
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_TYPE_POSITION_DEFAULT:           str1 = disk_info_get_type ( disk_info1);
 
168
                                                                                                        str2 = disk_info_get_type ( disk_info2);
 
169
                                                                                                        break;
 
170
 
 
171
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_VOLUME_POSITION_DEFAULT:         str1 = disk_info_get_volume ( disk_info1);
 
172
                                                                                                        str2 = disk_info_get_volume ( disk_info2);
 
173
                                                                                                        break;
 
174
 
 
175
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_SERIAL_POSITION_DEFAULT:         str1 = disk_info_get_serial ( disk_info1);
 
176
                                                                                                        str2 = disk_info_get_serial ( disk_info2);
 
177
                                                                                                        break;
 
178
 
 
179
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CATEGORY_POSITION_DEFAULT:       str1 = disk_info_get_category_name ( disk_info1);
 
180
                                                                                                        str2 = disk_info_get_category_name ( disk_info2);
 
181
                                                                                                        break;
 
182
 
 
183
                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_POSITION_DEFAULT:    str1 = disk_info_get_description ( disk_info1);
 
184
                                                                                                        str2 = disk_info_get_description ( disk_info2);
 
185
                                                                                                        break;
 
186
                        }
 
187
 
 
188
                        if ( (str1!=NULL) && (str2!=NULL) )
 
189
                        {
 
190
                                if ( gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_CASE_SENSITIVE) == 1 )
 
191
                                {
 
192
                                        result = strcmp ( str1, str2);
 
193
                                }
 
194
                                else
 
195
                                {
 
196
                                        result = strcasecmp ( str1, str2);
 
197
                                }
 
198
                        }
 
199
                }
 
200
        }
 
201
 
 
202
        return result;
 
203
}
 
204
 
 
205
 
 
206
gint gw_catalog_compare_file_glong ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
207
{
 
208
        struct file_info *file_info1 = NULL, *file_info2 = NULL;
 
209
        glong nb1 = -1, nb2 = -1;
 
210
        gboolean isfolder1 = FALSE, isfolder2 = FALSE;
 
211
        gchar *str_name1 = NULL, *str_name2 = NULL;
 
212
        gint result = 0;
 
213
 
 
214
 
 
215
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
216
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
217
#endif
 
218
 
 
219
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
220
        {
 
221
                file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
 
222
                file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
 
223
 
 
224
                if ( (file_info1!=NULL) && (file_info2!=NULL) )
 
225
                {
 
226
                        str_name1 = file_info_get_name ( file_info1);
 
227
                        str_name2 = file_info_get_name ( file_info2);
 
228
                        isfolder1 = file_info_get_isdirectory ( file_info1);
 
229
                        isfolder2 = file_info_get_isdirectory ( file_info2);
 
230
 
 
231
                        switch ( clist->sort_column)
 
232
                        {
 
233
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT:  nb1 = file_info_get_inode ( file_info1);
 
234
                                                                                                nb2 = file_info_get_inode ( file_info2);
 
235
                                                                                                break;
 
236
                        }
 
237
 
 
238
                        if ( (str_name1!=NULL) && (str_name2!=NULL) )
 
239
                        {
 
240
                                if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
 
241
                                {
 
242
                                        result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
 
243
                                }
 
244
                                else
 
245
                                {
 
246
                                        if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
 
247
                                        {
 
248
                                                result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
 
249
                                        }
 
250
                                        else
 
251
                                        {
 
252
                                                result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?(nb1-nb2):(isfolder2-isfolder1));
 
253
                                        }
 
254
                                }
 
255
                        }
 
256
                }
 
257
        }
 
258
 
 
259
        return result;
 
260
}
 
261
 
 
262
 
 
263
gint gw_catalog_compare_file_gulong ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
264
{
 
265
        struct file_info *file_info1 = NULL, *file_info2 = NULL;
 
266
        gulong nb1 = 0, nb2 = 0;
 
267
        gboolean isfolder1 = FALSE, isfolder2 = FALSE;
 
268
        gchar *str_name1 = NULL, *str_name2 = NULL;
 
269
        gint result = 0;
 
270
 
 
271
 
 
272
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
273
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
274
#endif
 
275
 
 
276
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
277
        {
 
278
                file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
 
279
                file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
 
280
 
 
281
                if ( (file_info1!=NULL) && (file_info2!=NULL) )
 
282
                {
 
283
                        str_name1 = file_info_get_name ( file_info1);
 
284
                        str_name2 = file_info_get_name ( file_info2);
 
285
                        isfolder1 = file_info_get_isdirectory ( file_info1);
 
286
                        isfolder2 = file_info_get_isdirectory ( file_info2);
 
287
 
 
288
                        switch ( clist->sort_column)
 
289
                        {
 
290
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT:  nb1 = file_info_get_cdate ( file_info1);
 
291
                                                                                                nb2 = file_info_get_cdate ( file_info2);
 
292
                                                                                                break;
 
293
 
 
294
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT:  nb1 = file_info_get_adate ( file_info1);
 
295
                                                                                                nb2 = file_info_get_adate ( file_info2);
 
296
                                                                                                break;
 
297
 
 
298
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT:  nb1 = file_info_get_mdate ( file_info1);
 
299
                                                                                                nb2 = file_info_get_mdate ( file_info2);
 
300
                                                                                                break;
 
301
                        }
 
302
 
 
303
                        if ( (str_name1!=NULL) && (str_name2!=NULL) )
 
304
                        {
 
305
                                if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
 
306
                                {
 
307
                                        result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
 
308
                                }
 
309
                                else
 
310
                                {
 
311
                                        if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
 
312
                                        {
 
313
                                                result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
 
314
                                        }
 
315
                                        else
 
316
                                        {
 
317
                                                result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?(nb1-nb2):(isfolder2-isfolder1));
 
318
                                        }
 
319
                                }
 
320
                        }
 
321
                }
 
322
        }
 
323
 
 
324
        return result;
 
325
}
 
326
 
 
327
 
 
328
gint gw_catalog_compare_file_guint64 ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
329
{
 
330
        struct file_info *file_info1 = NULL, *file_info2 = NULL;
 
331
        guint64 nb1 = 0, nb2 = 0;
 
332
        gboolean isfolder1 = FALSE, isfolder2 = FALSE;
 
333
        gchar *str_name1 = NULL, *str_name2 = NULL;
 
334
        gint result = 0;
 
335
 
 
336
 
 
337
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
338
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
339
#endif
 
340
 
 
341
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
342
        {
 
343
                file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
 
344
                file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
 
345
 
 
346
                if ( (file_info1!=NULL) && (file_info2!=NULL) )
 
347
                {
 
348
                        str_name1 = file_info_get_name ( file_info1);
 
349
                        str_name2 = file_info_get_name ( file_info2);
 
350
                        isfolder1 = file_info_get_isdirectory ( file_info1);
 
351
                        isfolder2 = file_info_get_isdirectory ( file_info2);
 
352
 
 
353
                        switch ( clist->sort_column)
 
354
                        {
 
355
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT:   nb1 = file_info_get_size ( file_info1);
 
356
                                                                                                nb2 = file_info_get_size ( file_info2);
 
357
                                                                                                break;
 
358
                        }
 
359
 
 
360
                        if ( (str_name1!=NULL) && (str_name2!=NULL) )
 
361
                        {
 
362
                                if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
 
363
                                {
 
364
                                        result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
 
365
                                }
 
366
                                else
 
367
                                {
 
368
                                        if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
 
369
                                        {
 
370
                                                result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
 
371
                                        }
 
372
                                        else
 
373
                                        {
 
374
                                                result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?(nb1-nb2):(isfolder2-isfolder1));
 
375
                                        }
 
376
                                }
 
377
                        }
 
378
                }
 
379
        }
 
380
 
 
381
        return result;
 
382
}
 
383
 
 
384
 
 
385
gint gw_catalog_compare_file_str ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
 
386
{
 
387
        struct file_info *file_info1 = NULL, *file_info2 = NULL;
 
388
        gchar *str_name1 = NULL, *str_name2 = NULL;
 
389
        gchar *str1 = NULL, *str2 = NULL;
 
390
        gboolean isfolder1 = FALSE, isfolder2 = FALSE;
 
391
        gint result = 0;
 
392
 
 
393
 
 
394
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
395
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
396
#endif
 
397
 
 
398
        if ( (ptr1!=NULL) && (ptr2!=NULL) )
 
399
        {
 
400
                file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
 
401
                file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
 
402
 
 
403
                if ( (file_info1!=NULL) && (file_info2!=NULL) )
 
404
                {
 
405
                        str_name1 = file_info_get_name ( file_info1);
 
406
                        str_name2 = file_info_get_name ( file_info2);
 
407
                        isfolder1 = file_info_get_isdirectory ( file_info1);
 
408
                        isfolder2 = file_info_get_isdirectory ( file_info2);
 
409
 
 
410
                        switch ( clist->sort_column)
 
411
                        {
 
412
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT:           str1 = str_name1;
 
413
                                                                                                        str2 = str_name2;
 
414
                                                                                                        break;
 
415
 
 
416
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT:         str1 = file_info_get_rights_to_gchar ( file_info1);
 
417
                                                                                                        str2 = file_info_get_rights_to_gchar ( file_info2);
 
418
                                                                                                        break;
 
419
 
 
420
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT:          str1 = file_info_get_owner ( file_info1);
 
421
                                                                                                        str2 = file_info_get_owner ( file_info2);
 
422
                                                                                                        break;
 
423
 
 
424
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT:          str1 = file_info_get_group ( file_info1);
 
425
                                                                                                        str2 = file_info_get_group ( file_info2);
 
426
                                                                                                        break;
 
427
 
 
428
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT:       str1 = file_info_get_category_name ( file_info1);
 
429
                                                                                                        str2 = file_info_get_category_name ( file_info2);
 
430
                                                                                                        break;
 
431
 
 
432
                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT:    str1 = file_info_get_description ( file_info1);
 
433
                                                                                                        str2 = file_info_get_description ( file_info2);
 
434
                                                                                                        break;
 
435
                        }
 
436
 
 
437
                        if ( (str_name1!=NULL) && (str_name2!=NULL) && (str1!=NULL) && (str2!=NULL) )
 
438
                        {
 
439
                                if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
 
440
                                {
 
441
                                        result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
 
442
                                }
 
443
                                else
 
444
                                {
 
445
                                        if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
 
446
                                        {
 
447
                                                result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
 
448
                                        }
 
449
                                        else
 
450
                                        {
 
451
                                                if ( gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_CASE_SENSITIVE) == 1 )
 
452
                                                {
 
453
                                                        result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?strcmp ( str1, str2):(isfolder2-isfolder1));
 
454
                                                }
 
455
                                                else
 
456
                                                {
 
457
                                                        result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?strcasecmp ( str1, str2):(isfolder2-isfolder1));
 
458
                                                }
 
459
                                        }
 
460
                                }
 
461
                        }
 
462
 
 
463
                        if ( clist->sort_column == GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT )
 
464
                        {
 
465
                                if ( str1 != NULL )
 
466
                                {
 
467
                                        g_free ( str1);
 
468
                                }
 
469
 
 
470
                                if ( str2 != NULL )
 
471
                                {
 
472
                                        g_free ( str2);
 
473
                                }
 
474
                        }
 
475
                }
 
476
        }
 
477
 
 
478
        return result;
 
479
}
 
480
 
 
481
 
 
482
gint gw_notebook_catalog_set_column_sort ( GtkCList *clist, gint column)
 
483
{
 
484
        GtkCTree *ctree = NULL;
 
485
        GtkCTreeNode *selection = NULL;
 
486
        gint result = -1;
 
487
 
 
488
 
 
489
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
490
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
491
#endif
 
492
 
 
493
        if ( (clist!=NULL) && (column>-1) )
 
494
        {
 
495
                /* Gets the selected item in the tree. */
 
496
                if ( (ctree = gw_gui_manager_main_interface_get_tree ( )) != NULL )
 
497
                {
 
498
                        if ( (GTK_CLIST ( ctree)->selection != NULL) && ((selection = GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data)) != NULL) )
 
499
                        {
 
500
                                if ( GTK_CTREE_ROW ( selection)->parent == NULL )
 
501
                                {
 
502
                                        /* User is in the catalog : this is a list of disks. */
 
503
                                        switch ( column)
 
504
                                        {
 
505
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NAME_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
506
                                                                                                                        break;
 
507
 
 
508
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FSNAME_POSITION_DEFAULT:         gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
509
                                                                                                                        break;
 
510
 
 
511
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_PATH_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
512
                                                                                                                        break;
 
513
 
 
514
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NBARCHIVE_POSITION_DEFAULT:      gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_int);
 
515
                                                                                                                        break;
 
516
 
 
517
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_TYPE_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
518
                                                                                                                        break;
 
519
 
 
520
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_VOLUME_POSITION_DEFAULT:         gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
521
                                                                                                                        break;
 
522
 
 
523
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CAPACITY_POSITION_DEFAULT:       gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_guint64);
 
524
                                                                                                                        break;
 
525
 
 
526
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FREE_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_guint64);
 
527
                                                                                                                        break;
 
528
 
 
529
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DATE_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_gulong);
 
530
                                                                                                                        break;
 
531
 
 
532
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_SERIAL_POSITION_DEFAULT:         gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
533
                                                                                                                        break;
 
534
 
 
535
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CATEGORY_POSITION_DEFAULT:       gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
536
                                                                                                                        break;
 
537
 
 
538
                                                case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_POSITION_DEFAULT:    gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
 
539
                                                                                                                        break;
 
540
 
 
541
                                                default:                                                                gtk_clist_set_compare_func ( clist, NULL);
 
542
                                                                                                                        break;
 
543
                                        }
 
544
                                }
 
545
                                else
 
546
                                {
 
547
                                        /* User is in a disk or a folder : this is a list of files. */
 
548
                                        switch ( column)
 
549
                                        {
 
550
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
 
551
                                                                                                                        break;
 
552
 
 
553
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT:         gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
 
554
                                                                                                                        break;
 
555
 
 
556
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT:          gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
 
557
                                                                                                                        break;
 
558
 
 
559
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT:          gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
 
560
                                                                                                                        break;
 
561
 
 
562
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT:           gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_guint64);
 
563
                                                                                                                        break;
 
564
 
 
565
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT:          gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_glong);
 
566
                                                                                                                        break;
 
567
 
 
568
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT:          gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_gulong);
 
569
                                                                                                                        break;
 
570
 
 
571
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT:          gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_gulong);
 
572
                                                                                                                        break;
 
573
 
 
574
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT:          gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_gulong);
 
575
                                                                                                                        break;
 
576
 
 
577
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT:       gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
 
578
                                                                                                                        break;
 
579
 
 
580
                                                case GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT:    gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
 
581
                                                                                                                        break;
 
582
 
 
583
                                                default:                                                                gtk_clist_set_compare_func ( clist, NULL);
 
584
                                                                                                                        break;
 
585
                                        }
 
586
                                }
 
587
                        }
 
588
                }
 
589
 
 
590
                result = 0;
 
591
        }
 
592
 
 
593
        return result;
 
594
}
 
595
 
 
596
 
 
597
gboolean gw_notebook_catalog_column_sort ( GtkCList *clist, gint column, gpointer data)
 
598
{
 
599
        gboolean result = FALSE;
 
600
 
 
601
 
 
602
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
603
        g_print ( "*** GW - %s (%d) :: %s() : column=%d data=%d\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, column, GPOINTER_TO_INT ( data));
 
604
#endif
 
605
 
 
606
        if ( clist != NULL )
 
607
        {
 
608
                if ( GPOINTER_TO_INT ( data) != -1 )
 
609
                {
 
610
                        if ( column == clist->sort_column )
 
611
                        {
 
612
                                if ( clist->sort_type == GTK_SORT_ASCENDING )
 
613
                                {
 
614
                                        clist->sort_type = GTK_SORT_DESCENDING;
 
615
                                }
 
616
                                else
 
617
                                {
 
618
                                        clist->sort_type = GTK_SORT_ASCENDING;
 
619
                                }
 
620
                        }
 
621
                        else
 
622
                        {
 
623
                                gtk_clist_set_sort_column ( clist, column);
 
624
                        }
 
625
                }
 
626
 
 
627
                gw_notebook_catalog_set_column_sort ( clist, column);
 
628
 
 
629
                if ( GPOINTER_TO_INT ( data) != -1 )
 
630
                {
 
631
                gtk_clist_sort ( clist);
 
632
                }
 
633
 
 
634
                result = TRUE;
 
635
        }
 
636
 
 
637
        return result;
 
638
}
 
639
 
 
640
 
 
641
gboolean gw_notebook_catalog_clist_button_press_event ( GtkWidget *w, GdkEventButton *event)
 
642
{
 
643
        GtkCList *clist_info = NULL;
 
644
        GtkCTreeNode *selection = NULL, *node = NULL, *child = NULL;
 
645
        struct disk_info *disk_info = NULL;
 
646
        struct file_info *file_info = NULL;
 
647
        GdkEventButton *bev = ( GdkEventButton *)event;
 
648
        gint row,col;
 
649
        GtkWindow *window = NULL;
 
650
        GtkCTree *ctree = NULL;
 
651
        GtkCTreeNode *root = NULL;
 
652
        gchar *tmp_date = NULL;
 
653
 
 
654
 
 
655
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
656
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
657
#endif
 
658
 
 
659
        /* Gets all needs references. */
 
660
        window = gw_gui_manager_main_interface_get_main_window ( );
 
661
        ctree = gw_gui_manager_main_interface_get_tree ( );
 
662
        root = gw_gui_manager_main_interface_get_tree_root ( );
 
663
        clist_info = gw_notebook_catalog_get_clist_explorer ( window);
 
664
 
 
665
        if ( root == NULL )
 
666
        {
 
667
                /* If no one opened catalog. */
 
668
                return FALSE;
 
669
        }
 
670
 
 
671
        /* Ignores clicks on scrollbars. */
 
672
        if ( event->window != GTK_CLIST ( clist_info)->clist_window )
 
673
        {
 
674
                return FALSE;
 
675
        }
 
676
 
 
677
        /* Gets the selected item in the tree. */
 
678
        selection = GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data);
 
679
 
 
680
        /* Gets the selected item in the list. */
 
681
        gtk_clist_get_selection_info ( clist_info, event->x, event->y, &row, &col);
 
682
 
 
683
        /* Stops the signal during the process. */
 
684
        /* If uncomment this line, the item will not be selected.
 
685
        gtk_signal_emit_stop_by_name ( GTK_OBJECT ( clist_info), "button_press_event");
 
686
        */
 
687
 
 
688
        /* Checks if it's a double click. */
 
689
        if ( event->type == GDK_2BUTTON_PRESS )
 
690
        {
 
691
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
692
        g_print ( "*** GW - %s (%d) :: %s() : user make a double click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
693
#endif
 
694
 
 
695
                /* If it's a double click. */
 
696
                if ( event->button == 1 )
 
697
                {
 
698
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
699
                        g_print ( "*** GW - %s (%d) :: %s() : user make a left double click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
700
#endif
 
701
 
 
702
                        /* If it's a double left click. */
 
703
 
 
704
                        /* To prevent that double click generates a signal in excess. */
 
705
                        gdk_event_get ( );
 
706
 
 
707
                        if ( GTK_CTREE_ROW ( selection)->parent == NULL )
 
708
                        {
 
709
                                /* User is in the catalog : he clicked on a disk. */
 
710
 
 
711
                                /* Gets informations attached to the line. */
 
712
                                if ( (disk_info = (struct disk_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
 
713
                                {
 
714
                                        /* If user clicked in empty space. */
 
715
 
 
716
                                        return TRUE;
 
717
                                }
 
718
                                else
 
719
                                {
 
720
                                        /* Else if user clicked on a disk. */
 
721
 
 
722
                                        if ( !GTK_CTREE_ROW ( selection)->expanded )
 
723
                                        {
 
724
                                                gtk_ctree_expand ( ctree, selection);
 
725
                                        }
 
726
 
 
727
                                        /* Searches in the tree where is the selected disk. */
 
728
                                        child = GTK_CTREE_ROW ( selection)->children;
 
729
                                        while ( child != NULL )
 
730
                                        {
 
731
                                                if ( strcmp ( disk_info_get_name ( disk_data_get_info ( gtk_ctree_node_get_row_data ( ctree, child))), disk_info_get_name ( disk_info)) == 0 )
 
732
                                                {
 
733
                                                        gtk_ctree_select ( ctree, child);
 
734
 
 
735
                                                        return TRUE;
 
736
                                                }
 
737
 
 
738
                                                child = GTK_CTREE_NODE_NEXT( child);
 
739
                                        }
 
740
 
 
741
                                        return TRUE;
 
742
                                }
 
743
                        }
 
744
                        else
 
745
                        {
 
746
                                /* Else if user clicked on a folder or a file. */
 
747
 
 
748
                                /* Gets informations attached to the line. */
 
749
                                if ( (file_info = (struct file_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
 
750
                                {
 
751
                                        /* If user clicked in empty space. */
 
752
 
 
753
                                        return TRUE;
 
754
                                }
 
755
                                else
 
756
                                {
 
757
                                        /* Else if user clicked on an item. */
 
758
 
 
759
                                        if ( file_info_get_isdirectory ( file_info) )
 
760
                                        {
 
761
                                                /* If it's a folder. */
 
762
 
 
763
                                                if ( (strlen ( file_info_get_name ( file_info)) == 2) && (strncmp ( file_info_get_name ( file_info), "..", 2) == 0) )
 
764
                                                {
 
765
                                                        /* If it's the parent folder. */
 
766
 
 
767
                                                        child = GTK_CTREE_ROW ( selection)->parent;
 
768
 
 
769
                                                        if ( child != root )
 
770
                                                        {
 
771
                                                                gtk_ctree_select ( ctree, child);
 
772
                                                        }
 
773
 
 
774
                                                        return TRUE;
 
775
                                                }
 
776
                                                else
 
777
                                                {
 
778
                                                        /* Else if it's an unspecified folder. */
 
779
 
 
780
                                                        if ( !GTK_CTREE_ROW ( selection)->expanded )
 
781
                                                        {
 
782
                                                                gtk_ctree_expand ( ctree, selection);
 
783
                                                        }
 
784
 
 
785
                                                        /* Searches in the tree where is the selected folder. */
 
786
                                                        child = GTK_CTREE_ROW ( selection)->children;
 
787
                                                        while ( child != NULL )
 
788
                                                        {
 
789
                                                                if ( strcmp ( file_info_get_name ( dir_data_get_info ( gtk_ctree_node_get_row_data ( ctree, child))), file_info_get_name ( file_info)) == 0 )
 
790
                                                                {
 
791
                                                                        gtk_ctree_select ( ctree, child);
 
792
 
 
793
                                                                        return TRUE;
 
794
                                                                }
 
795
 
 
796
                                                                child = GTK_CTREE_NODE_NEXT ( child);
 
797
                                                        }
 
798
 
 
799
                                                        return TRUE;
 
800
                                                }
 
801
                                        }
 
802
                                        else
 
803
                                        {
 
804
                                                /* If it's a file. */
 
805
                                                tmp_date = file_info_get_cdate_to_gchar ( file_info);
 
806
                                                gw_status_bar_put_msg_file ( window,
 
807
                                                                        file_info_get_name ( file_info),
 
808
                                                                        file_info_get_size ( file_info),
 
809
                                                                        tmp_date,
 
810
                                                                        1);
 
811
                                                g_free ( tmp_date);
 
812
 
 
813
                                                return TRUE;
 
814
                                        }
 
815
                                }
 
816
                        }
 
817
                }
 
818
        }
 
819
        else { if ( event->type == GDK_BUTTON_PRESS )
 
820
        {
 
821
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
822
        g_print ( "*** GW - %s (%d) :: %s() : user make a single click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
823
#endif
 
824
 
 
825
                /* If it's a single click. */
 
826
                if ( event->button == 1 )
 
827
                {
 
828
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
829
                        g_print ( "*** GW - %s (%d) :: %s() : user make a left single click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
830
#endif
 
831
 
 
832
                        if ( GTK_CTREE_ROW ( selection)->parent == NULL )
 
833
                        {
 
834
                                /* User is in the catalog : he clicked on a disk. */
 
835
 
 
836
                                /* Gets informations attached to the line. */
 
837
                                if ( (disk_info = (struct disk_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
 
838
                                {
 
839
                                        /* If user clicked on a empty space. */
 
840
 
 
841
                                        return TRUE;
 
842
                                }
 
843
                                else
 
844
                                {
 
845
                                        /* Else if user clicked on a disk. */
 
846
 
 
847
                                        /* Searches in the tree the selected disk. */
 
848
                                        node = gw_notebook_catalog_ctree_node_get_child ( GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data), disk_info_get_name ( disk_info));
 
849
                                        disk_info = disk_data_get_info ( gtk_ctree_node_get_row_data ( ctree, node));
 
850
 
 
851
                                        /* Updates the status bar. */
 
852
                                        gw_status_bar_put_msg_disk ( window,
 
853
                                                                disk_info_get_name ( disk_info),
 
854
                                                                disk_info_get_type ( disk_info),
 
855
                                                                disk_info_get_capacity ( disk_info),
 
856
                                                                disk_info_get_free ( disk_info),
 
857
                                                                (long double)disk_info_get_full ( disk_info),
 
858
                                                                0);
 
859
 
 
860
                                        return TRUE;
 
861
                                }
 
862
                        }
 
863
                        else
 
864
                        {
 
865
                                /* If user clicked on a folder or a file. */
 
866
 
 
867
                                /* Gets informations attached to the line. */
 
868
                                if ( (file_info = (struct file_info*)gtk_clist_get_row_data ( GTK_CLIST( clist_info), row)) == NULL )
 
869
                                {
 
870
                                        /* User clicked on a empty space. */
 
871
 
 
872
                                        return TRUE;
 
873
                                }
 
874
                                else
 
875
                                {
 
876
                                        /* If user clicked on an item. */
 
877
 
 
878
                                        if ( file_info_get_isdirectory ( file_info) )
 
879
                                        {
 
880
                                                /* If it's a folder. */
 
881
 
 
882
                                                if ( (strlen ( file_info_get_name ( file_info)) == 2) && (strncmp ( file_info_get_name ( file_info), "..", 2) == 0) )
 
883
                                                {
 
884
                                                        /* If it's the parent folder. */
 
885
 
 
886
                                                        /* Updates the status bar. */
 
887
                                                        tmp_date = file_info_get_cdate_to_gchar ( file_info);
 
888
                                                        gw_status_bar_put_msg_file ( window,
 
889
                                                                                file_info_get_name ( file_info),
 
890
                                                                                file_info_get_size ( file_info),
 
891
                                                                                tmp_date,
 
892
                                                                                1);
 
893
                                                        g_free ( tmp_date);
 
894
                                                        /* Must return FALSE to show the selected item with GTK+ 2.x (with bleu background) */
 
895
 
 
896
                                                        return FALSE;
 
897
                                                }
 
898
                                                else
 
899
                                                {
 
900
                                                        /* If it's an unspecified folder. */
 
901
 
 
902
                                                        /* Searches in the tree where is the selected folder. */
 
903
                                                        node = gw_notebook_catalog_ctree_node_get_child ( GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data), file_info_get_name ( file_info));
 
904
                                                        file_info = dir_data_get_info ( gtk_ctree_node_get_row_data ( ctree, node));
 
905
 
 
906
                                                        /* Updates the status bar. */
 
907
                                                        gw_status_bar_put_msg_dir ( window,
 
908
                                                                                file_info_get_name ( file_info),
 
909
                                                                                file_info_get_size ( file_info),
 
910
                                                                                dir_data_get_num_file ( gtk_ctree_node_get_row_data ( ctree, node)) - 1,
 
911
                                                                                gw_notebook_catalog_ctree_node_get_num_children ( node),
 
912
                                                                                0);
 
913
                                                        /* Must return FALSE to show the selected item with GTK+ 2.x (with bleu background) */
 
914
 
 
915
                                                        return FALSE;
 
916
                                                }
 
917
                                        }
 
918
                                        else
 
919
                                        {
 
920
                                                /* If it's a file. */
 
921
 
 
922
                                                /* Updates a the status bar. */
 
923
                                                tmp_date = file_info_get_cdate_to_gchar ( file_info);
 
924
                                                gw_status_bar_put_msg_file ( window,
 
925
                                                                        file_info_get_name ( file_info),
 
926
                                                                        file_info_get_size ( file_info),
 
927
                                                                        tmp_date,
 
928
                                                                        1);
 
929
                                                g_free ( tmp_date);
 
930
 
 
931
                                                return FALSE;
 
932
                                        }
 
933
                                }
 
934
                        }
 
935
                }
 
936
                else { if ( event->button == 3 )
 
937
                {
 
938
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
939
        g_print ( "*** GW - %s (%d) :: %s() : user make a right single click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
940
#endif
 
941
 
 
942
                        /* If it's a right click : displays the popup menu. */
 
943
 
 
944
 
 
945
                        if ( GTK_CTREE_ROW ( selection)->parent == NULL )
 
946
                        {
 
947
                                /* User is in the catalog : he clicked on a disk. */
 
948
 
 
949
                                /* Gets informations attached to the line. */
 
950
                                if ( (disk_info = (struct disk_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
 
951
                                {
 
952
                                        /* User clicked on empty space. */
 
953
 
 
954
                                        return TRUE;
 
955
                                }
 
956
                                else
 
957
                                {
 
958
                                        /* Else if user clicked on a disk. */
 
959
 
 
960
                                        /* Searches in the tree where is the selected disk. */
 
961
                                        node = gw_notebook_catalog_ctree_node_get_child ( GTK_CTREE_NODE( GTK_CLIST( ctree)->selection->data), disk_info_get_name ( disk_info));
 
962
 
 
963
                                        /* Displays the popup menu. */
 
964
                                        gtk_menu_popup ( gw_menu_popup_disk_create_and_show ( node, window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
965
 
 
966
                                        return TRUE;
 
967
                                }
 
968
                        }
 
969
                        else
 
970
                        {
 
971
                                /* User clicked on a folder or a file. */
 
972
 
 
973
                                /* Gets informations attached to the line. */
 
974
                                if ( (file_info = (struct file_info*)gtk_clist_get_row_data ( GTK_CLIST( clist_info), row)) == NULL )
 
975
                                {
 
976
                                        /* If user clicked on empty space. */
 
977
 
 
978
                                        return TRUE;
 
979
                                }
 
980
                                else
 
981
                                {
 
982
                                        /* Else if user clicked on an item. */
 
983
 
 
984
                                        if ( file_info_get_isdirectory ( file_info) )
 
985
                                        {
 
986
                                                /* If it's a folder. */
 
987
 
 
988
                                                if ( (strlen ( file_info_get_name ( file_info)) == 2) && (strncmp ( file_info_get_name ( file_info), "..", 2) == 0) )
 
989
                                                {
 
990
                                                        /* If it's the parent folder. */
 
991
 
 
992
                                                        return TRUE;
 
993
                                                }
 
994
                                                else
 
995
                                                {
 
996
                                                        /* Else if it's an unspecified folder. */
 
997
 
 
998
                                                        /* Searches in the tree where is the selected folder. */
 
999
                                                        node = gw_notebook_catalog_ctree_node_get_child ( GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data), file_info_get_name ( file_info));
 
1000
 
 
1001
                                                        /* Displays the popup menu. */
 
1002
                                                        gtk_menu_popup ( gw_menu_popup_dir_create_and_show ( node, window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
1003
 
 
1004
                                                        return TRUE;
 
1005
                                                }
 
1006
                                        }
 
1007
                                        else
 
1008
                                        {
 
1009
                                                /* If it's a file which is selected. */
 
1010
 
 
1011
                                                /* Displays the popup menu. */
 
1012
                                                gtk_menu_popup ( gw_menu_popup_file_create_and_show ( GINT_TO_POINTER ( row), window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
1013
 
 
1014
                                                return TRUE;
 
1015
                                        }
 
1016
                                }
 
1017
                        }
 
1018
                }}
 
1019
        }}
 
1020
 
 
1021
        return FALSE;
 
1022
}
 
1023
 
 
1024
 
 
1025
gint gw_notebook_catalog_clist_column_resized ( GtkCList *clist, gint column, gint width, gpointer user_data)
 
1026
{
 
1027
        GtkCTreeNode *root = gw_gui_manager_main_interface_get_tree_root ( );
 
1028
        GtkCTree *ctree = NULL;
 
1029
        GtkCTreeNode *selection = NULL;
 
1030
        gint result = -1;
 
1031
        gint autoresize = -1;
 
1032
 
 
1033
 
 
1034
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1035
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1036
#endif
 
1037
 
 
1038
        if ( (root!=NULL) && (clist!=NULL) && (column>-1) )
 
1039
        {
 
1040
                if ( (autoresize = gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_COLUMN_AUTORESIZE)) == -1 )
 
1041
                {
 
1042
                        autoresize = GW_VALUE_APP_EXPLORER_COLUMN_AUTORESIZE_DEFAULT;
 
1043
                }
 
1044
 
 
1045
                /* Saves the column width only if the autoresize mode is desactivated. */
 
1046
                if ( autoresize == FALSE )
 
1047
                {
 
1048
                        /* Gets the selected item in the tree. */
 
1049
                        if ( (ctree = gw_gui_manager_main_interface_get_tree ( )) != NULL )
 
1050
                        {
 
1051
                                if ( (GTK_CLIST ( ctree)->selection != NULL) && ((selection = GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data)) != NULL) )
 
1052
                                {
 
1053
                                        if ( GTK_CTREE_ROW ( selection)->parent == NULL )
 
1054
                                        {
 
1055
                                                /* User is in the catalog : this is a list of disks. */
 
1056
                                                switch ( column)
 
1057
                                                {
 
1058
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NAME_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_NAME_SIZE, g_strdup_printf ( "%d", width));
 
1059
                                                                                                                                break;
 
1060
 
 
1061
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FSNAME_POSITION_DEFAULT:         gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_FSNAME_SIZE, g_strdup_printf ( "%d", width));
 
1062
                                                                                                                                break;
 
1063
 
 
1064
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_PATH_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_PATH_SIZE, g_strdup_printf ( "%d", width));
 
1065
                                                                                                                                break;
 
1066
 
 
1067
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NBARCHIVE_POSITION_DEFAULT:      gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_NBARCHIVE_SIZE, g_strdup_printf ( "%d", width));
 
1068
                                                                                                                                break;
 
1069
 
 
1070
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_TYPE_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_TYPE_SIZE, g_strdup_printf ( "%d", width));
 
1071
                                                                                                                                break;
 
1072
 
 
1073
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_VOLUME_POSITION_DEFAULT:         gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_VOLUME_SIZE, g_strdup_printf ( "%d", width));
 
1074
                                                                                                                                break;
 
1075
 
 
1076
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CAPACITY_POSITION_DEFAULT:       gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_CAPACITY_SIZE, g_strdup_printf ( "%d", width));
 
1077
                                                                                                                                break;
 
1078
 
 
1079
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FREE_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_FREE_SIZE, g_strdup_printf ( "%d", width));
 
1080
                                                                                                                                break;
 
1081
 
 
1082
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DATE_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_DATE_SIZE, g_strdup_printf ( "%d", width));
 
1083
                                                                                                                                break;
 
1084
 
 
1085
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_SERIAL_POSITION_DEFAULT:         gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_SERIAL_SIZE, g_strdup_printf ( "%d", width));
 
1086
                                                                                                                                break;
 
1087
 
 
1088
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CATEGORY_POSITION_DEFAULT:       gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_CATEGORY_SIZE, g_strdup_printf ( "%d", width));
 
1089
                                                                                                                                break;
 
1090
 
 
1091
                                                        case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_POSITION_DEFAULT:    gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_SIZE, g_strdup_printf ( "%d", width));
 
1092
                                                                                                                                break;
 
1093
 
 
1094
                                                        default:                                                                break;
 
1095
                                                }
 
1096
 
 
1097
                                                result = 0;
 
1098
                                        }
 
1099
                                        else
 
1100
                                        {
 
1101
                                                /* User is in a disk or a folder : this is a list of files. */
 
1102
                                                switch ( column)
 
1103
                                                {
 
1104
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_SIZE, g_strdup_printf ( "%d", width));
 
1105
                                                                                                                                break;
 
1106
 
 
1107
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT:         gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_SIZE, g_strdup_printf ( "%d", width));
 
1108
                                                                                                                                break;
 
1109
 
 
1110
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT:          gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_SIZE, g_strdup_printf ( "%d", width));
 
1111
                                                                                                                                break;
 
1112
 
 
1113
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT:          gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_SIZE, g_strdup_printf ( "%d", width));
 
1114
                                                                                                                                break;
 
1115
 
 
1116
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT:           gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_SIZE, g_strdup_printf ( "%d", width));
 
1117
                                                                                                                                break;
 
1118
 
 
1119
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT:          gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_SIZE, g_strdup_printf ( "%d", width));
 
1120
                                                                                                                                break;
 
1121
 
 
1122
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT:          gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_SIZE, g_strdup_printf ( "%d", width));
 
1123
                                                                                                                                break;
 
1124
 
 
1125
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT:          gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_SIZE, g_strdup_printf ( "%d", width));
 
1126
                                                                                                                                break;
 
1127
 
 
1128
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT:          gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_SIZE, g_strdup_printf ( "%d", width));
 
1129
                                                                                                                                break;
 
1130
 
 
1131
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT:       gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_SIZE, g_strdup_printf ( "%d", width));
 
1132
                                                                                                                                break;
 
1133
 
 
1134
                                                        case GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT:    gw_application_manager_set_settings ( GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_SIZE, g_strdup_printf ( "%d", width));
 
1135
                                                                                                                                break;
 
1136
 
 
1137
                                                        default:                                                                break;
 
1138
                                                }
 
1139
 
 
1140
                                                result = 0;
 
1141
                                        }
 
1142
                                }
 
1143
                                else
 
1144
                                {
 
1145
                                }
 
1146
                        }
 
1147
                        else
 
1148
                        {
 
1149
                        }
 
1150
                }
 
1151
        }
 
1152
 
 
1153
        return result;
 
1154
}
 
1155
 
 
1156
 
 
1157
gboolean gw_notebook_catalog_ctree_button_press_event ( GtkWidget *w, GdkEventButton *event)
 
1158
{
 
1159
        GtkCList *clist;
 
1160
        GtkCTreeNode *node;
 
1161
        gint row, col;
 
1162
        GdkEventButton *bev = NULL;
 
1163
        GtkCTree *ctree = NULL;
 
1164
        GtkWindow *window = NULL;
 
1165
 
 
1166
 
 
1167
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1168
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1169
#endif
 
1170
 
 
1171
        bev = ( GdkEventButton *)event;
 
1172
        ctree = gw_gui_manager_main_interface_get_tree ( );
 
1173
        window = gw_gui_manager_main_interface_get_main_window ( );
 
1174
        clist = GTK_CLIST ( w);
 
1175
 
 
1176
        /* Ignores clicks on scrollbars. */
 
1177
        if ( event->window != GTK_CLIST ( clist)->clist_window )
 
1178
        {
 
1179
                return TRUE;
 
1180
        }
 
1181
 
 
1182
        gtk_clist_get_selection_info ( GTK_CLIST ( clist), event->x, event->y, &row, &col);
 
1183
        node = GTK_CTREE_NODE ( g_list_nth ( clist->row_list, row));
 
1184
 
 
1185
        /* Stops the signal during the process, except for single left click in order expand or
 
1186
           collapse node with click on the cross node. */
 
1187
        if ( !((event->type == GDK_BUTTON_PRESS) && (event->button == 1)) )
 
1188
        {
 
1189
                gtk_signal_emit_stop_by_name ( GTK_OBJECT ( ctree), "button_press_event");
 
1190
        }
 
1191
 
 
1192
        /* Checks if it's a double click. */
 
1193
        if ( event->type == GDK_2BUTTON_PRESS )
 
1194
        {
 
1195
                /* Checks if it's a left click. */
 
1196
                if ( event->button == 1 )
 
1197
                {
 
1198
                        /* Prevents from double click to generate too many signals. */
 
1199
                        gdk_event_get ( );
 
1200
 
 
1201
                        /* Checks if user didn't click in the empty space. */
 
1202
                        if ( node != NULL )
 
1203
                        {
 
1204
                                /* Opens or closes the node. */
 
1205
                                if ( GTK_CTREE_ROW ( node)->expanded )
 
1206
                                {
 
1207
                                        gtk_ctree_collapse ( ctree, node);
 
1208
                                }
 
1209
                                else
 
1210
                                {
 
1211
                                        gtk_ctree_expand ( ctree, node);
 
1212
                                }
 
1213
 
 
1214
                                gtk_ctree_select ( ctree, node);
 
1215
                        }
 
1216
 
 
1217
                        return TRUE;
 
1218
                }
 
1219
        }
 
1220
        /* Checks if it's a single click. */
 
1221
        else { if ( event->type == GDK_BUTTON_PRESS )
 
1222
        {
 
1223
                /* Checks if it's a left click. */
 
1224
                if ( event->button == 1 )
 
1225
                {
 
1226
                        if ( node != NULL )
 
1227
                        {
 
1228
                                /* If user didn't click in the empty space : select the row. */
 
1229
                                gtk_ctree_select ( ctree, node);
 
1230
                        }
 
1231
 
 
1232
                        return FALSE;
 
1233
                }
 
1234
                /* Checks if it's a right click. */
 
1235
                else { if ( event->button == 3 )
 
1236
                {
 
1237
                        /* Displays the popup menu. */
 
1238
                        if ( node == NULL )
 
1239
                        {
 
1240
                                /* If user clicked in the empty space. */
 
1241
                                gtk_menu_popup ( gw_menu_popup_create_and_show ( window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
1242
 
 
1243
                                return TRUE;
 
1244
                        }
 
1245
                        else
 
1246
                        {
 
1247
                                /* Selects the item for more user visibility. */
 
1248
                                gtk_ctree_select ( ctree, node);
 
1249
                                gw_gui_manager_main_interface_refresh ( );
 
1250
 
 
1251
                                if ( GTK_CTREE_ROW ( node)->parent == NULL )
 
1252
                                {
 
1253
                                        /* If user clicked on a catalog. */
 
1254
                                        gtk_menu_popup ( gw_menu_popup_catalog_create_and_show ( node, window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
1255
 
 
1256
                                        return TRUE;
 
1257
                                }
 
1258
                                else { if ( GTK_CTREE_ROW ( GTK_CTREE_ROW ( node)->parent)->parent == NULL )
 
1259
                                {
 
1260
                                        /* If user clicked on a disk. */
 
1261
                                        gtk_menu_popup ( gw_menu_popup_disk_create_and_show ( node, window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
1262
 
 
1263
                                        return TRUE;
 
1264
                                }
 
1265
                                else
 
1266
                                {
 
1267
                                        /* If user clicked on a folder. */
 
1268
                                        gtk_menu_popup ( gw_menu_popup_dir_create_and_show ( node, window), NULL, NULL, NULL, NULL, bev->button, bev->time);
 
1269
 
 
1270
                                        return TRUE;
 
1271
                                }}
 
1272
                        }
 
1273
 
 
1274
                        return TRUE;
 
1275
                }}
 
1276
        }}
 
1277
 
 
1278
        return FALSE;
 
1279
}
 
1280
 
 
1281
 
 
1282
gboolean gw_notebook_catalog_ctree_select_row ( GtkCTree *ctree, GtkCTreeNode *node, gint column, gpointer g)
 
1283
{
 
1284
        GtkCList *clist_info = NULL;
 
1285
        struct disk_info *disk_info = NULL;
 
1286
        gchar *info[12];
 
1287
        gint i, row, compt = 0, compt_file = 0;
 
1288
        double size = 0;
 
1289
        GtkCTreeNode *tmp = NULL;
 
1290
        struct file_info *file_info = NULL;
 
1291
        struct dir_data *dir_data = NULL;
 
1292
        struct disk_data *disk_data = NULL;
 
1293
        GList *files_data = NULL;
 
1294
        GtkWindow *window = NULL;
 
1295
        GtkCTreeNode *root = NULL;
 
1296
        gchar *text_utf8 = NULL;
 
1297
        gchar *tmp_date = NULL;
 
1298
 
 
1299
 
 
1300
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1301
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1302
#endif
 
1303
 
 
1304
        window = gw_gui_manager_main_interface_get_main_window ( );
 
1305
        root = gw_gui_manager_main_interface_get_tree_root ( );
 
1306
        clist_info = gw_notebook_catalog_get_clist_explorer ( window);
 
1307
 
 
1308
        /* Stop the signal during the process. */
 
1309
        gtk_signal_emit_stop_by_name ( GTK_OBJECT ( ctree), "tree_select_row");
 
1310
 
 
1311
        /* Freezes informations table */
 
1312
        gtk_clist_freeze ( clist_info);
 
1313
        gtk_clist_clear ( clist_info);
 
1314
 
 
1315
        /* Updates list */
 
1316
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1317
        g_print ( "*** GW - %s (%d) :: %s() : updates list\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1318
#endif
 
1319
 
 
1320
        if ( node == root )
 
1321
        {
 
1322
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1323
                g_print ( "*** GW - %s (%d) :: %s() : catalog selected\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1324
#endif
 
1325
 
 
1326
                /* If a catalog is selected, must to display disk list */
 
1327
                gw_notebook_catalog_clist_explorer_set_column_title_disk ( );
 
1328
                node = GTK_CTREE_ROW ( GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data))->children;
 
1329
 
 
1330
                while ( node != NULL )
 
1331
                {
 
1332
                        compt++;
 
1333
                                                disk_info = disk_data_get_info ( gtk_ctree_node_get_row_data ( ctree, node));
 
1334
                                                size = size + disk_info_get_full ( disk_info);
 
1335
 
 
1336
                        g_strdup_to_gtk_text ( disk_info_get_name ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_NAME_POSITION_DEFAULT]);
 
1337
                        g_strdup_to_gtk_text ( disk_info_get_fsname ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_FSNAME_POSITION_DEFAULT]);
 
1338
                        g_strdup_to_gtk_text ( disk_info_get_dir ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_PATH_POSITION_DEFAULT]);
 
1339
                        text_utf8 = g_strdup_printf ( "%d", disk_info_get_num ( disk_info));
 
1340
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_NBARCHIVE_POSITION_DEFAULT]);
 
1341
                        g_free ( text_utf8);
 
1342
                        g_strdup_to_gtk_text ( disk_info_get_type ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_TYPE_POSITION_DEFAULT]);
 
1343
                        g_strdup_to_gtk_text ( disk_info_get_volume ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_VOLUME_POSITION_DEFAULT]);
 
1344
                        text_utf8 = gw_ui64_byte_to_str_format ( disk_info_get_capacity ( disk_info));
 
1345
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_CAPACITY_POSITION_DEFAULT]);
 
1346
                        g_free ( text_utf8);
 
1347
                        text_utf8 = gw_ui64_byte_to_str_format ( disk_info_get_free ( disk_info));
 
1348
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_FREE_POSITION_DEFAULT]);
 
1349
                        g_free ( text_utf8);
 
1350
                        tmp_date = disk_info_get_date_to_gchar ( disk_info);
 
1351
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_DATE_POSITION_DEFAULT]);
 
1352
                        g_free ( tmp_date);
 
1353
                        g_strdup_to_gtk_text ( disk_info_get_serial ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_SERIAL_POSITION_DEFAULT]);
 
1354
                        g_strdup_to_gtk_text ( disk_info_get_category_name ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_CATEGORY_POSITION_DEFAULT]);
 
1355
                        g_strdup_to_gtk_text ( disk_info_get_description ( disk_info), info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_POSITION_DEFAULT]);
 
1356
                        gw_str_replace_char ( info[GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_POSITION_DEFAULT], '\n', ' ');
 
1357
 
 
1358
                        row = gtk_clist_append ( clist_info, info);
 
1359
 
 
1360
                        /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1361
                        gtk_clist_set_row_data_full ( clist_info, row, disk_info, NULL);
 
1362
                        gtk_clist_set_pixtext ( clist_info, row, 0, info[0], 5, disk_info_get_pixmap ( disk_info), disk_info_get_bitmap ( disk_info));
 
1363
 
 
1364
                        /* Frees memory used by info. */
 
1365
                        for ( i = 0; i < 11; i++)
 
1366
                        {
 
1367
                                g_free ( info[i]);
 
1368
                        }
 
1369
 
 
1370
                        node = GTK_CTREE_ROW ( node)->sibling;
 
1371
                }
 
1372
 
 
1373
                /* Displays in the status bar the informations about the selected item. */
 
1374
                gw_status_bar_put_msg_catalog ( window, ctree, root, compt, size);
 
1375
 
 
1376
                /* Updates the list of disk. */
 
1377
                gtk_clist_sort ( clist_info);
 
1378
                gtk_clist_thaw ( clist_info);
 
1379
 
 
1380
                return TRUE;
 
1381
        }
 
1382
        else { if ( GTK_CTREE_ROW ( node)->parent == root )
 
1383
        {
 
1384
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1385
                g_print ( "*** GW - %s (%d) :: %s() : disk selected\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1386
#endif
 
1387
 
 
1388
                /* If a disk is selected, must to display folders and files list */
 
1389
                gw_notebook_catalog_clist_explorer_set_column_title_file ( );
 
1390
                tmp = node;
 
1391
 
 
1392
                /* Folders displaying. */
 
1393
                node = GTK_CTREE_ROW ( node)->children;
 
1394
                while ( node != NULL )
 
1395
                {
 
1396
                        compt++;
 
1397
                        file_info = dir_data_get_info ( gtk_ctree_node_get_row_data ( ctree, node));
 
1398
                        size = size + file_info_get_size ( file_info);
 
1399
                        g_strdup_to_gtk_text ( file_info_get_name ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT]);
 
1400
                        tmp_date = file_info_get_rights_to_gchar ( file_info);
 
1401
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT]);
 
1402
                        g_free ( tmp_date);
 
1403
                        if ( strlen ( file_info_get_owner ( file_info)) != 0 )
 
1404
                        {
 
1405
                                g_strdup_to_gtk_text ( file_info_get_owner ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1406
                        }
 
1407
                        else
 
1408
                        {
 
1409
                                g_strdup_to_gtk_text ( _( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1410
                        }
 
1411
                        if ( strlen ( file_info_get_group ( file_info)) != 0 )
 
1412
                        {
 
1413
                                g_strdup_to_gtk_text ( file_info_get_group ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1414
                        }
 
1415
                        else
 
1416
                        {
 
1417
                                g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1418
                        }
 
1419
                        text_utf8 = gw_ui64_byte_to_str_format ( file_info_get_size ( file_info));
 
1420
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT]);
 
1421
                        g_free ( text_utf8);
 
1422
                        text_utf8 = g_strdup_printf ( "%ld", file_info_get_inode ( file_info));
 
1423
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT]);
 
1424
                        g_free ( text_utf8);
 
1425
                        tmp_date = file_info_get_cdate_to_gchar ( file_info);
 
1426
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT]);
 
1427
                        g_free ( tmp_date);
 
1428
                        tmp_date = file_info_get_mdate_to_gchar ( file_info);
 
1429
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT]);
 
1430
                        g_free ( tmp_date);
 
1431
                        tmp_date = file_info_get_adate_to_gchar ( file_info);
 
1432
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT]);
 
1433
                        g_free ( tmp_date);
 
1434
                        g_strdup_to_gtk_text ( file_info_get_category_name ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT]);
 
1435
                        g_strdup_to_gtk_text ( file_info_get_description ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT]);
 
1436
                        gw_str_replace_char ( info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT], '\n', ' ');
 
1437
                        g_strdup_to_gtk_text ( NULL, info[11]);
 
1438
 
 
1439
                        row = gtk_clist_append ( clist_info, info);
 
1440
 
 
1441
                        /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1442
                        gtk_clist_set_row_data_full ( clist_info, row, file_info, NULL);
 
1443
                        if ( dir_data_get_num_file ( gtk_ctree_node_get_row_data ( ctree, node))==0 && GTK_CTREE_ROW ( node)->children==NULL) {
 
1444
                                gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixLockedFolder, MskLockedFolder);
 
1445
                        } else {
 
1446
                                gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixFolder, MskFolder);
 
1447
                        }
 
1448
 
 
1449
                        /* Frees memory used by info. */
 
1450
                        for ( i = 0; i < 11; i++)
 
1451
                        {
 
1452
                                g_free ( info[i]);
 
1453
                        }
 
1454
 
 
1455
                        node = GTK_CTREE_ROW ( node)->sibling;
 
1456
                }
 
1457
 
 
1458
                /* Files displaying. */
 
1459
                node = tmp;
 
1460
                disk_data = gtk_ctree_node_get_row_data ( ctree, node);
 
1461
                files_data = g_list_first ( disk_data_get_child ( disk_data));
 
1462
 
 
1463
                if ( files_data != NULL)
 
1464
                {
 
1465
                        /* Warning : on win32 systems, there's no "." and ".." files. */
 
1466
 
 
1467
                        /* Skips the file which should be the "." file. */
 
1468
                        if ( (file_info_get_name ( files_data->data) != NULL) && (strcmp ( file_info_get_name ( files_data->data), ".") == 0) )
 
1469
                        {
 
1470
                                files_data = g_list_next ( files_data);
 
1471
                        }
 
1472
 
 
1473
                        do
 
1474
                        {
 
1475
                                compt++;
 
1476
                                compt_file++;
 
1477
                                size = size + file_info_get_size ( files_data->data);
 
1478
                                g_strdup_to_gtk_text ( file_info_get_name ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT]);
 
1479
                                                                tmp_date = file_info_get_rights_to_gchar ( files_data->data);
 
1480
                                g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT]);
 
1481
                                                                g_free ( tmp_date);
 
1482
                                if ( strlen ( file_info_get_owner ( files_data->data)) != 0 )
 
1483
                                {
 
1484
                                        g_strdup_to_gtk_text ( file_info_get_owner ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1485
                                }
 
1486
                                else
 
1487
                                {
 
1488
                                        g_strdup_to_gtk_text ( _ ( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1489
                                }
 
1490
                                if ( strlen ( file_info_get_group ( files_data->data)) != 0 )
 
1491
                                {
 
1492
                                        g_strdup_to_gtk_text ( file_info_get_group ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1493
                                }
 
1494
                                else
 
1495
                                {
 
1496
                                        g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1497
                                }
 
1498
                                text_utf8 = gw_ui64_byte_to_str_format ( file_info_get_size ( files_data->data));
 
1499
                                g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT]);
 
1500
                                g_free ( text_utf8);
 
1501
                                text_utf8 = g_strdup_printf ( "%ld", file_info_get_inode ( files_data->data));
 
1502
                                g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT]);
 
1503
                                g_free ( text_utf8);
 
1504
                                tmp_date = file_info_get_cdate_to_gchar ( files_data->data);
 
1505
                                g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT]);
 
1506
                                g_free ( tmp_date);
 
1507
                                tmp_date = file_info_get_mdate_to_gchar ( files_data->data);
 
1508
                                g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT]);
 
1509
                                g_free ( tmp_date);
 
1510
                                tmp_date = file_info_get_adate_to_gchar ( files_data->data);
 
1511
                                g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT]);
 
1512
                                g_free ( tmp_date);
 
1513
                                g_strdup_to_gtk_text ( file_info_get_category_name ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT]);
 
1514
                                g_strdup_to_gtk_text ( file_info_get_description ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT]);
 
1515
                                        gw_str_replace_char ( info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT], '\n', ' ');
 
1516
                                g_strdup_to_gtk_text ( NULL, info[11]);
 
1517
 
 
1518
                                if ( (strlen ( file_info_get_name ( files_data->data)) == 2) && (strncmp ( file_info_get_name ( files_data->data), "..", 2) == 0) )
 
1519
                                {
 
1520
                                        row = gtk_clist_prepend ( clist_info, info);
 
1521
 
 
1522
                                        /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1523
                                        gtk_clist_set_row_data_full ( clist_info, row, (struct file_info*)files_data->data, NULL);
 
1524
                                        gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixParentFolder, MskParentFolder);
 
1525
                                }
 
1526
                                else
 
1527
                                {
 
1528
                                        row = gtk_clist_append ( clist_info, info);
 
1529
 
 
1530
                                        /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1531
                                        gtk_clist_set_row_data_full ( clist_info, row, (struct file_info*)files_data->data, NULL);
 
1532
                                        gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixFile, MskFile);
 
1533
                                }
 
1534
 
 
1535
                                files_data = g_list_next ( files_data);
 
1536
 
 
1537
                                /* Frees memory used by info. */
 
1538
                                for ( i = 0; i < 11; i++)
 
1539
                                {
 
1540
                                        g_free ( info[i]);
 
1541
                                }
 
1542
                        }
 
1543
                        while ( files_data != g_list_first ( files_data));
 
1544
                }
 
1545
 
 
1546
                if ( disk_data!=NULL) {
 
1547
                        /* Displays in the status bar the informations about the selected item. */
 
1548
                        gw_status_bar_put_msg_disk ( window,
 
1549
                                                disk_info_get_name ( disk_data_get_info ( disk_data)),
 
1550
                                                disk_info_get_type ( disk_data_get_info ( disk_data)),
 
1551
                                                disk_info_get_capacity ( disk_data_get_info ( disk_data)),
 
1552
                                                disk_info_get_free ( disk_data_get_info ( disk_data)),
 
1553
                                                size,
 
1554
                                                compt - 1);
 
1555
                } else {
 
1556
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1557
                        g_print ( "*** GW - %s (%d) :: %s() : warning!! disk_data\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1558
#endif
 
1559
                }
 
1560
 
 
1561
                /* Updates the list of folders and files. */
 
1562
                gtk_clist_sort ( clist_info);
 
1563
                gtk_clist_thaw ( clist_info);
 
1564
 
 
1565
                return TRUE;
 
1566
        }
 
1567
        else
 
1568
        {
 
1569
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1570
                g_print ( "*** GW - %s (%d) :: %s() : folder selected\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1571
#endif
 
1572
 
 
1573
                /* If a folder is selected, must to display folders and files list */
 
1574
                gw_notebook_catalog_clist_explorer_set_column_title_file ( );
 
1575
                tmp = node;
 
1576
 
 
1577
                /* Displays folders. */
 
1578
                node = GTK_CTREE_ROW ( node)->children;
 
1579
                while ( node != NULL )
 
1580
                {
 
1581
                        compt++;
 
1582
                        file_info = dir_data_get_info ( gtk_ctree_node_get_row_data ( ctree, node));
 
1583
                        size = size + file_info_get_size ( file_info);
 
1584
                        g_strdup_to_gtk_text ( file_info_get_name ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT]);
 
1585
                        tmp_date = file_info_get_rights_to_gchar ( file_info);
 
1586
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT]);
 
1587
                        g_free ( tmp_date);
 
1588
                        if ( strlen ( file_info_get_owner ( file_info)) != 0 )
 
1589
                        {
 
1590
                                g_strdup_to_gtk_text ( file_info_get_owner ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1591
                        }
 
1592
                        else
 
1593
                        {
 
1594
                                g_strdup_to_gtk_text ( _ ( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1595
                        }
 
1596
                        if ( strlen ( file_info_get_group ( file_info)) != 0 )
 
1597
                        {
 
1598
                                g_strdup_to_gtk_text ( file_info_get_group ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1599
                        }
 
1600
                        else
 
1601
                        {
 
1602
                                g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1603
                        }
 
1604
                        text_utf8 = gw_ui64_byte_to_str_format ( file_info_get_size ( file_info));
 
1605
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT]);
 
1606
                        g_free ( text_utf8);
 
1607
                        text_utf8 = g_strdup_printf ( "%ld", file_info_get_inode ( file_info));
 
1608
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT]);
 
1609
                        g_free ( text_utf8);
 
1610
                        tmp_date = file_info_get_cdate_to_gchar ( file_info);
 
1611
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT]);
 
1612
                        g_free ( tmp_date);
 
1613
                        tmp_date = file_info_get_mdate_to_gchar ( file_info);
 
1614
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT]);
 
1615
                        g_free ( tmp_date);
 
1616
                        tmp_date = file_info_get_adate_to_gchar ( file_info);
 
1617
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT]);
 
1618
                        g_free ( tmp_date);
 
1619
                        g_strdup_to_gtk_text ( file_info_get_category_name ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT]);
 
1620
                        g_strdup_to_gtk_text ( file_info_get_description ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT]);
 
1621
                        gw_str_replace_char ( info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT], '\n', ' ');
 
1622
                        g_strdup_to_gtk_text ( NULL, info[11]);
 
1623
 
 
1624
                        row = gtk_clist_append ( clist_info, info);
 
1625
 
 
1626
                        /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1627
                        gtk_clist_set_row_data_full ( clist_info, row, file_info, NULL);
 
1628
                        if ( dir_data_get_num_file ( gtk_ctree_node_get_row_data ( ctree, node))==0 && GTK_CTREE_ROW ( node)->children==NULL) {
 
1629
                                gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixLockedFolder, MskLockedFolder);
 
1630
                        } else {
 
1631
                                gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixFolder, MskFolder);
 
1632
                        }
 
1633
 
 
1634
                        /* Frees memory used by info. */
 
1635
                        for ( i = 0; i < 11; i++)
 
1636
                        {
 
1637
                                g_free ( info[i]);
 
1638
                        }
 
1639
 
 
1640
                        node = GTK_CTREE_ROW ( node)->sibling;
 
1641
                }
 
1642
 
 
1643
                /* Displays files */
 
1644
                node = tmp;
 
1645
                dir_data = gtk_ctree_node_get_row_data ( ctree, node);
 
1646
                files_data = g_list_first ( dir_data_get_child ( dir_data));
 
1647
                files_data = g_list_next ( files_data);
 
1648
 
 
1649
                while ( files_data != g_list_first ( files_data))
 
1650
                {
 
1651
                        compt++;
 
1652
                        compt_file++;
 
1653
                        size = size + file_info_get_size ( files_data->data);
 
1654
                        g_strdup_to_gtk_text ( file_info_get_name ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT]);
 
1655
                                                tmp_date = file_info_get_rights_to_gchar ( files_data->data);
 
1656
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT]);
 
1657
                                                g_free ( tmp_date);
 
1658
                        if ( strlen ( file_info_get_owner ( files_data->data)) != 0 )
 
1659
                        {
 
1660
                                g_strdup_to_gtk_text ( file_info_get_owner ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1661
                        }
 
1662
                        else
 
1663
                        {
 
1664
                                g_strdup_to_gtk_text ( _( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
 
1665
                        }
 
1666
                        if ( strlen ( file_info_get_group ( files_data->data)) != 0 )
 
1667
                        {
 
1668
                                g_strdup_to_gtk_text ( file_info_get_group ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1669
                        }
 
1670
                        else
 
1671
                        {
 
1672
                                g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
 
1673
                        }
 
1674
                        text_utf8 = g_strdup_printf ( "%ld", file_info_get_inode ( files_data->data));
 
1675
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT]);
 
1676
                        g_free ( text_utf8);
 
1677
                        text_utf8 = gw_ui64_byte_to_str_format ( file_info_get_size ( files_data->data));
 
1678
                        g_strdup_to_gtk_text ( text_utf8, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT]);
 
1679
                        g_free ( text_utf8);
 
1680
                        tmp_date = file_info_get_cdate_to_gchar ( files_data->data);
 
1681
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT]);
 
1682
                        g_free ( tmp_date);
 
1683
                        tmp_date = file_info_get_mdate_to_gchar ( files_data->data);
 
1684
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT]);
 
1685
                        g_free ( tmp_date);
 
1686
                        tmp_date = file_info_get_adate_to_gchar ( files_data->data);
 
1687
                        g_strdup_to_gtk_text ( tmp_date, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT]);
 
1688
                        g_free ( tmp_date);
 
1689
                        g_strdup_to_gtk_text ( file_info_get_category_name ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT]);
 
1690
                        g_strdup_to_gtk_text ( file_info_get_description ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT]);
 
1691
                        gw_str_replace_char ( info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT], '\n', ' ');
 
1692
                        g_strdup_to_gtk_text ( NULL, info[11]);
 
1693
 
 
1694
                        if ( ( strlen ( file_info_get_name ( files_data->data)) == 2) && (strncmp ( file_info_get_name ( files_data->data), "..", 2) == 0) )
 
1695
                        {
 
1696
                                row = gtk_clist_prepend ( clist_info, info);
 
1697
 
 
1698
                                /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1699
                                gtk_clist_set_row_data_full ( clist_info, row, (struct file_info*)files_data->data, NULL);
 
1700
                                gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixParentFolder, MskParentFolder);
 
1701
                        }
 
1702
                        else
 
1703
                        {
 
1704
                                row = gtk_clist_append ( clist_info, info);
 
1705
 
 
1706
                                /* Note that doesn't give the data destroy function, because that will destroy the database. */
 
1707
                                gtk_clist_set_row_data_full ( clist_info, row, (struct file_info*)files_data->data, NULL);
 
1708
                                gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixFile, MskFile);
 
1709
                        }
 
1710
 
 
1711
                        files_data = g_list_next ( files_data);
 
1712
 
 
1713
                        /* Frees memory used by info. */
 
1714
                        for ( i = 0; i < 11; i++)
 
1715
                        {
 
1716
                                g_free ( info[i]);
 
1717
                        }
 
1718
                }
 
1719
 
 
1720
                if ( dir_data!=NULL) {
 
1721
                        /* Displays in the status bar the informations about the selected item. */
 
1722
                        gw_status_bar_put_msg_dir ( window,
 
1723
                                                file_info_get_name ( dir_data_get_info ( dir_data)),
 
1724
                                                size,
 
1725
                                                compt_file - 1,
 
1726
                                                compt - compt_file,
 
1727
                                                compt - 1);
 
1728
                } else {
 
1729
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1730
                        g_print ( "*** GW - %s (%d) :: %s() : warning!! dir_data\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1731
#endif
 
1732
                }
 
1733
 
 
1734
                /* Updates the list of folders and files. */
 
1735
                gtk_clist_sort ( clist_info);
 
1736
                gtk_clist_thaw ( clist_info);
 
1737
 
 
1738
                return TRUE;
 
1739
        }}
 
1740
 
 
1741
        gtk_clist_thaw ( clist_info);
 
1742
 
 
1743
        return FALSE;
 
1744
}
 
1745
 
 
1746
 
 
1747
gulong gw_notebook_catalog_ctree_node_get_folder_size ( GtkCTree *ctree, GtkCTreeNode *node)
 
1748
{
 
1749
        /* Bug to fix : gulong seems be too short. It should be better to use guint64. */
 
1750
        GtkCTreeNode *child = NULL;
 
1751
        struct dir_data *dir_data = NULL;
 
1752
        GList *files = NULL;
 
1753
        gulong size = 0;
 
1754
        gulong result = 0;
 
1755
        GtkCTreeNode *root = NULL;
 
1756
 
 
1757
 
 
1758
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
 
1759
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
1760
#endif
 
1761
 
 
1762
        if ( (ctree != NULL) && (node != NULL ) )
 
1763
        {
 
1764
                root = gw_gui_manager_main_interface_get_tree_root ( );
 
1765
 
 
1766
                /* Lists all subfolders. */
 
1767
                child = GTK_CTREE_ROW ( node)->children;
 
1768
 
 
1769
                while ( child != NULL )
 
1770
                {
 
1771
                        /* Recursive call of the function gw_notebook_catalog_ctree_node_get_folder_size. */
 
1772
                        size = size + gw_notebook_catalog_ctree_node_get_folder_size ( ctree, child);
 
1773
                }
 
1774
 
 
1775
                /* Gets the size of all files which are in the folder. */
 
1776
                dir_data = gtk_ctree_node_get_row_data ( ctree, node);
 
1777
                files = g_list_first ( dir_data_get_child ( dir_data));
 
1778
                files = g_list_next ( files);
 
1779
 
 
1780
                if ( (GTK_CTREE_ROW ( node)->parent) == root )
 
1781
                {
 
1782
                        files = g_list_next ( files);
 
1783
                }
 
1784
 
 
1785
                while ( files != g_list_first ( files))
 
1786
                {
 
1787
                        size = size + file_info_get_size ( files->data);
 
1788
                        files = g_list_next ( files);
 
1789
                }
 
1790
 
 
1791
                result = size;
 
1792
        }
 
1793
 
 
1794
        return result;
 
1795
}