Horizon
pool_cache_box.hpp
1 #pragma once
2 #include <gtkmm.h>
3 #include <set>
4 #include <mutex>
5 #include "util/uuid.hpp"
6 #include "common/common.hpp"
7 #include "nlohmann/json.hpp"
8 #include "pool/pool_cache_status.hpp"
9 #include "util/pool_goto_provider.hpp"
10 
11 namespace horizon {
12 using json = nlohmann::json;
13 
14 class PoolCacheBox : public Gtk::Box, public PoolGotoProvider {
15 public:
16  PoolCacheBox(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class PoolProjectManagerApplication *app,
17  class PoolNotebook *nb, class IPool &pool);
18  static PoolCacheBox *create(class PoolProjectManagerApplication *app, class PoolNotebook *nb, class IPool &pool);
19 
20  bool refreshed_once = false;
21  void refresh_status();
22 
23 private:
24  class PoolProjectManagerApplication *app = nullptr;
25  class PoolNotebook *notebook = nullptr;
26  IPool &pool;
27 
28  void selection_changed();
29  void update_from_pool();
30  void cleanup();
31  void refresh_list(const class PoolCacheStatus &status);
32 
33  Gtk::TreeView *pool_item_view = nullptr;
34  Gtk::Stack *stack = nullptr;
35  Gtk::TextView *delta_text_view = nullptr;
36  Gtk::Button *update_from_pool_button = nullptr;
37  Gtk::Label *status_label = nullptr;
38 
39  class TreeColumns : public Gtk::TreeModelColumnRecord {
40  public:
41  TreeColumns()
42  {
43  Gtk::TreeModelColumnRecord::add(name);
44  Gtk::TreeModelColumnRecord::add(type);
45  Gtk::TreeModelColumnRecord::add(state);
46  Gtk::TreeModelColumnRecord::add(item);
47  }
48  Gtk::TreeModelColumn<Glib::ustring> name;
49  Gtk::TreeModelColumn<ObjectType> type;
50  Gtk::TreeModelColumn<PoolCacheStatus::Item::State> state;
51  Gtk::TreeModelColumn<PoolCacheStatus::Item> item;
52  };
53  TreeColumns tree_columns;
54 
55  Glib::RefPtr<Gtk::ListStore> item_store;
56 };
57 } // namespace horizon
Definition: ipool.hpp:14
Definition: pool_cache_box.hpp:14
Definition: pool_cache_status.hpp:11
Definition: pool_goto_provider.hpp:7
Definition: pool_notebook.hpp:20
Definition: pool-prj-mgr-app.hpp:16
a class to store JSON values
Definition: json.hpp:177
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62