From 2b6da0cbb30518a529ee8b714788ee8e4b9841e4 Mon Sep 17 00:00:00 2001 From: Reuben Green Date: Tue, 17 Sep 2019 14:57:27 +0100 Subject: [PATCH 1/2] Prevent Gtk-CRITICAL when adding or modifying a user customizable action. Adds a check for a NULL value which occurs when adding a new user customizable action or adding a keyboard shortcut to one which previously did not have one. This NULL value itself is not an error, since it indicates the abscence of an existing shortcut, but the lack of this check causes a Gtk-CRITICAL error. --- plugins/thunar-uca/thunar-uca-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/thunar-uca/thunar-uca-editor.c b/plugins/thunar-uca/thunar-uca-editor.c index 58ac524e..9bc80754 100644 --- a/plugins/thunar-uca/thunar-uca-editor.c +++ b/plugins/thunar-uca/thunar-uca-editor.c @@ -655,7 +655,7 @@ thunar_uca_editor_save (ThunarUcaEditor *uca_editor, -1); /* always clear the accelerator, it'll be updated in thunar_uca_model_update */ - if (gtk_accel_map_lookup_entry (uca_editor->accel_path, &key) && key.accel_key != 0) + if (uca_editor->accel_path != NULL && gtk_accel_map_lookup_entry (uca_editor->accel_path, &key) && key.accel_key != 0) gtk_accel_map_change_entry (uca_editor->accel_path, 0, 0, TRUE); thunar_uca_model_update (uca_model, iter, -- 2.23.0 From 43efb95541819845d2e0ed4d9876f1151dd2df0a Mon Sep 17 00:00:00 2001 From: Reuben Green Date: Tue, 17 Sep 2019 15:28:40 +0100 Subject: [PATCH 2/2] Clear user customizable action shortcut when the action is deleted 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. --- plugins/thunar-uca/thunar-uca-model.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/thunar-uca/thunar-uca-model.c b/plugins/thunar-uca/thunar-uca-model.c index 91f6e4a5..dcfc7bac 100644 --- a/plugins/thunar-uca/thunar-uca-model.c +++ b/plugins/thunar-uca/thunar-uca-model.c @@ -1263,10 +1263,22 @@ 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 ("/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); -- 2.23.0