Skip to content

Commit

Permalink
No need for copy_button param
Browse files Browse the repository at this point in the history
  • Loading branch information
dpedu committed Mar 14, 2017
1 parent 13b18a1 commit 91bf4b9
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions item_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class ItemView : public Gtk::Grid {
}

void processSingleField(const KeychainField& field) {
processSingleField(field.name, field.value, field.password, true);
processSingleField(field.name, field.value, field.password);
}

void processSingleField(std::string label, std::string value, bool conceal, bool copy_button) {
void processSingleField(std::string label, std::string value, bool conceal) {
auto my_index = row_index++;

auto label_widget = Gtk::manage(new Gtk::Label(label));
Expand All @@ -81,18 +81,16 @@ class ItemView : public Gtk::Grid {

if (conceal && !isTOTP)
value_widget->set_visibility(false);
attach(*value_widget, 1, my_index, conceal || copy_button ? 1 : 3, 1);

if (copy_button) {
auto copy_button = Gtk::manage(new Gtk::Button("_Copy", true));
copy_button->signal_clicked().connect([value_widget]() {
auto valueText = value_widget->get_text();
auto clipboard = Gtk::Clipboard::get();
clipboard->set_text(valueText);
clipboard->store();
});
attach(*copy_button, 2, my_index, 1, 1);
}
attach(*value_widget, 1, my_index, 1, 1);

auto copy_button = Gtk::manage(new Gtk::Button("_Copy", true));
copy_button->signal_clicked().connect([value_widget]() {
auto valueText = value_widget->get_text();
auto clipboard = Gtk::Clipboard::get();
clipboard->set_text(valueText);
clipboard->store();
});
attach(*copy_button, 2, my_index, 1, 1);

if (conceal) {
if (isTOTP) {
Expand Down

0 comments on commit 91bf4b9

Please sign in to comment.