mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-29 08:34:56 +01:00
Some style updates
This commit is contained in:
parent
f384c912a0
commit
9f1a3c6c62
2 changed files with 14 additions and 19 deletions
13
commands.c
13
commands.c
|
@ -107,7 +107,6 @@ cmd_close(girara_session_t* session, girara_list_t* UNUSED(argument_list))
|
||||||
g_return_val_if_fail(session->global.data != NULL, false);
|
g_return_val_if_fail(session->global.data != NULL, false);
|
||||||
zathura_t* zathura = session->global.data;
|
zathura_t* zathura = session->global.data;
|
||||||
if (zathura->document == NULL) {
|
if (zathura->document == NULL) {
|
||||||
// nothing needs to be done
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,15 +191,13 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
girara_notify(session, GIRARA_ERROR, "Too many arguments.");
|
girara_notify(session, GIRARA_ERROR, "Too many arguments.");
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (argc >= 1) {
|
||||||
else if (argc >= 1) {
|
|
||||||
if (zathura->document) {
|
if (zathura->document) {
|
||||||
document_close(zathura);
|
document_close(zathura);
|
||||||
}
|
}
|
||||||
|
|
||||||
document_open(zathura, girara_list_nth(argument_list, 0), (argc == 2) ? girara_list_nth(argument_list, 1) : NULL);
|
document_open(zathura, girara_list_nth(argument_list, 0), (argc == 2) ? girara_list_nth(argument_list, 1) : NULL);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
girara_notify(session, GIRARA_ERROR, "No arguments given.");
|
girara_notify(session, GIRARA_ERROR, "No arguments given.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -239,8 +236,7 @@ cmd_save(girara_session_t* session, girara_list_t* argument_list)
|
||||||
|
|
||||||
if (girara_list_size(argument_list) == 1) {
|
if (girara_list_size(argument_list) == 1) {
|
||||||
document_save(zathura, girara_list_nth(argument_list, 0), false);
|
document_save(zathura, girara_list_nth(argument_list, 0), false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
girara_notify(session, GIRARA_ERROR, "Invalid number of arguments.");
|
girara_notify(session, GIRARA_ERROR, "Invalid number of arguments.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -262,8 +258,7 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list)
|
||||||
|
|
||||||
if (girara_list_size(argument_list) == 1) {
|
if (girara_list_size(argument_list) == 1) {
|
||||||
document_save(zathura, girara_list_nth(argument_list, 0), true);
|
document_save(zathura, girara_list_nth(argument_list, 0), true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
girara_notify(session, GIRARA_ERROR, "Invalid number of arguments.");
|
girara_notify(session, GIRARA_ERROR, "Invalid number of arguments.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
20
shortcuts.c
20
shortcuts.c
|
@ -230,19 +230,19 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkAdjustment* adjustment = NULL;
|
GtkAdjustment* adjustment = NULL;
|
||||||
if ( (argument->n == LEFT) || (argument->n == RIGHT) )
|
if ( (argument->n == LEFT) || (argument->n == RIGHT) ) {
|
||||||
adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
|
adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
|
||||||
else
|
} else {
|
||||||
adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
|
adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
|
||||||
|
}
|
||||||
|
|
||||||
gdouble view_size = gtk_adjustment_get_page_size(adjustment);
|
gdouble view_size = gtk_adjustment_get_page_size(adjustment);
|
||||||
gdouble value = gtk_adjustment_get_value(adjustment);
|
gdouble value = gtk_adjustment_get_value(adjustment);
|
||||||
gdouble max = gtk_adjustment_get_upper(adjustment) - view_size;
|
gdouble max = gtk_adjustment_get_upper(adjustment) - view_size;
|
||||||
gdouble scroll_step = 40;
|
gdouble scroll_step = 40;
|
||||||
|
gdouble new_value = value;
|
||||||
|
|
||||||
gdouble new_value;
|
switch(argument->n) {
|
||||||
switch(argument->n)
|
|
||||||
{
|
|
||||||
case FULL_UP:
|
case FULL_UP:
|
||||||
new_value = (value - view_size) < 0 ? 0 : (value - view_size);
|
new_value = (value - view_size) < 0 ? 0 : (value - view_size);
|
||||||
break;
|
break;
|
||||||
|
@ -270,7 +270,7 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int
|
||||||
new_value = max;
|
new_value = max;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
new_value = 0;
|
new_value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_adjustment_set_value(adjustment, new_value);
|
gtk_adjustment_set_value(adjustment, new_value);
|
||||||
|
@ -309,7 +309,7 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument,
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
gtk_tree_view_get_cursor(tree_view, &path, NULL);
|
gtk_tree_view_get_cursor(tree_view, &path, NULL);
|
||||||
if(path == NULL) {
|
if (path == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue