[gnome] Update extensions for version 48
This commit is contained in:
@ -16,7 +16,7 @@ import system from 'system';
|
||||
*
|
||||
* @param {*} [salt] - If not %null, will be used as salt for generating a color
|
||||
* @param {number} alpha - A value in the [0...1] range for the alpha channel
|
||||
* @return {Gdk.RGBA} A new Gdk.RGBA object generated from the input
|
||||
* @returns {Gdk.RGBA} A new Gdk.RGBA object generated from the input
|
||||
*/
|
||||
function randomRGBA(salt = null, alpha = 1.0) {
|
||||
let red, green, blue;
|
||||
@ -41,7 +41,7 @@ function randomRGBA(salt = null, alpha = 1.0) {
|
||||
* See: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
||||
*
|
||||
* @param {Gdk.RGBA} rgba - A GdkRGBA object
|
||||
* @return {number} The relative luminance of the color
|
||||
* @returns {number} The relative luminance of the color
|
||||
*/
|
||||
function relativeLuminance(rgba) {
|
||||
const {red, green, blue} = rgba;
|
||||
@ -59,7 +59,7 @@ function relativeLuminance(rgba) {
|
||||
* See: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
|
||||
*
|
||||
* @param {Gdk.RGBA} rgba - A GdkRGBA object for the background color
|
||||
* @return {Gdk.RGBA} A GdkRGBA object for the foreground color
|
||||
* @returns {Gdk.RGBA} A GdkRGBA object for the foreground color
|
||||
*/
|
||||
function getFgRGBA(rgba) {
|
||||
const bgLuminance = relativeLuminance(rgba);
|
||||
@ -78,7 +78,7 @@ function getFgRGBA(rgba) {
|
||||
* @param {string} path - A local file path
|
||||
* @param {number} size - Size in pixels
|
||||
* @param {scale} [scale] - Scale factor for the size
|
||||
* @return {Gdk.Pixbuf} A pixbuf
|
||||
* @returns {Gdk.Pixbuf} A pixbuf
|
||||
*/
|
||||
function getPixbufForPath(path, size, scale = 1.0) {
|
||||
let data, loader;
|
||||
@ -107,6 +107,15 @@ function getPixbufForPath(path, size, scale = 1.0) {
|
||||
return pixbuf.scale_simple(size, size, GdkPixbuf.InterpType.HYPER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the GdkPixbuf for a named icon
|
||||
*
|
||||
* @param {string} name - The icon name to load
|
||||
* @param {number} size - The pixel size requested
|
||||
* @param {number} scale - The scale multiplier
|
||||
* @param {string} bgColor - The background color the icon will be used against
|
||||
* @returns {GdkPixbuf.pixbuf|null} The icon image
|
||||
*/
|
||||
function getPixbufForIcon(name, size, scale, bgColor) {
|
||||
const color = getFgRGBA(bgColor);
|
||||
const theme = Gtk.IconTheme.get_default();
|
||||
@ -126,7 +135,7 @@ function getPixbufForIcon(name, size, scale, bgColor) {
|
||||
* See: http://www.ietf.org/rfc/rfc2426.txt
|
||||
*
|
||||
* @param {string} type - An RFC2426 phone number type
|
||||
* @return {string} A localized string like 'Mobile'
|
||||
* @returns {string} A localized string like 'Mobile'
|
||||
*/
|
||||
function getNumberTypeLabel(type) {
|
||||
if (type.includes('fax'))
|
||||
@ -152,9 +161,9 @@ function getNumberTypeLabel(type) {
|
||||
/**
|
||||
* Get a display number from @contact for @address.
|
||||
*
|
||||
* @param {Object} contact - A contact object
|
||||
* @param {object} contact - A contact object
|
||||
* @param {string} address - A phone number
|
||||
* @return {string} A (possibly) better display number for the address
|
||||
* @returns {string} A (possibly) better display number for the address
|
||||
*/
|
||||
export function getDisplayNumber(contact, address) {
|
||||
const number = address.toPhoneNumber();
|
||||
@ -623,7 +632,7 @@ export const ContactChooser = GObject.registerClass({
|
||||
/**
|
||||
* Get a dictionary of number-contact pairs for each selected phone number.
|
||||
*
|
||||
* @return {Object[]} A dictionary of contacts
|
||||
* @returns {object[]} A dictionary of contacts
|
||||
*/
|
||||
getSelected() {
|
||||
try {
|
||||
@ -639,4 +648,3 @@ export const ContactChooser = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ const _cFormat = new Intl.DateTimeFormat('default', {
|
||||
* Return a human-readable timestamp, formatted for longer contexts.
|
||||
*
|
||||
* @param {number} time - Milliseconds since the epoch (local time)
|
||||
* @return {string} A localized timestamp similar to what Android Messages uses
|
||||
* @returns {string} A localized timestamp similar to what Android Messages uses
|
||||
*/
|
||||
function getTime(time) {
|
||||
const date = new Date(time);
|
||||
@ -134,7 +134,7 @@ function getTime(time) {
|
||||
* Return a human-readable timestamp, formatted for shorter contexts.
|
||||
*
|
||||
* @param {number} time - Milliseconds since the epoch (local time)
|
||||
* @return {string} A localized timestamp similar to what Android Messages uses
|
||||
* @returns {string} A localized timestamp similar to what Android Messages uses
|
||||
*/
|
||||
function getShortTime(time) {
|
||||
const date = new Date(time);
|
||||
@ -175,13 +175,19 @@ function getShortTime(time) {
|
||||
* Return a human-readable timestamp, similar to `strftime()` with `%c`.
|
||||
*
|
||||
* @param {number} time - Milliseconds since the epoch (local time)
|
||||
* @return {string} A localized timestamp
|
||||
* @returns {string} A localized timestamp
|
||||
*/
|
||||
function getDetailedTime(time) {
|
||||
return _cFormat.format(time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make the avatar for an incoming message visible or invisible
|
||||
*
|
||||
* @param {ConversationMessage} row - The message row to modify
|
||||
* @param {boolean} visible - Whether the avatar should be visible
|
||||
*/
|
||||
function setAvatarVisible(row, visible) {
|
||||
const incoming = row.message.type === Sms.MessageBox.INBOX;
|
||||
|
||||
@ -546,8 +552,8 @@ const Conversation = GObject.registerClass({
|
||||
* Create a message row, ensuring a contact object has been retrieved or
|
||||
* generated for the message.
|
||||
*
|
||||
* @param {Object} message - A dictionary of message data
|
||||
* @return {ConversationMessage} A message row
|
||||
* @param {object} message - A dictionary of message data
|
||||
* @returns {ConversationMessage} A message row
|
||||
*/
|
||||
_createMessageRow(message) {
|
||||
// Ensure we have a contact
|
||||
@ -655,7 +661,7 @@ const Conversation = GObject.registerClass({
|
||||
/**
|
||||
* Log the next message in the conversation.
|
||||
*
|
||||
* @param {Object} message - A message object
|
||||
* @param {object} message - A message object
|
||||
*/
|
||||
logNext(message) {
|
||||
try {
|
||||
@ -1073,8 +1079,8 @@ export const Window = GObject.registerClass({
|
||||
/**
|
||||
* Find the thread row for @contacts
|
||||
*
|
||||
* @param {Object[]} contacts - A contact group
|
||||
* @return {ConversationSummary|null} The thread row or %null
|
||||
* @param {object[]} contacts - A contact group
|
||||
* @returns {ConversationSummary|null} The thread row or %null
|
||||
*/
|
||||
_getRowForContacts(contacts) {
|
||||
const addresses = Object.keys(contacts).map(address => {
|
||||
@ -1156,8 +1162,8 @@ export const Window = GObject.registerClass({
|
||||
/**
|
||||
* Try and find an existing conversation widget for @message.
|
||||
*
|
||||
* @param {Object} message - A message object
|
||||
* @return {Conversation|null} A conversation widget or %null
|
||||
* @param {object} message - A message object
|
||||
* @returns {Conversation|null} A conversation widget or %null
|
||||
*/
|
||||
getConversationForMessage(message) {
|
||||
// TODO: This shouldn't happen?
|
||||
@ -1317,4 +1323,3 @@ export const ConversationChooser = GObject.registerClass({
|
||||
this.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user