mirror of
git://projects.qi-hardware.com/vido.git
synced 2024-12-22 19:18:38 +02:00
create "loading" message
Signed-off-by: Mirko Lindner <mirko@sharism.cc>
This commit is contained in:
parent
1d03169f6e
commit
024e25a62f
30
src/vido.cc
30
src/vido.cc
@ -74,6 +74,21 @@ const zim::File& get_file()
|
|||||||
return zimFile;
|
return zimFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void screenblock(int val){
|
||||||
|
|
||||||
|
if (val == 1){
|
||||||
|
scrolled_window2->remove();
|
||||||
|
scrolled_window2->add_label("loading");
|
||||||
|
}else if(val == 0){
|
||||||
|
scrolled_window2->remove();
|
||||||
|
scrolled_window2->add(*html);
|
||||||
|
}
|
||||||
|
while( Gtk::Main::events_pending() ){
|
||||||
|
Gtk::Main::iteration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// display message in gtk window
|
// display message in gtk window
|
||||||
void show_message(std::string title, std::string txt)
|
void show_message(std::string title, std::string txt)
|
||||||
{
|
{
|
||||||
@ -100,10 +115,10 @@ void show_help()
|
|||||||
|
|
||||||
// fill gtkhtml widget with new content
|
// fill gtkhtml widget with new content
|
||||||
|
|
||||||
void fill_gtkhtml(std::string& html, std::string url, std::string title){
|
void fill_gtkhtml(std::string& html_str, std::string url, std::string title){
|
||||||
log_debug("fill gtkhtml called with " << url << " and " << title);
|
log_debug("fill gtkhtml called with " << url << " and " << title);
|
||||||
std::string ccontent;
|
std::string ccontent;
|
||||||
ccontent = "<a name=\"top\"></a>" + html;
|
ccontent = "<a name=\"top\"></a>" + html_str;
|
||||||
gtk_html_flush(GTK_HTML(html_wg));
|
gtk_html_flush(GTK_HTML(html_wg));
|
||||||
gtk_html_load_from_string(GTK_HTML(html_wg), ccontent.c_str(), -1);
|
gtk_html_load_from_string(GTK_HTML(html_wg), ccontent.c_str(), -1);
|
||||||
current_url = url;
|
current_url = url;
|
||||||
@ -131,12 +146,15 @@ void fill_gtkhtml(std::string& html, std::string url, std::string title){
|
|||||||
while( Gtk::Main::events_pending() ){
|
while( Gtk::Main::events_pending() ){
|
||||||
Gtk::Main::iteration();
|
Gtk::Main::iteration();
|
||||||
}
|
}
|
||||||
|
screenblock(0);
|
||||||
|
|
||||||
window2->connect_all();
|
window2->connect_all();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_history()
|
void show_history()
|
||||||
{
|
{
|
||||||
|
screenblock(1);
|
||||||
std::string res, url, title;
|
std::string res, url, title;
|
||||||
res += "<ul style=\"list-style-type:none;\">";
|
res += "<ul style=\"list-style-type:none;\">";
|
||||||
|
|
||||||
@ -189,10 +207,13 @@ void history_jump(int jumper){
|
|||||||
|
|
||||||
// // // externally called functions
|
// // // externally called functions
|
||||||
|
|
||||||
|
|
||||||
// // display random article
|
// // display random article
|
||||||
void show_random()
|
void show_random()
|
||||||
{
|
{
|
||||||
// window2->disconnect_all();
|
// window2->disconnect_all();
|
||||||
|
|
||||||
|
screenblock(1);
|
||||||
log_debug("random called. window all disconnected");
|
log_debug("random called. window all disconnected");
|
||||||
zim::File m = get_file();
|
zim::File m = get_file();
|
||||||
zim::Article article;
|
zim::Article article;
|
||||||
@ -219,6 +240,7 @@ void show_random()
|
|||||||
position = 0;
|
position = 0;
|
||||||
fill_gtkhtml(res, article.getUrl(), article.getTitle());
|
fill_gtkhtml(res, article.getUrl(), article.getTitle());
|
||||||
log_debug("random called. window all connected");
|
log_debug("random called. window all connected");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // display search dialog
|
// // display search dialog
|
||||||
@ -227,6 +249,7 @@ void search_window(main_window *window_x)
|
|||||||
// html_color = html_color_new_from_rgb('255','0','0');
|
// html_color = html_color_new_from_rgb('255','0','0');
|
||||||
// gtk_html_set_color(GTK_HTML(html_wg),html_color);
|
// gtk_html_set_color(GTK_HTML(html_wg),html_color);
|
||||||
search_dialog(window_x, " ");
|
search_dialog(window_x, " ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
// //
|
||||||
@ -313,6 +336,7 @@ void getArticleFromUrl(const gchar *url, int pos = 0)
|
|||||||
// // test functions
|
// // test functions
|
||||||
void getArticleFromTitle(const gchar *phrase)
|
void getArticleFromTitle(const gchar *phrase)
|
||||||
{
|
{
|
||||||
|
screenblock(1);
|
||||||
char ns;
|
char ns;
|
||||||
ns = 'A';
|
ns = 'A';
|
||||||
zim::File z = get_file();
|
zim::File z = get_file();
|
||||||
@ -326,7 +350,7 @@ void getArticleFromTitle(const gchar *phrase)
|
|||||||
if( result.size() == 0)
|
if( result.size() == 0)
|
||||||
{
|
{
|
||||||
show_message("Error", "The article you requested (" + term + ") was not found.");
|
show_message("Error", "The article you requested (" + term + ") was not found.");
|
||||||
|
screenblock(0);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if (result.size() == 1){
|
if (result.size() == 1){
|
||||||
|
Loading…
Reference in New Issue
Block a user