Skip to content

Commit eb1581e

Browse files
Convert type into checkboxes instead of radio buttons
1 parent 9dbb69c commit eb1581e

File tree

2 files changed

+38
-54
lines changed

2 files changed

+38
-54
lines changed

pepv.ui

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -105,51 +105,6 @@
105105
<property name="top-attach">5</property>
106106
</packing>
107107
</child>
108-
<child>
109-
<object class="GtkRadioButton" id="typeRadioButtonAny">
110-
<property name="label" translatable="yes">Any</property>
111-
<property name="visible">True</property>
112-
<property name="can-focus">True</property>
113-
<property name="receives-default">False</property>
114-
<property name="active">True</property>
115-
<property name="draw-indicator">True</property>
116-
<property name="group">typeRadioButtonExplicit</property>
117-
</object>
118-
<packing>
119-
<property name="left-attach">1</property>
120-
<property name="top-attach">5</property>
121-
</packing>
122-
</child>
123-
<child>
124-
<object class="GtkRadioButton" id="typeRadioButtonExplicit">
125-
<property name="label" translatable="yes">Explicit</property>
126-
<property name="visible">True</property>
127-
<property name="can-focus">True</property>
128-
<property name="receives-default">False</property>
129-
<property name="active">True</property>
130-
<property name="draw-indicator">True</property>
131-
<property name="group">typeRadioButtonAny</property>
132-
</object>
133-
<packing>
134-
<property name="left-attach">1</property>
135-
<property name="top-attach">6</property>
136-
</packing>
137-
</child>
138-
<child>
139-
<object class="GtkRadioButton" id="typeRadioButtonDependency">
140-
<property name="label" translatable="yes">Dependency</property>
141-
<property name="visible">True</property>
142-
<property name="can-focus">True</property>
143-
<property name="receives-default">False</property>
144-
<property name="active">True</property>
145-
<property name="draw-indicator">True</property>
146-
<property name="group">typeRadioButtonAny</property>
147-
</object>
148-
<packing>
149-
<property name="left-attach">1</property>
150-
<property name="top-attach">7</property>
151-
</packing>
152-
</child>
153108
<child>
154109
<object class="GtkButton" id="applyFilters">
155110
<property name="label" translatable="yes">Apply filters</property>
@@ -454,6 +409,37 @@
454409
<property name="top-attach">22</property>
455410
</packing>
456411
</child>
412+
<child>
413+
<object class="GtkCheckButton" id="typeExplicit">
414+
<property name="label" translatable="yes">Explicit</property>
415+
<property name="visible">True</property>
416+
<property name="can-focus">True</property>
417+
<property name="receives-default">False</property>
418+
<property name="active">True</property>
419+
<property name="draw-indicator">True</property>
420+
</object>
421+
<packing>
422+
<property name="left-attach">1</property>
423+
<property name="top-attach">5</property>
424+
</packing>
425+
</child>
426+
<child>
427+
<object class="GtkCheckButton" id="typeDependency">
428+
<property name="label" translatable="yes">Dependency</property>
429+
<property name="visible">True</property>
430+
<property name="can-focus">True</property>
431+
<property name="receives-default">False</property>
432+
<property name="active">True</property>
433+
<property name="draw-indicator">True</property>
434+
</object>
435+
<packing>
436+
<property name="left-attach">1</property>
437+
<property name="top-attach">6</property>
438+
</packing>
439+
</child>
440+
<child>
441+
<placeholder/>
442+
</child>
457443
<child>
458444
<placeholder/>
459445
</child>

src/events.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ void populatePkgList() {
140140
static auto gSearchInName = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "searchInName"));
141141
static auto gSearchInDesc = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "searchInDesc"));
142142

143-
static auto gTypeRadioButtonAny = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "typeRadioButtonAny"));
144-
static auto gTypeRadioButtonExplicit = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "typeRadioButtonExplicit"));
145-
static auto gTypeRadioButtonDependency = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "typeRadioButtonDependency"));
143+
static auto gTypeExplicit = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "typeExplicit"));
144+
static auto gTypeDependency = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "typeDependency"));
146145

147146
static auto gShownPackages = GTK_LABEL(gtk_builder_get_object(builder, "shownPackages"));
148147
static auto gShownSize = GTK_LABEL(gtk_builder_get_object(builder, "shownSize"));
@@ -156,9 +155,8 @@ void populatePkgList() {
156155
const auto searchInName = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSearchInName));
157156
const auto searchInDesc = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSearchInDesc));
158157

159-
const auto typeAny = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gTypeRadioButtonAny));
160-
const auto typeExplicit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gTypeRadioButtonExplicit));
161-
const auto typeDependency = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gTypeRadioButtonDependency));
158+
const auto typeExplicit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gTypeExplicit));
159+
const auto typeDependency = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gTypeDependency));
162160

163161
const auto fromOfficial = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSourceOfficial));
164162
const auto fromAUR = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSourceAUR));
@@ -198,8 +196,8 @@ void populatePkgList() {
198196
if (!fromOfficial && !pkg.isLocal) continue;
199197
if (!fromAUR && pkg.isLocal) continue;
200198

201-
if (typeExplicit && pkg.reason != REASON_EXPLICIT) continue;
202-
if (typeDependency && pkg.reason != REASON_DEPEND) continue;
199+
if (pkg.reason == REASON_EXPLICIT && !typeExplicit) continue;
200+
if (pkg.reason == REASON_DEPEND && !typeDependency) continue;
203201

204202
if (!query.empty() && (searchInName || searchInDesc)) {
205203
bool foundQuery = false;
@@ -248,7 +246,7 @@ void populatePkgList() {
248246
gtk_label_set_label(gTotalPackages, totalStr.c_str());
249247

250248
static auto gTotalSize = GTK_LABEL(gtk_builder_get_object(builder, "totalSize"));
251-
const auto totalSizeStr = formattedSize(totalSize);
249+
const auto totalSizeStr = formattedSize(totalSize);
252250
gtk_label_set_label(gTotalSize, totalSizeStr.c_str());
253251

254252
static auto gTotalFiles = GTK_LABEL(gtk_builder_get_object(builder, "totalFiles"));

0 commit comments

Comments
 (0)