User choose window fixes

pull/73/head
parent aa2b524951
commit a32cfb979f

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.40.0 -->
<interface domain="ubl-settings-usergroups"> <interface domain="libublsettingsui-gtk3">
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<!-- interface-css-provider-path libublsettingsui-gtk3.css -->
<object class="GtkImage" id="image5"> <object class="GtkImage" id="image5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>

@ -455,3 +455,35 @@ msgstr ""
#: source/libublsettingsui-gtk3.h:728 #: source/libublsettingsui-gtk3.h:728
msgid "The password does not meet the password policy requirements" msgid "The password does not meet the password policy requirements"
msgstr "" msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "Choose groups"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "Choose group"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "Choose users"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "Choose user"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "Chosen"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "ID"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "Group"
msgstr ""
#: source/libublsettingsui-gtk3.h:728
msgid "User"
msgstr ""

@ -464,3 +464,35 @@ msgstr "ММ-ДД-ГГГГ"
#: source/libublsettingsui-gtk3.h:728 #: source/libublsettingsui-gtk3.h:728
msgid "The password does not meet the password policy requirements" msgid "The password does not meet the password policy requirements"
msgstr "Пароль не соответствует требованиям политики паролей" msgstr "Пароль не соответствует требованиям политики паролей"
#: source/libublsettingsui-gtk3.h:728
msgid "Choose groups"
msgstr "Выбор групп"
#: source/libublsettingsui-gtk3.h:728
msgid "Choose group"
msgstr "Выбор группы"
#: source/libublsettingsui-gtk3.h:728
msgid "Choose users"
msgstr "Выбор пользователей"
#: source/libublsettingsui-gtk3.h:728
msgid "Choose user"
msgstr "Выбор пользователя"
#: source/libublsettingsui-gtk3.h:728
msgid "Chosen"
msgstr "Выбрано"
#: source/libublsettingsui-gtk3.h:728
msgid "ID"
msgstr "ID"
#: source/libublsettingsui-gtk3.h:728
msgid "Group"
msgstr "Группа"
#: source/libublsettingsui-gtk3.h:728
msgid "User"
msgstr "Пользователь"

@ -73,18 +73,20 @@ yon_user_window *yon_user_window_new(enum YON_USER_WINDOW_MODE_TYPE mode){
window->list = gtk_list_store_new(3,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INT); window->list = gtk_list_store_new(3,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INT);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(window->list),2,GTK_SORT_ASCENDING); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(window->list),2,GTK_SORT_ASCENDING);
yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,NULL,NULL,"GroupWindow");
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_user_window_closed),window); g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_user_window_closed),window);
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_users_window_accept),window); g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_users_window_accept),window);
g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window); g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window);
GtkTreeIter iter; GtkTreeIter iter;
int multiple = 0;
switch (mode){ switch (mode){
case YON_USER_WINDOW_USERS_MULTIPLE: case YON_USER_WINDOW_USERS_MULTIPLE:
gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(window->StatusCell),0); gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(window->StatusCell),0);
multiple = 1;
[[fallthrough]]; [[fallthrough]];
case YON_USER_WINDOW_USERS:{ case YON_USER_WINDOW_USERS:{
yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,!multiple?_CHOOSE_USER_LABEL:_CHOOSE_USERS_LABEL,yon_dull_icon_path,"GroupWindow");
gtk_tree_view_column_set_title(gtk_tree_view_get_column(GTK_TREE_VIEW(window->UsersTree),2),_USER_LABEL);
int size; int size;
config_str system_param = yon_file_open("/etc/passwd",&size); config_str system_param = yon_file_open("/etc/passwd",&size);
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){
@ -99,8 +101,11 @@ yon_user_window *yon_user_window_new(enum YON_USER_WINDOW_MODE_TYPE mode){
case YON_USER_WINDOW_GROUPS_MULTIPLE: case YON_USER_WINDOW_GROUPS_MULTIPLE:
gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(window->StatusCell),0); gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(window->StatusCell),0);
multiple = 1;
[[fallthrough]]; [[fallthrough]];
case YON_USER_WINDOW_GROUPS:{ case YON_USER_WINDOW_GROUPS:{
yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,!multiple?_CHOOSE_GROUP_LABEL:_CHOOSE_GROUPS_LABEL, yon_dull_icon_path,"GroupWindow");
gtk_tree_view_column_set_title(gtk_tree_view_get_column(GTK_TREE_VIEW(window->UsersTree),2),_GROUP_LABEL);
int size; int size;
config_str system_param = yon_file_open("/etc/group",&size); config_str system_param = yon_file_open("/etc/group",&size);
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){

@ -284,7 +284,11 @@ void yon_file_chooser_remove_accept_function(filechooser_window *window);
dialog_confirmation_data *yon_confirmation_dialog_data_new(); dialog_confirmation_data *yon_confirmation_dialog_data_new();
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data); /// @brief Call a confirmation dialog with specific data
/// @param parent_window parent window or any widget contained by parent window. The argument can be NULL.
/// @param data Data structure with label strings and accept function;
/// @return GTK_RESPONCE_ACCEPT, or 0 if canceled
int yon_confirmation_dialog_call(GtkWidget *parent_window,dialog_confirmation_data *data);
/**yon_open_browser(GtkWidget *self, char *link) /**yon_open_browser(GtkWidget *self, char *link)
* [EN] * [EN]
@ -731,6 +735,18 @@ yon_window *yon_window_new();
#define _WARNING_LABEL yon_char_get_localised_from_lib("Warning") #define _WARNING_LABEL yon_char_get_localised_from_lib("Warning")
#define _CREATE_CONFIG_DIALOG_LABEL yon_char_get_localised_from_lib("Configuration file does not exist. Create new configuration file?") #define _CREATE_CONFIG_DIALOG_LABEL yon_char_get_localised_from_lib("Configuration file does not exist. Create new configuration file?")
#define _CREATE_CONFIG_DIALOG_HOMEDIR_LABEL yon_char_get_localised_from_lib("Configuration file does not exist. Create new configuration file? New configuration file will be created at your user's home directory") #define _CREATE_CONFIG_DIALOG_HOMEDIR_LABEL yon_char_get_localised_from_lib("Configuration file does not exist. Create new configuration file? New configuration file will be created at your user's home directory")
#define _CHOOSEN_LABEL yon_char_get_localised_from_lib("Chosen")
#define _ID_LABEL yon_char_get_localised_from_lib("ID")
#define _GROUP_LABEL yon_char_get_localised_from_lib("Group")
#define _USER_LABEL yon_char_get_localised_from_lib("User")
#define _CHOOSE_GROUPS_LABEL yon_char_get_localised_from_lib("Choose groups")
#define _CHOOSE_GROUP_LABEL yon_char_get_localised_from_lib("Choose group")
#define _CHOOSE_USERS_LABEL yon_char_get_localised_from_lib("Choose users")
#define _CHOOSE_USER_LABEL yon_char_get_localised_from_lib("Choose user")
#endif #endif
Loading…
Cancel
Save