diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-07-25 19:06:10 +0000 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-09-17 17:03:53 +0000 |
commit | 65ace942fdabfd6116163a21eec7cd7bbd3cbcb1 (patch) | |
tree | 40b1bce4290125bfa3d3695b85fd213f2bb15f77 /src/commands.c | |
parent | 1cbac1d7fb292adc0e3e07d206370aeb5ac8e7e0 (diff) |
introduce getter and setter functions.
some variables didn't always have a value reflecting the browser's
internal state. for example, if `default_encoding` was never set then
`print @default_encoding` would always print a blank string.
this introduces getter functions that ensure the value of a variable is
always in sync with the internal state of the browser.
also: setters, because sometimes you need to process user input
before storing it.
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/commands.c b/src/commands.c index 7b327e6..8717bd8 100644 --- a/src/commands.c +++ b/src/commands.c @@ -98,17 +98,18 @@ VIEWFUNC(go_forward) void toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result) { - (void)argv; (void)result; - webkit_web_view_set_full_content_zoom (page, !webkit_web_view_get_full_content_zoom (page)); + (void)page; (void)argv; (void)result; + + int current_type = get_zoom_type(); + set_zoom_type(!current_type); } void toggle_status (WebKitWebView* page, GArray *argv, GString *result) { (void)page; (void)argv; (void)result; - uzbl.behave.show_status = !uzbl.behave.show_status; - - set_show_status(); + int current_status = uzbl.behave.show_status; + set_show_status(!current_status); } /* |