[gnome-builder/wip/gtk4-port] plugins/symbol-tree: handle NULL names better
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/symbol-tree: handle NULL names better
- Date: Fri, 22 Apr 2022 02:24:02 +0000 (UTC)
commit c2cec371659f14a815e907adfbb229a41c7eae59
Author: Christian Hergert <chergert redhat com>
Date: Thu Apr 21 19:23:54 2022 -0700
plugins/symbol-tree: handle NULL names better
src/plugins/symbol-tree/gbp-symbol-workspace-addin.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/symbol-tree/gbp-symbol-workspace-addin.c
b/src/plugins/symbol-tree/gbp-symbol-workspace-addin.c
index 6ef483538..d3f6a1538 100644
--- a/src/plugins/symbol-tree/gbp-symbol-workspace-addin.c
+++ b/src/plugins/symbol-tree/gbp-symbol-workspace-addin.c
@@ -56,15 +56,24 @@ static void
gbp_symbol_workspace_addin_set_symbol (GbpSymbolWorkspaceAddin *self,
IdeSymbol *symbol)
{
- const char *label;
- const char *icon_name;
+ const char *label = NULL;
+ const char *icon_name = NULL;
IDE_ENTRY;
g_assert (GBP_IS_SYMBOL_WORKSPACE_ADDIN (self));
g_assert (!symbol || IDE_IS_SYMBOL (symbol));
- if (symbol == NULL)
+ if (symbol != NULL)
+ {
+ icon_name = ide_symbol_kind_get_icon_name (ide_symbol_get_kind (symbol));
+ label = ide_symbol_get_name (symbol);
+
+ if (ide_str_empty0 (label))
+ label = NULL;
+ }
+
+ if (label == NULL)
{
gtk_label_set_label (self->menu_label, _("Select Symbol…"));
gtk_image_set_from_icon_name (self->menu_image, NULL);
@@ -72,9 +81,6 @@ gbp_symbol_workspace_addin_set_symbol (GbpSymbolWorkspaceAddin *self,
IDE_EXIT;
}
- label = ide_symbol_get_name (symbol);
- icon_name = ide_symbol_kind_get_icon_name (ide_symbol_get_kind (symbol));
-
gtk_label_set_label (self->menu_label, label);
gtk_image_set_from_icon_name (self->menu_image, icon_name);
gtk_widget_set_visible (GTK_WIDGET (self->menu_image), icon_name != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]