[gnome-maps] searchPopup: Move treeview init to ui file
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] searchPopup: Move treeview init to ui file
- Date: Thu, 30 Oct 2014 08:39:01 +0000 (UTC)
commit f2df263c152bf7129236bbe68d3d9b81713c6017
Author: Jonas Danielsson <jonas danielsson threetimestwo org>
Date: Thu Oct 30 04:27:00 2014 -0400
searchPopup: Move treeview init to ui file
src/search-popup.ui | 25 +++++++++++++++++++++++++
src/searchPopup.js | 26 ++++----------------------
2 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/src/search-popup.ui b/src/search-popup.ui
index d17de55..1ddfb17 100644
--- a/src/search-popup.ui
+++ b/src/search-popup.ui
@@ -25,6 +25,31 @@
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
+ <child>
+ <object class="GtkTreeViewColumn" id="icon-column">
+ <child>
+ <object class="GtkCellRendererPixbuf" id="icon-cell">
+ <property name="xpad">2</property>
+ </object>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="text-column">
+ <child>
+ <object class="GtkCellRendererText" id="text-cell">
+ <property name="xpad">4</property>
+ <property name="ypad">4</property>
+ </object>
+ <attributes>
+ <attribute name="markup">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/searchPopup.js b/src/searchPopup.js
index f7c8843..3517622 100644
--- a/src/searchPopup.js
+++ b/src/searchPopup.js
@@ -48,8 +48,8 @@ const SearchPopup = new Lang.Class({
let ui = Utils.getUIObject('search-popup', ['scrolled-window',
'stack',
'spinner',
- 'treeview',]);
-
+ 'treeview',
+ 'text-column',]);
this._stack = ui.stack;
this._scrolledWindow = ui.scrolledWindow;
this._spinner = ui.spinner;
@@ -63,8 +63,8 @@ const SearchPopup = new Lang.Class({
this._treeView.connect('row-activated',
this._onRowActivated.bind(this));
- this._initList();
- this.height_request = this._cellHeight * this._numVisible;
+ let cellHeight = ui.textColumn.cell_get_size(null)[3];
+ this.height_request = cellHeight * this._numVisible;
this._scrolledWindow.set_min_content_height(this.height_request);
this.parent(props);
@@ -74,24 +74,6 @@ const SearchPopup = new Lang.Class({
this.hide();
},
- _initList: function() {
- let column = new Gtk.TreeViewColumn();
-
- this._treeView.append_column(column);
-
- let cell = new Gtk.CellRendererPixbuf({ xpad: 2 });
- column.pack_start(cell, false);
- column.add_attribute(cell, 'pixbuf', Columns.ICON);
-
- cell = new Gtk.CellRendererText({ xpad: 8,
- ypad: 8 });
- column.pack_start(cell, true);
- column.add_attribute(cell, 'markup', Columns.DESCRIPTION);
-
- this._cellHeight = column.cell_get_size(null)[3];
- this._cellHeight += cell.get_preferred_height(this._treeView)[0];
- },
-
_onRowActivated: function(widget, path, column) {
let model = this._treeView.model;
let iter_valid, iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]