From 29f55a95efad74f6df2ae4f2e933a85b2899b601 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 17 Apr 2016 21:06:00 +0100 Subject: [PATCH] app, pdb: minor cleanup in the new font loading code --- app/actions/fonts-commands.c | 2 +- app/core/gimp.c | 2 +- app/pdb/fonts-cmds.c | 4 ++-- app/text/gimp-fonts.c | 18 +++++++----------- app/text/gimp-fonts.h | 9 ++++----- libgimp/gimpfonts_pdb.c | 3 ++- tools/pdbgen/pdb/fonts.pdb | 5 +++-- 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/app/actions/fonts-commands.c b/app/actions/fonts-commands.c index c0d33be2b1..713327e993 100644 --- a/app/actions/fonts-commands.c +++ b/app/actions/fonts-commands.c @@ -43,5 +43,5 @@ fonts_refresh_cmd_callback (GtkAction *action, GimpContext *context = action_data_get_context (data); if (context) - gimp_fonts_load (context->gimp); + gimp_fonts_load (context->gimp, NULL); } diff --git a/app/core/gimp.c b/app/core/gimp.c index 86c4090b1d..08d4d71643 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -1119,7 +1119,7 @@ gimp_restore (Gimp *gimp, /* initialize the list of fonts */ status_callback (NULL, _("Fonts (this may take a while)"), 0.6); if (! gimp->no_fonts) - gimp_fonts_load_with_status (gimp, status_callback); + gimp_fonts_load (gimp, status_callback); /* initialize the color history */ gimp_palettes_load (gimp); diff --git a/app/pdb/fonts-cmds.c b/app/pdb/fonts-cmds.c index d07d245f4b..e9aed2c069 100644 --- a/app/pdb/fonts-cmds.c +++ b/app/pdb/fonts-cmds.c @@ -46,7 +46,7 @@ fonts_refresh_invoker (GimpProcedure *procedure, const GimpValueArray *args, GError **error) { - gimp_fonts_load (gimp); + gimp_fonts_load (gimp, NULL); return gimp_procedure_get_return_values (procedure, TRUE, NULL); } @@ -99,7 +99,7 @@ register_fonts_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-fonts-refresh", "Refresh current fonts. This function always succeeds.", - "This procedure retrieves all fonts currently in the user's font path and updates the font dialogs accordingly.", + "This procedure retrieves all fonts currently in the user's font path and updates the font dialogs accordingly. Depending on the amount of fonts on the system, this can take considerable time.", "Sven Neumann ", "Sven Neumann", "2003", diff --git a/app/text/gimp-fonts.c b/app/text/gimp-fonts.c index 4e8ad764c8..5cb94075e6 100644 --- a/app/text/gimp-fonts.c +++ b/app/text/gimp-fonts.c @@ -89,8 +89,8 @@ gimp_fonts_load_thread (GimpFontsLoadFuncData *data) } void -gimp_fonts_load_with_status (Gimp *gimp, - GimpInitStatusFunc status_callback) +gimp_fonts_load (Gimp *gimp, + GimpInitStatusFunc status_callback) { FcConfig *config; GFile *fonts_conf; @@ -146,8 +146,8 @@ gimp_fonts_load_with_status (Gimp *gimp, g_mutex_lock (&data.mutex); end_time = g_get_monotonic_time () + 0.1 * G_TIME_SPAN_SECOND; - while (!data.caching_complete) - if (!g_cond_wait_until (&data.cond, &data.mutex, end_time)) + while (! data.caching_complete) + if (! g_cond_wait_until (&data.cond, &data.mutex, end_time)) { status_callback (NULL, NULL, 0.6); @@ -159,7 +159,9 @@ gimp_fonts_load_with_status (Gimp *gimp, g_thread_join (cache_thread); } else - gimp_fonts_load_func (config); + { + gimp_fonts_load_func (config); + } gimp_font_list_restore (GIMP_FONT_LIST (gimp->fonts)); @@ -168,12 +170,6 @@ gimp_fonts_load_with_status (Gimp *gimp, gimp_unset_busy (gimp); } -void -gimp_fonts_load (Gimp *gimp) -{ - gimp_fonts_load_with_status (gimp, NULL); -} - void gimp_fonts_reset (Gimp *gimp) { diff --git a/app/text/gimp-fonts.h b/app/text/gimp-fonts.h index 0169fc31f3..19cc154832 100644 --- a/app/text/gimp-fonts.h +++ b/app/text/gimp-fonts.h @@ -19,11 +19,10 @@ #define __GIMP_FONTS_H__ -void gimp_fonts_init (Gimp *gimp); -void gimp_fonts_load (Gimp *gimp); -void gimp_fonts_load_with_status (Gimp *gimp, - GimpInitStatusFunc status_callback); -void gimp_fonts_reset (Gimp *gimp); +void gimp_fonts_init (Gimp *gimp); +void gimp_fonts_load (Gimp *gimp, + GimpInitStatusFunc status_callback); +void gimp_fonts_reset (Gimp *gimp); #endif /* __GIMP_FONTS_H__ */ diff --git a/libgimp/gimpfonts_pdb.c b/libgimp/gimpfonts_pdb.c index 81e7a822ae..fcdd71fa0c 100644 --- a/libgimp/gimpfonts_pdb.c +++ b/libgimp/gimpfonts_pdb.c @@ -40,7 +40,8 @@ * Refresh current fonts. This function always succeeds. * * This procedure retrieves all fonts currently in the user's font path - * and updates the font dialogs accordingly. + * and updates the font dialogs accordingly. Depending on the amount of + * fonts on the system, this can take considerable time. * * Returns: TRUE on success. **/ diff --git a/tools/pdbgen/pdb/fonts.pdb b/tools/pdbgen/pdb/fonts.pdb index e4e77727a3..b3cad7139c 100644 --- a/tools/pdbgen/pdb/fonts.pdb +++ b/tools/pdbgen/pdb/fonts.pdb @@ -21,7 +21,8 @@ sub fonts_refresh { $help = <<'HELP'; This procedure retrieves all fonts currently in the user's font path -and updates the font dialogs accordingly. +and updates the font dialogs accordingly. Depending on the amount +of fonts on the system, this can take considerable time. HELP &neo_pdb_misc('2003'); @@ -29,7 +30,7 @@ HELP %invoke = ( code => <<'CODE' { - gimp_fonts_load (gimp); + gimp_fonts_load (gimp, NULL); } CODE );