Port to Gtk4
This commit is contained in:
parent
66f1deed14
commit
af32fbefd2
38
prefs.js
38
prefs.js
@ -83,7 +83,6 @@ const prefs = [
|
|||||||
function init() {
|
function init() {
|
||||||
monitoLog('initializing ${Me.metadata.name} Preferences');
|
monitoLog('initializing ${Me.metadata.name} Preferences');
|
||||||
this.settings = ExtensionUtils.getSettings(SETTINGS_SCHEMA);
|
this.settings = ExtensionUtils.getSettings(SETTINGS_SCHEMA);
|
||||||
monitoLog ( 'Foo: ' + Me.metadata );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ function buildPrefsWidget() {
|
|||||||
let mainWidget = new Gtk.Notebook( { } );
|
let mainWidget = new Gtk.Notebook( { } );
|
||||||
|
|
||||||
let prefsWidget = new Gtk.Grid({
|
let prefsWidget = new Gtk.Grid({
|
||||||
margin: 18,
|
// margin: 18,
|
||||||
column_spacing: 12,
|
column_spacing: 12,
|
||||||
row_spacing: 12,
|
row_spacing: 12,
|
||||||
column_homogeneous: false,
|
column_homogeneous: false,
|
||||||
@ -158,18 +157,20 @@ function buildPrefsWidget() {
|
|||||||
|
|
||||||
// Accounts
|
// Accounts
|
||||||
this._accountsWidgetContainer = new Gtk.Box( { orientation: Gtk.Orientation.HORIZONTAL,
|
this._accountsWidgetContainer = new Gtk.Box( { orientation: Gtk.Orientation.HORIZONTAL,
|
||||||
homogeneous: false, } );
|
homogeneous: false, } );
|
||||||
mainWidget.append_page ( this._accountsWidgetContainer,
|
mainWidget.append_page ( this._accountsWidgetContainer,
|
||||||
new Gtk.Label ( { label: _('Servers'), } ) );
|
new Gtk.Label ( { label: _('Servers'), } ) );
|
||||||
|
|
||||||
let accountsChooserContainer = new Gtk.Box( { orientation: Gtk.Orientation.VERTICAL,
|
let accountsChooserContainer = new Gtk.Box( { orientation: Gtk.Orientation.VERTICAL,
|
||||||
homogeneous: false, } );
|
homogeneous: false, } );
|
||||||
this._accountsWidgetContainer.pack_start(accountsChooserContainer, true, true, 0);
|
monitoLog ( 'Box ' + this._accountsWidgetContainer );
|
||||||
|
monitoLog ( 'Func ' + this._accountsWidgetContainer.pack_start );
|
||||||
|
this._accountsWidgetContainer.append(accountsChooserContainer, true, true, 0);
|
||||||
|
|
||||||
this.accountsChooser = new Gtk.ListBox ( { valign: Gtk.Align.FILL,
|
this.accountsChooser = new Gtk.ListBox ( { valign: Gtk.Align.FILL,
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
vexpand: true } );
|
vexpand: true } );
|
||||||
accountsChooserContainer.pack_start(this.accountsChooser, true, true, 0);
|
accountsChooserContainer.append(this.accountsChooser, true, true, 0);
|
||||||
|
|
||||||
// Account list
|
// Account list
|
||||||
for ( var server_id of this.getServersList ( ) )
|
for ( var server_id of this.getServersList ( ) )
|
||||||
@ -178,7 +179,7 @@ function buildPrefsWidget() {
|
|||||||
|
|
||||||
// Action Bar
|
// Action Bar
|
||||||
let accountsChooserActionBar = new Gtk.ActionBar ( { valign: Gtk.Align.END } );
|
let accountsChooserActionBar = new Gtk.ActionBar ( { valign: Gtk.Align.END } );
|
||||||
accountsChooserContainer.pack_start(accountsChooserActionBar, true, true, 0);
|
accountsChooserContainer.append(accountsChooserActionBar, true, true, 0);
|
||||||
|
|
||||||
let accountCreateButton = Gtk.Button.new_from_icon_name ( 'list-add',
|
let accountCreateButton = Gtk.Button.new_from_icon_name ( 'list-add',
|
||||||
Gtk.IconSize.BUTTON );
|
Gtk.IconSize.BUTTON );
|
||||||
@ -192,7 +193,7 @@ function buildPrefsWidget() {
|
|||||||
|
|
||||||
this.createAccountWidgets ( false ) ;
|
this.createAccountWidgets ( false ) ;
|
||||||
|
|
||||||
mainVbox.pack_start(mainWidget, true, true, 0);
|
mainVbox.append(mainWidget, true, true, 0);
|
||||||
mainVbox.show_all();
|
mainVbox.show_all();
|
||||||
|
|
||||||
return mainVbox;
|
return mainVbox;
|
||||||
@ -244,7 +245,7 @@ function createAccountWidgets ( isActive )
|
|||||||
this.prefWidgets = { };
|
this.prefWidgets = { };
|
||||||
|
|
||||||
this._accountsWidget = new Gtk.Notebook( { } );
|
this._accountsWidget = new Gtk.Notebook( { } );
|
||||||
this._accountsWidgetContainer.pack_start(this._accountsWidget, true, true, 0);
|
this._accountsWidgetContainer.append(this._accountsWidget, true, true, 0);
|
||||||
|
|
||||||
for ( var _tab of [ 'Settings', 'Columns', 'Colors', 'Filters', 'Replacements' ] )
|
for ( var _tab of [ 'Settings', 'Columns', 'Colors', 'Filters', 'Replacements' ] )
|
||||||
{
|
{
|
||||||
@ -269,7 +270,7 @@ function createPrefWidgets ( noteBook, type, isActive )
|
|||||||
{
|
{
|
||||||
let grid = new Gtk.Grid ( {
|
let grid = new Gtk.Grid ( {
|
||||||
halign: Gtk.Align.FILL,
|
halign: Gtk.Align.FILL,
|
||||||
margin: 18,
|
// margin: 18,
|
||||||
column_spacing: 12,
|
column_spacing: 12,
|
||||||
row_spacing: 12,
|
row_spacing: 12,
|
||||||
visible: true,
|
visible: true,
|
||||||
@ -333,7 +334,7 @@ function createColumnsPrefTab ( noteBook, type, isActive )
|
|||||||
{
|
{
|
||||||
let grid = new Gtk.Grid ( {
|
let grid = new Gtk.Grid ( {
|
||||||
halign: Gtk.Align.FILL,
|
halign: Gtk.Align.FILL,
|
||||||
margin: 18,
|
// margin: 18,
|
||||||
column_spacing: 12,
|
column_spacing: 12,
|
||||||
row_spacing: 12,
|
row_spacing: 12,
|
||||||
visible: true,
|
visible: true,
|
||||||
@ -353,13 +354,13 @@ function createColumnsPrefTab ( noteBook, type, isActive )
|
|||||||
|
|
||||||
let columnNumbers = new Gtk.TreeViewColumn ( { title: _("Column") } );
|
let columnNumbers = new Gtk.TreeViewColumn ( { title: _("Column") } );
|
||||||
let rendererNumbers = new Gtk.CellRendererText ( { editable: true } );
|
let rendererNumbers = new Gtk.CellRendererText ( { editable: true } );
|
||||||
columnNumbers.pack_start(rendererNumbers, true);
|
columnNumbers.append(rendererNumbers, true);
|
||||||
columnNumbers.add_attribute(rendererNumbers, 'text', 0);
|
columnNumbers.add_attribute(rendererNumbers, 'text', 0);
|
||||||
_treeView.append_column(columnNumbers);
|
_treeView.append_column(columnNumbers);
|
||||||
|
|
||||||
let _colSize = new Gtk.TreeViewColumn ( { title: _("Size") } );
|
let _colSize = new Gtk.TreeViewColumn ( { title: _("Size") } );
|
||||||
let _colRenderer = new Gtk.CellRendererText ( { editable: true } );
|
let _colRenderer = new Gtk.CellRendererText ( { editable: true } );
|
||||||
_colSize.pack_start(_colRenderer, true);
|
_colSize.append(_colRenderer, true);
|
||||||
_colSize.add_attribute(_colRenderer, 'text', 1);
|
_colSize.add_attribute(_colRenderer, 'text', 1);
|
||||||
_treeView.append_column(_colSize);
|
_treeView.append_column(_colSize);
|
||||||
|
|
||||||
@ -438,17 +439,16 @@ function addAccountLine ( server_id )
|
|||||||
monitoLog ( '> Add line ' + server_id );
|
monitoLog ( '> Add line ' + server_id );
|
||||||
let _account_settings = getAccountSettings ( server_id );
|
let _account_settings = getAccountSettings ( server_id );
|
||||||
let row = new Gtk.ListBoxRow ( { hexpand: true,
|
let row = new Gtk.ListBoxRow ( { hexpand: true,
|
||||||
halign: Gtk.Align.FILL } );
|
halign: Gtk.Align.FILL } );
|
||||||
row.server = server_id;
|
row.server = server_id;
|
||||||
|
|
||||||
let _label = new Gtk.Label ( { label: _account_settings.get_string('name'),
|
let _label = new Gtk.Label ( { label: _account_settings.get_string('name'),
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
margin: 5,
|
// margin: 5,
|
||||||
halign: Gtk.Align.START,
|
halign: Gtk.Align.START } );
|
||||||
expand: true } );
|
row.set_child ( _label );
|
||||||
row.add ( _label );
|
this.accountsChooser.append ( row );
|
||||||
this.accountsChooser.add ( row );
|
this.accountsChooser.show_all(); // XXX Does not work in gtk4 ?
|
||||||
this.accountsChooser.show_all();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user