Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft add config options to hide applications and games #41

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevenhoving
Copy link
Contributor

@stevenhoving stevenhoving commented Nov 4, 2023

This is just a prototype for #40, do not merge

@stevenhoving stevenhoving changed the title draft add config options to hide applications and games #40 draft add config options to hide applications and games Nov 4, 2023
@stevenhoving stevenhoving changed the title #40 draft add config options to hide applications and games draft add config options to hide applications and games Nov 4, 2023
@stevenhoving stevenhoving force-pushed the hide-applications-and-games-options branch from 0d5bca3 to ecae073 Compare November 4, 2023 13:02
@Apaczer Apaczer linked an issue Nov 5, 2023 that may be closed by this pull request
@Apaczer
Copy link
Member

Apaczer commented Nov 5, 2023

Hi @stevenhoving,
Thanks for your last contribute and future attemps. You said you will be maintainer of device but still you prefer to leave "Settings" sections rather than "Games", which dosen't resonate much with what you've said.
Apart from that you can hide unnecessary stuff by prefixing dot (.) in name of section/file/appLink which follows general Linux Hidden rule.
I have in backlog to add an option to "Show Hidden" but this should also include editLink entry with "Hide\Unhide" or just simplier a rename option for links.

To show all in filebrowser and menu it just requies to disable part of code:

commit cdd089b4eaf4cdab2f3c8dfe11852dde41636b7f
Author: Apaczer <[email protected]>
Date:   Sat Nov 4 20:42:12 2023 +0100

    show hidden files in Explorer and Menu

diff --git a/src/filelister.cpp b/src/filelister.cpp
index 173c406..9daa11a 100644
--- a/src/filelister.cpp
+++ b/src/filelister.cpp
@@ -57,7 +57,7 @@ void FileLister::browse() {
 
 		while (++i < n) {
 			string file = dptr[i]->d_name;
-			if (file[0] == '.' || (find(excludes.begin(), excludes.end(), file) != excludes.end()))
+			if (/*file[0] == '.' || */(find(excludes.begin(), excludes.end(), file) != excludes.end()))
 				continue;
 
 			if (!((dptr[i]->d_type & DT_REG) || (dptr[i]->d_type & DT_DIR))) {
diff --git a/src/menu.cpp b/src/menu.cpp
index 9ba4b03..7383f3a 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -62,9 +62,9 @@ void Menu::readSections() {
 	links.clear();
 
 	while ((dptr = readdir(dirp))) {
-		if (dptr->d_name[0] == '.') {
+		/*if (dptr->d_name[0] == '.') {
 			continue;
-		}
+		}*/
 
 		string filepath = (string)"sections/" + dptr->d_name;
 		if (dir_exists(filepath)) {
@@ -99,9 +99,9 @@ void Menu::readLinks() {
 		}
 
 		while ((dptr = readdir(dirp))) {
-			if (dptr->d_name[0] == '.') {
+			/*if (dptr->d_name[0] == '.') {
 				continue;
-			}
+			}*/
 			string filepath = sectionPath(i) + dptr->d_name;
 			if (filepath.substr(filepath.size() - 5, 5) == "-opkg") {
 				continue;

/* To keep things simple, we will always create the applications section */
if (gmenu2x->hideSectionApplications)
{
auto itr = std::find(sections.begin(), sections.end(), "applications");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are within std namespace, so I think no need for std::

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don't want to go into a theological discussion about using namespace std;. It has been my personal style to never omit std::. Of course I have to adjust my personal coding style to the coding style of the project I contribute to. So I will of course remove std:: there.

sections.erase(itr);
}

if (gmenu2x->hideSectionGames)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now that section Apps\Settings is always created if nonexistent, so maybe we could add simply a setting to hide them if requested (still I see no reason to hide Games). On a second look we could check if it's prefixed with dot (.) and then hide - would be useful in the long run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configuration option to hide application and games sections
2 participants