|
|
|
@ -2,110 +2,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
config main_config;
|
|
|
|
config main_config;
|
|
|
|
|
|
|
|
|
|
|
|
//signal emmit handlers - no header initialization
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**on_close_subwindow(GtkWidget *self)
|
|
|
|
|
|
|
|
* [EN]
|
|
|
|
|
|
|
|
* Closes window in which [self] is contained.
|
|
|
|
|
|
|
|
* [RU]
|
|
|
|
|
|
|
|
* Закрывает окно, в котором расположен виджет [self].
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void on_close_subwindow(GtkWidget *self){
|
|
|
|
|
|
|
|
gtk_widget_destroy(gtk_widget_get_toplevel(self));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_open_browser(GtkWidget *self, char *link)
|
|
|
|
|
|
|
|
* [EN]
|
|
|
|
|
|
|
|
* Opens browser with [link] link.
|
|
|
|
|
|
|
|
* [RU]
|
|
|
|
|
|
|
|
* Открывает браузер с [link] ссылкой.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void yon_open_browser(GtkWidget *self, char *link){
|
|
|
|
|
|
|
|
yon_ubl_browser_window_open(link,TITLE_LABEL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**on_open_documentation_confirmation(GtkWidget *self, char *link)
|
|
|
|
|
|
|
|
* [EN]
|
|
|
|
|
|
|
|
* Opens confirmation window for [link] link.
|
|
|
|
|
|
|
|
* [RU]
|
|
|
|
|
|
|
|
* Открывает окно подтверждение перехода по ссылке [link].
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void on_open_documentation_confirmation(GtkWidget *self, char *link){
|
|
|
|
|
|
|
|
if (main_config.always_open_documentation==0){
|
|
|
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
|
|
|
|
documentation_confirmation_window *widgets = malloc(sizeof(documentation_confirmation_window));
|
|
|
|
|
|
|
|
widgets->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow");
|
|
|
|
|
|
|
|
widgets->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton");
|
|
|
|
|
|
|
|
widgets->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton");
|
|
|
|
|
|
|
|
widgets->HatText = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel");
|
|
|
|
|
|
|
|
widgets->HeaderText = yon_gtk_builder_get_widget(builder,"helpHeader");
|
|
|
|
|
|
|
|
widgets->InfoText = yon_gtk_builder_get_widget(builder,"helpText");
|
|
|
|
|
|
|
|
widgets->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox");
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->HatText),TITLE_LABEL);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->HeaderText),HELP_TITLE_LABEL);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->InfoText),HELP_INFO_LABEL);
|
|
|
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(widgets->AcceptButton),OPEN_HELP_LABEL);
|
|
|
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(widgets->AlwaysOpenCheck),HELP_ALWAYS_OPEN_LABEL);
|
|
|
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(widgets->CloseButton),CANCEL_LABEL);
|
|
|
|
|
|
|
|
gtk_widget_show_all(widgets->Window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->CloseButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link));
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_open_browser(self,link);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**on_link(GtkWidget *self, char* uri, gpointer user_data)
|
|
|
|
|
|
|
|
* [EN]
|
|
|
|
|
|
|
|
* Signal for hadnling AboutDialog links.
|
|
|
|
|
|
|
|
* Connect to "activate-link" signal.
|
|
|
|
|
|
|
|
* [self] is AboutDialog window;
|
|
|
|
|
|
|
|
* [uri] is activated link;
|
|
|
|
|
|
|
|
* [user_data] is pointer for user data, hasn't used in standard handler;
|
|
|
|
|
|
|
|
* [RU]
|
|
|
|
|
|
|
|
* Функция для обработки сигнала нажатия на ссылку окна AboutDialog.
|
|
|
|
|
|
|
|
* Присоединять к сигналу "activate-link".
|
|
|
|
|
|
|
|
* [self] - окно AboutDialog;
|
|
|
|
|
|
|
|
* [uri] - ссылка, по которой совершается переход;
|
|
|
|
|
|
|
|
* [user_data] - указатель на любые другие данные, не используется в стандартном обработчике;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void on_link(GtkWidget *self, char* uri, gpointer user_data){
|
|
|
|
|
|
|
|
gtk_widget_destroy(self);
|
|
|
|
|
|
|
|
on_open_documentation_confirmation(self,uri);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**on_about()
|
|
|
|
|
|
|
|
* [EN]
|
|
|
|
|
|
|
|
* Function for setting up and showing AboutDialog.
|
|
|
|
|
|
|
|
* Connect it to "activate" signal of Documentation MenuItem.
|
|
|
|
|
|
|
|
* [RU]
|
|
|
|
|
|
|
|
* Функиця для настройки и показа окна AboutDialog.
|
|
|
|
|
|
|
|
* Присоединять к сигналу "activate" кнопки справки типа MenuItem.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void on_about(){
|
|
|
|
|
|
|
|
GtkBuilder *builder=gtk_builder_new_from_resource(glade_path);
|
|
|
|
|
|
|
|
GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow");
|
|
|
|
|
|
|
|
GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic");
|
|
|
|
|
|
|
|
GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide");
|
|
|
|
|
|
|
|
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application);
|
|
|
|
|
|
|
|
gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),PROJECT_HOME_LABEL);
|
|
|
|
|
|
|
|
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL);
|
|
|
|
|
|
|
|
gtk_widget_set_visible(hideButtonBox,0);
|
|
|
|
|
|
|
|
gtk_widget_destroy(hideButtonBox);
|
|
|
|
|
|
|
|
gtk_widget_show(window);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//functions
|
|
|
|
//functions
|
|
|
|
|
|
|
|
|
|
|
|
void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
if (yon_config_load_register(type,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL)){}
|
|
|
|
if (yon_config_load_register(type,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL)){}
|
|
|
|
else
|
|
|
|
else{
|
|
|
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
yon_ubl_status_box_render(LOAD_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
yon_ubl_status_box_render(LOAD_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -123,7 +28,8 @@ void yon_config_local_load(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0);
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),yon_config_get_by_key(hostname_parameter));
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),yon_config_get_by_key(hostname_parameter));
|
|
|
|
for_iter(GTK_TREE_MODEL(widgets->languagelist),&iter){
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->languagelist),&iter);
|
|
|
|
|
|
|
|
for(;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->languagelist),&iter)){
|
|
|
|
gtk_list_store_set(widgets->languagelist,&iter,2,0,-1);
|
|
|
|
gtk_list_store_set(widgets->languagelist,&iter,2,0,-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *id = yon_config_get_by_key(id_parameter);
|
|
|
|
char *id = yon_config_get_by_key(id_parameter);
|
|
|
|
@ -168,8 +74,12 @@ void yon_config_local_load(GtkWidget *self, main_window *widgets){
|
|
|
|
if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string);
|
|
|
|
if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets);
|
|
|
|
if (getuid()==0)
|
|
|
|
if (getuid()==0){
|
|
|
|
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main_config.load_mode=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
void yon_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
@ -186,7 +96,8 @@ void yon_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0);
|
|
|
|
yon_load_proceed(YON_CONFIG_GLOBAL);
|
|
|
|
yon_load_proceed(YON_CONFIG_GLOBAL);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),yon_config_get_by_key(hostname_parameter));
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),yon_config_get_by_key(hostname_parameter));
|
|
|
|
for_iter(GTK_TREE_MODEL(widgets->languagelist),&iter){
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->languagelist),&iter);
|
|
|
|
|
|
|
|
for(;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->languagelist),&iter)){
|
|
|
|
gtk_list_store_set(widgets->languagelist,&iter,2,0,-1);
|
|
|
|
gtk_list_store_set(widgets->languagelist,&iter,2,0,-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *id = yon_config_get_by_key(id_parameter);
|
|
|
|
char *id = yon_config_get_by_key(id_parameter);
|
|
|
|
@ -194,7 +105,7 @@ void yon_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->IDCombo),1);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->IDCombo),1);
|
|
|
|
else if (!strcmp(id,"hardware"))
|
|
|
|
else if (!strcmp(id,"hardware"))
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->IDCombo),2);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->IDCombo),2);
|
|
|
|
else{
|
|
|
|
else {
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),id);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),id);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->IDCombo),3);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->IDCombo),3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -231,24 +142,54 @@ void yon_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string);
|
|
|
|
if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets);
|
|
|
|
if (getuid()==0)
|
|
|
|
if (getuid()==0){
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main_config.load_mode=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_config_global_local_save(){
|
|
|
|
void yon_config_global_local_save(){
|
|
|
|
yon_config_save_registered(NULL);
|
|
|
|
int changed = yon_config_get_status(id_parameter)==1;
|
|
|
|
yon_ubl_status_box_render(yon_char_unite(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL);
|
|
|
|
|
|
|
|
if (window){
|
|
|
|
|
|
|
|
if (changed){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// yon_ubl_status_box_render(yon_char_unite(SAVE_SUCCESS,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_config_local_save(){
|
|
|
|
void yon_config_local_save(){
|
|
|
|
yon_config_save_registered("system");
|
|
|
|
int changed = yon_config_get_status(id_parameter)==1;
|
|
|
|
yon_ubl_status_box_render(yon_char_unite(LOCAL_SAVE_SUCCESS_LABEL,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
template_saving_window *window = yon_save_proceed("system",YON_CONFIG_LOCAL,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL);
|
|
|
|
|
|
|
|
if (window){
|
|
|
|
|
|
|
|
if (changed){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// yon_ubl_status_box_render(yon_char_unite(LOCAL_SAVE_SUCCESS,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_config_global_save(){
|
|
|
|
void yon_config_global_save(){
|
|
|
|
yon_config_save_registered("global");
|
|
|
|
int changed = yon_config_get_status(id_parameter)==1;
|
|
|
|
yon_ubl_status_box_render(yon_char_unite(GLOBAL_SAVE_SUCCESS_LABEL,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL);
|
|
|
|
|
|
|
|
if (window){
|
|
|
|
|
|
|
|
if (changed){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// yon_ubl_status_box_render(yon_char_unite(GLOBAL_SAVE_SUCCESS,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -280,7 +221,7 @@ void on_locale_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),final_string);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),final_string);
|
|
|
|
if (yon_config_get_by_key("LOCALE")) yon_config_set("LOCALE",final_ids);
|
|
|
|
if (yon_config_get_by_key("LOCALE")) yon_config_set("LOCALE",final_ids);
|
|
|
|
else yon_config_register("LOCALE",locale_section,final_ids);
|
|
|
|
else yon_config_register("LOCALE",locale_section,final_ids);
|
|
|
|
on_close_subwindow(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_locale_open(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_locale_open(GtkWidget *self, main_window *widgets){
|
|
|
|
@ -297,7 +238,7 @@ void on_locale_open(GtkWidget *self, main_window *widgets){
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_locale_accept),dict);
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_locale_accept),dict);
|
|
|
|
g_signal_connect(G_OBJECT(window->MainTree),"row-activated",G_CALLBACK(on_locale_toggle),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->MainTree),"row-activated",G_CALLBACK(on_locale_toggle),window);
|
|
|
|
gtk_dialog_run(GTK_DIALOG(window->Window));
|
|
|
|
gtk_dialog_run(GTK_DIALOG(window->Window));
|
|
|
|
@ -397,10 +338,6 @@ void on_language_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
void config_init(){
|
|
|
|
void config_init(){
|
|
|
|
main_config.always_open_documentation=0;
|
|
|
|
main_config.always_open_documentation=0;
|
|
|
|
main_config.win_height=0;
|
|
|
|
|
|
|
|
main_config.win_width=0;
|
|
|
|
|
|
|
|
main_config.win_pos_x=0;
|
|
|
|
|
|
|
|
main_config.win_pos_y=0;
|
|
|
|
|
|
|
|
main_config.socket_id=-1;
|
|
|
|
main_config.socket_id=-1;
|
|
|
|
main_config.save_socket_id=-1;
|
|
|
|
main_config.save_socket_id=-1;
|
|
|
|
main_config.load_socket_id=-1;
|
|
|
|
main_config.load_socket_id=-1;
|
|
|
|
@ -411,34 +348,11 @@ void config_init(){
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main_window *setup_window(){
|
|
|
|
main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
/* Widgets getting | Получение виджетов */
|
|
|
|
/* Widgets getting | Получение виджетов */
|
|
|
|
main_window *widgets = malloc(sizeof(main_window));
|
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
|
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->InterfaceBox),yon_gtk_builder_get_widget(builder,"BoxMain"),1,1,0);
|
|
|
|
widgets->HatLabel = yon_gtk_builder_get_widget(builder,"headerTopic");
|
|
|
|
|
|
|
|
widgets->PlugBox = yon_gtk_builder_get_widget(builder,"plugBox");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets->HeadOverlay = yon_gtk_builder_get_widget(builder,"HeadOverlay");
|
|
|
|
|
|
|
|
widgets->HeadImage = yon_gtk_builder_get_widget(builder,"HeadBackgroundImage");
|
|
|
|
|
|
|
|
widgets->HeadBox = yon_gtk_builder_get_widget(builder,"HeaderBox");
|
|
|
|
|
|
|
|
widgets->HeadTitleLabel = yon_gtk_builder_get_widget(builder,"HeaderTitleLabel");
|
|
|
|
|
|
|
|
widgets->HeadInfoLabel = yon_gtk_builder_get_widget(builder,"HeaderInfoLabel");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets->StatusBox = yon_gtk_builder_get_widget(builder,"mainStatusBox");
|
|
|
|
|
|
|
|
widgets->StatusIcon = yon_gtk_builder_get_widget(builder,"mainStatusIcon");
|
|
|
|
|
|
|
|
widgets->StatusLabel = yon_gtk_builder_get_widget(builder,"mainStatusLabel");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets->SaveLabel = yon_gtk_builder_get_widget(builder,"headerSaveConfigLabel");
|
|
|
|
|
|
|
|
widgets->SaveMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalLocalConfigurationMenuItem");
|
|
|
|
|
|
|
|
widgets->SaveGlobalMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalConfigurationMenuItem");
|
|
|
|
|
|
|
|
widgets->SaveLocalMenuItem = yon_gtk_builder_get_widget(builder,"SaveLocalConfigurationMenuItem");
|
|
|
|
|
|
|
|
widgets->RightBox = yon_gtk_builder_get_widget(builder,"HeaderRightBox");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets->LoadLabel = yon_gtk_builder_get_widget(builder,"headerLoadConfigLabel");
|
|
|
|
|
|
|
|
widgets->LoadGlobalMenuItem = yon_gtk_builder_get_widget(builder,"LoadGlobalConfigurationMenuItem");
|
|
|
|
|
|
|
|
widgets->LoadLocalMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem");
|
|
|
|
|
|
|
|
widgets->LeftBox = yon_gtk_builder_get_widget(builder,"HeaderLeftBox");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets->HostnameEntry = yon_gtk_builder_get_widget(builder,"HostnameEntry");
|
|
|
|
widgets->HostnameEntry = yon_gtk_builder_get_widget(builder,"HostnameEntry");
|
|
|
|
widgets->IDCombo = yon_gtk_builder_get_widget(builder,"IDCombo");
|
|
|
|
widgets->IDCombo = yon_gtk_builder_get_widget(builder,"IDCombo");
|
|
|
|
@ -514,6 +428,7 @@ main_window *setup_window(){
|
|
|
|
gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
|
|
|
|
gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_widget_show(widgets->Window);
|
|
|
|
gtk_widget_show(widgets->Window);
|
|
|
|
|
|
|
|
yon_config_local_load(NULL,widgets);
|
|
|
|
return widgets;
|
|
|
|
return widgets;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -536,12 +451,11 @@ int main(int argc, char *argv[]){
|
|
|
|
{"socket-id", 1, 0, 's'},
|
|
|
|
{"socket-id", 1, 0, 's'},
|
|
|
|
{"socket-ext-id", 1,0, 'e'},
|
|
|
|
{"socket-ext-id", 1,0, 'e'},
|
|
|
|
{"socket-trd-id", 1,0, 't'},
|
|
|
|
{"socket-trd-id", 1,0, 't'},
|
|
|
|
{"debug", 0,0, 'd'},
|
|
|
|
{"clear-config", 0,0, 'c'},
|
|
|
|
{"clean-config", 0,0, 'c'},
|
|
|
|
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
for (int i=0;i<argc;i++){
|
|
|
|
for (int i=0;i<argc;i++){
|
|
|
|
int argument=getopt_long(argc,argv,"hVvs:e:t:d",long_options,&option_index);
|
|
|
|
int argument=getopt_long(argc,argv,"hVvs:e:t:c",long_options,&option_index);
|
|
|
|
switch(argument){
|
|
|
|
switch(argument){
|
|
|
|
case 'h':
|
|
|
|
case 'h':
|
|
|
|
show_help=1;
|
|
|
|
show_help=1;
|
|
|
|
@ -563,7 +477,7 @@ int main(int argc, char *argv[]){
|
|
|
|
if(optarg)
|
|
|
|
if(optarg)
|
|
|
|
main_config.load_socket_id=atoi(optarg);
|
|
|
|
main_config.load_socket_id=atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'c': rmdir(yon_char_unite(yon_ubl_user_get_home_directory(),"/",LocaleName,"/",LocaleName,".conf",NULL));
|
|
|
|
case 'c': system(yon_char_unite("rm -rfd ", yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",NULL));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
main_config.lock_help=1;
|
|
|
|
main_config.lock_help=1;
|
|
|
|
@ -597,21 +511,24 @@ int main(int argc, char *argv[]){
|
|
|
|
gtk_init(&argc,&argv);
|
|
|
|
gtk_init(&argc,&argv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main_window *widgets = setup_window();
|
|
|
|
yon_ubl_connect_config((_template_config*)&main_config);
|
|
|
|
yon_ubl_header_setup_resource(widgets->HeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path);
|
|
|
|
yon_ubl_window_init(TITLE_LABEL,TITLE_INFO_LABEL,LocaleName,CssPath,LocaleName,version_application,WIKI_LINK);
|
|
|
|
|
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
|
yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel);
|
|
|
|
yon_main_window_complete((main_window*)widgets);
|
|
|
|
if (getuid()!=0)
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
// if (getuid()!=0){
|
|
|
|
yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id);
|
|
|
|
// textdomain(template_ui_LocaleName);
|
|
|
|
yon_window_config_setup(GTK_WINDOW(widgets->Window));
|
|
|
|
// yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
yon_window_config_load(config_path);
|
|
|
|
// textdomain(LocaleName);
|
|
|
|
yon_config_local_load(NULL,widgets);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id);
|
|
|
|
GtkCssProvider *css=gtk_css_provider_new();
|
|
|
|
// yon_window_config_setup(GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_css_provider_load_from_resource(css,CssPath);
|
|
|
|
// yon_window_config_load(config_path);
|
|
|
|
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
|
|
|
|
|
|
|
|
GTK_STYLE_PROVIDER(css),
|
|
|
|
// GtkCssProvider *css=gtk_css_provider_new();
|
|
|
|
-1);
|
|
|
|
// gtk_css_provider_load_from_resource(css,CssPath);
|
|
|
|
|
|
|
|
// gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
|
|
|
|
|
|
|
|
// GTK_STYLE_PROVIDER(css),
|
|
|
|
|
|
|
|
// -1);
|
|
|
|
gtk_main();
|
|
|
|
gtk_main();
|
|
|
|
}
|
|
|
|
}
|