[gimp] app: output proper info message while fonts are loading.



commit cfaa3103e71193c80a5c5b578a506cba4e7d8bd2
Author: Jehan <jehan girinstud io>
Date:   Sun May 27 03:42:43 2018 +0200

    app: output proper info message while fonts are loading.
    
    To this effect, I add a variable to differentiate the "no-fonts on the
    system" case from "fonts still loading".

 app/core/gimp.h          |  1 +
 app/text/gimp-fonts.c    | 12 ++++++++----
 app/text/gimptextlayer.c |  9 ++++++++-
 3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimp.h b/app/core/gimp.h
index c5fc6e207e..b1a9c9d0d1 100644
--- a/app/core/gimp.h
+++ b/app/core/gimp.h
@@ -95,6 +95,7 @@ struct _Gimp
   GimpContainer          *named_buffers;
 
   GimpContainer          *fonts;
+  gboolean                fonts_loading;
 
   GimpDataFactory        *brush_factory;
   GimpDataFactory        *dynamics_factory;
diff --git a/app/text/gimp-fonts.c b/app/text/gimp-fonts.c
index f30507a148..4e1e2b702f 100644
--- a/app/text/gimp-fonts.c
+++ b/app/text/gimp-fonts.c
@@ -111,11 +111,14 @@ gimp_fonts_load_async (GimpAsync *async,
 }
 
 static void
-gimp_fonts_load_async_callback (GimpAsync    *async,
-                                GimpFontList *fonts)
+gimp_fonts_load_async_callback (GimpAsync *async,
+                                Gimp      *gimp)
 {
   if (gimp_async_is_finished (async))
-    gimp_font_list_restore (fonts);
+    {
+      gimp_font_list_restore (GIMP_FONT_LIST (gimp->fonts));
+      gimp->fonts_loading = FALSE;
+    }
 }
 
 void
@@ -155,6 +158,7 @@ gimp_fonts_load (Gimp    *gimp,
   gimp_fonts_add_directories (gimp, config, path, error);
   g_list_free_full (path, (GDestroyNotify) g_object_unref);
 
+  gimp->fonts_loading = TRUE;
   /* We perform font cache initialization in a separate thread, so
    * in the case a cache rebuild is to be done it will not block
    * the UI.
@@ -163,7 +167,7 @@ gimp_fonts_load (Gimp    *gimp,
                                    config);
   gimp_async_add_callback (async,
                            (GimpAsyncCallback) gimp_fonts_load_async_callback,
-                           gimp->fonts);
+                           gimp);
   g_object_unref (async);
 
  cleanup:
diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c
index 7a7d98b6c3..2ac00fb3f0 100644
--- a/app/text/gimptextlayer.c
+++ b/app/text/gimptextlayer.c
@@ -628,7 +628,14 @@ gimp_text_layer_render (GimpTextLayer *layer)
   item     = GIMP_ITEM (layer);
   image    = gimp_item_get_image (item);
 
-  if (gimp_container_is_empty (image->gimp->fonts))
+  if (image->gimp->fonts_loading)
+    {
+      gimp_message_literal (image->gimp, NULL, GIMP_MESSAGE_ERROR,
+                            _("Fonts are still loading (this may take a while), "
+                              "text functionality is not available yet."));
+      return FALSE;
+    }
+  else if (gimp_container_is_empty (image->gimp->fonts))
     {
       gimp_message_literal (image->gimp, NULL, GIMP_MESSAGE_ERROR,
                             _("Due to lack of any fonts, "


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