More FIXME-to-bug work.

* src/nautilus-index-title.c,
	* libnautilus-extensions/nautilus-gdk-extensions.h,
	* libnautilus-extensions/nautilus-gdk-extensions.c:
	(select_font): Moved this function to gdk_extensions
	and renamed it nautilus_get_largest_fitting_font.

	* src/nautilus-index-tabs.c,
	* src/nautilus-index-title.c,
	* src/file-manager/fm-list-view.c,
	* src/file-manager/fm-properties-window.c:
	Wrote bug reports for all (other) FIXMEs in these files. Down to
	81 in Nautilus with no bug report.
This commit is contained in:
John Sullivan 2000-04-26 22:07:02 +00:00
parent 5f90e5043e
commit 0b4acd0e69
11 changed files with 148 additions and 109 deletions

View file

@ -1,3 +1,20 @@
2000-04-26 John Sullivan <sullivan@eazel.com>
More FIXME-to-bug work.
* src/nautilus-index-title.c,
* libnautilus-extensions/nautilus-gdk-extensions.h,
* libnautilus-extensions/nautilus-gdk-extensions.c:
(select_font): Moved this function to gdk_extensions
and renamed it nautilus_get_largest_fitting_font.
* src/nautilus-index-tabs.c,
* src/nautilus-index-title.c,
* src/file-manager/fm-list-view.c,
* src/file-manager/fm-properties-window.c:
Wrote bug reports for all (other) FIXMEs in these files. Down to
81 in Nautilus with no bug report.
2000-04-26 Andy Hertzfeld <andy@eazel.com>
* src/ntl-index-panel.c:

View file

@ -473,6 +473,48 @@ nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
return gdk_font_equal (font_a_null_allowed, font_b_null_allowed);
}
GdkFont *
nautilus_get_largest_fitting_font (const char *text_to_format, int width, const char* font_template)
{
int font_index, this_width;
char *font_name;
const int font_sizes[5] = { 28, 24, 18, 14, 12 };
GdkFont *candidate_font = NULL;
char *alt_text_to_format = NULL;
char *temp_str = strdup(text_to_format);
char *cr_pos = strchr(temp_str, '\n');
if (cr_pos) {
*cr_pos = '\0';
alt_text_to_format = cr_pos + 1;
}
for (font_index = 0; font_index < NAUTILUS_N_ELEMENTS (font_sizes); font_index++) {
if (candidate_font != NULL) {
gdk_font_unref (candidate_font);
}
font_name = g_strdup_printf (font_template, font_sizes[font_index]);
candidate_font = gdk_font_load (font_name);
g_free (font_name);
this_width = gdk_string_width (candidate_font, temp_str);
if (alt_text_to_format != NULL) {
int alt_width = gdk_string_width (candidate_font, alt_text_to_format);
if (this_width <= width && alt_width <= width) {
break;
}
} else {
if (this_width <= width) {
break;
}
}
}
g_free (temp_str);
return candidate_font;
}
/**
* nautilus_stipple_bitmap:
*

View file

@ -95,7 +95,12 @@ void nautilus_rectangle_inset (GdkRectangle *rectan
guint32 nautilus_interpolate_color (gdouble ratio,
guint32 start_rgb,
guint32 end_rgb);
/* Misc GdkFont helper functions */
gboolean nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
GdkFont *font_b_null_allowed);
GdkFont *nautilus_get_largest_fitting_font (const char *text_to_format,
int width,
const char *font_format);
#endif /* NAUTILUS_GDK_EXTENSIONS_H */

View file

@ -473,6 +473,48 @@ nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
return gdk_font_equal (font_a_null_allowed, font_b_null_allowed);
}
GdkFont *
nautilus_get_largest_fitting_font (const char *text_to_format, int width, const char* font_template)
{
int font_index, this_width;
char *font_name;
const int font_sizes[5] = { 28, 24, 18, 14, 12 };
GdkFont *candidate_font = NULL;
char *alt_text_to_format = NULL;
char *temp_str = strdup(text_to_format);
char *cr_pos = strchr(temp_str, '\n');
if (cr_pos) {
*cr_pos = '\0';
alt_text_to_format = cr_pos + 1;
}
for (font_index = 0; font_index < NAUTILUS_N_ELEMENTS (font_sizes); font_index++) {
if (candidate_font != NULL) {
gdk_font_unref (candidate_font);
}
font_name = g_strdup_printf (font_template, font_sizes[font_index]);
candidate_font = gdk_font_load (font_name);
g_free (font_name);
this_width = gdk_string_width (candidate_font, temp_str);
if (alt_text_to_format != NULL) {
int alt_width = gdk_string_width (candidate_font, alt_text_to_format);
if (this_width <= width && alt_width <= width) {
break;
}
} else {
if (this_width <= width) {
break;
}
}
}
g_free (temp_str);
return candidate_font;
}
/**
* nautilus_stipple_bitmap:
*

View file

@ -95,7 +95,12 @@ void nautilus_rectangle_inset (GdkRectangle *rectan
guint32 nautilus_interpolate_color (gdouble ratio,
guint32 start_rgb,
guint32 end_rgb);
/* Misc GdkFont helper functions */
gboolean nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
GdkFont *font_b_null_allowed);
GdkFont *nautilus_get_largest_fitting_font (const char *text_to_format,
int width,
const char *font_format);
#endif /* NAUTILUS_GDK_EXTENSIONS_H */

View file

@ -291,13 +291,13 @@ create_list (FMListView *list_view)
NautilusList *list;
GtkCList *clist;
/* FIXME:
/* FIXME bugzilla.eazel.com 666:
* title setup should allow for columns not being resizable at all,
* justification, editable or not, type/format,
* not being usable as a sort order criteria, etc.
* for now just set up name, min, max and current width
*
* FIXME:
* FIXME bugzilla.eazel.com 315:
* the icon column should be set to the width of an icon at a given
* zoom level or should be resizable when using nautilus theme icons
*/

View file

@ -72,7 +72,7 @@ get_pixmap_and_mask_for_properties_window (NautilusFile *file,
g_assert (NAUTILUS_IS_FILE (file));
/* FIXME: Do something about giant icon sizes here */
/* FIXME bugzilla.eazel.com 413: Do something about giant icon sizes here */
pixbuf = nautilus_icon_factory_get_pixbuf_for_file (file, NAUTILUS_ICON_SIZE_STANDARD);
gdk_pixbuf_render_pixmap_and_mask (pixbuf, pixmap_return, mask_return, 128);
gdk_pixbuf_unref (pixbuf);

View file

@ -104,7 +104,9 @@ nautilus_index_tabs_initialize_class (NautilusIndexTabsClass *class)
widget_class->size_allocate = nautilus_index_tabs_size_allocate;
/* load the font */
/* FIXME: this shouldn't be hardwired - it should be fetched from preferences */
/* FIXME bugzilla.eazel.com 667:
* this shouldn't be hardwired - it should be fetched from preferences
*/
tab_font = gdk_font_load ("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
}
@ -249,7 +251,9 @@ draw_one_tab (NautilusIndexTabs *index_tabs, GdkGC *gc,
int total_width = name_width + 2*TAB_MARGIN;
GtkWidget *widget = GTK_WIDGET (index_tabs);
/* FIXME: we must "ellipsize" the name if it doesn't fit, for now, assume it does */
/* FIXME bugzilla.eazel.com 668:
* we must "ellipsize" the name if it doesn't fit, for now, assume it does
*/
/* fill the tab rectangle with the tab color */

View file

@ -35,6 +35,7 @@
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libnautilus-extensions/nautilus-file-attributes.h>
#include <libnautilus-extensions/nautilus-gdk-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
@ -47,9 +48,6 @@ static void nautilus_index_title_destroy (GtkObject
static void nautilus_index_title_initialize (NautilusIndexTitle *pixmap);
static gboolean nautilus_index_title_button_press_event (GtkWidget *widget,
GdkEventButton *event);
static GdkFont *select_font (const char *text_to_format,
int width,
const char *font_template);
static void nautilus_index_title_update_icon (NautilusIndexTitle *index_title);
static void nautilus_index_title_update_label (NautilusIndexTitle *index_title);
static void nautilus_index_title_update_info (NautilusIndexTitle *index_title);
@ -201,50 +199,6 @@ nautilus_index_title_update_icon (NautilusIndexTitle *index_title)
}
}
/* utility routine (FIXME: should be located elsewhere) to find the largest font that fits */
GdkFont *
select_font (const char *text_to_format, int width, const char* font_template)
{
int font_index, this_width;
char *font_name;
const int font_sizes[5] = { 28, 24, 18, 14, 12 };
GdkFont *candidate_font = NULL;
char *alt_text_to_format = NULL;
char *temp_str = strdup(text_to_format);
char *cr_pos = strchr(temp_str, '\n');
if (cr_pos) {
*cr_pos = '\0';
alt_text_to_format = cr_pos + 1;
}
for (font_index = 0; font_index < NAUTILUS_N_ELEMENTS (font_sizes); font_index++) {
if (candidate_font != NULL) {
gdk_font_unref (candidate_font);
}
font_name = g_strdup_printf (font_template, font_sizes[font_index]);
candidate_font = gdk_font_load (font_name);
g_free (font_name);
this_width = gdk_string_width (candidate_font, temp_str);
if (alt_text_to_format != NULL) {
int alt_width = gdk_string_width (candidate_font, alt_text_to_format);
if (this_width <= width && alt_width <= width) {
break;
}
} else {
if (this_width <= width) {
break;
}
}
}
g_free (temp_str);
return candidate_font;
}
/* set up the filename label */
static void
nautilus_index_title_update_label (NautilusIndexTitle *index_title)
@ -300,8 +254,10 @@ nautilus_index_title_update_label (NautilusIndexTitle *index_title)
gtk_box_reorder_child (GTK_BOX (index_title), index_title->details->title, 1);
}
/* FIXME: don't use hardwired font like this - get it from preferences */
label_font = select_font (displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
/* FIXME bugzilla.eazel.com 667:
* don't use hardwired font like this - get it from preferences
*/
label_font = nautilus_get_largest_fitting_font (displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
"-bitstream-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*");
nautilus_gtk_widget_set_font (index_title->details->title, label_font);
@ -356,7 +312,9 @@ nautilus_index_title_update_info (NautilusIndexTitle *index_title)
gtk_box_reorder_child (GTK_BOX (index_title), index_title->details->more_info, 2);
}
/* FIXME: shouldn't use hardwired font */
/* FIXME bugzilla.eazel.com 667:
* don't use hardwired font like this - get it from preferences
*/
nautilus_gtk_widget_set_font_by_name (index_title->details->more_info,
"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
@ -375,7 +333,9 @@ nautilus_index_title_update_info (NautilusIndexTitle *index_title)
gtk_box_reorder_child (GTK_BOX (index_title), index_title->details->notes, 3);
}
/* FIXME: don't use hardwired font like this */
/* FIXME bugzilla.eazel.com 667:
* don't use hardwired font like this - get it from preferences
*/
nautilus_gtk_widget_set_font_by_name (index_title->details->notes,
"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");

View file

@ -104,7 +104,9 @@ nautilus_index_tabs_initialize_class (NautilusIndexTabsClass *class)
widget_class->size_allocate = nautilus_index_tabs_size_allocate;
/* load the font */
/* FIXME: this shouldn't be hardwired - it should be fetched from preferences */
/* FIXME bugzilla.eazel.com 667:
* this shouldn't be hardwired - it should be fetched from preferences
*/
tab_font = gdk_font_load ("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
}
@ -249,7 +251,9 @@ draw_one_tab (NautilusIndexTabs *index_tabs, GdkGC *gc,
int total_width = name_width + 2*TAB_MARGIN;
GtkWidget *widget = GTK_WIDGET (index_tabs);
/* FIXME: we must "ellipsize" the name if it doesn't fit, for now, assume it does */
/* FIXME bugzilla.eazel.com 668:
* we must "ellipsize" the name if it doesn't fit, for now, assume it does
*/
/* fill the tab rectangle with the tab color */

View file

@ -35,6 +35,7 @@
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libnautilus-extensions/nautilus-file-attributes.h>
#include <libnautilus-extensions/nautilus-gdk-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
@ -47,9 +48,6 @@ static void nautilus_index_title_destroy (GtkObject
static void nautilus_index_title_initialize (NautilusIndexTitle *pixmap);
static gboolean nautilus_index_title_button_press_event (GtkWidget *widget,
GdkEventButton *event);
static GdkFont *select_font (const char *text_to_format,
int width,
const char *font_template);
static void nautilus_index_title_update_icon (NautilusIndexTitle *index_title);
static void nautilus_index_title_update_label (NautilusIndexTitle *index_title);
static void nautilus_index_title_update_info (NautilusIndexTitle *index_title);
@ -201,50 +199,6 @@ nautilus_index_title_update_icon (NautilusIndexTitle *index_title)
}
}
/* utility routine (FIXME: should be located elsewhere) to find the largest font that fits */
GdkFont *
select_font (const char *text_to_format, int width, const char* font_template)
{
int font_index, this_width;
char *font_name;
const int font_sizes[5] = { 28, 24, 18, 14, 12 };
GdkFont *candidate_font = NULL;
char *alt_text_to_format = NULL;
char *temp_str = strdup(text_to_format);
char *cr_pos = strchr(temp_str, '\n');
if (cr_pos) {
*cr_pos = '\0';
alt_text_to_format = cr_pos + 1;
}
for (font_index = 0; font_index < NAUTILUS_N_ELEMENTS (font_sizes); font_index++) {
if (candidate_font != NULL) {
gdk_font_unref (candidate_font);
}
font_name = g_strdup_printf (font_template, font_sizes[font_index]);
candidate_font = gdk_font_load (font_name);
g_free (font_name);
this_width = gdk_string_width (candidate_font, temp_str);
if (alt_text_to_format != NULL) {
int alt_width = gdk_string_width (candidate_font, alt_text_to_format);
if (this_width <= width && alt_width <= width) {
break;
}
} else {
if (this_width <= width) {
break;
}
}
}
g_free (temp_str);
return candidate_font;
}
/* set up the filename label */
static void
nautilus_index_title_update_label (NautilusIndexTitle *index_title)
@ -300,8 +254,10 @@ nautilus_index_title_update_label (NautilusIndexTitle *index_title)
gtk_box_reorder_child (GTK_BOX (index_title), index_title->details->title, 1);
}
/* FIXME: don't use hardwired font like this - get it from preferences */
label_font = select_font (displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
/* FIXME bugzilla.eazel.com 667:
* don't use hardwired font like this - get it from preferences
*/
label_font = nautilus_get_largest_fitting_font (displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
"-bitstream-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*");
nautilus_gtk_widget_set_font (index_title->details->title, label_font);
@ -356,7 +312,9 @@ nautilus_index_title_update_info (NautilusIndexTitle *index_title)
gtk_box_reorder_child (GTK_BOX (index_title), index_title->details->more_info, 2);
}
/* FIXME: shouldn't use hardwired font */
/* FIXME bugzilla.eazel.com 667:
* don't use hardwired font like this - get it from preferences
*/
nautilus_gtk_widget_set_font_by_name (index_title->details->more_info,
"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
@ -375,7 +333,9 @@ nautilus_index_title_update_info (NautilusIndexTitle *index_title)
gtk_box_reorder_child (GTK_BOX (index_title), index_title->details->notes, 3);
}
/* FIXME: don't use hardwired font like this */
/* FIXME bugzilla.eazel.com 667:
* don't use hardwired font like this - get it from preferences
*/
nautilus_gtk_widget_set_font_by_name (index_title->details->notes,
"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");