static void getFaviconCallback(GObject* sourceObject, GAsyncResult* result, void* data) { FaviconDatabaseTest* test = static_cast<FaviconDatabaseTest*>(data); WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(test->m_webContext); test->m_favicon = webkit_favicon_database_get_favicon_finish(database, result, &test->m_error.outPtr()); test->quitMainLoop(); }
static void icon_loaded_cb (GObject *source, GAsyncResult *result, gpointer user_data) { GtkTreeIter iter; GtkTreePath *path; IconLoadData *data = (IconLoadData *) user_data; WebKitFaviconDatabase *database = WEBKIT_FAVICON_DATABASE (source); GdkPixbuf *favicon = NULL; #ifdef HAVE_WEBKIT2 cairo_surface_t *icon_surface = webkit_favicon_database_get_favicon_finish (database, result, NULL); if (icon_surface) { favicon = ephy_pixbuf_get_from_surface_scaled (icon_surface, FAVICON_SIZE, FAVICON_SIZE); cairo_surface_destroy (icon_surface); } #else favicon = webkit_favicon_database_get_favicon_pixbuf_finish (database, result, NULL); #endif if (favicon) { /* The completion model might have changed its contents */ if (gtk_tree_row_reference_valid (data->row_reference)) { path = gtk_tree_row_reference_get_path (data->row_reference); gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); gtk_list_store_set (data->model, &iter, EPHY_COMPLETION_FAVICON_COL, favicon, -1); g_object_unref (favicon); gtk_tree_path_free (path); } } g_object_unref (data->model); gtk_tree_row_reference_free (data->row_reference); g_slice_free (IconLoadData, data); }