Добавлен 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("lblOffice", lblOffice);
builder->get_widget("lblOther", lblOther); builder->get_widget("lblOther", lblOther);
builder->get_widget("lblDevelopment", lblDevelopment); builder->get_widget("lblDevelopment", lblDevelopment);
builder->get_widget("iconGraphics", iconGraphics);
builder->get_widget("lblSystem", lblSystem); builder->get_widget("lblSystem", lblSystem);
/*
builder->get_widget("iconGraphics", iconGraphics);
builder->get_widget("iconTools", iconTools); list_Graphics = Gtk::ListStore::create( m_Columns );
builder->get_widget("iconInternet", iconInternet); list_Graphics->set_sort_column( m_Columns.m_col_description, Gtk::SORT_ASCENDING );
builder->get_widget("iconMultimedia", iconMultimedia);
builder->get_widget("iconSettings", iconSettings); iconGraphics->set_model(list_Graphics);
builder->get_widget("iconEducation", iconEducation); iconGraphics->set_markup_column(m_Columns.m_col_description);
builder->get_widget("iconOffice", iconOffice); iconGraphics->set_pixbuf_column(m_Columns.m_col_pixbuf);
builder->get_widget("iconOther", iconOther);
builder->get_widget("iconDevelopment", iconDevelopment);
builder->get_widget("iconSystem", iconSystem);
*/
builder->get_widget("treeViewGraphics", treeViewGraphics);
} }
@ -249,6 +247,9 @@ void MainWindow::open_list_app(){
for ( const auto &str_categor : str_app.Categories){ for ( const auto &str_categor : str_app.Categories){
path = "/usr/share/applications/" + str_app.Icon + ".svg"; path = "/usr/share/applications/" + str_app.Icon + ".svg";
if (str_categor=="Graphics"){ 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"){ 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(); 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(){ void MainWindow::start_cmd(){
//txtCmd->set_text(""); //txtCmd->set_text("");
string str_cmd_terminal=""; string str_cmd_terminal="";
string str_variants_root = ""; string str_variants_root = "";
string str_nice_cmd = ""; string str_nice_cmd = "";
string user_cmd = "";
user_cmd = txtCmd->get_text();
//========================================= //=========================================
if (chbAnotherUser->get_active()){ if (chbAnotherUser->get_active()){
if (geteuid()!=0){
chbTerminal->set_active(true);
}
if (rbPkexec->get_active()){ if (rbPkexec->get_active()){
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
//this->tmp_desktop(user_cmd);
} }
else if (chbAnotherUser->get_active()){ else if (chbAnotherUser->get_active()){
str_variants_root = "pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; str_variants_root = "pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
} }
else{ else{
str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; 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()){ else if (rbSu->get_active()){
if (geteuid()!=0){
chbTerminal->set_active(true);
}
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
str_variants_root="su "; str_variants_root="su ";
} }
@ -326,9 +337,6 @@ void MainWindow::start_cmd(){
} }
} }
else if (rbSudo->get_active()){ else if (rbSudo->get_active()){
if (geteuid()!=0){
chbTerminal->set_active(true);
}
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
str_variants_root="sudo "; str_variants_root="sudo ";
} }
@ -346,7 +354,6 @@ void MainWindow::start_cmd(){
//========================================= //=========================================
string user_cmd = txtCmd->get_text();
//========================================= //=========================================
if (user_cmd.length()==0){ if (user_cmd.length()==0){
messageError->show(); messageError->show();
@ -360,9 +367,11 @@ void MainWindow::start_cmd(){
} }
string cmd = ""; string cmd = "";
if (path_file!=""){ if (path_file!=""){
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + user_cmd + "' &"; cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + user_cmd + "' &";
} }
else{ 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); txtCmd->set_text(cmd);

@ -85,6 +85,7 @@ public:
void pars_dir_bin(); void pars_dir_bin();
void pars_users(); void pars_users();
void pars_apps(); void pars_apps();
void tmp_desktop(string cmd_name);
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);
public: public:
@ -93,10 +94,15 @@ public:
public: public:
ModelColumns() ModelColumns()
{ add(m_col_id); add(m_col_name); } {
add(m_col_filename);
Gtk::TreeModelColumn<int> m_col_id; add(m_col_description);
Gtk::TreeModelColumn<Glib::ustring> m_col_name; 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;
@ -152,12 +158,10 @@ public:
Gtk::Label *lblOther; Gtk::Label *lblOther;
Gtk::Label *lblDevelopment; Gtk::Label *lblDevelopment;
Gtk::Label *lblSystem; Gtk::Label *lblSystem;
Gtk::IconView *iconGraphics;
Glib::RefPtr<Gtk::ListStore> list_Graphics;
Gtk::TreeView *treeViewGraphics=0;
Glib::RefPtr<Gtk::TreeStore> tree_store;
Glib::RefPtr<Gtk::ListStore> m_refTreeModel;

@ -10,7 +10,7 @@
</object> </object>
<object class="GtkDialog" id="dialogStartMenu"> <object class="GtkDialog" id="dialogStartMenu">
<property name="width-request">250</property> <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="can-focus">False</property>
<property name="type-hint">dialog</property> <property name="type-hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
@ -107,19 +107,10 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledGraphics"> <object class="GtkIconView" id="iconGraphics">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="shadow-type">in</property> <property name="margin">6</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>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -147,11 +138,6 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledTools">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -160,8 +146,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -188,11 +172,6 @@
<property name="position">4</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledInternet">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -201,8 +180,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -229,11 +206,6 @@
<property name="position">6</property> <property name="position">6</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledMultimedia">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -242,8 +214,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -270,11 +240,6 @@
<property name="position">8</property> <property name="position">8</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledSettings">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -283,8 +248,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -311,11 +274,6 @@
<property name="position">10</property> <property name="position">10</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledEducation">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -324,8 +282,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -352,11 +308,6 @@
<property name="position">12</property> <property name="position">12</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledOffice">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -365,8 +316,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -393,11 +342,6 @@
<property name="position">14</property> <property name="position">14</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledOther">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -406,8 +350,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -434,11 +376,6 @@
<property name="position">16</property> <property name="position">16</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledDevelopment">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -447,8 +384,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -475,11 +410,6 @@
<property name="position">18</property> <property name="position">18</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledSystem">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView"> <object class="GtkTreeView">
<property name="visible">True</property> <property name="visible">True</property>
@ -488,8 +418,6 @@
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
</object> </object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -583,9 +511,9 @@
<property name="label" translatable="yes">Запуск приложений от имени пользователя с <property name="label" translatable="yes">Запуск приложений от имени пользователя с
указанным приоритетом</property> указанным приоритетом</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="font-desc" value="URW Gothic Semi-Bold 10"/>
<attribute name="foreground" value="#000023233232"/> <attribute name="foreground" value="#000023233232"/>
<attribute name="size" value="12288"/> <attribute name="size" value="14336"/>
</attributes> </attributes>
</object> </object>
<packing> <packing>
@ -675,6 +603,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="halign">end</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
@ -706,6 +635,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="halign">end</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -1106,6 +1036,7 @@
<property name="adjustment">adjustment1</property> <property name="adjustment">adjustment1</property>
<property name="fill-level">20</property> <property name="fill-level">20</property>
<property name="round-digits">0</property> <property name="round-digits">0</property>
<property name="digits">0</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

Loading…
Cancel
Save