From 35028b9f0595db92c964e5119cc4a32d6811ead3 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 11 Sep 2009 13:14:49 -0500 Subject: [PATCH] Factor out function to set a fixed size for the icon cell renderers Signed-off-by: Federico Mena Quintero --- gtk/gtkfilechooserdefault.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index f6ea9d6d6c..c8c4d2a5d6 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -4401,6 +4401,14 @@ file_list_query_tooltip_cb (GtkWidget *widget, return TRUE; } +static void +set_icon_cell_renderer_fixed_size (GtkFileChooserDefault *impl, GtkCellRenderer *renderer) +{ + gtk_cell_renderer_set_fixed_size (renderer, + renderer->xpad * 2 + impl->icon_size, + renderer->ypad * 2 + impl->icon_size); +} + /* Creates the widgets for the file list */ static GtkWidget * create_file_list (GtkFileChooserDefault *impl) @@ -4479,9 +4487,7 @@ create_file_list (GtkFileChooserDefault *impl) renderer = gtk_cell_renderer_pixbuf_new (); /* We set a fixed size so that we get an empty slot even if no icons are loaded yet */ - gtk_cell_renderer_set_fixed_size (renderer, - renderer->xpad * 2 + impl->icon_size, - renderer->ypad * 2 + impl->icon_size); + set_icon_cell_renderer_fixed_size (impl, renderer); gtk_tree_view_column_pack_start (impl->list_name_column, renderer, FALSE); impl->list_name_renderer = gtk_cell_renderer_text_new (); @@ -5752,9 +5758,7 @@ change_icon_theme (GtkFileChooserDefault *impl) cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT ( gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_files_tree_view), 0))); renderer = GTK_CELL_RENDERER (cells->data); - gtk_cell_renderer_set_fixed_size (renderer, - renderer->xpad * 2 + impl->icon_size, - renderer->ypad * 2 + impl->icon_size); + set_icon_cell_renderer_fixed_size (impl, renderer); g_list_free (cells); if (impl->browse_files_model) _gtk_file_system_model_clear_cache (impl->browse_files_model, MODEL_COL_PIXBUF);