Skip to content

Commit

Permalink
Tweak to color choose dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerryliu committed May 27, 2017
1 parent 5316302 commit 5f08d0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions legend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ using std::vector;
Legend::Legend(const vector<Device::sensor_reading> &sensor_readings,
unsigned int device_index, unsigned int type,
vector<Gdk::RGBA> &m_colors, Gtk::Window &cur_window)
: device_index(device_index), type(type), m_colors(m_colors),
cur_window(cur_window) {
: device_index(device_index), type(type), sensor_readings(sensor_readings),
m_colors(m_colors), cur_window(cur_window) {
m_legend.set_max_children_per_line(30);
m_legend.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE);
m_legend.set_homogeneous();
Expand Down Expand Up @@ -50,7 +50,8 @@ Legend::Legend(const vector<Device::sensor_reading> &sensor_readings,
}

void Legend::on_color_button_color_set(unsigned int i) {
Gtk::ColorChooserDialog dialog("Please choose a color");
Gtk::ColorChooserDialog dialog("Pick a color for \"" +
sensor_readings[i].name + "\"");
dialog.set_transient_for(cur_window);
dialog.set_rgba(m_colors[i]);
const int result = dialog.run();
Expand Down
2 changes: 2 additions & 0 deletions legend.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Legend {
private:
unsigned int device_index;
unsigned int type;
vector<Device::sensor_reading> sensor_readings;

vector<std::shared_ptr<Gtk::Label>> m_labels;
vector<std::shared_ptr<Gtk::Button>> m_color_buttons;
vector<std::shared_ptr<Gtk::Label>> m_color_labels;
Expand Down

0 comments on commit 5f08d0f

Please sign in to comment.