Commit fb687376 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add init_variables paramater

If true, adds all variables known to girara to the template and sets them to their current value.
Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 0182286f
......@@ -969,7 +969,7 @@ girara_session_get_template(girara_session_t* session)
}
void
girara_session_set_template(girara_session_t* session, GiraraTemplate* template)
girara_session_set_template(girara_session_t* session, GiraraTemplate* template, bool init_variables)
{
g_return_if_fail(session != NULL);
g_return_if_fail(template != NULL);
......@@ -979,6 +979,11 @@ girara_session_set_template(girara_session_t* session, GiraraTemplate* template)
}
session->private_data->csstemplate = template;
if (init_variables == true) {
init_template_engine(template);
fill_template_with_values(template);
}
css_template_changed(template, session);
}
......@@ -252,14 +252,16 @@ girara_list_t* girara_get_command_history(girara_session_t* session);
GiraraTemplate* girara_session_get_template(girara_session_t* session);
/**
* Replaces the internal template object, thus provides entirely user-defined styling
* Replaces the internal template object, thus provides entirely user-defined styling.
*
* @param session The girara session
* @param template The template to apply, @ref girara_template_new
* @param init_variables Defines whether the default variables and current
* values should be added to the the template
*
* @note Using the template @c girara_template_new("") will use the default gtk style
*
*/
void girara_session_set_template(girara_session_t* session, GiraraTemplate *template);
void girara_session_set_template(girara_session_t* session, GiraraTemplate* template, bool init_variables);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment