Commit f4bee430 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Move statusbar items to private data

Signed-off-by: default avatarSebastian Ramacher <sebastian@ramacher.at>
parent 22a6377b
......@@ -279,6 +279,11 @@ struct girara_session_private_s
GtkCssProvider* cssprovider;
} gtk;
struct
{
girara_list_t* statusbar_items; /**< List of statusbar items */
} elements;
struct
{
int n; /**< Numeric buffer */
......
......@@ -306,7 +306,7 @@ girara_session_create()
session->bindings.inputbar_shortcuts = girara_list_new2(
(girara_free_function_t) girara_inputbar_shortcut_free);
session->elements.statusbar_items = girara_list_new2(
session->private_data->elements.statusbar_items = girara_list_new2(
(girara_free_function_t) girara_statusbar_item_free);
/* settings */
......@@ -581,6 +581,16 @@ girara_session_private_free(girara_session_private_t* session)
g_free(session->session_name);
}
/* clean up buffer */
if (session->buffer.command) {
g_string_free(session->buffer.command, TRUE);
}
session->buffer.command = NULL;
/* clean up statusbar items */
girara_list_free(session->elements.statusbar_items);
session->elements.statusbar_items = NULL;
/* clean up CSS style provider */
g_clear_object(&session->gtk.cssprovider);
g_clear_object(&session->csstemplate);
......@@ -589,12 +599,6 @@ girara_session_private_free(girara_session_private_t* session)
girara_list_free(session->settings);
session->settings = NULL;
/* clean up buffer */
if (session->buffer.command) {
g_string_free(session->buffer.command, TRUE);
}
session->buffer.command = NULL;
g_slice_free(girara_session_private_t, session);
}
......@@ -626,10 +630,6 @@ girara_session_destroy(girara_session_t* session)
/* clean up input histry */
g_clear_object(&session->command_history);
/* clean up statusbar items */
girara_list_free(session->elements.statusbar_items);
session->elements.statusbar_items = NULL;
/* clean up config handles */
girara_list_free(session->config.handles);
session->config.handles = NULL;
......
......@@ -46,11 +46,6 @@ struct girara_session_s
girara_list_t* inputbar_shortcuts; /**< List of inputbar shortcuts */
} bindings;
struct
{
girara_list_t* statusbar_items; /**< List of statusbar items */
} elements;
struct
{
int inputbar_activate; /**< Inputbar activation */
......
......@@ -10,7 +10,10 @@ girara_statusbar_item_t*
girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill,
bool left, girara_statusbar_event_t callback)
{
g_return_val_if_fail(session != NULL && session->elements.statusbar_items, FALSE);
g_return_val_if_fail(session != NULL, FALSE);
girara_session_private_t* session_private = session->private_data;
g_return_val_if_fail(session_private->elements.statusbar_items != NULL, FALSE);
girara_statusbar_item_t* item = g_slice_new(girara_statusbar_item_t);
......@@ -43,7 +46,7 @@ girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill,
gtk_box_pack_start(session->gtk.statusbar_entries, GTK_WIDGET(item->box), expand, fill, 0);
gtk_widget_show_all(GTK_WIDGET(item->box));
girara_list_prepend(session->elements.statusbar_items, item);
girara_list_prepend(session_private->elements.statusbar_items, item);
return item;
}
......
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