Compare commits
32 Commits
3.31.92
...
gbsneto/au
Author | SHA1 | Date | |
---|---|---|---|
![]() |
47a2e58d45 | ||
![]() |
20d73be57d | ||
![]() |
62233a4db4 | ||
![]() |
4a7e2ddff5 | ||
![]() |
fb737ebde0 | ||
![]() |
bf77cb44e7 | ||
![]() |
c72e2bb4a9 | ||
![]() |
68c182b1df | ||
![]() |
348d303794 | ||
![]() |
ede0fd8660 | ||
![]() |
187c2193e8 | ||
![]() |
706bdd8059 | ||
![]() |
436861edc8 | ||
![]() |
9729a2e772 | ||
![]() |
6b924c00c5 | ||
![]() |
b90f4d29a4 | ||
![]() |
47915f8c11 | ||
![]() |
5dfdeaa4ea | ||
![]() |
98a2a81f2a | ||
![]() |
c4850027bc | ||
![]() |
d4202e7f38 | ||
![]() |
4f65283f31 | ||
![]() |
d86d3bbe54 | ||
![]() |
6f794738e8 | ||
![]() |
ef7a93bb07 | ||
![]() |
5197a992a6 | ||
![]() |
49d8540f6d | ||
![]() |
6e1a1f1a57 | ||
![]() |
c73428247c | ||
![]() |
fc2caf5794 | ||
![]() |
b117826ada | ||
![]() |
26b44b48ab |
14
NEWS
14
NEWS
@@ -1,3 +1,17 @@
|
||||
3.32.0
|
||||
======
|
||||
* Fix sizing issues in on-screen-keyboard emoji panel [Carlos; !439]
|
||||
* Fix test linker failure on Debian/Ubuntu [Iain; !442]
|
||||
* Avoid assertion when sizing fallback app icons from CSS [Florian; #1027]
|
||||
* Fix mis-sized menu arrows after texture cache changes [Florian; !452]
|
||||
|
||||
Contributors:
|
||||
Carlos Garnacho, Iain Lane, Florian Müllner
|
||||
|
||||
Translators:
|
||||
Gábor Kelemen [hu], Victor Ibragimov [tg], Ryuta Fujii [ja], Piotr Drąg [af,
|
||||
tg], Mart Raudsepp [et]
|
||||
|
||||
3.31.92
|
||||
=======
|
||||
* Fix visual glitch in submenus [Alex; #987]
|
||||
|
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gnome/shell/theme">
|
||||
<file>automatic-updates-off-symbolic.svg</file>
|
||||
<file>automatic-updates-on-symbolic.svg</file>
|
||||
<file>automatic-updates-scheduled-symbolic.svg</file>
|
||||
<file>calendar-today.svg</file>
|
||||
<file>checkbox-focused.svg</file>
|
||||
<file>checkbox-off-focused.svg</file>
|
||||
|
1
data/theme/automatic-updates-off-symbolic.svg
Normal file
1
data/theme/automatic-updates-off-symbolic.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><title>EOS_symbolic-icons_v0.1auto-updates_OFF</title><path d="M11.03,10.074a.125.125,0,0,0-.086.213l1.347,1.35a5.733,5.733,0,0,1-4.238,1.9,5.6,5.6,0,0,1-2.282-.484l-1.11,1.11a7.024,7.024,0,0,0,3.392.875,7.3,7.3,0,0,0,5.3-2.339l1.357,1.36a.125.125,0,0,0,.213-.086L15,10Z" style="fill:#999"/><path d="M12.921,5.9a6.354,6.354,0,0,1,.326,1.863.248.248,0,0,0,.244.244h1a.261.261,0,0,0,.257-.265,7.543,7.543,0,0,0-.677-2.991Z" style="fill:#999"/><path d="M6.286,9.707a.994.994,0,0,0,.715.3H9a1,1,0,0,0,1-1v-2A.994.994,0,0,0,9.7,6.3l2.175-2.175,0,0L12.93,3.067l0,0,1.4-1.4a.25.25,0,0,0,0-.354L13.617.608a.25.25,0,0,0-.354,0L11.772,2.1A6.97,6.97,0,0,0,7.948.961,7.3,7.3,0,0,0,2.651,3.3L1.293,1.94a.125.125,0,0,0-.214.086L1,6l3.971-.074a.125.125,0,0,0,.086-.213L3.71,4.363a5.733,5.733,0,0,1,4.238-1.9,5.523,5.523,0,0,1,2.723.739L7.86,6.011H7a1,1,0,0,0-1,1V7.87L3.291,10.58a6,6,0,0,1-.537-2.346.248.248,0,0,0-.244-.245h-1a.261.261,0,0,0-.257.265A7.329,7.329,0,0,0,2.172,11.7L.608,13.263a.25.25,0,0,0,0,.354l.707.707a.25.25,0,0,0,.354,0l1.4-1.4,0,0,1.056-1.056,0,0Z" style="fill:#999"/></svg>
|
After Width: | Height: | Size: 1.1 KiB |
1
data/theme/automatic-updates-on-symbolic.svg
Normal file
1
data/theme/automatic-updates-on-symbolic.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><title>EOS_symbolic-icons_v0.1auto-updates_ON</title><rect x="6.001" y="6.011" width="4" height="4" rx="1" ry="1" style="fill:#999"/><path d="M5.057,5.713,3.71,4.362a5.733,5.733,0,0,1,4.238-1.9,5.173,5.173,0,0,1,5.3,5.305.248.248,0,0,0,.244.244h1a.261.261,0,0,0,.257-.265A6.684,6.684,0,0,0,7.948.961,7.3,7.3,0,0,0,2.65,3.3L1.293,1.94a.125.125,0,0,0-.213.086L1,6l3.971-.074A.125.125,0,0,0,5.057,5.713Z" style="fill:#999"/><path d="M11.03,10.074a.125.125,0,0,0-.086.213l1.347,1.35a5.733,5.733,0,0,1-4.238,1.9,5.173,5.173,0,0,1-5.3-5.305.248.248,0,0,0-.244-.245h-1a.261.261,0,0,0-.257.265,6.684,6.684,0,0,0,6.8,6.785,7.3,7.3,0,0,0,5.3-2.339l1.357,1.36a.125.125,0,0,0,.214-.086L15,10Z" style="fill:#999"/></svg>
|
After Width: | Height: | Size: 767 B |
1
data/theme/automatic-updates-scheduled-symbolic.svg
Normal file
1
data/theme/automatic-updates-scheduled-symbolic.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><title>EOS_symbolic-icons_v0.1update-scheduled_OUTLINE</title><path d="M7.99,15.054A6.7,6.7,0,0,1,1.06,8,6.7,6.7,0,0,1,7.99.954,6.71,6.71,0,0,1,14.948,8,6.71,6.71,0,0,1,7.99,15.054Zm0-12.6A5.2,5.2,0,0,0,2.56,8a5.2,5.2,0,0,0,5.43,5.55A5.215,5.215,0,0,0,13.448,8,5.216,5.216,0,0,0,7.99,2.454Z" style="fill:#999"/><path d="M9.209,10.443,7.2,8.437a.25.25,0,0,1-.073-.177l0-4.01A.25.25,0,0,1,7.379,4h1.25a.25.25,0,0,1,.25.25l0,3.283a.25.25,0,0,0,.073.177l1.5,1.494a.25.25,0,0,1,0,.354l-.883.884A.25.25,0,0,1,9.209,10.443Z" style="fill:#999"/></svg>
|
After Width: | Height: | Size: 603 B |
@@ -16,7 +16,7 @@ $link_visited_color: if($variant == 'light', darken($selected_bg_color, 20%), li
|
||||
$top_hilight: $borders_edge;
|
||||
|
||||
$warning_color: #f57900;
|
||||
$error_color: #cc0000;
|
||||
$error_color: #ff8080;
|
||||
$success_color: if($variant == 'light', #33d17a, darken(#33d17a, 10%));
|
||||
$destructive_color: if($variant == 'light', #e01b24, darken(#e01b24, 10%));
|
||||
|
||||
|
@@ -392,7 +392,7 @@ StScrollBar {
|
||||
|
||||
.prompt-dialog-error-label {
|
||||
font-size: 10pt;
|
||||
color: $error_color;
|
||||
color: $warning_color;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
@@ -1031,6 +1031,11 @@ StScrollBar {
|
||||
-st-icon-style: symbolic;
|
||||
}
|
||||
|
||||
.message-icon-bin > .fallback-window-icon {
|
||||
width: 1.09em;
|
||||
height: 1.09em;
|
||||
}
|
||||
|
||||
.message-secondary-bin {
|
||||
padding: 0 0.82em;;
|
||||
}
|
||||
@@ -1138,7 +1143,7 @@ StScrollBar {
|
||||
.ripple-box:rtl { border-radius: 0 0 0 52px; } // just a simple change to the border radius position
|
||||
|
||||
// not really top bar only
|
||||
.popup-menu-arrow { width: 16px; height: 16px; }
|
||||
.popup-menu-arrow { icon-size: 1.09em; }
|
||||
.popup-menu-icon { icon-size: 1.09em; }
|
||||
|
||||
//close buttons
|
||||
@@ -1448,13 +1453,13 @@ StScrollBar {
|
||||
height: 12px;
|
||||
background-color: transparent;
|
||||
border: 2px solid rgba(255, 255, 255, 0.4);
|
||||
border-radius:12px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
&:hover .page-indicator-icon { border-color: white; }
|
||||
&:active .page-indicator-icon { border: none; margin: 2px; background-color:#fff; }
|
||||
&:active .page-indicator-icon { border: none; margin: 2px; background-color: white; }
|
||||
&:checked .page-indicator-icon,
|
||||
&:checked:active { background-color: #fff;}
|
||||
&:checked:active .page-indicator-icon { background-color: white;}
|
||||
}
|
||||
|
||||
.no-frequent-applications-label { @extend %status_text; }
|
||||
|
@@ -9,6 +9,7 @@
|
||||
<file>gdm/realmd.js</file>
|
||||
<file>gdm/util.js</file>
|
||||
|
||||
<file>misc/updateManager.js</file>
|
||||
<file>misc/config.js</file>
|
||||
<file>misc/extensionUtils.js</file>
|
||||
<file>misc/fileUtils.js</file>
|
||||
@@ -116,9 +117,11 @@
|
||||
<file>ui/components/networkAgent.js</file>
|
||||
<file>ui/components/polkitAgent.js</file>
|
||||
<file>ui/components/telepathyClient.js</file>
|
||||
<file>ui/components/updates.js</file>
|
||||
<file>ui/components/keyring.js</file>
|
||||
|
||||
<file>ui/status/accessibility.js</file>
|
||||
<file>ui/status/automaticUpdates.js</file>
|
||||
<file>ui/status/brightness.js</file>
|
||||
<file>ui/status/location.js</file>
|
||||
<file>ui/status/keyboard.js</file>
|
||||
|
338
js/misc/updateManager.js
Normal file
338
js/misc/updateManager.js
Normal file
@@ -0,0 +1,338 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Copyright (C) 2019 Endless Mobile, Inc.
|
||||
//
|
||||
// This is a GNOME Shell component to wrap the interactions over
|
||||
// D-Bus with the Mogwai system daemon.
|
||||
//
|
||||
// Licensed under the GNU General Public License Version 2
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
const { Clutter, Gio, GLib,
|
||||
GObject, Gtk, NM, Shell, St } = imports.gi;
|
||||
|
||||
const NM_SETTING_AUTOMATIC_UPDATES_NOTIFICATION_TIME = "connection.automatic-updates-notification-time";
|
||||
const NM_SETTING_ALLOW_DOWNLOADS = 'connection.allow-downloads';
|
||||
const NM_SETTING_TARIFF_ENABLED = "connection.tariff-enabled";
|
||||
|
||||
const SchedulerInterface = '\
|
||||
<node> \
|
||||
<interface name="com.endlessm.DownloadManager1.Scheduler"> \
|
||||
<property name="ActiveEntryCount" type="u" access="read" /> \
|
||||
<property name="EntryCount" type="u" access="read" /> \
|
||||
</interface> \
|
||||
</node>';
|
||||
|
||||
const SchedulerProxy = Gio.DBusProxy.makeProxyWrapper(SchedulerInterface);
|
||||
|
||||
let _updateManager = null;
|
||||
|
||||
function getUpdateManager() {
|
||||
if (_updateManager == null)
|
||||
_updateManager = new UpdateManager();
|
||||
return _updateManager;
|
||||
}
|
||||
|
||||
var State = {
|
||||
UNKNOWN: 0,
|
||||
DISCONNECTED: 1,
|
||||
DISABLED: 2,
|
||||
IDLE: 3,
|
||||
SCHEDULED: 4,
|
||||
DOWNLOADING: 5
|
||||
};
|
||||
|
||||
function stateToIconName(state) {
|
||||
switch (state) {
|
||||
case State.UNKNOWN:
|
||||
case State.DISCONNECTED:
|
||||
return null;
|
||||
|
||||
case State.DISABLED:
|
||||
return 'resource:///org/gnome/shell/theme/automatic-updates-off-symbolic.svg';
|
||||
|
||||
case State.IDLE:
|
||||
case State.DOWNLOADING:
|
||||
return 'resource:///org/gnome/shell/theme/automatic-updates-on-symbolic.svg';
|
||||
|
||||
case State.SCHEDULED:
|
||||
return 'resource:///org/gnome/shell/theme/automatic-updates-scheduled-symbolic.svg';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var UpdateManager = GObject.registerClass ({
|
||||
Properties: {
|
||||
'last-notification-time': GObject.ParamSpec.int('last-notification-time',
|
||||
'last-notification-time',
|
||||
'last-notification-time',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
null),
|
||||
'icon': GObject.ParamSpec.object('icon', 'icon', 'icon',
|
||||
GObject.ParamFlags.READABLE,
|
||||
Gio.Icon.$gtype),
|
||||
'state': GObject.ParamSpec.uint('state', 'state', 'state',
|
||||
GObject.ParamFlags.READABLE,
|
||||
null),
|
||||
},
|
||||
}, class UpdateManager extends GObject.Object {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
this._activeConnection = null;
|
||||
this._settingChangedSignalId = 0;
|
||||
this._updateTimeoutId = 0;
|
||||
|
||||
this._state = State.UNKNOWN;
|
||||
|
||||
NM.Client.new_async(null, this._clientGot.bind(this));
|
||||
}
|
||||
|
||||
_clientGot(obj, result) {
|
||||
this._client = NM.Client.new_finish(result);
|
||||
|
||||
this._client.connect('notify::primary-connection', this._sync.bind(this));
|
||||
this._client.connect('notify::state', this._sync.bind(this));
|
||||
|
||||
// Start retrieving the Mogwai proxy
|
||||
this._proxy = new SchedulerProxy(Gio.DBus.system,
|
||||
'com.endlessm.MogwaiSchedule1',
|
||||
'/com/endlessm/DownloadManager1',
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
}
|
||||
this._proxy.connect('g-properties-changed',
|
||||
this._sync.bind(this));
|
||||
this._updateStatus();
|
||||
});
|
||||
|
||||
this._sync();
|
||||
}
|
||||
|
||||
_sync() {
|
||||
if (!this._client || !this._proxy)
|
||||
return;
|
||||
|
||||
if (this._updateTimeoutId > 0) {
|
||||
GLib.source_remove(this._updateTimeoutId);
|
||||
this._updateTimeoutId = 0;
|
||||
}
|
||||
|
||||
// Intermediate states (connecting or disconnecting) must not trigger
|
||||
// any kind of state change.
|
||||
if (this._client.state == NM.State.CONNECTING || this._client.state == NM.State.DISCONNECTING)
|
||||
return;
|
||||
|
||||
// Use a timeout to avoid instantly throwing the notification at
|
||||
// the user's face, and to avoid a series of unecessary updates
|
||||
// that happen when NetworkManager is still figuring out details.
|
||||
this._updateTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT,
|
||||
2,
|
||||
() => {
|
||||
this._updateStatus();
|
||||
this._updateTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._updateTimeoutId, '[update] updateStatus');
|
||||
}
|
||||
|
||||
_updateStatus() {
|
||||
// Update the current active connection. This will connect to the
|
||||
// NM.SettingUser signal to sync every time someone updates the
|
||||
// NM_SETTING_ALLOW_DOWNLOADS setting.
|
||||
this._updateActiveConnection();
|
||||
|
||||
let state = this._getState();
|
||||
if (state != this._state) {
|
||||
this._state = state;
|
||||
this.notify('state');
|
||||
|
||||
this._updateIcon();
|
||||
}
|
||||
}
|
||||
|
||||
_updateActiveConnection() {
|
||||
let currentActiveConnection = this._getActiveConnection();
|
||||
|
||||
if (this._activeConnection == currentActiveConnection)
|
||||
return;
|
||||
|
||||
// Disconnect from the previous active connection
|
||||
if (this._settingChangedSignalId > 0) {
|
||||
this._activeConnection.disconnect(this._settingChangedSignalId);
|
||||
this._settingChangedSignalId = 0;
|
||||
}
|
||||
|
||||
this._activeConnection = currentActiveConnection;
|
||||
|
||||
// Connect from the current active connection
|
||||
if (currentActiveConnection)
|
||||
this._settingChangedSignalId = currentActiveConnection.connect('changed', this._updateStatus.bind(this));
|
||||
}
|
||||
|
||||
_ensureUserSetting(connection) {
|
||||
let userSetting = connection.get_setting(NM.SettingUser.$gtype);
|
||||
if (!userSetting) {
|
||||
userSetting = new NM.SettingUser();
|
||||
connection.add_setting(userSetting);
|
||||
}
|
||||
return userSetting;
|
||||
}
|
||||
|
||||
_getState() {
|
||||
if (!this._activeConnection)
|
||||
return State.DISCONNECTED;
|
||||
|
||||
let userSetting = this._ensureUserSetting(this._activeConnection);
|
||||
|
||||
// We only return true when:
|
||||
// * Automatic Updates are on
|
||||
// * A schedule was set
|
||||
// * Something is being downloaded
|
||||
|
||||
let allowDownloadsValue = userSetting.get_data(NM_SETTING_ALLOW_DOWNLOADS);
|
||||
if (allowDownloadsValue) {
|
||||
let allowDownloads = (allowDownloadsValue === '1');
|
||||
|
||||
if (!allowDownloads)
|
||||
return State.DISABLED;
|
||||
} else {
|
||||
// Guess the default value from the metered state. Only return
|
||||
// if it's disabled - if it's not, we want to follow the regular
|
||||
// code paths and fetch the correct state
|
||||
let connectionSetting = this._activeConnection.get_setting_connection();
|
||||
|
||||
if (!connectionSetting)
|
||||
return State.DISABLED;
|
||||
|
||||
let metered = connectionSetting.get_metered();
|
||||
if (metered == NM.Metered.YES || metered == NM.Metered.GUESS_YES)
|
||||
return State.DISABLED;
|
||||
}
|
||||
|
||||
// Without the proxy, we can't really know the state
|
||||
if (!this._proxy)
|
||||
return State.UNKNOWN;
|
||||
|
||||
let scheduleSet = userSetting.get_data(NM_SETTING_TARIFF_ENABLED) === '1';
|
||||
if (!scheduleSet)
|
||||
return State.IDLE;
|
||||
|
||||
let downloading = this._proxy.ActiveEntryCount > 0;
|
||||
if (downloading)
|
||||
return State.DOWNLOADING;
|
||||
|
||||
// At this point we're not downloading anything, but something
|
||||
// might be queued
|
||||
let downloadsQueued = this._proxy.EntryCount > 0;
|
||||
if (downloadsQueued)
|
||||
return State.SCHEDULED;
|
||||
else
|
||||
return State.IDLE;
|
||||
}
|
||||
|
||||
_getActiveConnection() {
|
||||
let activeConnection = this._client.get_primary_connection();
|
||||
return activeConnection ? activeConnection.get_connection() : null;
|
||||
}
|
||||
|
||||
_updateIcon() {
|
||||
let state = this._state;
|
||||
let iconName = stateToIconName(state);
|
||||
|
||||
if (iconName) {
|
||||
let iconFile = Gio.File.new_for_uri(iconName);
|
||||
this._icon = new Gio.FileIcon({ file: iconFile });
|
||||
} else {
|
||||
this._icon = null;
|
||||
}
|
||||
|
||||
this.notify('icon');
|
||||
}
|
||||
|
||||
get state() {
|
||||
return this._state;
|
||||
}
|
||||
|
||||
get lastNotificationTime() {
|
||||
let connection = this._getActiveConnection();
|
||||
if (!connection)
|
||||
return -1;
|
||||
|
||||
let userSetting = connection.get_setting(NM.SettingUser.$gtype);
|
||||
if (!userSetting)
|
||||
return -1;
|
||||
|
||||
let time = userSetting.get_data(NM_SETTING_AUTOMATIC_UPDATES_NOTIFICATION_TIME);
|
||||
return time ? parseInt(time) : -1;
|
||||
}
|
||||
|
||||
set lastNotificationTime(time) {
|
||||
if (!this._activeConnection)
|
||||
return;
|
||||
|
||||
let userSetting = this._ensureUserSetting(this._activeConnection);
|
||||
userSetting.set_data(NM_SETTING_AUTOMATIC_UPDATES_NOTIFICATION_TIME,
|
||||
'%s'.format(time));
|
||||
|
||||
this._activeConnection.commit_changes(true, null);
|
||||
}
|
||||
|
||||
|
||||
get active() {
|
||||
return this._active;
|
||||
}
|
||||
|
||||
set active(_active) {
|
||||
if (this._active == _active)
|
||||
return;
|
||||
|
||||
this._active = _active;
|
||||
this.notify('active');
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return this._icon;
|
||||
}
|
||||
|
||||
toggleAutomaticUpdates() {
|
||||
if (!this._activeConnection)
|
||||
return;
|
||||
|
||||
let userSetting = this._ensureUserSetting(this._activeConnection);
|
||||
|
||||
let state = this._getState();
|
||||
let value;
|
||||
|
||||
if (state == State.IDLE ||
|
||||
state == State.SCHEDULED ||
|
||||
state == State.DOWNLOADING) {
|
||||
value = '0';
|
||||
} else {
|
||||
value = '1';
|
||||
}
|
||||
|
||||
userSetting.set_data(NM_SETTING_ALLOW_DOWNLOADS, value);
|
||||
|
||||
this._activeConnection.commit_changes_async(true, null, (con, res, data) => {
|
||||
this._activeConnection.commit_changes_finish(res);
|
||||
this._updateStatus();
|
||||
});
|
||||
}
|
||||
});
|
135
js/ui/components/updates.js
Normal file
135
js/ui/components/updates.js
Normal file
@@ -0,0 +1,135 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Copyright (C) 2018 Endless Mobile, Inc.
|
||||
//
|
||||
// This is a GNOME Shell component to wrap the interactions over
|
||||
// D-Bus with the Mogwai system daemon.
|
||||
//
|
||||
// Licensed under the GNU General Public License Version 2
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
const { Gio, GLib, Shell } = imports.gi;
|
||||
|
||||
const UpdateManager = imports.misc.updateManager;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
|
||||
var UpdateComponent = class {
|
||||
constructor() {
|
||||
this._notification = null;
|
||||
this._state = UpdateManager.State.UNKNOWN;
|
||||
|
||||
this._manager = UpdateManager.getUpdateManager();
|
||||
this._manager.connect('notify::state', this._updateState.bind(this));
|
||||
|
||||
this._updateState();
|
||||
}
|
||||
|
||||
enable() {
|
||||
}
|
||||
|
||||
disable() {
|
||||
}
|
||||
|
||||
_updateState() {
|
||||
let newState = this._manager.state;
|
||||
|
||||
if (this._state == newState)
|
||||
return;
|
||||
|
||||
this._updateNotification(newState);
|
||||
this._state = newState;
|
||||
}
|
||||
|
||||
_updateNotification(newState) {
|
||||
// Don't notify when starting up
|
||||
if (this._manager.state == UpdateManager.State.UNKNOWN)
|
||||
return;
|
||||
|
||||
let alreadySentNotification = this._manager.lastNotificationTime != -1;
|
||||
|
||||
let wasDisconnected = this._state == UpdateManager.State.DISCONNECTED;
|
||||
let wasActive = this._state >= UpdateManager.State.IDLE;
|
||||
let isActive = newState >= UpdateManager.State.IDLE;
|
||||
|
||||
// The criteria to notify about the Automatic Updates setting is:
|
||||
// 1. If the user was disconnected and connects to a new network; or
|
||||
// 2. If the user was connected and connects to a network with different status;
|
||||
if ((wasDisconnected && alreadySentNotification) || (!wasDisconnected && isActive == wasActive))
|
||||
return;
|
||||
|
||||
if (this._notification)
|
||||
this._notification.destroy();
|
||||
|
||||
if (newState == UpdateManager.State.DISCONNECTED)
|
||||
return;
|
||||
|
||||
let source = new MessageTray.SystemNotificationSource();
|
||||
Main.messageTray.add(source);
|
||||
|
||||
// Figure out the title, subtitle and icon
|
||||
let title, subtitle, iconFile;
|
||||
|
||||
if (isActive) {
|
||||
title = _("Automatic updates on");
|
||||
subtitle = _("Your connection has unlimited data so automatic updates have been turned on.");
|
||||
iconFile = UpdateManager.stateToIconName(UpdateManager.State.IDLE);
|
||||
} else {
|
||||
title = _("Automatic updates are turned off to save your data");
|
||||
subtitle = _("You will need to choose which updates to apply when on this connection.");
|
||||
iconFile = UpdateManager.stateToIconName(UpdateManager.State.DISABLED);
|
||||
}
|
||||
|
||||
let gicon = new Gio.FileIcon({ file: Gio.File.new_for_uri(iconFile) });
|
||||
|
||||
// Create the notification.
|
||||
// The first time we notify the user for a given connection,
|
||||
// we set the urgency to critical so that we make sure the
|
||||
// user understands how we may be changing their settings.
|
||||
// On subsequent notifications for the given connection,
|
||||
// for instance if the user regularly switches between
|
||||
// metered and unmetered connections, we set the urgency
|
||||
// to normal so as not to be too obtrusive.
|
||||
this._notification = new MessageTray.Notification(source, title, subtitle, { gicon: gicon });
|
||||
this._notification.setUrgency(alreadySentNotification ?
|
||||
MessageTray.Urgency.NORMAL : MessageTray.Urgency.CRITICAL);
|
||||
this._notification.setTransient(false);
|
||||
|
||||
this._notification.addAction(_("Close"), () => {
|
||||
this._notification.destroy();
|
||||
});
|
||||
|
||||
this._notification.addAction(_("Change Settings…"), () => {
|
||||
// FIXME: this requires the Automatic Updates panel in GNOME
|
||||
// Settings. Going with the Network panel for now…
|
||||
let app = Shell.AppSystem.get_default().lookup_app('gnome-network-panel.desktop');
|
||||
Main.overview.hide();
|
||||
app.activate();
|
||||
});
|
||||
|
||||
source.notify(this._notification);
|
||||
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
|
||||
// Now that we first detected this connection, mark it as such
|
||||
this._manager.lastNotificationTime = GLib.get_real_time();
|
||||
}
|
||||
};
|
||||
|
||||
var Component = UpdateComponent;
|
@@ -306,6 +306,9 @@ var _Draggable = class _Draggable {
|
||||
* for the draggable.
|
||||
*/
|
||||
startDrag(stageX, stageY, time, sequence, device) {
|
||||
if (currentDraggable)
|
||||
return;
|
||||
|
||||
if (device == undefined) {
|
||||
let event = Clutter.get_current_event();
|
||||
|
||||
@@ -447,7 +450,8 @@ var _Draggable = class _Draggable {
|
||||
let [stageX, stageY] = event.get_coords();
|
||||
|
||||
// See if the user has moved the mouse enough to trigger a drag
|
||||
let threshold = St.Settings.get().drag_threshold;
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let threshold = St.Settings.get().drag_threshold * scaleFactor;
|
||||
if (!currentDraggable &&
|
||||
(Math.abs(stageX - this._dragStartX) > threshold ||
|
||||
Math.abs(stageY - this._dragStartY) > threshold)) {
|
||||
|
@@ -73,12 +73,9 @@ class AspectContainer extends St.Widget {
|
||||
box.x1 += Math.floor(diff / 2);
|
||||
box.x2 -= Math.ceil(diff / 2);
|
||||
} else {
|
||||
/* Restrict vertically */
|
||||
/* Restrict vertically, align to bottom */
|
||||
let height = box.get_width() / this._ratio;
|
||||
let diff = box.get_height() - height;
|
||||
|
||||
box.y1 += Math.floor(diff / 2);
|
||||
box.y2 -= Math.floor(diff / 2);
|
||||
box.y1 = box.y2 - Math.floor(height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,7 +881,7 @@ var EmojiSelection = class EmojiSelection {
|
||||
this._pageIndicator.setReactive(false);
|
||||
|
||||
let bottomRow = this._createBottomRow();
|
||||
this.actor.add(bottomRow, { x_fill: true, y_fill: false });
|
||||
this.actor.add(bottomRow, { expand: true, x_fill: false, y_fill: false });
|
||||
|
||||
this._emojiPager.setCurrentPage(0);
|
||||
}
|
||||
@@ -973,7 +970,16 @@ var EmojiSelection = class EmojiSelection {
|
||||
row.appendKey(key.actor);
|
||||
row.layoutButtons();
|
||||
|
||||
return row;
|
||||
let actor = new AspectContainer({ layout_manager: new Clutter.BinLayout(),
|
||||
x_expand: true, y_expand: true });
|
||||
actor.add_child(row);
|
||||
/* Regular keyboard layouts are 11.5×4 grids, optimize for that
|
||||
* at the moment. Ideally this should be as wide as the current
|
||||
* keymap.
|
||||
*/
|
||||
actor.setRatio(11.5, 1);
|
||||
|
||||
return actor;
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(EmojiSelection.prototype);
|
||||
|
@@ -160,6 +160,19 @@ var Monitor = class Monitor {
|
||||
}
|
||||
};
|
||||
|
||||
const UiActor = GObject.registerClass(
|
||||
class UiActor extends St.Widget {
|
||||
vfunc_get_preferred_width (forHeight) {
|
||||
let width = global.stage.width;
|
||||
return [width, width];
|
||||
}
|
||||
|
||||
vfunc_get_preferred_height (forWidth) {
|
||||
let height = global.stage.height;
|
||||
return [height, height];
|
||||
}
|
||||
});
|
||||
|
||||
const defaultParams = {
|
||||
trackFullscreen: false,
|
||||
affectsStruts: false,
|
||||
@@ -200,12 +213,8 @@ var LayoutManager = GObject.registerClass({
|
||||
global.stage.no_clear_hint = true;
|
||||
|
||||
// Set up stage hierarchy to group all UI actors under one container.
|
||||
this.uiGroup = new St.Widget({ name: 'uiGroup' });
|
||||
this.uiGroup = new UiActor({ name: 'uiGroup' });
|
||||
this.uiGroup.set_flags(Clutter.ActorFlags.NO_LAYOUT);
|
||||
this.uiGroup.add_constraint(new Clutter.BindConstraint({
|
||||
source: global.stage,
|
||||
coordinate: Clutter.BindCoordinate.ALL,
|
||||
}));
|
||||
|
||||
global.stage.remove_actor(global.window_group);
|
||||
this.uiGroup.add_actor(global.window_group);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
const { Atspi, Clutter, Cogl, GDesktopEnums,
|
||||
const { Atspi, Clutter, GDesktopEnums,
|
||||
Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
|
||||
const Mainloop = imports.mainloop;
|
||||
const Signals = imports.signals;
|
||||
@@ -65,9 +65,7 @@ var MouseSpriteContent = GObject.registerClass({
|
||||
if (!this._texture)
|
||||
return;
|
||||
|
||||
let color = new Cogl.Color();
|
||||
color.init_from_4ub(0, 0, 0, 0);
|
||||
|
||||
let color = new Clutter.Color();
|
||||
let textureNode = new Clutter.TextureNode(this._texture,
|
||||
color,
|
||||
Clutter.ScalingFilter.NEAREST,
|
||||
|
@@ -774,10 +774,17 @@ class AggregateMenu extends PanelMenu.Button {
|
||||
this._nightLight = new imports.ui.status.nightLight.Indicator();
|
||||
this._thunderbolt = new imports.ui.status.thunderbolt.Indicator();
|
||||
|
||||
if (Main.sessionMode.components.includes('updates'))
|
||||
this._automaticUpdates = new imports.ui.status.automaticUpdates.Indicator();
|
||||
else
|
||||
this._automaticUpdates = null;
|
||||
|
||||
this._indicators.add_child(this._thunderbolt.indicators);
|
||||
this._indicators.add_child(this._screencast.indicators);
|
||||
this._indicators.add_child(this._location.indicators);
|
||||
this._indicators.add_child(this._nightLight.indicators);
|
||||
if (this._automaticUpdates)
|
||||
this._indicators.add_child(this._automaticUpdates.indicators);
|
||||
if (this._network) {
|
||||
this._indicators.add_child(this._network.indicators);
|
||||
}
|
||||
@@ -796,6 +803,8 @@ class AggregateMenu extends PanelMenu.Button {
|
||||
if (this._network) {
|
||||
this.menu.addMenuItem(this._network.menu);
|
||||
}
|
||||
if (this._automaticUpdates)
|
||||
this.menu.addMenuItem(this._automaticUpdates.menu);
|
||||
if (this._bluetooth) {
|
||||
this.menu.addMenuItem(this._bluetooth.menu);
|
||||
}
|
||||
|
@@ -92,9 +92,11 @@ const _modes = {
|
||||
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
|
||||
components: Config.HAVE_NETWORKMANAGER ?
|
||||
['networkAgent', 'polkitAgent', 'telepathyClient',
|
||||
'keyring', 'autorunManager', 'automountManager'] :
|
||||
'keyring', 'autorunManager', 'automountManager',
|
||||
'updates'] :
|
||||
['polkitAgent', 'telepathyClient',
|
||||
'keyring', 'autorunManager', 'automountManager'],
|
||||
'keyring', 'autorunManager', 'automountManager',
|
||||
'updates'],
|
||||
|
||||
panel: {
|
||||
left: ['activities', 'appMenu'],
|
||||
|
144
js/ui/status/automaticUpdates.js
Normal file
144
js/ui/status/automaticUpdates.js
Normal file
@@ -0,0 +1,144 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Copyright (C) 2018 Endless Mobile, Inc.
|
||||
//
|
||||
// This is a GNOME Shell component to wrap the interactions over
|
||||
// D-Bus with the Mogwai system daemon.
|
||||
//
|
||||
// Licensed under the GNU General Public License Version 2
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
const { Gio, GLib, Shell, St } = imports.gi;
|
||||
|
||||
const UpdateManager = imports.misc.updateManager;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const PanelMenu = imports.ui.panelMenu;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
|
||||
const NM_SETTING_AUTOMATIC_UPDATES_NOTIFICATION_TIME = "connection.automatic-updates-notification-time";
|
||||
const NM_SETTING_ALLOW_DOWNLOADS = 'connection.allow-downloads';
|
||||
const NM_SETTING_TARIFF_ENABLED = "connection.tariff-enabled";
|
||||
|
||||
const SchedulerInterface = '\
|
||||
<node> \
|
||||
<interface name="com.endlessm.DownloadManager1.Scheduler"> \
|
||||
<property name="ActiveEntryCount" type="u" access="read" /> \
|
||||
<property name="EntryCount" type="u" access="read" /> \
|
||||
</interface> \
|
||||
</node>';
|
||||
|
||||
const SchedulerProxy = Gio.DBusProxy.makeProxyWrapper(SchedulerInterface);
|
||||
|
||||
var Indicator = class extends PanelMenu.SystemIndicator {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this._indicator = this._addIndicator();
|
||||
this._indicator.visible = false;
|
||||
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem("", true);
|
||||
this._toggleItem = this._item.menu.addAction("", this._toggleAutomaticUpdates.bind(this));
|
||||
this._item.menu.addAction(_("Updates Queue"), () => {
|
||||
let params = new GLib.Variant('(sava{sv})', [ 'set-mode', [ new GLib.Variant('s', 'updates') ], {} ]);
|
||||
Gio.DBus.session.call('org.gnome.Software',
|
||||
'/org/gnome/Software',
|
||||
'org.gtk.Actions',
|
||||
'Activate',
|
||||
params,
|
||||
null,
|
||||
Gio.DBusCallFlags.NONE,
|
||||
5000,
|
||||
null,
|
||||
(conn, result) => {
|
||||
try {
|
||||
conn.call_finish(result);
|
||||
} catch (e) {
|
||||
logError(e, 'Failed to start gnome-software');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
this._item.menu.addSettingsAction(_("Set a Schedule"), 'gnome-updates-panel.desktop');
|
||||
this.menu.addMenuItem(this._item);
|
||||
|
||||
this._manager = UpdateManager.getUpdateManager();
|
||||
this._manager.connect('notify::state', this._updateState.bind(this));
|
||||
|
||||
this._updateState();
|
||||
}
|
||||
|
||||
_updateState() {
|
||||
this._updateStatus();
|
||||
}
|
||||
|
||||
_sessionUpdated() {
|
||||
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||
this.menu.setSensitive(sensitive);
|
||||
}
|
||||
|
||||
_updateStatus() {
|
||||
// Toggle item name
|
||||
this._updateItem();
|
||||
|
||||
// Icons
|
||||
let icon = this._getIcon()
|
||||
|
||||
this._item.icon.gicon = icon;
|
||||
this._indicator.gicon = icon;
|
||||
|
||||
// Only show the Automatic Updates icon at the bottom bar when it is
|
||||
// both enabled, and there are updates being downloaded or installed.
|
||||
this._updateVisibility();
|
||||
|
||||
// The status label
|
||||
this._item.label.text = _("Automatic Updates");
|
||||
}
|
||||
|
||||
_updateItem() {
|
||||
let state = this._manager.state;
|
||||
|
||||
if (state == UpdateManager.State.DISABLED)
|
||||
this._toggleItem.label.text = _("Turn On");
|
||||
else
|
||||
this._toggleItem.label.text = _("Turn Off");
|
||||
}
|
||||
|
||||
_toggleAutomaticUpdates() {
|
||||
this._manager.toggleAutomaticUpdates();
|
||||
}
|
||||
|
||||
_getIcon() {
|
||||
let state = this._manager.state;
|
||||
let iconName = UpdateManager.stateToIconName(state);
|
||||
|
||||
if (!iconName)
|
||||
return null;
|
||||
|
||||
let iconFile = Gio.File.new_for_uri(iconName);
|
||||
let gicon = new Gio.FileIcon({ file: iconFile });
|
||||
|
||||
return gicon;
|
||||
}
|
||||
|
||||
_updateVisibility() {
|
||||
let state = this._manager.state;
|
||||
|
||||
this._item.actor.visible = (state != UpdateManager.State.DISCONNECTED);
|
||||
this._indicator.visible = (state == UpdateManager.State.DOWNLOADING);
|
||||
}
|
||||
};
|
@@ -46,15 +46,14 @@ var Avatar = class {
|
||||
if (iconFile) {
|
||||
let file = Gio.File.new_for_path(iconFile);
|
||||
this.actor.child = null;
|
||||
this.actor.style = 'background-image: url("%s");'.format(iconFile);
|
||||
this.actor.style = `
|
||||
background-image: url("${iconFile}");
|
||||
background-size: ${this._iconSize}px`;
|
||||
} else {
|
||||
this.actor.style = null;
|
||||
this.actor.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
|
||||
icon_size: this._iconSize });
|
||||
}
|
||||
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
this.actor.set_size(this._iconSize * scaleFactor, this._iconSize * scaleFactor);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
project('gnome-shell', 'c',
|
||||
version: '3.31.92',
|
||||
version: '3.32.0',
|
||||
meson_version: '>= 0.47.0',
|
||||
license: 'GPLv2+'
|
||||
)
|
||||
@@ -23,7 +23,7 @@ gi_req = '>= 1.49.1'
|
||||
gjs_req = '>= 1.54.0'
|
||||
gtk_req = '>= 3.15.0'
|
||||
json_glib_req = '>= 0.13.2'
|
||||
mutter_req = '>= 3.31.92'
|
||||
mutter_req = '>= 3.32.0'
|
||||
polkit_req = '>= 0.100'
|
||||
schemas_req = '>= 3.27.90'
|
||||
startup_req = '>= 0.11'
|
||||
|
@@ -52,6 +52,7 @@ js/ui/search.js
|
||||
js/ui/shellEntry.js
|
||||
js/ui/shellMountOperation.js
|
||||
js/ui/status/accessibility.js
|
||||
js/ui/status/automaticUpdates.js
|
||||
js/ui/status/bluetooth.js
|
||||
js/ui/status/brightness.js
|
||||
js/ui/status/keyboard.js
|
||||
|
2
po/af.po
2
po/af.po
@@ -330,7 +330,7 @@ msgstr "Netwerkaanmelding"
|
||||
#. Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
||||
#: data/org.gnome.Shell.PortalHelper.desktop.in.in:9
|
||||
msgid "network-workgroup"
|
||||
msgstr "netwerk-werkgroep"
|
||||
msgstr "network-workgroup"
|
||||
|
||||
#: js/extensionPrefs/main.js:120
|
||||
#, javascript-format
|
||||
|
@@ -184,7 +184,7 @@ window_backed_app_get_icon (ShellApp *app,
|
||||
int size)
|
||||
{
|
||||
MetaWindow *window = NULL;
|
||||
ClutterActor *actor;
|
||||
StWidget *widget;
|
||||
gint scale;
|
||||
ShellGlobal *global;
|
||||
StThemeContext *context;
|
||||
@@ -204,16 +204,20 @@ window_backed_app_get_icon (ShellApp *app,
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
|
||||
actor = clutter_actor_new ();
|
||||
g_object_set (actor, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
|
||||
return actor;
|
||||
}
|
||||
|
||||
actor = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (),
|
||||
G_OBJECT (window),
|
||||
"icon",
|
||||
size);
|
||||
return actor;
|
||||
widget = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (),
|
||||
G_OBJECT (window),
|
||||
"icon",
|
||||
size);
|
||||
st_widget_add_style_class_name (widget, "fallback-app-icon");
|
||||
|
||||
return CLUTTER_ACTOR (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -126,6 +126,7 @@ libst = shared_library('st-1.0',
|
||||
sources: st_gir_sources + st_non_gir_sources,
|
||||
c_args: st_cflags,
|
||||
dependencies: [clutter_dep, gtk_dep, croco_dep, x11_dep, m_dep],
|
||||
build_rpath: mutter_typelibdir,
|
||||
install_rpath: mutter_typelibdir,
|
||||
install_dir: pkglibdir,
|
||||
install: true
|
||||
|
@@ -502,7 +502,7 @@ pixbuf_to_st_content_image (GdkPixbuf *pixbuf,
|
||||
width *= paint_scale;
|
||||
|
||||
if (height < 0)
|
||||
height = ceilf (gdk_pixbuf_get_width (pixbuf) / resource_scale);
|
||||
height = ceilf (gdk_pixbuf_get_height (pixbuf) / resource_scale);
|
||||
else
|
||||
height *= paint_scale;
|
||||
|
||||
@@ -700,10 +700,14 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
|
||||
{
|
||||
g_autoptr(ClutterContent) image = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
int size = bind->size;
|
||||
|
||||
if (size < 0)
|
||||
clutter_actor_get_preferred_width (bind->actor, -1, NULL, (float *)&size);
|
||||
|
||||
image = clutter_actor_get_content (bind->actor);
|
||||
if (!image || !CLUTTER_IS_IMAGE (image))
|
||||
image = st_image_content_new_with_preferred_size (bind->size, bind->size);
|
||||
image = st_image_content_new_with_preferred_size (size, size);
|
||||
else
|
||||
g_object_ref (image);
|
||||
|
||||
@@ -767,27 +771,30 @@ st_texture_cache_free_bind (gpointer data)
|
||||
* If the source object is destroyed, the texture will continue to show the last
|
||||
* value of the property.
|
||||
*
|
||||
* Return value: (transfer none): A new #ClutterActor
|
||||
* Return value: (transfer none): A new #StWidget
|
||||
*/
|
||||
ClutterActor *
|
||||
StWidget *
|
||||
st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
||||
GObject *object,
|
||||
const char *property_name,
|
||||
gint size)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
StWidget *widget;
|
||||
gchar *notify_key;
|
||||
StTextureCachePropertyBind *bind;
|
||||
|
||||
actor = create_invisible_actor ();
|
||||
clutter_actor_set_size (actor, size, size);
|
||||
widget = g_object_new (ST_TYPE_WIDGET,
|
||||
"opacity", 0,
|
||||
"width", (float)size,
|
||||
"height", (float)size,
|
||||
NULL);
|
||||
|
||||
bind = g_slice_new0 (StTextureCachePropertyBind);
|
||||
bind->cache = cache;
|
||||
bind->actor = actor;
|
||||
bind->actor = CLUTTER_ACTOR (widget);
|
||||
bind->size = size;
|
||||
bind->source = object;
|
||||
g_object_weak_ref (G_OBJECT (actor), st_texture_cache_bind_weak_notify, bind);
|
||||
g_object_weak_ref (G_OBJECT (widget), st_texture_cache_bind_weak_notify, bind);
|
||||
bind->weakref_active = TRUE;
|
||||
|
||||
st_texture_cache_reset_texture (bind, property_name);
|
||||
@@ -797,7 +804,7 @@ st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
||||
bind, (GClosureNotify)st_texture_cache_free_bind, 0);
|
||||
g_free (notify_key);
|
||||
|
||||
return actor;
|
||||
return widget;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <st/st-types.h>
|
||||
#include <st/st-theme-node.h>
|
||||
#include <st/st-widget.h>
|
||||
|
||||
#define ST_TYPE_TEXTURE_CACHE (st_texture_cache_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (StTextureCache, st_texture_cache,
|
||||
@@ -63,10 +64,10 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
|
||||
GFunc load_callback,
|
||||
gpointer user_data);
|
||||
|
||||
ClutterActor *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
||||
GObject *object,
|
||||
const char *property_name,
|
||||
gint size);
|
||||
StWidget *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
||||
GObject *object,
|
||||
const char *property_name,
|
||||
gint size);
|
||||
|
||||
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
|
||||
StThemeNode *theme_node,
|
||||
|
@@ -119,6 +119,10 @@ st_theme_node_transition_new (StThemeNode *from_node,
|
||||
return transition;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_theme_node_transition_get_new_paint_state: (skip)
|
||||
*
|
||||
*/
|
||||
StThemeNodePaintState *
|
||||
st_theme_node_transition_get_new_paint_state (StThemeNodeTransition *transition)
|
||||
{
|
||||
|
@@ -579,7 +579,11 @@ get_root_theme_node (ClutterStage *stage)
|
||||
StThemeNode *
|
||||
st_widget_get_theme_node (StWidget *widget)
|
||||
{
|
||||
StWidgetPrivate *priv = st_widget_get_instance_private (widget);
|
||||
StWidgetPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (ST_IS_WIDGET (widget), NULL);
|
||||
|
||||
priv = st_widget_get_instance_private (widget);
|
||||
|
||||
if (priv->theme_node == NULL)
|
||||
{
|
||||
|
Reference in New Issue
Block a user