static void completion_set_entry_text(Client* c, Completion* completion);
static char* completion_get_text(Client* c, Completion* completion);
static Completion* completion_get_new(const char* label, const char* prefix);
+static void completion_free(Completion* completion);
gboolean completion_complete(Client* c, gboolean back)
{
if (!strcmp(input, text)) {
/* updatecompletions */
c->comps.active = completion_update(c, c->comps.completions, c->comps.active, back);
-
+ g_free(text);
return TRUE;
} else {
+ g_free(text);
/* if current input isn't the content of the completion item */
completion_clean(c);
}
c,
c->comps.completions, source, (Comp_Func)util_strcasestr, &input[6], ":open "
);
+ g_list_free(source);
} else if (!strncmp(input, ":tabopen ", 9)) {
source = url_history_get_all();
c->comps.completions = completion_init_completion(
void completion_clean(Client* c)
{
- g_list_free_full(c->comps.completions, (GDestroyNotify)g_free);
+ g_list_free_full(c->comps.completions, (GDestroyNotify)completion_free);
c->comps.completions = NULL;
if (c->gui.compbox) {
return c;
}
+
+static void completion_free(Completion* completion)
+{
+ gtk_widget_destroy(completion->event);
+ g_free(completion->prefix);
+ g_free(completion);
+}
*/
gboolean dom_is_editable(Element* element)
{
+ gboolean result = FALSE;
if (!element) {
- return FALSE;
+ return result;
}
char* tagname = webkit_dom_element_get_tag_name(element);
- if (!g_ascii_strcasecmp(tagname, "textarea")) {
- return TRUE;
- }
char *type = webkit_dom_element_get_attribute(element, "type");
- if (!g_ascii_strcasecmp(tagname, "input")
+ if (!g_ascii_strcasecmp(tagname, "textarea")) {
+ result = TRUE;
+ } else if (!g_ascii_strcasecmp(tagname, "input")
&& g_ascii_strcasecmp(type, "submit")
&& g_ascii_strcasecmp(type, "reset")
&& g_ascii_strcasecmp(type, "image")
) {
- return TRUE;
+ result = TRUE;
+ } else {
+ result = FALSE;
}
+ g_free(tagname);
+ g_free(type);
- return FALSE;
+ return result;
}
static gboolean dom_auto_insert(Client* c, Element* element)
{
Document* d = NULL;
Element* active = webkit_dom_html_document_get_active_element((void*)doc);
- char* tagname = webkit_dom_element_get_tag_name(active);
+ char* tagname = webkit_dom_element_get_tag_name(active);
+ Element* result = NULL;
if (!g_strcmp0(tagname, "FRAME")) {
d = webkit_dom_html_frame_element_get_content_document(WEBKIT_DOM_HTML_FRAME_ELEMENT(active));
- return dom_get_active_element(d);
- }
- if (!g_strcmp0(tagname, "IFRAME")) {
+ result = dom_get_active_element(d);
+ } else if (!g_strcmp0(tagname, "IFRAME")) {
d = webkit_dom_html_iframe_element_get_content_document(WEBKIT_DOM_HTML_IFRAME_ELEMENT(active));
- return dom_get_active_element(d);
+ result = dom_get_active_element(d);
}
+ g_free(tagname);
+
+ if (result) {
+ g_free(active);
+
+ return result;
+ }
+
return active;
}
return;
}
- if (!value) {
- return;
- }
if (!strncmp(value, "OVER:", 5)) {
g_signal_emit_by_name(
fprintf(stderr, "Invalid config: %s\n", line);
}
}
- g_strfreev(lines);
}
+ g_strfreev(lines);
}
static Client* vp_client_new(void)
webkit_web_view_stop_loading(c->gui.webview);
gtk_widget_destroy(GTK_WIDGET(c->gui.webview));
+ gtk_widget_destroy(GTK_WIDGET(c->gui.scroll));
+ gtk_widget_destroy(GTK_WIDGET(c->gui.box));
gtk_widget_destroy(GTK_WIDGET(c->gui.window));
for(p = clients; p && p->next != c; p = p->next);
file_lock_set(fileno(file), F_UNLCK);
fclose(file);
+
+ /* reverse the history because we read it from lates to old from file */
+ core.behave.url_history = g_list_reverse(core.behave.url_history);
}
void url_history_cleanup(void)
core.behave.url_history = g_list_prepend(core.behave.url_history, item);
}
+/**
+ * Retrieves the ur history as ne allocated list.
+ */
GList* url_history_get_all(void)
{
GList* out = NULL;
if (item->title) {
g_free(item->title);
}
+ g_free(item);
}