1 #ifndef GT_RESOURCE_DOWNLOADER_H 2 #define GT_RESOURCE_DOWNLOADER_H 3 4 #include <glib-object.h> 5 #include <gdk-pixbuf/gdk-pixbuf.h> 6 7 G_BEGIN_DECLS 8 9 #define GT_TYPE_RESOURCE_DOWNLOADER gt_resource_downloader_get_type() 10 11 #define GT_IMAGE_FILETYPE_JPEG "jpeg" 12 #define GT_IMAGE_FILETYPE_PNG "png" 13 14 typedef void (*ResourceDownloaderFunc)(GdkPixbuf* pixbuf, gpointer udata, GError* err); 15 16 G_DECLARE_FINAL_TYPE(GtResourceDownloader, gt_resource_downloader, GT, RESOURCE_DOWNLOADER, GObject); 17 18 struct _GtResourceDownloader 19 { 20 GObject parent_instance; 21 }; 22 23 GtResourceDownloader* gt_resource_downloader_new(); 24 GtResourceDownloader* gt_resource_downloader_new_with_cache(const gchar* filepath); 25 void gt_resource_downloader_set_image_filetype(GtResourceDownloader* self, const gchar* filetype); 26 GdkPixbuf* gt_resource_downloader_download_image(GtResourceDownloader* self, const gchar* uri, const gchar* name, GError** error); 27 void gt_resource_downloader_download_image_async(GtResourceDownloader* self, const gchar* uri, const gchar* name, GAsyncReadyCallback cb, GCancellable* cancel, gpointer udata); 28 GdkPixbuf* gt_resource_donwloader_download_image_finish(GtResourceDownloader* self, GAsyncResult* result, GError** error); 29 GdkPixbuf* gt_resource_downloader_download_image_immediately(GtResourceDownloader* self, const gchar* uri, const gchar* name, ResourceDownloaderFunc cb, gpointer udata, GError** error); 30 31 G_END_DECLS 32 33 #endif 34