diff --git a/exo/exo-icon-chooser-dialog.c b/exo/exo-icon-chooser-dialog.c index 93d3071..d0c91ab 100644 --- a/exo/exo-icon-chooser-dialog.c +++ b/exo/exo-icon-chooser-dialog.c @@ -461,6 +461,10 @@ exo_icon_chooser_dialog_visible_func (GtkTreeModel *model, visible = (strstr (name_casefolded, priv->casefolded_text) != NULL); + /* check alternative names also */ + if (!visible) + visible = _exo_icon_chooser_model_strstr_other_names (EXO_ICON_CHOOSER_MODEL (model), iter, priv->casefolded_text); + g_free (name_casefolded); return visible; diff --git a/exo/exo-icon-chooser-model.c b/exo/exo-icon-chooser-model.c index 008dfdd..8fc297d 100644 --- a/exo/exo-icon-chooser-model.c +++ b/exo/exo-icon-chooser-model.c @@ -513,11 +513,9 @@ exo_icon_chooser_model_icon_theme_changed (GtkIconTheme *icon_theme, icons = gtk_icon_theme_list_icons (icon_theme, NULL); for (lp = icons; lp != NULL; lp = lp->next) { - /* Skip symbolic icons since they lead to double processing */ + /* skip symbolic icons since they lead to double processing */ if (icon_name_is_symbolic (lp->data)) - { continue; - } item = g_slice_new0 (ExoIconChooserModelItem); item->icon_name = lp->data; @@ -551,11 +549,12 @@ exo_icon_chooser_model_icon_theme_changed (GtkIconTheme *icon_theme, icons = gtk_icon_theme_list_icons (icon_theme, CONTEXT_NAMES[context]); for (lp = icons; lp != NULL; lp = lp->next) { - /* Skip symbolic icons since they lead to double processing */ + /* skip symbolic icons since they lead to double processing */ if (icon_name_is_symbolic (lp->data)) - { - continue; - } + { + g_free (lp->data); + continue; + } /* lookup the item in one of the hash tables */ item = g_hash_table_lookup (items, lp->data); @@ -563,7 +562,7 @@ exo_icon_chooser_model_icon_theme_changed (GtkIconTheme *icon_theme, item = g_hash_table_lookup (symlink_items, lp->data); /* set the categories */ - if (item != NULL) + if (item != NULL && item->context == EXO_ICON_CHOOSER_CONTEXT_OTHER) item->context = context; g_free (lp->data); @@ -779,5 +778,42 @@ _exo_icon_chooser_model_get_iter_for_icon_name (ExoIconChooserModel *model, +/** + * + */ +gboolean +_exo_icon_chooser_model_strstr_other_names (ExoIconChooserModel *model, + GtkTreeIter *iter, + const gchar *str) +{ + ExoIconChooserModelItem *item; + guint i; + const gchar *other_name; + + _exo_return_val_if_fail (EXO_IS_ICON_CHOOSER_MODEL (model), FALSE); + _exo_return_val_if_fail (str != NULL, FALSE); + _exo_return_val_if_fail (iter != NULL, FALSE); + + /* determine the item */ + item = ((GList *) iter->user_data)->data; + + /* look in the alternative names */ + if (item && item->other_names != NULL) + { + for (i = 0; i < item->other_names->len; ++i) + { + other_name = g_ptr_array_index (item->other_names, i); + // g_utf8_normalize + // g_utf8_casefold + if (strstr (other_name, str) != 0) + return TRUE; + } + } + + return FALSE; +} + + + #define __EXO_ICON_CHOOSER_MODEL_C__ #include diff --git a/exo/exo-icon-chooser-model.h b/exo/exo-icon-chooser-model.h index 34d65dc..c05886f 100644 --- a/exo/exo-icon-chooser-model.h +++ b/exo/exo-icon-chooser-model.h @@ -92,6 +92,10 @@ G_GNUC_INTERNAL gboolean _exo_icon_chooser_model_get_iter_for_icon GtkTreeIter *iter, const gchar *icon_name); +G_GNUC_INTERNAL gboolean _exo_icon_chooser_model_strstr_other_names (ExoIconChooserModel *model, + GtkTreeIter *iter, + const gchar *str); + G_END_DECLS #endif /* !__EXO_ICON_CHOOSER_MODEL_H__ */