[bijiben] NoteIcon : rather use png suffix on file names
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] NoteIcon : rather use png suffix on file names
- Date: Thu, 6 Dec 2012 20:22:04 +0000 (UTC)
commit 5a42310e1269a513c0c98bb2c3e3ddd827f31192
Author: Pierre-Yves Luyten <py luyten fr>
Date: Thu Dec 6 21:20:53 2012 +0100
NoteIcon : rather use png suffix on file names
src/libbiji/deserializer/biji-lazy-deserializer.c | 12 ++++++++++--
src/libbiji/serializer/biji-lazy-serializer.c | 11 ++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/libbiji/deserializer/biji-lazy-deserializer.c b/src/libbiji/deserializer/biji-lazy-deserializer.c
index f20752b..d2228c3 100644
--- a/src/libbiji/deserializer/biji-lazy-deserializer.c
+++ b/src/libbiji/deserializer/biji-lazy-deserializer.c
@@ -704,15 +704,21 @@ biji_lazy_deserializer_new (BijiNoteObj *note)
static void
biji_note_obj_load_icon (BijiNoteObj *note)
{
- gchar *filename;
+ gchar *uuid, *basename, *filename;
GdkPixbuf *retval;
GError *error = NULL;
+ uuid = biji_note_obj_get_uuid (note);
+ basename = biji_str_mass_replace (uuid, ".note", ".png", NULL);
+
filename = g_build_filename (g_get_user_cache_dir (),
g_get_application_name (),
- biji_note_obj_get_uuid (note),
+ basename,
NULL);
+ g_free (uuid);
+ g_free (basename);
+
retval = gdk_pixbuf_new_from_file (filename, &error);
if (error)
{
@@ -724,6 +730,8 @@ biji_note_obj_load_icon (BijiNoteObj *note)
{
biji_note_obj_set_icon (note, retval);
}
+
+ g_free (filename);
}
gboolean
diff --git a/src/libbiji/serializer/biji-lazy-serializer.c b/src/libbiji/serializer/biji-lazy-serializer.c
index 70e9345..ed6dd0a 100644
--- a/src/libbiji/serializer/biji-lazy-serializer.c
+++ b/src/libbiji/serializer/biji-lazy-serializer.c
@@ -416,9 +416,10 @@ biji_lazy_serialize_internal (BijiLazySerializer *self)
static void
biji_note_obj_save_icon (BijiNoteObj *note)
{
- gchar *filename;
+ gchar *uuid, *basename, *filename;
GFile *directory;
GError *error = NULL;
+ GdkPixbuf *icon;
/* First ensure the dir exists */
filename = g_build_filename (g_get_user_cache_dir (),
@@ -428,11 +429,15 @@ biji_note_obj_save_icon (BijiNoteObj *note)
g_file_make_directory (directory, NULL, NULL);
/* Png */
- GdkPixbuf *icon = biji_note_obj_get_icon (note);
+ uuid = biji_note_obj_get_uuid (note);
+ basename = biji_str_mass_replace (uuid, ".note", ".png", NULL);
+ icon = biji_note_obj_get_icon (note);
filename = g_build_filename (g_get_user_cache_dir (),
g_get_application_name (),
- biji_note_obj_get_uuid (note),
+ basename,
NULL);
+ g_free (uuid);
+ g_free (basename);
gdk_pixbuf_save (icon, filename, "png", &error, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]