static gboolean ide_preferences_entry_matches (IdePreferencesBin *bin, IdePatternSpec *spec) { IdePreferencesEntry *self = (IdePreferencesEntry *)bin; IdePreferencesEntryPrivate *priv = ide_preferences_entry_get_instance_private (self); const gchar *tmp; g_assert (IDE_IS_PREFERENCES_ENTRY (self)); g_assert (spec != NULL); tmp = gtk_label_get_label (priv->title); if (tmp && ide_pattern_spec_match (spec, tmp)) return TRUE; tmp = gtk_entry_get_text (GTK_ENTRY (priv->entry)); if (tmp && ide_pattern_spec_match (spec, tmp)) return TRUE; return FALSE; }
static void gb_shortcuts_dialog__entry__changed (GbShortcutsDialog *self, GtkSearchEntry *search_entry) { GbShortcutsDialogPrivate *priv = gb_shortcuts_dialog_get_instance_private (self); g_autoptr(IdePatternSpec) spec = NULL; g_autofree gchar *downcase = NULL; GHashTableIter iter; const gchar *text; const gchar *last_view_name; gpointer key; gpointer value; g_assert (GB_IS_SHORTCUTS_DIALOG (self)); g_assert (GTK_IS_SEARCH_ENTRY (search_entry)); text = gtk_entry_get_text (GTK_ENTRY (search_entry)); if (!text || !*text) { if (priv->last_view_name != NULL) { gtk_stack_set_visible_child_name (priv->stack, priv->last_view_name); return; } } last_view_name = gtk_stack_get_visible_child_name (priv->stack); if (g_strcmp0 (last_view_name, "internal-search") != 0) { g_free (priv->last_view_name); priv->last_view_name = g_strdup (last_view_name); } gtk_stack_set_visible_child_name (priv->stack, "internal-search"); downcase = g_utf8_strdown (text, -1); spec = ide_pattern_spec_new (downcase); g_hash_table_iter_init (&iter, priv->keywords); while (g_hash_table_iter_next (&iter, &key, &value)) { GtkWidget *widget = key; const gchar *keywords = value; gtk_widget_set_visible (widget, ide_pattern_spec_match (spec, keywords)); } }
static gboolean ide_preferences_spin_button_matches (IdePreferencesBin *bin, IdePatternSpec *spec) { IdePreferencesSpinButton *self = (IdePreferencesSpinButton *)bin; const gchar *tmp; g_assert (IDE_IS_PREFERENCES_SPIN_BUTTON (self)); g_assert (spec != NULL); tmp = gtk_label_get_label (self->title); if (tmp && ide_pattern_spec_match (spec, tmp)) return TRUE; tmp = gtk_label_get_label (self->subtitle); if (tmp && ide_pattern_spec_match (spec, tmp)) return TRUE; if (self->key && ide_pattern_spec_match (spec, self->key)) return TRUE; return FALSE; }