app, pdb: minor cleanup in the new font loading code

This commit is contained in:
Michael Natterer 2016-04-17 21:06:00 +01:00
parent a75fa755f4
commit 29f55a95ef
7 changed files with 20 additions and 23 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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@gimp.org>",
"Sven Neumann",
"2003",

View File

@ -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)
{

View File

@ -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__ */

View File

@ -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.
**/

View File

@ -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
);