mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 06:51:10 +00:00
inspector: Work with new search entry
Don't assume a search entry is an entry, and use the editable api as far as possible.
This commit is contained in:
parent
3a1a7c43f3
commit
b8c981fb2b
@ -916,7 +916,7 @@ search (GtkInspectorObjectTree *wt,
|
|||||||
guint i, selected, n, row;
|
guint i, selected, n, row;
|
||||||
const char *text;
|
const char *text;
|
||||||
|
|
||||||
text = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
|
text = gtk_editable_get_text (GTK_EDITABLE (priv->search_entry));
|
||||||
if (gtk_list_box_get_selected_row (priv->list))
|
if (gtk_list_box_get_selected_row (priv->list))
|
||||||
{
|
{
|
||||||
selected = gtk_list_box_row_get_index (gtk_list_box_get_selected_row (priv->list));
|
selected = gtk_list_box_row_get_index (gtk_list_box_get_selected_row (priv->list));
|
||||||
@ -998,7 +998,7 @@ static void
|
|||||||
stop_search (GtkWidget *entry,
|
stop_search (GtkWidget *entry,
|
||||||
GtkInspectorObjectTree *wt)
|
GtkInspectorObjectTree *wt)
|
||||||
{
|
{
|
||||||
gtk_entry_set_text (GTK_ENTRY (wt->priv->search_entry), "");
|
gtk_editable_set_text (GTK_EDITABLE (wt->priv->search_entry), "");
|
||||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (wt->priv->search_bar), FALSE);
|
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (wt->priv->search_bar), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1155,7 +1155,7 @@ gtk_inspector_object_tree_init (GtkInspectorObjectTree *wt)
|
|||||||
gtk_widget_init_template (GTK_WIDGET (wt));
|
gtk_widget_init_template (GTK_WIDGET (wt));
|
||||||
|
|
||||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (wt->priv->search_bar),
|
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (wt->priv->search_bar),
|
||||||
GTK_ENTRY (wt->priv->search_entry));
|
GTK_EDITABLE (wt->priv->search_entry));
|
||||||
|
|
||||||
root_model = create_root_model ();
|
root_model = create_root_model ();
|
||||||
wt->priv->tree_model = gtk_tree_list_model_new (FALSE,
|
wt->priv->tree_model = gtk_tree_list_model_new (FALSE,
|
||||||
|
@ -79,7 +79,7 @@ static void
|
|||||||
search_close_clicked (GtkWidget *button,
|
search_close_clicked (GtkWidget *button,
|
||||||
GtkInspectorPropList *pl)
|
GtkInspectorPropList *pl)
|
||||||
{
|
{
|
||||||
gtk_entry_set_text (GTK_ENTRY (pl->priv->search_entry), "");
|
gtk_editable_set_text (GTK_EDITABLE (pl->priv->search_entry), "");
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ constructed (GObject *object)
|
|||||||
pl->priv->search_stack = gtk_widget_get_parent (pl->priv->search_entry);
|
pl->priv->search_stack = gtk_widget_get_parent (pl->priv->search_entry);
|
||||||
|
|
||||||
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (pl->priv->tree),
|
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (pl->priv->tree),
|
||||||
GTK_ENTRY (pl->priv->search_entry));
|
GTK_EDITABLE (pl->priv->search_entry));
|
||||||
|
|
||||||
g_signal_connect (pl->priv->search_entry, "stop-search",
|
g_signal_connect (pl->priv->search_entry, "stop-search",
|
||||||
G_CALLBACK (search_close_clicked), pl);
|
G_CALLBACK (search_close_clicked), pl);
|
||||||
@ -525,7 +525,7 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
|||||||
|
|
||||||
cleanup_object (pl);
|
cleanup_object (pl);
|
||||||
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (pl->priv->search_entry), "");
|
gtk_editable_set_text (GTK_EDITABLE (pl->priv->search_entry), "");
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
||||||
|
|
||||||
if (pl->priv->child_properties)
|
if (pl->priv->child_properties)
|
||||||
|
@ -548,7 +548,7 @@ match_row (GtkTreeModel *model,
|
|||||||
const gchar *text;
|
const gchar *text;
|
||||||
gboolean match;
|
gboolean match;
|
||||||
|
|
||||||
text = gtk_entry_get_text (GTK_ENTRY (sl->priv->search_entry));
|
text = gtk_editable_get_text (GTK_EDITABLE (sl->priv->search_entry));
|
||||||
gtk_tree_model_get (model, iter,
|
gtk_tree_model_get (model, iter,
|
||||||
COLUMN_NAME, &name,
|
COLUMN_NAME, &name,
|
||||||
COLUMN_PATH, &path,
|
COLUMN_PATH, &path,
|
||||||
@ -622,7 +622,7 @@ gtk_inspector_resource_list_init (GtkInspectorResourceList *sl)
|
|||||||
g_signal_connect (sl, "map", G_CALLBACK (on_map), NULL);
|
g_signal_connect (sl, "map", G_CALLBACK (on_map), NULL);
|
||||||
|
|
||||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (sl->priv->search_bar),
|
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (sl->priv->search_bar),
|
||||||
GTK_ENTRY (sl->priv->search_entry));
|
GTK_EDITABLE (sl->priv->search_entry));
|
||||||
|
|
||||||
g_signal_connect (sl->priv->search_bar, "notify::search-mode-enabled",
|
g_signal_connect (sl->priv->search_bar, "notify::search-mode-enabled",
|
||||||
G_CALLBACK (search_mode_changed), sl);
|
G_CALLBACK (search_mode_changed), sl);
|
||||||
|
@ -374,7 +374,7 @@ gtk_inspector_statistics_init (GtkInspectorStatistics *sl)
|
|||||||
GINT_TO_POINTER (COLUMN_CUMULATIVE2), NULL);
|
GINT_TO_POINTER (COLUMN_CUMULATIVE2), NULL);
|
||||||
sl->priv->counts = g_hash_table_new_full (NULL, NULL, NULL, type_data_free);
|
sl->priv->counts = g_hash_table_new_full (NULL, NULL, NULL, type_data_free);
|
||||||
|
|
||||||
gtk_tree_view_set_search_entry (sl->priv->view, GTK_ENTRY (sl->priv->search_entry));
|
gtk_tree_view_set_search_entry (sl->priv->view, GTK_EDITABLE (sl->priv->search_entry));
|
||||||
gtk_tree_view_set_search_equal_func (sl->priv->view, match_row, sl, NULL);
|
gtk_tree_view_set_search_equal_func (sl->priv->view, match_row, sl, NULL);
|
||||||
g_signal_connect (sl, "hierarchy-changed", G_CALLBACK (hierarchy_changed), NULL);
|
g_signal_connect (sl, "hierarchy-changed", G_CALLBACK (hierarchy_changed), NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user