[Debtags-commits] [svn] r2042 - in debtags-edit/1.2: . src
Enrico Zini
enrico at alioth.debian.org
Wed Nov 1 02:17:58 CET 2006
Author: enrico
Date: Wed Nov 1 02:17:57 2006
New Revision: 2042
Modified:
debtags-edit/1.2/ (props changed)
debtags-edit/1.2/src/AddButtons.h
debtags-edit/1.2/src/TagSelector.cc
Log:
r3590 at viaza: enrico | 2006-11-01 02:17:32 +0100
Only show companion tags in the tag selector, as it was before
Modified: debtags-edit/1.2/src/AddButtons.h
==============================================================================
--- debtags-edit/1.2/src/AddButtons.h (original)
+++ debtags-edit/1.2/src/AddButtons.h Wed Nov 1 02:17:57 2006
@@ -94,6 +94,45 @@
}
template<typename Doc, typename Sel>
+class AddCompanionButton : public AddButton<Doc>
+{
+protected:
+ typedef typename Doc::Facet Facet;
+ typedef typename Doc::Tag Tag;
+ typedef typename Doc::Package Package;
+
+ virtual bool invoke(GdkEvent* e)
+ {
+ if (e->type == GDK_BUTTON_PRESS)
+ {
+ TagMenu<Doc>* addMenu = manage(new TagMenu<Doc>());
+ if (this->doc.getComputeIntensive())
+ {
+ addMenu->populateAvailableSmart(this->doc, this->sel.currentTags(), this->doc.subCollection);
+ } else {
+ addMenu->populateAvailable(this->doc, this->sel.currentTags(), this->doc.subCollection);
+ }
+ addMenu->signal_selected().connect(sigc::mem_fun(*this, &AddCompanionButton<Doc, Sel>::do_selected));
+ addMenu->popup(e->button.button, e->button.time);
+ return true;
+ }
+ return false;
+ }
+
+ const Sel& sel;
+
+public:
+ AddCompanionButton(Doc& doc, const Sel& sel, const std::string& label)
+ : AddButton<Doc>(doc, label), sel(sel) {}
+};
+
+template<typename Doc, typename Sel>
+AddCompanionButton<Doc, Sel>* newAddCompanionButton(Doc& doc, const Sel& sel, const std::string& label)
+{
+ return new AddCompanionButton<Doc, Sel>(doc, sel, label);
+}
+
+template<typename Doc, typename Sel>
class AddDiscriminantButton : public AddButton<Doc>
{
protected:
Modified: debtags-edit/1.2/src/TagSelector.cc
==============================================================================
--- debtags-edit/1.2/src/TagSelector.cc (original)
+++ debtags-edit/1.2/src/TagSelector.cc Wed Nov 1 02:17:57 2006
@@ -186,7 +186,7 @@
Gtk::HBox* hbox = manage(new Gtk::HBox());
pack_start(*hbox, false, false);
- AddButton<DebtagsDocument>* add = newAddAllButton(doc, *this, "Add");
+ AddButton<DebtagsDocument>* add = newAddCompanionButton(doc, *this, "Add");
manage(add);
hbox->pack_start(*add, true, true);
add->signal_selected().connect(sigc::mem_fun(*this, &TagSelector::on_add_to_selection));
More information about the Debtags-commits
mailing list