Fix for defect 93087



Hi,

http://bugzilla.gnome.org/show_bug.cgi?id=93087

This defect is about font wropping inappropriately in
gnome-control-center --use-shell.

In capplet-dir-view-list.c, function list_populate(), set the icon
list width to a value depending on the current font.


Index: gnome-control-center/control-center/capplet-dir-view-list.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/control-center/capplet-dir-view-list.c,v
retrieving revision 1.13
diff -u -r1.13 capplet-dir-view-list.c
--- gnome-control-center/control-center/capplet-dir-view-list.c	21 Apr 2002 21:21:09 -0000	1.13
+++ gnome-control-center/control-center/capplet-dir-view-list.c	14 Nov 2003 03:35:43 -0000
@@ -282,6 +282,11 @@
 	int i;
 	ListViewData *data = view->view_data;
 
+	gint font_char_width;
+	PangoContext *context;
+	PangoFontDescription *desc;
+	PangoFontMetrics *metrics;
+
 	g_return_if_fail (GNOME_IS_ICON_LIST (data->gil));
 
 	if (!data->root_dir)
@@ -318,6 +323,15 @@
 					CAPPLET_DIR_ENTRY (list->data)->label);
 #endif
 	}
+	
+	context = gtk_widget_get_pango_context (GTK_WIDGET(data->gil));
+	desc = pango_context_get_font_description (context);
+	metrics = pango_context_get_metrics(context, desc, NULL);
+	font_char_width = pango_font_metrics_get_approximate_char_width(metrics);
+
+	/* Enough space to fit approximately 15 characters of the current font size */
+	gnome_icon_list_set_icon_width (data->gil, 15 * (font_char_width / PANGO_SCALE) );
+
 	gnome_icon_list_thaw (data->gil);
 
 	g_free (data->header_text);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]