Skip to content

Commit

Permalink
Parallel save instead of waiting for it to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
DisableGraphics committed Apr 28, 2022
1 parent e43755c commit 2d9841c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ korai:
#-----------------------------------------------------
# BUILDING KORAI
#-----------------------------------------------------
mkdir -p build & g++ src/main.cpp `pkg-config gtkmm-3.0 --libs --cflags` `pkg-config webkit2gtk-4.0 --libs --cflags` `pkg-config vte-2.91 --libs --cflags` -DDOWNLOAD -larchive -O3 -std=c++17 -o build/korai
mkdir -p build & g++ src/main.cpp `pkg-config gtkmm-3.0 --libs --cflags` `pkg-config webkit2gtk-4.0 --libs --cflags` `pkg-config vte-2.91 --libs --cflags` -DDOWNLOAD -larchive -pthread -O3 -std=c++17 -o build/korai

korai-nodownload:
#-----------------------------------------------------
# BUILDING KORAI-NODOWNLOAD
#-----------------------------------------------------
mkdir -p build & g++ src/main.cpp `pkg-config gtkmm-3.0 --libs --cflags` `pkg-config webkit2gtk-4.0 --libs --cflags` -larchive -O3 -std=c++17 -o build/korai-nodownload
mkdir -p build & g++ src/main.cpp `pkg-config gtkmm-3.0 --libs --cflags` `pkg-config webkit2gtk-4.0 --libs --cflags` -larchive -pthread -O3 -std=c++17 -o build/korai-nodownload

16 changes: 11 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "strnatcmp.hpp"
#include "zipextract.hpp"
#include "comp.hpp"
#include <thread>

#ifdef DOWNLOAD
#include <vte-2.91/vte/vte.h>
Expand Down Expand Up @@ -299,7 +300,8 @@ void next_chapter(WebKitWebView * webView, Gtk::HeaderBar * titleBar)
titleBar->set_subtitle(getMangaName() + " - " + getChapterName());
gtk_widget_grab_focus(GTK_WIDGET(webView));
}
save();
std::thread t(save);
t.detach();
}
else if(position == -2)
{
Expand Down Expand Up @@ -339,7 +341,8 @@ void previous_chapter(WebKitWebView * webView, Gtk::HeaderBar * titleBar)
titleBar->set_subtitle(getMangaName() + " - " + getChapterName());
gtk_widget_grab_focus(GTK_WIDGET(webView));
}
save();
std::thread t(save);
t.detach();
}
else if (position == -2)
{
Expand Down Expand Up @@ -384,7 +387,8 @@ void open(WebKitWebView * webview, Gtk::HeaderBar * titlebar)
open_chapter(webview);
titlebar->set_subtitle(getMangaName() + " - " + getChapterName());
gtk_widget_grab_focus(GTK_WIDGET(webview));
save();
std::thread t(save);
t.detach();
break;
}
}
Expand Down Expand Up @@ -452,7 +456,8 @@ void delete_manga(WebKitWebView * webview, Gtk::HeaderBar * headbar, Gtk::Popove
load_homepage(webview);
}
}
save();
std::thread t(save);
t.detach();
}
}

Expand All @@ -467,7 +472,8 @@ void close_manga(WebKitWebView * webView, Gtk::HeaderBar * headbar, Gtk::Popover
position = -1;
headbar->set_subtitle("");

save();
std::thread t(save);
t.detach();

load_homepage(webView);
menu->hide();
Expand Down

0 comments on commit 2d9841c

Please sign in to comment.