Исправил таблицу пользователей и групп

pull/24/head
Igor Belitskiy 2 years ago
parent c28ebb7d28
commit 6fd3648898

@ -132,7 +132,7 @@ void philos_free_int_array_n2(int ***array, int size) {
}
}
config_str philos_list_user(int* size) {
config_str philos_list_user(int* size, int flag_lim) {
char* str_uid_min = "UID_MIN";
char* str_uid_max = "UID_MAX";
unsigned short uid_min = philos_read_uid_min_max(file_source_login_min_max, str_uid_min);
@ -147,9 +147,15 @@ config_str philos_list_user(int* size) {
}
break;
}
if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) {
if (flag_lim == 1) {
if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) {
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
}
}
else {
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
}
}
endpwent();
return str_users;
@ -200,7 +206,7 @@ unsigned short philos_read_uid_min_max(char* filename, char* search) {
}
config_str philos_list_group(int* size) {
config_str philos_list_group(int* size, int flag_lim) {
char* str_uid_min = "UID_MIN";
char* str_uid_max = "UID_MAX";
unsigned short uid_min = philos_read_uid_min_max(file_source_login_min_max, str_uid_min);
@ -215,7 +221,14 @@ config_str philos_list_group(int* size) {
}
break;
}
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
if (flag_lim == 1) {
if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) {
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
}
}
else {
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
}
}
endpwent();
return str_users;

@ -106,8 +106,8 @@ void philos_free_string_array_n3(char ****array, int size);
void philos_free_int_array(int **array, int size);
void philos_free_int_array_n2(int ***array, int size);
unsigned short philos_read_uid_min_max(char* filename, char* search);
config_str philos_list_user(int* size);
config_str philos_list_group(int* size);
config_str philos_list_user(int* size, int flag_lim);
config_str philos_list_group(int* size, int flag_lim);
char* philos_str_size_pow_byte(GtkWidget *combo_box_text);
char* philos_str_remove(char *str, const char *sub);
void philos_split_size_memory(char* str_value, int* size, char* pow_memory);

@ -14,30 +14,42 @@ table_u_g* get_widget_table_u_g() {
return table_widgets;
}
void table_u_g_set_fill_user_group() {
int size = 0;
g_object_ref(table_widgets->liststoreUsersGroups);
gtk_list_store_clear(table_widgets->liststoreUsersGroups);
gboolean active1 = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(table_widgets->chkActivUsersGroup));
if (strcmp(flag_u_g, "grpquota")==0) {
gtk_button_set_label(GTK_BUTTON(table_widgets->chkActivUsersGroup), _("Withdraw all groups"));
char** array_groups = philos_list_group(&size,active1);
table_u_g_fill_tree_view(array_groups, size);
}
else if (strcmp(flag_u_g, "usrquota") == 0) {
gtk_button_set_label(GTK_BUTTON(table_widgets->chkActivUsersGroup), _("Withdraw all users"));
char** array_user = philos_list_user(&size, active1);
table_u_g_fill_tree_view(array_user, size);
}
}
table_u_g *setup_table_u_g(){
/* Widgets getting | Получение виджетов */
table_widgets = malloc(sizeof(table_u_g));
device_disk_parsed();
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
table_widgets->Window = yon_gtk_builder_get_widget(builder,"tableUserGroupWindow");
table_widgets->chkActivUsersGroup = yon_gtk_builder_get_widget(builder,"chkActivUsersGroup");
table_widgets->btnCancel = yon_gtk_builder_get_widget(builder,"quotegroupCancelButton1");
table_widgets->btnSave = yon_gtk_builder_get_widget(builder,"quotegroupSaveButton1");
table_widgets->treeViewCheckUsersGroups = yon_gtk_builder_get_widget(builder,"treeViewCheckUsersGroups");
table_widgets->checkColUserGroup = GTK_CELL_RENDERER_TOGGLE(gtk_builder_get_object(builder,"checkColUserGroup"));
table_widgets->liststoreUsersGroups = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreUsersGroups"));
int size = 0;
if (strcmp(flag_u_g, "grpquota")==0) {
char** array_groups = philos_list_group(&size);
table_u_g_fill_tree_view(array_groups, size);
}
else if (strcmp(flag_u_g, "usrquota") == 0) {
char** array_user = philos_list_user(&size);
table_u_g_fill_tree_view(array_user, size);
}
table_u_g_set_fill_user_group();
set_actors(_actors);
table_u_g_event();
g_signal_connect(G_OBJECT(table_widgets->chkActivUsersGroup), "toggled", G_CALLBACK(table_u_g_set_fill_user_group), NULL);
}
void table_u_g_set_glade_path(char* _glade_path) {
glade_path = _glade_path;
}

@ -21,6 +21,7 @@ typedef struct {
GtkWidget* treeViewCheckUsersGroups;
GtkListStore* liststoreUsersGroups;
GtkCellRendererToggle* checkColUserGroup;
GtkWidget* chkActivUsersGroup;
} table_u_g;
void table_u_g_table_u_g_event(table_u_g *widgets);

@ -2674,6 +2674,26 @@ translated and supported by community.</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="chkActivUsersGroup">
<property name="label" translatable="yes">Withdraw all users</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</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="GtkScrolledWindow">
<property name="visible">True</property>
@ -2691,9 +2711,6 @@ translated and supported by community.</property>
<property name="can-focus">True</property>
<property name="model">liststoreUsersGroups</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn">
<child>
@ -2723,7 +2740,7 @@ translated and supported by community.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
</object>

@ -410,3 +410,9 @@ msgstr ""
msgid "The selected directory is not located on the target device"
msgstr ""
msgid "Withdraw all users"
msgstr ""
msgid "Withdraw all groups"
msgstr ""

@ -410,4 +410,10 @@ msgid "Warning"
msgstr "Внимание"
msgid "The selected directory is not located on the target device"
msgstr "Выбранный каталог не расположен на целевом устройстве"
msgstr "Выбранный каталог не расположен на целевом устройстве"
msgid "Withdraw all users"
msgstr "Вывести всех пользователей"
msgid "Withdraw all groups"
msgstr "Вывести всех группы"
Loading…
Cancel
Save