mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 21:06:01 +01:00
Statusbar entries
This commit is contained in:
parent
43727a597b
commit
ff2b588ea5
4 changed files with 27 additions and 5 deletions
|
@ -20,12 +20,12 @@ void
|
|||
buffer_changed(girara_session_t* session)
|
||||
{
|
||||
g_return_if_fail(session != NULL);
|
||||
g_return_if_fail(Zathura.UI.buffer != NULL);
|
||||
g_return_if_fail(Zathura.UI.statusbar.buffer != NULL);
|
||||
|
||||
char* buffer = girara_buffer_get(session);
|
||||
|
||||
if(buffer) {
|
||||
girara_statusbar_item_set_text(session, Zathura.UI.buffer, buffer);
|
||||
girara_statusbar_item_set_text(session, Zathura.UI.statusbar.buffer, buffer);
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "document.h"
|
||||
#include "../utils.h"
|
||||
#include "../zathura.h"
|
||||
#include "pdf/pdf.h"
|
||||
|
||||
#define LENGTH(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
@ -88,6 +89,7 @@ zathura_document_open(const char* path, const char* password)
|
|||
if(!strcmp(file_extension, zathura_document_plugins[i].file_extension)) {
|
||||
if(zathura_document_plugins[i].open_function) {
|
||||
if(zathura_document_plugins[i].open_function(document)) {
|
||||
girara_statusbar_item_set_text(Zathura.UI.session, Zathura.UI.statusbar.file, real_path);
|
||||
return document;
|
||||
} else {
|
||||
fprintf(stderr, "error: could not open file\n");
|
||||
|
|
18
zathura.c
18
zathura.c
|
@ -19,12 +19,26 @@ init_zathura()
|
|||
}
|
||||
|
||||
/* UI */
|
||||
Zathura.UI.buffer = girara_statusbar_item_add(Zathura.UI.session, FALSE, FALSE, FALSE, NULL);
|
||||
if(!Zathura.UI.buffer) {
|
||||
Zathura.UI.statusbar.file = girara_statusbar_item_add(Zathura.UI.session, TRUE, TRUE, TRUE, NULL);
|
||||
if(!Zathura.UI.statusbar.file) {
|
||||
girara_session_destroy(Zathura.UI.session);
|
||||
return false;
|
||||
}
|
||||
|
||||
Zathura.UI.statusbar.buffer = girara_statusbar_item_add(Zathura.UI.session, FALSE, FALSE, FALSE, NULL);
|
||||
if(!Zathura.UI.statusbar.buffer) {
|
||||
girara_session_destroy(Zathura.UI.session);
|
||||
return false;
|
||||
}
|
||||
|
||||
Zathura.UI.statusbar.page_number = girara_statusbar_item_add(Zathura.UI.session, FALSE, FALSE, FALSE, NULL);
|
||||
if(!Zathura.UI.statusbar.page_number) {
|
||||
girara_session_destroy(Zathura.UI.session);
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -26,7 +26,13 @@ struct
|
|||
struct
|
||||
{
|
||||
girara_session_t* session; /**> girara interface session */
|
||||
girara_statusbar_item_t* buffer; /**> buffer statusbar entry */
|
||||
|
||||
struct
|
||||
{
|
||||
girara_statusbar_item_t* buffer; /**> buffer statusbar entry */
|
||||
girara_statusbar_item_t* file; /**> file statusbar entry */
|
||||
girara_statusbar_item_t* page_number; /**> page number statusbar entry */
|
||||
} statusbar;
|
||||
} UI;
|
||||
} Zathura;
|
||||
|
||||
|
|
Loading…
Reference in a new issue