|
|
|
|
@ -101,65 +101,66 @@ void yon_on_about(GtkWidget *, main_window *){
|
|
|
|
|
//functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
GtkWidget *dialog = gtk_dialog_new_with_buttons(TITLE_LABEL,GTK_WINDOW(gtk_widget_get_toplevel(self)),GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
gtk_window_set_modal(GTK_WINDOW(dialog),1);
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName));
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL);
|
|
|
|
|
gtk_widget_set_size_request(dialog,450,-1);
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_header_bar(GTK_DIALOG(dialog))));
|
|
|
|
|
GtkWidget *image_cancel = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.cancel-symbolic",GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
GtkWidget *image_accept = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.accept-symbolic",GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
gtk_button_set_image((GtkButton*)g_list_nth_data(list,0),image_cancel);
|
|
|
|
|
gtk_button_set_image((GtkButton*)g_list_nth_data(list,1),image_accept);
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,0)),"marginright");
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,1)),"marginright");
|
|
|
|
|
|
|
|
|
|
g_list_free(list);
|
|
|
|
|
GtkWidget *header_label = gtk_label_new(yon_char_is_empty(data->title)?TITLE_LABEL:data->title);
|
|
|
|
|
gtk_widget_show(header_label);
|
|
|
|
|
PangoAttrList *attributes = pango_attr_list_new();
|
|
|
|
|
PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
|
|
|
|
|
pango_attr_list_insert(attributes, boldAttr);
|
|
|
|
|
gtk_label_set_attributes(GTK_LABEL(header_label),attributes);
|
|
|
|
|
|
|
|
|
|
GtkWidget *header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
|
|
|
|
|
gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label);
|
|
|
|
|
gtk_widget_show(header);
|
|
|
|
|
|
|
|
|
|
GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_DIALOG);
|
|
|
|
|
gtk_widget_show(image);
|
|
|
|
|
gtk_widget_set_margin_start(image,20);
|
|
|
|
|
gtk_widget_set_margin_end(image,20);
|
|
|
|
|
gtk_widget_set_margin_bottom(image,20);
|
|
|
|
|
gtk_widget_set_margin_top(image,20);
|
|
|
|
|
|
|
|
|
|
GtkWidget *label = gtk_label_new("");
|
|
|
|
|
gtk_widget_set_margin_end(label,20);
|
|
|
|
|
gtk_widget_show(label);
|
|
|
|
|
gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD);
|
|
|
|
|
gtk_label_set_line_wrap(GTK_LABEL(label),1);
|
|
|
|
|
gtk_label_set_markup(GTK_LABEL(label),data->action_text);
|
|
|
|
|
|
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
gtk_widget_show(box);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),image,0,0,5);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5);
|
|
|
|
|
|
|
|
|
|
gtk_window_set_default_size(GTK_WINDOW(dialog),450,-1);
|
|
|
|
|
|
|
|
|
|
int resp = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
|
if (resp == GTK_RESPONSE_ACCEPT){
|
|
|
|
|
if (data->function){
|
|
|
|
|
data->function(NULL,data->data);
|
|
|
|
|
}
|
|
|
|
|
} else resp=0;
|
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
// int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){
|
|
|
|
|
// textdomain(template_ui_LocaleName);
|
|
|
|
|
// GtkWindow *parent = self?GTK_WINDOW(gtk_widget_get_toplevel(self)):NULL;
|
|
|
|
|
// GtkWidget *dialog = gtk_dialog_new_with_buttons(TITLE_LABEL,parent,GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
// textdomain(LocaleName);
|
|
|
|
|
// gtk_window_set_modal(GTK_WINDOW(dialog),1);
|
|
|
|
|
// gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName));
|
|
|
|
|
// gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL);
|
|
|
|
|
// gtk_widget_set_size_request(dialog,450,-1);
|
|
|
|
|
// GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_header_bar(GTK_DIALOG(dialog))));
|
|
|
|
|
// GtkWidget *image_cancel = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.cancel-symbolic",GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
// GtkWidget *image_accept = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.accept-symbolic",GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
// gtk_button_set_image((GtkButton*)g_list_nth_data(list,0),image_cancel);
|
|
|
|
|
// gtk_button_set_image((GtkButton*)g_list_nth_data(list,1),image_accept);
|
|
|
|
|
// gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,0)),"marginright");
|
|
|
|
|
// gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,1)),"marginright");
|
|
|
|
|
|
|
|
|
|
// g_list_free(list);
|
|
|
|
|
// GtkWidget *header_label = gtk_label_new(yon_char_is_empty(data->title)?TITLE_LABEL:data->title);
|
|
|
|
|
// gtk_widget_show(header_label);
|
|
|
|
|
// PangoAttrList *attributes = pango_attr_list_new();
|
|
|
|
|
// PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
|
|
|
|
|
// pango_attr_list_insert(attributes, boldAttr);
|
|
|
|
|
// gtk_label_set_attributes(GTK_LABEL(header_label),attributes);
|
|
|
|
|
|
|
|
|
|
// GtkWidget *header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
|
|
|
|
|
// gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label);
|
|
|
|
|
// gtk_widget_show(header);
|
|
|
|
|
|
|
|
|
|
// GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_DIALOG);
|
|
|
|
|
// gtk_widget_show(image);
|
|
|
|
|
// gtk_widget_set_margin_start(image,20);
|
|
|
|
|
// gtk_widget_set_margin_end(image,20);
|
|
|
|
|
// gtk_widget_set_margin_bottom(image,20);
|
|
|
|
|
// gtk_widget_set_margin_top(image,20);
|
|
|
|
|
|
|
|
|
|
// GtkWidget *label = gtk_label_new("");
|
|
|
|
|
// gtk_widget_set_margin_end(label,20);
|
|
|
|
|
// gtk_widget_show(label);
|
|
|
|
|
// gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD);
|
|
|
|
|
// gtk_label_set_line_wrap(GTK_LABEL(label),1);
|
|
|
|
|
// gtk_label_set_markup(GTK_LABEL(label),data->action_text);
|
|
|
|
|
|
|
|
|
|
// GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
// gtk_widget_show(box);
|
|
|
|
|
// gtk_box_pack_start(GTK_BOX(box),image,0,0,5);
|
|
|
|
|
// gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
|
|
|
|
|
// gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5);
|
|
|
|
|
|
|
|
|
|
// gtk_window_set_default_size(GTK_WINDOW(dialog),450,-1);
|
|
|
|
|
|
|
|
|
|
// int resp = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
|
// if (resp == GTK_RESPONSE_ACCEPT){
|
|
|
|
|
// if (data->function){
|
|
|
|
|
// data->function(NULL,data->data);
|
|
|
|
|
// }
|
|
|
|
|
// } else resp=0;
|
|
|
|
|
// gtk_widget_destroy(dialog);
|
|
|
|
|
// return resp;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// //functions
|
|
|
|
|
// void yon_encryption_type_setup(GtkComboBoxText *target){
|
|
|
|
|
@ -464,7 +465,7 @@ void on_locale_changed(GtkWidget *,main_window *widgets){
|
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&model,&iter)) return;
|
|
|
|
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter));
|
|
|
|
|
char *config_code = config(installer_lang_parameter);
|
|
|
|
|
char *config_code = config(installer_locale_parameter);
|
|
|
|
|
if (yon_char_is_empty(config_code)){
|
|
|
|
|
config_code = setlocale(LC_ALL,NULL);
|
|
|
|
|
}
|
|
|
|
|
@ -492,13 +493,13 @@ void on_installer_language_changed(GtkWidget *self,GtkTreePath*,GtkTreeViewColum
|
|
|
|
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&model,&iter)) return;
|
|
|
|
|
gtk_tree_model_get(model,&iter,2,&window_language,-1);
|
|
|
|
|
if (!yon_char_is_empty(window_language)){
|
|
|
|
|
char *prev_lang = config(installer_lang_parameter);
|
|
|
|
|
char *prev_lang = config(installer_locale_parameter);
|
|
|
|
|
if (!yon_char_is_empty(prev_lang)&&!strcmp(prev_lang,window_language)) return;
|
|
|
|
|
yon_config_register(installer_lang_parameter,installer_lang_parameter_command,(char*)window_language);
|
|
|
|
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,(char*)window_language);
|
|
|
|
|
}
|
|
|
|
|
char *active_lang_id = gtk_tree_model_get_string_from_iter(model,&iter);
|
|
|
|
|
int size;
|
|
|
|
|
config_str parameters = yon_config_get_save_parameters_by_key(&size,installer_lang_parameter,NULL);
|
|
|
|
|
config_str parameters = yon_config_get_save_parameters_by_key(&size,installer_locale_parameter,NULL);
|
|
|
|
|
char *command_parameters = yon_char_parsed_to_string(parameters,size," ");
|
|
|
|
|
char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL);
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->MainWindow),G_CALLBACK(on_yon_exit),widgets);
|
|
|
|
|
@ -537,7 +538,7 @@ void set_locales_list(main_window *widgets){
|
|
|
|
|
gtk_list_store_clear(widgets->InstallerLanguageList);
|
|
|
|
|
gtk_list_store_clear(widgets->InstallerCountryList);
|
|
|
|
|
|
|
|
|
|
char *config_code = yon_char_new(config(installer_lang_parameter));
|
|
|
|
|
char *config_code = yon_char_new(config(installer_locale_parameter));
|
|
|
|
|
int size;
|
|
|
|
|
config_str locales = yon_locale_get_all_codes(&size);
|
|
|
|
|
qsort(locales,size,sizeof(char*),yon_char_parsed_compare);
|
|
|
|
|
@ -604,7 +605,7 @@ gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *w
|
|
|
|
|
char *code;
|
|
|
|
|
gtk_tree_model_get(model,&itar,0,&code,-1);
|
|
|
|
|
if (!strcmp(code,cur_code)){
|
|
|
|
|
char *config_lang = config(installer_lang_parameter);
|
|
|
|
|
char *config_lang = config(installer_locale_parameter);
|
|
|
|
|
if (!yon_char_is_empty(config_lang)&&!strcmp(cur_code,config_lang)){
|
|
|
|
|
if (gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),iter,&itar)){
|
|
|
|
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&itar);
|
|
|
|
|
@ -1160,13 +1161,19 @@ void yon_main_window_create(main_window *widgets){
|
|
|
|
|
gtk_widget_hide(widgets->StartScenarioButton);
|
|
|
|
|
}
|
|
|
|
|
if (main_config.force_ini){
|
|
|
|
|
main_config.configure_mode=1;
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->ConfigurationModeMenuItem),G_CALLBACK(on_configuration_mode_switch),widgets);
|
|
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,0);
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ConfigurationModeMenuItem),G_CALLBACK(on_configuration_mode_switch),widgets);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox),"config_mode",CONFIGURATION_MODE_STATUS_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox2),"config_mede",CONFIG_PATH_LABEL(main_config.config_save_path),BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
if (yon_configuration_path_check(main_config.config_save_path)){
|
|
|
|
|
main_config.configure_mode=1;
|
|
|
|
|
GList *box = gtk_container_get_children(GTK_CONTAINER(widgets->ConfigurationModeMenuItem));
|
|
|
|
|
GList *children = gtk_container_get_children(GTK_CONTAINER(box->data));
|
|
|
|
|
|
|
|
|
|
GtkWidget *Check = GTK_WIDGET(g_list_nth_data(children,1));
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Check),1);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox),"config_mode",CONFIGURATION_MODE_STATUS_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox2),"config_mede",CONFIG_PATH_LABEL(main_config.config_save_path),BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_main_quit();
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_locale_init();
|
|
|
|
|
set_locales_list(widgets);
|
|
|
|
|
|