[gnome-builder/wip/chergert/libpanel-changes] plugins/symbol-tree: give line/column in hover provider
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/libpanel-changes] plugins/symbol-tree: give line/column in hover provider
- Date: Tue, 13 Sep 2022 17:14:08 +0000 (UTC)
commit 0c8b6973ae0310324327b735696de6231fa940a8
Author: Christian Hergert <chergert redhat com>
Date: Tue Sep 13 10:10:00 2022 -0700
plugins/symbol-tree: give line/column in hover provider
Also stop using small text, it looks weird.
src/plugins/symbol-tree/gbp-symbol-hover-provider.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/symbol-tree/gbp-symbol-hover-provider.c
b/src/plugins/symbol-tree/gbp-symbol-hover-provider.c
index 3b1dd96ea..ab922a9d8 100644
--- a/src/plugins/symbol-tree/gbp-symbol-hover-provider.c
+++ b/src/plugins/symbol-tree/gbp-symbol-hover-provider.c
@@ -114,7 +114,7 @@ gbp_symbol_hover_provider_get_symbol_cb (GObject *object,
if (!name || !*name)
name = _("Unnamed Symbol");
- tt = g_strdup_printf ("<tt><span size='smaller'>%s</span></tt>", name);
+ tt = g_strdup_printf ("<tt>%s</tt>", name);
gtk_box_append (box,
g_object_new (GTK_TYPE_LABEL,
@@ -135,8 +135,19 @@ gbp_symbol_hover_provider_get_symbol_cb (GObject *object,
GtkWidget *label;
GFile *file = ide_location_get_file (loc[i].loc);
g_autofree gchar *base = g_file_get_basename (file);
- g_autofree gchar *markup = g_strdup_printf ("<span size='smaller'>%s: <a href='#'>%s</a></span>",
- loc[i].kind, base);
+ g_autofree gchar *markup = NULL;
+ int line = ide_location_get_line (loc[i].loc);
+ int line_offset = ide_location_get_line_offset (loc[i].loc);
+
+ if (line >= 0 && line_offset >= 0)
+ markup = g_strdup_printf ("%s: <a href='#'>%s:%d:%d</a>",
+ loc[i].kind, base, line+1, line_offset+1);
+ else if (line >= 0)
+ markup = g_strdup_printf ("%s: <a href='#'>%s:%d</a>",
+ loc[i].kind, base, line+1);
+ else
+ markup = g_strdup_printf ("%s: <a href='#'>%s</a>",
+ loc[i].kind, base);
label = g_object_new (GTK_TYPE_LABEL,
"visible", TRUE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]