Start of implementation of custom columns
This commit is contained in:
parent
b8eba20b7c
commit
acc8512800
58
prefs.js
58
prefs.js
@ -24,6 +24,7 @@ const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const Gtk = imports.gi.Gtk;
|
||||
const Gdk = imports.gi.Gdk;
|
||||
const GObject = imports.gi.GObject;
|
||||
|
||||
// It's common practice to keep GNOME API and JS imports in separate blocks
|
||||
const Lang = imports.lang;
|
||||
@ -245,9 +246,12 @@ function createAccountWidgets ( isActive )
|
||||
this._accountsWidget = new Gtk.Notebook( { } );
|
||||
this._accountsWidgetContainer.pack_start(this._accountsWidget, true, true, 0);
|
||||
|
||||
for ( var _tab of [ 'Settings', 'Colors', 'Filters', 'Replacements' ] )
|
||||
for ( var _tab of [ 'Settings', 'Columns', 'Colors', 'Filters', 'Replacements' ] )
|
||||
{
|
||||
this.createPrefWidgets ( _accountsWidget, _tab, isActive );
|
||||
if ( _tab != 'Columns' )
|
||||
this.createPrefWidgets ( _accountsWidget, _tab, isActive );
|
||||
else
|
||||
this.createColumnsPrefTab ( _accountsWidget, _tab, isActive );
|
||||
}
|
||||
|
||||
// Settings
|
||||
@ -324,6 +328,56 @@ function createPrefWidgets ( noteBook, type, isActive )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createColumnsPrefTab ( noteBook, type, isActive )
|
||||
{
|
||||
let grid = new Gtk.Grid ( {
|
||||
halign: Gtk.Align.FILL,
|
||||
margin: 18,
|
||||
column_spacing: 12,
|
||||
row_spacing: 12,
|
||||
visible: true,
|
||||
column_homogeneous: false,
|
||||
});
|
||||
noteBook.append_page ( grid, new Gtk.Label ( { label: _(type), } ) );
|
||||
|
||||
let _store = new Gtk.TreeStore();
|
||||
_store.set_column_types([GObject.TYPE_STRING, GObject.TYPE_INT]);
|
||||
_store.filter_new(null);
|
||||
|
||||
let _treeView = new Gtk.TreeView ( { model: _store,
|
||||
headers_visible: true,
|
||||
reorderable: true,
|
||||
hexpand: true,
|
||||
vexpand: true });
|
||||
|
||||
let columnNumbers = new Gtk.TreeViewColumn ( { title: _("Column") } );
|
||||
let rendererNumbers = new Gtk.CellRendererText ( { editable: true } );
|
||||
columnNumbers.pack_start(rendererNumbers, true);
|
||||
columnNumbers.add_attribute(rendererNumbers, 'text', 0);
|
||||
_treeView.append_column(columnNumbers);
|
||||
|
||||
let _colSize = new Gtk.TreeViewColumn ( { title: _("Size") } );
|
||||
let _colRenderer = new Gtk.CellRendererText ( { editable: true } );
|
||||
_colSize.pack_start(_colRenderer, true);
|
||||
_colSize.add_attribute(_colRenderer, 'text', 1);
|
||||
_treeView.append_column(_colSize);
|
||||
|
||||
let _item = _store.append(null);
|
||||
_store.set_value(_item, 0, 'prout' );
|
||||
_store.set_value(_item, 1, 2 );
|
||||
|
||||
_item = _store.append(null);
|
||||
_store.set_value(_item, 0, 'bar' );
|
||||
_store.set_value(_item, 1, 1 );
|
||||
|
||||
// _treeView.connect('row-activated', this._editPath.bind(this));
|
||||
|
||||
grid.attach ( _treeView, 0, 1, 1, 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function activateAccountRow ( ) {
|
||||
|
||||
if ( this._accountsWidget )
|
||||
|
Loading…
Reference in New Issue
Block a user