diff --git a/dialogs/keyboard-settings/xfce-keyboard-settings.c b/dialogs/keyboard-settings/xfce-keyboard-settings.c index e8b6811..2b212c0 100644 --- a/dialogs/keyboard-settings/xfce-keyboard-settings.c +++ b/dialogs/keyboard-settings/xfce-keyboard-settings.c @@ -566,15 +566,23 @@ xfce_keyboard_settings_edit_shortcut (XfceKeyboardSettings *settings, if (G_LIKELY (response == GTK_RESPONSE_OK)) { - /* Remove old shortcut from the settings */ - gtk_list_store_remove (GTK_LIST_STORE (model), &iter); - xfce_shortcuts_provider_reset_shortcut (settings->priv->provider, shortcut); - /* Get the shortcut entered by the user */ new_shortcut = xfce_shortcut_dialog_get_shortcut (XFCE_SHORTCUT_DIALOG (dialog)); - /* Save new shortcut to the settings */ - xfce_shortcuts_provider_set_shortcut (settings->priv->provider, new_shortcut, command, snotify); + if (g_strcmp0 (shortcut, new_shortcut) == 0) + { + /* Do nothing, in particular do not emit any signals, + * i.e., do not remove + add the shortcut. */ + } + else + { + /* Remove old shortcut from the settings */ + gtk_list_store_remove (GTK_LIST_STORE (model), &iter); + xfce_shortcuts_provider_reset_shortcut (settings->priv->provider, shortcut); + + /* Save new shortcut to the settings */ + xfce_shortcuts_provider_set_shortcut (settings->priv->provider, new_shortcut, command, snotify); + } } /* Destroy the shortcut dialog */ @@ -688,9 +696,7 @@ xfce_keyboard_settings_validate_shortcut (XfceShortcutDialog *dialog, info->shortcut->command, FALSE); - if (G_UNLIKELY (response == GTK_RESPONSE_ACCEPT)) - xfce_shortcuts_provider_reset_shortcut (info->provider, shortcut); - else + if (G_LIKELY (response != GTK_RESPONSE_ACCEPT)) accepted = FALSE; xfce_keyboard_settings_free_shortcut_info (info);