]> spindle.queued.net Git - midori/commitdiff
Helper function for computing path to thumbnail file
authorPaweł Forysiuk <tuxator@o2.pl>
Sat, 19 Mar 2011 18:13:47 +0000 (19:13 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 22 Mar 2011 22:01:59 +0000 (23:01 +0100)
midori/sokoke.c
midori/sokoke.h

index 7bb38b127e256530118d8cb563d9e4b484b35333..8b3bd144a0220f687cf95cda94d631e467cb97d1 100644 (file)
@@ -2184,3 +2184,21 @@ sokoke_widget_copy_clipboard (GtkWidget*   widget,
     clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY);
     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;
+}
index 881378613acf2d0ce6c66b85763b4a1ce9feaf0d..e76a914fc9b2251ca745ce498c8c8c192adb7740 100644 (file)
@@ -284,4 +284,7 @@ void
 sokoke_widget_copy_clipboard (GtkWidget*   widget,
                               const gchar* text);
 
+gchar*
+sokoke_build_thumbnail_path (const gchar* name);
+
 #endif /* !__SOKOKE_H__ */