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) buffer_changed(girara_session_t* session)
{ {
g_return_if_fail(session != NULL); 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); char* buffer = girara_buffer_get(session);
if(buffer) { 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); free(buffer);
} }
} }

View File

@ -11,6 +11,7 @@
#include "document.h" #include "document.h"
#include "../utils.h" #include "../utils.h"
#include "../zathura.h"
#include "pdf/pdf.h" #include "pdf/pdf.h"
#define LENGTH(x) (sizeof(x)/sizeof((x)[0])) #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(!strcmp(file_extension, zathura_document_plugins[i].file_extension)) {
if(zathura_document_plugins[i].open_function) { if(zathura_document_plugins[i].open_function) {
if(zathura_document_plugins[i].open_function(document)) { if(zathura_document_plugins[i].open_function(document)) {
girara_statusbar_item_set_text(Zathura.UI.session, Zathura.UI.statusbar.file, real_path);
return document; return document;
} else { } else {
fprintf(stderr, "error: could not open file\n"); fprintf(stderr, "error: could not open file\n");

View File

@ -19,12 +19,26 @@ init_zathura()
} }
/* UI */ /* UI */
Zathura.UI.buffer = girara_statusbar_item_add(Zathura.UI.session, FALSE, FALSE, FALSE, NULL); Zathura.UI.statusbar.file = girara_statusbar_item_add(Zathura.UI.session, TRUE, TRUE, TRUE, NULL);
if(!Zathura.UI.buffer) { if(!Zathura.UI.statusbar.file) {
girara_session_destroy(Zathura.UI.session); girara_session_destroy(Zathura.UI.session);
return false; 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 */ /* 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), NULL);

View File

@ -26,7 +26,13 @@ struct
struct struct
{ {
girara_session_t* session; /**> girara interface session */ girara_session_t* session; /**> girara interface session */
struct
{
girara_statusbar_item_t* buffer; /**> buffer statusbar entry */ 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; } UI;
} Zathura; } Zathura;