Created config owner fix

pull/207/head
parent 77dae8e156
commit 4bdf1a5da2

@ -1,37 +1,38 @@
#include "ubinstall-gtk.h" #include "ubinstall-gtk.h"
int yon_configuration_path_check(const char *path){ int yon_configuration_path_check(const char *path){
char *full_path = yon_char_new(path); char *full_path = NULL;
if (access(path,F_OK)){ int homedir_create = 0;
int homedir_create = 0; int pos = yon_char_find_last((char*)path,'/');
int pos = yon_char_find_last((char*)path,'/'); if (pos>-1){
if (pos>-1){ char *path_copy = yon_char_new(path);
char *path_copy = yon_char_new(path); char *dir_path = yon_char_divide(path_copy,pos);
char *dir_path = yon_char_divide(path_copy,pos); if (access(dir_path,F_OK)){
if (access(dir_path,F_OK)){ homedir_create = 1;
homedir_create = 1;
}
free(path_copy);
free(dir_path);
} else {
homedir_create = 1;
} }
free(path_copy);
free(dir_path);
} else {
homedir_create = 1;
}
if (homedir_create){
full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL);
} else {
full_path = yon_char_new(path);
}
if (access(full_path,F_OK)){
dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL; data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL;
data->title = WARNING_TITLE_LABEL; data->title = WARNING_TITLE_LABEL;
if (yon_confirmation_dialog_call(NULL,data)==GTK_RESPONSE_ACCEPT){ if (yon_confirmation_dialog_call(NULL,data)==GTK_RESPONSE_ACCEPT){
if (homedir_create){
free(full_path);
full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL);
} else {
free(full_path);
full_path = yon_char_new(path);
}
yon_launch(ubconfig_file_create(full_path)); yon_launch(ubconfig_file_create(full_path));
struct passwd *user = getpwnam(yon_ubl_root_user_get());
if (chown(full_path,user->pw_uid,user->pw_gid)){};
} else return 0; }
} }
main_config.config_load_path = full_path;
if (!yon_char_is_empty(main_config.config_save_path)) free(main_config.config_save_path); if (!yon_char_is_empty(main_config.config_save_path)) free(main_config.config_save_path);
main_config.config_save_path = yon_char_new(full_path); main_config.config_save_path = yon_char_new(full_path);
return 1; return 1;

@ -515,7 +515,7 @@ void on_installer_language_changed(GtkWidget *self,GtkTreePath*,GtkTreeViewColum
void yon_main_window_update_locale(main_window *widgets){ void yon_main_window_update_locale(main_window *widgets){
int size; int size;
char *command = yon_config_parameter_prepare_command(get_localisation_command,main_config.config_load_path,NULL,NULL); char *command = yon_config_parameter_prepare_command(get_localisation_command,main_config.config_load_path,NULL,NULL);
config_str locale_output = yon_config_load(command,&size); config_str locale_output = yon_config_load(yon_debug_output("%s\n",command),&size);
char *locale = NULL; char *locale = NULL;
if (size&&strcmp(locale_output[0],"(null)\n")){ if (size&&strcmp(locale_output[0],"(null)\n")){
yon_char_remove_last_symbol(locale_output[0],'\n'); yon_char_remove_last_symbol(locale_output[0],'\n');
@ -532,7 +532,7 @@ void yon_main_window_update_locale(main_window *widgets){
yon_char_parsed_free(locale_output,size); yon_char_parsed_free(locale_output,size);
gtk_widget_destroy(widgets->MainWindow); gtk_widget_destroy(widgets->MainWindow);
textdomain(LocaleName); bind_textdomain_codeset(LocaleName,"UTF-8");
g_setenv("LANGUAGE",locale,1); g_setenv("LANGUAGE",locale,1);
yon_main_window_create(widgets); yon_main_window_create(widgets);
@ -565,7 +565,7 @@ void set_locales_list(main_window *widgets){
qsort(locales,size,sizeof(char*),yon_char_parsed_compare); qsort(locales,size,sizeof(char*),yon_char_parsed_compare);
GtkTreeIter iter,itar; GtkTreeIter iter,itar;
GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal); GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal);
textdomain(LOCALES_DOMAIN_NAME); bind_textdomain_codeset(LOCALES_DOMAIN_NAME,"UTF-8");
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){
char *lang_ab = yon_locale_get_parameter(locales[i],YON_LOCALE_LANG_AB); char *lang_ab = yon_locale_get_parameter(locales[i],YON_LOCALE_LANG_AB);
char *code = yon_locale_get_parameter(locales[i],YON_LOCALE_CODE); char *code = yon_locale_get_parameter(locales[i],YON_LOCALE_CODE);
@ -609,7 +609,7 @@ void set_locales_list(main_window *widgets){
on_locale_changed(NULL,widgets); on_locale_changed(NULL,widgets);
} }
} }
textdomain(LocaleName); bind_textdomain_codeset(LocaleName,"UTF-8");
} }
@ -1162,12 +1162,11 @@ void yon_main_window_create(main_window *widgets){
config_str parsed = NULL; config_str parsed = NULL;
parsed = yon_file_open(licence_path,&size); parsed = yon_file_open(licence_path,&size);
if (size){ if (size){
textdomain("ublinux-init-eula"); bind_textdomain_codeset("ublinux-init-eula","UTF-8");
char *licence = yon_char_parsed_to_string(parsed,size,""); char *licence = yon_char_parsed_to_string(parsed,size,"");
gtk_label_set_text(GTK_LABEL(widgets->LicenceLabel),_(licence)); gtk_label_set_text(GTK_LABEL(widgets->LicenceLabel),_(licence));
free(licence); free(licence);
yon_char_parsed_free(parsed,size); yon_char_parsed_free(parsed,size);bind_textdomain_codeset(LocaleName,"UTF-8");
textdomain(LocaleName);
} }
} }
gtk_builder_connect_signals(builder,NULL); gtk_builder_connect_signals(builder,NULL);
@ -1227,7 +1226,7 @@ main_window *yon_main_window_complete(){
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
__attribute__((unused)) char *locale = setlocale(LC_ALL, ""); __attribute__((unused)) char *locale = setlocale(LC_ALL, "");
textdomain (LocaleName); bind_textdomain_codeset(LocaleName,"UTF-8");
config_init(); config_init();
config_str unfound = NULL; config_str unfound = NULL;
int size=0; int size=0;
@ -1258,7 +1257,6 @@ int main(int argc, char *argv[]){
} }
} }
gtk_init(&argc,&argv); gtk_init(&argc,&argv);
bind_textdomain_codeset(LocaleName,"UTF-8");
main_window *widgets = NULL; main_window *widgets = NULL;
if (widgets){}; if (widgets){};
int fullscreen = 0; int fullscreen = 0;

@ -300,21 +300,6 @@
</columns> </columns>
</object> </object>
<object class="GtkSizeGroup" id="TagsSizeGroup"/> <object class="GtkSizeGroup" id="TagsSizeGroup"/>
<object class="GtkFlowBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkFlowBoxChild">
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="image1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>

Loading…
Cancel
Save