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/uzbl-core.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/uzbl-core.c')
-rw-r--r-- | src/uzbl-core.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c index b233f8b..8449c28 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -926,21 +926,6 @@ void handle_authentication (SoupSession *session, SoupMessage *msg, SoupAuth *au } } -void -retrieve_geometry() { - int w, h, x, y; - GString *buf = g_string_new(""); - - gtk_window_get_size(GTK_WINDOW(uzbl.gui.main_window), &w, &h); - gtk_window_get_position(GTK_WINDOW(uzbl.gui.main_window), &x, &y); - - g_string_printf(buf, "%dx%d+%d+%d", w, h, x, y); - - if(uzbl.gui.geometry) - g_free(uzbl.gui.geometry); - uzbl.gui.geometry = g_string_free(buf, FALSE); -} - /* Set up gtk, gobject, variable defaults and other things that tests and other * external applications need to do anyhow */ void @@ -1097,11 +1082,10 @@ main (int argc, char* argv[]) { builtins(); /* Check uzbl is in window mode before getting/setting geometry */ - if (uzbl.gui.main_window) { - if (uzbl.gui.geometry) - set_geometry(); - else - retrieve_geometry(); + if (uzbl.gui.main_window && uzbl.gui.geometry) { + gchar *geometry = g_strdup(uzbl.gui.geometry); + set_geometry(geometry); + g_free(geometry); } gchar *uri_override = (uzbl.state.uri ? g_strdup(uzbl.state.uri) : NULL); |