mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 12:05:59 +01:00
SF in set function
The function now checks if a parameter is given or not
This commit is contained in:
parent
ad897d2c65
commit
c7ebceb83a
1 changed files with 14 additions and 8 deletions
14
zathura.c
14
zathura.c
|
@ -1700,12 +1700,15 @@ cmd_set(int argc, char** argv)
|
||||||
if(settings[i].type == 'b')
|
if(settings[i].type == 'b')
|
||||||
{
|
{
|
||||||
gboolean *x = (gboolean*) (settings[i].variable);
|
gboolean *x = (gboolean*) (settings[i].variable);
|
||||||
gboolean new_value = TRUE;
|
*x = !(*x);
|
||||||
|
|
||||||
|
if(argv[1])
|
||||||
|
{
|
||||||
if(!strcmp(argv[1], "false") || !strcmp(argv[1], "0"))
|
if(!strcmp(argv[1], "false") || !strcmp(argv[1], "0"))
|
||||||
new_value = FALSE;
|
*x = TRUE;
|
||||||
|
else
|
||||||
*x = new_value;
|
*x = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(settings[i].type == 'i')
|
else if(settings[i].type == 'i')
|
||||||
{
|
{
|
||||||
|
@ -1713,6 +1716,7 @@ cmd_set(int argc, char** argv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
int *x = (int*) (settings[i].variable);
|
int *x = (int*) (settings[i].variable);
|
||||||
|
if(argv[1])
|
||||||
*x = atoi(argv[1]);
|
*x = atoi(argv[1]);
|
||||||
}
|
}
|
||||||
else if(settings[i].type == 's')
|
else if(settings[i].type == 's')
|
||||||
|
@ -1721,6 +1725,7 @@ cmd_set(int argc, char** argv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
char **x = (char**) settings[i].variable;
|
char **x = (char**) settings[i].variable;
|
||||||
|
if(argv[1])
|
||||||
*x = argv[1];
|
*x = argv[1];
|
||||||
}
|
}
|
||||||
else if(settings[i].type == 'c')
|
else if(settings[i].type == 'c')
|
||||||
|
@ -1729,6 +1734,7 @@ cmd_set(int argc, char** argv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
char *x = (char*) (settings[i].variable);
|
char *x = (char*) (settings[i].variable);
|
||||||
|
if(argv[1])
|
||||||
*x = argv[1][0];
|
*x = argv[1][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue