115
115
const gchar *buf, const gint len
117
117
static gchar *FileBrowserDNDBufFormat(
118
FileBrowserObject **object, const gint total, GList *selection,
118
GList *objects_list, GList *selection, gint *len_rtn
121
120
static gboolean FileBrowserObjectNameFilter(
122
121
const gchar *name, const gchar *full_path,
156
static FileBrowserIcon *FileBrowserIconNew(void);
157
static void FileBrowserIconDelete(FileBrowserIcon *icon);
157
158
static FileBrowserIcon *FileBrowserGetIcon(FileBrowser *fb, const gint i);
158
159
static FileBrowserIcon *FileBrowserIconAppend(
159
160
FileBrowser *fb, guint8 **data, const gchar *desc
167
static FileBrowserObject *FileBrowserGetObject(FileBrowser *fb, gint i);
168
static FileBrowserObject *FileBrowserObjectNew(void);
169
static void FileBrowserObjectDelete(FileBrowserObject *o);
170
static FileBrowserObject *FileBrowserGetObject(FileBrowser *fb, const gint i);
168
171
static void FileBrowserObjectUpdateValues(
169
172
FileBrowser *fb, FileBrowserObject *o
194
197
/* List Columns */
195
static FileBrowserColumn *FileBrowserListGetColumn(FileBrowser *fb, gint i);
198
static FileBrowserColumn *FileBrowserColumnNew(void);
199
static void FileBrowserColumnDelete(FileBrowserColumn *column);
200
static FileBrowserColumn *FileBrowserListGetColumn(FileBrowser *fb, const gint i);
196
201
static FileBrowserColumn *FileBrowserListColumnAppend(
197
202
FileBrowser *fb, const gchar *label, const gint width
212
217
static void FileBrowserLocationsPUListItemDestroyCB(gpointer data);
213
218
static void FileBrowserTypesPUListItemDestroyCB(gpointer data);
214
static void FileBrowserIconDestroyCB(gpointer data);
215
static void FileBrowserObjectDestroyCB(gpointer data);
216
static void FileBrowserColumnDestroyCB(gpointer data);
218
220
static gboolean FileBrowserDragMotionCB(
219
221
GtkWidget *widget, GdkDragContext *dc, gint x, gint y, guint t,
289
291
gint FileBrowserInit(void);
290
292
void FileBrowserSetStyle(GtkRcStyle *rc_style);
291
293
void FileBrowserSetTransientFor(GtkWidget *w);
294
void FileBrowserSetObjectCreatedCB(
301
void FileBrowserSetObjectModifiedCB(
303
const gchar *old_path,
304
const gchar *new_path,
309
void FileBrowserSetObjectDeletedCB(
292
316
gboolean FileBrowserIsQuery(void);
293
317
void FileBrowserBreakQuery(void);
294
318
GtkWidget *FileBrowserGetToplevel(void);
544
569
pulistbox_struct *loc_pulistbox,
545
570
*types_pulistbox;
572
/* Current Location */
547
573
gchar *cur_location;
549
gint block_loop_level;
550
gboolean user_response; /* TRUE if user clicked on OK */
552
576
FileBrowserListFormat list_format;
554
FileBrowserColumn **column;
557
fb_type_struct cur_type; /* Current file type */
558
gchar **selected_path;
559
gint total_selected_paths;
561
FileBrowserIcon **icon;
579
GList *columns_list; /* GList of FileBrowserColumn * columns */
582
GList *icons_list; /* GList of FileBrowserIcon * icons */
566
586
gchar *home_path;
567
589
GList *device_paths_list; /* List of gchar * device paths */
592
GList *objects_list; /* GList of FileBrowserObject * objects */
593
gint objects_per_row; /* For use with
594
* FB_LIST_FORMAT_STANDARD */
570
595
GList *selection,
572
FileBrowserObject **object;
574
gint objects_per_row; /* For use with
575
* FB_LIST_FORMAT_STANDARD */
576
gint last_single_select_object;
598
last_single_select_object;
577
599
gboolean show_hidden_objects;
601
/* Current File Type Return */
602
fb_type_struct cur_type;
604
/* Selected Paths Return */
605
gchar **selected_path;
606
gint total_selected_paths;
609
void (*object_created_cb)(
613
gpointer object_created_data;
615
void (*object_modified_cb)(
616
const gchar *old_path,
617
const gchar *new_path,
620
gpointer object_modified_data;
622
void (*object_deleted_cb)(
626
gpointer object_deleted_data;
579
628
/* Last button pressed and pointer position */
649
698
* Generates a DND buffer based on the list of objects that are
650
* selected based on the given selection.
701
* The objects_list specifies the GList of FileBrowserObject *
704
* The selection specifies the GList of gint selections.
706
* The len_rtn specifies the return value for the length of the
709
* Returns a null deliminator string describing the objects in
710
* URL format or NULL on error.
652
712
static gchar *FileBrowserDNDBufFormat(
653
FileBrowserObject **object, const gint total, GList *selection,
713
GList *objects_list, GList *selection, gint *len_rtn
657
716
gchar *buf = NULL;
660
719
FileBrowserObject *o;
663
721
/* Iterate through the selection list */
664
722
for(glist = selection;
666
724
glist = g_list_next(glist)
669
i = (gint)glist->data;
670
if((i >= 0) && (i < total))
674
if((o != NULL) ? (o->full_path != NULL) : FALSE)
727
o = FILE_BROWSER_OBJECT(g_list_nth_data(
728
objects_list, (guint)glist->data
733
if(o->full_path != NULL)
676
gchar *url = g_strdup_printf(
735
gchar *url = g_strconcat(
680
gint url_len = STRLEN(url);
681
gint last_buf_len = buf_len;
740
const gint url_len = STRLEN(url),
741
last_buf_len = buf_len;
683
/* Increase allocation of buffer for this url string
743
/* Increase the buffer allocation for this url string
684
744
* which we will append to the buffer (include the
685
745
* '\0' character counted in buf_len)
1221
1280
/* No change in location, but check if we still need
1222
1281
* to update the lists if the lists were reset/cleared
1224
if(fb->total_objects > 0)
1283
if(fb->objects_list != NULL)
1226
1285
/* Lists were not cleared, so no need to update */
1227
1286
g_free(new_location);
1452
1511
gchar *buf = FileBrowserDNDBufFormat(
1453
fb->object, fb->total_objects, fb->selection,
1512
fb->objects_list, fb->selection, &buf_len
1456
1514
if(buf != NULL)
1731
1789
if(name != NULL)
1734
const FileBrowserObject *o;
1735
for(i = 0; i < fb->total_objects; i++)
1793
FileBrowserObject *o;
1795
for(glist = fb->objects_list, i = 0;
1797
glist = g_list_next(glist), i++
1738
if((o != NULL) ? (o->name == NULL) : TRUE)
1741
if(!strcmp(o->name, name))
1800
o = FILE_BROWSER_OBJECT(glist->data);
1807
if(!strcmp((const char *)o->name, (const char *)name))
1743
1809
/* Select this object */
1744
1810
fb->focus_object = i;
1759
1825
/* Update selected objects on entry */
1760
1826
FileBrowserEntrySetSelectedObjects(fb);
1828
/* Notify about the created directory */
1829
if(fb->object_created_cb != NULL)
1830
fb->object_created_cb(
1832
fb->object_created_data
1762
1835
FileBrowserSetBusy(fb, FALSE);
2150
* Creates a new icon.
2152
static FileBrowserIcon *FileBrowserIconNew(void)
2154
return(FILE_BROWSER_ICON(g_malloc0(
2155
sizeof(FileBrowserIcon)
2162
static void FileBrowserIconDelete(FileBrowserIcon *icon)
2167
GDK_PIXMAP_UNREF(icon->pixmap);
2168
GDK_BITMAP_UNREF(icon->mask);
2077
2174
* Returns the icon at index i or NULL on error.
2079
2176
static FileBrowserIcon *FileBrowserGetIcon(FileBrowser *fb, const gint i)
2094
2193
FileBrowser *fb, guint8 **data, const gchar *desc
2098
2196
FileBrowserIcon *icon;
2100
2198
if((fb == NULL) || (data == NULL))
2103
i = MAX(fb->total_icons, 0);
2104
fb->total_icons = i + 1;
2105
fb->icon = (FileBrowserIcon **)g_realloc(
2106
fb->icon, fb->total_icons * sizeof(FileBrowserIcon *)
2108
if(fb->icon == NULL)
2110
fb->total_icons = 0;
2201
/* Create a new icon */
2202
icon = FileBrowserIconNew();
2114
fb->icon[i] = icon = FILE_BROWSER_ICON(g_malloc0(
2115
sizeof(FileBrowserIcon)
2119
icon->pixmap = GDK_PIXMAP_NEW_FROM_XPM_DATA(&icon->mask, data);
2120
gdk_window_get_size(icon->pixmap, &icon->width, &icon->height);
2121
icon->desc = STRDUP(desc);
2206
/* Append it to the list */
2207
fb->icons_list = g_list_append(fb->icons_list, icon);
2209
/* Set the new icon's values */
2210
icon->pixmap = GDK_PIXMAP_NEW_FROM_XPM_DATA(&icon->mask, data);
2211
gdk_window_get_size(icon->pixmap, &icon->width, &icon->height);
2212
icon->desc = STRDUP(desc);
2405
* Creates a new object.
2407
static FileBrowserObject *FileBrowserObjectNew(void)
2409
return(FILE_BROWSER_OBJECT(g_malloc0(
2410
sizeof(FileBrowserObject)
2415
* Deletes the object.
2417
static void FileBrowserObjectDelete(FileBrowserObject *o)
2422
g_free(o->displayed_name);
2423
g_free(o->full_path);
2314
2429
* Returns the object at index i or NULL on error.
2316
static FileBrowserObject *FileBrowserGetObject(FileBrowser *fb, gint i)
2431
static FileBrowserObject *FileBrowserGetObject(FileBrowser *fb, const gint i)
2321
if((i < 0) || (i >= fb->total_objects))
2324
return(fb->object[i]);
2439
return(FILE_BROWSER_OBJECT(
2440
g_list_nth_data(fb->objects_list, (guint)i)
2363
2480
/* Set displayed_name from name, abbreviate it as needed */
2364
2481
if(o->name != NULL)
2484
/* Do not shorten the displayed name anymore */
2366
2485
const gchar *name = o->name;
2367
2486
const gint len = STRLEN(name),
2368
2487
max_chars = FB_LIST_ITEM_MAX_CHARS;
2439
2561
struct stat *lstat_buf
2443
2564
FileBrowserObject *o;
2445
2566
if((fb == NULL) || (full_path == NULL))
2448
/* Allocate one more pointer for the array */
2449
i = MAX(fb->total_objects, 0);
2450
fb->total_objects = i + 1;
2451
fb->object = (FileBrowserObject **)g_realloc(
2452
fb->object, fb->total_objects * sizeof(FileBrowserObject *)
2454
if(fb->object == NULL)
2456
fb->total_objects = 0;
2569
/* Create a new object */
2570
o = FileBrowserObjectNew();
2460
/* Create a new Object */
2461
fb->object[i] = o = FILE_BROWSER_OBJECT(g_malloc0(
2462
sizeof(FileBrowserObject)
2466
o->name = STRDUP(name);
2467
o->full_path = STRDUP(full_path);
2468
if(lstat_buf != NULL)
2469
memcpy(&o->lstat_buf, lstat_buf, sizeof(struct stat));
2471
memset(&o->lstat_buf, 0x00, sizeof(struct stat));
2474
FileBrowserObjectUpdateValues(fb, o);
2574
/* Append this object to the list */
2575
fb->objects_list = g_list_append(fb->objects_list, o);
2577
o->name = STRDUP(name);
2578
o->full_path = STRDUP(full_path);
2579
if(lstat_buf != NULL)
2580
memcpy(&o->lstat_buf, lstat_buf, sizeof(struct stat));
2582
memset(&o->lstat_buf, 0x00, sizeof(struct stat));
2585
FileBrowserObjectUpdateValues(fb, o);
2515
2625
g_list_free(fb->selection);
2516
2626
fb->selection = fb->selection_end = NULL;
2518
/* Delete all objects */
2519
for(i = 0; i < fb->total_objects; i++)
2520
FileBrowserObjectDestroyCB(fb->object[i]);
2523
fb->total_objects = 0;
2628
/* Delete all the objects */
2629
if(fb->objects_list != NULL)
2632
fb->objects_list, (GFunc)FileBrowserObjectDelete, NULL
2634
g_list_free(fb->objects_list);
2635
fb->objects_list = NULL;
2525
/* Reset objects per row */
2638
/* Reset the number of objects per row */
2526
2639
fb->objects_per_row = 0;
2704
2817
list_x_max = 0, list_y_max = 0,
2705
2818
list_x_inc = 0, list_x_page_inc = 0,
2706
2819
list_y_inc = 0, list_y_page_inc = 0;
2707
2821
GdkWindow *window;
2709
2823
FileBrowserListFormat list_format;
2732
2846
case FB_LIST_FORMAT_VERTICAL_DETAILS:
2733
2847
case FB_LIST_FORMAT_VERTICAL:
2734
total_objects = fb->total_objects;
2735
for(i = 0; i < total_objects; i++)
2848
for(glist = fb->objects_list;
2850
glist = g_list_next(glist)
2853
o = FILE_BROWSER_OBJECT(glist->data);
2749
2865
case FB_LIST_FORMAT_STANDARD:
2750
total_objects = fb->total_objects;
2751
2866
objects_per_row = 0;
2752
for(i = 0; i < total_objects; i++)
2867
for(glist = fb->objects_list;
2869
glist = g_list_next(glist)
2872
o = FILE_BROWSER_OBJECT(glist->data);
3108
3226
FileBrowser *fb, const gint x, const gint y
3111
gint scroll_x = 0, scroll_y = 0;
3229
gint i, cx, cy, scroll_x = 0, scroll_y = 0;
3231
FileBrowserObject *o;
3130
3250
/* Find object by list display format */
3131
3251
switch(fb->list_format)
3134
FileBrowserObject *o;
3136
3253
case FB_LIST_FORMAT_VERTICAL_DETAILS:
3137
3254
case FB_LIST_FORMAT_VERTICAL:
3138
for(i = 0; i < fb->total_objects; i++)
3255
for(glist = fb->objects_list, i = 0;
3257
glist = g_list_next(glist), i++
3260
o = FILE_BROWSER_OBJECT(glist->data);
3159
3279
case FB_LIST_FORMAT_STANDARD:
3160
for(i = 0; i < fb->total_objects; i++)
3280
for(glist = fb->objects_list, i = 0;
3282
glist = g_list_next(glist), i++
3285
o = FILE_BROWSER_OBJECT(glist->data);
3258
3381
/* Any column headings to draw? */
3259
if(fb->total_columns > 0)
3382
if(fb->columns_list != NULL)
3261
gint i, last_column_position = 0;
3384
gint last_column_position = 0;
3262
3386
GdkRectangle rect;
3263
3388
FileBrowserColumn *column;
3266
3390
/* Draw each column heading */
3267
for(i = 0; i < fb->total_columns; i++)
3391
for(glist = fb->columns_list;
3393
glist = g_list_next(glist)
3269
column = fb->column[i];
3396
column = FILE_BROWSER_COLUMN(glist->data);
3270
3397
if(column == NULL)
3275
3402
rect.width = MAX(column->position - last_column_position, 0);
3276
3403
rect.height = height;
3279
style, drawable, state,
3410
(column->flags & GTK_HAS_FOCUS) ?
3411
GTK_STATE_ACTIVE : state,
3412
(column->flags & GTK_HAS_FOCUS) ?
3413
GTK_SHADOW_IN : GTK_SHADOW_OUT,
3281
3414
rect.x, rect.y, rect.width, rect.height
3327
3460
gdk_gc_set_clip_rectangle(gc_text, NULL);
3330
if((column->flags & GTK_SENSITIVE) &&
3331
(column->flags & GTK_HAS_FOCUS) &&
3332
GTK_WIDGET_HAS_FOCUS(w) &&
3333
GTK_WIDGET_SENSITIVE(w)
3336
drawable, style->fg_gc[state], FALSE,
3337
rect.x, rect.y, rect.width - 1, rect.height - 1
3340
3463
last_column_position = column->position;
3434
3557
switch(fb->list_format)
3436
3559
gboolean o_is_selected;
3438
3560
gint i, x, y, icon_width;
3439
3563
GdkGC *gc_text;
3440
const FileBrowserObject *o;
3441
const FileBrowserIcon *icon;
3564
FileBrowserObject *o;
3565
FileBrowserIcon *icon;
3443
3567
case FB_LIST_FORMAT_VERTICAL_DETAILS:
3444
3568
/* Make sure we have enough columns to draw for this
3445
3569
* list display format
3447
if(fb->total_columns >= 4)
3571
if(g_list_length(fb->columns_list) >= 4)
3450
3574
const struct stat *lstat_buf;
3451
3575
GdkRectangle rect;
3452
const FileBrowserColumn *column[4];
3576
FileBrowserColumn *column[4];
3454
3578
/* Get the pointers to each column */
3455
for(i = 0; i < 4; i++)
3456
column[i] = fb->column[i];
3579
for(glist = fb->columns_list, i = 0;
3580
(glist != NULL) && (i < 4);
3581
glist = g_list_next(glist), i++
3583
column[i] = FILE_BROWSER_COLUMN(glist->data);
3458
3585
/* Draw each object */
3459
for(i = 0; i < fb->total_objects; i++)
3586
for(glist = fb->objects_list, i = 0;
3588
glist = g_list_next(glist), i++
3591
o = FILE_BROWSER_OBJECT(glist->data);
3494
3624
gc = style->fg_gc[GTK_STATE_SELECTED];
3495
3625
gc_text = style->text_gc[GTK_STATE_SELECTED];
3497
drawable, style->bg_gc[GTK_STATE_SELECTED], TRUE,
3498
rect.x, rect.y, rect.width, rect.height
3628
drawable, style->bg_gc[GTK_STATE_SELECTED], TRUE,
3629
rect.x, rect.y, rect.width, rect.height
3507
3638
gc_text = style->text_gc[state];
3641
/* Set up the clip rectangle for drawing of the
3642
* object's name cell
3644
gdk_gc_set_clip_origin(gc, 0, 0);
3645
gdk_gc_set_clip_rectangle(gc, &rect);
3510
3647
/* Draw the icon */
3511
3648
icon = FileBrowserGetIcon(fb, o->icon_num);
3512
3649
if((icon != NULL) ? (icon->pixmap != NULL) : FALSE)
3527
3664
icon_width = 0;
3530
/* Set up the clip rectangle for drawing of the
3531
* object's name cell
3533
gdk_gc_set_clip_origin(gc, 0, 0);
3534
gdk_gc_set_clip_rectangle(gc, &rect);
3535
3667
gdk_gc_set_clip_origin(gc_text, 0, 0);
3536
3668
gdk_gc_set_clip_rectangle(gc_text, &rect);
3712
(gulong)lstat_buf->st_size
3582
3714
gdk_string_bounds(font, s, &b);
3583
3715
rect.x = column[0]->position;
3584
3716
rect.width = column[1]->position - column[0]->position;
3585
3717
if(rect.width > 0)
3586
3719
gdk_gc_set_clip_rectangle(gc_text, &rect);
3588
drawable, font, gc_text,
3589
(rect.x + rect.width - b.width - 2) -
3591
(y + (o->height / 2) -
3592
((font->ascent + font->descent) / 2)) +
3721
drawable, font, gc_text,
3722
(rect.x + rect.width - b.width - 2) -
3724
(y + (o->height / 2) -
3725
((font->ascent + font->descent) / 2)) +
3598
3732
/* Draw the permissions */
3627
3761
rect.x = column[1]->position;
3628
3762
rect.width = column[2]->position - column[1]->position;
3629
3763
if(rect.width > 0)
3630
3765
gdk_gc_set_clip_rectangle(gc_text, &rect);
3632
drawable, font, gc_text,
3633
(rect.x + 2) - b.lbearing,
3634
(y + (o->height / 2) -
3635
((font->ascent + font->descent) / 2)) +
3767
drawable, font, gc_text,
3768
(rect.x + 2) - b.lbearing,
3769
(y + (o->height / 2) -
3770
((font->ascent + font->descent) / 2)) +
3641
3777
/* Draw the modified time */
3652
3788
rect.x = column[2]->position;
3653
3789
rect.width = column[3]->position - column[2]->position;
3654
3790
if(rect.width > 0)
3655
3792
gdk_gc_set_clip_rectangle(gc_text, &rect);
3657
drawable, font, gc_text,
3658
(rect.x + 2) - b.lbearing,
3659
(y + (o->height / 2) -
3660
((font->ascent + font->descent) / 2)) +
3794
drawable, font, gc_text,
3795
(rect.x + 2) - b.lbearing,
3796
(y + (o->height / 2) -
3797
((font->ascent + font->descent) / 2)) +
3690
3828
case FB_LIST_FORMAT_VERTICAL:
3691
for(i = 0; i < fb->total_objects; i++)
3829
for(glist = fb->objects_list, i = 0;
3831
glist = g_list_next(glist), i++
3834
o = FILE_BROWSER_OBJECT(glist->data);
3777
3918
case FB_LIST_FORMAT_STANDARD:
3778
3919
/* Draw each object */
3779
for(i = 0; i < fb->total_objects; i++)
3920
for(glist = fb->objects_list, i = 0;
3922
glist = g_list_next(glist), i++
3925
o = FILE_BROWSER_OBJECT(glist->data);
4046
* Creates a new list column.
4048
static FileBrowserColumn *FileBrowserColumnNew(void)
4050
return(FILE_BROWSER_COLUMN(g_malloc0(
4051
sizeof(FileBrowserColumn)
4056
* Deletes the list column.
4058
static void FileBrowserColumnDelete(FileBrowserColumn *column)
4063
g_free(column->label);
3902
4068
* Returns the list column at index i.
3904
static FileBrowserColumn *FileBrowserListGetColumn(FileBrowser *fb, gint i)
4070
static FileBrowserColumn *FileBrowserListGetColumn(FileBrowser *fb, const gint i)
3908
if((i < 0) || (i >= fb->total_columns))
3911
return(fb->column[i]);
4078
return(FILE_BROWSER_COLUMN(
4079
g_list_nth_data(fb->columns_list, (guint)i)
3918
4087
FileBrowser *fb, const gchar *label, const gint width
3922
4091
FileBrowserColumn *column, *column_prev;
3927
i = fb->total_columns;
3928
fb->total_columns = i + 1;
3929
fb->column = (FileBrowserColumn **)g_realloc(
3930
fb->column, fb->total_columns * sizeof(FileBrowserColumn *)
3932
if(fb->column == NULL)
3934
fb->total_columns = 0;
3938
fb->column[i] = column = FILE_BROWSER_COLUMN(g_malloc0(
3939
sizeof(FileBrowserColumn)
4096
/* Create a new list column */
4097
column = FileBrowserColumnNew();
3941
4098
if(column == NULL)
4101
fb->columns_list = g_list_append(fb->columns_list, column);
4102
ncolumns = g_list_length(fb->columns_list);
3944
4104
column->label = STRDUP(label);
3945
column_prev = FileBrowserListGetColumn(fb, i - 1);
3946
column->position = ((column_prev != NULL) ?
3947
column_prev->position : 0) + width;
4105
column_prev = FileBrowserListGetColumn(fb, ncolumns - 2);
4106
if(column_prev != NULL)
4107
column->position = column_prev->position + width;
4109
column->position = width;
3948
4110
column->label_justify = GTK_JUSTIFY_LEFT;
3949
4111
column->flags = GTK_SENSITIVE | GTK_CAN_FOCUS |
3950
4112
GTK_CAN_DEFAULT;
3960
* Deletes all list columns.
4122
* Deletes all the list columns.
3962
4124
static void FileBrowserListColumnsClear(FileBrowser *fb)
3969
for(i = 0; i < fb->total_columns; i++)
3970
FileBrowserColumnDestroyCB(fb->column[i]);
3973
fb->total_columns = 0;
4129
if(fb->columns_list != NULL)
4132
fb->columns_list, (GFunc)FileBrowserColumnDelete, NULL
4134
g_list_free(fb->columns_list);
4135
fb->columns_list = NULL;
4128
* File browser icon destroy callback.
4130
static void FileBrowserIconDestroyCB(gpointer data)
4132
FileBrowserIcon *icon = FILE_BROWSER_ICON(data);
4136
GDK_PIXMAP_UNREF(icon->pixmap);
4137
GDK_BITMAP_UNREF(icon->mask);
4143
* File browser object destroy callback.
4145
static void FileBrowserObjectDestroyCB(gpointer data)
4147
FileBrowserObject *o = FILE_BROWSER_OBJECT(data);
4151
g_free(o->displayed_name);
4152
g_free(o->full_path);
4158
* File browser list column destroy callback.
4160
static void FileBrowserColumnDestroyCB(gpointer data)
4162
FileBrowserColumn *column = FILE_BROWSER_COLUMN(data);
4166
g_free(column->label);
4171
4291
* File browser ok button signal callback.
4173
4293
static void FileBrowserOKCB(GtkWidget *widget, gpointer data)
4478
4598
button = (GdkEventButton *)event;
4479
4599
if(!GTK_WIDGET_HAS_FOCUS(w))
4480
4600
gtk_widget_grab_focus(w);
4481
if(fb->total_columns > 0)
4601
if(fb->columns_list != NULL)
4483
gint i, cp, tolor = 3;
4484
4604
gint p = (gint)button->x;
4485
FileBrowserColumn *column;
4487
#define COLUMN_POSITION(p) (((p) != NULL) ? (p)->position : 0)
4489
/* Iterate through all columns to update focus and
4492
for(i = 0; i < fb->total_columns; i++)
4494
column = fb->column[i];
4498
/* Get left edge column position */
4499
cp = ((i - 1) >= 0) ?
4500
COLUMN_POSITION(fb->column[i - 1]) : 0;
4502
if((p >= (cp + tolor)) && (p < (column->position - tolor)))
4503
column->flags |= GTK_HAS_FOCUS;
4505
column->flags &= ~GTK_HAS_FOCUS;
4507
column->drag = FALSE;
4509
FileBrowserListHeaderQueueDraw(fb);
4511
/* Iterate through all columns, checking for one
4512
* where the pointer is over its resizing area.
4514
for(i = fb->total_columns - 1; i >= 0; i--)
4516
column = fb->column[i];
4606
FileBrowserColumn *column, *prev_column;
4608
/* Iterate through the list of columns, checking a
4609
* column that the pointer is over its resizing
4612
for(glist = g_list_last(fb->columns_list);
4614
glist = g_list_previous(glist)
4617
column = FILE_BROWSER_COLUMN(glist->data);
4517
4618
if(column == NULL)
4535
#undef COLUMN_POSITION
4636
/* No column was clicked on its resizing area? */
4639
/* Iterate through all columns to update the focus
4640
* and reset the drag state
4643
for(glist = fb->columns_list;
4645
glist = g_list_next(glist)
4648
column = FILE_BROWSER_COLUMN(glist->data);
4652
/* Get the left edge column position */
4653
cp = (prev_column != NULL) ? prev_column->position : 0;
4655
/* Clicked on this column? */
4656
if((p >= (cp + tolor)) && (p < (column->position - tolor)))
4658
/* Invert the focus */
4659
if(column->flags & GTK_HAS_FOCUS)
4660
column->flags &= ~GTK_HAS_FOCUS;
4662
column->flags |= GTK_HAS_FOCUS;
4666
column->flags &= ~GTK_HAS_FOCUS;
4669
column->drag = FALSE;
4671
prev_column = column;
4674
FileBrowserListHeaderQueueDraw(fb);
4540
4679
case GDK_BUTTON_RELEASE:
4541
4680
button = (GdkEventButton *)event;
4542
if(fb->total_columns > 0)
4681
if(fb->columns_list != NULL)
4544
gint i, pos_shift_delta = 0;
4683
gint pos_shift_delta = 0;
4545
4685
FileBrowserColumn *column;
4547
/* Iterate through all columns, checking for one that
4548
* is being dragged and set that new column's
4687
/* Iterate through the columns list, checking for one
4688
* that is being dragged and set that column's new
4551
for(i = 0; i < fb->total_columns; i++)
4691
for(glist = fb->columns_list;
4693
glist = g_list_next(glist)
4553
column = fb->column[i];
4696
column = FILE_BROWSER_COLUMN(glist->data);
4554
4697
if(column == NULL)
4578
4721
case GDK_MOTION_NOTIFY:
4579
4722
motion = (GdkEventMotion *)event;
4580
if(fb->total_columns > 0)
4723
if(fb->columns_list != NULL)
4582
gint i, tolor = 3, left_column_pos = 0;
4725
gint tolor = 3, left_column_pos = 0;
4726
gint p = (gint)motion->x;
4583
4728
GdkCursor *cursor = NULL;
4584
gint p = (gint)motion->x;
4585
4729
FileBrowserColumn *column;
4591
4735
* moved into the dragging area of a column then
4592
4736
* the new cursor will be specified.
4594
for(i = 0; i < fb->total_columns; i++)
4738
for(glist = fb->columns_list;
4740
glist = g_list_next(glist)
4596
column = fb->column[i];
4743
column = FILE_BROWSER_COLUMN(glist->data);
4597
4744
if(column == NULL)
4625
4772
* pointer has moved into the dragging
4626
4773
* area of this column.
4628
gint cp = column->position;
4775
const gint cp = column->position;
4629
4776
if((p >= (cp - tolor)) && (p < (cp + (2 * tolor))))
4631
4777
cursor = fb->cur_column_hresize;
4634
4779
left_column_pos = column->position;
4876
const FileBrowserObject *o = (fb->total_objects > 0) ?
4877
fb->object[0] : NULL;
5023
FileBrowserObject *o = FILE_BROWSER_OBJECT(
5024
g_list_nth_data(fb->objects_list, 0)
4878
5026
gint i, n = fb->focus_object,
4879
5027
row_height = (o != NULL) ?
4880
5028
(o->height + 1) : 0;
4894
5042
if((key->state & GDK_SHIFT_MASK) &&
4895
(fb->total_objects > 0)
4899
for(j = MIN(n, fb->total_objects - 1); j >= i; j--)
5047
for(j = MIN(n, nobjs - 1); j >= i; j--)
4901
5049
if(!OBJISSEL(fb, j))
4902
5050
fb->selection = g_list_append(
4944
const FileBrowserObject *o = (fb->total_objects > 0) ?
4945
fb->object[0] : NULL;
5093
FileBrowserObject *o = FILE_BROWSER_OBJECT(
5094
g_list_nth_data(fb->objects_list, 0)
4946
5096
gint i, n = fb->focus_object,
4947
5097
row_height = (o != NULL) ?
4948
5098
(o->height + 1) : 0;
4955
5105
fb->focus_object = i = MIN(
4956
5106
fb->focus_object +
4957
(gint)(adj->page_increment / row_height),
4958
fb->total_objects - 1
5107
(gint)(adj->page_increment / row_height),
4962
5112
if((key->state & GDK_SHIFT_MASK) &&
4963
(fb->total_objects > 0)
5015
5166
if((key->state & GDK_SHIFT_MASK) &&
5016
(fb->total_objects > 0)
5020
for(j = MIN(n, fb->total_objects - 1); j >= i; j--)
5171
for(j = MIN(n, (nobjs - 1)); j >= i; j--)
5022
5173
if(!OBJISSEL(fb, j))
5023
5174
fb->selection = g_list_append(
5062
else if(fb->focus_object < (fb->total_objects - 1))
5214
else if(fb->focus_object < (nobjs - 1))
5064
gint i = MAX(fb->total_objects - 1, 0),
5216
gint i = MAX((nobjs - 1), 0),
5065
5217
n = fb->focus_object;
5067
5219
fb->focus_object = i;
5070
5222
if((key->state & GDK_SHIFT_MASK) &&
5071
(fb->total_objects > 0)
5113
5265
else if(fb->focus_object > 0)
5115
const gint n = fb->focus_object,
5267
const gint nobjs = g_list_length(fb->objects_list),
5268
n = fb->focus_object,
5118
5271
fb->focus_object = i;
5121
5274
if((key->state & GDK_SHIFT_MASK) &&
5122
(fb->total_objects > 0)
5125
5278
if(!OBJISSEL(fb, n))
5154
5307
/* Scroll only? */
5308
const gint nobjs = g_list_length(fb->objects_list);
5155
5309
if(key->state & GDK_CONTROL_MASK)
5157
5311
/* No vertical scrolling */
5159
else if(fb->focus_object < (fb->total_objects - 1))
5313
else if(fb->focus_object < (nobjs - 1))
5161
5315
const gint n = MAX(fb->focus_object, 0),
5215
5369
else if(fb->focus_object > 0)
5217
const gint n = fb->focus_object,
5371
const gint nobjs = g_list_length(fb->objects_list),
5372
n = fb->focus_object,
5219
fb->focus_object - fb->objects_per_row, 0
5374
(fb->focus_object - fb->objects_per_row), 0
5222
5377
fb->focus_object = i;
5225
5380
if((key->state & GDK_SHIFT_MASK) &&
5226
(fb->total_objects > 0)
5230
for(j = MIN(n, fb->total_objects - 1); j >= i; j--)
5385
for(j = MIN(n, (nobjs - 1)); j >= i; j--)
5232
5387
if(!OBJISSEL(fb, j))
5233
5388
fb->selection = g_list_append(
5273
else if(fb->focus_object < (fb->total_objects - 1))
5429
else if(fb->focus_object < (nobjs - 1))
5275
5431
const gint n = MAX(fb->focus_object, 0),
5277
n + fb->objects_per_row,
5278
fb->total_objects - 1
5433
(n + fb->objects_per_row),
5281
5437
fb->focus_object = i;
5284
5440
if((key->state & GDK_SHIFT_MASK) &&
5285
(fb->total_objects > 0)
5332
5488
else if(fb->focus_object > 0)
5334
gint n = fb->focus_object,
5490
const gint nobjs = g_list_length(fb->objects_list),
5491
n = fb->focus_object,
5336
fb->focus_object - fb->objects_per_row, 0
5493
(fb->focus_object - fb->objects_per_row), 0
5339
5496
fb->focus_object = i;
5342
5499
if((key->state & GDK_SHIFT_MASK) &&
5343
(fb->total_objects > 0)
5347
for(j = MIN(n, fb->total_objects - 1); j >= i; j--)
5504
for(j = MIN(n, (nobjs - 1)); j >= i; j--)
5349
5506
if(!OBJISSEL(fb, j))
5350
5507
fb->selection = g_list_append(
5389
else if(fb->focus_object < (fb->total_objects - 1))
5547
else if(fb->focus_object < (nobjs - 1))
5391
gint n = fb->focus_object,
5549
const gint n = fb->focus_object,
5393
fb->focus_object + fb->objects_per_row,
5394
fb->total_objects - 1
5551
(fb->focus_object + fb->objects_per_row),
5397
5555
fb->focus_object = i;
5400
5558
if((key->state & GDK_SHIFT_MASK) &&
5401
(fb->total_objects > 0)
5444
5602
else if(fb->focus_object > 0)
5604
const gint nobjs = g_list_length(fb->objects_list),
5447
5606
n = fb->focus_object;
5449
5608
fb->focus_object = i;
5452
5611
if((key->state & GDK_SHIFT_MASK) &&
5453
(fb->total_objects > 0)
5457
for(j = MIN(n, fb->total_objects - 1); j >= i; j--)
5616
for(j = MIN(n, (nobjs - 1)); j >= i; j--)
5459
5618
if(!OBJISSEL(fb, j))
5460
5619
fb->selection = g_list_append(
5499
else if(fb->focus_object < (fb->total_objects - 1))
5659
else if(fb->focus_object < (nobjs - 1))
5501
gint i = MAX(fb->total_objects - 1, 0),
5661
const gint i = MAX(nobjs - 1, 0),
5502
5662
n = fb->focus_object;
5504
5664
fb->focus_object = i;
5507
5667
if((key->state & GDK_SHIFT_MASK) &&
5508
(fb->total_objects > 0)
5636
5796
/* Unmap the floating prompt as needed */
5637
5797
if(FPromptIsQuery())
5638
5798
FPromptBreakQuery();
5639
/* Grab focus as needed */
5799
/* Grab the focus as needed */
5640
5800
if(!GTK_WIDGET_HAS_FOCUS(w))
5641
5801
gtk_widget_grab_focus(w);
5642
/* Handle by button number */
5802
/* Handle by the button number */
5643
5803
switch(button->button)
5645
5805
case GDK_BUTTON1: /* Select */
5834
5994
if(fb->list_menu != NULL)
5836
5996
GtkMenu *menu = GTK_MENU(fb->list_menu);
5837
gint i = FileBrowserListSelectCoordinates(
5997
const gint i = FileBrowserListSelectCoordinates(
5838
5998
fb, (gint)button->x, (gint)button->y
5840
6000
/* If ctrl or shift modifier keys are held then do
5870
6030
FileBrowserListObjectSetDNDIcon(fb, i);
6032
/* Update the entry with the new list of
6035
FileBrowserEntrySetSelectedObjects(fb);
6038
/* Map the right-click menu */
5874
6039
gtk_menu_popup(
5875
6040
menu, NULL, NULL,
6147
6312
if(fb->selection != NULL)
6148
6313
g_list_free(fb->selection);
6149
6314
fb->selection = NULL;
6150
for(i = 0; i < fb->total_objects; i++)
6315
nobjs = g_list_length(fb->objects_list);
6316
for(i = 0; i < nobjs; i++)
6151
6317
fb->selection = g_list_append(
6152
6318
fb->selection, (gpointer)i
6178
6344
static void FileBrowserInvertSelectionCB(GtkWidget *widget, gpointer data)
6181
GList *glist = NULL;
6182
6348
FileBrowser *fb = FILE_BROWSER(data);
6186
for(i = 0; i < fb->total_objects; i++)
6352
nobjs = g_list_length(fb->objects_list);
6354
for(i = 0; i < nobjs; i++)
6188
6356
if(!OBJISSEL(fb, i))
6189
6357
glist = g_list_append(glist, (gpointer)i);
6241
6409
CDialogSetTransientFor(NULL); \
6412
FileBrowserSetBusy(fb, TRUE);
6244
6414
/* No directory deliminators may exist in the new value */
6245
if(strchr(value, G_DIR_SEPARATOR) != NULL)
6415
if(strchr((const char *)value, G_DIR_SEPARATOR) != NULL)
6247
gchar *s = g_strdup_printf(
6417
gchar *msg = g_strdup_printf(
6248
6418
#if defined(PROG_LANGUAGE_SPANISH)
6249
6419
"El nombre nuevo \"%s\" contiene deliminators de\n\
6250
6420
gu�a de '%c' que no se permiten en un nombre de objeto."
6274
6444
value, G_DIR_SEPARATOR
6276
MESSAGE_RENAME_FAILED(s);
6446
MESSAGE_RENAME_FAILED(msg);
6448
FileBrowserSetBusy(fb, FALSE);
6281
/* Get last selected object */
6452
/* Get the last selected object */
6282
6453
glist = fb->selection_end;
6283
6454
i = (glist != NULL) ? (gint)glist->data : -1;
6284
6455
o = FileBrowserGetObject(fb, i);
6285
if((o != NULL) ? (o->full_path != NULL) : FALSE)
6457
(o->name != NULL) && (o->full_path != NULL) : FALSE
6460
struct stat lstat_buf;
6287
6461
const gchar *cur_location = FileBrowserGetLocation(fb);
6288
6462
gchar *old_full_path = STRDUP(o->full_path),
6289
6463
*new_full_path = STRDUP(
6290
6464
PrefixPaths(cur_location, value)
6292
struct stat lstat_buf;
6294
6467
/* New name and old name the same? */
6295
if(!strcmp(o->name, value))
6468
if(!strcmp((const char *)o->name, (const char *)value))
6300
6473
* already exists
6303
else if(stat(new_full_path, &lstat_buf) == 0)
6476
else if(stat((const char *)new_full_path, &lstat_buf) == 0)
6305
else if(lstat(new_full_path, &lstat_buf) == 0)
6478
else if(lstat((const char *)new_full_path, &lstat_buf) == 0)
6308
gchar *s = g_strdup_printf(
6481
gchar *msg = g_strdup_printf(
6309
6482
"An object by the name of \"%s\" already exists.",
6312
MESSAGE_RENAME_FAILED(s);
6485
MESSAGE_RENAME_FAILED(msg);
6316
else if(rename(old_full_path, new_full_path))
6489
else if(rename((const char *)old_full_path, (const char *)new_full_path))
6318
6491
const gint error_code = (gint)errno;
6319
gchar *s = g_strdup_printf(
6492
gchar *msg = g_strdup_printf(
6321
6494
g_strerror(error_code)
6323
MESSAGE_RENAME_FAILED(s);
6496
MESSAGE_RENAME_FAILED(msg);
6330
6503
/* Update the list */
6331
6504
FileBrowserListUpdate(fb, NULL);
6333
/* Reselect object */
6334
for(i = 0; i < fb->total_objects; i++)
6506
/* Reselect the object */
6507
for(glist = fb->objects_list, i = 0;
6509
glist = g_list_next(glist), i++
6337
if((o != NULL) ? (o->full_path == NULL) : TRUE)
6340
if(!strcmp(o->full_path, new_full_path))
6512
o = FILE_BROWSER_OBJECT(glist->data);
6516
if(o->full_path == NULL)
6519
if(!strcmp((const char *)o->full_path, (const char *)new_full_path))
6342
6521
/* Select this object */
6343
6522
fb->focus_object = i;
6357
6536
/* Update selected objects on entry */
6358
6537
FileBrowserEntrySetSelectedObjects(fb);
6539
/* Notify about the rename */
6540
if(fb->object_modified_cb != NULL)
6541
fb->object_modified_cb(
6544
fb->object_modified_data
6361
6548
g_free(old_full_path);
6362
6549
g_free(new_full_path);
6552
FileBrowserSetBusy(fb, FALSE);
6365
6554
#undef MESSAGE_RENAME_FAILED
6366
6555
#undef TITLE_RENAME_FAILED
6918
7107
if(ISLPATHDIR(full_path))
6920
7109
/* Delete directory */
6921
if(rmdir(full_path))
7110
if(rmdir((const char *)full_path))
6923
7112
const gint error_code = (gint)errno;
6924
gchar *s = g_strdup_printf(
7113
gchar *msg = g_strdup_printf(
6926
7115
g_strerror(error_code)
6928
MESSAGE_DELETE_FAILED(s);
7117
MESSAGE_DELETE_FAILED(msg);
6939
7128
if(unlink((const char *)full_path))
6941
7130
const gint error_code = (gint)errno;
6942
gchar *s = g_strdup_printf(
7131
gchar *msg = g_strdup_printf(
6944
7133
g_strerror(error_code)
6946
MESSAGE_DELETE_FAILED(s);
7135
MESSAGE_DELETE_FAILED(msg);
6951
7140
objects_deleted++;
7144
/* Notify about the deleted object */
7145
if(fb->object_deleted_cb != NULL)
7146
fb->object_deleted_cb(
7148
fb->object_deleted_data
6956
7152
glist = g_list_next(glist);
7038
7234
gtk_entry_set_text(entry, (path != NULL) ? path : "");
7039
7235
gtk_entry_set_position(entry, -1);
7041
/* If there was no change in the path then beep */
7042
if((prev_path != NULL) && (path != NULL))
7044
if(!strcmp((const char *)prev_path, (const char *)path))
7237
/* If there was no change in the path then beep */
7238
if((prev_path != NULL) && (path != NULL))
7240
if(!strcmp((const char *)prev_path, (const char *)path))
7048
7244
g_free(prev_path);
7232
7428
GdkWindow *window;
7233
7429
GtkAdjustment *adj;
7234
7430
GtkAccelGroup *accelgrp;
7235
GtkWidget *w, *parent, *parent2, *parent3, *parent4;
7432
*parent, *parent2, *parent3, *parent4,
7236
7434
pulist_struct *pulist;
7237
7435
pulistbox_struct *pulistbox;
7238
7436
FileBrowser *fb = &file_browser;
7438
fb->toplevel = toplevel = gtk_window_new(GTK_WINDOW_DIALOG);
7439
fb->accelgrp = accelgrp = gtk_accel_group_new();
7241
7440
fb->busy_count = 0;
7242
7441
fb->freeze_count = 0;
7243
fb->accelgrp = accelgrp = gtk_accel_group_new();
7442
fb->block_loop_level = 0;
7443
fb->user_response = FALSE;
7244
7444
fb->cur_busy = gdk_cursor_new(GDK_WATCH);
7245
7445
fb->cur_column_hresize = gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW);
7246
7446
fb->cur_translate = gdk_cursor_new(GDK_FLEUR);
7248
7448
fb->vsb_map_state = FALSE;
7249
7449
fb->hsb_map_state = FALSE;
7250
7450
fb->cur_location = NULL;
7251
fb->block_loop_level = 0;
7252
fb->user_response = FALSE;
7253
7451
fb->list_format = FB_LIST_FORMAT_STANDARD;
7255
fb->total_columns = 0;
7256
memset(&fb->cur_type, 0x00, sizeof(fb_type_struct));
7257
fb->selected_path = NULL;
7258
fb->total_selected_paths = 0;
7260
fb->total_icons = 0;
7452
fb->columns_list = NULL;
7453
fb->icons_list = NULL;
7275
7468
fb->home_path = STRDUP(g_getenv("HOME"));
7277
7470
fb->device_paths_list = NULL;
7471
fb->objects_list = NULL;
7472
fb->objects_per_row = 0;
7278
7473
fb->focus_object = -1;
7279
fb->selection = fb->selection_end = NULL;
7281
fb->total_objects = 0;
7282
fb->objects_per_row = 0;
7283
7474
fb->last_single_select_object = -1;
7475
fb->selection = fb->selection_end = NULL;
7284
7476
fb->show_hidden_objects = TRUE;
7477
memset(&fb->cur_type, 0x00, sizeof(fb_type_struct));
7478
fb->selected_path = NULL;
7479
fb->total_selected_paths = 0;
7480
fb->object_created_cb = NULL;
7481
fb->object_created_data = NULL;
7482
fb->object_modified_cb = NULL;
7483
fb->object_modified_data = NULL;
7484
fb->object_deleted_cb = NULL;
7485
fb->object_deleted_data = NULL;
7285
7486
fb->button = 0;
7286
7487
fb->drag_last_x = 0;
7287
7488
fb->drag_last_y = 0;
7288
7489
fb->last_button1_release_time = 0l;
7291
fb->toplevel = w = gtk_window_new(GTK_WINDOW_DIALOG);
7491
/* Toplevel GtkWindow */
7292
7493
gtk_window_set_policy(GTK_WINDOW(w), TRUE, TRUE, TRUE);
7293
7494
gtk_widget_set_usize(w, FB_WIDTH, FB_HEIGHT);
7294
7495
gtk_window_set_title(GTK_WINDOW(w), "Select File");
8229
8430
GTK_OBJECT(w), "activate",
8230
8431
GTK_SIGNAL_FUNC(FileBrowserEntryEnterCB), fb
8433
GUIEditableEndowPopupMenu(w, 0);
8232
8434
gtk_widget_show(w);
8234
8437
#if defined(PROG_LANGUAGE_SPANISH)
8235
8438
"Entre el nombre del objeto, usted puede especificar m�s\
8236
8439
que un objeto (separa cada nombre con un ',' el car�cter)"
8703
* Sets the object created callback.
8705
void FileBrowserSetObjectCreatedCB(
8713
FileBrowser *fb = &file_browser;
8714
fb->object_created_cb = cb;
8715
fb->object_created_data = data;
8719
* Sets the object modified callback.
8721
void FileBrowserSetObjectModifiedCB(
8723
const gchar *old_path,
8724
const gchar *new_path,
8730
FileBrowser *fb = &file_browser;
8731
fb->object_modified_cb = cb;
8732
fb->object_modified_data = data;
8736
* Sets the object deleted callback.
8738
void FileBrowserSetObjectDeletedCB(
8746
FileBrowser *fb = &file_browser;
8747
fb->object_deleted_cb = cb;
8748
fb->object_deleted_data = data;
8500
8752
* Returns TRUE if currently blocking for query.
8502
8754
gboolean FileBrowserIsQuery(void)
8575
8826
fb->selection = fb->selection_end = NULL;
8577
8828
/* Delete all the objects */
8578
for(i = 0; i < fb->total_objects; i++)
8579
FileBrowserObjectDestroyCB(fb->object[i]);
8582
fb->total_objects = 0;
8829
if(fb->objects_list != NULL)
8832
fb->objects_list, (GFunc)FileBrowserObjectDelete, NULL
8834
g_list_free(fb->objects_list);
8835
fb->objects_list = NULL;
8584
/* Reset the objects per row */
8838
/* Reset the number of objects per row */
8585
8839
fb->objects_per_row = 0;
8587
8841
fb->freeze_count--;
8681
8935
FileBrowserSetBusy(fb, TRUE);
8937
/* Map the File Browser
8685
8939
* This needs to be done now in order to allow the proper
8686
8940
* realizing of sizes before other things can be updated
8942
* A configure_event signal will be emitted at which the
8943
* correct sizes will be known when adding the objects to
8688
8946
FileBrowserMap();
8690
/* This is not needed any more since object positions are updated when
8691
* a "configure_event" signal is received
8693
while(gtk_events_pending() > 0)
8694
gtk_main_iteration();
8697
8948
/* No initial path specified? */
8698
8949
if(STRISEMPTY(path))
8701
8952
* check if the list was previous cleared (reset), in
8702
8953
* which case we need to reget the listing
8704
if(fb->total_objects <= 0)
8955
if(fb->objects_list == NULL)
8706
8957
FileBrowserListUpdate(fb, NULL);
8707
8958
FileBrowserLocationsPUListUpdate(fb);
8720
8971
FileBrowserSetLocation(fb, "~");
8722
8973
/* If there is a first object in the list then set it in focus */
8723
if(fb->total_objects > 0)
8974
if(fb->objects_list != NULL)
8725
8976
if(fb->focus_object < 0)
8814
9065
g_list_free(fb->selection);
8815
9066
fb->selection = fb->selection_end = NULL;
8817
/* Delete the objects */
8818
for(i = 0; i < fb->total_objects; i++)
8819
FileBrowserObjectDestroyCB(fb->object[i]);
8822
fb->total_objects = 0;
9068
/* Delete all the objects */
9069
if(fb->objects_list != NULL)
9072
fb->objects_list, (GFunc)FileBrowserObjectDelete, NULL
9074
g_list_free(fb->objects_list);
9075
fb->objects_list = NULL;
8823
9077
fb->objects_per_row = 0;
8825
9079
/* Delete the icons */
8826
for(i = 0; i < fb->total_icons; i++)
8827
FileBrowserIconDestroyCB(fb->icon[i]);
8830
fb->total_icons = 0;
9080
if(fb->icons_list != NULL)
9083
fb->icons_list, (GFunc)FileBrowserIconDelete, NULL
9085
g_list_free(fb->icons_list);
9086
fb->icons_list = NULL;
8832
9089
/* Delete the list columns */
8833
9090
FileBrowserListColumnsClear(fb);