Commit 4d955b39 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Simplify

Signed-off-by: default avatarSebastian Ramacher <sebastian@ramacher.at>
parent b1ed7916
......@@ -111,15 +111,11 @@ ih_set_property(GObject* object, guint prop_id, const GValue* value,
switch (prop_id) {
case PROP_IO: {
if (priv->io != NULL) {
g_object_unref(priv->io);
}
g_clear_object(&priv->io);
gpointer* tmp = g_value_dup_object(value);
if (tmp != NULL) {
priv->io = GIRARA_INPUT_HISTORY_IO(tmp);
} else {
priv->io = NULL;
}
girara_input_history_reset(GIRARA_INPUT_HISTORY(object));
break;
......
......@@ -631,14 +631,8 @@ girara_session_private_free(girara_session_private_t* session)
}
/* clean up CSS style provider */
if (session->gtk.cssprovider != NULL) {
g_object_unref(session->gtk.cssprovider);
}
session->gtk.cssprovider = NULL;
if (session->csstemplate != NULL) {
g_object_unref(session->csstemplate);
}
session->csstemplate = NULL;
g_clear_object(&session->gtk.cssprovider);
g_clear_object(&session->csstemplate);
/* clean up settings */
girara_list_free(session->settings);
......@@ -673,8 +667,7 @@ girara_session_destroy(girara_session_t* session)
session->bindings.mouse_events = NULL;
/* clean up input histry */
g_object_unref(session->command_history);
session->command_history = NULL;
g_clear_object(&session->command_history);
/* clean up statusbar items */
girara_list_free(session->elements.statusbar_items);
......@@ -974,9 +967,7 @@ girara_session_set_template(girara_session_t* session, GiraraTemplate* template,
g_return_if_fail(session != NULL);
g_return_if_fail(template != NULL);
if (session->private_data->csstemplate != NULL) {
g_object_unref(session->private_data->csstemplate);
}
g_clear_object(&session->private_data->csstemplate);
session->private_data->csstemplate = template;
if (init_variables == true) {
......
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