2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
27 * @file ewk_favicon_database.h
28 * @brief Describes the Ewk Favicon Database API.
31 #ifndef ewk_favicon_database_h
32 #define ewk_favicon_database_h
40 /** Creates a type name for @a Ewk_Favicon_Database. */
41 typedef struct Ewk_Favicon_Database Ewk_Favicon_Database;
44 * @typedef Ewk_Favicon_Database_Icon_Change_Cb Ewk_Favicon_Database_Icon_Change_Cb
45 * @brief Callback type for use with ewk_favicon_database_icon_change_callback_add and ewk_favicon_database_icon_change_callback_del
47 typedef void (*Ewk_Favicon_Database_Icon_Change_Cb)(const char *page_url, void *event_info);
50 * @typedef Ewk_Favicon_Database_Async_Icon_Get_Cb Ewk_Favicon_Database_Async_Icon_Get_Cb
51 * @brief Callback type for use with ewk_favicon_database_async_icon_get
53 * The @a icon may be NULL if there is no favicon associated to the given @a page_url.
55 * You need to call evas_object_ref() on the @a icon if you wish to keep it after the
56 * callback is executed.
58 typedef void (*Ewk_Favicon_Database_Async_Icon_Get_Cb)(const char *page_url, Evas_Object *icon, void *event_info);
61 * Retrieves from the database the favicon URL for the given @a page_url
63 * @param database database object to query
64 * @param page_url URL of the page to get the favicon URL for
66 * @return a newly allocated string guaranteed to be eina_stringshare
67 * or @c NULL in case of error or if the key does not exist.
68 * You need to call eina_stringshare_del() after use.
70 EAPI const char *ewk_favicon_database_icon_url_get(Ewk_Favicon_Database *database, const char *page_url);
73 * Retrieves asynchronously from the database the favicon for the given @a page_url
75 * @param database database object to query
76 * @param page_url URL of the page to get the favicon for
77 * @param evas The canvas to add the favicon to
78 * @param callback callback function to be called when the icon is retrieved
79 * @param data the data pointer that was to be passed to the callback
81 * @return @c EINA_TRUE if the icon was successfuly requested, @c EINA_FALSE otherwise
83 EAPI Eina_Bool ewk_favicon_database_async_icon_get(Ewk_Favicon_Database *database, const char *page_url, Evas *evas, Ewk_Favicon_Database_Async_Icon_Get_Cb callback, void *data);
86 * Add (register) a callback function to a icon change event
88 * @param database database object to register the callback
89 * @param callback callback function to be called when an icon changes
90 * @param data the data pointer that was to be passed to the callback
92 EAPI void ewk_favicon_database_icon_change_callback_add(Ewk_Favicon_Database *database, Ewk_Favicon_Database_Icon_Change_Cb callback, void *data);
95 * Delete (unregister) a callback function registered to a icon change event
97 * @param database database object to unregister the callback.
98 * @param callback callback function to unregister
100 EAPI void ewk_favicon_database_icon_change_callback_del(Ewk_Favicon_Database *database, Ewk_Favicon_Database_Icon_Change_Cb callback);
106 #endif // ewk_favicon_database_h