[gnome-builder/search] GbSearchDisplay: sort by result score
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/search] GbSearchDisplay: sort by result score
- Date: Tue, 16 Dec 2014 05:43:16 +0000 (UTC)
commit a6390bcd569aa10218d1dedc38c9eae36475b506
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 15 21:42:55 2014 -0800
GbSearchDisplay: sort by result score
src/search/gb-search-display.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/search/gb-search-display.c b/src/search/gb-search-display.c
index aeeed5c..71e360c 100644
--- a/src/search/gb-search-display.c
+++ b/src/search/gb-search-display.c
@@ -201,6 +201,21 @@ gb_search_display_row_activated (GbSearchDisplay *display,
gb_search_display_emit_result_activated (display, GB_SEARCH_RESULT (child));
}
+static gint
+gb_search_display_sort_cb (GtkListBoxRow *row1,
+ GtkListBoxRow *row2,
+ gpointer user_data)
+{
+ GtkWidget *child1;
+ GtkWidget *child2;
+
+ child1 = gtk_bin_get_child (GTK_BIN (row1));
+ child2 = gtk_bin_get_child (GTK_BIN (row2));
+
+ return gb_search_result_compare_func (GB_SEARCH_RESULT (child1),
+ GB_SEARCH_RESULT (child2));
+}
+
static void
gb_search_display_grab_focus (GtkWidget *widget)
{
@@ -243,6 +258,10 @@ gb_search_display_constructed (GObject *object)
G_CALLBACK (gb_search_display_row_activated),
self,
G_CONNECT_SWAPPED);
+
+ gtk_list_box_set_sort_func (self->priv->list_box,
+ gb_search_display_sort_cb,
+ NULL, NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]