[gimp/wip/Jehan/fix-CI-2021-07-06: 2/5] Revert "libgimpwidgets: fix meson/mingw-w64 build and relocatable builds."




commit 0d4e8d718865ffb73ea90bec260e7fd2d07f373a
Author: Jehan <jehan girinstud io>
Date:   Tue Jul 6 16:58:37 2021 +0200

    Revert "libgimpwidgets: fix meson/mingw-w64 build and relocatable builds."
    
    This reverts commit 8025962a20ae970c8b285ad882abcfa7b68946c2.

 libgimpwidgets/Makefile.am           |  2 +-
 libgimpwidgets/gimpwidgets-private.c | 56 ++++++++++++------------------------
 libgimpwidgets/meson.build           |  4 ++-
 3 files changed, 22 insertions(+), 40 deletions(-)
---
diff --git a/libgimpwidgets/Makefile.am b/libgimpwidgets/Makefile.am
index 2e99f00721..d1a7726edd 100644
--- a/libgimpwidgets/Makefile.am
+++ b/libgimpwidgets/Makefile.am
@@ -56,7 +56,7 @@ libgimpwidgetsincludedir = $(includedir)/gimp-$(GIMP_API_VERSION)/libgimpwidgets
 AM_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"LibGimpWidgets\"       \
        -DGIMP_WIDGETS_COMPILATION              \
-       -DDATAROOTDIR=\""$(datarootdir)"\"      \
+       -DDATADIR=\""$(datadir)"\"              \
        -I$(top_srcdir)                         \
        $(GEGL_CFLAGS)                          \
        $(GTK_CFLAGS)                           \
diff --git a/libgimpwidgets/gimpwidgets-private.c b/libgimpwidgets/gimpwidgets-private.c
index f435c35b34..83c46b6e90 100644
--- a/libgimpwidgets/gimpwidgets-private.c
+++ b/libgimpwidgets/gimpwidgets-private.c
@@ -65,9 +65,8 @@ gimp_widgets_init (GimpHelpFunc          standard_help_func,
                    GimpGetColorFunc      get_background_func,
                    GimpEnsureModulesFunc ensure_modules_func)
 {
+  const gchar *svg_icon = DATADIR "/icons/hicolor/scalable/apps/gimp.svg";
   GList       *icons = NULL;
-  gchar       *base_dir;
-  gchar       *path;
   GdkPixbuf   *pixbuf;
 
   g_return_if_fail (standard_help_func != NULL);
@@ -84,12 +83,6 @@ gimp_widgets_init (GimpHelpFunc          standard_help_func,
 
   gimp_icons_init ();
 
-#ifdef ENABLE_RELOCATABLE_RESOURCES
-  base_dir = g_build_filename (gimp_installation_directory (), "share", "icons", "hicolor", NULL);
-#else
-  base_dir = g_build_filename (DATAROOTDIR, "icons", "hicolor", NULL);
-#endif
-
   /* Loading the application icons. Unfortunately GTK doesn't know how
    * to load any size from a single SVG, so we have to generate common
    * sizes ourselves.
@@ -97,40 +90,31 @@ gimp_widgets_init (GimpHelpFunc          standard_help_func,
    * then the application icon is dependant to the theme and for now at
    * least, we want the installed icon.
    */
-  path   = g_build_filename (base_dir, "16x16/apps/gimp.png", NULL);
-  pixbuf = gdk_pixbuf_new_from_file (DATAROOTDIR "/icons/hicolor/16x16/apps/gimp.png", NULL);
+  pixbuf = gdk_pixbuf_new_from_file (DATADIR "/icons/hicolor/16x16/apps/gimp.png", NULL);
   if (pixbuf)
     icons = g_list_prepend (icons, pixbuf);
   else
-    g_warning ("Application icon missing: %s", path);
-  g_free (path);
+    g_warning ("Application icon missing: %s", DATADIR "/icons/hicolor/16x16/apps/gimp.png");
 
-  path   = g_build_filename (base_dir, "32x32/apps/gimp.png", NULL);
-  pixbuf = gdk_pixbuf_new_from_file (DATAROOTDIR "/icons/hicolor/32x32/apps/gimp.png", NULL);
+  pixbuf = gdk_pixbuf_new_from_file (DATADIR "/icons/hicolor/32x32/apps/gimp.png", NULL);
   if (pixbuf)
     icons = g_list_prepend (icons, pixbuf);
   else
-    g_warning ("Application icon missing: %s", path);
-  g_free (path);
+    g_warning ("Application icon missing: %s", DATADIR "/icons/hicolor/32x32/apps/gimp.png");
 
-  path   = g_build_filename (base_dir, "48x48/apps/gimp.png", NULL);
-  pixbuf = gdk_pixbuf_new_from_file (DATAROOTDIR "/icons/hicolor/48x48/apps/gimp.png", NULL);
+  pixbuf = gdk_pixbuf_new_from_file (DATADIR "/icons/hicolor/48x48/apps/gimp.png", NULL);
   if (pixbuf)
     icons = g_list_prepend (icons, pixbuf);
   else
-    g_warning ("Application icon missing: %s", path);
-  g_free (path);
+    g_warning ("Application icon missing: %s", DATADIR "/icons/hicolor/48x48/apps/gimp.png");
 
-  path   = g_build_filename (base_dir, "64x64/apps/gimp.png", NULL);
-  pixbuf = gdk_pixbuf_new_from_file (DATAROOTDIR "/icons/hicolor/64x64/apps/gimp.png", NULL);
+  pixbuf = gdk_pixbuf_new_from_file (DATADIR "/icons/hicolor/64x64/apps/gimp.png", NULL);
   if (pixbuf)
     icons = g_list_prepend (icons, pixbuf);
   else
-    g_warning ("Application icon missing: %s", path);
-  g_free (path);
+    g_warning ("Application icon missing: %s", DATADIR "/icons/hicolor/64x64/apps/gimp.png");
 
-  path   = g_build_filename (base_dir, "scalable/apps/gimp.svg", NULL);
-  pixbuf = gdk_pixbuf_new_from_file_at_size (path, 128, 128, NULL);
+  pixbuf = gdk_pixbuf_new_from_file_at_size (svg_icon, 128, 128, NULL);
   if (pixbuf)
     {
       /* Various common sizes from the same SVG. Why I go into such
@@ -140,34 +124,31 @@ gimp_widgets_init (GimpHelpFunc          standard_help_func,
        */
       icons = g_list_prepend (icons, pixbuf);
 
-      pixbuf = gdk_pixbuf_new_from_file_at_size (path, 144, 144, NULL);
+      pixbuf = gdk_pixbuf_new_from_file_at_size (svg_icon, 144, 144, NULL);
       icons = g_list_prepend (icons, pixbuf);
 
-      pixbuf = gdk_pixbuf_new_from_file_at_size (path, 160, 160, NULL);
+      pixbuf = gdk_pixbuf_new_from_file_at_size (svg_icon, 160, 160, NULL);
       icons = g_list_prepend (icons, pixbuf);
 
-      pixbuf = gdk_pixbuf_new_from_file_at_size (path, 176, 176, NULL);
+      pixbuf = gdk_pixbuf_new_from_file_at_size (svg_icon, 176, 176, NULL);
       icons = g_list_prepend (icons, pixbuf);
 
-      pixbuf = gdk_pixbuf_new_from_file_at_size (path, 192, 192, NULL);
+      pixbuf = gdk_pixbuf_new_from_file_at_size (svg_icon, 192, 192, NULL);
       icons = g_list_prepend (icons, pixbuf);
 
-      pixbuf = gdk_pixbuf_new_from_file_at_size (path, 224, 224, NULL);
+      pixbuf = gdk_pixbuf_new_from_file_at_size (svg_icon, 224, 224, NULL);
       icons = g_list_prepend (icons, pixbuf);
     }
   else
     {
-      g_warning ("Application icon missing: %s", path);
+      g_warning ("Application icon missing: %s", svg_icon);
     }
-  g_free (path);
 
-  path   = g_build_filename (base_dir, "256x256/apps/gimp.png", NULL);
-  pixbuf = gdk_pixbuf_new_from_file (DATAROOTDIR "/icons/hicolor/256x256/apps/gimp.png", NULL);
+  pixbuf = gdk_pixbuf_new_from_file (DATADIR "/icons/hicolor/256x256/apps/gimp.png", NULL);
   if (pixbuf)
     icons = g_list_prepend (icons, pixbuf);
   else
-    g_warning ("Application icon missing: %s", path);
-  g_free (path);
+    g_warning ("Application icon missing: %s", DATADIR "/icons/hicolor/256x256/apps/gimp.png");
 
   gtk_window_set_default_icon_list (icons);
   g_list_free_full (icons, g_object_unref);
@@ -175,7 +156,6 @@ gimp_widgets_init (GimpHelpFunc          standard_help_func,
   gimp_widgets_init_foreign_enums ();
 
   gimp_widgets_initialized = TRUE;
-  g_free (base_dir);
 }
 
 /* clean up babl (in particular, so that the fish cache is constructed) if the
diff --git a/libgimpwidgets/meson.build b/libgimpwidgets/meson.build
index 488ce7ad5f..3cf15959c8 100644
--- a/libgimpwidgets/meson.build
+++ b/libgimpwidgets/meson.build
@@ -189,7 +189,9 @@ libgimpwidgets = library('gimpwidgets-'+ gimp_api_version,
   dependencies: [
     gegl, gtk3, lcms, math
   ],
-  c_args: [ '-DG_LOG_DOMAIN="LibGimpWidgets"', '-DGIMP_WIDGETS_COMPILATION', ],
+  c_args: [ '-DG_LOG_DOMAIN="LibGimpWidgets"', '-DGIMP_WIDGETS_COMPILATION',
+            '-DDATADIR="@0@"'.format(prefix / get_option('datadir')),
+  ],
   link_with: [
     libgimpbase,
     libgimpcolor,


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