1
0
mirror of git://projects.qi-hardware.com/vido.git synced 2024-12-22 08:45:12 +02:00

create "loading" message

Signed-off-by: Mirko Lindner <mirko@sharism.cc>
This commit is contained in:
Mirko Lindner 2010-02-20 21:10:35 +01:00
parent 1d03169f6e
commit 024e25a62f

View File

@ -74,6 +74,21 @@ const zim::File& get_file()
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
void show_message(std::string title, std::string txt)
{
@ -100,10 +115,10 @@ void show_help()
// 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);
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_load_from_string(GTK_HTML(html_wg), ccontent.c_str(), -1);
current_url = url;
@ -131,12 +146,15 @@ void fill_gtkhtml(std::string& html, std::string url, std::string title){
while( Gtk::Main::events_pending() ){
Gtk::Main::iteration();
}
screenblock(0);
window2->connect_all();
}
void show_history()
{
screenblock(1);
std::string res, url, title;
res += "<ul style=\"list-style-type:none;\">";
@ -189,10 +207,13 @@ void history_jump(int jumper){
// // // externally called functions
// // display random article
void show_random()
{
// window2->disconnect_all();
screenblock(1);
log_debug("random called. window all disconnected");
zim::File m = get_file();
zim::Article article;
@ -219,6 +240,7 @@ void show_random()
position = 0;
fill_gtkhtml(res, article.getUrl(), article.getTitle());
log_debug("random called. window all connected");
}
// // display search dialog
@ -227,6 +249,7 @@ void search_window(main_window *window_x)
// html_color = html_color_new_from_rgb('255','0','0');
// gtk_html_set_color(GTK_HTML(html_wg),html_color);
search_dialog(window_x, " ");
}
// //
@ -313,7 +336,8 @@ void getArticleFromUrl(const gchar *url, int pos = 0)
// // test functions
void getArticleFromTitle(const gchar *phrase)
{
char ns;
screenblock(1);
char ns;
ns = 'A';
zim::File z = get_file();
@ -326,7 +350,7 @@ void getArticleFromTitle(const gchar *phrase)
if( result.size() == 0)
{
show_message("Error", "The article you requested (" + term + ") was not found.");
screenblock(0);
}else{
if (result.size() == 1){