gtk-demo: Turn world map path into a resource

The C string literal way way too long for MSVC.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
This commit is contained in:
Sergey Bugaev 2023-08-16 14:35:35 +03:00
parent cc93347fe6
commit 122176a3a1
4 changed files with 8 additions and 8 deletions

View File

@ -424,7 +424,7 @@
</gresource>
<gresource prefix="/path_walk">
<file>path_walk.ui</file>
<file>path_world.c</file>
<file compressed="true">path_world.txt</file>
</gresource>
<gresource prefix="/org/gtk/Demo4">
<file>icons/16x16/actions/application-exit.png</file>

View File

@ -9,8 +9,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "path_world.c"
#define GTK_TYPE_PATH_WALK (gtk_path_walk_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWalk, gtk_path_walk, GTK, PATH_WALK, GtkWidget)
@ -179,7 +177,12 @@ gtk_path_walk_class_init (GtkPathWalkClass *klass)
static void
gtk_path_walk_init (GtkPathWalk *self)
{
GskPath *path = gsk_path_parse (path_world);
/* Data taken from
* https://commons.wikimedia.org/wiki/Maps_of_the_world#/media/File:Simplified_blank_world_map_without_Antartica_(no_borders).svg
*/
GBytes *data = g_resources_lookup_data ("/path_walk/path_world.txt", 0, NULL);
GskPath *path = gsk_path_parse (g_bytes_get_data (data, NULL));
g_bytes_unref (data);
gtk_path_walk_set_path (self, path);
gsk_path_unref (path);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long