[gnome-builder/wip/chergert/layout: 90/118] symbol-tree: don't remove our previous button children



commit 32a4bf49825ed0224282f50441e5b112fb95b22f
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 3 17:03:38 2017 -0700

    symbol-tree: don't remove our previous button children
    
    We manually track the state now in GbpSymbolMenuButton so there
    is no reason to change the label here and cause those children
    to be removed.
    
    Signed-off-by: Christian Hergert <chergert redhat com>

 .../symbol-tree/gbp-symbol-layout-stack-addin.c    |    2 +-
 plugins/symbol-tree/gbp-symbol-menu-button.c       |    5 +++++
 plugins/symbol-tree/gbp-symbol-menu-button.ui      |    2 ++
 3 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c 
b/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
index f03362d..51546b7 100644
--- a/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
+++ b/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
@@ -231,7 +231,7 @@ gbp_symbol_layout_stack_addin_bind (GbpSymbolLayoutStackAddin *self,
 
   self->cancellable = g_cancellable_new ();
 
-  gtk_button_set_label (GTK_BUTTON (self->button), _("Document Outline"));
+  gbp_symbol_menu_button_set_symbol (self->button, NULL);
 
   symbol_resolver = ide_buffer_get_symbol_resolver (buffer);
   gtk_widget_set_visible (GTK_WIDGET (self->button), symbol_resolver != NULL);
diff --git a/plugins/symbol-tree/gbp-symbol-menu-button.c b/plugins/symbol-tree/gbp-symbol-menu-button.c
index b30fc33..9f9efcc 100644
--- a/plugins/symbol-tree/gbp-symbol-menu-button.c
+++ b/plugins/symbol-tree/gbp-symbol-menu-button.c
@@ -262,6 +262,8 @@ gbp_symbol_menu_button_set_symbol (GbpSymbolMenuButton *self,
   const gchar *title = _("Document Outline");
   const gchar *icon_name = NULL;
 
+  IDE_ENTRY;
+
   g_assert (GBP_IS_SYMBOL_MENU_BUTTON (self));
 
   if (symbol != NULL)
@@ -269,6 +271,7 @@ gbp_symbol_menu_button_set_symbol (GbpSymbolMenuButton *self,
       IdeSymbolKind kind = ide_symbol_get_kind (symbol);
 
       icon_name = ide_symbol_kind_get_icon_name (kind);
+      title = ide_symbol_get_name (symbol);
     }
 
   g_object_set (self->symbol_icon,
@@ -280,4 +283,6 @@ gbp_symbol_menu_button_set_symbol (GbpSymbolMenuButton *self,
                 "label", title,
                 "visible", (symbol != NULL),
                 NULL);
+
+  IDE_EXIT;
 }
diff --git a/plugins/symbol-tree/gbp-symbol-menu-button.ui b/plugins/symbol-tree/gbp-symbol-menu-button.ui
index be96ba7..a7af5c0 100644
--- a/plugins/symbol-tree/gbp-symbol-menu-button.ui
+++ b/plugins/symbol-tree/gbp-symbol-menu-button.ui
@@ -61,6 +61,8 @@
         <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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]