[gnome-builder/wip/chergert/layout: 79/118] symbol-tree: make toplevel icons align with search entry



commit aff232d1be05388c96e1df05fa2e11f13d4ff80e
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 2 22:13:34 2017 -0700

    symbol-tree: make toplevel icons align with search entry

 plugins/symbol-tree/gbp-symbol-menu-button.c  |   35 +++++++++++++++++++++++++
 plugins/symbol-tree/gbp-symbol-menu-button.ui |    5 +--
 plugins/symbol-tree/themes/shared.css         |    9 ++++--
 3 files changed, 43 insertions(+), 6 deletions(-)
---
diff --git a/plugins/symbol-tree/gbp-symbol-menu-button.c b/plugins/symbol-tree/gbp-symbol-menu-button.c
index 21af553..597b7c2 100644
--- a/plugins/symbol-tree/gbp-symbol-menu-button.c
+++ b/plugins/symbol-tree/gbp-symbol-menu-button.c
@@ -81,6 +81,36 @@ gbp_symbol_menu_button_search_changed (GbpSymbolMenuButton *self,
   gtk_tree_view_expand_all (GTK_TREE_VIEW (self->tree));
 }
 
+static GtkCellRenderer *
+gbp_symbol_menu_button_get_icon_cell (GbpSymbolMenuButton *self)
+{
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *cell = NULL;
+
+  g_assert (GBP_IS_SYMBOL_MENU_BUTTON (self));
+  g_assert (GTK_IS_TREE_VIEW (self->tree));
+
+  column = gtk_tree_view_get_column (GTK_TREE_VIEW (self->tree), 0);
+
+  if (column != NULL)
+    {
+      GList *cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
+
+      for (const GList *iter = cells; iter; iter = iter->next)
+        {
+          if (GTK_IS_CELL_RENDERER_PIXBUF (iter->data))
+            {
+              cell = iter->data;
+              break;
+            }
+        }
+
+      g_list_free (cells);
+    }
+
+  return cell;
+}
+
 static void
 gbp_symbol_menu_button_destroy (GtkWidget *widget)
 {
@@ -170,6 +200,11 @@ gbp_symbol_menu_button_init (GbpSymbolMenuButton *self)
                             "changed",
                             G_CALLBACK (gbp_symbol_menu_button_search_changed),
                             self);
+
+  g_object_set (gbp_symbol_menu_button_get_icon_cell (self),
+                "width", 28,
+                "xalign", 1.0f,
+                NULL);
 }
 
 /**
diff --git a/plugins/symbol-tree/gbp-symbol-menu-button.ui b/plugins/symbol-tree/gbp-symbol-menu-button.ui
index a0fe230..6925170 100644
--- a/plugins/symbol-tree/gbp-symbol-menu-button.ui
+++ b/plugins/symbol-tree/gbp-symbol-menu-button.ui
@@ -10,9 +10,6 @@
         <property name="visible">true</property>
         <child>
           <object class="GtkSearchEntry" id="search_entry">
-            <property name="margin-start">14</property>
-            <property name="margin-end">14</property>
-            <property name="margin-top">6</property>
             <property name="margin-bottom">6</property>
             <property name="visible">true</property>
           </object>
@@ -21,11 +18,13 @@
           <object class="GtkScrolledWindow">
             <property name="propagate-natural-height">true</property>
             <property name="propagate-natural-width">true</property>
+            <property name="min-content-width">250</property>
             <property name="min-content-height">300</property>
             <property name="max-content-height">600</property>
             <property name="visible">true</property>
             <child>
               <object class="DzlTree" id="tree">
+                <property name="level-indentation">16</property>
                 <property name="headers-visible">false</property>
                 <property name="show-icons">true</property>
                 <property name="activate-on-single-click">true</property>
diff --git a/plugins/symbol-tree/themes/shared.css b/plugins/symbol-tree/themes/shared.css
index 07eaa58..be9e30d 100644
--- a/plugins/symbol-tree/themes/shared.css
+++ b/plugins/symbol-tree/themes/shared.css
@@ -1,10 +1,13 @@
 popover.symbols-button {
   padding: 12px;
-  }
+}
 popover.symbols-button treeview {
+  -GtkTreeView-expander-size: 0;
+  -GtkTreeView-horizontal-separator: 0;
+  -gtk-icon-source: none;
   background: transparent;
   color: @theme_fg_color;
-  }
+}
 popover.symbols-button treeview:backdrop {
   color: @theme_unfocused_fg_color;
-  }
+}


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