summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2011-09-19 15:33:37 +0200
committerportix <portix@gmx.net>2011-09-19 15:33:37 +0200
commit6ab4fc95240fd1e8d135fa43fdea8afa8386fcfb (patch)
tree21fceb7a4bfb912a425831a99f1b812244ac96e5 /src/util.c
parent42e5c54fa864b9390b81b9e55fcaff6a31cbe678 (diff)
downloaddwb-6ab4fc95240fd1e8d135fa43fdea8afa8386fcfb.zip
Remove functions for bookmarks, quickmarks, history
--HG-- branch : develop
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index e33d7d5a..8776f7c5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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) {{{*/