Helper function for computing path to thumbnail file

This commit is contained in:
Paweł Forysiuk 2011-03-19 19:13:47 +01:00 committed by Christian Dywan
parent 9c48997a26
commit a8ce104d86
2 changed files with 21 additions and 0 deletions

View file

@ -2184,3 +2184,21 @@ sokoke_widget_copy_clipboard (GtkWidget* widget,
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY); clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY);
gtk_clipboard_set_text (clipboard, text, -1); gtk_clipboard_set_text (clipboard, text, -1);
} }
gchar*
sokoke_build_thumbnail_path (const gchar* name)
{
gchar* path = NULL;
if (name != NULL)
{
gchar* checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, name, -1);
gchar* filename = g_strdup_printf ("%s.png", checksum);
path = g_build_filename (g_get_user_cache_dir (), "midori", "thumbnails",
filename, NULL);
g_free (filename);
g_free (checksum);
}
return path;
}

View file

@ -284,4 +284,7 @@ void
sokoke_widget_copy_clipboard (GtkWidget* widget, sokoke_widget_copy_clipboard (GtkWidget* widget,
const gchar* text); const gchar* text);
gchar*
sokoke_build_thumbnail_path (const gchar* name);
#endif /* !__SOKOKE_H__ */ #endif /* !__SOKOKE_H__ */