ID is shown; added warning at saving

pull/16/head
parent f86ea445fe
commit 98e8c15386

@ -113,7 +113,10 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
void yon_config_local_load(GtkWidget *self, main_window *widgets){ void yon_config_local_load(GtkWidget *self, main_window *widgets){
gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),"");
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),"");
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),""); int size;
config_str rtn = yon_config_load(get_id_command,&size);
rtn[0]=yon_char_divide_search(rtn[0],"\n",-1);
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),*rtn);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ConsoleFontCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ConsoleFontCombo),0);
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);
@ -150,7 +153,10 @@ void yon_config_local_load(GtkWidget *self, main_window *widgets){
void yon_config_global_load(GtkWidget *self, main_window *widgets){ void yon_config_global_load(GtkWidget *self, main_window *widgets){
gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),"");
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),"");
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),""); int size;
config_str rtn = yon_config_load(get_id_command,&size);
rtn[0]=yon_char_divide_search(rtn[0],"\n",-1);
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),*rtn);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ConsoleFontCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ConsoleFontCombo),0);
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);
@ -160,9 +166,6 @@ 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
gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),id);
GtkTreeIter iter; GtkTreeIter iter;
char *code; char *code;
char *cons_font = yon_config_get_by_key(console_font_parameter); char *cons_font = yon_config_get_by_key(console_font_parameter);
@ -188,15 +191,18 @@ void yon_config_global_load(GtkWidget *self, main_window *widgets){
void yon_config_global_local_save(){ void yon_config_global_local_save(){
yon_config_save_registered(NULL,""); yon_config_save_registered(NULL,"");
yon_ubl_status_box_render(yon_char_unite(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL," ", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
} }
void yon_config_local_save(){ void yon_config_local_save(){
yon_config_save_registered("system","config"); yon_config_save_registered("system","config");
yon_ubl_status_box_render(yon_char_unite(LOCAL_SAVE_SUCCESS_LABEL," ", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
} }
void yon_config_global_save(){ void yon_config_global_save(){
yon_config_save_registered("global",""); yon_config_save_registered("global","");
yon_ubl_status_box_render(yon_char_unite(GLOBAL_SAVE_SUCCESS_LABEL," ", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
} }
@ -219,12 +225,9 @@ void on_id_combo_toggled(GtkComboBox *self, main_window *widgets){
} }
} }
if (id<3){ if (id<3){
gtk_widget_set_sensitive(widgets->IDEntry,0); gtk_widget_set_sensitive(widgets->IDEntry,0);
gtk_widget_set_sensitive(widgets->IDCopyButton,0);
} }
else { else {
gtk_widget_set_sensitive(widgets->IDCopyButton,1);
gtk_widget_set_sensitive(widgets->IDEntry,1); gtk_widget_set_sensitive(widgets->IDEntry,1);
} }
} }
@ -358,7 +361,6 @@ main_window *setup_window(){
gtk_widget_set_sensitive(widgets->SaveLocalMenuItem,0); gtk_widget_set_sensitive(widgets->SaveLocalMenuItem,0);
gtk_widget_set_sensitive(widgets->SaveMenuItem,0); gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
} }
/* Widget registration for config monitoring | Регистрация виджетов для мониторинга конфига */ /* Widget registration for config monitoring | Регистрация виджетов для мониторинга конфига */
// yon_window_config_add_custom_parameter(widgets->HeadInfoLabel,"head-text","label",YON_TYPE_STRING); // yon_window_config_add_custom_parameter(widgets->HeadInfoLabel,"head-text","label",YON_TYPE_STRING);
@ -379,8 +381,7 @@ main_window *setup_window(){
g_signal_connect(G_OBJECT(widgets->IDCopyButton),"clicked",G_CALLBACK(on_id_copy),widgets); g_signal_connect(G_OBJECT(widgets->IDCopyButton),"clicked",G_CALLBACK(on_id_copy),widgets);
g_signal_connect(G_OBJECT(widgets->ConsoleFontCombo),"changed",G_CALLBACK(on_console_font_changed),widgets); g_signal_connect(G_OBJECT(widgets->ConsoleFontCombo),"changed",G_CALLBACK(on_console_font_changed),widgets);
g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_language_changed),widgets); g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_language_changed),widgets);
// g_signal_connect(G_OBJECT(widgets->IDRandomCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->IDCopyButton);
// g_signal_connect(G_OBJECT(widgets->IDRandomCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->IDEntry);
int size; int size;
config_str locales = yon_config_load(get_locales_command,&size); config_str locales = yon_config_load(get_locales_command,&size);
GtkTreeIter iter; GtkTreeIter iter;

@ -32,8 +32,16 @@
#define get_locales_command "grep '' /usr/share/ubl-settings-system/csv/locales.csv" #define get_locales_command "grep '' /usr/share/ubl-settings-system/csv/locales.csv"
#define get_fonts_command "grep '' /usr/share/ubl-settings-system/csv/fonts.csv" #define get_fonts_command "grep '' /usr/share/ubl-settings-system/csv/fonts.csv"
#define get_id_command "grep '' /etc/machine-id"
// #define get_fonts_command "ls /usr/share/kbd/consolefonts/ |grep -v \"README\"|grep -oE \"^[-a-zA-Z0-9_]{3,}.psf\"|sed -e 's/\\.psf//g'" // #define get_fonts_command "ls /usr/share/kbd/consolefonts/ |grep -v \"README\"|grep -oE \"^[-a-zA-Z0-9_]{3,}.psf\"|sed -e 's/\\.psf//g'"
#define hostname_parameter "HOSTNAME"
#define id_parameter "MACHINEID"
#define keyboard_layout_parameter "XkbLayout"
#define console_font_parameter "CONSOLE_FONT"
#define num_lock_boot_parameter "NUMLOCK"
#define language_parameter "LANG"
typedef char* string; typedef char* string;
string version_application; string version_application;

@ -36,6 +36,7 @@
#define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succseeded.") #define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succseeded.")
#define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succseeded.") #define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succseeded.")
#define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succseeded.") #define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succseeded.")
#define SAVE_WARNING_LABEL _("Warning! New machine ID will apply after system reboot")
#define HOSTNAME_LABEL _("Hostname:") #define HOSTNAME_LABEL _("Hostname:")
#define ID_LABEL _("Work station ID:") #define ID_LABEL _("Work station ID:")

@ -28,14 +28,6 @@
#define get_home_dir_command yon_char_unite("getent passwd \"",yon_ubl_root_user_get(),"\" | cut -d: -f6",NULL) #define get_home_dir_command yon_char_unite("getent passwd \"",yon_ubl_root_user_get(),"\" | cut -d: -f6",NULL)
#define hostname_parameter "HOSTNAME"
#define id_parameter "MACHINEID"
#define keyboard_layout_parameter "XkbLayout"
#define console_font_parameter "CONSOLE_FONT"
#define num_lock_boot_parameter "NUMLOCK"
#define language_parameter "LANG"
typedef enum typedef enum
{ {
#ifdef __GTK_H__ #ifdef __GTK_H__

@ -1,15 +1,15 @@
[Desktop Entry] [Desktop Entry]
Encoding=UTF-8 Encoding=UTF-8
Name=System configuration Name=System configuration
Name[ru]=TEMPLATE Name[ru]=Системные настройки
GenericName=ubl-settings-system GenericName=ubl-settings-system
GenericName[ru]=TEMPLATE GenericName[ru]=ubl-settings-system
Comment=System basic parameters configuration Comment=System basic parameters configuration
Comment[ru]=Приложение для TEMPLATE Comment[ru]=Настройка основных параметров системы
Type=Application Type=Application
Exec=pkexec ubl-settings-system Exec=pkexec ubl-settings-system
Icon=com.ublinux.ubl-settings-system Icon=com.ublinux.ubl-settings-system
Terminal=false Terminal=false
X-XfcePluggable=true X-XfcePluggable=true
X-UBLPluggable=true X-UBLPluggable=true
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;X-UBL-SettingsManager;X-UBL-Personal-Settings; Categories=XFCE;GTK;Settings;X-UBL-SettingsManager;X-UBL-System-Settings;

@ -711,6 +711,7 @@ translated and supported by community.</property>
<object class="GtkEntry" id="IDEntry"> <object class="GtkEntry" id="IDEntry">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="truncate-multiline">True</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

@ -173,51 +173,55 @@ msgstr ""
msgid "Local configuration saving succseeded." msgid "Local configuration saving succseeded."
msgstr "" msgstr ""
#: source/ubl-strings.h:40 #: source/ubl-strings.h:39
msgid "Hostname:" msgid "Warning! New machine ID will apply after reboot"
msgstr "" msgstr ""
#: source/ubl-strings.h:41 #: source/ubl-strings.h:41
msgid "Work station ID:" msgid "Hostname:"
msgstr "" msgstr ""
#: source/ubl-strings.h:42 #: source/ubl-strings.h:42
msgid "System" msgid "Work station ID:"
msgstr "" msgstr ""
#: source/ubl-strings.h:43 #: source/ubl-strings.h:43
msgid "Random" msgid "System"
msgstr "" msgstr ""
#: source/ubl-strings.h:44 #: source/ubl-strings.h:44
msgid "Hardware" msgid "Random"
msgstr "" msgstr ""
#: source/ubl-strings.h:45 #: source/ubl-strings.h:45
msgid "Manual" msgid "Hardware"
msgstr "" msgstr ""
#: source/ubl-strings.h:46 #: source/ubl-strings.h:46
msgid "Console" msgid "Manual"
msgstr "" msgstr ""
#: source/ubl-strings.h:47 #: source/ubl-strings.h:47
msgid "Console font:" msgid "Console"
msgstr "" msgstr ""
#: source/ubl-strings.h:48 #: source/ubl-strings.h:48
msgid "Locale" msgid "Console font:"
msgstr "" msgstr ""
#: source/ubl-strings.h:49 #: source/ubl-strings.h:49
msgid "Locale"
msgstr ""
#: source/ubl-strings.h:50
msgid "Language:" msgid "Language:"
msgstr "" msgstr ""
#: source/ubl-strings.h:51 #: source/ubl-strings.h:52
msgid "Default" msgid "Default"
msgstr "" msgstr ""
#: source/ubl-strings.h:53 #: source/ubl-strings.h:54
msgid "Machine ID has been copied" msgid "Machine ID has been copied"
msgstr "" msgstr ""

@ -155,11 +155,11 @@ msgstr "Ничего не было выбрано"
#: source/ubl-strings.h:32 #: source/ubl-strings.h:32
msgid "Global configuration loading succseeded." msgid "Global configuration loading succseeded."
msgstr "Успешно загружена глобальная конфигурация" msgstr "Успешно загружена глобальная конфигурация."
#: source/ubl-strings.h:33 #: source/ubl-strings.h:33
msgid "Local configuration loading succseeded." msgid "Local configuration loading succseeded."
msgstr "Успешно загружена локальная конфигурация" msgstr "Успешно загружена локальная конфигурация."
#: source/ubl-strings.h:34 #: source/ubl-strings.h:34
msgid "Config loading failed" msgid "Config loading failed"
@ -167,61 +167,65 @@ msgstr "Ошибка загрузки конфигурации"
#: source/ubl-strings.h:36 #: source/ubl-strings.h:36
msgid "Local and global configuration saving succseeded." msgid "Local and global configuration saving succseeded."
msgstr "Успешно записаны локальная и глобальная конфигурация" msgstr "Успешно записаны локальная и глобальная конфигурация."
#: source/ubl-strings.h:37 #: source/ubl-strings.h:37
msgid "Global configuration saving succseeded." msgid "Global configuration saving succseeded."
msgstr "Успешно записана глобальная конфигурация" msgstr "Успешно записана глобальная конфигурация."
#: source/ubl-strings.h:38 #: source/ubl-strings.h:38
msgid "Local configuration saving succseeded." msgid "Local configuration saving succseeded."
msgstr "Успешно записана локальная конфигурация" msgstr "Успешно записана локальная конфигурация."
#: source/ubl-strings.h:40 #: source/ubl-strings.h:39
msgid "Warning! New machine ID will apply after reboot"
msgstr "Внимание! Новый ID рабочей станции будет применён после перезагрузки системы."
#: source/ubl-strings.h:41
msgid "Hostname:" msgid "Hostname:"
msgstr "Имя хоста:" msgstr "Имя хоста:"
#: source/ubl-strings.h:41 #: source/ubl-strings.h:42
msgid "Work station ID:" msgid "Work station ID:"
msgstr "ID рабочей станции:" msgstr "ID рабочей станции:"
#: source/ubl-strings.h:42 #: source/ubl-strings.h:43
msgid "System" msgid "System"
msgstr "Система" msgstr "Система"
#: source/ubl-strings.h:43 #: source/ubl-strings.h:44
msgid "Random" msgid "Random"
msgstr "Случайный" msgstr "Случайный"
#: source/ubl-strings.h:44 #: source/ubl-strings.h:45
msgid "Hardware" msgid "Hardware"
msgstr "Системный" msgstr "Системный"
#: source/ubl-strings.h:45 #: source/ubl-strings.h:46
msgid "Manual" msgid "Manual"
msgstr "Вручную" msgstr "Вручную"
#: source/ubl-strings.h:46 #: source/ubl-strings.h:47
msgid "Console" msgid "Console"
msgstr "Консоль" msgstr "Консоль"
#: source/ubl-strings.h:47 #: source/ubl-strings.h:48
msgid "Console font:" msgid "Console font:"
msgstr "Шрифт в консоли" msgstr "Шрифт в консоли"
#: source/ubl-strings.h:48 #: source/ubl-strings.h:49
msgid "Locale" msgid "Locale"
msgstr "Локаль" msgstr "Локаль"
#: source/ubl-strings.h:49 #: source/ubl-strings.h:50
msgid "Language:" msgid "Language:"
msgstr "Язык" msgstr "Язык"
#: source/ubl-strings.h:51 #: source/ubl-strings.h:52
msgid "Default" msgid "Default"
msgstr "По умолчанию" msgstr "По умолчанию"
#: source/ubl-strings.h:53 #: source/ubl-strings.h:54
msgid "Machine ID has been copied" msgid "Machine ID has been copied"
msgstr "ID рабочей станции скопирован" msgstr "ID рабочей станции скопирован"

Loading…
Cancel
Save