From: Daniel Carl Date: Sun, 11 May 2014 21:01:56 +0000 (+0200) Subject: Removed no more needed session.c. X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=f9f66df79faf85062eb575f6087a8dca87aa6b8a;p=vimb.git Removed no more needed session.c. The two remaining function are moved into main.c. --- diff --git a/src/main.c b/src/main.c index 09cbfb7..4ddaafb 100644 --- a/src/main.c +++ b/src/main.c @@ -28,7 +28,7 @@ #include "hints.h" #include "shortcut.h" #include "history.h" -#include "session.h" +#include "cookiejar.h" #include "hsts.h" #include "mode.h" #include "normal.h" @@ -89,6 +89,8 @@ static void marks_clear(void); static void read_config(void); static void setup_signals(); static void init_files(void); +static void session_init(void); +static void session_cleanup(void); static gboolean hide_message(); static void set_status(const StatusType status); static void input_print(gboolean force, const MessageType type, gboolean hide, const char *message); @@ -923,6 +925,34 @@ static void init_files(void) g_free(path); } +static void session_init(void) +{ + /* init soup session */ + vb.session = webkit_get_default_session(); + g_object_set(vb.session, "max-conns", SETTING_MAX_CONNS , NULL); + g_object_set(vb.session, "max-conns-per-host", SETTING_MAX_CONNS_PER_HOST, NULL); + g_object_set(vb.session, "accept-language-auto", true, NULL); + +#ifdef FEATURE_COOKIE + SoupCookieJar *cookie = cookiejar_new(vb.files[FILES_COOKIE], false); + soup_session_add_feature(vb.session, SOUP_SESSION_FEATURE(cookie)); + g_object_unref(cookie); +#endif +#ifdef FEATURE_HSTS + HSTSProvider *hsts = hsts_provider_new(); + soup_session_add_feature(vb.session, SOUP_SESSION_FEATURE(hsts)); + g_object_unref(hsts); +#endif +} + +static void session_cleanup(void) +{ +#ifdef FEATURE_HSTS + /* remove feature from session to make sure the feature is finalized */ + soup_session_remove_feature_by_type(vb.session, HSTS_TYPE_PROVIDER); +#endif +} + static gboolean button_relase_cb(WebKitWebView *webview, GdkEventButton *event) { gboolean propagate = false; diff --git a/src/session.c b/src/session.c deleted file mode 100644 index 9c63859..0000000 --- a/src/session.c +++ /dev/null @@ -1,59 +0,0 @@ -/** - * vimb - a webkit based vim like browser. - * - * Copyright (C) 2012-2014 Daniel Carl - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ - -#include "config.h" -#include "main.h" -#include "session.h" -#ifdef FEATURE_COOKIE -#include "cookiejar.h" -#endif -#ifdef FEATURE_HSTS -#include "hsts.h" -#endif - -extern VbCore vb; - - -void session_init(void) -{ - /* init soup session */ - vb.session = webkit_get_default_session(); - g_object_set(vb.session, "max-conns", SETTING_MAX_CONNS , NULL); - g_object_set(vb.session, "max-conns-per-host", SETTING_MAX_CONNS_PER_HOST, NULL); - g_object_set(vb.session, "accept-language-auto", true, NULL); - -#ifdef FEATURE_COOKIE - SoupCookieJar *cookie = cookiejar_new(vb.files[FILES_COOKIE], false); - soup_session_add_feature(vb.session, SOUP_SESSION_FEATURE(cookie)); - g_object_unref(cookie); -#endif -#ifdef FEATURE_HSTS - HSTSProvider *hsts = hsts_provider_new(); - soup_session_add_feature(vb.session, SOUP_SESSION_FEATURE(hsts)); - g_object_unref(hsts); -#endif -} - -void session_cleanup(void) -{ -#ifdef FEATURE_HSTS - /* remove feature from session to make sure the feature is finalized */ - soup_session_remove_feature_by_type(vb.session, HSTS_TYPE_PROVIDER); -#endif -} diff --git a/src/session.h b/src/session.h deleted file mode 100644 index dcc4cf7..0000000 --- a/src/session.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * vimb - a webkit based vim like browser. - * - * Copyright (C) 2012-2014 Daniel Carl - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ - -#ifndef _SESSION_H -#define _SESSION_H - -void session_init(void); -void session_cleanup(void); - -#endif /* end of include guard: _SESSION_H */