Localisation revertion, fixes, window size and position saving

pull/70/head
parent 21a09b6eeb
commit a27ec72f5b

@ -8,28 +8,28 @@ noapic|Disable APIC
nolapic|Disable local APIC nolapic|Disable local APIC
single|Single User Mode single|Single User Mode
nomodeset|Disable kernel selection and loading of video drivers nomodeset|Disable kernel selection and loading of video drivers
nouveau.modeset=0|Enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) nouveau.modeset=0|Enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) (int)
nouveau.noaccel|Disable kernel/abi16 acceleration nouveau.noaccel|Disable kernel/abi16 acceleration (int)
i915.modeset=1|Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) i915.modeset=1|Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) (int)
i915.enable_fbc=0|Enable frame buffer compression for power savings (default: -1 (use per-chip default)) i915.enable_fbc=0|Enable frame buffer compression for power savings (default: -1 (use per-chip default)) (int)
i915.enable_dc=0|Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) i915.enable_dc=0|Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) (int)
i915.enable_psr=0|Enable PSR (0=disabled, 1=enabled) i915.enable_psr=0|Enable PSR (0=disabled, 1=enabled) (int)
i915.disable_power_well=1|Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) i915.disable_power_well=1|Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) (int)
i915.enable_ips=N|Enable IPS (default: true) i915.enable_ips=N|Enable IPS (default: true) (int)
i915.fastboot=1|Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default) i915.fastboot=1|Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default) (int)
i915.disable_display=Y|Disable display (default: false) i915.disable_display=Y|Disable display (default: false) (bool)
i915.enable_guc=0|Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load) i915.enable_guc=0|Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load) (int)
i915.enable_dp_mst=N|Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) i915.enable_dp_mst=N|Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) (bool)
i915.enable_gvt=Y|Enable support for Intel GVT-g graphics virtualization host support (default:false) i915.enable_gvt=Y|Enable support for Intel GVT-g graphics virtualization host support (default:false) (bool)
ahci.marvell_enable=1|Marvell SATA via AHCI (1 = enabled) ahci.marvell_enable=1|Marvell SATA via AHCI (1 = enabled) (int)
ahci.mobile_lpm_policy=1|Default LPM policy for mobile chipsets (default:-1) ahci.mobile_lpm_policy=1|Default LPM policy for mobile chipsets (default:-1) (int)
snd-intel-dspcfg.dsp_driver=1|Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF) snd-intel-dspcfg.dsp_driver=1|Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF) (int)
intel_idle.no_acpi=Y|Do not use ACPI _CST for building the idle states list (default:N) intel_idle.no_acpi=Y|Do not use ACPI _CST for building the idle states list (default:N) (bool)
intel_idle.use_acpi=Y|Use ACPI _CST for building the idle states list (default:N) intel_idle.use_acpi=Y|Use ACPI _CST for building the idle states list (default:N) (bool)
intel_idle.max_cstate=1|Prevents the processor from going into a deep sleep state (default:9) intel_idle.max_cstate=1|Prevents the processor from going into a deep sleep state (default:9) (int)
intel_idle.max_cstate=2|Eliminates flickering laptop display on Ultra Voltage processors intel_idle.max_cstate=2|Eliminates flickering laptop display on Ultra Voltage processors (int)
intel_idle.max_cstate=3|Eliminates flickering laptop display on Ultra Voltage processors intel_idle.max_cstate=3|Eliminates flickering laptop display on Ultra Voltage processors (int)
intel_idle.max_cstate=4|Eliminates flickering laptop display on Ultra Voltage processors intel_idle.max_cstate=4|Eliminates flickering laptop display on Ultra Voltage processors (int)
intel_idle.states_off=1|Mask of disabled idle states (0=disabled, 1=enabled) Default: 0 intel_idle.states_off=1|Mask of disabled idle states (0=disabled, 1=enabled) Default: 0 (uint)
usbcore.autosuspend=-1|Default autosuspend delay (-1=disabled) usbcore.autosuspend=-1|Default autosuspend delay (-1=disabled) (int)
modprobe.blacklist=nouveau|Force dont`t load nouveau driver video for Nvidia modprobe.blacklist=nouveau|Force dont`t load nouveau driver video for Nvidia
1 Option Description
8 nolapic Disable local APIC
9 single Single User Mode
10 nomodeset Disable kernel selection and loading of video drivers
11 nouveau.modeset=0 Enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) Enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) (int)
12 nouveau.noaccel Disable kernel/abi16 acceleration Disable kernel/abi16 acceleration (int)
13 i915.modeset=1 Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) (int)
14 i915.enable_fbc=0 Enable frame buffer compression for power savings (default: -1 (use per-chip default)) Enable frame buffer compression for power savings (default: -1 (use per-chip default)) (int)
15 i915.enable_dc=0 Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) (int)
16 i915.enable_psr=0 Enable PSR (0=disabled, 1=enabled) Enable PSR (0=disabled, 1=enabled) (int)
17 i915.disable_power_well=1 Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) (int)
18 i915.enable_ips=N Enable IPS (default: true) Enable IPS (default: true) (int)
19 i915.fastboot=1 Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default) Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default) (int)
20 i915.disable_display=Y Disable display (default: false) Disable display (default: false) (bool)
21 i915.enable_guc=0 Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load) Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load) (int)
22 i915.enable_dp_mst=N Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) (bool)
23 i915.enable_gvt=Y Enable support for Intel GVT-g graphics virtualization host support (default:false) Enable support for Intel GVT-g graphics virtualization host support (default:false) (bool)
24 ahci.marvell_enable=1 Marvell SATA via AHCI (1 = enabled) Marvell SATA via AHCI (1 = enabled) (int)
25 ahci.mobile_lpm_policy=1 Default LPM policy for mobile chipsets (default:-1) Default LPM policy for mobile chipsets (default:-1) (int)
26 snd-intel-dspcfg.dsp_driver=1 Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF) Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF) (int)
27 intel_idle.no_acpi=Y Do not use ACPI _CST for building the idle states list (default:N) Do not use ACPI _CST for building the idle states list (default:N) (bool)
28 intel_idle.use_acpi=Y Use ACPI _CST for building the idle states list (default:N) Use ACPI _CST for building the idle states list (default:N) (bool)
29 intel_idle.max_cstate=1 Prevents the processor from going into a deep sleep state (default:9) Prevents the processor from going into a deep sleep state (default:9) (int)
30 intel_idle.max_cstate=2 Eliminates flickering laptop display on Ultra Voltage processors Eliminates flickering laptop display on Ultra Voltage processors (int)
31 intel_idle.max_cstate=3 Eliminates flickering laptop display on Ultra Voltage processors Eliminates flickering laptop display on Ultra Voltage processors (int)
32 intel_idle.max_cstate=4 Eliminates flickering laptop display on Ultra Voltage processors Eliminates flickering laptop display on Ultra Voltage processors (int)
33 intel_idle.states_off=1 Mask of disabled idle states (0=disabled, 1=enabled) Default: 0 Mask of disabled idle states (0=disabled, 1=enabled) Default: 0 (uint)
34 usbcore.autosuspend=-1 Default autosuspend delay (-1=disabled) Default autosuspend delay (-1=disabled) (int)
35 modprobe.blacklist=nouveau Force dont`t load nouveau driver video for Nvidia

@ -47,6 +47,9 @@ int main(int argc, char** argv) {
pars_flag(1, argc, argv); pars_flag(1, argc, argv);
MainWindow* wnd = nullptr; MainWindow* wnd = nullptr;
builder->get_widget_derived("window", wnd); builder->get_widget_derived("window", wnd);
GObject *window_obj = G_OBJECT(wnd->gobj());
Utils::yon_window_config_setup(GTK_WINDOW(window_obj));
Utils::yon_window_config_load(ui_config_path);
wnd->settings(); wnd->settings();
wnd->event(); wnd->event();
wnd->set_menu_os_to_button(); wnd->set_menu_os_to_button();

@ -45,6 +45,9 @@ SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> build
: Gtk::Plug{p_socketID} { : Gtk::Plug{p_socketID} {
MainWindow* wnd = nullptr; MainWindow* wnd = nullptr;
builder->get_widget_derived("window", wnd); builder->get_widget_derived("window", wnd);
GObject *window_obj = G_OBJECT(wnd->gobj());
Utils::yon_window_config_setup(GTK_WINDOW(window_obj));
Utils::yon_window_config_load(ui_config_path);
builder->get_widget("plugBox", plugBox); builder->get_widget("plugBox", plugBox);
wnd->settings(); wnd->settings();
wnd->set_plug(plugBox); wnd->set_plug(plugBox);

@ -151,6 +151,8 @@ void me_thread(string cmd);
#define app_name "ubl-settings-bootloader" #define app_name "ubl-settings-bootloader"
#define path_resources "/usr/share/ubl-settings-bootloader" #define path_resources "/usr/share/ubl-settings-bootloader"
#define path_img_head_background "/com/ublinux/images/ubl-settings-bootloader-banner.png" #define path_img_head_background "/com/ublinux/images/ubl-settings-bootloader-banner.png"
#define ui_config_path Utils::yon_char_unite(Utils::yon_ubl_user_get_home_directory(),"/.config/",app_name,"/",app_name,".conf",NULL)
#define cmd_pars_list_os "/usr/lib/ublinux/scripts/grub-functions exec_get_all_menuentry" #define cmd_pars_list_os "/usr/lib/ublinux/scripts/grub-functions exec_get_all_menuentry"
#define cmd_last_launched_os "/usr/lib/ublinux/scripts/grub-functions exec_get_last_menuentry" #define cmd_last_launched_os "/usr/lib/ublinux/scripts/grub-functions exec_get_last_menuentry"
#define info_box_ok_css "boxInfoMessOK" #define info_box_ok_css "boxInfoMessOK"

@ -62,7 +62,7 @@ vector<tuple<string, string>> read_csv_melody(const string& filename) {
vector<tuple<string, string>> vec_music; vector<tuple<string, string>> vec_music;
ifstream file(filename); ifstream file(filename);
string line; string line;
char delimiter = ';'; char delimiter = '|';
getline(file, line); getline(file, line);
while (getline(file, line)) { while (getline(file, line)) {
stringstream stream(line); stringstream stream(line);
@ -131,4 +131,330 @@ std::vector<std::string> split(std::string text, char delim) {
return vec; return vec;
} }
char *yon_char_new(char *chr)
{
if (chr){
char *newchar = (char*)malloc(strlen(chr) + 1);
memset(newchar, 0, strlen(chr) + 1);
memcpy(newchar, chr, strlen(chr));
return newchar;
} else
return NULL;
}
char *yon_char_append(char *source, char *append)
{
if (source && append)
{
int size = strlen(source) + strlen(append) + 1;
char *final = (char*)malloc(size);
memset(final, 0, size);
// if (strstr(source, "%%"))
// sprintf(final, source, append);
// else
sprintf(final, "%s%s", source, append);
return final;
}
else
return NULL;
}
char *yon_char_unite(char *source, ...){
va_list arglist;
char *new_char=NULL;
char *unite_char=NULL;
new_char=yon_char_new(source);
va_start(arglist,source);
unite_char = va_arg(arglist,char*);
while(unite_char){
new_char = yon_char_append(new_char,unite_char);
unite_char = va_arg(arglist,char*);
}
va_end(arglist);
return new_char;
}
char *yon_char_divide(char *source, int dividepos)
{
if (source&&(int)strlen(source)>=dividepos){
char *cut = (char*)malloc(dividepos + 1);
memset(cut, 0, dividepos + 1);
memcpy(cut, source, dividepos);
char *left = (char*)malloc(strlen(source) - strlen(cut));
memset(left, 0, strlen(source) - strlen(cut));
memcpy(left, source + dividepos + 1, (strlen(source) - dividepos));
memset(source, 0, strlen(source));
memcpy(source, left, strlen(left));
return cut;
}
return NULL;
}
char *yon_char_divide_search(char *source, char *dividepos, int delete_divider)
{
if (delete_divider){};
if (source&&dividepos){
char *cut = strstr(source, dividepos);
if (cut)
{
int leng = strlen(source) - strlen(cut);
cut = yon_char_divide(source, leng);
return cut;
}
}
return source;
}
char **yon_char_parse(char *parameters, int *size, char *divider){
*size=0;
if (parameters){
char **string=NULL;
char *paramline=yon_char_new(parameters);
char *param = strstr(paramline,divider);
for (;param;param=strstr(paramline,divider)){
string = (!string) ? (char **)malloc(sizeof(char*)*((*size)+1)) : (char **)realloc(string, sizeof(char*)*((*size)+1));
string[(*size)]=yon_char_divide(paramline,strlen(paramline)-strlen(param));
*size=(*size)+1;
}
string = (!string) ? (char **)malloc(sizeof(char*)*((*size)+1)) : (char **)realloc(string, sizeof(char*)*((*size)+1));
string[(*size)]=paramline;
(*size)+=1;
return string;
}
return NULL;
}
#define check_window_config_setup if(__yon_window_config_target_window)
typedef struct {
char *parameter_name;
enum YON_TYPE containing_type;
GtkWidget *track_widget;
char *property_name;
} __yon_listener_parameter;
typedef struct {
char *parameter_name;
char *section;
enum YON_TYPE containing_type;
void *property;
} __yon_custom_parameter;
struct {
int x;
int y;
int width;
int height;
int fullscreen;
dictionary *custom_listeners;
dictionary *custom_parameters;
dictionary *deleted_parameters;
} __yon_main_window_config;
static GtkWindow *__yon_window_config_target_window = NULL;
static GKeyFile *__yon_window_config_file = NULL;
static char *__yon_window_config_path = NULL;
void yon_window_config_save();
void yon_window_config_save(){
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x);
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y);
g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width);
g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height);
g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen);
dictionary *dict=NULL;
if (__yon_main_window_config.deleted_parameters)
for_dictionaries(dict,__yon_main_window_config.deleted_parameters){
__yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*);
g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL);
}
if (__yon_main_window_config.custom_listeners)
for_dictionaries(dict,__yon_main_window_config.custom_listeners){
__yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*);
GValue *val = (GValue*)g_malloc0(sizeof(GValue));
g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val);
switch(param->containing_type){
case YON_TYPE_STRING:
g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val));
break;
case YON_TYPE_INT:
g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val));
break;
case YON_TYPE_BOOLEAN:
g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val));
break;
case YON_TYPE_STRING_LIST:break;
case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break;
}
}
if (__yon_main_window_config.custom_parameters)
for_dictionaries(dict,__yon_main_window_config.custom_parameters){
__yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*);
switch (param->containing_type){
case YON_TYPE_STRING:
g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property);
break;
case YON_TYPE_INT:
g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property);
break;
case YON_TYPE_BOOLEAN:
g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property);
break;
case YON_TYPE_STRING_LIST:break;
default:
break;
}
}
g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL);
}
void yon_get_is_fullscreen();
void yon_get_is_fullscreen(){
gtk_window_is_maximized(__yon_window_config_target_window);
__yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window);
if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
}
/**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event)
* [EN]
*
* [RU]
* Сохраняет настройки основного окна. Вызывается когда основное окно уничтожается.
*/
void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event);
void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){
if (self&&event){};
check_window_config_setup{
yon_get_is_fullscreen();
yon_window_config_save();
}
gtk_main_quit();
}
void __yon_window_config_on_resize();
void __yon_window_config_on_resize(){
int max=0;
max=gtk_window_is_maximized(__yon_window_config_target_window);
if(max==0){
gtk_window_get_size(__yon_window_config_target_window,&__yon_main_window_config.width,&__yon_main_window_config.height);
gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
}
}
void yon_window_config_setup(GtkWindow *window){
__yon_window_config_target_window = window;
g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_configured_window_destroy),NULL);
g_signal_connect(G_OBJECT(window),"check-resize"/*"configure-event"*/,G_CALLBACK(__yon_window_config_on_resize),NULL);
}
void *_yon_maximize(void *data);
void *_yon_maximize(void *data){
if (data){};
g_usleep(G_USEC_PER_SEC/10);
if(__yon_main_window_config.fullscreen ==1) gtk_window_maximize(__yon_window_config_target_window);
return NULL;
}
int yon_window_config_load(char *path){
__yon_window_config_file = g_key_file_new();
__yon_window_config_path=yon_char_new(path);
if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){
struct stat st;
int size;
config_str conf = yon_char_parse(yon_char_new(__yon_window_config_path),&size,(char*)"/");
char *path = yon_char_unite(conf[0],(char*)"/",conf[1],(char*)"/",conf[2],(char*)"/",conf[3],(char*)"/",conf[4],(char*)"/",NULL);
if (stat(path, &st) == -1) {
mkdir(path, 0777);
}
FILE *fp;
fp=fopen(__yon_window_config_path,"w");
chmod(__yon_window_config_path,0777);
fclose(fp);
g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL);
}
__yon_main_window_config.x = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosX",NULL);
__yon_main_window_config.y = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosY",NULL);
__yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL);
__yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL);
__yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL);
dictionary *dict=NULL;
if (__yon_main_window_config.custom_listeners)
for_dictionaries(dict,__yon_main_window_config.custom_listeners){
__yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*);
GValue *val = (GValue*)g_malloc0(sizeof(GValue));
g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val);
gboolean res=0;
switch(param->containing_type){
case YON_TYPE_STRING:
g_value_set_string(val,g_key_file_get_string(__yon_window_config_file,"window",param->parameter_name, NULL));
break;
case YON_TYPE_INT:
g_value_set_int(val,g_key_file_get_integer(__yon_window_config_file,"window",param->parameter_name, NULL));
break;
case YON_TYPE_BOOLEAN:
res = g_key_file_get_boolean(__yon_window_config_file,"window",param->parameter_name, NULL);
g_value_set_boolean(val,res);
break;
case YON_TYPE_STRING_LIST:break;
case YON_TYPE_OTHER:break;
}
g_object_set_property(G_OBJECT(param->track_widget),param->property_name,val);
}
if (__yon_main_window_config.width==0) __yon_main_window_config.width=800;
if (__yon_main_window_config.height==0) __yon_main_window_config.height=600;
gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y);
pthread_t tid;
pthread_create(&tid, NULL, (&_yon_maximize), NULL);
return 1;
}
void yon_window_config_apply();
void yon_window_config_apply(){
gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y);
gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
}
config_str yon_window_config_get_section(char *section, gsize *size){
config_str key = g_key_file_get_keys(__yon_window_config_file,section,size,NULL);
return key;
}
char *yon_ubl_user_get_home_directory(){
FILE *path = popen(get_home_dir_command,"r");
char *ret = (char*)malloc(4096);
memset(ret,0,4096);
if (fgets(ret,4096,path)){
ret=yon_char_divide_search(ret,(char*)"\n",-1);
return ret;
} else return NULL;
}
char *yon_ubl_root_user_get(){
char *user=NULL;
if (yon_ubl_check_root()){
user=getenv("SUDO_USER");
if (user&&strcmp(user,"")!=0){
return user;
}else {
FILE *file = popen("getent passwd $PKEXEC_UID | cut -d: -f1","r");
user=(char*)malloc(4096);
memset(user,0,4096);
if (fgets(user,4096,file)){
user=yon_char_divide_search(user,(char*)"\n",-1);
if (user) return user;
} else return NULL;
}
}
return getlogin();
}
int yon_ubl_check_root(){
if (getuid()==0) return 1;
else return 0;
}
} }

@ -12,7 +12,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <string> #include <string>
@ -24,10 +23,16 @@
#include <map> #include <map>
#include <pwd.h> #include <pwd.h>
#include <set> #include <set>
#include <gtk/gtk.h>
#include <sys/stat.h>
using namespace std; using namespace std;
namespace Utils { namespace Utils {
#define get_home_dir_command yon_char_unite((char*)"getent passwd \"",yon_ubl_root_user_get(),(char*)"\" | cut -d: -f6",NULL)
template<typename Type> template<typename Type>
struct Result{ struct Result{
Type response; Type response;
@ -47,5 +52,87 @@ void str_replace_all(string &str_base, string str_find, string str_replace);
std::vector<std::string> split(std::string text, char delim); std::vector<std::string> split(std::string text, char delim);
vector<tuple<string, string>> read_csv_melody(const string& filename); vector<tuple<string, string>> read_csv_melody(const string& filename);
void write_file(string path_name, string data); void write_file(string path_name, string data);
#define for_dictionaries(element, stack) for (element = stack->first; element != NULL; element = element->next)
#define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data)
typedef enum
{
DICTIONARY_GTK_WIDGETS_TYPE,
DICTIONARY_OTHER_TYPE=0,
DICTIONARY_CHAR_TYPE,
DICTIONARY_INT_TYPE,
DICTIONARY_BOOL_TYPE,
} DICT_TYPE;
typedef struct dictionary
{
char *key;
void *data;
struct dictionary *next;
struct dictionary *prev;
struct dictionary *first;
DICT_TYPE data_type;
} dictionary;
typedef char** config_str;
char *yon_char_divide(char *source, int dividepos);
char *yon_char_divide_search(char *source, char *dividepos, int delete_divider);
char *yon_char_new(char *chr);
char *yon_char_append(char *source, char *append);
char *yon_char_unite(char *source, ...);
char **yon_char_parse(char *parameters, int *size, char *divider);
/**YON_TYPE
* [EN]
*
* [RU]
* Типы, поддерживаемые функциями сохранения/загрузки конфигурации утилиты
*/
enum YON_TYPE{
YON_TYPE_STRING,
YON_TYPE_STRING_LIST,
YON_TYPE_INT,
YON_TYPE_BOOLEAN,
YON_TYPE_OTHER};
/**yon_window_config_setup(GtkWindow *window)
* [EN]
*
* [RU]
* Устанавливает указатель на окно для отслеживания его положения и размера
*/
void yon_window_config_setup(GtkWindow *window);
/**yon_window_config_load(char *path)
* [EN]
*
* [RU]
* Загружает конфиг окна и инициализирует отслеживание его параметров
*/
int yon_window_config_load(char *path);
/**yon_window_config_get_section(char *section, gsize *size)
* [EN]
*
* [RU]
* Возвращает все параметры раздела [section] конфига утилиты и записывает в [size] количество считанных параметров.
*/
config_str yon_window_config_get_section(char *section, gsize *size);
char *yon_ubl_user_get_home_directory();
char *yon_ubl_root_user_get();
int yon_ubl_check_root();
} }
#endif #endif

@ -619,91 +619,91 @@ msgid "Disable kernel selection and loading of video drivers"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless)" msgid "enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "disable kernel/abi16 acceleration" msgid "disable kernel/abi16 acceleration (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default])" msgid "Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable frame buffer compression for power savings (default: -1 (use per-chip default))" msgid "Enable frame buffer compression for power savings (default: -1 (use per-chip default)) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO)" msgid "Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable PSR (0=disabled, 1=enabled)" msgid "Enable PSR (0=disabled, 1=enabled) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible)" msgid "Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable IPS (default: true)" msgid "Enable IPS (default: true) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default)" msgid "Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Disable display (default: false)" msgid "Disable display (default: false) (bool)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load)" msgid "Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)" msgid "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) (bool)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable support for Intel GVT-g graphics virtualization host support (default:false)" msgid "Enable support for Intel GVT-g graphics virtualization host support (default:false) (bool)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Marvell SATA via AHCI (1 = enabled)" msgid "Marvell SATA via AHCI (1 = enabled) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Default LPM policy for mobile chipsets (default:-1)" msgid "Default LPM policy for mobile chipsets (default:-1) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF)" msgid "Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Do not use ACPI _CST for building the idle states list (default:N)" msgid "Do not use ACPI _CST for building the idle states list (default:N) (bool)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Use ACPI _CST for building the idle states list (default:N)" msgid "Use ACPI _CST for building the idle states list (default:N) (bool)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Prevents the processor from going into a deep sleep state (default:9)" msgid "Prevents the processor from going into a deep sleep state (default:9) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Eliminates flickering laptop display on Ultra Voltage processors" msgid "Eliminates flickering laptop display on Ultra Voltage processors (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Mask of disabled idle states (0=disabled, 1=enabled) Default: 0" msgid "Mask of disabled idle states (0=disabled, 1=enabled) Default: 0 (uint)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "default autosuspend delay (-1=disabled)" msgid "default autosuspend delay (-1=disabled) (int)"
msgstr "" msgstr ""
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162

@ -118,6 +118,9 @@ msgstr "Меню загрузки"
msgid "Downloading without text messages" msgid "Downloading without text messages"
msgstr "Загрузка без текстовых сообщений" msgstr "Загрузка без текстовых сообщений"
msgid "Eliminates flickering laptop display on Ultra Voltage processors"
msgstr "Устраняет мерцание дисплея ноутбука на процессорах Ultra Voltage"
#: source/ubl-settings-bootloader.h:78 source/ubl-settings-bootloader.h:77 #: source/ubl-settings-bootloader.h:78 source/ubl-settings-bootloader.h:77
#: source/ubl-settings-bootloader.cc:496 #: source/ubl-settings-bootloader.cc:496
msgid "Enter login" msgid "Enter login"
@ -639,92 +642,92 @@ msgid "Disable kernel selection and loading of video drivers"
msgstr "Отключить выбор ядра и загрузку видеодрайверов" msgstr "Отключить выбор ядра и загрузку видеодрайверов"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless)" msgid "Enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) (целочисленное)"
msgstr "Включить драйвер (по умолчанию: авто, 0 = отключено, 1 = включено, 2 = без головы)" msgstr "Включить драйвер (по умолчанию: авто, 0 = отключено, 1 = включено, 2 = без головы) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Disable kernel/abi16 acceleration" msgid "Disable kernel/abi16 acceleration (целочисленное)"
msgstr "Отключить ускорение ядра/abi16" msgstr "Отключить ускорение ядра/abi16 (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default])" msgid "Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) (целочисленное)"
msgstr "Использовать настройку режима ядра [KMS] (0=отключить, 1=включить, -1=принудительно настроить консоль vga [по умолчанию])" msgstr "Использовать настройку режима ядра [KMS] (0=отключить, 1=включить, -1=принудительно настроить консоль vga [по умолчанию]) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable frame buffer compression for power savings (default: -1 (use per-chip default))" msgid "Enable frame buffer compression for power savings (default: -1 (use per-chip default)) (целочисленное)"
msgstr "Включить сжатие кадрового буфера для экономии энергии (по умолчанию: -1 (используйте значение по умолчанию для каждого чипа))" msgstr "Включить сжатие кадрового буфера для экономии энергии (по умолчанию: -1 (используйте значение по умолчанию для каждого чипа)) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO)" msgid "Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) (целочисленное)"
msgstr "Включить энергосберегающее отображение C-состояний. (-1=авто [по умолчанию]; 0=отключить; 1=до DC5; 2=до DC6; 3=до DC5 с DC3CO; 4=до DC6 с DC3CO)" msgstr "Включить энергосберегающее отображение C-состояний. (-1=авто [по умолчанию]; 0=отключить; 1=до DC5; 2=до DC6; 3=до DC5 с DC3CO; 4=до DC6 с DC3CO) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable PSR (0=disabled, 1=enabled)" msgid "Enable PSR (0=disabled, 1=enabled) (целочисленное)"
msgstr "Включить PSR (0=выключено, 1=включено)" msgstr "Включить PSR (0=выключено, 1=включено) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible)" msgid "Disable display power wells when possible (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) (целочисленное)"
msgstr "Отключить отображение энергетических колодцев, когда это возможно (-1=авто [по умолчанию], 0=энергетические колодцы всегда включены, 1=энергетические колодцы отключены, когда это возможно)" msgstr "Отключить отображение энергетических колодцев, когда это возможно (-1=авто [по умолчанию], 0=энергетические колодцы всегда включены, 1=энергетические колодцы отключены, когда это возможно) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable IPS (default: true)" msgid "Enable IPS (default: true) (целочисленное)"
msgstr "Включить IPS (по умолчанию: true)" msgstr "Включить IPS (по умолчанию: true) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default)" msgid "Try to skip unnecessary mode sets at boot time (0=disabled, 1=enabled) Default: -1 (use per-chip default) (целочисленное)"
msgstr "Попробовать пропустить ненужные наборы режимов во время загрузки (0=отключено, 1=включено). По умолчанию: -1 (используйте настройки по умолчанию для каждого чипа)" msgstr "Попробовать пропустить ненужные наборы режимов во время загрузки (0=отключено, 1=включено). По умолчанию: -1 (используйте настройки по умолчанию для каждого чипа) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Disable display (default: false)" msgid "Disable display (default: false) (логическое значение)"
msgstr "Отключить отображение (по умолчанию: false)" msgstr "Отключить отображение (по умолчанию: false) (логическое значение)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load)" msgid "Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load) (целочисленное)"
msgstr "Включить загрузку GuC для отправки GuC и/или загрузки HuC. Требуемую функциональность можно выбрать с помощью значений битовой маски. (-1=авто [по умолчанию], 0=отключить, 1=отправка GuC, 2=загрузка HuC)" msgstr "Включить загрузку GuC для отправки GuC и/или загрузки HuC. Требуемую функциональность можно выбрать с помощью значений битовой маски. (-1=авто [по умолчанию], 0=отключить, 1=отправка GuC, 2=загрузка HuC) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)" msgid "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) (логическое значение)"
msgstr "Включить многопотоковую передачу (MST) для новых приемников DisplayPort. (по умолчанию: true)" msgstr "Включить многопотоковую передачу (MST) для новых приемников DisplayPort. (по умолчанию: true) (логическое значение)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Enable support for Intel GVT-g graphics virtualization host support (default:false)" msgid "Enable support for Intel GVT-g graphics virtualization host support (default:false) (логическое значение)"
msgstr "Включить поддержку хоста виртуализации графики Intel GVT-g (по умолчанию: false)" msgstr "Включить поддержку хоста виртуализации графики Intel GVT-g (по умолчанию: false) (логическое значение)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Marvell SATA via AHCI (1 = enabled)" msgid "Marvell SATA via AHCI (1 = enabled) (целочисленное)"
msgstr "Marvell SATA через AHCI (1 = включено)" msgstr "Marvell SATA через AHCI (1 = включено) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Default LPM policy for mobile chipsets (default:-1)" msgid "Default LPM policy for mobile chipsets (default:-1) (целочисленное)"
msgstr "Политика LPM по умолчанию для мобильных чипсетов (по умолчанию:-1)" msgstr "Политика LPM по умолчанию для мобильных чипсетов (по умолчанию:-1) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF)" msgid "Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF) (целочисленное)"
msgstr "Принудительно установить драйвер DSP для Intel DSP (0=авто, 1=устаревший, 2=SST, 3=SOF)" msgstr "Принудительно установить драйвер DSP для Intel DSP (0=авто, 1=устаревший, 2=SST, 3=SOF) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Do not use ACPI _CST for building the idle states list (default:N)" msgid "Do not use ACPI _CST for building the idle states list (default:N) (логическое значение)"
msgstr "Не использовать ACPI _CST для создания списка состояний простоя (по умолчанию: N)" msgstr "Не использовать ACPI _CST для создания списка состояний простоя (по умолчанию: N) (логическое значение)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Use ACPI _CST for building the idle states list (default:N)" msgid "Use ACPI _CST for building the idle states list (default:N) (логическое значение)"
msgstr "Используйте ACPI _CST для создания списка состояний простоя (по умолчанию: N)" msgstr "Используйте ACPI _CST для создания списка состояний простоя (по умолчанию: N) (логическое значение)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Prevents the processor from going into a deep sleep state (default:9)" msgid "Prevents the processor from going into a deep sleep state (default:9) (целочисленное)"
msgstr "Предотвращает переход процессора в состояние глубокого сна (по умолчанию: 9)" msgstr "Предотвращает переход процессора в состояние глубокого сна (по умолчанию: 9) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Eliminates flickering laptop display on Ultra Voltage processors" msgid "Eliminates flickering laptop display on Ultra Voltage processors (целочисленное)"
msgstr "Устраняет мерцание дисплея ноутбука на процессорах сверхнапряжения" msgstr "Устраняет мерцание дисплея ноутбука на процессорах сверхнапряжения (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Mask of disabled idle states (0=disabled, 1=enabled) Default: 0" msgid "Mask of disabled idle states (0=disabled, 1=enabled) Default: 0 (целочисленное)"
msgstr "Маска отключенных состояний простоя (0=отключено, 1=включено) По умолчанию: 0" msgstr "Маска отключенных состояний простоя (0=отключено, 1=включено) По умолчанию: 0 (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Default autosuspend delay (-1=disabled)" msgid "Default autosuspend delay (-1=disabled) (целочисленное)"
msgstr "Задержка автоприостановки по умолчанию (-1=отключено)" msgstr "Задержка автоприостановки по умолчанию (-1=отключено) (целочисленное)"
#: source/ubl-settings-bootloader.h:162 #: source/ubl-settings-bootloader.h:162
msgid "Force dont`t load nouveau driver video for Nvidia" msgid "Force dont`t load nouveau driver video for Nvidia"

Loading…
Cancel
Save