[gnome-builder/wip/chergert/layout] symbol-tree: handle failure cases better
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/layout] symbol-tree: handle failure cases better
- Date: Tue, 4 Jul 2017 00:27:15 +0000 (UTC)
commit b3047a9a4b3647529991ff12af15360928d94421
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 3 17:26:53 2017 -0700
symbol-tree: handle failure cases better
Signed-off-by: Christian Hergert <chergert redhat com>
.../symbol-tree/gbp-symbol-layout-stack-addin.c | 1 +
plugins/symbol-tree/gbp-symbol-menu-button.c | 14 +++++++++-----
plugins/symbol-tree/gbp-symbol-menu-button.ui | 6 ++++--
3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
b/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
index 51546b7..b781ea7 100644
--- a/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
+++ b/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
@@ -54,6 +54,7 @@ gbp_symbol_layout_stack_addin_find_scope_cb (GObject *object,
if (error != NULL &&
!(g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
+ g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)))
g_warning ("Failed to find nearest scope: %s", error->message);
diff --git a/plugins/symbol-tree/gbp-symbol-menu-button.c b/plugins/symbol-tree/gbp-symbol-menu-button.c
index 9f9efcc..cf7ed81 100644
--- a/plugins/symbol-tree/gbp-symbol-menu-button.c
+++ b/plugins/symbol-tree/gbp-symbol-menu-button.c
@@ -259,7 +259,7 @@ void
gbp_symbol_menu_button_set_symbol (GbpSymbolMenuButton *self,
IdeSymbol *symbol)
{
- const gchar *title = _("Document Outline");
+ const gchar *title = NULL;
const gchar *icon_name = NULL;
IDE_ENTRY;
@@ -274,15 +274,19 @@ gbp_symbol_menu_button_set_symbol (GbpSymbolMenuButton *self,
title = ide_symbol_get_name (symbol);
}
+ if (ide_str_empty0 (title))
+ {
+ title = _("Document Outline");
+ icon_name = NULL;
+ symbol = NULL;
+ }
+
g_object_set (self->symbol_icon,
"icon-name", icon_name,
"visible", (symbol != NULL),
NULL);
- g_object_set (self->symbol_title,
- "label", title,
- "visible", (symbol != NULL),
- NULL);
+ gtk_label_set_label (self->symbol_title, title);
IDE_EXIT;
}
diff --git a/plugins/symbol-tree/gbp-symbol-menu-button.ui b/plugins/symbol-tree/gbp-symbol-menu-button.ui
index a7af5c0..bf4316b 100644
--- a/plugins/symbol-tree/gbp-symbol-menu-button.ui
+++ b/plugins/symbol-tree/gbp-symbol-menu-button.ui
@@ -57,18 +57,20 @@
<property name="popover">popover</property>
<child>
<object class="GtkBox">
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="spacing">6</property>
<property name="hexpand">true</property>
<property name="visible">true</property>
<child>
<object class="GtkImage" id="symbol_icon">
- <property name="margin-start">8</property>
- <property name="margin-end">8</property>
<property name="hexpand">true</property>
<property name="halign">end</property>
</object>
</child>
<child type="center">
<object class="GtkLabel" id="symbol_title">
+ <property name="ellipsize">end</property>
<property name="label" translatable="yes">Document Outline</property>
<property name="visible">true</property>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]