diff options
author | Andre Miranda <andreldm@xfce.org> | 2022-03-05 15:18:48 -0300 |
---|---|---|
committer | Andre Miranda <andreldm@xfce.org> | 2022-03-05 15:18:48 -0300 |
commit | 7a85770084114f78834c4a9690ac83bafed23060 (patch) | |
tree | 7f0a58dc64be5c6400a9d1f76b4c9c8974995c93 | |
parent | 8e41acd63d6c3cf1d461c40cd071882cc0a61823 (diff) | |
download | xfce4-appfinder-7a85770084114f78834c4a9690ac83bafed23060.tar.gz |
Avoid saving duplicate command (#58)
Closes #58
-rw-r--r-- | src/appfinder-model.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/appfinder-model.c b/src/appfinder-model.c index 52916b2..5acf328 100644 --- a/src/appfinder-model.c +++ b/src/appfinder-model.c @@ -880,6 +880,17 @@ xfce_appfinder_model_item_compare (gconstpointer a, +static gint +xfce_appfinder_model_item_compare_command (gconstpointer a, + gconstpointer b) +{ + const ModelItem *item_a = a, *item_b = b; + + return g_utf8_collate (item_a->command, item_b->command); +} + + + static gchar * xfce_appfinder_model_item_key (GarconMenuItem *item) { @@ -1138,7 +1149,7 @@ xfce_appfinder_model_history_insert (XfceAppfinderModel *model, /* add new command */ item = g_slice_new0 (ModelItem); item->command = g_strdup (command); - if (g_slist_find_custom (model->items, item, xfce_appfinder_model_item_compare) != NULL) + if (g_slist_find_custom (model->items, item, xfce_appfinder_model_item_compare_command) != NULL) { APPFINDER_DEBUG ("Skip adding %s to the model as it's already contained.", command); g_slice_free (ModelItem, item); |