Added new checkboxes to user configuration window

pull/14/head
parent fc905ac2cc
commit e6451fa451

@ -764,6 +764,10 @@ void on_user_save(GtkWidget *self, dictionary *dict){
char *samba_sync = NULL;
char *deactivate = NULL;
char *extra_options = NULL;
char *useradd_boot = "";
char *useradd_shutdown = "";
char *usershadow_boot = "";
char *usershadow_shutdown = "";
int uid_auto_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck));
if (uid_auto_active){
@ -886,6 +890,30 @@ void on_user_save(GtkWidget *self, dictionary *dict){
password_changed_date = yon_char_unite(yon_char_from_int(tm.tm_mday),".",yon_char_from_int(tm.tm_mon+1),".",yon_char_from_int(1900+tm.tm_year),NULL);
}
int useradd_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck));
if (useradd_boot_active){
useradd_boot = "boot";
}
int useradd_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck));
if (useradd_shutdown_active){
useradd_shutdown = "shutdown";
}
int usershadow_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck));
if (usershadow_boot_active){
usershadow_boot = "boot";
}
int usershadow_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck));
if (usershadow_shutdown_active){
usershadow_shutdown = "shutdown";
}
char *useradd_sync_string = NULL;
useradd_sync_string = yon_char_unite(useradd_boot,!yon_char_is_empty(useradd_boot)?",":"",useradd_shutdown,NULL);
char *usershadow_sync_string = NULL;
usershadow_sync_string = yon_char_unite(usershadow_boot,!yon_char_is_empty(usershadow_boot)?",":"",usershadow_shutdown,NULL);
char *shadow_string = NULL;
shadow_string = yon_char_unite(yon_char_return_if_exist(password_changed_date,""),
":",yon_char_return_if_exist(password_change_interval_minimum,""),
@ -909,6 +937,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){
NULL);
yon_config_register(USERADD(login),"users",final_user);
yon_config_register(USERSHADOW(login),"users",shadow_string);
if (!yon_char_is_empty(useradd_sync_string))
yon_config_register(USERADD_SYNC(login),"users",useradd_sync_string);
if (!yon_char_is_empty(usershadow_sync_string))
yon_config_register(USERSHADOW_SYNC(login),"users",usershadow_sync_string);
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList);
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter))
@ -964,7 +998,11 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton");
window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton");
window->CalendarPopup=yon_gtk_builder_get_widget(builder,"CalendarPopover");
window->UseraddBootCheck=yon_gtk_builder_get_widget(builder,"UseraddBootCheck");
window->ExpirationCalendar=yon_gtk_builder_get_widget(builder,"ExpirationCalendar");
window->UseraddShutdownCheck=yon_gtk_builder_get_widget(builder,"UseraddShutdownCheck");
window->UsershadowBootCheck=yon_gtk_builder_get_widget(builder,"UsershadowBootCheck");
window->UsershadowShutdownCheck=yon_gtk_builder_get_widget(builder,"UsershadowShutdownCheck");
gtk_window_set_title(GTK_WINDOW(window->CreateUserWindow),USER_TITLE_LABEL);
int shell_size=0;
@ -1107,12 +1145,34 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin),atol(parsed_size>2?parameters[2]:"0"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userWarningSpin),atol(parsed_size>3?parameters[3]:"0"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userActivitySpin),atol(parsed_size>4?parameters[4]:"0"));
if (parsed_size>5){
if (parsed_size>5&&!yon_char_is_empty(parameters[5])){
GDateTime *date = g_date_time_new_from_unix_local(atol(parameters[5]));
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),g_date_time_format(date,"%c"));
}
gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window));
gtk_widget_show(window->CreateUserWindow);
char *useradd_sync = NULL;
useradd_sync = yon_config_get_by_key(USERADD_SYNC(name));
if (useradd_sync){
if (strstr(useradd_sync,"boot")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck),1);
}
if (strstr(useradd_sync,"shutdown")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck),1);
}
free(useradd_sync);
}
char *usershadow_sync =yon_config_get_by_key(USERSHADOW_SYNC(name));
if (usershadow_sync){
if (strstr(usershadow_sync,"boot")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck),1);
}
if (strstr(usershadow_sync,"shutdown")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck),1);
}
free(usershadow_sync);
}
}
} else {
model = GTK_TREE_MODEL(widgets->GroupsList);

@ -50,6 +50,8 @@
#define USERADD(user) yon_char_unite("USERADD[",user,"]",NULL)
#define GROUPADD(group) yon_char_unite("GROUPADD[",group,"]",NULL)
#define USERSHADOW(user) yon_char_unite("USERSHADOW[",user,"]",NULL)
#define USERADD_SYNC(user) yon_char_unite("USERADD_SYNC[",user,"]",NULL)
#define USERSHADOW_SYNC(user) yon_char_unite("USERSHADOW_SYNC[",user,"]",NULL)
#define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd)
@ -250,6 +252,10 @@ typedef struct{
GtkWidget *UserOkButton;
GtkWidget *CalendarPopup;
GtkWidget *ExpirationCalendar;
GtkWidget *UseraddBootCheck;
GtkWidget *UseraddShutdownCheck;
GtkWidget *UsershadowBootCheck;
GtkWidget *UsershadowShutdownCheck;
long expiration_unix;

@ -138,6 +138,13 @@
#define TEMPORARY_DEACTIVATION_LABEL _("Temporary deactivation")
#define SAVE_LABEL _("Save")
#define USERADD_SYNC_LABEL _("System user synchronization mode with configuration")
#define USERADD_BOOT_LABEL _("During system startup, load the user from the configuration")
#define USERADD_SHUTDOWN_LABEL _("When shutting down the system, save the user into the configuration")
#define USERSHADOW_SYNC_LABEL _("The mode of synchronizing system user settings with the configuration")
#define USERSHADOW_BOOT_LABEL _("When the system boots up, load the user's settings from the configuration")
#define USERSHADOW_SHUTDOWN_LABEL _("When shutting down the system, save the user's settings into the configuration")
//ubl-settings-usergroups-password.glade
#define PASSWORD_REPEAT_LABEL _("Repeat password:")
#define PASSWORD_HASH_LABEL _("Password hash:")

@ -429,6 +429,71 @@
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0.019999999552965164</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bottom-padding">5</property>
<property name="left-padding">5</property>
<property name="right-padding">5</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkCheckButton" id="UseraddBootCheck">
<property name="label" translatable="yes">During system startup, load the user from the configuration</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="UseraddShutdownCheck">
<property name="label" translatable="yes">When shutting down the system, save the user into the configuration</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">System user synchronization mode with configuration</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
@ -709,7 +774,72 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0.019999999552965164</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bottom-padding">5</property>
<property name="left-padding">5</property>
<property name="right-padding">5</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkCheckButton" id="UsershadowBootCheck">
<property name="label" translatable="yes">When the system boots up, load the user's settings from the configuration</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="UsershadowShutdownCheck">
<property name="label" translatable="yes">When shutting down the system, save the user's settings into the configuration</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">The mode of synchronizing system user settings with the configuration</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">8</property>
</packing>
</child>
<child>
@ -942,54 +1072,6 @@
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="can-focus">False</property>
<property name="label-xalign">0.019999999552965164</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="bottom-padding">5</property>
<property name="left-padding">5</property>
<property name="right-padding">5</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Sync configuration</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>

@ -441,10 +441,37 @@ msgstr ""
msgid "Save"
msgstr ""
#: source/ubl-strings.h:141
msgid "System user synchronization mode with configuration"
msgstr ""
#: source/ubl-strings.h:142
msgid "Repeat password:"
msgid "During system startup, load the user from the configuration"
msgstr ""
#: source/ubl-strings.h:143
msgid "When shutting down the system, save the user into the configuration"
msgstr ""
#: source/ubl-strings.h:144
msgid "The mode of synchronizing system user settings with the configuration"
msgstr ""
#: source/ubl-strings.h:145
msgid ""
"When the system boots up, load the user's settings from the configuration"
msgstr ""
#: source/ubl-strings.h:146
msgid ""
"When shutting down the system, save the user's settings into the "
"configuration"
msgstr ""
#: source/ubl-strings.h:149
msgid "Repeat password:"
msgstr ""
#: source/ubl-strings.h:150
msgid "Password hash:"
msgstr ""

@ -447,11 +447,38 @@ msgstr "Временное отключение учётной записи"
msgid "Save"
msgstr "Сохранить"
#: source/ubl-strings.h:141
msgid "System user synchronization mode with configuration"
msgstr "Режим синхронизации пользователя системы с конфигурацией"
#: source/ubl-strings.h:142
msgid "During system startup, load the user from the configuration"
msgstr "При загрузке системы загрузить пользователя из конфигурации"
#: source/ubl-strings.h:143
msgid "When shutting down the system, save the user into the configuration"
msgstr "При завершении работы системы сохранить пользователя в конфигурацию"
#: source/ubl-strings.h:144
msgid "The mode of synchronizing system user settings with the configuration"
msgstr "Режим синхронизации параметров пользователя системы с конфигурацией"
#: source/ubl-strings.h:145
msgid ""
"When the system boots up, load the user's settings from the configuration"
msgstr "При загрузке системы загрузить параметры пользователя из конфигурации"
#: source/ubl-strings.h:146
#, fuzzy
msgid ""
"When shutting down the system, save the user's settings into the "
"configuration"
msgstr "При завершении работы системы сохранить пользователя в конфигурацию"
#: source/ubl-strings.h:149
msgid "Repeat password:"
msgstr "Подтверждение пароля:"
#: source/ubl-strings.h:143
#: source/ubl-strings.h:150
msgid "Password hash:"
msgstr "Хэш пароля:"

Loading…
Cancel
Save