From: Hannes S. <ha...@yl...> - 2012-04-12 21:29:50
|
--- main.c | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 63b9245..29e01c6 100644 --- a/main.c +++ b/main.c @@ -102,6 +102,7 @@ void fill_suggline(char * suggline, const char * command, const char *fill_with) GtkWidget * fill_eventbox(const char * completion_line); static void mop_up(void); void apply_settings(char *uri); +void revert_settings(void); #include "main.h" @@ -2566,8 +2567,11 @@ apply_settings(char *uri) { char temp[MAX_SETTING_SIZE], *temp2, temp3[MAX_SETTING_SIZE]; guint i, j, len, len2, len3; - /* check for site-specific settings */ if (siteSettings != NULL) { + /* to ensure consistency in case several defined sites are visited one after another, + * temporarily revert back to standard settings */ + revert_settings(); + /* check for site-specific settings */ len = g_list_length(siteSettings); for (i = 0; i < len; i++) { l = g_list_nth(siteSettings, i); @@ -2596,21 +2600,26 @@ apply_settings(char *uri) { return; } } - if (strlen(backupsettings) > 0) { - /* revert to standard settings - * the string has to be applied from right to left - * this ensures that if various values have been set for the same key in the meantime, - * we will still get back to the most basic state - */ + } +} + +void revert_settings(void) { + char *temp2; + + if (strlen(backupsettings) > 0) { + /* revert to standard settings + * the string has to be applied from right to left + * this ensures that if various values have been set for the same key in the meantime, + * we will still get back to the most basic state + */ + temp2 = strrchr(backupsettings, '|'); + while (temp2 != NULL) { + process_set_line(temp2 + 1); + memset(temp2, 0, strlen(temp2)); temp2 = strrchr(backupsettings, '|'); - while (temp2 != NULL) { - process_set_line(temp2 + 1); - memset(temp2, 0, strlen(temp2)); - temp2 = strrchr(backupsettings, '|'); - } - /* erase remembered settings */ - memset(backupsettings, 0, MAX_SETTING_SIZE); } + /* erase remembered settings */ + memset(backupsettings, 0, MAX_SETTING_SIZE); } } -- 1.7.2.5 |