diff --git a/locale/ubl-settings-keyboard.pot b/locale/ubl-settings-keyboard.pot index 0e83a23..94558d9 100644 --- a/locale/ubl-settings-keyboard.pot +++ b/locale/ubl-settings-keyboard.pot @@ -173,3 +173,19 @@ msgstr "" #: source/ubl-strings.h:20 msgid "Font" msgstr "" + +#: source/ubl-strings.h:20 +msgid "Are you sure you want to remove current option?" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Option deletion" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Are you sure you want to remove current layout?" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Layout deletion" +msgstr "" diff --git a/locale/ubl-settings-keyboard_ru.po b/locale/ubl-settings-keyboard_ru.po index 285a783..018636a 100644 --- a/locale/ubl-settings-keyboard_ru.po +++ b/locale/ubl-settings-keyboard_ru.po @@ -175,3 +175,19 @@ msgstr "Дополнительная раскладка клавиш для кл #: source/ubl-strings.h:20 msgid "Font" msgstr "Шрифт" + +#: source/ubl-strings.h:20 +msgid "Are you sure you want to remove current option?" +msgstr "Вы уверены что хотите удалить данную опцию?" + +#: source/ubl-strings.h:20 +msgid "Option deletion" +msgstr "Удаление опции" + +#: source/ubl-strings.h:20 +msgid "Are you sure you want to remove current layout?" +msgstr "Вы уверены что хотите удалить данную раскладку?" + +#: source/ubl-strings.h:20 +msgid "Layout deletion" +msgstr "Удаление раскладки" diff --git a/source/ubl-settings-keyboard-layouts.c b/source/ubl-settings-keyboard-layouts.c index a81eec0..9f34a5b 100644 --- a/source/ubl-settings-keyboard-layouts.c +++ b/source/ubl-settings-keyboard-layouts.c @@ -95,6 +95,10 @@ void yon_layouts_remove(GtkTreeView *tree, GtkListStore *cur_list, main_window * GtkTreeModel *model = GTK_TREE_MODEL(cur_list); GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree),&model,&iter)){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text = LAYOUT_REMOVE_LABEL; + data->title = LAYOUT_REMOVE_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->Window,data)!=GTK_RESPONSE_ACCEPT) return; char *layout, *variant; gtk_tree_model_get(model,&iter,0,&layout,1,&variant,-1); if (!yon_char_is_empty(variant)){ diff --git a/source/ubl-settings-keyboard-options.c b/source/ubl-settings-keyboard-options.c index 3825691..ac7b0ba 100644 --- a/source/ubl-settings-keyboard-options.c +++ b/source/ubl-settings-keyboard-options.c @@ -165,6 +165,10 @@ void on_option_remove(GtkWidget*, main_window *widgets){ GtkTreeIter iter; GtkTreeModel *model; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->OptionsTree)),&model, &iter)){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text = OPTION_REMOVE_LABEL; + data->title = OPTION_REMOVE_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->Window,data)!=GTK_RESPONSE_ACCEPT) return; char *target; gtk_tree_model_get(model,&iter,0,&target,-1); yon_config_remove_element(options_parameter,target,","); diff --git a/source/ubl-settings-keyboard.c b/source/ubl-settings-keyboard.c index 5996b57..60c78f3 100644 --- a/source/ubl-settings-keyboard.c +++ b/source/ubl-settings-keyboard.c @@ -319,6 +319,12 @@ void on_layout_selection_changed(GtkTreeView *self,main_window *widgets){ } +void on_option_selection_changed(GtkTreeView *self,main_window *widgets){ + int status = gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),NULL,NULL); + gtk_widget_set_sensitive(widgets->OptionsRemoveButton,status); + +} + void yon_main_window_complete(main_window *widgets){ widgets = yon_remalloc(widgets,sizeof(main_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); @@ -371,6 +377,7 @@ void yon_main_window_complete(main_window *widgets){ // g_signal_connect(G_OBJECT(widgets->LayoutsList),"row-deleted",G_CALLBACK(on_layout_dnd_deleted),widgets); g_signal_connect(G_OBJECT(widgets->LayoutTree),"cursor-changed",G_CALLBACK(on_layout_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->OptionsTree),"cursor-changed",G_CALLBACK(on_option_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(on_layout_default_toggled),widgets); diff --git a/source/ubl-settings-keyboard.h b/source/ubl-settings-keyboard.h index 1d6b3f2..66d82ba 100644 --- a/source/ubl-settings-keyboard.h +++ b/source/ubl-settings-keyboard.h @@ -278,4 +278,5 @@ void on_font_accept(GtkWidget *, layouts_window *window); void on_font_selection_changed(GtkWidget *,layouts_window *window); void yon_interface_save(main_window *widgets); void on_layout_default_toggled(GtkWidget *, int status, main_window *widgets); -void on_layout_selection_changed(GtkTreeView*,main_window *widgets); \ No newline at end of file +void on_layout_selection_changed(GtkTreeView*,main_window *widgets); +void on_option_selection_changed(GtkTreeView *self,main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 45e8402..e0ecef5 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -44,4 +44,9 @@ #define GROUP_LABEL _("Group") #define KEYMAP_TITLE_LABEL _("Additional key layout for the keyboard") -#define FONT_TITLE_LABEL _("Font") \ No newline at end of file +#define FONT_TITLE_LABEL _("Font") + +#define OPTION_REMOVE_LABEL _("Are you sure you want to remove current option?") +#define OPTION_REMOVE_TITLE_LABEL _("Option deletion") +#define LAYOUT_REMOVE_LABEL _("Are you sure you want to remove current layout?") +#define LAYOUT_REMOVE_TITLE_LABEL _("Layout deletion") \ No newline at end of file diff --git a/ubl-settings-keyboard.glade b/ubl-settings-keyboard.glade index 9120e56..b499e65 100644 --- a/ubl-settings-keyboard.glade +++ b/ubl-settings-keyboard.glade @@ -543,6 +543,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. True + False True True image3