diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 8d27447..216b13c 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1399,25 +1399,35 @@ void on_main_delete(GtkWidget *self, main_window *widgets){ GtkTreeModel *model; GtkWidget *cur_tree; 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){ model = GTK_TREE_MODEL(widgets->UsersList); cur_tree=widgets->UsersTree; if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){ char *name; gtk_tree_model_get(model,&iter,2,&name,-1); - yon_config_remove_by_key(USERADD(name)); - yon_config_remove_by_key(USERADD_SYNC(name)); - yon_config_remove_by_key(USERSHADOW(name)); - gtk_list_store_remove(GTK_LIST_STORE(model),&iter); - } + data->action_text=DELETE_CONFIRMATION_LABEL("user",name); + if (yon_confirmation_dialog_call(self,data)==GTK_RESPONSE_ACCEPT){ + yon_config_remove_by_key(USERADD(name)); + 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 { model = GTK_TREE_MODEL(widgets->GroupsList); cur_tree=widgets->GroupsTree; if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){ char *name; gtk_tree_model_get(model,&iter,1,&name,-1); - yon_config_remove_by_key(GROUPADD(name)); - gtk_list_store_remove(GTK_LIST_STORE(model),&iter); + data->action_text=DELETE_CONFIRMATION_LABEL("group",name); + 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.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 | Присоединение сигналов */ 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->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->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); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index afdd8e7..4bb04e3 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -50,7 +50,7 @@ #define REMOVE_LABEL _("Remove") #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 #define ADDITIONAL_SETTINGS_TITLE_LABEL _("Additional settings") diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index 692cc00..46ff057 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -248,7 +248,11 @@ msgid "Update users and groups" msgstr "" #: 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 "" #: source/ubl-strings.h:57 diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 177f3f4..41217d1 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -151,7 +151,9 @@ msgstr "Основная группа:" msgid "" "Additional\n" "groups" -msgstr "Дополнительные\nгруппы" +msgstr "" +"Дополнительные\n" +"группы" #: source/ubl-strings.h:27 msgid "Sync with SAMBA user" @@ -262,8 +264,12 @@ msgid "Update users and groups" msgstr "Обновить список пользователей и групп" #: source/ubl-strings.h:53 -msgid "Are you sure?" -msgstr "Вы уверены?" +msgid "Are you sure want to delete group" +msgstr "Вы уверены что хотите удалить группу" + +#: source/ubl-strings.h:53 +msgid "Are you sure want to delete user" +msgstr "Вы уверены что хотите удалить пользователя" #: source/ubl-strings.h:57 msgid "No password required" @@ -357,13 +363,17 @@ msgstr "Имя пользователя" msgid "" "Primary\n" "group" -msgstr "Основная\nгруппа" +msgstr "" +"Основная\n" +"группа" #: source/ubl-strings.h:99 msgid "" "Home\n" "directory" -msgstr "Домашний\nкаталог" +msgstr "" +"Домашний\n" +"каталог" #: source/ubl-strings.h:100 source/ubl-strings.h:106 msgid "Group" @@ -393,43 +403,57 @@ msgstr "символов" msgid "" "Days until\n" "warning" -msgstr "Дней до\nпредупреждения" +msgstr "" +"Дней до\n" +"предупреждения" #: source/ubl-strings.h:108 msgid "" "Days\n" "without activity" -msgstr "Дней без\nактивности" +msgstr "" +"Дней без\n" +"активности" #: source/ubl-strings.h:109 msgid "" "Shell\n" "path" -msgstr "Путь до\nоболочки" +msgstr "" +"Путь до\n" +"оболочки" #: source/ubl-strings.h:110 msgid "" "Password has\n" "been changed" -msgstr "Пароль\nизменён" +msgstr "" +"Пароль\n" +"изменён" #: source/ubl-strings.h:111 msgid "" "Expiration\n" "date" -msgstr "Дата\nустаревания" +msgstr "" +"Дата\n" +"устаревания" #: source/ubl-strings.h:112 msgid "" "Password change\n" "interval (min)" -msgstr "Интервал смены\nпароля (мин.)" +msgstr "" +"Интервал смены\n" +"пароля (мин.)" #: source/ubl-strings.h:113 msgid "" "Password change\n" "interval (max)" -msgstr "Интервал смены\nпароля (макс.)" +msgstr "" +"Интервал смены\n" +"пароля (макс.)" #: source/ubl-strings.h:116 msgid "Add user"