[PATCH 2/4] Allocate memory for and truncate strings that go into the title bar
Martin Gysel
me at bearsh.org
Thu Oct 18 02:11:27 PDT 2012
Am 17.10.2012 23:47, schrieb Lubomir I. Ivanov:
> could have been prettier if glib had something in the lines of
> g_utf8_snprintf().
> i'd be interested in improvements or alternatives. i can think of one
> but this is actually safer.
what's wrong with:
char* title:
basename = g_path_get_basename(existing_filename);
title = g_strdup_printf("Subsurface: %s", basename);
gtk_window_set_title(GTK_WINDOW(main_window), title);
free(basename);
free(title);
does it matter if any of these strings are utf8 or not? at the end they
are just a null-terminated char buffer and you are not relying on a
particular string (not char buffer) length in that very use case
/martin
More information about the subsurface
mailing list