Commit bbb7d78b authored by Ramiro Estrugo's avatar Ramiro Estrugo

Task 667. Unhardcode font strings.

* libnautilus-extensions/nautilus-font-factory.c:
(nautilus_get_current_font_factory), (nautilus_font_factory_get),
(nautilus_font_factory_new), (nautilus_font_factory_initialize),
(nautilus_font_factory_initialize_class), (font_hash_node_alloc),
(font_hash_node_free), (font_hash_node_lookup),
(font_hash_node_lookup_with_insertion),
(nautilus_font_factory_get_font_by_family),
(nautilus_font_factory_get_font_from_preferences),
(nautilus_font_factory_get_fallback_font), (make_font_name_string):
* libnautilus-extensions/nautilus-font-factory.h:
New class to obtain fonts either by family or from preferences.  A
specific size can be requested.

Right now its a pretty dumb class, but it can be enhanced to do
smart things like looking at gtkstyles and/or smarted choosing of
fonts if the specifically requested size is not avialable.

* components/hardware/nautilus-hardware-view.c: (setup_form_title):
* components/music/nautilus-music-view.c:
(nautilus_music_view_initialize):
* components/rpmview/nautilus-rpm-view.c:
(nautilus_rpm_view_initialize):
* components/services/startup/nautilus-view/nautilus-service-startup-view.c:
(setup_form_title):
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-icon-container.c:
(nautilus_icon_container_initialize):
* src/nautilus-property-browser.c:
(nautilus_property_browser_initialize):
* src/nautilus-sidebar-title.c: (nautilus_index_title_update_info):
Unhardcode xlfd font strings in all of these and use the font
factory instead.
parent 9adeb195
2000-06-02 Ramiro Estrugo <ramiro@eazel.com>
Task 667. Unhardcode font strings.
* libnautilus-extensions/nautilus-font-factory.c:
(nautilus_get_current_font_factory), (nautilus_font_factory_get),
(nautilus_font_factory_new), (nautilus_font_factory_initialize),
(nautilus_font_factory_initialize_class), (font_hash_node_alloc),
(font_hash_node_free), (font_hash_node_lookup),
(font_hash_node_lookup_with_insertion),
(nautilus_font_factory_get_font_by_family),
(nautilus_font_factory_get_font_from_preferences),
(nautilus_font_factory_get_fallback_font), (make_font_name_string):
* libnautilus-extensions/nautilus-font-factory.h:
New class to obtain fonts either by family or from preferences. A
specific size can be requested.
Right now its a pretty dumb class, but it can be enhanced to do
smart things like looking at gtkstyles and/or smarted choosing of
fonts if the specifically requested size is not avialable.
* components/hardware/nautilus-hardware-view.c: (setup_form_title):
* components/music/nautilus-music-view.c:
(nautilus_music_view_initialize):
* components/rpmview/nautilus-rpm-view.c:
(nautilus_rpm_view_initialize):
* components/services/startup/nautilus-view/nautilus-service-startup-view.c:
(setup_form_title):
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-icon-container.c:
(nautilus_icon_container_initialize):
* src/nautilus-property-browser.c:
(nautilus_property_browser_initialize):
* src/nautilus-sidebar-title.c: (nautilus_index_title_update_info):
Unhardcode xlfd font strings in all of these and use the font
factory instead.
2000-06-02 Pavel Cisler <pavel@eazel.com>
* src/file-manager/fm-list-view.c: (fm_list_handle_dropped_icons):
......
......@@ -35,8 +35,9 @@
#include <libnautilus/libnautilus.h>
#include <libnautilus-extensions/nautilus-background.h>
#include <libnautilus-extensions/nautilus-directory-background.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
......@@ -276,7 +277,8 @@ setup_form_title (NautilusHardwareView *view, const char* image_name, const char
GtkWidget *temp_widget;
char *file_name;
GtkWidget *temp_container = gtk_hbox_new(FALSE, 0);
GdkFont *font;
gtk_box_pack_start (GTK_BOX(view->details->form), temp_container, 0, 0, 4);
gtk_widget_show(temp_container);
......@@ -289,9 +291,12 @@ setup_form_title (NautilusHardwareView *view, const char* image_name, const char
}
temp_widget = gtk_label_new (title_text);
/* FIXME bugzilla.eazel.com 667: don't use hardwired font like this */
nautilus_gtk_widget_set_font_by_name (temp_widget,
"-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*"); ;
font = nautilus_font_factory_get_font_from_preferences (18);
nautilus_gtk_widget_set_font (temp_widget, font);
gdk_font_unref (font);
gtk_box_pack_start (GTK_BOX (temp_container), temp_widget, 0, 0, 8);
gtk_widget_show (temp_widget);
}
......
......@@ -46,6 +46,7 @@
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtksignal.h>
#include <gnome.h>
......@@ -195,6 +196,7 @@ nautilus_music_view_initialize (NautilusMusicView *music_view)
{
GtkWidget *scrollwindow;
char *titles[] = {_("Track "), _("Title"), _("Artist"), _("Year"), _("Bitrate "), _("Time "), _("Album"), _("Comment"),};
GdkFont *font;
music_view->details = g_new0 (NautilusMusicViewDetails, 1);
......@@ -219,9 +221,10 @@ nautilus_music_view_initialize (NautilusMusicView *music_view)
/* allocate a widget for the album title */
music_view->details->album_title = gtk_label_new (_("Album Title"));
/* FIXME bugzilla.eazel.com 667: don't use hardwired font like this */
nautilus_gtk_widget_set_font_by_name (music_view->details->album_title,
"-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*"); ;
font = nautilus_font_factory_get_font_from_preferences (18);
nautilus_gtk_widget_set_font (music_view->details->album_title, font);
gtk_box_pack_start (GTK_BOX (music_view->details->album_container), music_view->details->album_title, FALSE, FALSE, 0);
gtk_widget_show (music_view->details->album_title);
......
......@@ -43,6 +43,7 @@
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtksignal.h>
#include <gnome.h>
......@@ -136,6 +137,7 @@ nautilus_rpm_view_initialize (NautilusRPMView *rpm_view)
GtkWidget *temp_box, *temp_title_box, *temp_widget;
GtkTable *table;
static gchar *list_headers[] = { N_("Package Contents") };
GdkFont *font;
rpm_view->details = g_new0 (NautilusRPMViewDetails, 1);
......@@ -176,9 +178,11 @@ nautilus_rpm_view_initialize (NautilusRPMView *rpm_view)
/* allocate the name field */
rpm_view->details->package_title = gtk_label_new (_("Package Title"));
/* FIXME bugzilla.eazel.com 667: don't use hardwired font like this */
nautilus_gtk_widget_set_font_by_name (rpm_view->details->package_title,
"-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
font = nautilus_font_factory_get_font_from_preferences (18);
nautilus_gtk_widget_set_font (rpm_view->details->package_title, font);
gdk_font_unref (font);
gtk_box_pack_start (GTK_BOX (temp_title_box), rpm_view->details->package_title, 0, 0, 0);
gtk_widget_show (rpm_view->details->package_title);
......
......@@ -38,6 +38,7 @@
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <stdio.h>
#include "nautilus-service-startup-view.h"
......@@ -469,6 +470,7 @@ setup_form_title (NautilusServicesContentView* view,
GtkWidget* temp_widget;
char* file_name;
GtkWidget* temp_container;
GdkFont *font;
temp_container = gtk_hbox_new (FALSE, 0);
......@@ -482,9 +484,11 @@ setup_form_title (NautilusServicesContentView* view,
g_free (file_name);
view->details->form_title = gtk_label_new (title_text);
/* FIXME bugzilla.eazel.com 667: don't use hardwired font like this */
nautilus_gtk_widget_set_font_by_name (view->details->form_title,
"-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*"); ;
font = nautilus_font_factory_get_font_from_preferences (18);
nautilus_gtk_widget_set_font (view->details->form_title, font);
gdk_font_unref (font);
gtk_box_pack_start (GTK_BOX (temp_container), view->details->form_title, 0, 0, 8);
gtk_widget_show (view->details->form_title);
}
......
......@@ -55,6 +55,7 @@ libnautilus_extensionsinclude_HEADERS= \
nautilus-gtk-macros.h \
nautilus-icon-container.h \
nautilus-icon-factory.h \
nautilus-font-factory.h \
nautilus-icon-text-item.h \
nautilus-keep-last-vertical-box.h \
nautilus-link.h \
......@@ -109,6 +110,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-drag.c \
nautilus-icon-dnd.c \
nautilus-icon-factory.c \
nautilus-font-factory.c \
nautilus-icon-grid.c \
nautilus-icon-text-item.c \
nautilus-keep-last-vertical-box.c \
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-font-factory.c: Class for obtaining fonts.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-font-factory.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-string.h"
#include "nautilus-global-preferences.h"
#include <unistd.h>
#include <pthread.h>
/* The font factory */
typedef struct {
GtkObject object;
GHashTable *fonts;
} NautilusFontFactory;
typedef struct {
GtkObjectClass parent_class;
} NautilusFontFactoryClass;
/* FontHashNode */
typedef struct {
char *name;
GdkFont *font;
} FontHashNode;
static GtkType nautilus_font_factory_get_type (void);
static void nautilus_font_factory_initialize_class (NautilusFontFactoryClass *class);
static void nautilus_font_factory_initialize (NautilusFontFactory *factory);
static NautilusFontFactory *nautilus_get_current_font_factory (void);
static NautilusFontFactory *nautilus_font_factory_new (void);
static char * make_font_name_string (const char *foundry,
const char *familiy,
const char *weight,
const char *slant,
const char *set_width,
const char *add_style,
guint size_in_pixels);
static FontHashNode * font_hash_node_alloc (const char *name);
static FontHashNode * font_hash_node_lookup (const char *name);
static FontHashNode * font_hash_node_lookup_with_insertion (const char *name);
#if 0
static void font_hash_node_free (FontHashNode *node);
#endif
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusFontFactory, nautilus_font_factory, GTK_TYPE_OBJECT)
/* Return a pointer to the single global font factory. */
static NautilusFontFactory *
nautilus_get_current_font_factory (void)
{
static NautilusFontFactory *global_font_factory = NULL;
if (global_font_factory == NULL) {
global_font_factory = nautilus_font_factory_new ();
}
return global_font_factory;
}
GtkObject *
nautilus_font_factory_get (void)
{
return GTK_OBJECT (nautilus_get_current_font_factory ());
}
/* Create the font factory. */
static NautilusFontFactory *
nautilus_font_factory_new (void)
{
NautilusFontFactory *factory;
factory = (NautilusFontFactory *) gtk_object_new (nautilus_font_factory_get_type (), NULL);
return factory;
}
static void
nautilus_font_factory_initialize (NautilusFontFactory *factory)
{
factory->fonts = g_hash_table_new (g_str_hash, g_str_equal);
}
static void
nautilus_font_factory_initialize_class (NautilusFontFactoryClass *class)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (class);
}
static FontHashNode *
font_hash_node_alloc (const char *name)
{
FontHashNode * node;
g_assert (name != NULL);
node = g_new (FontHashNode, 1);
node->name = g_strdup (name);
node->font = NULL;
return node;
}
#if 0
static void
font_hash_node_free (FontHashNode *node)
{
g_assert (node != NULL);
g_free (node->name);
g_free (node);
}
#endif
static FontHashNode *
font_hash_node_lookup (const char *name)
{
static NautilusFontFactory *factory;
gpointer hash_value;
g_assert (name != NULL);
factory = nautilus_get_current_font_factory ();
g_assert (factory != NULL);
hash_value = g_hash_table_lookup (factory->fonts, (gconstpointer) name);
return (FontHashNode *) hash_value;
}
static FontHashNode *
font_hash_node_lookup_with_insertion (const char *name)
{
static NautilusFontFactory *factory;
FontHashNode *node = NULL;
g_assert (name != NULL);
factory = nautilus_get_current_font_factory ();
g_assert (factory != NULL);
node = font_hash_node_lookup (name);
if (node == NULL) {
GdkFont *font;
font = gdk_font_load (name);
if (font != NULL) {
node = font_hash_node_alloc (name);
node->font = font;
gdk_font_ref (node->font);
g_hash_table_insert (factory->fonts, (gpointer) name, (gpointer) node);
}
}
return node;
}
static char *
make_font_name_string (const char *foundry,
const char *familiy,
const char *weight,
const char *slant,
const char *set_width,
const char *add_style,
guint size_in_pixels)
{
char *font_name;
const char *points = "*";
const char *hor_res = "*";
const char *ver_res = "*";
const char *spacing = "*";
const char *average_width = "*";
const char *char_set_registry = "*";
const char *char_set_encoding = "*";
/* +---------------------------------------------------- foundry
| +------------------------------------------------- family
| | +---------------------------------------------- weight
| | | +------------------------------------------- slant
| | | | +---------------------------------------- sel_width
| | | | | +------------------------------------- add-style
| | | | | | +---------------------------------- pixels
| | | | | | | +------------------------------- points
| | | | | | | | +---------------------------- hor_res
| | | | | | | | | +------------------------- ver_res
| | | | | | | | | | +---------------------- spacing
| | | | | | | | | | | +------------------- average_width
| | | | | | | | | | | | +---------------- char_set_registry
| | | | | | | | | | | | | +------------- char_set_encoding */
font_name = g_strdup_printf ("-%s-%s-%s-%s-%s-%s-%d-%s-%s-%s-%s-%s-%s-%s",
foundry,
familiy,
weight,
slant,
set_width,
add_style,
size_in_pixels,
points,
hor_res,
ver_res,
spacing,
average_width,
char_set_registry,
char_set_encoding);
return font_name;
}
/* Public functions */
GdkFont *
nautilus_font_factory_get_font_by_family (const char *family,
guint size_in_pixels)
{
static NautilusFontFactory *factory;
GdkFont *font = NULL;
FontHashNode *node;
char *font_name;
g_return_val_if_fail (family != NULL, NULL);
g_return_val_if_fail (size_in_pixels > 0, NULL);
factory = nautilus_get_current_font_factory ();
g_assert (factory != NULL);
font_name = make_font_name_string ("*",
family,
"medium",
"r",
"normal",
"*",
size_in_pixels);
g_assert (font_name != NULL);
node = font_hash_node_lookup_with_insertion (font_name);
if (node != NULL) {
g_assert (node->font);
font = node->font;
gdk_font_ref (font);
}
else {
font = nautilus_font_factory_get_fallback_font ();
}
g_free (font_name);
return font;
}
GdkFont *
nautilus_font_factory_get_font_from_preferences (guint size_in_pixels)
{
char *family;
GdkFont *font;
family = nautilus_preferences_get (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY, "helvectica");
font = nautilus_font_factory_get_font_by_family (family, size_in_pixels);
g_free (family);
return font;
}
GdkFont *
nautilus_font_factory_get_fallback_font (void)
{
static GdkFont *fixed_font;
if (fixed_font == NULL) {
fixed_font = gdk_font_load ("fixed");
g_assert (fixed_font != NULL);
gdk_font_ref (fixed_font);
}
return fixed_font;
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-font-factory.h: Class for obtaining fonts.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#ifndef NAUTILUS_FONT_FACTORY_H
#define NAUTILUS_FONT_FACTORY_H
#include <gdk/gdk.h>
#include <gtk/gtkobject.h>
/* A There's a single NautilusFontFactory object. */
GtkObject *nautilus_font_factory_get (void);
/* Get a font by familiy. */
GdkFont * nautilus_font_factory_get_font_by_family (const char *family,
guint size_in_pixels);
/* Get a font according to the family set in preferences. */
GdkFont * nautilus_font_factory_get_font_from_preferences (guint size_in_pixels);
/* Get the fallback font */
GdkFont * nautilus_font_factory_get_fallback_font (void);
#endif /* NAUTILUS_FONT_FACTORY_H */
......@@ -43,6 +43,7 @@
#include "nautilus-gtk-extensions.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-icon-text-item.h"
#include "nautilus-font-factory.h"
#include "nautilus-lib-self-check-functions.h"
......@@ -2404,20 +2405,6 @@ nautilus_icon_container_initialize_class (NautilusIconContainerClass *class)
stipple = gdk_bitmap_create_from_data (NULL, stipple_bits, 2, 2);
}
static GdkFont *
load_font (const char *name)
{
GdkFont *font;
/* FIXME bugzilla.eazel.com 40:
* Eventually we need a runtime check, but an assert is better than nothing.
*/
font = gdk_font_load (name);
g_assert (font != NULL);
return font;
}
/* Handler for the editing_started signal of an icon text item. We block the
* event handler so that it will not be called while the text is being edited.
*/
......@@ -2459,14 +2446,13 @@ nautilus_icon_container_initialize (NautilusIconContainer *container)
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
/* font table - this isn't exactly proportional, but it looks better than computed */
/* FIXME bugzilla.eazel.com 619: read font from metadata and/or preferences */
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = load_font ("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = load_font ("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = load_font ("-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = load_font ("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = load_font ("-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = load_font ("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = load_font ("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = nautilus_font_factory_get_font_from_preferences (8);
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = nautilus_font_factory_get_font_from_preferences (8);
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = nautilus_font_factory_get_font_from_preferences (10);
details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = nautilus_font_factory_get_font_from_preferences (12);
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = nautilus_font_factory_get_font_from_preferences (14);
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = nautilus_font_factory_get_font_from_preferences (18);
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = nautilus_font_factory_get_font_from_preferences (18);
container->details = details;
......
......@@ -55,6 +55,7 @@ libnautilus_extensionsinclude_HEADERS= \
nautilus-gtk-macros.h \
nautilus-icon-container.h \
nautilus-icon-factory.h \
nautilus-font-factory.h \
nautilus-icon-text-item.h \
nautilus-keep-last-vertical-box.h \
nautilus-link.h \
......@@ -109,6 +110,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-drag.c \
nautilus-icon-dnd.c \
nautilus-icon-factory.c \
nautilus-font-factory.c \
nautilus-icon-grid.c \
nautilus-icon-text-item.c \
nautilus-keep-last-vertical-box.c \
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-font-factory.c: Class for obtaining fonts.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-font-factory.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-string.h"
#include "nautilus-global-preferences.h"
#include <unistd.h>
#include <pthread.h>
/* The font factory */
typedef struct {
GtkObject object;
GHashTable *fonts;
} NautilusFontFactory;
typedef struct {
GtkObjectClass parent_class;
} NautilusFontFactoryClass;
/* FontHashNode */
typedef struct {
char *name;
GdkFont *font;
} FontHashNode;
static GtkType nautilus_font_factory_get_type (void);
static void nautilus_font_factory_initialize_class (NautilusFontFactoryClass *class);
static void nautilus_font_factory_initialize (NautilusFontFactory *factory);
static NautilusFontFactory *nautilus_get_current_font_factory (void);
static NautilusFontFactory *nautilus_font_factory_new (void);
static char * make_font_name_string (const char *foundry,
const char *familiy,
const char *weight,
const char *slant,
const char *set_width,
const char *add_style,
guint size_in_pixels);
static FontHashNode * font_hash_node_alloc (const char *name);
static FontHashNode * font_hash_node_lookup (const char *name);
static FontHashNode * font_hash_node_lookup_with_insertion (const char *name);
#if 0
static void font_hash_node_free (FontHashNode *node);
#endif
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusFontFactory, nautilus_font_factory, GTK_TYPE_OBJECT)
/* Return a pointer to the single global font factory. */
static NautilusFontFactory *
nautilus_get_current_font_factory (void)
{
static NautilusFontFactory *global_font_factory = NULL;
if (global_font_factory == NULL) {
global_font_factory = nautilus_font_factory_new ();
}
return global_font_factory;
}
GtkObject *
nautilus_font_factory_get (void)
{
return GTK_OBJECT (nautilus_get_current_font_factory ());
}