[gnome-builder] grep: use "Location" instead of "Filename"
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] grep: use "Location" instead of "Filename"
- Date: Wed, 31 Oct 2018 20:32:49 +0000 (UTC)
commit 03038af6207a566fe7db7a8e0b458d63cb5ba5e8
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 31 13:30:51 2018 -0700
grep: use "Location" instead of "Filename"
We want to give some information about the location, being filename + line
number, so this is more descriptive.
src/plugins/grep/gbp-grep-panel.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c
index f48bd634f..2010d7841 100644
--- a/src/plugins/grep/gbp-grep-panel.c
+++ b/src/plugins/grep/gbp-grep-panel.c
@@ -175,12 +175,17 @@ filename_data_func (GtkCellLayout *layout,
if G_LIKELY (line != NULL)
{
+ g_autofree gchar *formatted = NULL;
const gchar *slash = strrchr (line->path, G_DIR_SEPARATOR);
+ const gchar *shortpath;
if (slash != NULL)
- g_object_set (cell, "text", slash + 1, NULL);
+ shortpath = slash + 1;
else
- g_object_set (cell, "text", line->path, NULL);
+ shortpath = line->path;
+
+ formatted = g_strdup_printf ("%s:%u", shortpath, line->line);
+ g_object_set (cell, "text", formatted, NULL);
return;
}
@@ -475,7 +480,7 @@ gbp_grep_panel_init (GbpGrepPanel *self)
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), cell, TRUE);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column), cell, filename_data_func, NULL, NULL);
- gtk_tree_view_column_set_title (column, _("Filename"));
+ gtk_tree_view_column_set_title (column, _("Location"));
gtk_tree_view_column_set_expand (column, FALSE);
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_append_column (self->tree_view, column);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]