I am working on this extension and for the settings window, I would like the text field where users type their message to take the whole row. Right now, it takes half of it because of the space for a label.
Also, how would I do it in both gtk4 and gtk3?
Thanks for any help!
'use strict';
//Import required libraries
const { Gio, GObject, Gtk } = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;//Access to settings from schema
function init() {}
//GTK4 WINDOW
//Dectect Gnome Version Number
const Config = imports.misc.config;
const [major, minor] = Config.PACKAGE_VERSION.split('.').map(s => Number(s));
function fillPreferencesWindow(window) {
if (major >= 42) {//Check for Gnome 42 or above
const Adw = imports.gi.Adw;
//Create a preferences page and group
const page = new Adw.PreferencesPage();
window.add(page);
const group = new Adw.PreferencesGroup({ title: 'Write your message' });
page.add(group);
let settings = ExtensionUtils.getSettings();
//Add the row for the text entry
const messageRow = new Adw.ActionRow();
let messageText = new Gtk.EntryBuffer({ text: settings.get_string('message') })
let messageEntry = new Gtk.Entry({
buffer: messageText,
hexpand: true,
halign: Gtk.Align.CENTER,
valign:Gtk.Align.CENTER
})
group.add(messageRow);
messageRow.add_suffix(messageEntry);
messageRow.activatable_widget = messageEntry;
}
}