diff --git a/source/ublexec.cc b/source/ublexec.cc index f373191..9d14402 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -447,8 +447,39 @@ void MainWindow::get_path_filemaneg() { this->denamic_cmd(); } +vector MainWindow::find_all(string &text, string &word) { + size_t index{}; + vector list_index; + while ((index = text.find(word, index)) != std::string::npos) + { + index += word.length(); + list_index.push_back(index); + } + return list_index; +} + void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::RefPtr &dtk_list) { Gtk::TreeModel::Row row = *(dtk_list->append()); + string s_remove[] = {".png", ".jpg", ".jpeg", ".svg"}; + string str_search = "/"; + if (path.find(str_search) != string::npos){ + vector list_index = this->find_all(path, str_search); + int index = list_index.size(); + if (index>1){ + index = index-1; + index = list_index.at(index); + if (index){ + size_t len_path = path.length(); + path = path.substr(index, len_path); + } + } + } + for (string &del: s_remove){ + if (path.find(del) != string::npos){ + str_remove(path, del); + } + } + row[m_Columns.m_col_filename] = path; row[m_Columns.m_col_description] = Name; row[m_Columns.icon_name] = path; diff --git a/source/ublexec.h b/source/ublexec.h index 93c41ce..2a229f8 100755 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -88,6 +88,7 @@ public: void denamic_cmd(); void is_user_wheel(); void sudo_nice(); + vector find_all(string &text, string &word); bool focus_out_txt_cmd(GdkEventFocus* event); bool focus_in_txt_cmd(GdkEventFocus* event); void unselect_icon(Gtk::IconView *icon_entry); diff --git a/ublexec.glade b/ublexec.glade index badb58e..deacc94 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -1082,10 +1082,10 @@ specified priority False vertical - + True False - start + baseline 5 5 5 @@ -1285,7 +1285,7 @@ specified priority - False + True True 0 @@ -1304,16 +1304,16 @@ specified priority 5 vertical - + True False - start + baseline 5 5 5 5 0.019999999552965164 - none + in True @@ -1484,7 +1484,7 @@ specified priority - False + True True 0 @@ -1503,10 +1503,10 @@ specified priority 5 vertical - + True False - start + baseline 5 5 5 @@ -1719,7 +1719,7 @@ specified priority - False + True True 0 @@ -1827,6 +1827,14 @@ specified priority + + + + + + + + False Внимание!