pull/35/head
Igor Belitskiy 3 years ago
parent abbf4c1e68
commit 8fcd9880a5

@ -9,5 +9,7 @@
#define path_css "/usr/share/ublexec/css/ublexec.css" #define path_css "/usr/share/ublexec/css/ublexec.css"
#define app_name "ublexec" #define app_name "ublexec"
#define path_img_head_background "/usr/share/ublexec/images/logo-background.png" #define path_img_head_background "/usr/share/ublexec/images/logo-background.png"
#define path_all_applications "/usr/share/applications/"
#define file_source_login_min_max "/etc/login.defs"
#endif #endif

@ -954,8 +954,8 @@ unsigned short MainWindow::read_uid_min_max(string filename, string search){
} }
void MainWindow::pars_users() { void MainWindow::pars_users() {
unsigned short uid_min = this->read_uid_min_max("/etc/login.defs", "UID_MIN"); unsigned short uid_min = this->read_uid_min_max(file_source_login_min_max, "UID_MIN");
unsigned short uid_max = this->read_uid_min_max("/etc/login.defs", "UID_MAX"); unsigned short uid_max = this->read_uid_min_max(file_source_login_min_max, "UID_MAX");
while (true) { while (true) {
errno = 0; errno = 0;
passwd* entry = getpwent(); passwd* entry = getpwent();
@ -996,10 +996,10 @@ void MainWindow::pars_apps() {
struct struct_App App; struct struct_App App;
string file_name = ""; string file_name = "";
string str_Categories; string str_Categories;
string path = "/usr/share/applications/"; string path = path_all_applications;
for (const auto & entry : fs::directory_iterator(path)) { for (const auto & entry : fs::directory_iterator(path)) {
file_name = entry.path().filename().string(); file_name = entry.path().filename().string();
path = "/usr/share/applications/"+file_name; path = string(path_all_applications) +file_name;
if (file_name.find(".desktop") != std::string::npos) { if (file_name.find(".desktop") != std::string::npos) {
GKeyFile *gfile=g_key_file_new(); GKeyFile *gfile=g_key_file_new();
g_key_file_load_from_file(gfile, path.c_str(), G_KEY_FILE_KEEP_TRANSLATIONS, NULL); g_key_file_load_from_file(gfile, path.c_str(), G_KEY_FILE_KEEP_TRANSLATIONS, NULL);

Loading…
Cancel
Save