Fix adjust-open setting

This commit is contained in:
Moritz Lipp 2012-02-09 11:25:00 +01:00
parent 900516d1f1
commit 3fec0ed485
2 changed files with 12 additions and 5 deletions

View file

@ -60,8 +60,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "highlight-transparency", &float_value, FLOAT, false, "Transparency for highlighting", NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "render-loading", &bool_value, BOOLEAN, false, "Render 'Loading ...'", NULL, NULL);
int_value = ADJUST_BESTFIT;
girara_setting_add(gsession, "adjust-open", &int_value, INT, false, "Adjust to when opening file", NULL, NULL);
string_value = "best-fit";
girara_setting_add(gsession, "adjust-open", string_value, STRING, false, "Adjust to when opening file", NULL, NULL);
/* define default shortcuts */
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_c, NULL, sc_abort, 0, 0, NULL);

View file

@ -346,10 +346,17 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password
g_signal_connect(G_OBJECT(document->file_monitor.monitor), "changed", G_CALLBACK(cb_file_monitor), zathura->ui.session);
/* apply open adjustment */
int adjust_open = ADJUST_BESTFIT;
girara_setting_get(zathura->ui.session, "adjust-open", &adjust_open);
char* adjust_open = "best-fit";
document->adjust_mode = ADJUST_BESTFIT;
if (girara_setting_get(zathura->ui.session, "adjust-open", &(adjust_open)) == true) {
if (g_strcmp0(adjust_open, "best-fit") == 0) {
document->adjust_mode = ADJUST_BESTFIT;
} else if (g_strcmp0(adjust_open, "width") == 0) {
document->adjust_mode = ADJUST_WIDTH;
}
g_free(adjust_open);
}
g_free(file_uri);