comparison src/view_file_icon.c @ 318:b16b9b8979e5

Add a new struct ConfOptions to handle options. Changes were made among the code to use only one global var named "options" of type ConfOptions *. Initialization takes place in new init_options().
author zas_
date Fri, 11 Apr 2008 22:14:36 +0000
parents 9995c5fb202a
children c74af1cbd61a
comparison
equal deleted inserted replaced
317:46169c246c51 318:b16b9b8979e5
378 sel_fd = id->fd; 378 sel_fd = id->fd;
379 379
380 cur_fd = layout_image_get_fd(vfi->layout); 380 cur_fd = layout_image_get_fd(vfi->layout);
381 if (sel_fd == cur_fd) return; /* no change */ 381 if (sel_fd == cur_fd) return; /* no change */
382 382
383 if (enable_read_ahead) 383 if (options->enable_read_ahead)
384 { 384 {
385 gint row; 385 gint row;
386 386
387 row = g_list_index(vfi->list, id); 387 row = g_list_index(vfi->list, id);
388 if (row > vficon_index_by_fd(vfi, cur_fd) && 388 if (row > vficon_index_by_fd(vfi, cur_fd) &&
409 409
410 static gint vficon_get_icon_width(ViewFileIcon *vfi) 410 static gint vficon_get_icon_width(ViewFileIcon *vfi)
411 { 411 {
412 gint width; 412 gint width;
413 413
414 if (!vfi->show_text) return thumb_max_width; 414 if (!vfi->show_text) return options->thumb_max_width;
415 415
416 width = thumb_max_width + thumb_max_width / 2; 416 width = options->thumb_max_width + options->thumb_max_width / 2;
417 if (width < THUMB_MIN_ICON_WIDTH) width = THUMB_MIN_ICON_WIDTH; 417 if (width < THUMB_MIN_ICON_WIDTH) width = THUMB_MIN_ICON_WIDTH;
418 if (width > THUMB_MAX_ICON_WIDTH) width = thumb_max_width; 418 if (width > THUMB_MAX_ICON_WIDTH) width = options->thumb_max_width;
419 419
420 return width; 420 return width;
421 } 421 }
422 422
423 /* 423 /*
858 if (!vficon_find_position(vfi, start, &row1, &col1) || 858 if (!vficon_find_position(vfi, start, &row1, &col1) ||
859 !vficon_find_position(vfi, end, &row2, &col2) ) return; 859 !vficon_find_position(vfi, end, &row2, &col2) ) return;
860 860
861 vfi->prev_selection = end; 861 vfi->prev_selection = end;
862 862
863 if (!collection_rectangular_selection) 863 if (!options->collection_rectangular_selection)
864 { 864 {
865 GList *work; 865 GList *work;
866 IconData *id; 866 IconData *id;
867 867
868 if (g_list_index(vfi->list, start) > g_list_index(vfi->list, end)) 868 if (g_list_index(vfi->list, start) > g_list_index(vfi->list, end))
1254 gint ret; 1254 gint ret;
1255 1255
1256 adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vfi->listview)); 1256 adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vfi->listview));
1257 page_size = (gint)adj->page_increment; 1257 page_size = (gint)adj->page_increment;
1258 1258
1259 row_height = thumb_max_height + THUMB_BORDER_PADDING * 2; 1259 row_height = options->thumb_max_height + THUMB_BORDER_PADDING * 2;
1260 if (vfi->show_text) row_height += thumb_max_height / 3; 1260 if (vfi->show_text) row_height += options->thumb_max_height / 3;
1261 1261
1262 ret = page_size / row_height; 1262 ret = page_size / row_height;
1263 if (ret < 1) ret = 1; 1263 if (ret < 1) ret = 1;
1264 1264
1265 return ret; 1265 return ret;
1380 1380
1381 if (new_id != old_id) 1381 if (new_id != old_id)
1382 { 1382 {
1383 if (event->state & GDK_SHIFT_MASK) 1383 if (event->state & GDK_SHIFT_MASK)
1384 { 1384 {
1385 if (!collection_rectangular_selection) 1385 if (!options->collection_rectangular_selection)
1386 { 1386 {
1387 vficon_select_region_util(vfi, old_id, new_id, FALSE); 1387 vficon_select_region_util(vfi, old_id, new_id, FALSE);
1388 } 1388 }
1389 else 1389 else
1390 { 1390 {
1662 g_list_free(list); 1662 g_list_free(list);
1663 1663
1664 if (cell && GQV_IS_CELL_RENDERER_ICON(cell)) 1664 if (cell && GQV_IS_CELL_RENDERER_ICON(cell))
1665 { 1665 {
1666 g_object_set(G_OBJECT(cell), "fixed_width", thumb_width, 1666 g_object_set(G_OBJECT(cell), "fixed_width", thumb_width,
1667 "fixed_height", thumb_max_height, 1667 "fixed_height", options->thumb_max_height,
1668 "show_text", vfi->show_text, NULL); 1668 "show_text", vfi->show_text, NULL);
1669 } 1669 }
1670 } 1670 }
1671 if (GTK_WIDGET_REALIZED(vfi->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vfi->listview)); 1671 if (GTK_WIDGET_REALIZED(vfi->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vfi->listview));
1672 } 1672 }
1988 1988
1989 vfi->thumbs_fd = fd; 1989 vfi->thumbs_fd = fd;
1990 1990
1991 thumb_loader_free(vfi->thumbs_loader); 1991 thumb_loader_free(vfi->thumbs_loader);
1992 1992
1993 vfi->thumbs_loader = thumb_loader_new(thumb_max_width, thumb_max_height); 1993 vfi->thumbs_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height);
1994 thumb_loader_set_callbacks(vfi->thumbs_loader, 1994 thumb_loader_set_callbacks(vfi->thumbs_loader,
1995 vficon_thumb_done_cb, 1995 vficon_thumb_done_cb,
1996 vficon_thumb_error_cb, 1996 vficon_thumb_error_cb,
1997 NULL, 1997 NULL,
1998 vfi); 1998 vfi);