|
|
|
|
@ -401,7 +401,9 @@ gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_main_window_create(main_window *widgets){
|
|
|
|
|
__attribute__((unused)) char *locale = setlocale(LC_ALL, "en_US.UTF-8");
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
|
yon_translation_init(builder);
|
|
|
|
|
gtk_builder_add_callback_symbol(builder,"yon_gtk_widget_set_sensitive_from_toggle_button",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button));
|
|
|
|
|
gtk_builder_add_callback_symbol(builder,"on_toggle_button_switch_on",G_CALLBACK(on_toggle_button_switch_on));
|
|
|
|
|
// Custom widgets configuration
|
|
|
|
|
@ -713,6 +715,7 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->DocumentationMenuItem);
|
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->AboutMenuItem);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LicenseAgreeRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextButton);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadGlobalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets);
|
|
|
|
|
@ -749,8 +752,8 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LocaleCell),"toggled",G_CALLBACK(on_locale_toggled),widgets);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_cancel_clicked),widgets);
|
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets);
|
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ZoneCombo),"changed",G_CALLBACK(on_zone_changed),widgets);
|
|
|
|
|
#endif
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->RegionCombo);
|
|
|
|
|
@ -870,7 +873,9 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(yon_on_about),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_window_config_setup(GTK_WINDOW(widgets->MainWindow));
|
|
|
|
|
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(widgets->MainWindow),NULL,TITLE_LABEL,icon_path,NULL);
|
|
|
|
|
|
|
|
|
|
@ -922,10 +927,6 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
if (main_config.lock_load_global == 1){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->LoadGlobalConfigurationMenuItem,0);
|
|
|
|
|
}
|
|
|
|
|
if (getuid()){
|
|
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(widgets->MainWindow),TITLE_LABEL);
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(widgets->MainWindow),icon_path);
|
|
|
|
|
@ -953,6 +954,13 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_hide(widgets->StartScenarioButton);
|
|
|
|
|
}
|
|
|
|
|
if (getuid()){
|
|
|
|
|
gtk_menu_item_activate(GTK_MENU_ITEM(widgets->ConfigurationModeMenuItem));
|
|
|
|
|
if (yon_char_is_empty(main_config.config_save_path)){
|
|
|
|
|
gtk_main_quit();
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (main_config.force_ini){
|
|
|
|
|
if (yon_configuration_path_check(main_config.config_save_path)){
|
|
|
|
|
GList *box = gtk_container_get_children(GTK_CONTAINER(widgets->ConfigurationModeMenuItem));
|
|
|
|
|
@ -967,8 +975,6 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_locale_init();
|
|
|
|
|
set_locales_list(widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean yon_maximize_start(main_window *widgets){
|
|
|
|
|
@ -989,7 +995,7 @@ void *yon_maximize(main_window *widgets){
|
|
|
|
|
* Функция настройки основного окна приложения. [widgets] - структура со стандартным интерфейсом.
|
|
|
|
|
*/
|
|
|
|
|
main_window *yon_main_window_complete(){
|
|
|
|
|
if (main_config.force_ini){
|
|
|
|
|
if (main_config.force_ini){ //Check if config path exists
|
|
|
|
|
if (yon_configuration_path_check(main_config.config_save_path)){
|
|
|
|
|
{
|
|
|
|
|
main_config.configure_mode=1;
|
|
|
|
|
@ -997,17 +1003,32 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
main_window *widgets=NULL;
|
|
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
|
|
widgets = malloc(sizeof(main_window));
|
|
|
|
|
memset(widgets,0,sizeof(main_window));
|
|
|
|
|
yon_startup_language_init();
|
|
|
|
|
yon_main_window_create(widgets);
|
|
|
|
|
yon_window_config_setup(GTK_WINDOW(widgets->MainWindow));
|
|
|
|
|
// yon_window_config_custom_window_setup(GTK_WINDOW(widgets->MainWindow),"MainWindow");
|
|
|
|
|
|
|
|
|
|
yon_startup_language_init();
|
|
|
|
|
yon_locale_init();
|
|
|
|
|
set_locales_list(widgets);
|
|
|
|
|
// yon_main_window_update_locale(widgets);
|
|
|
|
|
// // yon_window_config_custom_window_setup(GTK_WINDOW(widgets->MainWindow),"MainWindow");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int fullscreen = 0;
|
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
|
if (access(path,F_OK)){
|
|
|
|
|
fullscreen = 1;
|
|
|
|
|
g_thread_new("fullscreen",(GThreadFunc)yon_maximize,widgets);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
yon_window_config_load(path);
|
|
|
|
|
yon_window_config_add_instant_parameter("fullscreen","window",&fullscreen,YON_TYPE_BOOLEAN);
|
|
|
|
|
yon_main_window_update_locale(widgets);
|
|
|
|
|
return widgets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
|
|
|
__attribute__((unused)) char *locale = setlocale(LC_ALL, "");
|
|
|
|
|
// __attribute__((unused)) char *locale = setlocale(LC_ALL, "en_US.UTF-8");
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
yon_ubl_connect_config((_template_config*)&main_config);
|
|
|
|
|
config_init();
|
|
|
|
|
@ -1040,31 +1061,24 @@ int main(int argc, char *argv[]){
|
|
|
|
|
}
|
|
|
|
|
gtk_init(&argc,&argv);
|
|
|
|
|
main_window *widgets = NULL;
|
|
|
|
|
if (widgets){};
|
|
|
|
|
int fullscreen = 0;
|
|
|
|
|
GtkCssProvider *css=gtk_css_provider_new();
|
|
|
|
|
gtk_css_provider_load_from_resource(css,CssPath);
|
|
|
|
|
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
|
|
|
|
|
GTK_STYLE_PROVIDER(css),
|
|
|
|
|
-1);
|
|
|
|
|
{
|
|
|
|
|
widgets = yon_main_window_complete();
|
|
|
|
|
GtkWidget *root_button = yon_root_button_new(argv,argc);
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(root_button),"menuitemtop");
|
|
|
|
|
|
|
|
|
|
gtk_menu_shell_prepend(GTK_MENU_SHELL(gtk_widget_get_parent(widgets->AboutMenuItem)),root_button);
|
|
|
|
|
|
|
|
|
|
yon_root_button_init(root_button,GTK_WINDOW(widgets->MainWindow));
|
|
|
|
|
on_config_global_load(NULL,widgets);
|
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
|
if (access(path,F_OK)){
|
|
|
|
|
fullscreen = 1;
|
|
|
|
|
g_thread_new("fullscreen",(GThreadFunc)yon_maximize,widgets);
|
|
|
|
|
|
|
|
|
|
on_config_global_load(NULL,widgets);
|
|
|
|
|
}
|
|
|
|
|
yon_window_config_load(path);
|
|
|
|
|
yon_window_config_add_instant_parameter("fullscreen","window",&fullscreen,YON_TYPE_BOOLEAN);
|
|
|
|
|
|
|
|
|
|
main_config.launch_arguments=yon_char_parsed_copy(argv,argc);
|
|
|
|
|
main_config.launch_size=argc;
|
|
|
|
|
GtkCssProvider *css=gtk_css_provider_new();
|
|
|
|
|
gtk_css_provider_load_from_resource(css,CssPath);
|
|
|
|
|
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
|
|
|
|
|
GTK_STYLE_PROVIDER(css),
|
|
|
|
|
-1);
|
|
|
|
|
if (getuid()!=0){
|
|
|
|
|
yon_ubl_status_box_render(yon_char_get_localised_from_lib(ROOT_WARNING_LABEL),BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
|