mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 23:43:46 +01:00
Simplify
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
49aa419568
commit
63314cfbc9
@ -246,10 +246,7 @@ error_free:
|
||||
g_free(priv->bookmark_path);
|
||||
priv->bookmark_path = NULL;
|
||||
|
||||
if (priv->bookmark_monitor != NULL) {
|
||||
g_object_unref(priv->bookmark_monitor);
|
||||
priv->bookmark_monitor = NULL;
|
||||
}
|
||||
g_clear_object(&priv->bookmark_monitor);
|
||||
|
||||
if (priv->bookmarks != NULL) {
|
||||
g_key_file_free(priv->bookmarks);
|
||||
@ -260,10 +257,7 @@ error_free:
|
||||
g_free(priv->history_path);
|
||||
priv->history_path = NULL;
|
||||
|
||||
if (priv->history_monitor != NULL) {
|
||||
g_object_unref(priv->history_monitor);
|
||||
priv->history_monitor = NULL;
|
||||
}
|
||||
g_clear_object(&priv->history_monitor);
|
||||
|
||||
if (priv->history != NULL) {
|
||||
g_key_file_free(priv->history);
|
||||
|
@ -119,8 +119,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri,
|
||||
document->uri = g_strdup(uri);
|
||||
if (document->uri == NULL) {
|
||||
document->basename = g_file_get_basename(file);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
GFile *gf = g_file_new_for_uri(document->uri);
|
||||
document->basename = g_file_get_basename(gf);
|
||||
g_object_unref(gf);
|
||||
|
@ -215,12 +215,8 @@ cb_print_done(GtkPrintOperation* operation, GtkPrintOperationResult result,
|
||||
zathura_t* zathura)
|
||||
{
|
||||
if (result == GTK_PRINT_OPERATION_RESULT_APPLY) {
|
||||
if (zathura->print.settings != NULL) {
|
||||
g_object_unref(zathura->print.settings);
|
||||
}
|
||||
if (zathura->print.page_setup != NULL) {
|
||||
g_object_unref(zathura->print.page_setup);
|
||||
}
|
||||
g_clear_object(&zathura->print.settings);
|
||||
g_clear_object(&zathura->print.page_setup);
|
||||
|
||||
/* save previous settings */
|
||||
zathura->print.settings = g_object_ref(gtk_print_operation_get_print_settings(operation));
|
||||
|
@ -391,10 +391,7 @@ zathura_free(zathura_t* zathura)
|
||||
#endif
|
||||
|
||||
/* stop D-Bus */
|
||||
if (zathura->dbus != NULL) {
|
||||
g_object_unref(zathura->dbus);
|
||||
zathura->dbus = NULL;
|
||||
}
|
||||
g_clear_object(&zathura->dbus);
|
||||
|
||||
if (zathura->ui.session != NULL) {
|
||||
girara_session_destroy(zathura->ui.session);
|
||||
@ -415,18 +412,11 @@ zathura_free(zathura_t* zathura)
|
||||
girara_list_free(zathura->bookmarks.bookmarks);
|
||||
|
||||
/* database */
|
||||
if (zathura->database != NULL) {
|
||||
g_object_unref(G_OBJECT(zathura->database));
|
||||
}
|
||||
g_clear_object(&zathura->database);
|
||||
|
||||
/* free print settings */
|
||||
if (zathura->print.settings != NULL) {
|
||||
g_object_unref(zathura->print.settings);
|
||||
}
|
||||
|
||||
if (zathura->print.page_setup != NULL) {
|
||||
g_object_unref(zathura->print.page_setup);
|
||||
}
|
||||
g_clear_object(&zathura->print.settings);
|
||||
g_clear_object(&zathura->print.page_setup);
|
||||
|
||||
/* free registered plugins */
|
||||
zathura_plugin_manager_free(zathura->plugins.manager);
|
||||
@ -1216,10 +1206,7 @@ document_close(zathura_t* zathura, bool keep_monitor)
|
||||
|
||||
/* remove monitor */
|
||||
if (keep_monitor == false) {
|
||||
if (zathura->file_monitor.monitor != NULL) {
|
||||
g_object_unref(zathura->file_monitor.monitor);
|
||||
zathura->file_monitor.monitor = NULL;
|
||||
}
|
||||
g_clear_object(&zathura->file_monitor.monitor);
|
||||
|
||||
if (zathura->file_monitor.password != NULL) {
|
||||
g_free(zathura->file_monitor.password);
|
||||
@ -1245,8 +1232,7 @@ document_close(zathura_t* zathura, bool keep_monitor)
|
||||
zathura->jumplist.size = 0;
|
||||
|
||||
/* release render thread */
|
||||
g_object_unref(zathura->sync.render_thread);
|
||||
zathura->sync.render_thread = NULL;
|
||||
g_clear_object(&zathura->sync.render_thread);
|
||||
|
||||
/* remove widgets */
|
||||
gtk_container_foreach(GTK_CONTAINER(zathura->ui.page_widget), remove_page_from_table, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user