[gnome-builder] libide/code: add ide_symbol_node_get_gicon()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/code: add ide_symbol_node_get_gicon()
- Date: Tue, 19 Jul 2022 22:29:33 +0000 (UTC)
commit dba76c37ca12b972d4e99441f739031b91605bda
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 19 14:30:03 2022 -0700
libide/code: add ide_symbol_node_get_gicon()
This is helpful to get a GIcon without going through creation/destroy cycle
of GIcon objects.
src/libide/code/ide-symbol-node.c | 17 ++++++++++++++++-
src/libide/code/ide-symbol-node.h | 6 +++++-
2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/code/ide-symbol-node.c b/src/libide/code/ide-symbol-node.c
index e4422c9b0..5feade1e5 100644
--- a/src/libide/code/ide-symbol-node.c
+++ b/src/libide/code/ide-symbol-node.c
@@ -75,13 +75,28 @@ ide_symbol_node_real_get_location_finish (IdeSymbolNode *self,
return ide_task_propagate_pointer (IDE_TASK (result), error);
}
-static const char *
+const char *
ide_symbol_node_get_icon_name (IdeSymbolNode *self)
{
IdeSymbolKind kind = ide_symbol_node_get_kind (self);
return ide_symbol_kind_get_icon_name (kind);
}
+/**
+ * ide_symbol_node_get_gicon:
+ * @self: a #IdeSymbolNode
+ *
+ * Gets a #GIcon for the symbol node.
+ *
+ * Returns: (transfer none) (nullable): a #GIcon or %NULL
+ */
+GIcon *
+ide_symbol_node_get_gicon (IdeSymbolNode *self)
+{
+ IdeSymbolKind kind = ide_symbol_node_get_kind (self);
+ return ide_symbol_kind_get_gicon (kind);
+}
+
static void
ide_symbol_node_finalize (GObject *object)
{
diff --git a/src/libide/code/ide-symbol-node.h b/src/libide/code/ide-symbol-node.h
index 0f8b435b3..632b6c6d0 100644
--- a/src/libide/code/ide-symbol-node.h
+++ b/src/libide/code/ide-symbol-node.h
@@ -57,7 +57,11 @@ IdeSymbolKind ide_symbol_node_get_kind (IdeSymbolNode *self)
IDE_AVAILABLE_IN_ALL
IdeSymbolFlags ide_symbol_node_get_flags (IdeSymbolNode *self);
IDE_AVAILABLE_IN_ALL
-const gchar *ide_symbol_node_get_name (IdeSymbolNode *self);
+const char *ide_symbol_node_get_name (IdeSymbolNode *self);
+IDE_AVAILABLE_IN_ALL
+const char *ide_symbol_node_get_icon_name (IdeSymbolNode *self);
+IDE_AVAILABLE_IN_ALL
+GIcon *ide_symbol_node_get_gicon (IdeSymbolNode *self);
IDE_AVAILABLE_IN_ALL
gboolean ide_symbol_node_get_use_markup (IdeSymbolNode *self);
IDE_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]