예제 #1
0
파일: main.cpp 프로젝트: Klendathu/minichan
void getThreadData(Glib::RefPtr<Gtk::ListStore> m_threads_tree_model) {
	///Get the thread data as JSON, and then push it onto the ListStore given in m_threads_tree_model
	
	Gtk::Spinner *spin = 0;
	builder->get_widget("spinner1", spin);
	spin->set_visible(true);
	spin->show();
	
	Gtk::TreeView *tree = 0;
	builder->get_widget("treeview2", tree);
	tree->hide();
	tree->set_visible(false);
	Json::Value json = getThreads(BOARD);
	
	for(int j=0;j<json.size();++j) {
		Json::Value threads = json[j]["threads"];
		for(int i=0;i<threads.size();++i) {
			Gtk::TreeModel::Row row = *(m_threads_tree_model->append());
			
			ostringstream convert3;
			convert3 << threads[i]["replies"].asUInt();
			
			row[m_thread_list.text] = standardPostFormatting(threads[i])+"\n\n"+convert3.str()+" replies";
			row[m_thread_list.tim] = threads[i]["tim"].asString();
			row[m_thread_list.ext] = trim(threads[i]["ext"].asString());
			if(threads[i].isMember("filename")) {
				row[m_thread_list.fn] = threads[i]["filename"].asString();
			}
			
			ostringstream convert2;
			convert2 << threads[i]["no"].asInt();
			row[m_thread_list.no] = convert2.str();
		}
	}
	
	spin->hide();
	spin->set_visible(false);
	
	tree->show();
	tree->set_visible(true);
}
예제 #2
0
파일: main.cpp 프로젝트: Klendathu/minichan
void on_refresh_posts_clicked(Glib::RefPtr<Gtk::ListStore> m_threads_tree_model) {
	///To be executed when the refresh button is clicked while viewing a thread
	
	Gtk::Spinner *spin = 0;
	builder->get_widget("spinner1", spin);
	spin->show();
	spin->set_visible(true);
	
	Gtk::TreeView *tree = 0;
	builder->get_widget("treeview4", tree);
	tree->hide();
	tree->set_visible(false);
	
	m_threads_tree_model->clear();
	getPostData(m_threads_tree_model);
	webkit_web_view_load_uri(pWebKitView, "about:blank");
	
	spin->hide();
	spin->set_visible(false);
	
	tree->show();
	tree->set_visible(true);
}