From bc985f8778953607a8b599325e33790f2c303d8f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 25 Oct 2024 18:06:52 +0600 Subject: [PATCH] Added root only check --- source/ubinstall-gtk.c | 18 +++++++++++++----- source/ubinstall-gtk.h | 1 + source/ubl-strings.h | 1 + ubinstall-gtk.glade | 14 ++++++++++++++ ubinstall-gtk.pot | 4 ++++ ubinstall-gtk_ru.po | 4 ++++ 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index cb63ce5..f44098c 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -434,7 +434,11 @@ void yon_interface_update(main_window *widgets){ char *autologin = config(autologin_parameter); char *hostname = config(hostname_parameter); if (!yon_char_is_empty(user_name)){ - gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); + if (!strcmp(user_name,"root")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); + } else { + gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); + } } else { gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),""); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); @@ -1639,10 +1643,13 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ yon_config_remove_by_key(user_name_parameter); } else { - char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); - if (login){}; - yon_config_register(user_name_parameter,user_name_parameter_command,login); - + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck))){ + yon_config_register(user_name_parameter,user_name_parameter_command,"root"); + } else { + char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); + if (login){}; + yon_config_register(user_name_parameter,user_name_parameter_command,login); + } } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck))){ @@ -2500,6 +2507,7 @@ main_window *yon_main_window_complete(){ widgets->LayoutSensitiveCheck = yon_gtk_builder_get_widget(builder,"LayoutSensitiveCheck"); widgets->UsernameSensitiveCheck = yon_gtk_builder_get_widget(builder,"UsernameSensitiveCheck"); widgets->LoginSensitiveCheck = yon_gtk_builder_get_widget(builder,"LoginSensitiveCheck"); + widgets->UserRootOnlyCheck = yon_gtk_builder_get_widget(builder,"UserRootOnlyCheck"); widgets->PasswordSensitiveCheck = yon_gtk_builder_get_widget(builder,"PasswordSensitiveCheck"); widgets->AutologinSensitiveCheck = yon_gtk_builder_get_widget(builder,"AutologinSensitiveCheck"); widgets->RootPasswordSensitiveCheck = yon_gtk_builder_get_widget(builder,"RootPasswordSensitiveCheck"); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 9703cc1..166d4bf 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -377,6 +377,7 @@ typedef struct { GtkWidget *LayoutSensitiveCheck; GtkWidget *UsernameSensitiveCheck; GtkWidget *LoginSensitiveCheck; + GtkWidget *UserRootOnlyCheck; GtkWidget *PasswordSensitiveCheck; GtkWidget *AutologinSensitiveCheck; GtkWidget *RootPasswordSensitiveCheck; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index abdc0be..11c6e08 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -14,6 +14,7 @@ #define CANCEL_LABEL _("Cancel") #define BACK_LABEL _("Back") #define NEXT_LABEL _("Next") +#define ROOT_ONLY_LABEL _("Root only") #define WELCOME_TAB_LABEL _("Welcome") #define LICENCE_TAB_LABEL _("Licence\nagreement") #define SECTIONS_TAB__LABEL _("Sections") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 5d31b34..62aae47 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -2396,6 +2396,20 @@ and help you install UBLinux on your computer 0 + + + Root only + True + True + False + True + + + False + True + 1 + + True diff --git a/ubinstall-gtk.pot b/ubinstall-gtk.pot index 64ee4dd..fcefb9c 100644 --- a/ubinstall-gtk.pot +++ b/ubinstall-gtk.pot @@ -99,6 +99,10 @@ msgstr "" msgid "Next" msgstr "" +#: source/ubl-strings.h:13 +msgid "Root only" +msgstr "" + #: source/ubl-strings.h:14 msgid "Welcome" msgstr "" diff --git a/ubinstall-gtk_ru.po b/ubinstall-gtk_ru.po index 48f2ee7..1c89b56 100644 --- a/ubinstall-gtk_ru.po +++ b/ubinstall-gtk_ru.po @@ -103,6 +103,10 @@ msgstr "Назад" msgid "Next" msgstr "Далее" +#: source/ubl-strings.h:13 +msgid "Root only" +msgstr "Только root" + #: source/ubl-strings.h:14 msgid "Welcome" msgstr "" -- 2.35.1