[gnome-characters/bilelmoussaoui/gtk4: 14/71] make use of new css helper
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters/bilelmoussaoui/gtk4: 14/71] make use of new css helper
- Date: Thu, 25 Nov 2021 11:03:10 +0000 (UTC)
commit 6c83a6df951c3dc721f749f803a0e63147a7ddfb
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Fri Nov 19 12:25:52 2021 +0100
make use of new css helper
src/categoryList.js | 16 ++++++++--------
src/characterDialog.js | 2 +-
src/characterList.js | 5 +----
src/menu.js | 7 +++----
src/window.js | 3 +--
5 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/src/categoryList.js b/src/categoryList.js
index 55b0710..f05f928 100644
--- a/src/categoryList.js
+++ b/src/categoryList.js
@@ -150,12 +150,12 @@ const CategoryListRowWidget = GObject.registerClass({
let image = Gtk.Image.new_from_icon_name(category.icon_name);
image.set_icon_size(Gtk.IconSize.LARGE_TOOLBAR);
- image.get_style_context().add_class('category-icon');
+ image.add_css_class('category-icon');
hbox.append(image);
let label = new Gtk.Label({ label: Gettext.gettext(category.title),
halign: Gtk.Align.START });
- label.get_style_context().add_class('category-label');
+ label.add_css_class('category-label');
hbox.append(label);
}
@@ -177,7 +177,7 @@ const CategoryListWidget = GObject.registerClass({
for (let index in this._categoryList) {
let category = this._categoryList[index];
let rowWidget = new CategoryListRowWidget({}, category);
- rowWidget.get_style_context().add_class('category');
+ rowWidget.add_css_class('category');
this.list.append(rowWidget);
}
@@ -366,8 +366,8 @@ const RecentCategoryListWidget = GObject.registerClass({
icon_name: 'document-open-recent-symbolic',
};
this.recentRow = new CategoryListRowWidget({}, this.recentCategory);
- this.recentRow.get_style_context().add_class('category');
- this.recentRow.get_style_context().add_class('recent-category');
+ this.recentRow.add_css_class('category');
+ this.recentRow.add_css_class('recent-category');
this.set_child(this.recentRow)
}
@@ -385,7 +385,7 @@ var CategoryListView = GObject.registerClass({
});
this._lastSelectedList = null;
super._init(params);
- this.get_style_context().add_class('categories-list');
+ this.add_css_class('categories-list');
this._recentCategoryList = new RecentCategoryListWidget();
this._recentCategoryList.list.connect('row-selected', (list, row) => {
@@ -405,7 +405,7 @@ var CategoryListView = GObject.registerClass({
margin_bottom: 12,
margin_end: 12,
});
- emojis_label.get_style_context().add_class("heading");
+ emojis_label.add_css_class("heading");
this.append(emojis_label);
this._emojiCategoryList = new EmojiCategoryListWidget({
@@ -427,7 +427,7 @@ var CategoryListView = GObject.registerClass({
margin_bottom: 12,
margin_end: 12,
});
- letters_label.get_style_context().add_class("heading");
+ letters_label.add_css_class("heading");
this.append(letters_label);
this._letterCategoryList = new LetterCategoryListWidget({
diff --git a/src/characterDialog.js b/src/characterDialog.js
index 49f8139..b1bb2cc 100644
--- a/src/characterDialog.js
+++ b/src/characterDialog.js
@@ -80,7 +80,7 @@ var CharacterDialog = GObject.registerClass({
valign: Gtk.Align.CENTER,
halign: Gtk.Align.CENTER,
width_request: 45 });
- characterLabel.get_style_context().add_class('character');
+ characterLabel.add_css_class('character');
hbox.pack_start(characterLabel, false, false, 2);
let nameLabel = new Gtk.Label({ label: Util.capitalize(name),
diff --git a/src/characterList.js b/src/characterList.js
index c93d2e8..13bca2c 100644
--- a/src/characterList.js
+++ b/src/characterList.js
@@ -202,9 +202,7 @@ const CharacterListWidget = GObject.registerClass({
});
params = Params.fill(params, {});
super._init(params);
- const context = this.get_style_context();
- context.add_class('character-list');
- context.save();
+ this.add_css_class('character-list');
this._cellsPerRow = CELLS_PER_ROW;
this._fontDescription = filtered.fontDescription;
this._numRows = filtered.numRows;
@@ -471,7 +469,6 @@ var CharacterListView = GObject.registerClass({
this._characterList.connect('character-selected', (w, c) => this.emit('character-selected', c));
let scroll = new Gtk.ScrolledWindow({
hscrollbar_policy: Gtk.PolicyType.NEVER,
- visible: true
});
scroll.set_child(this._characterList);
diff --git a/src/menu.js b/src/menu.js
index 5bdc0b2..81388cc 100644
--- a/src/menu.js
+++ b/src/menu.js
@@ -25,13 +25,12 @@ var MenuPopover = GObject.registerClass({
InternalChildren: ['search-entry', 'font-listbox'],
}, class MenuPopover extends Gtk.Popover {
_createFontListRow(title, family) {
- const row = new Gtk.ListBoxRow({ visible: true });
- row.get_style_context().add_class('font');
+ const row = new Gtk.ListBoxRow();
+ row.add_css_class('font');
row._family = family;
let label = new Gtk.Label({ label: title,
- visible: true,
halign: Gtk.Align.START });
- label.get_style_context().add_class('font-label');
+ label.add_css_class('font-label');
row.set_child(label);
return row;
}
diff --git a/src/window.js b/src/window.js
index 671724f..5861d9d 100644
--- a/src/window.js
+++ b/src/window.js
@@ -105,7 +105,6 @@ var MainWindow = GObject.registerClass({
let scroll = new Gtk.ScrolledWindow({
hscrollbar_policy: Gtk.PolicyType.NEVER,
hexpand: false,
- visible: true,
});
scroll.set_child(this._categoryListView);
this._sidebar.append(scroll);
@@ -158,7 +157,7 @@ var MainWindow = GObject.registerClass({
this._searchActive = v;
if (this._searchActive) {
- let categoryList = this._categoryListView.selectedList;
+ let categoryList = this._categoryListView.selectedList.list;
categoryList.unselect_all();
this._updateTitle(_("Search Result"));
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]