mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-03-03 18:14:41 +01:00
Close open document in cb_destroy
This commit is contained in:
parent
e73ca51d05
commit
593d8063fe
3 changed files with 10 additions and 4 deletions
|
@ -18,8 +18,13 @@
|
||||||
#include "page_widget.h"
|
#include "page_widget.h"
|
||||||
|
|
||||||
gboolean
|
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();
|
gtk_main_quit();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,16 @@
|
||||||
#include <girara/macros.h>
|
#include <girara/macros.h>
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.h"
|
||||||
|
#include "zathura.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quits the current zathura session
|
* Quits the current zathura session
|
||||||
*
|
*
|
||||||
* @param widget The gtk window of zathura
|
* @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
|
* @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
|
* 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]");
|
girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.file, "[No Name]");
|
||||||
|
|
||||||
/* signals */
|
/* 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 */
|
/* save page padding */
|
||||||
zathura->global.page_padding = 1;
|
zathura->global.page_padding = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue