Commit 593d8063 authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Close open document in cb_destroy

parent e73ca51d
......@@ -18,8 +18,13 @@
#include "page_widget.h"
gboolean
cb_destroy(GtkWidget* UNUSED(widget), gpointer UNUSED(data))
cb_destroy(GtkWidget* UNUSED(widget), zathura_t* zathura)
{
if (zathura != NULL && zathura->document != NULL) {
zathura_document_free(zathura->document);
zathura->document = NULL;
}
gtk_main_quit();
return TRUE;
}
......
......@@ -8,15 +8,16 @@
#include <girara/macros.h>
#include "document.h"
#include "zathura.h"
/**
* Quits the current zathura session
*
* @param widget The gtk window of zathura
* @param data NULL
* @param zathura Correspondending zathura session
* @return true if no error occured and the event has been handled
*/
gboolean cb_destroy(GtkWidget* widget, gpointer data);
gboolean cb_destroy(GtkWidget* widget, zathura_t* zathura);
/**
* This function gets called when the buffer of girara changes
......
......@@ -225,7 +225,7 @@ zathura_init(int argc, char* argv[])
girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.file, "[No Name]");
/* signals */
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL);
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), zathura);
/* save page padding */
zathura->global.page_padding = 1;
......
Supports Markdown
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