Добавлен iconView для графики в кнопки приложения

pull/1/head
Igor Belitskiy 3 years ago
parent ff979ab71d
commit 35cff5a54e

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 33 KiB

@ -106,22 +106,20 @@ void MainWindow::get_builder(){
builder->get_widget("lblOffice", lblOffice);
builder->get_widget("lblOther", lblOther);
builder->get_widget("lblDevelopment", lblDevelopment);
builder->get_widget("iconGraphics", iconGraphics);
builder->get_widget("lblSystem", lblSystem);
/*
builder->get_widget("iconGraphics", iconGraphics);
builder->get_widget("iconTools", iconTools);
builder->get_widget("iconInternet", iconInternet);
builder->get_widget("iconMultimedia", iconMultimedia);
builder->get_widget("iconSettings", iconSettings);
builder->get_widget("iconEducation", iconEducation);
builder->get_widget("iconOffice", iconOffice);
builder->get_widget("iconOther", iconOther);
builder->get_widget("iconDevelopment", iconDevelopment);
builder->get_widget("iconSystem", iconSystem);
*/
builder->get_widget("treeViewGraphics", treeViewGraphics);
list_Graphics = Gtk::ListStore::create( m_Columns );
list_Graphics->set_sort_column( m_Columns.m_col_description, Gtk::SORT_ASCENDING );
iconGraphics->set_model(list_Graphics);
iconGraphics->set_markup_column(m_Columns.m_col_description);
iconGraphics->set_pixbuf_column(m_Columns.m_col_pixbuf);
}
@ -249,6 +247,9 @@ void MainWindow::open_list_app(){
for ( const auto &str_categor : str_app.Categories){
path = "/usr/share/applications/" + str_app.Icon + ".svg";
if (str_categor=="Graphics"){
Gtk::TreeModel::Row row = *(list_Graphics->append());
row[m_Columns.m_col_filename] = path;
row[m_Columns.m_col_description] = str_app.Name;
}
else if (str_categor=="Tools"){
@ -280,41 +281,51 @@ void MainWindow::open_list_app(){
}
}
/*
for (const auto & str_categor : set_categories){
Gtk::Label* Label1 = new Gtk::Label(str_categor);
Gtk::IconView* icon = new Gtk::IconView();
boxlistProgramm->pack_start(*icon);
boxlistProgramm->pack_start(*Label1);
}*/
dialogStartMenu->show_all();
}
/*
void MainWindow::tmp_desktop(string cmd_name){
string desktop = "";
desktop = "[Desktop Entry]\nEncoding=UTF-8\nName=test\nName[ru]=тест\nGenericName=test\nGenericName[ru]=тест\nComment=test\nComment[ru]=test\nType=Application\nExec=pkexec "+cmd_name +
"\nIcon=ublexec\nTerminal=false\nCategories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;";
string cmd = "";
cmd = "touch /tmp/" + cmd_name + ".desktop; echo \"" + desktop + "\" > /tmp/"+cmd_name+".desktop; chmod +x /tmp/"+cmd_name+".desktop";
cout << cmd << endl;
system(cmd.c_str());
}
*/
void MainWindow::start_cmd(){
//txtCmd->set_text("");
string str_cmd_terminal="";
string str_variants_root = "";
string str_nice_cmd = "";
string user_cmd = "";
user_cmd = txtCmd->get_text();
//=========================================
if (chbAnotherUser->get_active()){
if (geteuid()!=0){
chbTerminal->set_active(true);
}
if (rbPkexec->get_active()){
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
//this->tmp_desktop(user_cmd);
}
else if (chbAnotherUser->get_active()){
str_variants_root = "pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
}
else{
str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
//this->tmp_desktop(user_cmd);
//user_cmd = "/tmp/" + user_cmd + ".desktop";
}
}
else if (rbSu->get_active()){
if (geteuid()!=0){
chbTerminal->set_active(true);
}
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
str_variants_root="su ";
}
@ -326,9 +337,6 @@ void MainWindow::start_cmd(){
}
}
else if (rbSudo->get_active()){
if (geteuid()!=0){
chbTerminal->set_active(true);
}
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
str_variants_root="sudo ";
}
@ -346,7 +354,6 @@ void MainWindow::start_cmd(){
//=========================================
string user_cmd = txtCmd->get_text();
//=========================================
if (user_cmd.length()==0){
messageError->show();
@ -360,10 +367,12 @@ void MainWindow::start_cmd(){
}
string cmd = "";
if (path_file!=""){
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + user_cmd + "' &";
}
else{
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd + " &";
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd + " &";
}
txtCmd->set_text(cmd);
system(cmd.c_str());

@ -85,21 +85,27 @@ public:
void pars_dir_bin();
void pars_users();
void pars_apps();
void tmp_desktop(string cmd_name);
vector<std::string> split(const std::string &s, char delim);
public:
class ModelColumns : public Gtk::TreeModel::ColumnRecord
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{ add(m_col_id); add(m_col_name); }
Gtk::TreeModelColumn<int> m_col_id;
Gtk::TreeModelColumn<Glib::ustring> m_col_name;
{
add(m_col_filename);
add(m_col_description);
add(m_col_pixbuf);
}
Gtk::TreeModelColumn<std::string> m_col_filename;
Gtk::TreeModelColumn<Glib::ustring> m_col_description;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_col_pixbuf;
};
ModelColumns m_Columns;
ModelColumns m_Columns;
public:
Glib::RefPtr<Gtk::Builder> builder;
Gtk::Button *btnFilemaneg;
@ -152,12 +158,10 @@ public:
Gtk::Label *lblOther;
Gtk::Label *lblDevelopment;
Gtk::Label *lblSystem;
Gtk::IconView *iconGraphics;
Gtk::TreeView *treeViewGraphics=0;
Glib::RefPtr<Gtk::TreeStore> tree_store;
Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
Glib::RefPtr<Gtk::ListStore> list_Graphics;

@ -10,7 +10,7 @@
</object>
<object class="GtkDialog" id="dialogStartMenu">
<property name="width-request">250</property>
<property name="height-request">470</property>
<property name="height-request">250</property>
<property name="can-focus">False</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
@ -107,19 +107,10 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledGraphics">
<object class="GtkIconView" id="iconGraphics">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="treeViewGraphics">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">False</property>
@ -148,18 +139,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledTools">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -189,18 +173,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledInternet">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -230,18 +207,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledMultimedia">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -271,18 +241,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledSettings">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -312,18 +275,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledEducation">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -353,18 +309,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledOffice">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -394,18 +343,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledOther">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -435,18 +377,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledDevelopment">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -476,18 +411,11 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledSystem">
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
<packing>
@ -583,9 +511,9 @@
<property name="label" translatable="yes">Запуск приложений от имени пользователя с
указанным приоритетом</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="font-desc" value="URW Gothic Semi-Bold 10"/>
<attribute name="foreground" value="#000023233232"/>
<attribute name="size" value="12288"/>
<attribute name="size" value="14336"/>
</attributes>
</object>
<packing>
@ -675,6 +603,7 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">end</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
@ -706,6 +635,7 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">end</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -1106,6 +1036,7 @@
<property name="adjustment">adjustment1</property>
<property name="fill-level">20</property>
<property name="round-digits">0</property>
<property name="digits">0</property>
</object>
<packing>
<property name="expand">True</property>

Loading…
Cancel
Save