0004-Remove-Gdk-dependency-from-gtk-encode-symbolic-svg.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. From 4d09ff324419fe4e671233044e424378da53969b Mon Sep 17 00:00:00 2001
  2. From: Jussi Kukkonen <jussi.kukkonen@intel.com>
  3. Date: Tue, 9 Jun 2015 14:20:30 +0300
  4. Subject: [PATCH] Remove Gdk-dependency from gtk-encode-symbolic-svg
  5. Building gtk-encode-symbolic-svg without building Gdk is useful
  6. as only the icon tools are needed on the native build: this makes
  7. native build much faster and requires much less dependencies.
  8. Upstream-Status: Pending
  9. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
  10. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  11. ---
  12. Patch status: taken from yocto, upstream pending
  13. gtk/encodesymbolic.c | 36 ++++++++++--------------------------
  14. 1 file changed, 10 insertions(+), 26 deletions(-)
  15. diff --git a/gtk/encodesymbolic.c b/gtk/encodesymbolic.c
  16. index 9f7d015..1f07563 100644
  17. --- a/gtk/encodesymbolic.c
  18. +++ b/gtk/encodesymbolic.c
  19. @@ -19,7 +19,6 @@
  20. #include <glib.h>
  21. #include <gdk-pixbuf/gdk-pixdata.h>
  22. -#include <gdk/gdk.h>
  23. #include <glib/gi18n.h>
  24. #ifdef HAVE_UNISTD_H
  25. @@ -43,30 +42,18 @@ static GdkPixbuf *
  26. load_symbolic_svg (char *file_data, gsize file_len,
  27. int width,
  28. int height,
  29. - const GdkRGBA *fg,
  30. - const GdkRGBA *success_color,
  31. - const GdkRGBA *warning_color,
  32. - const GdkRGBA *error_color,
  33. + const char *css_fg,
  34. + const char *css_success,
  35. + const char *css_warning,
  36. + const char *css_error,
  37. GError **error)
  38. {
  39. GInputStream *stream;
  40. GdkPixbuf *pixbuf;
  41. - gchar *css_fg;
  42. - gchar *css_success;
  43. - gchar *css_warning;
  44. - gchar *css_error;
  45. gchar *data;
  46. gchar *svg_width, *svg_height;
  47. gchar *escaped_file_data;
  48. - css_fg = gdk_rgba_to_string (fg);
  49. -
  50. - css_success = css_warning = css_error = NULL;
  51. -
  52. - css_warning = gdk_rgba_to_string (warning_color);
  53. - css_error = gdk_rgba_to_string (error_color);
  54. - css_success = gdk_rgba_to_string (success_color);
  55. -
  56. /* Fetch size from the original icon */
  57. stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
  58. pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error);
  59. @@ -105,10 +92,6 @@ load_symbolic_svg (char *file_data, gsize file_len,
  60. "</svg>",
  61. NULL);
  62. g_free (escaped_file_data);
  63. - g_free (css_fg);
  64. - g_free (css_warning);
  65. - g_free (css_error);
  66. - g_free (css_success);
  67. g_free (svg_width);
  68. g_free (svg_height);
  69. @@ -167,7 +150,8 @@ make_symbolic_pixbuf (char *file,
  70. GError **error)
  71. {
  72. - GdkRGBA r = { 1,0,0,1}, g = {0,1,0,1};
  73. + const char r[] = "rgba(255,0,0,1)";
  74. + const char g[] = "rgba(0,255,0,1)";
  75. GdkPixbuf *loaded;
  76. GdkPixbuf *pixbuf;
  77. int plane;
  78. @@ -196,10 +180,10 @@ make_symbolic_pixbuf (char *file,
  79. * the "rest", as all color fractions should add up to 1.
  80. */
  81. loaded = load_symbolic_svg (file_data, file_len, width, height,
  82. - &g,
  83. - plane == 0 ? &r : &g,
  84. - plane == 1 ? &r : &g,
  85. - plane == 2 ? &r : &g,
  86. + g,
  87. + plane == 0 ? r : g,
  88. + plane == 1 ? r : g,
  89. + plane == 2 ? r : g,
  90. error);
  91. if (loaded == NULL)
  92. return NULL;
  93. --
  94. 2.1.4