diff --git a/config.c b/config.c index 5ddb658..c885464 100644 --- a/config.c +++ b/config.c @@ -40,19 +40,19 @@ config_load_default(zathura_t* zathura) /* zathura settings */ int_value = 10; - girara_setting_add(gsession, "zoom_step", &int_value, INT, false, "Zoom step", NULL, NULL); + girara_setting_add(gsession, "zoom-step", &int_value, INT, false, "Zoom step", NULL, NULL); int_value = 1; - girara_setting_add(gsession, "page_padding", &int_value, INT, true, "Padding between pages", NULL, NULL); + girara_setting_add(gsession, "page-padding", &int_value, INT, true, "Padding between pages", NULL, NULL); int_value = 2; - girara_setting_add(gsession, "pages_per_row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, zathura); + girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, zathura); float_value = 40; - girara_setting_add(gsession, "scroll_step", &float_value, FLOAT, false, "Scroll step", NULL, NULL); + girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, "Scroll step", NULL, NULL); string_value = "#FFFFFF"; - girara_setting_add(gsession, "recolor_darkcolor", string_value, STRING, false, "Recoloring (dark color)", NULL, NULL); + girara_setting_add(gsession, "recolor-darkcolor", string_value, STRING, false, "Recoloring (dark color)", NULL, NULL); string_value = "#000000"; - girara_setting_add(gsession, "recolor_lightcolor", string_value, STRING, false, "Recoloring (light color)", NULL, NULL); + girara_setting_add(gsession, "recolor-lightcolor", string_value, STRING, false, "Recoloring (light color)", NULL, NULL); /* define default shortcuts */ girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_c, NULL, sc_abort, 0, 0, NULL); diff --git a/shortcuts.c b/shortcuts.c index e41883c..6c5675c 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -33,7 +33,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, zathura_t* zathura = session->global.data; g_return_val_if_fail(argument != NULL, false); - unsigned int* pages_per_row = girara_setting_get(session, "pages_per_row"); + unsigned int* pages_per_row = girara_setting_get(session, "pages-per-row"); if (zathura->ui.page_view == NULL || zathura->document == NULL || pages_per_row == NULL) { goto error_ret; @@ -238,7 +238,7 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int gdouble value = gtk_adjustment_get_value(adjustment); gdouble max = gtk_adjustment_get_upper(adjustment) - view_size; gdouble scroll_step = 40; - float* tmp = girara_setting_get(session, "scroll_step"); + float* tmp = girara_setting_get(session, "scroll-step"); if (tmp != NULL) { scroll_step = *tmp; g_free(tmp); @@ -486,11 +486,40 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* { g_return_val_if_fail(session != NULL, false); - static bool fullscreen = false; + static bool fullscreen = false; + static int pages_per_row = 1; - if (fullscreen) { + + if (fullscreen == true) { + /* reset pages per row */ + girara_setting_set(session, "pages-per-row", &pages_per_row); + + /* show status bar */ + gtk_widget_show(GTK_WIDGET(session->gtk.statusbar)); + + /* set full screen */ gtk_window_unfullscreen(GTK_WINDOW(session->gtk.window)); } else { + /* backup pages per row */ + int* tmp = girara_setting_get(session, "pages-per-row"); + if (tmp != NULL) { + pages_per_row = *tmp; + free(tmp); + } + + /* set single view */ + int int_value = 1; + girara_setting_set(session, "pages-per-row", &int_value); + + /* adjust window */ + girara_argument_t argument = { ADJUST_BESTFIT, NULL }; + sc_adjust_window(session, &argument, 0); + + /* hide status and inputbar */ + gtk_widget_hide(GTK_WIDGET(session->gtk.inputbar)); + gtk_widget_hide(GTK_WIDGET(session->gtk.statusbar)); + + /* set full screen */ gtk_window_fullscreen(GTK_WINDOW(session->gtk.window)); } @@ -524,7 +553,7 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, unsigned int g_return_val_if_fail(zathura->document != NULL, false); /* retreive zoom step value */ - int* value = girara_setting_get(zathura->ui.session, "zoom_step"); + int* value = girara_setting_get(zathura->ui.session, "zoom-step"); if (value == NULL) { return false; } diff --git a/zathura.c b/zathura.c index 696b570..e25345e 100644 --- a/zathura.c +++ b/zathura.c @@ -187,7 +187,7 @@ zathura_init(int argc, char* argv[]) g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL); /* save page padding */ - int* page_padding = girara_setting_get(zathura->ui.session, "page_padding"); + int* page_padding = girara_setting_get(zathura->ui.session, "page-padding"); zathura->global.page_padding = (page_padding) ? *page_padding : 1; g_free(page_padding); @@ -195,13 +195,13 @@ zathura_init(int argc, char* argv[]) gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_view), zathura->global.page_padding); /* parse colors */ - char* string_value = girara_setting_get(zathura->ui.session, "recolor_darkcolor"); + char* string_value = girara_setting_get(zathura->ui.session, "recolor-darkcolor"); if (string_value != NULL) { gdk_color_parse(string_value, &(zathura->ui.colors.recolor_dark_color)); g_free(string_value); } - string_value = girara_setting_get(zathura->ui.session, "recolor_lightcolor"); + string_value = girara_setting_get(zathura->ui.session, "recolor-lightcolor"); if (string_value != NULL) { gdk_color_parse(string_value, &(zathura->ui.colors.recolor_light_color)); g_free(string_value); @@ -386,7 +386,7 @@ document_open(zathura_t* zathura, const char* path, const char* password) zathura->document = document; /* view mode */ - int* value = girara_setting_get(zathura->ui.session, "pages_per_row"); + int* value = girara_setting_get(zathura->ui.session, "pages-per-row"); int pages_per_row = (value) ? *value : 1; g_free(value); page_view_set_mode(zathura, pages_per_row);