NetSurf
Functions | Variables
theme_install.c File Reference

Theme auto-installing. More...

#include <assert.h>
#include <stdbool.h>
#include <oslib/osfile.h>
#include <oslib/wimp.h>
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/content.h"
#include "content/hlcache.h"
#include "desktop/theme.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/theme.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
Include dependency graph for theme_install.c:

Go to the source code of this file.

Functions

static void theme_install_close (wimp_w w)
 Close the theme installer and free resources. More...
 
static nserror theme_install_callback (struct hlcache_handle *handle, const hlcache_event *event, void *pw)
 Callback for fetchcache() for theme install fetches. More...
 
void theme_install_start (struct hlcache_handle *c)
 Handle a CONTENT_THEME that has started loading. More...
 
static bool theme_install_read (const uint8_t *source_data, size_t source_size)
 Fill in theme_install_descriptor from received theme data. More...
 
bool ro_gui_theme_install_apply (wimp_w w)
 Install the downloaded theme. More...
 

Variables

static struct hlcache_handletheme_install_content = NULL
 
static struct theme_descriptor theme_install_descriptor
 
wimp_w dialog_theme_install
 

Detailed Description

Theme auto-installing.

Definition in file theme_install.c.

Function Documentation

◆ ro_gui_theme_install_apply()

bool ro_gui_theme_install_apply ( wimp_w  w)

Install the downloaded theme.

Parameters
wthe theme install window handle

Definition at line 171 of file theme_install.c.

References content_get_source_data(), theme_descriptor::leafname, theme_descriptor::name, NSLOG, nsoption_charp, nsoption_set_charp, ro_gui_save_options(), ro_gui_theme_apply(), ro_gui_theme_find(), ro_gui_theme_get_available(), ro_warn_user(), theme_install_content, and theme_install_descriptor.

Referenced by ro_gui_dialog_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ theme_install_callback()

nserror theme_install_callback ( struct hlcache_handle handle,
const hlcache_event event,
void *  pw 
)
static

Callback for fetchcache() for theme install fetches.

Definition at line 111 of file theme_install.c.

References theme_descriptor::author, buffer, content_get_source_data(), CONTENT_MSG_DONE, CONTENT_MSG_ERROR, hlcache_event::data, dialog_theme_install, content_msg_data::errordata, content_msg_data::errormsg, ICON_THEME_INSTALL_INSTALL, ICON_THEME_INSTALL_MESSAGE, messages_get(), theme_descriptor::name, NSERROR_OK, ro_gui_set_icon_shaded_state(), ro_gui_set_icon_string(), ro_warn_user(), theme_install_close(), theme_install_content, theme_install_descriptor, theme_install_read(), and hlcache_event::type.

Referenced by theme_install_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ theme_install_close()

void theme_install_close ( wimp_w  w)
static

Close the theme installer and free resources.

Definition at line 232 of file theme_install.c.

References hlcache_handle_release(), and theme_install_content.

Referenced by theme_install_callback(), and theme_install_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ theme_install_read()

static bool theme_install_read ( const uint8_t *  source_data,
size_t  source_size 
)
static

Fill in theme_install_descriptor from received theme data.

Parameters
source_datareceived data
source_sizesize of data
Returns
true if data is a correct theme, false on error

If the data is a correct theme, theme_install_descriptor is filled in.

Definition at line 91 of file theme_install.c.

References theme_descriptor::compressed_size, ro_gui_theme_read_file_header(), and theme_install_descriptor.

Referenced by theme_install_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ theme_install_start()

void theme_install_start ( struct hlcache_handle c)

Handle a CONTENT_THEME that has started loading.

Definition at line 56 of file theme_install.c.

References content_get_type(), content_invalidate_reuse_data(), CONTENT_THEME, dialog_theme_install, hlcache_handle_replace_callback(), ICON_THEME_INSTALL_INSTALL, ICON_THEME_INSTALL_MESSAGE, messages_get(), ro_gui_dialog_open_top(), ro_gui_set_icon_shaded_state(), ro_gui_set_icon_string(), ro_gui_wimp_event_register_close_window(), ro_warn_user(), theme_install_callback(), and theme_install_close().

Referenced by browser_window_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dialog_theme_install

wimp_w dialog_theme_install

Definition at line 44 of file theme_install.c.

Referenced by theme_install_callback(), and theme_install_start().

◆ theme_install_content

struct hlcache_handle* theme_install_content = NULL
static

◆ theme_install_descriptor

struct theme_descriptor theme_install_descriptor
static