Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions common/rpackagefilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,15 @@ void RPatternPackageFilter::addPattern(DepType type, string pattern,

bool RPatternPackageFilter::write(ofstream &out, string pad)
{
DepType type;
string pat;
bool excl;

out << pad + "andMode " << and_mode << ";" << endl;

out << pad + "patterns {" << endl;

for (int i = 0; i < count(); i++) {
for (size_t i = 0; i < count(); i++) {
DepType type;
string pat;
bool excl;
getPattern(i, type, pat, excl);
out << pad + " " + TypeName[(int)type] + ";"
<< " \"" << pat << "\"; " << (excl ? "true;" : "false;") << endl;
out << pad + " " + TypeName[(int)type] + ";" << " \"" << pat << "\"; " << (excl ? "true;" : "false;") << endl;
}

out << pad + "};" << endl;
Expand Down
10 changes: 7 additions & 3 deletions common/rpackagefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,17 @@ class RPatternPackageFilter : public RPackageFilter {
inline virtual const char *type() { return RPFPattern; }

void addPattern(DepType type, std::string pattern, bool exclusive);
inline int count() { return _patterns.size(); }
inline void getPattern(int index, DepType &type, std::string &pattern,
bool &exclusive) {

inline size_t count() {
return _patterns.size();
}

inline void getPattern(size_t index, DepType &type, std::string &pattern, bool &exclusive) {
type = _patterns[index].where;
pattern = _patterns[index].pattern;
exclusive = _patterns[index].exclusive;
}

void clear();
bool getAndMode() { return and_mode; }
void setAndMode(bool b) { and_mode=b; }
Expand Down
21 changes: 9 additions & 12 deletions gtk/rgfiltermanager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -651,24 +651,21 @@ bool RGFilterManagerWindow::setPatternRow(int row,

void RGFilterManagerWindow::setPatternFilter(RPatternPackageFilter &f)
{
//cout << "RGFilterEditor::setPatternFilter()"<<endl;

gtk_list_store_clear(_patternListStore);
for (int i = 0; i < f.count(); i++) {

for (size_t i = 0; i < f.count(); i++) {
RPatternPackageFilter::DepType type;
string pattern, s;
string pattern;
bool exclude;
f.getPattern(i, type, pattern, exclude);
setPatternRow(-1, exclude, type, utf8(pattern.c_str()));
}
if(f.getAndMode())
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(gtk_builder_get_object(_builder,
"radiobutton_properties_and")), TRUE);
else
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(gtk_builder_get_object(_builder,
"radiobutton_properties_or")), TRUE);

if (f.getAndMode()) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(_builder, "radiobutton_properties_and")), TRUE);
} else {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(_builder, "radiobutton_properties_or")), TRUE);
}
}

void RGFilterManagerWindow::getSectionFilter(RSectionPackageFilter & f)
Expand Down