Statusbar entries

This commit is contained in:
Moritz Lipp 2010-11-18 21:22:43 +01:00
parent 43727a597b
commit ff2b588ea5
4 changed files with 27 additions and 5 deletions

View file

@ -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);
}
}

View file

@ -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");

View file

@ -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);

View file

@ -26,7 +26,13 @@ struct
struct
{
girara_session_t* session; /**> girara interface session */
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;