2
* Copyright (C) 2000 S�bastien LECACHEUR
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.
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.
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.
20
#include "../gwsupport.h"
21
#include "gwnotebookcatalogcallback.h"
23
#include <string.h> /* strcmp strlen */
25
#include "tools/gwtools.h"
26
#include "res/gwres.h"
27
#include "data/gwdata.h"
29
#include "gwstatusbar.h"
30
#include "gwstatusbarcallback.h"
31
#include "gwnotebookcatalog.h"
32
#include "gwnotebooksearch.h"
33
#include "gwnotebookmanagmentcallback.h"
34
#include "gwmenupopup.h"
36
#include "../gwapplicationmanager.h"
37
#include "../gwguimanager.h"
38
#include "../gwcatalogmanager.h"
41
gint gw_catalog_compare_disk_int ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
43
struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
44
int nb1 = -1, nb2 = -1;
47
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
48
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
51
if ( (ptr1!=NULL) && (ptr2!=NULL) )
53
disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
54
disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
56
if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
58
switch ( clist->sort_column)
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);
71
gint gw_catalog_compare_disk_gulong ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
73
struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
74
gulong nb1 = 0, nb2 = 0;
77
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
78
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
81
if ( (ptr1!=NULL) && (ptr2!=NULL) )
83
disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
84
disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
86
if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
88
switch ( clist->sort_column)
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);
101
gint gw_catalog_compare_disk_guint64 ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
103
struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
104
guint64 nb1 = -1, nb2 = -1;
107
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
108
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
111
if ( (ptr1!=NULL) && (ptr2!=NULL) )
113
disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
114
disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
116
if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
118
switch ( clist->sort_column)
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);
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);
135
gint gw_catalog_compare_disk_str ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
137
struct disk_info *disk_info1 = NULL, *disk_info2 = NULL;
138
gchar *str1 = NULL, *str2 = NULL;
142
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
143
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
146
if ( (ptr1!=NULL) && (ptr2!=NULL) )
148
disk_info1 = (struct disk_info*)(((GtkCListRow *)ptr1)->data);
149
disk_info2 = (struct disk_info*)(((GtkCListRow *)ptr2)->data);
151
if ( (disk_info1!=NULL) && (disk_info2!=NULL) )
153
switch ( clist->sort_column)
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);
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);
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);
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);
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);
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);
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);
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);
188
if ( (str1!=NULL) && (str2!=NULL) )
190
if ( gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_CASE_SENSITIVE) == 1 )
192
result = strcmp ( str1, str2);
196
result = strcasecmp ( str1, str2);
206
gint gw_catalog_compare_file_glong ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
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;
215
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
216
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
219
if ( (ptr1!=NULL) && (ptr2!=NULL) )
221
file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
222
file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
224
if ( (file_info1!=NULL) && (file_info2!=NULL) )
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);
231
switch ( clist->sort_column)
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);
238
if ( (str_name1!=NULL) && (str_name2!=NULL) )
240
if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
242
result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
246
if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
248
result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
252
result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?(nb1-nb2):(isfolder2-isfolder1));
263
gint gw_catalog_compare_file_gulong ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
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;
272
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
273
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
276
if ( (ptr1!=NULL) && (ptr2!=NULL) )
278
file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
279
file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
281
if ( (file_info1!=NULL) && (file_info2!=NULL) )
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);
288
switch ( clist->sort_column)
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);
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);
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);
303
if ( (str_name1!=NULL) && (str_name2!=NULL) )
305
if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
307
result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
311
if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
313
result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
317
result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?(nb1-nb2):(isfolder2-isfolder1));
328
gint gw_catalog_compare_file_guint64 ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
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;
337
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
338
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
341
if ( (ptr1!=NULL) && (ptr2!=NULL) )
343
file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
344
file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
346
if ( (file_info1!=NULL) && (file_info2!=NULL) )
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);
353
switch ( clist->sort_column)
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);
360
if ( (str_name1!=NULL) && (str_name2!=NULL) )
362
if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
364
result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
368
if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
370
result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
374
result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?(nb1-nb2):(isfolder2-isfolder1));
385
gint gw_catalog_compare_file_str ( GtkCList *clist, const gpointer ptr1, const gpointer ptr2)
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;
394
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
395
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
398
if ( (ptr1!=NULL) && (ptr2!=NULL) )
400
file_info1 = (struct file_info*)(((GtkCListRow *)ptr1)->data);
401
file_info2 = (struct file_info*)(((GtkCListRow *)ptr2)->data);
403
if ( (file_info1!=NULL) && (file_info2!=NULL) )
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);
410
switch ( clist->sort_column)
412
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT: str1 = str_name1;
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);
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);
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);
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);
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);
437
if ( (str_name1!=NULL) && (str_name2!=NULL) && (str1!=NULL) && (str2!=NULL) )
439
if ( (strlen ( str_name1) == 2) && (strncmp ( str_name1, "..", 2) == 0) )
441
result = (clist->sort_type==GTK_SORT_ASCENDING?-2:2);
445
if ( (strlen ( str_name2) == 2) && (strncmp ( str_name2, "..", 2) == 0) )
447
result = (clist->sort_type==GTK_SORT_ASCENDING?2:-2);
451
if ( gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_CASE_SENSITIVE) == 1 )
453
result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?strcmp ( str1, str2):(isfolder2-isfolder1));
457
result = (((gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_SORT_BY_FOLDER)==0)||(isfolder1==isfolder2))?strcasecmp ( str1, str2):(isfolder2-isfolder1));
463
if ( clist->sort_column == GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT )
482
gint gw_notebook_catalog_set_column_sort ( GtkCList *clist, gint column)
484
GtkCTree *ctree = NULL;
485
GtkCTreeNode *selection = NULL;
489
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
490
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
493
if ( (clist!=NULL) && (column>-1) )
495
/* Gets the selected item in the tree. */
496
if ( (ctree = gw_gui_manager_main_interface_get_tree ( )) != NULL )
498
if ( (GTK_CLIST ( ctree)->selection != NULL) && ((selection = GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data)) != NULL) )
500
if ( GTK_CTREE_ROW ( selection)->parent == NULL )
502
/* User is in the catalog : this is a list of disks. */
505
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NAME_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
508
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FSNAME_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
511
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_PATH_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
514
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_NBARCHIVE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_int);
517
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_TYPE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
520
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_VOLUME_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
523
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CAPACITY_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_guint64);
526
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_FREE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_guint64);
529
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DATE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_gulong);
532
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_SERIAL_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
535
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_CATEGORY_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
538
case GW_VALUE_APP_EXPLORER_DISK_COLUMN_DESCRIPTION_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_disk_str);
541
default: gtk_clist_set_compare_func ( clist, NULL);
547
/* User is in a disk or a folder : this is a list of files. */
550
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
553
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_RIGHTS_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
556
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
559
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
562
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_SIZE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_guint64);
565
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_INODE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_glong);
568
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_ADATE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_gulong);
571
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CDATE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_gulong);
574
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_MDATE_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_gulong);
577
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_CATEGORY_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
580
case GW_VALUE_APP_EXPLORER_FILE_COLUMN_DESCRIPTION_POSITION_DEFAULT: gtk_clist_set_compare_func ( clist, (GtkCListCompareFunc)gw_catalog_compare_file_str);
583
default: gtk_clist_set_compare_func ( clist, NULL);
597
gboolean gw_notebook_catalog_column_sort ( GtkCList *clist, gint column, gpointer data)
599
gboolean result = FALSE;
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));
608
if ( GPOINTER_TO_INT ( data) != -1 )
610
if ( column == clist->sort_column )
612
if ( clist->sort_type == GTK_SORT_ASCENDING )
614
clist->sort_type = GTK_SORT_DESCENDING;
618
clist->sort_type = GTK_SORT_ASCENDING;
623
gtk_clist_set_sort_column ( clist, column);
627
gw_notebook_catalog_set_column_sort ( clist, column);
629
if ( GPOINTER_TO_INT ( data) != -1 )
631
gtk_clist_sort ( clist);
641
gboolean gw_notebook_catalog_clist_button_press_event ( GtkWidget *w, GdkEventButton *event)
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;
649
GtkWindow *window = NULL;
650
GtkCTree *ctree = NULL;
651
GtkCTreeNode *root = NULL;
652
gchar *tmp_date = NULL;
655
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
656
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
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);
667
/* If no one opened catalog. */
671
/* Ignores clicks on scrollbars. */
672
if ( event->window != GTK_CLIST ( clist_info)->clist_window )
677
/* Gets the selected item in the tree. */
678
selection = GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data);
680
/* Gets the selected item in the list. */
681
gtk_clist_get_selection_info ( clist_info, event->x, event->y, &row, &col);
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");
688
/* Checks if it's a double click. */
689
if ( event->type == GDK_2BUTTON_PRESS )
691
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
692
g_print ( "*** GW - %s (%d) :: %s() : user make a double click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
695
/* If it's a double click. */
696
if ( event->button == 1 )
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__);
702
/* If it's a double left click. */
704
/* To prevent that double click generates a signal in excess. */
707
if ( GTK_CTREE_ROW ( selection)->parent == NULL )
709
/* User is in the catalog : he clicked on a disk. */
711
/* Gets informations attached to the line. */
712
if ( (disk_info = (struct disk_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
714
/* If user clicked in empty space. */
720
/* Else if user clicked on a disk. */
722
if ( !GTK_CTREE_ROW ( selection)->expanded )
724
gtk_ctree_expand ( ctree, selection);
727
/* Searches in the tree where is the selected disk. */
728
child = GTK_CTREE_ROW ( selection)->children;
729
while ( child != NULL )
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 )
733
gtk_ctree_select ( ctree, child);
738
child = GTK_CTREE_NODE_NEXT( child);
746
/* Else if user clicked on a folder or a file. */
748
/* Gets informations attached to the line. */
749
if ( (file_info = (struct file_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
751
/* If user clicked in empty space. */
757
/* Else if user clicked on an item. */
759
if ( file_info_get_isdirectory ( file_info) )
761
/* If it's a folder. */
763
if ( (strlen ( file_info_get_name ( file_info)) == 2) && (strncmp ( file_info_get_name ( file_info), "..", 2) == 0) )
765
/* If it's the parent folder. */
767
child = GTK_CTREE_ROW ( selection)->parent;
771
gtk_ctree_select ( ctree, child);
778
/* Else if it's an unspecified folder. */
780
if ( !GTK_CTREE_ROW ( selection)->expanded )
782
gtk_ctree_expand ( ctree, selection);
785
/* Searches in the tree where is the selected folder. */
786
child = GTK_CTREE_ROW ( selection)->children;
787
while ( child != NULL )
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 )
791
gtk_ctree_select ( ctree, child);
796
child = GTK_CTREE_NODE_NEXT ( child);
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),
819
else { if ( event->type == GDK_BUTTON_PRESS )
821
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
822
g_print ( "*** GW - %s (%d) :: %s() : user make a single click\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
825
/* If it's a single click. */
826
if ( event->button == 1 )
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__);
832
if ( GTK_CTREE_ROW ( selection)->parent == NULL )
834
/* User is in the catalog : he clicked on a disk. */
836
/* Gets informations attached to the line. */
837
if ( (disk_info = (struct disk_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
839
/* If user clicked on a empty space. */
845
/* Else if user clicked on a disk. */
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));
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),
865
/* If user clicked on a folder or a file. */
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 )
870
/* User clicked on a empty space. */
876
/* If user clicked on an item. */
878
if ( file_info_get_isdirectory ( file_info) )
880
/* If it's a folder. */
882
if ( (strlen ( file_info_get_name ( file_info)) == 2) && (strncmp ( file_info_get_name ( file_info), "..", 2) == 0) )
884
/* If it's the parent folder. */
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),
894
/* Must return FALSE to show the selected item with GTK+ 2.x (with bleu background) */
900
/* If it's an unspecified folder. */
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));
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),
913
/* Must return FALSE to show the selected item with GTK+ 2.x (with bleu background) */
920
/* If it's a file. */
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),
936
else { if ( event->button == 3 )
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__);
942
/* If it's a right click : displays the popup menu. */
945
if ( GTK_CTREE_ROW ( selection)->parent == NULL )
947
/* User is in the catalog : he clicked on a disk. */
949
/* Gets informations attached to the line. */
950
if ( (disk_info = (struct disk_info*)gtk_clist_get_row_data ( clist_info, row)) == NULL )
952
/* User clicked on empty space. */
958
/* Else if user clicked on a disk. */
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));
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);
971
/* User clicked on a folder or a file. */
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 )
976
/* If user clicked on empty space. */
982
/* Else if user clicked on an item. */
984
if ( file_info_get_isdirectory ( file_info) )
986
/* If it's a folder. */
988
if ( (strlen ( file_info_get_name ( file_info)) == 2) && (strncmp ( file_info_get_name ( file_info), "..", 2) == 0) )
990
/* If it's the parent folder. */
996
/* Else if it's an unspecified folder. */
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));
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);
1009
/* If it's a file which is selected. */
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);
1025
gint gw_notebook_catalog_clist_column_resized ( GtkCList *clist, gint column, gint width, gpointer user_data)
1027
GtkCTreeNode *root = gw_gui_manager_main_interface_get_tree_root ( );
1028
GtkCTree *ctree = NULL;
1029
GtkCTreeNode *selection = NULL;
1031
gint autoresize = -1;
1034
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1035
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1038
if ( (root!=NULL) && (clist!=NULL) && (column>-1) )
1040
if ( (autoresize = gw_application_manager_get_settings_tol ( GW_VALUE_APP_EXPLORER_COLUMN_AUTORESIZE)) == -1 )
1042
autoresize = GW_VALUE_APP_EXPLORER_COLUMN_AUTORESIZE_DEFAULT;
1045
/* Saves the column width only if the autoresize mode is desactivated. */
1046
if ( autoresize == FALSE )
1048
/* Gets the selected item in the tree. */
1049
if ( (ctree = gw_gui_manager_main_interface_get_tree ( )) != NULL )
1051
if ( (GTK_CLIST ( ctree)->selection != NULL) && ((selection = GTK_CTREE_NODE ( GTK_CLIST ( ctree)->selection->data)) != NULL) )
1053
if ( GTK_CTREE_ROW ( selection)->parent == NULL )
1055
/* User is in the catalog : this is a list of disks. */
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
1101
/* User is in a disk or a folder : this is a list of files. */
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
1157
gboolean gw_notebook_catalog_ctree_button_press_event ( GtkWidget *w, GdkEventButton *event)
1162
GdkEventButton *bev = NULL;
1163
GtkCTree *ctree = NULL;
1164
GtkWindow *window = NULL;
1167
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1168
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
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);
1176
/* Ignores clicks on scrollbars. */
1177
if ( event->window != GTK_CLIST ( clist)->clist_window )
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));
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)) )
1189
gtk_signal_emit_stop_by_name ( GTK_OBJECT ( ctree), "button_press_event");
1192
/* Checks if it's a double click. */
1193
if ( event->type == GDK_2BUTTON_PRESS )
1195
/* Checks if it's a left click. */
1196
if ( event->button == 1 )
1198
/* Prevents from double click to generate too many signals. */
1201
/* Checks if user didn't click in the empty space. */
1204
/* Opens or closes the node. */
1205
if ( GTK_CTREE_ROW ( node)->expanded )
1207
gtk_ctree_collapse ( ctree, node);
1211
gtk_ctree_expand ( ctree, node);
1214
gtk_ctree_select ( ctree, node);
1220
/* Checks if it's a single click. */
1221
else { if ( event->type == GDK_BUTTON_PRESS )
1223
/* Checks if it's a left click. */
1224
if ( event->button == 1 )
1228
/* If user didn't click in the empty space : select the row. */
1229
gtk_ctree_select ( ctree, node);
1234
/* Checks if it's a right click. */
1235
else { if ( event->button == 3 )
1237
/* Displays the popup menu. */
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);
1247
/* Selects the item for more user visibility. */
1248
gtk_ctree_select ( ctree, node);
1249
gw_gui_manager_main_interface_refresh ( );
1251
if ( GTK_CTREE_ROW ( node)->parent == NULL )
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);
1258
else { if ( GTK_CTREE_ROW ( GTK_CTREE_ROW ( node)->parent)->parent == NULL )
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);
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);
1282
gboolean gw_notebook_catalog_ctree_select_row ( GtkCTree *ctree, GtkCTreeNode *node, gint column, gpointer g)
1284
GtkCList *clist_info = NULL;
1285
struct disk_info *disk_info = NULL;
1287
gint i, row, compt = 0, compt_file = 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;
1300
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1301
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
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);
1308
/* Stop the signal during the process. */
1309
gtk_signal_emit_stop_by_name ( GTK_OBJECT ( ctree), "tree_select_row");
1311
/* Freezes informations table */
1312
gtk_clist_freeze ( clist_info);
1313
gtk_clist_clear ( clist_info);
1316
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1317
g_print ( "*** GW - %s (%d) :: %s() : updates list\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1322
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1323
g_print ( "*** GW - %s (%d) :: %s() : catalog selected\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
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;
1330
while ( node != NULL )
1333
disk_info = disk_data_get_info ( gtk_ctree_node_get_row_data ( ctree, node));
1334
size = size + disk_info_get_full ( disk_info);
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]);
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', ' ');
1358
row = gtk_clist_append ( clist_info, info);
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));
1364
/* Frees memory used by info. */
1365
for ( i = 0; i < 11; i++)
1370
node = GTK_CTREE_ROW ( node)->sibling;
1373
/* Displays in the status bar the informations about the selected item. */
1374
gw_status_bar_put_msg_catalog ( window, ctree, root, compt, size);
1376
/* Updates the list of disk. */
1377
gtk_clist_sort ( clist_info);
1378
gtk_clist_thaw ( clist_info);
1382
else { if ( GTK_CTREE_ROW ( node)->parent == root )
1384
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1385
g_print ( "*** GW - %s (%d) :: %s() : disk selected\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1388
/* If a disk is selected, must to display folders and files list */
1389
gw_notebook_catalog_clist_explorer_set_column_title_file ( );
1392
/* Folders displaying. */
1393
node = GTK_CTREE_ROW ( node)->children;
1394
while ( node != NULL )
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]);
1403
if ( strlen ( file_info_get_owner ( file_info)) != 0 )
1405
g_strdup_to_gtk_text ( file_info_get_owner ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1409
g_strdup_to_gtk_text ( _( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1411
if ( strlen ( file_info_get_group ( file_info)) != 0 )
1413
g_strdup_to_gtk_text ( file_info_get_group ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
1417
g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
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]);
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]);
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]);
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]);
1439
row = gtk_clist_append ( clist_info, info);
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);
1446
gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixFolder, MskFolder);
1449
/* Frees memory used by info. */
1450
for ( i = 0; i < 11; i++)
1455
node = GTK_CTREE_ROW ( node)->sibling;
1458
/* Files displaying. */
1460
disk_data = gtk_ctree_node_get_row_data ( ctree, node);
1461
files_data = g_list_first ( disk_data_get_child ( disk_data));
1463
if ( files_data != NULL)
1465
/* Warning : on win32 systems, there's no "." and ".." files. */
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) )
1470
files_data = g_list_next ( files_data);
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]);
1482
if ( strlen ( file_info_get_owner ( files_data->data)) != 0 )
1484
g_strdup_to_gtk_text ( file_info_get_owner ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1488
g_strdup_to_gtk_text ( _ ( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1490
if ( strlen ( file_info_get_group ( files_data->data)) != 0 )
1492
g_strdup_to_gtk_text ( file_info_get_group ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
1496
g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
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]);
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]);
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]);
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]);
1518
if ( (strlen ( file_info_get_name ( files_data->data)) == 2) && (strncmp ( file_info_get_name ( files_data->data), "..", 2) == 0) )
1520
row = gtk_clist_prepend ( clist_info, info);
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);
1528
row = gtk_clist_append ( clist_info, info);
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);
1535
files_data = g_list_next ( files_data);
1537
/* Frees memory used by info. */
1538
for ( i = 0; i < 11; i++)
1543
while ( files_data != g_list_first ( files_data));
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)),
1556
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1557
g_print ( "*** GW - %s (%d) :: %s() : warning!! disk_data\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1561
/* Updates the list of folders and files. */
1562
gtk_clist_sort ( clist_info);
1563
gtk_clist_thaw ( clist_info);
1569
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1570
g_print ( "*** GW - %s (%d) :: %s() : folder selected\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1573
/* If a folder is selected, must to display folders and files list */
1574
gw_notebook_catalog_clist_explorer_set_column_title_file ( );
1577
/* Displays folders. */
1578
node = GTK_CTREE_ROW ( node)->children;
1579
while ( node != NULL )
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]);
1588
if ( strlen ( file_info_get_owner ( file_info)) != 0 )
1590
g_strdup_to_gtk_text ( file_info_get_owner ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1594
g_strdup_to_gtk_text ( _ ( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1596
if ( strlen ( file_info_get_group ( file_info)) != 0 )
1598
g_strdup_to_gtk_text ( file_info_get_group ( file_info), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
1602
g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
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]);
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]);
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]);
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]);
1624
row = gtk_clist_append ( clist_info, info);
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);
1631
gtk_clist_set_pixtext ( clist_info, row, 0, info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_NAME_POSITION_DEFAULT], 5, PixFolder, MskFolder);
1634
/* Frees memory used by info. */
1635
for ( i = 0; i < 11; i++)
1640
node = GTK_CTREE_ROW ( node)->sibling;
1643
/* Displays files */
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);
1649
while ( files_data != g_list_first ( files_data))
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]);
1658
if ( strlen ( file_info_get_owner ( files_data->data)) != 0 )
1660
g_strdup_to_gtk_text ( file_info_get_owner ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1664
g_strdup_to_gtk_text ( _( "unknown owner"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_OWNER_POSITION_DEFAULT]);
1666
if ( strlen ( file_info_get_group ( files_data->data)) != 0 )
1668
g_strdup_to_gtk_text ( file_info_get_group ( files_data->data), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
1672
g_strdup_to_gtk_text ( _( "unknown group"), info[GW_VALUE_APP_EXPLORER_FILE_COLUMN_GROUP_POSITION_DEFAULT]);
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]);
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]);
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]);
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]);
1694
if ( ( strlen ( file_info_get_name ( files_data->data)) == 2) && (strncmp ( file_info_get_name ( files_data->data), "..", 2) == 0) )
1696
row = gtk_clist_prepend ( clist_info, info);
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);
1704
row = gtk_clist_append ( clist_info, info);
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);
1711
files_data = g_list_next ( files_data);
1713
/* Frees memory used by info. */
1714
for ( i = 0; i < 11; i++)
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)),
1729
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1730
g_print ( "*** GW - %s (%d) :: %s() : warning!! dir_data\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1734
/* Updates the list of folders and files. */
1735
gtk_clist_sort ( clist_info);
1736
gtk_clist_thaw ( clist_info);
1741
gtk_clist_thaw ( clist_info);
1747
gulong gw_notebook_catalog_ctree_node_get_folder_size ( GtkCTree *ctree, GtkCTreeNode *node)
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;
1755
GtkCTreeNode *root = NULL;
1758
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
1759
g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
1762
if ( (ctree != NULL) && (node != NULL ) )
1764
root = gw_gui_manager_main_interface_get_tree_root ( );
1766
/* Lists all subfolders. */
1767
child = GTK_CTREE_ROW ( node)->children;
1769
while ( child != NULL )
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);
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);
1780
if ( (GTK_CTREE_ROW ( node)->parent) == root )
1782
files = g_list_next ( files);
1785
while ( files != g_list_first ( files))
1787
size = size + file_info_get_size ( files->data);
1788
files = g_list_next ( files);