NetSurf
|
Interface to gtk builtin resource handling. More...
Go to the source code of this file.
Functions | |
nserror | nsgtk_init_resources (char **respath) |
Initialise GTK resources handling. More... | |
GdkCursor * | nsgtk_create_menu_cursor (void) |
Creates a menu cursor from internal resources. More... | |
nserror | nsgtk_builder_new_from_resname (const char *resname, GtkBuilder **builder_out) |
Create gtk builder object for the named ui resource. More... | |
nserror | nsgdk_pixbuf_new_from_resname (const char *resname, GdkPixbuf **pixbuf_out) |
Create gdk pixbuf for the named ui resource. More... | |
nserror | nsgtk_data_from_resname (const char *resname, const uint8_t **data_out, size_t *data_size_out) |
Get direct pointer to resource data. More... | |
nserror | nsgtk_path_from_resname (const char *resname, const char **path_out) |
Get path to resource data. More... | |
Interface to gtk builtin resource handling.
This presents a unified interface to the rest of the codebase to obtain resources. Note this is not anything to do with the resource scheme handling beyond possibly providing the underlying data.
Definition in file resources.h.
nserror nsgdk_pixbuf_new_from_resname | ( | const char * | resname, |
GdkPixbuf ** | pixbuf_out | ||
) |
Create gdk pixbuf for the named ui resource.
This creates a pixbuf using an identifier name which is mapped to the ui_resource table which must be initialised with nsgtk_init_resources()
resname | The resource name to construct for |
pixbuf_out | The pixbuf result |
Definition at line 470 of file resources.c.
References find_resource_from_name(), nsgtk_resource_s::name, NSERROR_INIT_FAILED, NSERROR_NOT_FOUND, NSERROR_OK, NSGTK_RESOURCE_DIRECT, NSGTK_RESOURCE_FILE, NSGTK_RESOURCE_GLIB, NSGTK_RESOURCE_INLINE, NSLOG, nsgtk_resource_s::path, pixbuf_resource, and nsgtk_resource_s::type.
Referenced by add_builtin_icon(), nsgtk_create_menu_cursor(), nsgtk_setup(), and nsgtk_throbber_init().
nserror nsgtk_builder_new_from_resname | ( | const char * | resname, |
GtkBuilder ** | builder_out | ||
) |
Create gtk builder object for the named ui resource.
Creating gtk builder objects from a named resource requires the source xml resource to be parsed.
This creates a gtk builder instance using an identifier name which is mapped to the ui_resource table which must be initialised with nsgtk_init_resources()
resname | The resource name to construct for |
builder_out | The builder result |
Definition at line 526 of file resources.c.
References find_resource_from_name(), nsgtk_resource_s::name, NSERROR_INIT_FAILED, NSERROR_NOT_FOUND, NSERROR_OK, nsgtk_builder_add_from_resource(), NSGTK_RESOURCE_FILE, NSLOG, nsgtk_resource_s::path, nsgtk_resource_s::type, and ui_resource.
Referenced by cutomize_button_clicked_cb(), gui_window_create(), nsgtk_cookies_init(), nsgtk_download_init(), nsgtk_global_history_init(), nsgtk_hotlist_init(), nsgtk_local_history_init(), nsgtk_new_scaffolding(), nsgtk_page_info(), nsgtk_pdf_password(), nsgtk_preferences(), nsgtk_setup(), and window_init().
GdkCursor * nsgtk_create_menu_cursor | ( | void | ) |
Creates a menu cursor from internal resources.
Definition at line 148 of file resources.c.
References NSERROR_OK, and nsgdk_pixbuf_new_from_resname().
Referenced by gui_window_set_pointer().
nserror nsgtk_data_from_resname | ( | const char * | resname, |
const uint8_t ** | data_out, | ||
size_t * | data_size_out | ||
) |
Get direct pointer to resource data.
For a named resource this obtains a direct acesss pointer to the data and its length.
The data is read only through this pointer and remains valid until program exit.
resname | The resource name to obtain data for. |
data_out | The resulting data. |
data_size_out | The resulting data size. |
Definition at line 574 of file resources.c.
References buffer, direct_resource, find_resource_from_name(), nsgtk_resource_s::name, NSERROR_NOMEM, NSERROR_NOT_FOUND, NSERROR_OK, NSGTK_RESOURCE_DIRECT, nsgtk_resource_s::path, and nsgtk_resource_s::type.
Referenced by nsgtk_accelerator_init(), nsgtk_messages_init(), and nsgtk_preferences_comboboxLanguage_realize().
nserror nsgtk_init_resources | ( | char ** | respath | ) |
Initialise GTK resources handling.
Must be called before attempting to retrieve any resources but after logging is initialised as it logs.
respath | A string vector of paths to search for resources. |
Initialise GTK resources handling.
Definition at line 425 of file resources.c.
References direct_resource, init_direct_resource(), init_pixbuf_resource(), init_ui_resource(), nsgtk_resource_s::name, NSERROR_OK, pixbuf_resource, and ui_resource.
Referenced by nsgtk_init().
nserror nsgtk_path_from_resname | ( | const char * | resname, |
const char ** | path_out | ||
) |
Get path to resource data.
For a named resource this obtains the on-disc path to that resource.
The path is read only and remains valid untill program exit.
resname | The resource name to obtain path for. |
path_out | The resulting data. |
Definition at line 613 of file resources.c.
References direct_resource, find_resource_from_name(), nsgtk_resource_s::name, NSERROR_NOT_FOUND, NSERROR_OK, NSGTK_RESOURCE_FILE, nsgtk_resource_s::path, and nsgtk_resource_s::type.
Referenced by nsgtk_accelerator_init(), nsgtk_messages_init(), and nsgtk_preferences_comboboxLanguage_realize().