You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ublexec/source/ublexec.h

239 lines
7.6 KiB

#include <gtkmm/window.h>
#include <glibmm/i18n.h>
#include <gtkmm/plug.h>
#include <gtkmm/stock.h>
#include <gtkmm.h>
#include <iostream>
#include <map>
#include <string>
#include <array>
#include <vector>
#include <fstream>
#include <filesystem>
#include <stdio.h>
#include <pwd.h>
#include <ostream>
#include <thread>
#include <algorithm>
#include "ubl-util-standard.c"
using namespace std;
extern const string path_app;
extern const string app_name;
extern const string path_glade;
extern const string path_css;
extern int socket_ext_id_I;
extern int socket_trd_id_I;
void me_thread(string cmd);
class CmdArgParser : public Glib::OptionGroup
{
public:
CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help);
::Window GetSocketID() const;
private:
int m_socketID = 0;
};
class MainWindow : public Gtk::ApplicationWindow {
public:
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder);
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
void template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list_app);
void get_builder();
void add_CSS();
void localization();
void event();
void settings();
void close_entry_app();
void start_menu_entry_app();
void message_gui_close();
void activ_or_block_execute_epriority();
void open_filemaneg();
void close_filemaneg();
void get_path_filemaneg();
void open_list_app();
string start_cmd(string user_cmd);
void call_app(string &cmd);
void changed_user();
void entry_app();
void execute_another_User(){}
void activ_or_block_other_user();
void change_scale_priority();
void change_spin_priority();
void pars_dir_bin();
void pars_users();
void pars_apps();
void select_Graphics();
void tmp_desktop(string cmd_name);
void on_item_activated(const Gtk::TreeModel::Path& path);
void tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list);
void tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list);
void ok_close_entry_app();
void select_Tools();
void select_Internet();
void select_Multimedia();
void select_Settings();
void select_Education();
void select_Office();
void select_Other();
void select_Development();
void select_System();
void icon_clear();
void set_icon_array();
void delete_cmd(const int &x,const int &y);
void synopsis_show();
void denamic_cmd();
void is_user_wheel();
void sudo_nice();
bool focus_out_txt_cmd(GdkEventFocus* event);
bool focus_in_txt_cmd(GdkEventFocus* event);
void unselect_icon(Gtk::IconView *icon_entry);
void str_remove(std::string& source, std::string & to_remove);
string call(string cmd);
vector<std::string> split(const std::string &s, char delim);
public:
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns()
{
add(m_col_filename);
add(m_col_description);
add(m_col_pixbuf);
add(app_name_exec);
add(float_h_align);
add(float_w_align);
add(icon_name);
}
Gtk::TreeModelColumn<std::string> m_col_filename;
Gtk::TreeModelColumn<std::string> icon_name;
Gtk::TreeModelColumn<Glib::ustring> m_col_description;
Gtk::TreeModelColumn<Glib::ustring> app_name_exec;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_col_pixbuf;
Gtk::TreeModelColumn<float> float_h_align;
Gtk::TreeModelColumn<float> float_w_align;
};
ModelColumns m_Columns;
public:
Glib::RefPtr<Gtk::Builder> builder;
Gtk::Button *btnFilemaneg;
Gtk::Button *btnListApp;
Gtk::Button *btnStart;
Gtk::CheckButton *chbTerminal;
Gtk::CheckButton *chbAnotherUser;
Gtk::CheckButton *cbxExecuteEpriority;
Gtk::ComboBoxText *cmbUser;
Gtk::SpinButton *spinPriority;
Gtk::Scale *scalePriority;
Gtk::RadioButton *rbPkexec;
Gtk::RadioButton *rbSu;
Gtk::RadioButton *rbSudo;
Gtk::Entry *txtCmd;
Gtk::FileChooserDialog *wndChooseFileWallpaper;
Gtk::Button *btnFilemangerExit;
Gtk::Button *btnFilemangerOk;
Gtk::Label *lblTimeEpriority;
Gtk::Label *lblTimeEpriorityLow;
Gtk::Label *lblTime4EpriorityHigh;
Gtk::Label *lblUserName;
Gtk::MessageDialog *messageError;
Gtk::Button *btnMessageErrorOk;
Gtk::Label *lblMessageError;
Gtk::Button *btnStartMenuOK;
Gtk::Button *btnStartMenuExit;
Gtk::Window *dialogStartMenu;
Gtk::Box *boxColor;
Gtk::Label *lblInfoHead;
Gtk::Label *lblinfoCmd;
Gtk::Label *lblInfoTime;
Gtk::Label *labInfoExecutTerm;
Gtk::Label *lblInfoUser;
Gtk::Label *lblInfoUserOther;
Gtk::Label *lblInfoUserName;
Gtk::Label *lblInfoNooPriority;
Gtk::Label *lblInfoExec;
Gtk::Label *lblInfoPriority;
Gtk::Label *lblGraphics;
Gtk::Label *lblTools;
Gtk::Label *lblInternet;
Gtk::Label *lblMultimedia;
Gtk::Label *lblSettings;
Gtk::Label *lblEducation;
Gtk::Label *lblOffice;
Gtk::Label *lblOther;
Gtk::Label *lblDevelopment;
Gtk::Label *lblSystem;
Gtk::Label *lblHeaderName;
Gtk::IconView *iconGraphics;
Gtk::IconView *iconTools;
Gtk::IconView *iconInternet;
Gtk::IconView *iconMultimedia;
Gtk::IconView *iconSettings;
Gtk::IconView *iconEducation;
Gtk::IconView *iconOffice;
Gtk::IconView *iconOther;
Gtk::IconView *iconDevelopment;
Gtk::IconView *iconSystem;
Gtk::IconView *iconEntry;
Gtk::MenuItem *btnAbout;
Gtk::MenuItem *btnSynopsis;
Gtk::AboutDialog *aboutWindows;
Gtk::MenuButton *btnSettings;
Gtk::ButtonBox *btnBoxAboutDialog;
Glib::RefPtr<Gtk::ListStore> list_Graphics;
Glib::RefPtr<Gtk::ListStore> list_Tools;
Glib::RefPtr<Gtk::ListStore> list_Internet;
Glib::RefPtr<Gtk::ListStore> list_Multimedia;
Glib::RefPtr<Gtk::ListStore> list_Settings;
Glib::RefPtr<Gtk::ListStore> list_Education;
Glib::RefPtr<Gtk::ListStore> list_Office;
Glib::RefPtr<Gtk::ListStore> list_Other;
Glib::RefPtr<Gtk::ListStore> list_Development;
Glib::RefPtr<Gtk::ListStore> list_System;
Gtk::Widget *boxAbout;
public:
string version_application = "1.0";
string cmd_old = "";
string user_exec_app = "";
string user_cmd = "";
string user_cmd_old = "";
string name_app_old = "";
string path_file_old = "";
string execute_cmd = "";
string path_file = "";
string name_app = "";
bool flag_pkexec = false;
bool flag_su = false;
bool flag_sudo = false;
string path_file_name;
struct struct_App {
string Name_desktop;
string Name;
string Exec;
string Icon;
string MimeType;
string Type;
vector<std::string> Categories;
};
list <struct_App> list_app;
set <string> set_categories;
int index_exec_gui_apps = 0;
Gtk::IconView* array_icon[10];
};
class SettingsPlug : public Gtk::Plug{
public:
Gtk::Window *window;
SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder);
private:
Gtk::Widget *plugBox;
Gtk::Widget *parent;
};