GTK4: web_context => network_session
This commit is contained in:
parent
f44bd92891
commit
90521e0a18
1
config.h
1
config.h
|
@ -42,6 +42,7 @@ You could also look into commit afe93518a for an approach using stand-in code.
|
||||||
"default-charset", "utf-8"
|
"default-charset", "utf-8"
|
||||||
#define DATA_DIR "/home/nuno/.cache/rosenrot"
|
#define DATA_DIR "/home/nuno/.cache/rosenrot"
|
||||||
#define DATA_MANAGER_OPTS "base-cache-directory", DATA_DIR, "base-data-directory", DATA_DIR
|
#define DATA_MANAGER_OPTS "base-cache-directory", DATA_DIR, "base-data-directory", DATA_DIR
|
||||||
|
#define NETWORK_SESSION_OPTS DATA_DIR, DATA_DIR
|
||||||
|
|
||||||
// GTK
|
// GTK
|
||||||
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
||||||
|
|
10
rosenrot4.c
10
rosenrot4.c
|
@ -138,8 +138,9 @@ WebKitWebView* create_new_webview()
|
||||||
{
|
{
|
||||||
char* style;
|
char* style;
|
||||||
WebKitSettings* settings;
|
WebKitSettings* settings;
|
||||||
WebKitWebContext* web_context;
|
// WebKitWebContext* web_context;
|
||||||
WebKitCookieManager* cookiemanager;
|
WebKitCookieManager* cookiemanager;
|
||||||
|
WebKitNetworkSession* network_session; // new
|
||||||
WebKitUserContentManager* contentmanager;
|
WebKitUserContentManager* contentmanager;
|
||||||
|
|
||||||
settings = webkit_settings_new_with_settings(WEBKIT_DEFAULT_SETTINGS, NULL);
|
settings = webkit_settings_new_with_settings(WEBKIT_DEFAULT_SETTINGS, NULL);
|
||||||
|
@ -150,9 +151,10 @@ WebKitWebView* create_new_webview()
|
||||||
"like Gecko) Chrome/120.0.0.0 Safari/537.3");
|
"like Gecko) Chrome/120.0.0.0 Safari/537.3");
|
||||||
// https://www.useragents.me
|
// https://www.useragents.me
|
||||||
}
|
}
|
||||||
web_context = webkit_web_context_new_with_website_data_manager(webkit_website_data_manager_new(DATA_MANAGER_OPTS, NULL));
|
network_session = webkit_network_session_new(DATA_DIR, DATA_DIR);
|
||||||
|
// web_context = webkit_web_context_new_with_website_data_manager(webkit_website_data_manager_new(DATA_MANAGER_OPTS, NULL));
|
||||||
contentmanager = webkit_user_content_manager_new();
|
contentmanager = webkit_user_content_manager_new();
|
||||||
cookiemanager = webkit_web_context_get_cookie_manager(web_context);
|
cookiemanager = webkit_network_session_get_cookie_manager(network_session);
|
||||||
|
|
||||||
webkit_cookie_manager_set_persistent_storage(cookiemanager, DATA_DIR "/cookies.sqlite", WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
|
webkit_cookie_manager_set_persistent_storage(cookiemanager, DATA_DIR "/cookies.sqlite", WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
|
||||||
|
|
||||||
|
@ -163,7 +165,7 @@ WebKitWebView* create_new_webview()
|
||||||
contentmanager, webkit_user_style_sheet_new(style, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, NULL, NULL));
|
contentmanager, webkit_user_style_sheet_new(style, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_object_new(WEBKIT_TYPE_WEB_VIEW, "settings", settings, "web-context", web_context, "user-content-manager", contentmanager, NULL);
|
return g_object_new(WEBKIT_TYPE_WEB_VIEW, "settings", settings, "network-session", network_session, "user-content-manager", contentmanager, NULL);
|
||||||
}
|
}
|
||||||
void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user