summaryrefslogtreecommitdiff
path: root/gtk/tools/encodesymbolic.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-12-29 21:22:16 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-12-29 21:30:52 -0500
commit878b34fae3e43b342a2ceb23f873baa3a2bd5515 (patch)
tree9866a462a8edfeaeff40c790ec2581e1908d4a0c /gtk/tools/encodesymbolic.c
parent5fe433418d271acf06afc1538c3289b9e2ad4478 (diff)
downloadgtk+-encode-symbolic-debug.tar.gz
gtk4-encode-symbolic: Add debug outputencode-symbolic-debug
Add a --debug option that makes this tool produce some debug output that can be helpful in tracking down why symbolic svgs are broken.
Diffstat (limited to 'gtk/tools/encodesymbolic.c')
-rw-r--r--gtk/tools/encodesymbolic.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gtk/tools/encodesymbolic.c b/gtk/tools/encodesymbolic.c
index 3bca80100d..6f4a44f573 100644
--- a/gtk/tools/encodesymbolic.c
+++ b/gtk/tools/encodesymbolic.c
@@ -35,8 +35,11 @@
static char *output_dir = NULL;
+static gboolean debug;
+
static GOptionEntry args[] = {
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output_dir, N_("Output to this directory instead of cwd"), NULL },
+ { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Generate debug output") },
{ NULL }
};
@@ -65,7 +68,7 @@ main (int argc, char **argv)
g_set_prgname ("gtk-encode-symbolic-svg");
- context = g_option_context_new ("PATH WIDTHxHEIGHT");
+ context = g_option_context_new ("[OPTION…] PATH WIDTHxHEIGHT");
g_option_context_add_main_entries (context, args, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, NULL);
@@ -104,7 +107,9 @@ main (int argc, char **argv)
return 1;
}
- symbolic = gtk_make_symbolic_pixbuf_from_data (data, len, width, height, 1.0, &error);
+ basename = g_path_get_basename (path);
+
+ symbolic = gtk_make_symbolic_pixbuf_from_data (data, len, width, height, 1.0, debug ? basename : NULL, &error);
if (symbolic == NULL)
{
g_printerr (_("Can’t load file: %s\n"), error->message);
@@ -113,8 +118,6 @@ main (int argc, char **argv)
g_free (data);
- basename = g_path_get_basename (path);
-
dot = strrchr (basename, '.');
if (dot != NULL)
*dot = 0;