diff options
author | portix <portix@gmx.net> | 2011-09-19 15:33:37 +0200 |
---|---|---|
committer | portix <portix@gmx.net> | 2011-09-19 15:33:37 +0200 |
commit | 6ab4fc95240fd1e8d135fa43fdea8afa8386fcfb (patch) | |
tree | 21fceb7a4bfb912a425831a99f1b812244ac96e5 /src/util.c | |
parent | 42e5c54fa864b9390b81b9e55fcaff6a31cbe678 (diff) | |
download | dwb-6ab4fc95240fd1e8d135fa43fdea8afa8386fcfb.zip |
Remove functions for bookmarks, quickmarks, history
--HG--
branch : develop
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -325,6 +325,25 @@ util_get_data_file(const char *filename) { } return NULL; } +int +util_file_remove_line(const char *filename, const char *line) { + int ret = 1; + char *content = util_get_file_content(filename); + char **lines = g_strsplit(content, "\n", -1); + GString *buffer = g_string_new(NULL); + for (int i=0; lines[i]; i++) { + if (strlen(lines[i]) > 0 && STRCMP_SKIP_NEWLINE(lines[i], line)) { + g_string_append_printf(buffer, "%s\n", lines[i]); + } + } + g_file_set_contents(filename, buffer->str, -1, NULL); + + g_string_free(buffer, true); + g_free(content); + g_strfreev(lines); + + return ret; +} /* NAVIGATION {{{*/ /* dwb_navigation_new(const char *uri, const char *title) {{{*/ |