Deletion logics changing

pull/59/head
parent e4d9a19639
commit ff94eeb224

@ -1399,25 +1399,35 @@ void on_main_delete(GtkWidget *self, main_window *widgets){
GtkTreeModel *model; GtkTreeModel *model;
GtkWidget *cur_tree; GtkWidget *cur_tree;
GtkTreeIter iter; GtkTreeIter iter;
dialog_confirmation_data *data=malloc(sizeof(dialog_confirmation_data));
data->function=NULL;
data->data=NULL;
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){ if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
model = GTK_TREE_MODEL(widgets->UsersList); model = GTK_TREE_MODEL(widgets->UsersList);
cur_tree=widgets->UsersTree; cur_tree=widgets->UsersTree;
if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){ if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){
char *name; char *name;
gtk_tree_model_get(model,&iter,2,&name,-1); gtk_tree_model_get(model,&iter,2,&name,-1);
yon_config_remove_by_key(USERADD(name)); data->action_text=DELETE_CONFIRMATION_LABEL("user",name);
yon_config_remove_by_key(USERADD_SYNC(name)); if (yon_confirmation_dialog_call(self,data)==GTK_RESPONSE_ACCEPT){
yon_config_remove_by_key(USERSHADOW(name)); yon_config_remove_by_key(USERADD(name));
gtk_list_store_remove(GTK_LIST_STORE(model),&iter); yon_config_remove_by_key(USERADD_SYNC(name));
} yon_config_remove_by_key(USERSHADOW(name));
gtk_list_store_remove(GTK_LIST_STORE(model),&iter);
}
}
} else { } else {
model = GTK_TREE_MODEL(widgets->GroupsList); model = GTK_TREE_MODEL(widgets->GroupsList);
cur_tree=widgets->GroupsTree; cur_tree=widgets->GroupsTree;
if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){ if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){
char *name; char *name;
gtk_tree_model_get(model,&iter,1,&name,-1); gtk_tree_model_get(model,&iter,1,&name,-1);
yon_config_remove_by_key(GROUPADD(name)); data->action_text=DELETE_CONFIRMATION_LABEL("group",name);
gtk_list_store_remove(GTK_LIST_STORE(model),&iter); if (yon_confirmation_dialog_call(self,data)==GTK_RESPONSE_ACCEPT){
yon_config_remove_by_key(GROUPADD(name));
gtk_list_store_remove(GTK_LIST_STORE(model),&iter);
}
} }
} }
} }
@ -1580,14 +1590,10 @@ main_window *yon_main_window_complete(main_window *widgets){
main_config.users_list = widgets->UsersList; main_config.users_list = widgets->UsersList;
main_config.groups_list = widgets->GroupsList; main_config.groups_list = widgets->GroupsList;
dialog_confirmation_data *data=malloc(sizeof(dialog_confirmation_data));
data->function=(void (*)(void*,void*))on_main_delete;
data->data=widgets;
data->action_text=DELETE_CONFIRMATION_LABEL;
/* Signal connection | Присоединение сигналов */ /* Signal connection | Присоединение сигналов */
g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_main_add),widgets); g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_main_add),widgets);
g_signal_connect(G_OBJECT(widgets->EditButton),"clicked",G_CALLBACK(on_main_edit),widgets); g_signal_connect(G_OBJECT(widgets->EditButton),"clicked",G_CALLBACK(on_main_edit),widgets);
g_signal_connect(G_OBJECT(widgets->DeleteButton),"clicked",G_CALLBACK(yon_confirmation_dialog_call),data); g_signal_connect(G_OBJECT(widgets->DeleteButton),"clicked",G_CALLBACK(on_main_delete),widgets);
g_signal_connect(G_OBJECT(widgets->button3),"clicked",G_CALLBACK(on_standard_groups_open),widgets); g_signal_connect(G_OBJECT(widgets->button3),"clicked",G_CALLBACK(on_standard_groups_open),widgets);
g_signal_connect(G_OBJECT(widgets->button2),"clicked",G_CALLBACK(on_ubl_settings_usergroups_additional_settings_open),widgets); g_signal_connect(G_OBJECT(widgets->button2),"clicked",G_CALLBACK(on_ubl_settings_usergroups_additional_settings_open),widgets);
g_signal_connect(G_OBJECT(widgets->button1),"clicked",G_CALLBACK(on_settings_usergroups_system_open),widgets); g_signal_connect(G_OBJECT(widgets->button1),"clicked",G_CALLBACK(on_settings_usergroups_system_open),widgets);

@ -50,7 +50,7 @@
#define REMOVE_LABEL _("Remove") #define REMOVE_LABEL _("Remove")
#define UPDATE_LABEL _("Update users and groups") #define UPDATE_LABEL _("Update users and groups")
#define DELETE_CONFIRMATION_LABEL _("Are you sure?") #define DELETE_CONFIRMATION_LABEL(type,target) yon_char_unite(_(yon_char_append("Are you sure want to delete ",type)), " '",target,"'?",NULL)
//ubl-settings-usergroups-additional-settings.glade //ubl-settings-usergroups-additional-settings.glade
#define ADDITIONAL_SETTINGS_TITLE_LABEL _("Additional settings") #define ADDITIONAL_SETTINGS_TITLE_LABEL _("Additional settings")

@ -248,7 +248,11 @@ msgid "Update users and groups"
msgstr "" msgstr ""
#: source/ubl-strings.h:53 #: source/ubl-strings.h:53
msgid "Are you sure?" msgid "Are you sure want to delete group"
msgstr ""
#: source/ubl-strings.h:53
msgid "Are you sure want to delete user"
msgstr "" msgstr ""
#: source/ubl-strings.h:57 #: source/ubl-strings.h:57

@ -151,7 +151,9 @@ msgstr "Основная группа:"
msgid "" msgid ""
"Additional\n" "Additional\n"
"groups" "groups"
msgstr "Дополнительные\nгруппы" msgstr ""
"Дополнительные\n"
"группы"
#: source/ubl-strings.h:27 #: source/ubl-strings.h:27
msgid "Sync with SAMBA user" msgid "Sync with SAMBA user"
@ -262,8 +264,12 @@ msgid "Update users and groups"
msgstr "Обновить список пользователей и групп" msgstr "Обновить список пользователей и групп"
#: source/ubl-strings.h:53 #: source/ubl-strings.h:53
msgid "Are you sure?" msgid "Are you sure want to delete group"
msgstr "Вы уверены?" msgstr "Вы уверены что хотите удалить группу"
#: source/ubl-strings.h:53
msgid "Are you sure want to delete user"
msgstr "Вы уверены что хотите удалить пользователя"
#: source/ubl-strings.h:57 #: source/ubl-strings.h:57
msgid "No password required" msgid "No password required"
@ -357,13 +363,17 @@ msgstr "Имя пользователя"
msgid "" msgid ""
"Primary\n" "Primary\n"
"group" "group"
msgstr "Основная\nгруппа" msgstr ""
"Основная\n"
"группа"
#: source/ubl-strings.h:99 #: source/ubl-strings.h:99
msgid "" msgid ""
"Home\n" "Home\n"
"directory" "directory"
msgstr "Домашний\nкаталог" msgstr ""
"Домашний\n"
"каталог"
#: source/ubl-strings.h:100 source/ubl-strings.h:106 #: source/ubl-strings.h:100 source/ubl-strings.h:106
msgid "Group" msgid "Group"
@ -393,43 +403,57 @@ msgstr "символов"
msgid "" msgid ""
"Days until\n" "Days until\n"
"warning" "warning"
msgstr "Дней до\nпредупреждения" msgstr ""
"Дней до\n"
"предупреждения"
#: source/ubl-strings.h:108 #: source/ubl-strings.h:108
msgid "" msgid ""
"Days\n" "Days\n"
"without activity" "without activity"
msgstr "Дней без\nактивности" msgstr ""
"Дней без\n"
"активности"
#: source/ubl-strings.h:109 #: source/ubl-strings.h:109
msgid "" msgid ""
"Shell\n" "Shell\n"
"path" "path"
msgstr "Путь до\nоболочки" msgstr ""
"Путь до\n"
"оболочки"
#: source/ubl-strings.h:110 #: source/ubl-strings.h:110
msgid "" msgid ""
"Password has\n" "Password has\n"
"been changed" "been changed"
msgstr "Пароль\nизменён" msgstr ""
"Пароль\n"
"изменён"
#: source/ubl-strings.h:111 #: source/ubl-strings.h:111
msgid "" msgid ""
"Expiration\n" "Expiration\n"
"date" "date"
msgstr "Дата\nустаревания" msgstr ""
"Дата\n"
"устаревания"
#: source/ubl-strings.h:112 #: source/ubl-strings.h:112
msgid "" msgid ""
"Password change\n" "Password change\n"
"interval (min)" "interval (min)"
msgstr "Интервал смены\nпароля (мин.)" msgstr ""
"Интервал смены\n"
"пароля (мин.)"
#: source/ubl-strings.h:113 #: source/ubl-strings.h:113
msgid "" msgid ""
"Password change\n" "Password change\n"
"interval (max)" "interval (max)"
msgstr "Интервал смены\nпароля (макс.)" msgstr ""
"Интервал смены\n"
"пароля (макс.)"
#: source/ubl-strings.h:116 #: source/ubl-strings.h:116
msgid "Add user" msgid "Add user"

Loading…
Cancel
Save