From 70e8cb880e0c6dc819645729c4182c68f980334e Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 11 Feb 2024 15:56:53 +0100 Subject: simplify plugins code a bit. --- makefile | 15 +++++++-------- rose.c | 25 +++++++++++-------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/makefile b/makefile index b30c3ce..90ae574 100644 --- a/makefile +++ b/makefile @@ -30,11 +30,10 @@ LIBRE_REDIRECT=./plugins/libre_redirect/libre_redirect.c ./plugins/libre_redirec CUSTOM_STYLES=./plugins/style/style.c READABILITY=./plugins/readability/readability.c SHORTCUTS=./plugins/shortcuts/shortcuts.c - STAND_IN=./plugins/stand_in/stand_in.c # gives function definitions for the above, which do nothing -PLUGS=$(LIBRE_REDIRECT) $(READABILITY) $(CUSTOM_STYLES) $(SHORTCUTS) -# PLUGS=$(STAND_IN) +PLUGINS=$(LIBRE_REDIRECT) $(READABILITY) $(CUSTOM_STYLES) $(SHORTCUTS) +# PLUGINS=$(STAND_IN) # Note that if you want some plugins but not others, # You should edit the stand_in.c file @@ -56,7 +55,7 @@ CURRENT_CACHE_DIR=/home/$(USER)/.cache/rose DEFAULT_DIR=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot CURRENT_DIR=`pwd` -build: $(SRC) $(PLUGS) $(CONFIG) +build: $(SRC) $(PLUGINS) $(CONFIG) # Recompute constants cd plugins/readability/ && sh recompute_READABILITY_N.sh cd plugins/style && sh recompute_STYLE_N.sh @@ -70,10 +69,10 @@ build: $(SRC) $(PLUGS) $(CONFIG) sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} + # Compile rosenrot GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/ - $(CC) $(WARNINGS) $(OPTIMIZED) $(DEBUG) $(INCS) $(PLUGS) $(SRC) -o rose $(LIBS) $(ADBLOCK) + $(CC) $(WARNINGS) $(OPTIMIZED) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rose $(LIBS) $(ADBLOCK) lint: - clang-tidy $(SRC) $(PLUGS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.0'` -o rose `pkg-config --libs 'webkit2gtk-4.0'` + clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.0'` -o rose `pkg-config --libs 'webkit2gtk-4.0'` inspect: build GTK_DEBUG=interactive ./rose @@ -96,5 +95,5 @@ clean: rm rose rm $(CACHE_DIR) -format: $(SRC) $(PLUGS) - $(FORMATTER) $(SRC) $(PLUGS) $(rose.h) +format: $(SRC) $(PLUGINS) + $(FORMATTER) $(SRC) $(PLUGINS) $(rose.h) diff --git a/rose.c b/rose.c index 1c8aa32..5b10a1d 100644 --- a/rose.c +++ b/rose.c @@ -18,25 +18,22 @@ static GtkEntryBuffer* bar_line_text; static enum { _SEARCH, _FIND, _HIDDEN } bar_entry_mode; /* Plugins */ -// #include "plugins/stand_in/stand_in.h" int LIBRE_REDIRECT_ENABLED = true; int READABILITY_ENABLED = true; int CUSTOM_STYLE_ENABLED = true; int CUSTOM_USER_AGENT = false; int NUM_TABS = 0; - -// To disable plugins: set their variable to false. -// To exise plugins: - -// 1. Enable them: -// - uncomment their #include statement -// - set their variable to true -// - in build.sh, uncomment: REQS= #./plugins/*/*.c -// 2. Remove stand_in code; -// - Add an #include "plugins/stand_in/stand_in.h" line, and modify -// stand_in.c so as to include stand-in functions for the excluded plugin -// - In the make file, include the stand_in.c file and exclude the -// relevant plugin +/* +To disable plugins: +1. set their corresponding variable to false +2. you could also look into this file at commit afe93518a for an approach using stand-in code. +3. recompile + +To remove plugins completely; +1. Remove the corresponding code in this file by looking for the variables above. +2. Remove PLUGIN and $(PLUGIN) from the makefiel +3. Recompile +*/ WebKitWebView* webview_new() { -- cgit v1.2.3