Commit ff2b588e authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Statusbar entries

parent 43727a59
...@@ -20,12 +20,12 @@ void ...@@ -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);
} }
} }
...@@ -11,6 +11,7 @@ ...@@ -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) ...@@ -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");
......
...@@ -19,12 +19,26 @@ init_zathura() ...@@ -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);
......
...@@ -26,7 +26,13 @@ struct ...@@ -26,7 +26,13 @@ struct
struct struct
{ {
girara_session_t* session; /**> girara interface session */ 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; } UI;
} Zathura; } Zathura;
......
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