From 77024d3b82d200bfdc5186129b806c97ef954604 Mon Sep 17 00:00:00 2001 From: riccardom Date: Wed, 12 May 2010 16:02:08 +0000 Subject: [PATCH] On glib > 2.14 save screenshots on XDG specified dir for pictures. --- desmume/src/gtk/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 3555b328a..305d43a4e 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -1594,7 +1594,7 @@ static void ToggleLayerVisibility(GtkToggleAction* action, gpointer data) static void Printscreen() { GdkPixbuf *screenshot; - gchar *filename; + gchar *filename, *filen; GError *error = NULL; u8 *rgb; static int seq = 0; @@ -1623,7 +1623,13 @@ static void Printscreen() NULL, NULL); - filename = g_strdup_printf("./desmume-screenshot-%d.png", seq); + filen = g_strdup_printf("desmume-screenshot-%d.png", seq); +#if GLIB_CHECK_VERSION(2,14,0) + filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_PICTURES), filen, NULL); +#else + filename = g_build_filename("./", filen, NULL); +#endif + gdk_pixbuf_save(screenshot, filename, "png", &error, NULL); if (error) { g_error_free (error); @@ -1635,6 +1641,7 @@ static void Printscreen() free(rgb); g_object_unref(screenshot); g_free(filename); + g_free(filen); } #ifdef DESMUME_GTK_FIRMWARE_BROKEN