summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorReuben Green <reubengreen73@gmail.com>2019-09-17 15:28:40 +0100
committerAndre Miranda <andreldm@xfce.org>2019-09-17 22:19:57 -0300
commit15243ec398f1d877eb15e83d8305a1b0347f7a48 (patch)
tree7f6acaec00fb0d7bc9fefe1bb766e33fa0b4184a /plugins
parent0cfd8d96fd4c1846b42927a71ada062cae25ac23 (diff)
downloadthunar-15243ec398f1d877eb15e83d8305a1b0347f7a48.tar.gz
Clear user customizable action shortcut when the action is deleted
Bug #15970 Fixes a bug which causes a keyboard shortcut to become permenantly unavailable for use in a user customizable action (uca) if it has been used in a previously deleted uca, by adding code to clear any keyboard shortcut associated to a uca when it is deleted.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/thunar-uca/thunar-uca-model.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/thunar-uca/thunar-uca-model.c b/plugins/thunar-uca/thunar-uca-model.c
index 91f6e4a5..54f0dd12 100644
--- a/plugins/thunar-uca/thunar-uca-model.c
+++ b/plugins/thunar-uca/thunar-uca-model.c
@@ -1263,10 +1263,24 @@ thunar_uca_model_remove (ThunarUcaModel *uca_model,
{
ThunarUcaModelItem *item;
GtkTreePath *path;
+ gchar *unique_id;
+ gchar *accel_path;
+ GtkAccelKey key;
g_return_if_fail (THUNAR_UCA_IS_MODEL (uca_model));
g_return_if_fail (iter->stamp == uca_model->stamp);
+ /* clear any accelerator associated to the item */
+ gtk_tree_model_get (GTK_TREE_MODEL (uca_model), iter,
+ THUNAR_UCA_MODEL_COLUMN_UNIQUE_ID, &unique_id,
+ -1);
+ accel_path = g_strdup_printf ("<Actions>/ThunarActions/uca-action-%s", unique_id);
+
+ if (gtk_accel_map_lookup_entry (accel_path, &key) && key.accel_key != 0)
+ gtk_accel_map_change_entry (accel_path, 0, 0, TRUE);
+
+ g_free (accel_path);
+
/* determine the path for the item to remove */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (uca_model), iter);