Compare commits
132 Commits
wip/folder
...
wip/overvi
Author | SHA1 | Date | |
---|---|---|---|
1afb04d1e4 | |||
51e63233ce | |||
a7d7f94892 | |||
427f516d45 | |||
cbb88ffdbb | |||
71670bad3b | |||
a2e4153fa0 | |||
2fba8e29e0 | |||
de1bb4e203 | |||
b4680a5c25 | |||
d44f40d105 | |||
8d5771e302 | |||
fb31f99aed | |||
b97f3a9ecf | |||
ac22172a6e | |||
57367380f5 | |||
7101cc3170 | |||
7051411be7 | |||
bb8397b9b1 | |||
bb8fa61cb4 | |||
10147ee331 | |||
3779ac2c8a | |||
bdad4db9ec | |||
36c69124f7 | |||
7c8c811134 | |||
ccfc9f3ab0 | |||
d163b92e0b | |||
887a21afb9 | |||
634adc9f71 | |||
974f01cef7 | |||
ef9ade3548 | |||
24fdb73b44 | |||
ba06a87ba8 | |||
e6be483755 | |||
a36bfced47 | |||
4faf421d5a | |||
a739455414 | |||
73f6e75d8d | |||
17e7f8057a | |||
b62c157680 | |||
816f5162f9 | |||
9d8f8277aa | |||
cca14053a4 | |||
427790f005 | |||
17845bf71e | |||
452f5ab3ba | |||
335744e78a | |||
c9e24439b2 | |||
61c697b6db | |||
3227d4f3ed | |||
7e27afb645 | |||
9ba4790b4d | |||
3a26f7f4d5 | |||
8b99617513 | |||
587655f063 | |||
7e9ecf4eb2 | |||
5413010c60 | |||
7d13cf1587 | |||
24cd13935a | |||
1ae7dbec67 | |||
2b0a2ab3bc | |||
4ed0f3e5f0 | |||
9cacc703dd | |||
9ae70c6519 | |||
02b38fed49 | |||
b2a65f809f | |||
2931869522 | |||
11d8640ba6 | |||
65ff947b5e | |||
2dd7db4808 | |||
1d7354696e | |||
cbceac4c8a | |||
297877fbe2 | |||
0d92451c49 | |||
c8a58dcb69 | |||
a4dea25d76 | |||
bfb0235fc6 | |||
6dcc3d637f | |||
9bb4d17e31 | |||
9df09db5fe | |||
d8e28ec274 | |||
d3905734c1 | |||
8fe7f923ec | |||
933f38390b | |||
a4e019442f | |||
d1c4e60636 | |||
765d0228c0 | |||
2d2020a20d | |||
03ab282f67 | |||
7f94cb1cad | |||
a2a303bd72 | |||
d34bf9a14d | |||
68faba6bde | |||
5c5b9cfd96 | |||
9d683f4767 | |||
f2912bad95 | |||
c8adfe0131 | |||
8b7e637e74 | |||
43cffd7c4a | |||
f3dad3765e | |||
70c25141fc | |||
b1b81a2672 | |||
46197bf262 | |||
58ec409e7f | |||
c2d68599de | |||
65f00f3af2 | |||
6544326ffd | |||
a23c206ccb | |||
1b152e6bd0 | |||
d9624d9882 | |||
178b8471cc | |||
719d2092a7 | |||
2f3a4675da | |||
9513be664b | |||
64d8b7853a | |||
4174e57c13 | |||
88b395599a | |||
b6d682c92c | |||
3b02894341 | |||
f3feb13dfe | |||
114d8d0aba | |||
503a843bb3 | |||
c4d91aff40 | |||
2ffe5faf6e | |||
5d2a03aa82 | |||
f4c83d1221 | |||
100e91714b | |||
dafb7b5259 | |||
92906e217c | |||
5c7b721879 | |||
c27dcb0414 | |||
7fcae1e974 |
41
COPYING
41
COPYING
@ -1,12 +1,12 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
@ -225,7 +225,7 @@ impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
58
NEWS
58
NEWS
@ -1,3 +1,61 @@
|
||||
3.11.4
|
||||
======
|
||||
* Fix removal of workspacaes that are not at the end [Giovanni; #721417]
|
||||
* Allow session mode to be specified in the environment [Ray; #720894]
|
||||
* Special-case launching of terminals [Debarshi; #695010]
|
||||
* Always show arrow if app switcher is scrollable [Jonh; #711467]
|
||||
* Implement new app folders system [Jasper; #722117]
|
||||
* Remove arrow from background menu [Tarun; #699608]
|
||||
* Misc bug fixes and cleanups [Giovanni, Andika, Florian, Ray; #721039,
|
||||
#721439, #721507, #721629, #721868, #722210]
|
||||
|
||||
Contributors:
|
||||
Giovanni Campagna, Piotr Drąg, Tarun Kumar Joshi, Florian Müllner,
|
||||
Debarshi Ray, Jasper St. Pierre, Ray Strode, Andika Triwidada, Jonh Wendell
|
||||
|
||||
Translations:
|
||||
Dušan Kazik [sk], Tong Hui [zh_CN], Benjamin Steinwender [de],
|
||||
Matej Urbančič [sl], Jorge Pérez Pérez [an], Kjartan Maraas [nb],
|
||||
Milo Casagrande [it], Rafael Ferreira [pt_BR], Marek Černocký [cs],
|
||||
Daniel Mustieles [es], Adorilson Bezerra [pt_BR], Christian Kirbach [de],
|
||||
Aurimas Černius [lt], Andika Triwidada [id], Baurzhan Muftakhidinov [kk],
|
||||
Victor Ibragimov [tg], Yosef Or Boczko [he], Dimitris Spingos [el],
|
||||
Fran Diéguez [gl]
|
||||
|
||||
3.11.3
|
||||
======
|
||||
* Fix fade effect of desktop icons [Florian; #707671]
|
||||
* Fix issues with background management code [Jasper; #709313]
|
||||
* Use new Glib facilities for application search [Jasper; #711631]
|
||||
* Add focus indication to session menu button [Sebastien; #710539]
|
||||
* Fix hover tracking for StEntries [Jasper; #706749]
|
||||
* Fix reentrancy issue in message tray [Jasper; #711694]
|
||||
* Tone down zoom animation on login/unlock [Jasper; #712362]
|
||||
* Allow specifying monitor for OSD [Carlos; #712664]
|
||||
* Fix resetting prompt on user switch [Ray; #710456]
|
||||
* Stop using gnome-bluetooth-applet [Bastien; #719341]
|
||||
* Add support for EAP-FAST password requests [Dan; #719813]
|
||||
* Fix entry focus of chat notifications [Jasper; #709853]
|
||||
* Make window previews keyboard navigatable [Jasper; #644306]
|
||||
* Fix app switcher order with dialog windows [Florian; #719824]
|
||||
* Allow remote search providers without icons [Debarshi; #719965]
|
||||
* Fix various alignment issues in RTL locales [Yosef; #712638, #712596,
|
||||
#712594, #712600, #712579]
|
||||
* Misc. bug fixes and cleanups [Jasper, Florian, Giovanni, Dan; #712727,
|
||||
#712753, #719378, #719730, #719803, #710115, #720017, #719815, #719567,
|
||||
#720298]
|
||||
|
||||
Contributors:
|
||||
Giovanni Campagna, Carlos Garnacho, Sebastien Lafargue, Tim Lunn,
|
||||
Florian Müllner, Bastien Nocera, Yosef Or Boczko, Debarshi Ray,
|
||||
Jasper St. Pierre, Ray Strode, Dan Williams
|
||||
|
||||
Translations:
|
||||
Kjartan Maraas [nb], Reinout van Schouwen [nl], Rafael Ferreira [pt_BR],
|
||||
Mattias Põldaru [et], Emin Tufan Çetin [tr], Jiri Grönroos [fi],
|
||||
Khaled Hosny [ar], Fran Diéguez [gl], Victor Ibragimov [tg],
|
||||
Daniel Mustieles [es]
|
||||
|
||||
3.11.2
|
||||
======
|
||||
* Cache search result display actors [Jasper; #704912]
|
||||
|
@ -13,9 +13,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
|
@ -1,5 +1,5 @@
|
||||
AC_PREREQ(2.63)
|
||||
AC_INIT([gnome-shell],[3.11.2],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell],[gnome-shell])
|
||||
AC_INIT([gnome-shell],[3.11.4],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell],[gnome-shell])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([src/shell-global.c])
|
||||
@ -73,7 +73,7 @@ AS_IF([test x$enable_systemd != xno], [
|
||||
|
||||
AC_MSG_RESULT($enable_systemd)
|
||||
|
||||
CLUTTER_MIN_VERSION=1.13.4
|
||||
CLUTTER_MIN_VERSION=1.15.90
|
||||
GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
|
||||
GJS_MIN_VERSION=1.39.0
|
||||
MUTTER_MIN_VERSION=3.11.1
|
||||
|
@ -13,12 +13,12 @@
|
||||
</key>
|
||||
<key name="enabled-extensions" type="as">
|
||||
<default>[]</default>
|
||||
<_summary>Uuids of extensions to enable</_summary>
|
||||
<_summary>UUIDs of extensions to enable</_summary>
|
||||
<_description>
|
||||
GNOME Shell extensions have a uuid property; this key lists extensions
|
||||
GNOME Shell extensions have a UUID property; this key lists extensions
|
||||
which should be loaded. Any extension that wants to be loaded needs
|
||||
to be in this list. You can also manipulate this list with the
|
||||
EnableExtension and DisableExtension DBus methods on org.gnome.Shell.
|
||||
EnableExtension and DisableExtension D-Bus methods on org.gnome.Shell.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="favorite-apps" type="as">
|
||||
@ -29,14 +29,6 @@
|
||||
will be displayed in the favorites area.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="app-folder-categories" type="as">
|
||||
<default>[ 'Utilities', 'Sundry' ]</default>
|
||||
<_summary>List of categories that should be displayed as folders</_summary>
|
||||
<_description>
|
||||
Each category name in this list will be represented as folder in the
|
||||
application view, rather than being displayed inline in the main view.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="app-picker-view" type="u">
|
||||
<default>0</default>
|
||||
<summary>App Picker View</summary>
|
||||
@ -54,10 +46,10 @@
|
||||
</key>
|
||||
<key name="always-show-log-out" type="b">
|
||||
<default>false</default>
|
||||
<_summary>Always show the 'Log out' menuitem in the user menu.</_summary>
|
||||
<_summary>Always show the 'Log out' menu item in the user menu.</_summary>
|
||||
<_description>
|
||||
This key overrides the automatic hiding of the 'Log out'
|
||||
menuitem in single-user, single-session situations.
|
||||
menu item in single-user, single-session situations.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="remember-mount-password" type="b">
|
||||
@ -124,6 +116,11 @@
|
||||
Keybinding to focus the active notification.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="pause-resume-tweens" type="as">
|
||||
<default>[]</default>
|
||||
<summary>Keybinding that pauses and resumes all running tweens, for debugging purposes</summary>
|
||||
<description></description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnome.shell.keyboard" path="/org/gnome/shell/keyboard/"
|
||||
|
@ -2512,7 +2512,7 @@ StScrollBar StButton#vhandle:active {
|
||||
box-shadow: 0px 4px 8px rgba(0,0,0,0.9);
|
||||
}
|
||||
|
||||
#lockDialogGroup {
|
||||
#systemGroup {
|
||||
background: #2e3436 url(noise-texture.png);
|
||||
background-repeat: repeat;
|
||||
}
|
||||
@ -2624,4 +2624,5 @@ StScrollBar StButton#vhandle:active {
|
||||
|
||||
.background-menu {
|
||||
-boxpointer-gap: 4px;
|
||||
-arrow-rise: 0px;
|
||||
}
|
||||
|
@ -13,9 +13,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const Lang = imports.lang;
|
||||
|
@ -13,9 +13,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const AccountsService = imports.gi.AccountsService;
|
||||
@ -276,7 +274,7 @@ const SessionMenuButton = new Lang.Class({
|
||||
this.actor = new St.Bin({ child: this._button });
|
||||
|
||||
this._menu = new PopupMenu.PopupMenu(this._button, 0, St.Side.TOP);
|
||||
Main.uiGroup.add_actor(this._menu.actor);
|
||||
Main.layoutManager.menuGroup.add_actor(this._menu.actor);
|
||||
this._menu.actor.hide();
|
||||
|
||||
this._menu.connect('open-state-changed',
|
||||
@ -456,18 +454,6 @@ const LoginDialog = new Lang.Class({
|
||||
this.actor.add_child(this._logoBin);
|
||||
this._updateLogo();
|
||||
|
||||
if (!this._userManager.is_loaded)
|
||||
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
|
||||
Lang.bind(this, function() {
|
||||
if (this._userManager.is_loaded) {
|
||||
this._loadUserList();
|
||||
this._userManager.disconnect(this._userManagerLoadedId);
|
||||
this._userManagerLoadedId = 0;
|
||||
}
|
||||
}));
|
||||
else
|
||||
this._loadUserList();
|
||||
|
||||
this._userList.connect('activate',
|
||||
Lang.bind(this, function(userList, item) {
|
||||
this._onUserListActivated(item);
|
||||
@ -483,6 +469,18 @@ const LoginDialog = new Lang.Class({
|
||||
this._sessionMenuButton.actor.show();
|
||||
this._authPrompt.addActorToDefaultButtonWell(this._sessionMenuButton.actor);
|
||||
|
||||
if (!this._userManager.is_loaded)
|
||||
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
|
||||
Lang.bind(this, function() {
|
||||
if (this._userManager.is_loaded) {
|
||||
this._loadUserList();
|
||||
this._userManager.disconnect(this._userManagerLoadedId);
|
||||
this._userManagerLoadedId = 0;
|
||||
}
|
||||
}));
|
||||
else
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
|
||||
|
||||
},
|
||||
|
||||
_updateDisableUserList: function() {
|
||||
|
@ -15,7 +15,6 @@
|
||||
<file>misc/extensionUtils.js</file>
|
||||
<file>misc/fileUtils.js</file>
|
||||
<file>misc/gnomeSession.js</file>
|
||||
<file>misc/hash.js</file>
|
||||
<file>misc/history.js</file>
|
||||
<file>misc/jsParse.js</file>
|
||||
<file>misc/loginManager.js</file>
|
||||
@ -102,6 +101,7 @@
|
||||
|
||||
<file>ui/status/accessibility.js</file>
|
||||
<file>ui/status/brightness.js</file>
|
||||
<file>ui/status/location.js</file>
|
||||
<file>ui/status/keyboard.js</file>
|
||||
<file>ui/status/network.js</file>
|
||||
<file>ui/status/power.js</file>
|
||||
|
@ -5,26 +5,6 @@ const GLib = imports.gi.GLib;
|
||||
const Lang = imports.lang;
|
||||
const Params = imports.misc.params;
|
||||
|
||||
function listDirAsync(file, callback) {
|
||||
let allFiles = [];
|
||||
file.enumerate_children_async('standard::name,standard::type',
|
||||
Gio.FileQueryInfoFlags.NONE,
|
||||
GLib.PRIORITY_LOW, null, function (obj, res) {
|
||||
let enumerator = obj.enumerate_children_finish(res);
|
||||
function onNextFileComplete(obj, res) {
|
||||
let files = obj.next_files_finish(res);
|
||||
if (files.length) {
|
||||
allFiles = allFiles.concat(files);
|
||||
enumerator.next_files_async(100, GLib.PRIORITY_LOW, null, onNextFileComplete);
|
||||
} else {
|
||||
enumerator.close(null);
|
||||
callback(allFiles);
|
||||
}
|
||||
}
|
||||
enumerator.next_files_async(100, GLib.PRIORITY_LOW, null, onNextFileComplete);
|
||||
});
|
||||
}
|
||||
|
||||
function collectFromDatadirs(subdir, includeUserDir, processFile) {
|
||||
let dataDirs = GLib.get_system_data_dirs();
|
||||
if (includeUserDir)
|
||||
|
144
js/misc/hash.js
144
js/misc/hash.js
@ -1,144 +0,0 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
const Lang = imports.lang;
|
||||
const System = imports.system;
|
||||
|
||||
const Params = imports.misc.params;
|
||||
|
||||
// This is an implementation of EcmaScript SameValue algorithm,
|
||||
// which returns true if two values are not observably distinguishable.
|
||||
// It was taken from http://wiki.ecmascript.org/doku.php?id=harmony:egal
|
||||
//
|
||||
// In the future, we may want to use the 'is' operator instead.
|
||||
function _sameValue(x, y) {
|
||||
if (x === y) {
|
||||
// 0 === -0, but they are not identical
|
||||
return x !== 0 || 1 / x === 1 / y;
|
||||
}
|
||||
|
||||
// NaN !== NaN, but they are identical.
|
||||
// NaNs are the only non-reflexive value, i.e., if x !== x,
|
||||
// then x is a NaN.
|
||||
// isNaN is broken: it converts its argument to number, so
|
||||
// isNaN("foo") => true
|
||||
return x !== x && y !== y;
|
||||
}
|
||||
|
||||
const _hashers = {
|
||||
object: function(o) { return o ? System.addressOf(o) : 'null'; },
|
||||
function: function(f) { return System.addressOf(f); },
|
||||
string: function(s) { return s; },
|
||||
number: function(n) { return String(n); },
|
||||
undefined: function() { return 'undefined'; },
|
||||
};
|
||||
|
||||
/* Map is meant to be similar in usage to ES6 Map, which is
|
||||
described at http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets,
|
||||
without requiring more than ES5 + Gjs extensions.
|
||||
|
||||
Known differences from other implementations:
|
||||
Polyfills around the web usually implement HashMaps for
|
||||
primitive values and reversed WeakMaps for object keys,
|
||||
but we want real maps with real O(1) semantics in all cases,
|
||||
and the easiest way is to have different hashers for different
|
||||
types.
|
||||
|
||||
Known differences from the ES6 specification:
|
||||
- Map is a Lang.Class, not a ES6 class, so inheritance,
|
||||
prototype, sealing, etc. work differently.
|
||||
- items(), keys() and values() don't return iterators,
|
||||
they return actual arrays, so they incur a full copy everytime
|
||||
they're called, and they don't see changes if you mutate
|
||||
the table while iterating
|
||||
(admittedly, the ES6 spec is a bit unclear on this, and
|
||||
the reference code would just blow up)
|
||||
*/
|
||||
const Map = new Lang.Class({
|
||||
Name: 'Map',
|
||||
|
||||
_init: function(iterable) {
|
||||
this._pool = { };
|
||||
this._size = 0;
|
||||
|
||||
if (iterable) {
|
||||
for (let i = 0; i < iterable.length; i++) {
|
||||
let [key, value] = iterable[i];
|
||||
this.set(key, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_hashKey: function(key) {
|
||||
let type = typeof(key);
|
||||
return type + ':' + _hashers[type](key);
|
||||
},
|
||||
|
||||
_internalGet: function(key) {
|
||||
let hash = this._hashKey(key);
|
||||
let node = this._pool[hash];
|
||||
|
||||
if (node && _sameValue(node.key, key))
|
||||
return [true, node.value];
|
||||
else
|
||||
return [false, null];
|
||||
},
|
||||
|
||||
get: function(key) {
|
||||
return this._internalGet(key)[1];
|
||||
},
|
||||
|
||||
has: function(key) {
|
||||
return this._internalGet(key)[0];
|
||||
},
|
||||
|
||||
set: function(key, value) {
|
||||
let hash = this._hashKey(key);
|
||||
let node = this._pool[hash];
|
||||
|
||||
if (node) {
|
||||
node.key = key;
|
||||
node.value = value;
|
||||
} else {
|
||||
this._pool[hash] = { key: key, value: value };
|
||||
this._size++;
|
||||
}
|
||||
},
|
||||
|
||||
delete: function(key) {
|
||||
let hash = this._hashKey(key);
|
||||
let node = this._pool[hash];
|
||||
|
||||
if (node && _sameValue(node.key, key)) {
|
||||
delete this._pool[hash];
|
||||
this._size--;
|
||||
return [node.key, node.value];
|
||||
} else {
|
||||
return [null, null];
|
||||
}
|
||||
},
|
||||
|
||||
keys: function() {
|
||||
let pool = this._pool;
|
||||
return Object.getOwnPropertyNames(pool).map(function(hash) {
|
||||
return pool[hash].key;
|
||||
});
|
||||
},
|
||||
|
||||
values: function() {
|
||||
let pool = this._pool;
|
||||
return Object.getOwnPropertyNames(pool).map(function(hash) {
|
||||
return pool[hash].value;
|
||||
});
|
||||
},
|
||||
|
||||
items: function() {
|
||||
let pool = this._pool;
|
||||
return Object.getOwnPropertyNames(pool).map(function(hash) {
|
||||
return [pool[hash].key, pool[hash].value];
|
||||
});
|
||||
},
|
||||
|
||||
size: function() {
|
||||
return this._size;
|
||||
},
|
||||
});
|
@ -89,7 +89,7 @@ function spawnApp(argv) {
|
||||
let app = Gio.AppInfo.create_from_commandline(argv.join(' '), null,
|
||||
Gio.AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION);
|
||||
|
||||
let context = global.create_app_launch_context();
|
||||
let context = global.create_app_launch_context(0, -1);
|
||||
app.launch([], context);
|
||||
} catch(err) {
|
||||
_handleSpawnError(argv[0], err);
|
||||
@ -153,7 +153,7 @@ function trySpawnCommandLine(command_line) {
|
||||
}
|
||||
|
||||
function _handleSpawnError(command, err) {
|
||||
let title = _("Execution of '%s' failed:").format(command);
|
||||
let title = _("Execution of “%s” failed:").format(command);
|
||||
Main.notifyError(title, err.message);
|
||||
}
|
||||
|
||||
|
@ -460,9 +460,10 @@ const AppSwitcher = new Lang.Class({
|
||||
appIcon.cachedWindows = allWindows.filter(function(w) {
|
||||
return windowTracker.get_window_app (w) == appIcon.app;
|
||||
});
|
||||
if (workspace == null || appIcon.cachedWindows.length > 0) {
|
||||
if (appIcon.cachedWindows.length > 0)
|
||||
this._addIcon(appIcon);
|
||||
}
|
||||
else if (workspace == null)
|
||||
throw new Error('%s appears to be running, but doesn\'t have any windows'.format(appIcon.app.get_name()));
|
||||
}
|
||||
|
||||
this._curApp = -1;
|
||||
|
@ -46,6 +46,46 @@ const INDICATORS_ANIMATION_MAX_TIME = 0.75;
|
||||
const PAGE_SWITCH_TRESHOLD = 0.2;
|
||||
const PAGE_SWITCH_TIME = 0.3;
|
||||
|
||||
function _getCategories(info) {
|
||||
let categoriesStr = info.get_categories();
|
||||
if (!categoriesStr)
|
||||
return [];
|
||||
return categoriesStr.split(';');
|
||||
}
|
||||
|
||||
function _isTerminal(app) {
|
||||
let info = app.get_app_info();
|
||||
if (!info)
|
||||
return false;
|
||||
let categories = _getCategories(info);
|
||||
return categories.indexOf('TerminalEmulator') > -1;
|
||||
}
|
||||
|
||||
function _listsIntersect(a, b) {
|
||||
for (let itemA of a)
|
||||
if (b.indexOf(itemA) >= 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function _getFolderName(folder) {
|
||||
let name = folder.get_string('name');
|
||||
|
||||
if (folder.get_boolean('translate')) {
|
||||
let keyfile = new GLib.KeyFile();
|
||||
let path = 'desktop-directories/' + name;
|
||||
|
||||
try {
|
||||
keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE);
|
||||
name = keyfile.get_locale_string('Desktop Entry', 'Name', null);
|
||||
} catch(e) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
const BaseAppView = new Lang.Class({
|
||||
Name: 'BaseAppView',
|
||||
Abstract: true,
|
||||
@ -77,6 +117,15 @@ const BaseAppView = new Lang.Class({
|
||||
this._allItems = [];
|
||||
},
|
||||
|
||||
_redisplay: function() {
|
||||
this.removeAll();
|
||||
this._loadApps();
|
||||
},
|
||||
|
||||
getAllItems: function() {
|
||||
return this._allItems;
|
||||
},
|
||||
|
||||
addItem: function(icon) {
|
||||
let id = icon.id;
|
||||
if (this._items[id] !== undefined)
|
||||
@ -86,10 +135,12 @@ const BaseAppView = new Lang.Class({
|
||||
this._items[id] = icon;
|
||||
},
|
||||
|
||||
_compareItems: function(a, b) {
|
||||
return a.name.localeCompare(b.name);
|
||||
},
|
||||
|
||||
loadGrid: function() {
|
||||
this._allItems.sort(Lang.bind(this, function(a, b) {
|
||||
return a.name.localeCompare(b.name);
|
||||
}));
|
||||
this._allItems.sort(this._compareItems);
|
||||
this._allItems.forEach(Lang.bind(this, function(item) {
|
||||
this._grid.addItem(item);
|
||||
}));
|
||||
@ -308,6 +359,76 @@ const AllView = new Lang.Class({
|
||||
this._keyPressEventId = 0;
|
||||
}
|
||||
}));
|
||||
|
||||
this._redisplayWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
|
||||
|
||||
Shell.AppSystem.get_default().connect('installed-changed', Lang.bind(this, function() {
|
||||
Main.queueDeferredWork(this._redisplayWorkId);
|
||||
}));
|
||||
this._folderSettings = new Gio.Settings({ schema: 'org.gnome.desktop.app-folders' });
|
||||
this._folderSettings.connect('changed::folder-children', Lang.bind(this, function() {
|
||||
Main.queueDeferredWork(this._redisplayWorkId);
|
||||
}));
|
||||
},
|
||||
|
||||
removeAll: function() {
|
||||
this.folderIcons = [];
|
||||
this.parent();
|
||||
},
|
||||
|
||||
_itemNameChanged: function(item) {
|
||||
// If an item's name changed, we can pluck it out of where it's
|
||||
// supposed to be and reinsert it where it's sorted.
|
||||
let oldIdx = this._allItems.indexOf(item);
|
||||
this._allItems.splice(oldIdx, 1);
|
||||
let newIdx = Util.insertSorted(this._allItems, item, this._compareItems);
|
||||
|
||||
this._grid.removeItem(item);
|
||||
this._grid.addItem(item, newIdx);
|
||||
},
|
||||
|
||||
_refilterApps: function() {
|
||||
this._allItems.forEach(function(icon) {
|
||||
if (icon instanceof AppIcon)
|
||||
icon.actor.visible = true;
|
||||
});
|
||||
|
||||
this.folderIcons.forEach(Lang.bind(this, function(folder) {
|
||||
let folderApps = folder.getAppIds();
|
||||
folderApps.forEach(Lang.bind(this, function(appId) {
|
||||
let appIcon = this._items[appId];
|
||||
appIcon.actor.visible = false;
|
||||
}));
|
||||
}));
|
||||
},
|
||||
|
||||
_loadApps: function() {
|
||||
let apps = Gio.AppInfo.get_all().filter(function(appInfo) {
|
||||
return appInfo.should_show();
|
||||
}).map(function(app) {
|
||||
return app.get_id();
|
||||
});
|
||||
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
|
||||
let folders = this._folderSettings.get_strv('folder-children');
|
||||
folders.forEach(Lang.bind(this, function(id) {
|
||||
let path = this._folderSettings.path + 'folders/' + id + '/';
|
||||
let icon = new FolderIcon(id, path, this);
|
||||
icon.connect('name-changed', Lang.bind(this, this._itemNameChanged));
|
||||
icon.connect('apps-changed', Lang.bind(this, this._refilterApps));
|
||||
this.addItem(icon);
|
||||
this.folderIcons.push(icon);
|
||||
}));
|
||||
|
||||
apps.forEach(Lang.bind(this, function(appId) {
|
||||
let app = appSys.lookup_app(appId);
|
||||
let icon = new AppIcon(app);
|
||||
this.addItem(icon);
|
||||
}));
|
||||
|
||||
this.loadGrid();
|
||||
this._refilterApps();
|
||||
},
|
||||
|
||||
getCurrentPageY: function() {
|
||||
@ -429,11 +550,6 @@ const AllView = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
removeAll: function() {
|
||||
this.folderIcons = [];
|
||||
this.parent();
|
||||
},
|
||||
|
||||
addFolderPopup: function(popup) {
|
||||
this._stack.add_actor(popup.actor);
|
||||
popup.connect('open-state-changed', Lang.bind(this,
|
||||
@ -528,17 +644,18 @@ const FrequentView = new Lang.Class({
|
||||
this._noFrequentAppsLabel.hide();
|
||||
|
||||
this._usage = Shell.AppUsage.get_default();
|
||||
|
||||
this.actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||
if (this.actor.mapped)
|
||||
this._redisplay();
|
||||
}));
|
||||
},
|
||||
|
||||
hasUsefulData: function() {
|
||||
return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT;
|
||||
},
|
||||
|
||||
removeAll: function() {
|
||||
this._grid.destroyAll();
|
||||
},
|
||||
|
||||
loadApps: function() {
|
||||
_loadApps: function() {
|
||||
let mostUsed = this._usage.get_most_used ("");
|
||||
let hasUsefulData = this.hasUsefulData();
|
||||
this._noFrequentAppsLabel.visible = !hasUsefulData;
|
||||
@ -616,16 +733,6 @@ const AppDisplay = new Lang.Class({
|
||||
Name: 'AppDisplay',
|
||||
|
||||
_init: function() {
|
||||
Shell.AppSystem.get_default().connect('installed-changed', Lang.bind(this, function() {
|
||||
Main.queueDeferredWork(this._allAppsWorkId);
|
||||
}));
|
||||
Main.overview.connect('showing', Lang.bind(this, function() {
|
||||
Main.queueDeferredWork(this._frequentAppsWorkId);
|
||||
}));
|
||||
this._softwareSettings = new Gio.Settings({ schema: 'org.gnome.software' });
|
||||
this._softwareSettings.connect('changed::app-folders', Lang.bind(this, function() {
|
||||
Main.queueDeferredWork(this._frequentAppsWorkId);
|
||||
}));
|
||||
this._privacySettings = new Gio.Settings({ schema: 'org.gnome.desktop.privacy' });
|
||||
this._privacySettings.connect('changed::remember-app-usage',
|
||||
Lang.bind(this, this._updateFrequentVisibility));
|
||||
@ -679,15 +786,6 @@ const AppDisplay = new Lang.Class({
|
||||
initialView = Views.ALL;
|
||||
this._showView(initialView);
|
||||
this._updateFrequentVisibility();
|
||||
|
||||
// We need a dummy actor to catch the keyboard focus if the
|
||||
// user Ctrl-Alt-Tabs here before the deferred work creates
|
||||
// our real contents
|
||||
this._focusDummy = new St.Bin({ can_focus: true });
|
||||
this._viewStack.add_actor(this._focusDummy);
|
||||
|
||||
this._allAppsWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplayAllApps));
|
||||
this._frequentAppsWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplayFrequentApps));
|
||||
},
|
||||
|
||||
_showView: function(activeIndex) {
|
||||
@ -721,54 +819,6 @@ const AppDisplay = new Lang.Class({
|
||||
this._showView(Views.ALL);
|
||||
},
|
||||
|
||||
_redisplay: function() {
|
||||
this._redisplayFrequentApps();
|
||||
this._redisplayAllApps();
|
||||
},
|
||||
|
||||
_redisplayFrequentApps: function() {
|
||||
let view = this._views[Views.FREQUENT].view;
|
||||
|
||||
view.removeAll();
|
||||
view.loadApps();
|
||||
},
|
||||
|
||||
_redisplayAllApps: function() {
|
||||
let view = this._views[Views.ALL].view;
|
||||
|
||||
view.removeAll();
|
||||
|
||||
let apps = Gio.AppInfo.get_all();
|
||||
|
||||
let folders = this._softwareSettings.get_value('app-folders').deep_unpack();
|
||||
for (let id in folders) {
|
||||
let folderApps = folders[id];
|
||||
let icon = new FolderIcon(id, id, folderApps, view);
|
||||
view.addItem(icon);
|
||||
view.folderIcons.push(icon);
|
||||
}
|
||||
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
apps.forEach(Lang.bind(this, function(appInfo) {
|
||||
if (!appInfo.should_show())
|
||||
return;
|
||||
|
||||
let app = appSys.lookup_app(appInfo.get_id());
|
||||
let icon = new AppIcon(app);
|
||||
view.addItem(icon);
|
||||
}));
|
||||
|
||||
view.loadGrid();
|
||||
|
||||
if (this._focusDummy) {
|
||||
let focused = this._focusDummy.has_key_focus();
|
||||
this._focusDummy.destroy();
|
||||
this._focusDummy = null;
|
||||
if (focused)
|
||||
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||
}
|
||||
},
|
||||
|
||||
selectApp: function(id) {
|
||||
this._showView(Views.ALL);
|
||||
this._views[Views.ALL].view.selectApp(id);
|
||||
@ -838,7 +888,7 @@ const AppSearchProvider = new Lang.Class({
|
||||
let app = this._appSys.lookup_app(result);
|
||||
let event = Clutter.get_current_event();
|
||||
let modifiers = event ? event.get_state() : 0;
|
||||
let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK;
|
||||
let openNewWindow = (modifiers & Clutter.ModifierType.CONTROL_MASK) || _isTerminal(app);
|
||||
|
||||
if (openNewWindow)
|
||||
app.open_new_window(-1);
|
||||
@ -966,11 +1016,12 @@ const FolderView = new Lang.Class({
|
||||
const FolderIcon = new Lang.Class({
|
||||
Name: 'FolderIcon',
|
||||
|
||||
_init: function(id, name, apps, parentView) {
|
||||
_init: function(id, path, parentView) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this._parentView = parentView;
|
||||
|
||||
this._folder = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders.folder',
|
||||
path: path });
|
||||
this.actor = new St.Button({ style_class: 'app-well-app app-folder',
|
||||
button_mask: St.ButtonMask.ONE,
|
||||
toggle_mode: true,
|
||||
@ -981,22 +1032,11 @@ const FolderIcon = new Lang.Class({
|
||||
// whether we need to update arrow side, position etc.
|
||||
this._popupInvalidated = false;
|
||||
|
||||
this.icon = new IconGrid.BaseIcon(this.name,
|
||||
{ createIcon: Lang.bind(this, this._createIcon), setSizeManually: true });
|
||||
this.icon = new IconGrid.BaseIcon('', { createIcon: Lang.bind(this, this._createIcon), setSizeManually: true });
|
||||
this.actor.set_child(this.icon.actor);
|
||||
this.actor.label_actor = this.icon.label;
|
||||
|
||||
this.view = new FolderView();
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
apps.forEach(Lang.bind(this, function(appId) {
|
||||
let app = appSys.lookup_app(appId + '.desktop');
|
||||
if (!app)
|
||||
return;
|
||||
|
||||
let icon = new AppIcon(app);
|
||||
this.view.addItem(icon);
|
||||
}));
|
||||
this.view.loadGrid();
|
||||
|
||||
this.actor.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
@ -1009,6 +1049,63 @@ const FolderIcon = new Lang.Class({
|
||||
if (!this.actor.mapped && this._popup)
|
||||
this._popup.popdown();
|
||||
}));
|
||||
|
||||
this._folder.connect('changed', Lang.bind(this, this._redisplay));
|
||||
this._redisplay();
|
||||
},
|
||||
|
||||
getAppIds: function() {
|
||||
return this.view.getAllItems().map(function(item) {
|
||||
return item.id;
|
||||
});
|
||||
},
|
||||
|
||||
_updateName: function() {
|
||||
let name = _getFolderName(this._folder);
|
||||
if (this.name == name)
|
||||
return;
|
||||
|
||||
this.name = name;
|
||||
this.icon.label.text = this.name;
|
||||
this.emit('name-changed');
|
||||
},
|
||||
|
||||
_redisplay: function() {
|
||||
this._updateName();
|
||||
|
||||
this.view.removeAll();
|
||||
|
||||
let excludedApps = this._folder.get_strv('excluded-apps');
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
let addAppId = (function addAppId(appId) {
|
||||
if (excludedApps.indexOf(appId) >= 0)
|
||||
return;
|
||||
|
||||
let app = appSys.lookup_app(appId);
|
||||
if (!app)
|
||||
return;
|
||||
|
||||
if (!app.get_app_info().should_show())
|
||||
return;
|
||||
|
||||
let icon = new AppIcon(app);
|
||||
this.view.addItem(icon);
|
||||
}).bind(this);
|
||||
|
||||
let folderApps = this._folder.get_strv('apps');
|
||||
folderApps.forEach(addAppId);
|
||||
|
||||
let folderCategories = this._folder.get_strv('categories');
|
||||
Gio.AppInfo.get_all().forEach(function(appInfo) {
|
||||
let appCategories = _getCategories(appInfo);
|
||||
if (!_listsIntersect(folderCategories, appCategories))
|
||||
return;
|
||||
|
||||
addAppId(appInfo.get_id());
|
||||
});
|
||||
|
||||
this.view.loadGrid();
|
||||
this.emit('apps-changed');
|
||||
},
|
||||
|
||||
_createIcon: function(iconSize) {
|
||||
@ -1087,6 +1184,7 @@ const FolderIcon = new Lang.Class({
|
||||
this._popupInvalidated = true;
|
||||
},
|
||||
});
|
||||
Signals.addSignalMethods(FolderIcon.prototype);
|
||||
|
||||
const AppFolderPopup = new Lang.Class({
|
||||
Name: 'AppFolderPopup',
|
||||
@ -1368,8 +1466,9 @@ const AppIcon = new Lang.Class({
|
||||
_onActivate: function (event) {
|
||||
let modifiers = event.get_state();
|
||||
|
||||
if (modifiers & Clutter.ModifierType.CONTROL_MASK
|
||||
&& this.app.state == Shell.AppState.RUNNING) {
|
||||
if ((modifiers & Clutter.ModifierType.CONTROL_MASK
|
||||
&& this.app.state == Shell.AppState.RUNNING)
|
||||
|| _isTerminal(this.app)) {
|
||||
this.app.open_new_window(-1);
|
||||
} else {
|
||||
this.app.activate();
|
||||
@ -1417,8 +1516,6 @@ const AppIconMenu = new Lang.Class({
|
||||
|
||||
this._source = source;
|
||||
|
||||
this.connect('activate', Lang.bind(this, this._onActivate));
|
||||
|
||||
this.actor.add_style_class_name('app-well-menu');
|
||||
|
||||
// Chain our visibility and lifecycle to that of the source
|
||||
@ -1428,14 +1525,14 @@ const AppIconMenu = new Lang.Class({
|
||||
}));
|
||||
source.actor.connect('destroy', Lang.bind(this, function () { this.actor.destroy(); }));
|
||||
|
||||
Main.uiGroup.add_actor(this.actor);
|
||||
Main.layoutManager.menuGroup.add_actor(this.actor);
|
||||
},
|
||||
|
||||
_redisplay: function() {
|
||||
this.removeAll();
|
||||
|
||||
let windows = this._source.app.get_windows().filter(function(w) {
|
||||
return Shell.WindowTracker.is_window_interesting(w);
|
||||
return !w.skip_taskbar;
|
||||
});
|
||||
|
||||
// Display the app windows menu items and the separator between windows
|
||||
@ -1444,25 +1541,54 @@ const AppIconMenu = new Lang.Class({
|
||||
let separatorShown = windows.length > 0 && windows[0].get_workspace() != activeWorkspace;
|
||||
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
if (!separatorShown && windows[i].get_workspace() != activeWorkspace) {
|
||||
let window = windows[i];
|
||||
if (!separatorShown && window.get_workspace() != activeWorkspace) {
|
||||
this._appendSeparator();
|
||||
separatorShown = true;
|
||||
}
|
||||
let item = this._appendMenuItem(windows[i].title);
|
||||
item._window = windows[i];
|
||||
let item = this._appendMenuItem(window.title);
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
this.emit('activate-window', window);
|
||||
}));
|
||||
}
|
||||
|
||||
if (!this._source.app.is_window_backed()) {
|
||||
if (windows.length > 0)
|
||||
this._appendSeparator();
|
||||
this._appendSeparator();
|
||||
|
||||
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
|
||||
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
|
||||
this._source.app.open_new_window(-1);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
this._appendSeparator();
|
||||
|
||||
let appInfo = this._source.app.get_app_info();
|
||||
let actions = appInfo.list_actions();
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
let action = actions[i];
|
||||
let item = this._appendMenuItem(appInfo.get_action_name(action));
|
||||
item.connect('activate', Lang.bind(this, function(emitter, event) {
|
||||
this._source.app.launch_action(action, event.get_time(), -1);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
}
|
||||
this._appendSeparator();
|
||||
|
||||
let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._source.app.get_id());
|
||||
|
||||
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
|
||||
this._appendSeparator();
|
||||
|
||||
this._toggleFavoriteMenuItem = this._appendMenuItem(isFavorite ? _("Remove from Favorites")
|
||||
: _("Add to Favorites"));
|
||||
if (isFavorite) {
|
||||
let item = this._appendMenuItem(_("Remove from Favorites"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
favs.removeFavorite(this._source.app.get_id());
|
||||
}));
|
||||
} else {
|
||||
let item = this._appendMenuItem(_("Add to Favorites"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
favs.addFavorite(this._source.app.get_id());
|
||||
}));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -1481,24 +1607,6 @@ const AppIconMenu = new Lang.Class({
|
||||
popup: function(activatingButton) {
|
||||
this._redisplay();
|
||||
this.open();
|
||||
},
|
||||
|
||||
_onActivate: function (actor, child) {
|
||||
if (child._window) {
|
||||
let metaWindow = child._window;
|
||||
this.emit('activate-window', metaWindow);
|
||||
} else if (child == this._newWindowMenuItem) {
|
||||
this._source.app.open_new_window(-1);
|
||||
this.emit('activate-window', null);
|
||||
} else if (child == this._toggleFavoriteMenuItem) {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
let isFavorite = favs.isFavorite(this._source.app.get_id());
|
||||
if (isFavorite)
|
||||
favs.removeFavorite(this._source.app.get_id());
|
||||
else
|
||||
favs.addFavorite(this._source.app.get_id());
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(AppIconMenu.prototype);
|
||||
|
@ -132,6 +132,46 @@ const BackgroundCache = new Lang.Class({
|
||||
this._removeContent(this._images, content);
|
||||
},
|
||||
|
||||
_loadImageContentInternal: function(filename, style) {
|
||||
let cancellable = new Gio.Cancellable();
|
||||
let content = new Meta.Background({ meta_screen: global.screen });
|
||||
|
||||
let info = { filename: filename,
|
||||
style: style,
|
||||
cancellable: cancellable,
|
||||
callers: [] };
|
||||
|
||||
content.load_file_async(filename, style, cancellable, Lang.bind(this, function(object, result) {
|
||||
if (cancellable.is_cancelled())
|
||||
return;
|
||||
|
||||
try {
|
||||
content.load_file_finish(result);
|
||||
} catch(e) {
|
||||
content = null;
|
||||
}
|
||||
|
||||
if (content) {
|
||||
this._monitorFile(filename);
|
||||
info.callers.forEach(Lang.bind(this, function(caller) {
|
||||
let newContent = content.copy(caller.monitorIndex, caller.effects);
|
||||
this._images.push(newContent);
|
||||
caller.onFinished(newContent);
|
||||
}));
|
||||
} else {
|
||||
info.callers.forEach(Lang.bind(this, function(caller) {
|
||||
caller.onFinished(null);
|
||||
}));
|
||||
}
|
||||
|
||||
let idx = this._pendingFileLoads.indexOf(info);
|
||||
this._pendingFileLoads.splice(idx, 1);
|
||||
}));
|
||||
|
||||
this._pendingFileLoads.push(info);
|
||||
return info;
|
||||
},
|
||||
|
||||
_loadImageContent: function(params) {
|
||||
params = Params.parse(params, { monitorIndex: 0,
|
||||
style: null,
|
||||
@ -140,67 +180,38 @@ const BackgroundCache = new Lang.Class({
|
||||
cancellable: null,
|
||||
onFinished: null });
|
||||
|
||||
let caller = { monitorIndex: params.monitorIndex,
|
||||
effects: params.effects,
|
||||
cancellable: params.cancellable,
|
||||
onFinished: params.onFinished };
|
||||
|
||||
let info = null;
|
||||
for (let i = 0; i < this._pendingFileLoads.length; i++) {
|
||||
if (this._pendingFileLoads[i].filename == params.filename &&
|
||||
this._pendingFileLoads[i].style == params.style) {
|
||||
this._pendingFileLoads[i].callers.push({ shouldCopy: true,
|
||||
monitorIndex: params.monitorIndex,
|
||||
effects: params.effects,
|
||||
onFinished: params.onFinished });
|
||||
return;
|
||||
let pendingLoad = this._pendingFileLoads[i];
|
||||
if (pendingLoad.filename == params.filename && pendingLoad.style == params.style) {
|
||||
info = pendingLoad;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._pendingFileLoads.push({ filename: params.filename,
|
||||
style: params.style,
|
||||
callers: [{ shouldCopy: false,
|
||||
monitorIndex: params.monitorIndex,
|
||||
effects: params.effects,
|
||||
onFinished: params.onFinished }] });
|
||||
if (!info)
|
||||
info = this._loadImageContentInternal(params.filename, params.style);
|
||||
|
||||
let content = new Meta.Background({ meta_screen: global.screen,
|
||||
monitor: params.monitorIndex,
|
||||
effects: params.effects });
|
||||
info.callers.push(caller);
|
||||
|
||||
content.load_file_async(params.filename,
|
||||
params.style,
|
||||
params.cancellable,
|
||||
Lang.bind(this,
|
||||
function(object, result) {
|
||||
try {
|
||||
content.load_file_finish(result);
|
||||
if (caller.cancellable) {
|
||||
caller.cancellable.connect(Lang.bind(this, function() {
|
||||
let idx = info.callers.indexOf(caller);
|
||||
info.callers.splice(idx, 1);
|
||||
|
||||
this._monitorFile(params.filename);
|
||||
this._images.push(content);
|
||||
} catch(e) {
|
||||
content = null;
|
||||
}
|
||||
if (info.callers.length == 0) {
|
||||
info.cancellable.cancel();
|
||||
|
||||
for (let i = 0; i < this._pendingFileLoads.length; i++) {
|
||||
let pendingLoad = this._pendingFileLoads[i];
|
||||
if (pendingLoad.filename != params.filename ||
|
||||
pendingLoad.style != params.style)
|
||||
continue;
|
||||
|
||||
for (let j = 0; j < pendingLoad.callers.length; j++) {
|
||||
if (pendingLoad.callers[j].onFinished) {
|
||||
let newContent;
|
||||
|
||||
if (content && pendingLoad.callers[j].shouldCopy) {
|
||||
newContent = content.copy(pendingLoad.callers[j].monitorIndex,
|
||||
pendingLoad.callers[j].effects);
|
||||
this._images.push(newContent);
|
||||
} else {
|
||||
newContent = content;
|
||||
}
|
||||
|
||||
pendingLoad.callers[j].onFinished(newContent);
|
||||
}
|
||||
}
|
||||
|
||||
this._pendingFileLoads.splice(i, 1);
|
||||
}
|
||||
}));
|
||||
let idx = this._pendingFileLoads.indexOf(info);
|
||||
this._pendingFileLoads.splice(idx, 1);
|
||||
}
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
||||
getImageContent: function(params) {
|
||||
@ -250,7 +261,6 @@ const BackgroundCache = new Lang.Class({
|
||||
monitorIndex: params.monitorIndex,
|
||||
cancellable: params.cancellable,
|
||||
onFinished: params.onFinished });
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -565,7 +575,7 @@ const Background = new Lang.Class({
|
||||
_load: function () {
|
||||
this._cache = getBackgroundCache();
|
||||
|
||||
this._loadPattern(this._cache);
|
||||
this._loadPattern();
|
||||
|
||||
this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
|
||||
if (this._style == GDesktopEnums.BackgroundStyle.NONE) {
|
||||
@ -624,31 +634,6 @@ const Background = new Lang.Class({
|
||||
});
|
||||
Signals.addSignalMethods(Background.prototype);
|
||||
|
||||
const SystemBackground = new Lang.Class({
|
||||
Name: 'SystemBackground',
|
||||
|
||||
_init: function() {
|
||||
this._cache = getBackgroundCache();
|
||||
this.actor = new Meta.BackgroundActor();
|
||||
|
||||
this._cache.getImageContent({ style: GDesktopEnums.BackgroundStyle.WALLPAPER,
|
||||
filename: global.datadir + '/theme/noise-texture.png',
|
||||
effects: Meta.BackgroundEffects.NONE,
|
||||
onFinished: Lang.bind(this, function(content) {
|
||||
this.actor.content = content;
|
||||
this.emit('loaded');
|
||||
})
|
||||
});
|
||||
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
this._cache.removeImageContent(this.actor.content);
|
||||
},
|
||||
});
|
||||
Signals.addSignalMethods(SystemBackground.prototype);
|
||||
|
||||
const Animation = new Lang.Class({
|
||||
Name: 'Animation',
|
||||
|
||||
@ -733,29 +718,30 @@ const BackgroundManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateBackground: function(background) {
|
||||
_updateBackground: function() {
|
||||
let newBackground = this._createBackground();
|
||||
newBackground.vignetteSharpness = background.vignetteSharpness;
|
||||
newBackground.brightness = background.brightness;
|
||||
newBackground.visible = background.visible;
|
||||
newBackground.vignetteSharpness = this.background.vignetteSharpness;
|
||||
newBackground.brightness = this.background.brightness;
|
||||
newBackground.visible = this.background.visible;
|
||||
|
||||
newBackground.loadedSignalId = newBackground.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
newBackground.disconnect(newBackground.loadedSignalId);
|
||||
newBackground.loadedSignalId = 0;
|
||||
Tweener.addTween(background.actor,
|
||||
Tweener.addTween(this.background.actor,
|
||||
{ opacity: 0,
|
||||
time: FADE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
if (this._newBackground == newBackground) {
|
||||
this.background = newBackground;
|
||||
this._newBackground = null;
|
||||
} else {
|
||||
if (this._newBackground != newBackground) {
|
||||
/* Not interesting, we queued another load */
|
||||
newBackground.actor.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
background.actor.destroy();
|
||||
this.background.actor.destroy();
|
||||
this.background = newBackground;
|
||||
this._newBackground = null;
|
||||
|
||||
this.emit('changed');
|
||||
})
|
||||
@ -783,7 +769,7 @@ const BackgroundManager = new Lang.Class({
|
||||
background.changeSignalId = background.connect('changed', Lang.bind(this, function() {
|
||||
background.disconnect(background.changeSignalId);
|
||||
background.changeSignalId = 0;
|
||||
this._updateBackground(background);
|
||||
this._updateBackground();
|
||||
}));
|
||||
|
||||
background.actor.connect('destroy', Lang.bind(this, function() {
|
||||
|
@ -13,8 +13,8 @@ const BackgroundMenu = new Lang.Class({
|
||||
Name: 'BackgroundMenu',
|
||||
Extends: PopupMenu.PopupMenu,
|
||||
|
||||
_init: function(source, layoutManager) {
|
||||
this.parent(source, 0, St.Side.TOP);
|
||||
_init: function(layoutManager) {
|
||||
this.parent(layoutManager.dummyCursor, 0, St.Side.TOP);
|
||||
|
||||
this.addSettingsAction(_("Settings"), 'gnome-control-center.desktop');
|
||||
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||
@ -22,23 +22,20 @@ const BackgroundMenu = new Lang.Class({
|
||||
|
||||
this.actor.add_style_class_name('background-menu');
|
||||
|
||||
layoutManager.uiGroup.add_actor(this.actor);
|
||||
layoutManager.menuGroup.add_actor(this.actor);
|
||||
this.actor.hide();
|
||||
}
|
||||
});
|
||||
|
||||
function addBackgroundMenu(actor, layoutManager) {
|
||||
let cursor = new St.Bin({ opacity: 0 });
|
||||
layoutManager.uiGroup.add_actor(cursor);
|
||||
|
||||
actor.reactive = true;
|
||||
actor._backgroundMenu = new BackgroundMenu(cursor, layoutManager);
|
||||
actor._backgroundMenu = new BackgroundMenu(layoutManager);
|
||||
actor._backgroundManager = new PopupMenu.PopupMenuManager({ actor: actor });
|
||||
actor._backgroundManager.addMenu(actor._backgroundMenu);
|
||||
|
||||
function openMenu() {
|
||||
let [x, y] = global.get_pointer();
|
||||
cursor.set_position(x, y);
|
||||
Main.layoutManager.setDummyCursorPosition(x, y);
|
||||
actor._backgroundMenu.open(BoxPointer.PopupAnimation.NONE);
|
||||
}
|
||||
|
||||
@ -59,10 +56,8 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
actor.add_action(clickAction);
|
||||
|
||||
actor.connect('destroy', function() {
|
||||
actor._backgroundMenu.destroy();
|
||||
actor._backgroundMenu = null;
|
||||
actor._backgroundManager = null;
|
||||
|
||||
cursor.destroy();
|
||||
});
|
||||
actor._backgroundMenu.destroy();
|
||||
actor._backgroundMenu = null;
|
||||
actor._backgroundManager = null;
|
||||
});
|
||||
}
|
||||
|
@ -287,38 +287,40 @@ const BoxPointer = new Lang.Class({
|
||||
let skipBottomLeft = false;
|
||||
let skipBottomRight = false;
|
||||
|
||||
switch (this._arrowSide) {
|
||||
case St.Side.TOP:
|
||||
if (this._arrowOrigin == x1)
|
||||
skipTopLeft = true;
|
||||
else if (this._arrowOrigin == x2)
|
||||
skipTopRight = true;
|
||||
break;
|
||||
if (rise) {
|
||||
switch (this._arrowSide) {
|
||||
case St.Side.TOP:
|
||||
if (this._arrowOrigin == x1)
|
||||
skipTopLeft = true;
|
||||
else if (this._arrowOrigin == x2)
|
||||
skipTopRight = true;
|
||||
break;
|
||||
|
||||
case St.Side.RIGHT:
|
||||
if (this._arrowOrigin == y1)
|
||||
skipTopRight = true;
|
||||
else if (this._arrowOrigin == y2)
|
||||
skipBottomRight = true;
|
||||
break;
|
||||
case St.Side.RIGHT:
|
||||
if (this._arrowOrigin == y1)
|
||||
skipTopRight = true;
|
||||
else if (this._arrowOrigin == y2)
|
||||
skipBottomRight = true;
|
||||
break;
|
||||
|
||||
case St.Side.BOTTOM:
|
||||
if (this._arrowOrigin == x1)
|
||||
skipBottomLeft = true;
|
||||
else if (this._arrowOrigin == x2)
|
||||
skipBottomRight = true;
|
||||
break;
|
||||
case St.Side.BOTTOM:
|
||||
if (this._arrowOrigin == x1)
|
||||
skipBottomLeft = true;
|
||||
else if (this._arrowOrigin == x2)
|
||||
skipBottomRight = true;
|
||||
break;
|
||||
|
||||
case St.Side.LEFT:
|
||||
if (this._arrowOrigin == y1)
|
||||
skipTopLeft = true;
|
||||
else if (this._arrowOrigin == y2)
|
||||
skipBottomLeft = true;
|
||||
break;
|
||||
case St.Side.LEFT:
|
||||
if (this._arrowOrigin == y1)
|
||||
skipTopLeft = true;
|
||||
else if (this._arrowOrigin == y2)
|
||||
skipBottomLeft = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cr.moveTo(x1 + borderRadius, y1);
|
||||
if (this._arrowSide == St.Side.TOP) {
|
||||
if (this._arrowSide == St.Side.TOP && rise) {
|
||||
if (skipTopLeft) {
|
||||
cr.moveTo(x1, y2 - borderRadius);
|
||||
cr.lineTo(x1, y1 - rise);
|
||||
@ -340,7 +342,7 @@ const BoxPointer = new Lang.Class({
|
||||
3*Math.PI/2, Math.PI*2);
|
||||
}
|
||||
|
||||
if (this._arrowSide == St.Side.RIGHT) {
|
||||
if (this._arrowSide == St.Side.RIGHT && rise) {
|
||||
if (skipTopRight) {
|
||||
cr.lineTo(x2 + rise, y1);
|
||||
cr.lineTo(x2 + rise, y1 + halfBase);
|
||||
@ -361,7 +363,7 @@ const BoxPointer = new Lang.Class({
|
||||
0, Math.PI/2);
|
||||
}
|
||||
|
||||
if (this._arrowSide == St.Side.BOTTOM) {
|
||||
if (this._arrowSide == St.Side.BOTTOM && rise) {
|
||||
if (skipBottomLeft) {
|
||||
cr.lineTo(x1 + halfBase, y2);
|
||||
cr.lineTo(x1, y2 + rise);
|
||||
@ -382,7 +384,7 @@ const BoxPointer = new Lang.Class({
|
||||
Math.PI/2, Math.PI);
|
||||
}
|
||||
|
||||
if (this._arrowSide == St.Side.LEFT) {
|
||||
if (this._arrowSide == St.Side.LEFT && rise) {
|
||||
if (skipTopLeft) {
|
||||
cr.lineTo(x1, y1 + halfBase);
|
||||
cr.lineTo(x1 - rise, y1);
|
||||
|
@ -64,7 +64,7 @@ function startAppForMount(app, mount) {
|
||||
|
||||
try {
|
||||
retval = app.launch(files,
|
||||
global.create_app_launch_context())
|
||||
global.create_app_launch_context(0, -1))
|
||||
} catch (e) {
|
||||
log('Unable to launch the application ' + app.get_name()
|
||||
+ ': ' + e.toString());
|
||||
|
@ -309,7 +309,7 @@ const NetworkSecretDialog = new Lang.Class({
|
||||
wirelessSetting = this._connection.get_setting_wireless();
|
||||
ssid = NetworkManager.utils_ssid_to_utf8(wirelessSetting.get_ssid());
|
||||
content.title = _("Authentication required by wireless network");
|
||||
content.message = _("Passwords or encryption keys are required to access the wireless network '%s'.").format(ssid);
|
||||
content.message = _("Passwords or encryption keys are required to access the wireless network “%s”.").format(ssid);
|
||||
this._getWirelessSecrets(content.secrets, wirelessSetting);
|
||||
break;
|
||||
case '802-3-ethernet':
|
||||
@ -336,7 +336,7 @@ const NetworkSecretDialog = new Lang.Class({
|
||||
case 'cdma':
|
||||
case 'bluetooth':
|
||||
content.title = _("Mobile broadband network password");
|
||||
content.message = _("A password is required to connect to '%s'.").format(connectionSetting.get_id());
|
||||
content.message = _("A password is required to connect to “%s”.").format(connectionSetting.get_id());
|
||||
this._getMobileSecrets(content.secrets, connectionType);
|
||||
break;
|
||||
default:
|
||||
|
@ -621,7 +621,11 @@ const ChatSource = new Lang.Class({
|
||||
this.notify();
|
||||
},
|
||||
|
||||
_channelClosed: function() {
|
||||
destroy: function(reason) {
|
||||
if (this._destroyed)
|
||||
return;
|
||||
|
||||
this._destroyed = true;
|
||||
this._channel.disconnect(this._closedId);
|
||||
this._channel.disconnect(this._receivedId);
|
||||
this._channel.disconnect(this._pendingId);
|
||||
@ -631,7 +635,14 @@ const ChatSource = new Lang.Class({
|
||||
this._contact.disconnect(this._notifyAvatarId);
|
||||
this._contact.disconnect(this._presenceChangedId);
|
||||
|
||||
this.destroy();
|
||||
if (this._timestampTimeoutId)
|
||||
Mainloop.source_remove(this._timestampTimeoutId);
|
||||
|
||||
this.parent(reason);
|
||||
},
|
||||
|
||||
_channelClosed: function() {
|
||||
this.destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
||||
},
|
||||
|
||||
/* All messages are new messages for Telepathy sources */
|
||||
@ -1339,7 +1350,7 @@ const AccountNotification = new Lang.Class({
|
||||
let cmd = 'empathy-accounts --select-account=' +
|
||||
account.get_path_suffix();
|
||||
let app_info = Gio.app_info_create_from_commandline(cmd, null, 0);
|
||||
app_info.launch([], global.create_app_launch_context());
|
||||
app_info.launch([], global.create_app_launch_context(0, -1));
|
||||
}));
|
||||
|
||||
this._enabledId = account.connect('notify::enabled',
|
||||
|
@ -211,7 +211,7 @@ const DateMenuButton = new Lang.Class({
|
||||
let app = this._getCalendarApp();
|
||||
if (app.get_id() == 'evolution.desktop')
|
||||
app = Gio.DesktopAppInfo.new('evolution-calendar.desktop');
|
||||
app.launch([], global.create_app_launch_context());
|
||||
app.launch([], global.create_app_launch_context(0, -1));
|
||||
},
|
||||
|
||||
_onOpenClocksActivate: function() {
|
||||
|
12
js/ui/dnd.js
12
js/ui/dnd.js
@ -46,7 +46,7 @@ let dragMonitors = [];
|
||||
function _getEventHandlerActor() {
|
||||
if (!eventHandlerActor) {
|
||||
eventHandlerActor = new Clutter.Actor({ width: 0, height: 0 });
|
||||
Main.uiGroup.add_actor(eventHandlerActor);
|
||||
Main.layoutManager.sessionGroup.add_actor(eventHandlerActor);
|
||||
// We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen
|
||||
// when you've grabbed the pointer.
|
||||
eventHandlerActor.connect('event',
|
||||
@ -236,7 +236,7 @@ const _Draggable = new Lang.Class({
|
||||
|
||||
if (this.actor._delegate && this.actor._delegate.getDragActor) {
|
||||
this._dragActor = this.actor._delegate.getDragActor();
|
||||
Main.uiGroup.add_child(this._dragActor);
|
||||
Main.layoutManager.sessionGroup.add_child(this._dragActor);
|
||||
this._dragActor.raise_top();
|
||||
Shell.util_set_hidden_from_pick(this._dragActor, true);
|
||||
|
||||
@ -276,7 +276,7 @@ const _Draggable = new Lang.Class({
|
||||
this._dragOrigScale = this._dragActor.scale_x;
|
||||
|
||||
// Set the actor's scale such that it will keep the same
|
||||
// transformed size when it's reparented to the uiGroup
|
||||
// transformed size when it's reparented to the sessionGroup
|
||||
let [scaledWidth, scaledHeight] = this.actor.get_transformed_size();
|
||||
this._dragActor.set_scale(scaledWidth / this.actor.width,
|
||||
scaledHeight / this.actor.height);
|
||||
@ -286,7 +286,7 @@ const _Draggable = new Lang.Class({
|
||||
this._dragOffsetY = actorStageY - this._dragStartY;
|
||||
|
||||
this._dragOrigParent.remove_actor(this._dragActor);
|
||||
Main.uiGroup.add_child(this._dragActor);
|
||||
Main.layoutManager.sessionGroup.add_child(this._dragActor);
|
||||
this._dragActor.raise_top();
|
||||
Shell.util_set_hidden_from_pick(this._dragActor, true);
|
||||
}
|
||||
@ -448,7 +448,7 @@ const _Draggable = new Lang.Class({
|
||||
event.get_time())) {
|
||||
// If it accepted the drop without taking the actor,
|
||||
// handle it ourselves.
|
||||
if (this._dragActor.get_parent() == Main.uiGroup) {
|
||||
if (this._dragActor.get_parent() == Main.layoutManager.sessionGroup) {
|
||||
if (this._restoreOnSuccess) {
|
||||
this._restoreDragActor(event.get_time());
|
||||
return true;
|
||||
@ -557,7 +557,7 @@ const _Draggable = new Lang.Class({
|
||||
|
||||
_onAnimationComplete : function (dragActor, eventTime) {
|
||||
if (this._dragOrigParent) {
|
||||
Main.uiGroup.remove_child(this._dragActor);
|
||||
Main.layoutManager.sessionGroup.remove_child(this._dragActor);
|
||||
this._dragOrigParent.add_actor(this._dragActor);
|
||||
dragActor.set_scale(this._dragOrigScale, this._dragOrigScale);
|
||||
dragActor.set_position(this._dragOrigX, this._dragOrigY);
|
||||
|
@ -13,9 +13,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const Lang = imports.lang;
|
||||
|
@ -201,7 +201,7 @@ const InstallExtensionDialog = new Lang.Class({
|
||||
default: true
|
||||
}]);
|
||||
|
||||
let message = _("Download and install '%s' from extensions.gnome.org?").format(info.name);
|
||||
let message = _("Download and install “%s” from extensions.gnome.org?").format(info.name);
|
||||
|
||||
let box = new St.BoxLayout();
|
||||
this.contentLayout.add(box);
|
||||
|
@ -115,9 +115,6 @@ const CandidatePopup = new Lang.Class({
|
||||
Name: 'CandidatePopup',
|
||||
|
||||
_init: function() {
|
||||
this._cursor = new St.Bin({ opacity: 0 });
|
||||
Main.uiGroup.add_actor(this._cursor);
|
||||
|
||||
this._boxPointer = new BoxPointer.BoxPointer(St.Side.TOP);
|
||||
this._boxPointer.actor.visible = false;
|
||||
this._boxPointer.actor.style_class = 'candidate-popup-boxpointer';
|
||||
@ -158,10 +155,9 @@ const CandidatePopup = new Lang.Class({
|
||||
|
||||
panelService.connect('set-cursor-location',
|
||||
Lang.bind(this, function(ps, x, y, w, h) {
|
||||
this._cursor.set_position(x, y);
|
||||
this._cursor.set_size(w, h);
|
||||
Main.layoutManager.setDummyCursorPosition(x, y);
|
||||
if (this._boxPointer.actor.visible)
|
||||
this._boxPointer.setPosition(this._cursor, 0);
|
||||
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
|
||||
}));
|
||||
panelService.connect('update-preedit-text',
|
||||
Lang.bind(this, function(ps, text, cursorPosition, visible) {
|
||||
@ -253,7 +249,7 @@ const CandidatePopup = new Lang.Class({
|
||||
this._candidateArea.actor.visible);
|
||||
|
||||
if (isVisible) {
|
||||
this._boxPointer.setPosition(this._cursor, 0);
|
||||
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
|
||||
this._boxPointer.show(BoxPointer.PopupAnimation.NONE);
|
||||
this._boxPointer.actor.raise_top();
|
||||
} else {
|
||||
|
@ -433,6 +433,10 @@ const IconGrid = new Lang.Class({
|
||||
this._grid.add_actor(item.actor);
|
||||
},
|
||||
|
||||
removeItem: function(item) {
|
||||
this._grid.remove_child(item.actor);
|
||||
},
|
||||
|
||||
getItemAtIndex: function(index) {
|
||||
return this._grid.get_child_at_index(index);
|
||||
},
|
||||
|
177
js/ui/layout.js
177
js/ui/layout.js
@ -162,9 +162,9 @@ const LayoutManager = new Lang.Class({
|
||||
this._startingUp = true;
|
||||
|
||||
// Normally, the stage is always covered so Clutter doesn't need to clear
|
||||
// it; however it becomes visible during the startup animation
|
||||
// See the comment below for a longer explanation
|
||||
// it; however it becomes visible when using the magnifier.
|
||||
global.stage.color = DEFAULT_BACKGROUND_COLOR;
|
||||
global.stage.no_clear_hint = true;
|
||||
|
||||
// Set up stage hierarchy to group all UI actors under one container.
|
||||
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
|
||||
@ -184,29 +184,27 @@ const LayoutManager = new Lang.Class({
|
||||
let height = global.stage.height;
|
||||
[alloc.min_size, alloc.natural_size] = [height, height];
|
||||
});
|
||||
global.stage.add_child(this.uiGroup);
|
||||
|
||||
this.systemGroup = new St.Widget({ name: 'systemGroup',
|
||||
layout_manager: new Clutter.BinLayout() });
|
||||
this.uiGroup.add_actor(this.systemGroup);
|
||||
|
||||
this.sessionGroup = new St.Widget({ name: 'sessionGroup' });
|
||||
this.uiGroup.add_child(this.sessionGroup);
|
||||
|
||||
global.stage.remove_actor(global.window_group);
|
||||
this.uiGroup.add_actor(global.window_group);
|
||||
|
||||
global.stage.add_child(this.uiGroup);
|
||||
this.sessionGroup.add_actor(global.window_group);
|
||||
|
||||
this.overviewGroup = new St.Widget({ name: 'overviewGroup',
|
||||
visible: false });
|
||||
this.addChrome(this.overviewGroup);
|
||||
|
||||
this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
|
||||
visible: false,
|
||||
clip_to_allocation: true,
|
||||
layout_manager: new Clutter.BinLayout(),
|
||||
});
|
||||
this.addChrome(this.screenShieldGroup);
|
||||
|
||||
this.panelBox = new St.BoxLayout({ name: 'panelBox',
|
||||
vertical: true });
|
||||
this.addChrome(this.panelBox, { affectsStruts: true,
|
||||
trackFullscreen: true });
|
||||
this.panelBox.connect('allocation-changed',
|
||||
Lang.bind(this, this._panelBoxChanged));
|
||||
this.uiGroup.add_child(this.screenShieldGroup);
|
||||
|
||||
this.trayBox = new St.Widget({ name: 'trayBox',
|
||||
layout_manager: new Clutter.BinLayout() });
|
||||
@ -219,8 +217,39 @@ const LayoutManager = new Lang.Class({
|
||||
this.addChrome(this.keyboardBox);
|
||||
this._keyboardHeightNotifyId = 0;
|
||||
|
||||
global.stage.remove_actor(global.top_window_group);
|
||||
this.uiGroup.add_actor(global.top_window_group);
|
||||
this.osdGroup = new St.Widget();
|
||||
this.sessionGroup.add_child(this.osdGroup);
|
||||
|
||||
this.switcherPopupGroup = new St.Widget();
|
||||
this.sessionGroup.add_child(this.switcherPopupGroup);
|
||||
|
||||
this.dialogGroup = new St.Widget();
|
||||
this.sessionGroup.add_child(this.dialogGroup);
|
||||
|
||||
// A dummy actor that tracks the mouse or text cursor, based on the
|
||||
// position set in setDummyCursorPosition.
|
||||
this.dummyCursor = new St.Widget({ width: 0, height: 0 });
|
||||
this.uiGroup.add_child(this.dummyCursor);
|
||||
|
||||
// The panel group isn't in the session, as it needs to go above the screen
|
||||
// shield, and it isn't animated in the login animation.
|
||||
this.panelGroup = new St.Widget({ name: 'panelGroup' });
|
||||
this.uiGroup.add_child(this.panelGroup);
|
||||
this._trackActor(this.panelGroup, { affectsStruts: true,
|
||||
trackFullscreen: true });
|
||||
this.panelGroup.connect('allocation-changed',
|
||||
Lang.bind(this, this._panelGroupChanged));
|
||||
|
||||
this.overlayGroup = new St.Widget({ name: 'overlayGroup' });
|
||||
this.uiGroup.add_child(this.overlayGroup);
|
||||
|
||||
this.menuGroup = new St.Widget();
|
||||
this.overlayGroup.add_child(this.menuGroup);
|
||||
|
||||
this._topSessionGroup = new St.Widget();
|
||||
this.overlayGroup.add_child(this._topSessionGroup);
|
||||
global.stage.remove_child(global.top_window_group);
|
||||
this._topSessionGroup.add_child(global.top_window_group);
|
||||
|
||||
this._backgroundGroup = new Meta.BackgroundGroup();
|
||||
global.window_group.add_child(this._backgroundGroup);
|
||||
@ -242,8 +271,7 @@ const LayoutManager = new Lang.Class({
|
||||
// This is called by Main after everything else is constructed
|
||||
init: function() {
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
|
||||
this._loadBackground();
|
||||
this._prepareStartupAnimation();
|
||||
},
|
||||
|
||||
showOverview: function() {
|
||||
@ -252,6 +280,9 @@ const LayoutManager = new Lang.Class({
|
||||
this._inOverview = true;
|
||||
this._updateVisibility();
|
||||
this._updateRegions();
|
||||
|
||||
global.window_group.hide();
|
||||
global.top_window_group.hide();
|
||||
},
|
||||
|
||||
hideOverview: function() {
|
||||
@ -260,6 +291,9 @@ const LayoutManager = new Lang.Class({
|
||||
this._inOverview = false;
|
||||
this._updateVisibility();
|
||||
this._queueUpdateRegions();
|
||||
|
||||
global.window_group.show();
|
||||
global.top_window_group.show();
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
@ -301,7 +335,7 @@ const LayoutManager = new Lang.Class({
|
||||
});
|
||||
this.hotCorners = [];
|
||||
|
||||
let size = this.panelBox.height;
|
||||
let size = this.panelGroup.height;
|
||||
|
||||
// build new hot corners
|
||||
for (let i = 0; i < this.monitors.length; i++) {
|
||||
@ -401,11 +435,11 @@ const LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateBoxes: function() {
|
||||
this.screenShieldGroup.set_position(0, 0);
|
||||
this.screenShieldGroup.set_size(global.screen_width, global.screen_height);
|
||||
this.systemGroup.set_position(0, 0);
|
||||
this.systemGroup.set_size(global.screen_width, global.screen_height);
|
||||
|
||||
this.panelBox.set_position(this.primaryMonitor.x, this.primaryMonitor.y);
|
||||
this.panelBox.set_size(this.primaryMonitor.width, -1);
|
||||
this.panelGroup.set_position(this.primaryMonitor.x, this.primaryMonitor.y);
|
||||
this.panelGroup.set_size(this.primaryMonitor.width, -1);
|
||||
|
||||
if (this.keyboardIndex < 0)
|
||||
this.keyboardIndex = this.primaryIndex;
|
||||
@ -415,10 +449,10 @@ const LayoutManager = new Lang.Class({
|
||||
this.trayBox.set_size(this.bottomMonitor.width, -1);
|
||||
},
|
||||
|
||||
_panelBoxChanged: function() {
|
||||
_panelGroupChanged: function() {
|
||||
this._updatePanelBarrier();
|
||||
|
||||
let size = this.panelBox.height;
|
||||
let size = this.panelGroup.height;
|
||||
this.hotCorners.forEach(function(corner) {
|
||||
if (corner)
|
||||
corner.setBarrierSize(size);
|
||||
@ -431,12 +465,12 @@ const LayoutManager = new Lang.Class({
|
||||
this._rightPanelBarrier = null;
|
||||
}
|
||||
|
||||
if (this.panelBox.height) {
|
||||
if (this.panelGroup.height) {
|
||||
let primary = this.primaryMonitor;
|
||||
|
||||
this._rightPanelBarrier = new Meta.Barrier({ display: global.display,
|
||||
x1: primary.x + primary.width, y1: primary.y,
|
||||
x2: primary.x + primary.width, y2: primary.y + this.panelBox.height,
|
||||
x2: primary.x + primary.width, y2: primary.y + this.panelGroup.height,
|
||||
directions: Meta.BarrierDirection.NEGATIVE_X });
|
||||
}
|
||||
},
|
||||
@ -542,25 +576,6 @@ const LayoutManager = new Lang.Class({
|
||||
return this._keyboardIndex;
|
||||
},
|
||||
|
||||
_loadBackground: function() {
|
||||
this._systemBackground = new Background.SystemBackground();
|
||||
this._systemBackground.actor.hide();
|
||||
|
||||
global.stage.insert_child_below(this._systemBackground.actor, null);
|
||||
|
||||
let constraint = new Clutter.BindConstraint({ source: global.stage,
|
||||
coordinate: Clutter.BindCoordinate.ALL });
|
||||
this._systemBackground.actor.add_constraint(constraint);
|
||||
|
||||
let signalId = this._systemBackground.connect('loaded', Lang.bind(this, function() {
|
||||
this._systemBackground.disconnect(signalId);
|
||||
this._systemBackground.actor.show();
|
||||
global.stage.show();
|
||||
|
||||
this._prepareStartupAnimation();
|
||||
}));
|
||||
},
|
||||
|
||||
// Startup Animations
|
||||
//
|
||||
// We have two different animations, depending on whether we're a greeter
|
||||
@ -581,6 +596,8 @@ const LayoutManager = new Lang.Class({
|
||||
// screen. So, we set no_clear_hint at the end of the animation.
|
||||
|
||||
_prepareStartupAnimation: function() {
|
||||
global.stage.show();
|
||||
|
||||
// During the initial transition, add a simple actor to block all events,
|
||||
// so they don't get delivered to X11 windows that have been transformed.
|
||||
this._coverPane = new Clutter.Actor({ opacity: 0,
|
||||
@ -590,7 +607,7 @@ const LayoutManager = new Lang.Class({
|
||||
this.addChrome(this._coverPane);
|
||||
|
||||
if (Main.sessionMode.isGreeter) {
|
||||
this.panelBox.translation_y = -this.panelBox.height;
|
||||
this.panelGroup.translation_y = -this.panelGroup.height;
|
||||
} else {
|
||||
this._updateBackgrounds();
|
||||
|
||||
@ -605,10 +622,10 @@ const LayoutManager = new Lang.Class({
|
||||
let x = monitor.x + monitor.width / 2.0;
|
||||
let y = monitor.y + monitor.height / 2.0;
|
||||
|
||||
this.uiGroup.set_pivot_point(x / global.screen_width,
|
||||
y / global.screen_height);
|
||||
this.uiGroup.scale_x = this.uiGroup.scale_y = 0.75;
|
||||
this.uiGroup.opacity = 0;
|
||||
this.sessionGroup.set_pivot_point(x / global.screen_width,
|
||||
y / global.screen_height);
|
||||
this.sessionGroup.scale_x = this.sessionGroup.scale_y = 0.75;
|
||||
this.sessionGroup.opacity = 0;
|
||||
global.window_group.set_clip(monitor.x, monitor.y, monitor.width, monitor.height);
|
||||
}
|
||||
|
||||
@ -634,7 +651,7 @@ const LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_startupAnimationGreeter: function() {
|
||||
Tweener.addTween(this.panelBox,
|
||||
Tweener.addTween(this.panelGroup,
|
||||
{ translation_y: 0,
|
||||
time: STARTUP_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
@ -643,7 +660,7 @@ const LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_startupAnimationSession: function() {
|
||||
Tweener.addTween(this.uiGroup,
|
||||
Tweener.addTween(this.sessionGroup,
|
||||
{ scale_x: 1,
|
||||
scale_y: 1,
|
||||
opacity: 255,
|
||||
@ -654,16 +671,9 @@ const LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_startupAnimationComplete: function() {
|
||||
// At this point, the UI group is covering everything, so
|
||||
// we no longer need to clear the stage
|
||||
global.stage.no_clear_hint = true;
|
||||
|
||||
this._coverPane.destroy();
|
||||
this._coverPane = null;
|
||||
|
||||
this._systemBackground.actor.destroy();
|
||||
this._systemBackground = null;
|
||||
|
||||
this._startingUp = false;
|
||||
|
||||
this.trayBox.show();
|
||||
@ -720,6 +730,20 @@ const LayoutManager = new Lang.Class({
|
||||
this._updateRegions();
|
||||
},
|
||||
|
||||
// setDummyCursorPosition:
|
||||
//
|
||||
// The cursor dummy is a standard widget commonly used for popup
|
||||
// menus and box pointers to track, as the box pointer API only
|
||||
// tracks actors. If you want to pop up a menu based on where the
|
||||
// user clicked, or where the text cursor is, the cursor dummy
|
||||
// is what you should use. Given that the menu should not track
|
||||
// the actual mouse pointer as it moves, you need to call this
|
||||
// function before you show the menu to ensure it is at the right
|
||||
// position.
|
||||
setDummyCursorPosition: function(x, y) {
|
||||
this.dummyCursor.set_position(Math.round(x), Math.round(y));
|
||||
},
|
||||
|
||||
// addChrome:
|
||||
// @actor: an actor to add to the chrome
|
||||
// @params: (optional) additional params
|
||||
@ -739,9 +763,9 @@ const LayoutManager = new Lang.Class({
|
||||
// monitor (it will be hidden whenever a fullscreen window is visible,
|
||||
// and shown otherwise)
|
||||
addChrome: function(actor, params) {
|
||||
this.uiGroup.add_actor(actor);
|
||||
if (this.uiGroup.contains(global.top_window_group))
|
||||
this.uiGroup.set_child_below_sibling(actor, global.top_window_group);
|
||||
this.sessionGroup.add_actor(actor);
|
||||
if (this.sessionGroup.contains(global.top_window_group))
|
||||
this.sessionGroup.set_child_below_sibling(actor, global.top_window_group);
|
||||
this._trackActor(actor, params);
|
||||
},
|
||||
|
||||
@ -792,7 +816,7 @@ const LayoutManager = new Lang.Class({
|
||||
//
|
||||
// Removes @actor from the chrome
|
||||
removeChrome: function(actor) {
|
||||
this.uiGroup.remove_actor(actor);
|
||||
this.sessionGroup.remove_actor(actor);
|
||||
this._untrackActor(actor);
|
||||
},
|
||||
|
||||
@ -811,13 +835,10 @@ const LayoutManager = new Lang.Class({
|
||||
|
||||
let actorData = Params.parse(params, defaultParams);
|
||||
actorData.actor = actor;
|
||||
actorData.isToplevel = actor.get_parent() == this.uiGroup;
|
||||
actorData.visibleId = actor.connect('notify::visible',
|
||||
Lang.bind(this, this._queueUpdateRegions));
|
||||
actorData.allocationId = actor.connect('notify::allocation',
|
||||
Lang.bind(this, this._queueUpdateRegions));
|
||||
actorData.parentSetId = actor.connect('parent-set',
|
||||
Lang.bind(this, this._actorReparented));
|
||||
// Note that destroying actor will unset its parent, so we don't
|
||||
// need to connect to 'destroy' too.
|
||||
|
||||
@ -840,29 +861,13 @@ const LayoutManager = new Lang.Class({
|
||||
this._queueUpdateRegions();
|
||||
},
|
||||
|
||||
_actorReparented: function(actor, oldParent) {
|
||||
let newParent = actor.get_parent();
|
||||
if (!newParent) {
|
||||
this._untrackActor(actor);
|
||||
} else {
|
||||
let i = this._findActor(actor);
|
||||
let actorData = this._trackedActors[i];
|
||||
actorData.isToplevel = (newParent == this.uiGroup);
|
||||
}
|
||||
},
|
||||
|
||||
_updateVisibility: function() {
|
||||
let windowsVisible = Main.sessionMode.hasWindows && !this._inOverview;
|
||||
|
||||
global.window_group.visible = windowsVisible;
|
||||
global.top_window_group.visible = windowsVisible;
|
||||
|
||||
for (let i = 0; i < this._trackedActors.length; i++) {
|
||||
let actorData = this._trackedActors[i], visible;
|
||||
if (!actorData.trackFullscreen)
|
||||
continue;
|
||||
if (!actorData.isToplevel)
|
||||
continue;
|
||||
|
||||
if (!windowsVisible)
|
||||
visible = true;
|
||||
@ -1077,9 +1082,9 @@ const HotCorner = new Lang.Class({
|
||||
this._ripple2 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false });
|
||||
this._ripple3 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false });
|
||||
|
||||
layoutManager.uiGroup.add_actor(this._ripple1);
|
||||
layoutManager.uiGroup.add_actor(this._ripple2);
|
||||
layoutManager.uiGroup.add_actor(this._ripple3);
|
||||
layoutManager.sessionGroup.add_actor(this._ripple1);
|
||||
layoutManager.sessionGroup.add_actor(this._ripple2);
|
||||
layoutManager.sessionGroup.add_actor(this._ripple3);
|
||||
},
|
||||
|
||||
setBarrierSize: function(size) {
|
||||
|
@ -5,12 +5,38 @@ const Lang = imports.lang;
|
||||
const Meta = imports.gi.Meta;
|
||||
const Signals = imports.signals;
|
||||
const St = imports.gi.St;
|
||||
const Shell = imports.gi.Shell;
|
||||
|
||||
const Params = imports.misc.params;
|
||||
const Tweener = imports.ui.tweener;
|
||||
|
||||
const DEFAULT_FADE_FACTOR = 0.4;
|
||||
|
||||
const GLSL_DIM_EFFECT_DECLARATIONS = '\
|
||||
float compute_dim_factor (const vec2 coords) {\
|
||||
vec2 dist = coords - vec2(0.5, 0.5); \
|
||||
float elipse_radius = 0.5; \
|
||||
/* interpolate darkening value, based on distance from screen center */ \
|
||||
float val = min(length(dist), elipse_radius); \
|
||||
return mix(0.3, 1.0, val / elipse_radius) * 0.4; \
|
||||
}';
|
||||
const GLSL_DIM_EFFECT_CODE = '\
|
||||
float a = compute_dim_factor (cogl_tex_coord0_in.xy);\
|
||||
cogl_color_out = vec4(0, 0, 0, cogl_color_in.a * a);'
|
||||
;
|
||||
|
||||
const RadialShaderQuad = new Lang.Class({
|
||||
Name: 'RadialShaderQuad',
|
||||
Extends: Shell.GLSLQuad,
|
||||
|
||||
vfunc_build_pipeline: function() {
|
||||
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT,
|
||||
GLSL_DIM_EFFECT_DECLARATIONS,
|
||||
GLSL_DIM_EFFECT_CODE,
|
||||
true);
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Lightbox:
|
||||
* @container: parent Clutter.Container
|
||||
@ -43,15 +69,21 @@ const Lightbox = new Lang.Class({
|
||||
width: null,
|
||||
height: null,
|
||||
fadeFactor: DEFAULT_FADE_FACTOR,
|
||||
radialEffect: false,
|
||||
});
|
||||
|
||||
this._container = container;
|
||||
this._children = container.get_children();
|
||||
this._fadeFactor = params.fadeFactor;
|
||||
this.actor = new St.Bin({ x: 0,
|
||||
y: 0,
|
||||
style_class: 'lightbox',
|
||||
reactive: params.inhibitEvents });
|
||||
if (params.radialEffect)
|
||||
this.actor = new RadialShaderQuad({ x: 0,
|
||||
y: 0,
|
||||
reactive: params.inhibitEvents });
|
||||
else
|
||||
this.actor = new St.Bin({ x: 0,
|
||||
y: 0,
|
||||
style_class: 'lightbox',
|
||||
reactive: params.inhibitEvents });
|
||||
|
||||
container.add_actor(this.actor);
|
||||
this.actor.raise_top();
|
||||
|
@ -503,7 +503,7 @@ const Inspector = new Lang.Class({
|
||||
let container = new Shell.GenericContainer({ width: 0,
|
||||
height: 0 });
|
||||
container.connect('allocate', Lang.bind(this, this._allocate));
|
||||
Main.uiGroup.add_actor(container);
|
||||
Main.layoutManager.sessionGroup.add_actor(container);
|
||||
|
||||
let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
|
||||
vertical: false,
|
||||
@ -670,13 +670,13 @@ const Extensions = new Lang.Class({
|
||||
_onViewSource: function (actor) {
|
||||
let extension = actor._extension;
|
||||
let uri = extension.dir.get_uri();
|
||||
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context());
|
||||
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));
|
||||
this._lookingGlass.close();
|
||||
},
|
||||
|
||||
_onWebPage: function (actor) {
|
||||
let extension = actor._extension;
|
||||
Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context());
|
||||
Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context(0, -1));
|
||||
this._lookingGlass.close();
|
||||
},
|
||||
|
||||
@ -801,16 +801,14 @@ const LookingGlass = new Lang.Class({
|
||||
this._updateFont();
|
||||
|
||||
// We want it to appear to slide out from underneath the panel
|
||||
Main.uiGroup.add_actor(this.actor);
|
||||
Main.uiGroup.set_child_below_sibling(this.actor,
|
||||
Main.layoutManager.panelBox);
|
||||
Main.layoutManager.panelBox.connect('allocation-changed',
|
||||
Lang.bind(this, this._queueResize));
|
||||
Main.layoutManager.sessionGroup.add_actor(this.actor);
|
||||
Main.layoutManager.panelGroup.connect('allocation-changed',
|
||||
Lang.bind(this, this._queueResize));
|
||||
Main.layoutManager.keyboardBox.connect('allocation-changed',
|
||||
Lang.bind(this, this._queueResize));
|
||||
|
||||
this._objInspector = new ObjInspector(this);
|
||||
Main.uiGroup.add_actor(this._objInspector.actor);
|
||||
Main.layoutManager.sessionGroup.add_actor(this._objInspector.actor);
|
||||
this._objInspector.actor.hide();
|
||||
|
||||
let toolbar = new St.BoxLayout({ name: 'Toolbar' });
|
||||
@ -1037,7 +1035,7 @@ const LookingGlass = new Lang.Class({
|
||||
let availableHeight = primary.height - Main.layoutManager.keyboardBox.height;
|
||||
let myHeight = Math.min(primary.height * 0.7, availableHeight * 0.9);
|
||||
this.actor.x = primary.x + (primary.width - myWidth) / 2;
|
||||
this._hiddenY = primary.y + Main.layoutManager.panelBox.height - myHeight - 4; // -4 to hide the top corners
|
||||
this._hiddenY = primary.y + Main.layoutManager.panelGroup.height - myHeight - 4; // -4 to hide the top corners
|
||||
this._targetY = this._hiddenY + myHeight;
|
||||
this.actor.y = this._hiddenY;
|
||||
this.actor.width = myWidth;
|
||||
|
@ -1184,7 +1184,7 @@ const ZoomRegion = new Lang.Class({
|
||||
|
||||
// Clone the group that contains all of UI on the screen. This is the
|
||||
// chrome, the windows, etc.
|
||||
this._uiGroupClone = new Clutter.Clone({ source: Main.uiGroup });
|
||||
this._uiGroupClone = new Clutter.Clone({ source: Main.layoutManager.uiGroup });
|
||||
mainGroup.add_actor(this._uiGroupClone);
|
||||
|
||||
// Add either the given mouseSourceActor to the ZoomRegion, or a clone of
|
||||
|
@ -64,7 +64,6 @@ let screencastService = null;
|
||||
let modalCount = 0;
|
||||
let keybindingMode = Shell.KeyBindingMode.NONE;
|
||||
let modalActorFocusStack = [];
|
||||
let uiGroup = null;
|
||||
let magnifier = null;
|
||||
let xdndHandler = null;
|
||||
let keyboard = null;
|
||||
@ -150,11 +149,6 @@ function _initializeUI() {
|
||||
// Setup the stage hierarchy early
|
||||
layoutManager = new Layout.LayoutManager();
|
||||
|
||||
// Various parts of the codebase still refers to Main.uiGroup
|
||||
// instead using the layoutManager. This keeps that code
|
||||
// working until it's updated.
|
||||
uiGroup = layoutManager.uiGroup;
|
||||
|
||||
screencastService = new Screencast.ScreencastService();
|
||||
xdndHandler = new XdndHandler.XdndHandler();
|
||||
ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
|
||||
@ -172,6 +166,19 @@ function _initializeUI() {
|
||||
windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
|
||||
componentManager = new Components.ComponentManager();
|
||||
|
||||
if (sessionMode.isGreeter && screenShield) {
|
||||
layoutManager.connect('startup-prepared', function() {
|
||||
screenShield.showDialog();
|
||||
});
|
||||
}
|
||||
|
||||
layoutManager.connect('startup-complete', function() {
|
||||
if (keybindingMode == Shell.KeyBindingMode.NONE)
|
||||
keybindingMode = Shell.KeyBindingMode.NORMAL;
|
||||
if (screenShield)
|
||||
screenShield.lockIfWasLocked();
|
||||
});
|
||||
|
||||
layoutManager.init();
|
||||
overview.init();
|
||||
|
||||
@ -202,21 +209,6 @@ function _initializeUI() {
|
||||
|
||||
ExtensionDownloader.init();
|
||||
ExtensionSystem.init();
|
||||
|
||||
if (sessionMode.isGreeter && screenShield) {
|
||||
layoutManager.connect('startup-prepared', function() {
|
||||
screenShield.showDialog();
|
||||
});
|
||||
}
|
||||
|
||||
layoutManager.connect('startup-complete', function() {
|
||||
if (keybindingMode == Shell.KeyBindingMode.NONE) {
|
||||
keybindingMode = Shell.KeyBindingMode.NORMAL;
|
||||
}
|
||||
if (screenShield) {
|
||||
screenShield.lockIfWasLocked();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _loadDefaultStylesheet() {
|
||||
|
@ -19,7 +19,6 @@ const BoxPointer = imports.ui.boxpointer;
|
||||
const CtrlAltTab = imports.ui.ctrlAltTab;
|
||||
const GnomeSession = imports.misc.gnomeSession;
|
||||
const GrabHelper = imports.ui.grabHelper;
|
||||
const Hash = imports.misc.hash;
|
||||
const Lightbox = imports.ui.lightbox;
|
||||
const Main = imports.ui.main;
|
||||
const PointerWatcher = imports.ui.pointerWatcher;
|
||||
@ -204,7 +203,7 @@ const URLHighlighter = new Lang.Class({
|
||||
if (url.indexOf(':') == -1)
|
||||
url = 'http://' + url;
|
||||
|
||||
Gio.app_info_launch_default_for_uri(url, global.create_app_launch_context());
|
||||
Gio.app_info_launch_default_for_uri(url, global.create_app_launch_context(0, -1));
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
@ -1002,6 +1001,9 @@ const Notification = new Lang.Class({
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
Lang.bind(this,
|
||||
function() {
|
||||
if (this._destroyed)
|
||||
return false;
|
||||
|
||||
if (this._canExpandContent()) {
|
||||
this._addBannerBody();
|
||||
this._table.add_style_class_name('multi-line-notification');
|
||||
@ -1609,7 +1611,7 @@ const MessageTrayMenu = new Lang.Class({
|
||||
this._accountManager.prepare_async(null, Lang.bind(this, this._onIMPresenceChanged));
|
||||
|
||||
this.actor.hide();
|
||||
Main.layoutManager.addChrome(this.actor);
|
||||
Main.layoutManager.menuGroup.add_child(this.actor);
|
||||
|
||||
this._busyItem = new PopupMenu.PopupSwitchMenuItem(_("Notifications"));
|
||||
this._busyItem.connect('toggled', Lang.bind(this, this._updatePresence));
|
||||
@ -1899,7 +1901,7 @@ const MessageTray = new Lang.Class({
|
||||
Shell.KeyBindingMode.OVERVIEW,
|
||||
Lang.bind(this, this._expandActiveNotification));
|
||||
|
||||
this._sources = new Hash.Map();
|
||||
this._sources = new Map();
|
||||
this._chatSummaryItemsCount = 0;
|
||||
|
||||
this._trayDwellTimeoutId = 0;
|
||||
@ -1936,7 +1938,7 @@ const MessageTray = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateNoMessagesLabel: function() {
|
||||
this._noMessages.visible = this._sources.size() == 0;
|
||||
this._noMessages.visible = this._sources.size == 0;
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
@ -2099,7 +2101,8 @@ const MessageTray = new Lang.Class({
|
||||
},
|
||||
|
||||
_removeSource: function(source) {
|
||||
let [, obj] = this._sources.delete(source);
|
||||
let obj = this._sources.get(source);
|
||||
this._sources.delete(source);
|
||||
let summaryItem = obj.summaryItem;
|
||||
|
||||
if (source.isChat)
|
||||
@ -2120,7 +2123,7 @@ const MessageTray = new Lang.Class({
|
||||
},
|
||||
|
||||
getSources: function() {
|
||||
return this._sources.keys();
|
||||
return [k for (k of this._sources.keys())];
|
||||
},
|
||||
|
||||
_onSourceEnableChanged: function(policy, source) {
|
||||
@ -2509,7 +2512,7 @@ const MessageTray = new Lang.Class({
|
||||
let cloneSource = Main.overview.visible ? Main.layoutManager.overviewGroup : global.window_group;
|
||||
this._desktopClone = new Clutter.Clone({ source: cloneSource,
|
||||
clip: new Clutter.Geometry(this._bottomMonitorGeometry) });
|
||||
Main.uiGroup.insert_child_above(this._desktopClone, cloneSource);
|
||||
Main.layoutManager.sessionGroup.insert_child_above(this._desktopClone, cloneSource);
|
||||
this._desktopClone.x = 0;
|
||||
this._desktopClone.y = 0;
|
||||
this._desktopClone.show();
|
||||
|
@ -41,7 +41,7 @@ const ModalDialog = new Lang.Class({
|
||||
_init: function(params) {
|
||||
params = Params.parse(params, { shellReactive: false,
|
||||
styleClass: null,
|
||||
parentActor: Main.uiGroup,
|
||||
parentActor: Main.layoutManager.dialogGroup,
|
||||
keybindingMode: Shell.KeyBindingMode.SYSTEM_MODAL,
|
||||
shouldFadeIn: true,
|
||||
destroyOnClose: true });
|
||||
@ -89,7 +89,8 @@ const ModalDialog = new Lang.Class({
|
||||
|
||||
if (!this._shellReactive) {
|
||||
this._lightbox = new Lightbox.Lightbox(this._group,
|
||||
{ inhibitEvents: true });
|
||||
{ inhibitEvents: true,
|
||||
radialEffect: true });
|
||||
this._lightbox.highlight(this._backgroundBin);
|
||||
|
||||
this._eventBlocker = new Clutter.Actor({ reactive: true });
|
||||
|
@ -66,6 +66,7 @@ const LevelBar = new Lang.Class({
|
||||
cr.arc(radius, h - radius, radius, 0.5 * Math.PI, Math.PI);
|
||||
cr.arc(radius, radius, radius, Math.PI, 1.5 * Math.PI);
|
||||
cr.fill();
|
||||
cr.$dispose();
|
||||
}
|
||||
});
|
||||
|
||||
@ -109,7 +110,7 @@ const OsdWindow = new Lang.Class({
|
||||
Lang.bind(this, this._monitorsChanged));
|
||||
this._monitorsChanged();
|
||||
|
||||
Main.uiGroup.add_child(this.actor);
|
||||
Main.layoutManager.osdGroup.add_child(this.actor);
|
||||
},
|
||||
|
||||
setIcon: function(icon) {
|
||||
@ -124,13 +125,15 @@ const OsdWindow = new Lang.Class({
|
||||
|
||||
setLevel: function(level) {
|
||||
this._level.actor.visible = (level != undefined);
|
||||
if (this.actor.visible)
|
||||
Tweener.addTween(this._level,
|
||||
{ level: level,
|
||||
time: LEVEL_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad' });
|
||||
else
|
||||
this._level.level = level;
|
||||
if (level) {
|
||||
if (this.actor.visible)
|
||||
Tweener.addTween(this._level,
|
||||
{ level: level,
|
||||
time: LEVEL_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad' });
|
||||
else
|
||||
this._level.level = level;
|
||||
}
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
@ -131,7 +131,7 @@ const Overview = new Lang.Class({
|
||||
Main.layoutManager.overviewGroup.add_child(this._backgroundGroup);
|
||||
this._bgManagers = [];
|
||||
|
||||
this._desktopFade = new St.Bin();
|
||||
this._desktopFade = new St.Widget();
|
||||
Main.layoutManager.overviewGroup.add_child(this._desktopFade);
|
||||
|
||||
this._activationTime = 0;
|
||||
@ -493,8 +493,8 @@ const Overview = new Lang.Class({
|
||||
},
|
||||
|
||||
fadeOutDesktop: function() {
|
||||
if (!this._desktopFade.child)
|
||||
this._desktopFade.child = this._getDesktopClone();
|
||||
if (!this._desktopFade.get_n_children())
|
||||
this._desktopFade.add_child(this._getDesktopClone());
|
||||
|
||||
this._desktopFade.opacity = 255;
|
||||
this._desktopFade.show();
|
||||
@ -622,7 +622,7 @@ const Overview = new Lang.Class({
|
||||
this.animationInProgress = true;
|
||||
this.visibleTarget = false;
|
||||
|
||||
this.viewSelector.zoomFromOverview();
|
||||
this.viewSelector.leaveOverview();
|
||||
|
||||
// Make other elements fade out.
|
||||
Tweener.addTween(this._stack,
|
||||
|
@ -825,8 +825,10 @@ const AggregateMenu = new Lang.Class({
|
||||
this._brightness = new imports.ui.status.brightness.Indicator();
|
||||
this._system = new imports.ui.status.system.Indicator();
|
||||
this._screencast = new imports.ui.status.screencast.Indicator();
|
||||
this._location = new imports.ui.status.location.Indicator();
|
||||
|
||||
this._indicators.add_child(this._screencast.indicators);
|
||||
this._indicators.add_child(this._location.indicators);
|
||||
this._indicators.add_child(this._network.indicators);
|
||||
if (this._bluetooth) {
|
||||
this._indicators.add_child(this._bluetooth.indicators);
|
||||
@ -899,7 +901,7 @@ const Panel = new Lang.Class({
|
||||
this.actor.remove_style_pseudo_class('overview');
|
||||
}));
|
||||
|
||||
Main.layoutManager.panelBox.add(this.actor);
|
||||
Main.layoutManager.panelGroup.add_child(this.actor);
|
||||
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'emblem-system-symbolic',
|
||||
{ sortGroup: CtrlAltTab.SortGroup.TOP });
|
||||
|
||||
|
@ -130,7 +130,7 @@ const Button = new Lang.Class({
|
||||
this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
|
||||
this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress));
|
||||
|
||||
Main.uiGroup.add_actor(this.menu.actor);
|
||||
Main.layoutManager.menuGroup.add_child(this.menu.actor);
|
||||
this.menu.actor.hide();
|
||||
}
|
||||
},
|
||||
|
@ -283,7 +283,7 @@ const RemoteSearchProvider = new Lang.Class({
|
||||
// the provider is not compatible with the new version of the interface, launch
|
||||
// the app itself but warn so we can catch the error in logs
|
||||
log('Search provider ' + this.appInfo.get_id() + ' does not implement LaunchSearch');
|
||||
this.appInfo.launch([], global.create_app_launch_context());
|
||||
this.appInfo.launch([], global.create_app_launch_context(0, -1));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -233,7 +233,7 @@ const RunDialog = new Lang.Class({
|
||||
let file = Gio.file_new_for_path(path);
|
||||
try {
|
||||
Gio.app_info_launch_default_for_uri(file.get_uri(),
|
||||
global.create_app_launch_context());
|
||||
global.create_app_launch_context(0, -1));
|
||||
} catch (e) {
|
||||
// The exception from gjs contains an error string like:
|
||||
// Error invoking Gio.app_info_launch_default_for_uri: No application
|
||||
|
@ -17,7 +17,6 @@ const TweenerEquations = imports.tweener.equations;
|
||||
|
||||
const Background = imports.ui.background;
|
||||
const GnomeSession = imports.misc.gnomeSession;
|
||||
const Hash = imports.misc.hash;
|
||||
const Layout = imports.ui.layout;
|
||||
const OVirt = imports.gdm.oVirt;
|
||||
const LoginManager = imports.misc.loginManager;
|
||||
@ -115,7 +114,7 @@ const NotificationsBox = new Lang.Class({
|
||||
this.actor.add(this._musicBin);
|
||||
this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START });
|
||||
|
||||
this._sources = new Hash.Map();
|
||||
this._sources = new Map();
|
||||
Main.messageTray.getSources().forEach(Lang.bind(this, function(source) {
|
||||
this._sourceAdded(Main.messageTray, source, true);
|
||||
}));
|
||||
@ -130,9 +129,8 @@ const NotificationsBox = new Lang.Class({
|
||||
this._sourceAddedId = 0;
|
||||
}
|
||||
|
||||
let items = this._sources.items();
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let [source, obj] = items[i];
|
||||
let items = this._sources.entries();
|
||||
for (let [source, obj] of items) {
|
||||
this._removeSource(source, obj);
|
||||
}
|
||||
|
||||
@ -415,6 +413,7 @@ const Arrow = new Lang.Class({
|
||||
cr.lineTo(w/2, thickness);
|
||||
cr.lineTo(w - thickness / 2, h - thickness / 2);
|
||||
cr.stroke();
|
||||
cr.$dispose();
|
||||
},
|
||||
|
||||
vfunc_style_changed: function() {
|
||||
@ -457,8 +456,6 @@ const ScreenShield = new Lang.Class({
|
||||
Name: 'ScreenShield',
|
||||
|
||||
_init: function() {
|
||||
this.actor = Main.layoutManager.screenShieldGroup;
|
||||
|
||||
this._lockScreenState = MessageTray.State.HIDDEN;
|
||||
this._lockScreenGroup = new St.Widget({ x_expand: true,
|
||||
y_expand: true,
|
||||
@ -467,6 +464,7 @@ const ScreenShield = new Lang.Class({
|
||||
name: 'lockScreenGroup',
|
||||
visible: false,
|
||||
});
|
||||
|
||||
this._lockScreenGroup.connect('key-press-event',
|
||||
Lang.bind(this, this._onLockScreenKeyPress));
|
||||
this._lockScreenGroup.connect('scroll-event',
|
||||
@ -517,10 +515,9 @@ const ScreenShield = new Lang.Class({
|
||||
reactive: true,
|
||||
pivot_point: new Clutter.Point({ x: 0.5, y: 0.5 }),
|
||||
name: 'lockDialogGroup' });
|
||||
Main.layoutManager.systemGroup.add_child(this._lockDialogGroup);
|
||||
|
||||
this.actor.add_actor(this._lockDialogGroup);
|
||||
this.actor.add_actor(this._lockScreenGroup);
|
||||
|
||||
Main.layoutManager.screenShieldGroup.add_child(this._lockScreenGroup);
|
||||
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
|
||||
if (error) {
|
||||
logError(error, 'Error while reading gnome-session presence');
|
||||
@ -578,19 +575,27 @@ const ScreenShield = new Lang.Class({
|
||||
// The "long" lightbox is used for the longer (20 seconds) fade from session
|
||||
// to idle status, the "short" is used for quickly fading to black when locking
|
||||
// manually
|
||||
this._longLightbox = new Lightbox.Lightbox(Main.uiGroup,
|
||||
this._longLightbox = new Lightbox.Lightbox(Main.layoutManager.overlayGroup,
|
||||
{ inhibitEvents: true,
|
||||
fadeFactor: 1 });
|
||||
this._longLightbox.connect('shown', Lang.bind(this, this._onLongLightboxShown));
|
||||
this._shortLightbox = new Lightbox.Lightbox(Main.uiGroup,
|
||||
this._shortLightbox = new Lightbox.Lightbox(Main.layoutManager.overlayGroup,
|
||||
{ inhibitEvents: true,
|
||||
fadeFactor: 1 });
|
||||
this._shortLightbox.connect('shown', Lang.bind(this, this._onShortLightboxShown));
|
||||
|
||||
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._monitorsChanged));
|
||||
this._monitorsChanged();
|
||||
|
||||
this.idleMonitor = Meta.IdleMonitor.get_core();
|
||||
this._cursorTracker = Meta.CursorTracker.get_for_screen(global.screen);
|
||||
},
|
||||
|
||||
_monitorsChanged: function() {
|
||||
this._longLightbox.actor.set_size(global.screen_width, global.screen_height);
|
||||
this._shortLightbox.actor.set_size(global.screen_width, global.screen_height);
|
||||
},
|
||||
|
||||
_createBackground: function(monitorIndex) {
|
||||
let monitor = Main.layoutManager.monitors[monitorIndex];
|
||||
let widget = new St.Widget({ style_class: 'screen-shield-background',
|
||||
@ -648,14 +653,14 @@ const ScreenShield = new Lang.Class({
|
||||
if (this._isModal)
|
||||
return true;
|
||||
|
||||
this._isModal = Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
|
||||
this._isModal = Main.pushModal(this._lockDialogGroup, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
|
||||
if (this._isModal)
|
||||
return true;
|
||||
|
||||
// We failed to get a pointer grab, it means that
|
||||
// something else has it. Try with a keyboard grab only
|
||||
this._isModal = Main.pushModal(this.actor, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED,
|
||||
keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
|
||||
this._isModal = Main.pushModal(this._lockDialogGroup, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED,
|
||||
keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
|
||||
return this._isModal;
|
||||
},
|
||||
|
||||
@ -913,7 +918,7 @@ const ScreenShield = new Lang.Class({
|
||||
return false;
|
||||
}));
|
||||
|
||||
this.actor.show();
|
||||
this._lockDialogGroup.show();
|
||||
this._isGreeter = Main.sessionMode.isGreeter;
|
||||
this._isLocked = true;
|
||||
if (this._ensureUnlockDialog(true, true))
|
||||
@ -1003,6 +1008,7 @@ const ScreenShield = new Lang.Class({
|
||||
return;
|
||||
|
||||
this._ensureLockScreen();
|
||||
this._lockDialogGroup.hide();
|
||||
this._lockDialogGroup.scale_x = 1;
|
||||
this._lockDialogGroup.scale_y = 1;
|
||||
|
||||
@ -1101,8 +1107,10 @@ const ScreenShield = new Lang.Class({
|
||||
}));
|
||||
this._cursorTracker.set_pointer_visible(false);
|
||||
|
||||
this._lockScreenState = MessageTray.State.SHOWN;
|
||||
this._lockDialogGroup.show();
|
||||
this._lockScreenGroup.fixed_position_set = false;
|
||||
this._lockScreenState = MessageTray.State.SHOWN;
|
||||
Main.layoutManager.sessionGroup.hide();
|
||||
this._lockScreenScrollCounter = 0;
|
||||
|
||||
if (params.fadeToBlack && params.animateFade) {
|
||||
@ -1225,10 +1233,11 @@ const ScreenShield = new Lang.Class({
|
||||
this._dialog.popModal();
|
||||
|
||||
if (this._isModal) {
|
||||
Main.popModal(this.actor);
|
||||
Main.popModal(this._lockDialogGroup);
|
||||
this._isModal = false;
|
||||
}
|
||||
|
||||
Main.layoutManager.sessionGroup.show();
|
||||
Tweener.addTween(this._lockDialogGroup, {
|
||||
scale_x: 0,
|
||||
scale_y: 0,
|
||||
@ -1247,7 +1256,7 @@ const ScreenShield = new Lang.Class({
|
||||
|
||||
this._longLightbox.hide();
|
||||
this._shortLightbox.hide();
|
||||
this.actor.hide();
|
||||
this._lockScreenGroup.hide();
|
||||
|
||||
if (this._becameActiveId != 0) {
|
||||
this.idleMonitor.remove_watch(this._becameActiveId);
|
||||
@ -1271,7 +1280,7 @@ const ScreenShield = new Lang.Class({
|
||||
if (this._activationTime == 0)
|
||||
this._activationTime = GLib.get_monotonic_time();
|
||||
|
||||
this.actor.show();
|
||||
this._lockScreenGroup.show();
|
||||
|
||||
if (Main.sessionMode.currentMode != 'unlock-dialog' &&
|
||||
Main.sessionMode.currentMode != 'lock-screen') {
|
||||
|
@ -6,7 +6,6 @@ const Lang = imports.lang;
|
||||
const Shell = imports.gi.Shell;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const Hash = imports.misc.hash;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const ScreencastIface = '<node> \
|
||||
@ -42,13 +41,13 @@ const ScreencastService = new Lang.Class({
|
||||
|
||||
Gio.DBus.session.own_name('org.gnome.Shell.Screencast', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||
|
||||
this._recorders = new Hash.Map();
|
||||
this._recorders = new Map();
|
||||
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
},
|
||||
|
||||
get isRecording() {
|
||||
return this._recorders.size() > 0;
|
||||
return this._recorders.size > 0;
|
||||
},
|
||||
|
||||
_ensureRecorderForSender: function(sender) {
|
||||
@ -69,8 +68,7 @@ const ScreencastService = new Lang.Class({
|
||||
if (Main.sessionMode.allowScreencast)
|
||||
return;
|
||||
|
||||
for (let sender in this._recorders.keys())
|
||||
this._recorders.delete(sender);
|
||||
this._recorders.clear();
|
||||
this.emit('updated');
|
||||
},
|
||||
|
||||
|
@ -146,7 +146,7 @@ const SelectArea = new Lang.Class({
|
||||
reactive: true,
|
||||
x: 0,
|
||||
y: 0 });
|
||||
Main.uiGroup.add_actor(this._group);
|
||||
Main.layoutManager.osdGroup.add_actor(this._group);
|
||||
|
||||
this._group.connect('button-press-event',
|
||||
Lang.bind(this, this._onButtonPress));
|
||||
@ -259,9 +259,9 @@ const Flashspot = new Lang.Class({
|
||||
Extends: Lightbox.Lightbox,
|
||||
|
||||
_init: function(area) {
|
||||
this.parent(Main.uiGroup, { inhibitEvents: true,
|
||||
width: area.width,
|
||||
height: area.height });
|
||||
this.parent(Main.layoutManager.osdGroup, { inhibitEvents: true,
|
||||
width: area.width,
|
||||
height: area.height });
|
||||
|
||||
this.actor.style_class = 'flashspot';
|
||||
this.actor.set_position(area.x, area.y);
|
||||
|
@ -10,7 +10,6 @@ const Config = imports.misc.config;
|
||||
const ExtensionSystem = imports.ui.extensionSystem;
|
||||
const ExtensionDownloader = imports.ui.extensionDownloader;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Hash = imports.misc.hash;
|
||||
const Main = imports.ui.main;
|
||||
const Screenshot = imports.ui.screenshot;
|
||||
const ViewSelector = imports.ui.viewSelector;
|
||||
@ -83,8 +82,8 @@ const GnomeShell = new Lang.Class({
|
||||
this._extensionsService = new GnomeShellExtensions();
|
||||
this._screenshotService = new Screenshot.ScreenshotService();
|
||||
|
||||
this._grabbedAccelerators = new Hash.Map();
|
||||
this._grabbers = new Hash.Map();
|
||||
this._grabbedAccelerators = new Map();
|
||||
this._grabbers = new Map();
|
||||
|
||||
global.display.connect('accelerator-activated', Lang.bind(this,
|
||||
function(display, action, deviceid, timestamp) {
|
||||
@ -228,9 +227,8 @@ const GnomeShell = new Lang.Class({
|
||||
},
|
||||
|
||||
_onGrabberBusNameVanished: function(connection, name) {
|
||||
let grabs = this._grabbedAccelerators.items();
|
||||
for (let i = 0; i < grabs.length; i++) {
|
||||
let [action, sender] = grabs[i];
|
||||
let grabs = this._grabbedAccelerators.entries();
|
||||
for (let [action, sender] of grabs) {
|
||||
if (sender == name)
|
||||
this._ungrabAccelerator(action);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ const EntryMenu = new Lang.Class({
|
||||
|
||||
this._passwordItem = null;
|
||||
|
||||
Main.uiGroup.add_actor(this.actor);
|
||||
Main.layoutManager.menuGroup.add_actor(this.actor);
|
||||
this.actor.hide();
|
||||
},
|
||||
|
||||
|
58
js/ui/status/location.js
Normal file
58
js/ui/status/location.js
Normal file
@ -0,0 +1,58 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const Lang = imports.lang;
|
||||
|
||||
const PanelMenu = imports.ui.panelMenu;
|
||||
|
||||
var GeoclueIface = '<node> \
|
||||
<interface name="org.freedesktop.GeoClue2.Manager"> \
|
||||
<property name="InUse" type="b" access="read"/> \
|
||||
</interface> \
|
||||
</node>';
|
||||
|
||||
const GeoclueManager = Gio.DBusProxy.makeProxyWrapper(GeoclueIface);
|
||||
|
||||
const Indicator = new Lang.Class({
|
||||
Name: 'LocationIndicator',
|
||||
Extends: PanelMenu.SystemIndicator,
|
||||
|
||||
_init: function() {
|
||||
this.parent();
|
||||
|
||||
this._indicator = this._addIndicator();
|
||||
this._indicator.icon_name = 'find-location-symbolic';
|
||||
this._sync();
|
||||
|
||||
this._watchId = Gio.bus_watch_name(Gio.BusType.SYSTEM,
|
||||
'org.freedesktop.GeoClue2',
|
||||
0,
|
||||
Lang.bind(this, this._onGeoclueAppeared),
|
||||
Lang.bind(this, this._onGeoclueVanished));
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
if (this._proxy == null) {
|
||||
this._indicator.visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this._indicator.visible = this._proxy.InUse;
|
||||
},
|
||||
|
||||
_onGeoclueAppeared: function() {
|
||||
// FIXME: This should be done async
|
||||
this._proxy = new GeoclueManager(Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
'/org/freedesktop/GeoClue2/Manager');
|
||||
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
|
||||
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_onGeoclueVanished: function() {
|
||||
this._proxy = null;
|
||||
|
||||
this._sync();
|
||||
}
|
||||
});
|
@ -11,7 +11,6 @@ const NMGtk = imports.gi.NMGtk;
|
||||
const Signals = imports.signals;
|
||||
const St = imports.gi.St;
|
||||
|
||||
const Hash = imports.misc.hash;
|
||||
const Main = imports.ui.main;
|
||||
const PanelMenu = imports.ui.panelMenu;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
@ -22,6 +21,7 @@ const Util = imports.misc.util;
|
||||
|
||||
const NMConnectionCategory = {
|
||||
INVALID: 'invalid',
|
||||
WIRED: 'wired',
|
||||
WIRELESS: 'wireless',
|
||||
WWAN: 'wwan',
|
||||
VPN: 'vpn'
|
||||
@ -176,7 +176,7 @@ const NMConnectionSection = new Lang.Class({
|
||||
_init: function(client) {
|
||||
this._client = client;
|
||||
|
||||
this._connectionItems = new Hash.Map();
|
||||
this._connectionItems = new Map();
|
||||
this._connections = [];
|
||||
|
||||
this._labelSection = new PopupMenu.PopupMenuSection();
|
||||
@ -194,7 +194,7 @@ const NMConnectionSection = new Lang.Class({
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
let nItems = this._connectionItems.size();
|
||||
let nItems = this._connectionItems.size;
|
||||
|
||||
this._switchSection.actor.visible = (nItems > 1);
|
||||
this._labelSection.actor.visible = (nItems == 1);
|
||||
@ -213,8 +213,7 @@ const NMConnectionSection = new Lang.Class({
|
||||
|
||||
_getStatus: function() {
|
||||
let values = this._connectionItems.values();
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
let item = values[i];
|
||||
for (let item of values) {
|
||||
if (item.isActive())
|
||||
return item.getName();
|
||||
}
|
||||
@ -298,6 +297,11 @@ const NMConnectionDevice = new Lang.Class({
|
||||
this._activeConnectionChangedId = this._device.connect('notify::active-connection', Lang.bind(this, this._activeConnectionChanged));
|
||||
},
|
||||
|
||||
_autoConnect: function() {
|
||||
let connection = new NetworkManager.Connection();
|
||||
this._client.add_and_activate_connection(connection, this._device, null, null);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
if (this._stateChangedId) {
|
||||
GObject.Object.prototype.disconnect.call(this._device, this._stateChangedId);
|
||||
@ -305,7 +309,7 @@ const NMConnectionDevice = new Lang.Class({
|
||||
}
|
||||
if (this._activeConnectionChangedId) {
|
||||
GObject.Object.prototype.disconnect.call(this._device, this._activeConnectionChangedId);
|
||||
this._stateChangedId = 0;
|
||||
this._activeConnectionChangedId = 0;
|
||||
}
|
||||
|
||||
this.parent();
|
||||
@ -365,7 +369,7 @@ const NMConnectionDevice = new Lang.Class({
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
let nItems = this._connectionItems.size();
|
||||
let nItems = this._connectionItems.size;
|
||||
this._autoConnectItem.actor.visible = (nItems == 0);
|
||||
this.parent();
|
||||
},
|
||||
@ -415,6 +419,48 @@ const NMConnectionDevice = new Lang.Class({
|
||||
},
|
||||
});
|
||||
|
||||
const NMDeviceWired = new Lang.Class({
|
||||
Name: 'NMDeviceWired',
|
||||
Extends: NMConnectionDevice,
|
||||
category: NMConnectionCategory.WIRED,
|
||||
|
||||
_init: function(client, device, settings) {
|
||||
this.parent(client, device, settings);
|
||||
|
||||
this.item.menu.addMenuItem(createSettingsAction(_("Wired Settings"), device));
|
||||
},
|
||||
|
||||
_isConnected: function() {
|
||||
if (!this._device.active_connection)
|
||||
return false;
|
||||
|
||||
let state = this._device.active_connection.state;
|
||||
return state >= NetworkManager.ActiveConnectionState.ACTIVATING;
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
this.item.actor.visible = this._isConnected();
|
||||
this.parent();
|
||||
},
|
||||
|
||||
_getMenuIcon: function() {
|
||||
if (this._device.active_connection)
|
||||
return this.getIndicatorIcon();
|
||||
else
|
||||
return 'network-wired-disconnected-symbolic';
|
||||
},
|
||||
|
||||
getIndicatorIcon: function() {
|
||||
let state = this._device.active_connection.state;
|
||||
if (state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
||||
return 'network-wired-acquiring-symbolic';
|
||||
else if (state == NetworkManager.ActiveConnectionState.ACTIVATED)
|
||||
return 'network-wired-symbolic';
|
||||
else
|
||||
return 'network-wired-disconnected-symbolic';
|
||||
}
|
||||
});
|
||||
|
||||
const NMDeviceModem = new Lang.Class({
|
||||
Name: 'NMDeviceModem',
|
||||
Extends: NMConnectionDevice,
|
||||
@ -512,18 +558,6 @@ const NMDeviceBluetooth = new Lang.Class({
|
||||
this.item.menu.addMenuItem(createSettingsAction(_("Mobile Broadband Settings"), device));
|
||||
},
|
||||
|
||||
_autoConnect: function() {
|
||||
// FIXME: DUN devices are configured like modems, so
|
||||
// We need to spawn the mobile wizard
|
||||
// but the network panel doesn't support bluetooth at the moment
|
||||
// so we just create an empty connection and hope
|
||||
// that this phone supports PAN
|
||||
|
||||
let connection = new NetworkManager.Connection();
|
||||
this._client.add_and_activate_connection(connection, this._device, null, null);
|
||||
return true;
|
||||
},
|
||||
|
||||
_getMenuIcon: function() {
|
||||
if (this._device.active_connection)
|
||||
return this.getIndicatorIcon();
|
||||
@ -611,7 +645,7 @@ const NMWirelessDialog = new Lang.Class({
|
||||
Name: 'NMWirelessDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function(client, device, settings) {
|
||||
_init: function(client, device) {
|
||||
this.parent({ styleClass: 'nm-dialog' });
|
||||
|
||||
this._client = client;
|
||||
@ -620,10 +654,7 @@ const NMWirelessDialog = new Lang.Class({
|
||||
this._networks = [];
|
||||
this._buildLayout();
|
||||
|
||||
let connections = settings.list_connections();
|
||||
this._connections = connections.filter(Lang.bind(this, function(connection) {
|
||||
return device.connection_valid(connection);
|
||||
}));
|
||||
this._connections = device.get_available_connections();
|
||||
|
||||
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
|
||||
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
|
||||
@ -735,16 +766,11 @@ const NMWirelessDialog = new Lang.Class({
|
||||
|
||||
_connect: function() {
|
||||
let network = this._selectedNetwork;
|
||||
let accessPoints = network.accessPoints;
|
||||
if (network.connections.length > 0) {
|
||||
let connection = network.connections[0];
|
||||
for (let i = 0; i < accessPoints.length; i++) {
|
||||
if (accessPoints[i].connection_valid(connection)) {
|
||||
this._client.activate_connection(connection, this._device, accessPoints[i].dbus_path, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this._client.activate_connection(connection, this._device, null, null);
|
||||
} else {
|
||||
let accessPoints = network.accessPoints;
|
||||
if ((accessPoints[0]._secType == NMAccessPointSecurity.WPA2_ENT)
|
||||
|| (accessPoints[0]._secType == NMAccessPointSecurity.WPA_ENT)) {
|
||||
// 802.1x-enabled APs require further configuration, so they're
|
||||
@ -978,10 +1004,9 @@ const NMDeviceWireless = new Lang.Class({
|
||||
Name: 'NMDeviceWireless',
|
||||
category: NMConnectionCategory.WIRELESS,
|
||||
|
||||
_init: function(client, device, settings) {
|
||||
_init: function(client, device) {
|
||||
this._client = client;
|
||||
this._device = device;
|
||||
this._settings = settings;
|
||||
|
||||
this._description = '';
|
||||
|
||||
@ -1049,7 +1074,7 @@ const NMDeviceWireless = new Lang.Class({
|
||||
},
|
||||
|
||||
_showDialog: function() {
|
||||
this._dialog = new NMWirelessDialog(this._client, this._device, this._settings);
|
||||
this._dialog = new NMWirelessDialog(this._client, this._device);
|
||||
this._dialog.connect('closed', Lang.bind(this, this._dialogClosed));
|
||||
this._dialog.open();
|
||||
},
|
||||
@ -1217,7 +1242,7 @@ const NMVPNSection = new Lang.Class({
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
let nItems = this._connectionItems.size();
|
||||
let nItems = this._connectionItems.size;
|
||||
this.item.actor.visible = (nItems > 0);
|
||||
this.parent();
|
||||
},
|
||||
@ -1239,9 +1264,10 @@ const NMVPNSection = new Lang.Class({
|
||||
},
|
||||
|
||||
setActiveConnections: function(vpnConnections) {
|
||||
this._connectionItems.values().forEach(function(item) {
|
||||
let connections = this._connectionItems.values();
|
||||
for (let item of connections) {
|
||||
item.setActiveConnection(null);
|
||||
});
|
||||
}
|
||||
vpnConnections.forEach(Lang.bind(this, function(a) {
|
||||
let item = this._connectionItems.get(a._connection.get_uuid());
|
||||
item.setActiveConnection(a);
|
||||
@ -1254,8 +1280,7 @@ const NMVPNSection = new Lang.Class({
|
||||
|
||||
getIndicatorIcon: function() {
|
||||
let items = this._connectionItems.values();
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let item = items[i];
|
||||
for (let item of items) {
|
||||
let icon = item.getIndicatorIcon();
|
||||
if (icon)
|
||||
return icon;
|
||||
@ -1277,6 +1302,7 @@ const NMApplet = new Lang.Class({
|
||||
|
||||
// Device types
|
||||
this._dtypes = { };
|
||||
this._dtypes[NetworkManager.DeviceType.ETHERNET] = NMDeviceWired;
|
||||
this._dtypes[NetworkManager.DeviceType.WIFI] = NMDeviceWireless;
|
||||
this._dtypes[NetworkManager.DeviceType.MODEM] = NMDeviceModem;
|
||||
this._dtypes[NetworkManager.DeviceType.BT] = NMDeviceBluetooth;
|
||||
@ -1284,6 +1310,7 @@ const NMApplet = new Lang.Class({
|
||||
|
||||
// Connection types
|
||||
this._ctypes = { };
|
||||
this._ctypes[NetworkManager.SETTING_WIRED_SETTING_NAME] = NMConnectionCategory.WIRED;
|
||||
this._ctypes[NetworkManager.SETTING_WIRELESS_SETTING_NAME] = NMConnectionCategory.WIRELESS;
|
||||
this._ctypes[NetworkManager.SETTING_BLUETOOTH_SETTING_NAME] = NMConnectionCategory.WWAN;
|
||||
this._ctypes[NetworkManager.SETTING_CDMA_SETTING_NAME] = NMConnectionCategory.WWAN;
|
||||
@ -1306,6 +1333,15 @@ const NMApplet = new Lang.Class({
|
||||
this._tryLateInit();
|
||||
},
|
||||
|
||||
_createDeviceCategory: function() {
|
||||
let category = {
|
||||
section: new PopupMenu.PopupMenuSection(),
|
||||
devices: [ ],
|
||||
};
|
||||
this.menu.addMenuItem(category.section);
|
||||
return category;
|
||||
},
|
||||
|
||||
_tryLateInit: function() {
|
||||
if (!this._client || !this._settings)
|
||||
return;
|
||||
@ -1321,17 +1357,9 @@ const NMApplet = new Lang.Class({
|
||||
this._nmDevices = [];
|
||||
this._devices = { };
|
||||
|
||||
this._devices.wireless = {
|
||||
section: new PopupMenu.PopupMenuSection(),
|
||||
devices: [ ],
|
||||
};
|
||||
this.menu.addMenuItem(this._devices.wireless.section);
|
||||
|
||||
this._devices.wwan = {
|
||||
section: new PopupMenu.PopupMenuSection(),
|
||||
devices: [ ],
|
||||
};
|
||||
this.menu.addMenuItem(this._devices.wwan.section);
|
||||
this._devices.wired = this._createDeviceCategory();
|
||||
this._devices.wireless = this._createDeviceCategory();
|
||||
this._devices.wwan = this._createDeviceCategory();
|
||||
|
||||
this._vpnSection = new NMVPNSection(this._client);
|
||||
this._vpnSection.connect('activation-failed', Lang.bind(this, this._onActivationFailed));
|
||||
|
@ -54,7 +54,7 @@ const SwitcherPopup = new Lang.Class({
|
||||
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
|
||||
Main.uiGroup.add_actor(this.actor);
|
||||
Main.layoutManager.switcherPopupGroup.add_child(this.actor);
|
||||
|
||||
this._haveModal = false;
|
||||
this._modifierMask = 0;
|
||||
@ -452,10 +452,9 @@ const SwitcherList = new Lang.Class({
|
||||
time: POPUP_SCROLL_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function () {
|
||||
if (this._highlighted == 0) {
|
||||
if (this._highlighted == 0)
|
||||
this._scrollableLeft = false;
|
||||
this.actor.queue_relayout();
|
||||
}
|
||||
this.actor.queue_relayout();
|
||||
})
|
||||
});
|
||||
},
|
||||
@ -477,10 +476,9 @@ const SwitcherList = new Lang.Class({
|
||||
time: POPUP_SCROLL_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function () {
|
||||
if (this._highlighted == this._items.length - 1) {
|
||||
if (this._highlighted == this._items.length - 1)
|
||||
this._scrollableRight = false;
|
||||
this.actor.queue_relayout();
|
||||
}
|
||||
this.actor.queue_relayout();
|
||||
})
|
||||
});
|
||||
},
|
||||
@ -515,7 +513,7 @@ const SwitcherList = new Lang.Class({
|
||||
_getPreferredWidth: function (actor, forHeight, alloc) {
|
||||
let [maxChildMin, maxChildNat] = this._maxChildWidth(forHeight);
|
||||
|
||||
let totalSpacing = this._list.spacing * (this._items.length - 1);
|
||||
let totalSpacing = Math.max(this._list.spacing * (this._items.length - 1), 0);
|
||||
alloc.min_size = this._items.length * maxChildMin + totalSpacing;
|
||||
alloc.natural_size = alloc.min_size;
|
||||
this._minSize = alloc.min_size;
|
||||
@ -545,7 +543,7 @@ const SwitcherList = new Lang.Class({
|
||||
let childHeight = box.y2 - box.y1;
|
||||
|
||||
let [maxChildMin, maxChildNat] = this._maxChildWidth(childHeight);
|
||||
let totalSpacing = this._list.spacing * (this._items.length - 1);
|
||||
let totalSpacing = Math.max(this._list.spacing * (this._items.length - 1), 0);
|
||||
|
||||
let childWidth = Math.floor(Math.max(0, box.x2 - box.x1 - totalSpacing) / this._items.length);
|
||||
|
||||
|
@ -118,13 +118,11 @@ const ViewSelector = new Lang.Class({
|
||||
this._stageKeyPressId = 0;
|
||||
Main.overview.connect('showing', Lang.bind(this,
|
||||
function () {
|
||||
this._resetShowAppsButton();
|
||||
this._stageKeyPressId = global.stage.connect('key-press-event',
|
||||
Lang.bind(this, this._onStageKeyPress));
|
||||
}));
|
||||
Main.overview.connect('hiding', Lang.bind(this,
|
||||
function () {
|
||||
this._resetShowAppsButton();
|
||||
if (this._stageKeyPressId != 0) {
|
||||
global.stage.disconnect(this._stageKeyPressId);
|
||||
this._stageKeyPressId = 0;
|
||||
@ -160,19 +158,26 @@ const ViewSelector = new Lang.Class({
|
||||
show: function() {
|
||||
this.reset();
|
||||
|
||||
this._showAppsBlocked = true;
|
||||
this._showAppsButton.checked = false;
|
||||
this._showAppsBlocked = false;
|
||||
|
||||
this._workspacesPage.opacity = 255;
|
||||
this._workspacesDisplay.show();
|
||||
this._activePage = null;
|
||||
this._showPage(this._workspacesPage);
|
||||
this._syncActivePage();
|
||||
|
||||
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
|
||||
Main.overview.fadeOutDesktop();
|
||||
},
|
||||
|
||||
zoomFromOverview: function() {
|
||||
this._workspacesDisplay.zoomFromOverview();
|
||||
|
||||
leaveOverview: function() {
|
||||
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
|
||||
Main.overview.fadeInDesktop();
|
||||
|
||||
// If we're not on the windows page, don't zoom back the primary monitor.
|
||||
let zoomPrimary = (this._activePage == this._workspacesPage);
|
||||
this._workspacesDisplay.leaveOverview(zoomPrimary);
|
||||
},
|
||||
|
||||
setWorkspacesFullGeometry: function(geom) {
|
||||
@ -181,6 +186,9 @@ const ViewSelector = new Lang.Class({
|
||||
|
||||
hide: function() {
|
||||
this._workspacesDisplay.hide();
|
||||
if (this._activePage)
|
||||
this._activePage.hide();
|
||||
this._activePage = null;
|
||||
},
|
||||
|
||||
_addPage: function(actor, name, a11yIcon, params) {
|
||||
@ -215,13 +223,13 @@ const ViewSelector = new Lang.Class({
|
||||
this._activePage.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||
this._activePage.show();
|
||||
Tweener.addTween(this._activePage,
|
||||
{ opacity: 255,
|
||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad'
|
||||
});
|
||||
{ opacity: 255,
|
||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad'
|
||||
});
|
||||
},
|
||||
|
||||
_showPage: function(page, noFade) {
|
||||
_setActivePage: function(page) {
|
||||
if (page == this._activePage)
|
||||
return;
|
||||
|
||||
@ -229,7 +237,7 @@ const ViewSelector = new Lang.Class({
|
||||
this._activePage = page;
|
||||
this.emit('page-changed');
|
||||
|
||||
if (oldPage && !noFade)
|
||||
if (oldPage)
|
||||
Tweener.addTween(oldPage,
|
||||
{ opacity: 0,
|
||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||
@ -248,20 +256,25 @@ const ViewSelector = new Lang.Class({
|
||||
page.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||
},
|
||||
|
||||
_onShowAppsButtonToggled: function() {
|
||||
if (this._showAppsBlocked)
|
||||
return;
|
||||
|
||||
this._showPage(this._showAppsButton.checked ?
|
||||
this._appsPage : this._workspacesPage);
|
||||
_getActivePage: function() {
|
||||
if (this._searchActive)
|
||||
return this._searchPage;
|
||||
else if (this._showAppsButton.checked)
|
||||
return this._appsPage;
|
||||
else
|
||||
return this._workspacesPage;
|
||||
},
|
||||
|
||||
_resetShowAppsButton: function() {
|
||||
this._showAppsBlocked = true;
|
||||
this._showAppsButton.checked = false;
|
||||
this._showAppsBlocked = false;
|
||||
_syncActivePage: function() {
|
||||
let activePage = this._getActivePage();
|
||||
if (activePage == this._activePage)
|
||||
return;
|
||||
this._setActivePage(activePage);
|
||||
},
|
||||
|
||||
this._showPage(this._workspacesPage, true);
|
||||
_onShowAppsButtonToggled: function() {
|
||||
if (!this._showAppsBlocked)
|
||||
this._syncActivePage();
|
||||
},
|
||||
|
||||
_onStageKeyPress: function(actor, event) {
|
||||
@ -287,20 +300,6 @@ const ViewSelector = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_searchCancelled: function() {
|
||||
this._showPage(this._showAppsButton.checked ? this._appsPage
|
||||
: this._workspacesPage);
|
||||
|
||||
// Leave the entry focused when it doesn't have any text;
|
||||
// when replacing a selected search term, Clutter emits
|
||||
// two 'text-changed' signals, one for deleting the previous
|
||||
// text and one for the new one - the second one is handled
|
||||
// incorrectly when we remove focus
|
||||
// (https://bugzilla.gnome.org/show_bug.cgi?id=636341) */
|
||||
if (this._text.text != '')
|
||||
this.reset();
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
global.stage.set_key_focus(null);
|
||||
|
||||
@ -391,8 +390,18 @@ const ViewSelector = new Lang.Class({
|
||||
}
|
||||
|
||||
this._entry.set_secondary_icon(null);
|
||||
this._searchCancelled();
|
||||
|
||||
// Leave the entry focused when it doesn't have any text;
|
||||
// when replacing a selected search term, Clutter emits
|
||||
// two 'text-changed' signals, one for deleting the previous
|
||||
// text and one for the new one - the second one is handled
|
||||
// incorrectly when we remove focus
|
||||
// (https://bugzilla.gnome.org/show_bug.cgi?id=636341) */
|
||||
if (this._text.text != '')
|
||||
this.reset();
|
||||
}
|
||||
|
||||
this._syncActivePage();
|
||||
},
|
||||
|
||||
_onKeyPress: function(entry, event) {
|
||||
@ -459,9 +468,7 @@ const ViewSelector = new Lang.Class({
|
||||
this._searchTimeoutId = 0;
|
||||
|
||||
let terms = getTermsForSearchString(this._entry.get_text());
|
||||
|
||||
this._searchResults.setTerms(terms);
|
||||
this._showPage(this._searchPage);
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
@ -475,13 +482,6 @@ const ViewSelector = new Lang.Class({
|
||||
return ViewPage.SEARCH;
|
||||
},
|
||||
|
||||
setActivePage: function(page) {
|
||||
if (page == ViewPage.WINDOWS)
|
||||
this._showPage(this._workspacesPage);
|
||||
else
|
||||
this._showPage(this._appsPage);
|
||||
},
|
||||
|
||||
fadeIn: function() {
|
||||
let actor = this._activePage;
|
||||
Tweener.addTween(actor, { opacity: 255,
|
||||
|
@ -16,7 +16,7 @@ const WindowAttentionHandler = new Lang.Class({
|
||||
|
||||
_getTitleAndBanner: function(app, window) {
|
||||
let title = app.get_name();
|
||||
let banner = _("'%s' is ready").format(window.get_title());
|
||||
let banner = _("“%s” is ready").format(window.get_title());
|
||||
return [title, banner]
|
||||
},
|
||||
|
||||
|
@ -232,12 +232,13 @@ const WorkspaceTracker = new Lang.Class({
|
||||
|
||||
let windows = global.get_window_actors();
|
||||
for (i = 0; i < windows.length; i++) {
|
||||
let win = windows[i];
|
||||
let actor = windows[i];
|
||||
let win = actor.get_meta_window();
|
||||
|
||||
if (win.get_meta_window().is_on_all_workspaces())
|
||||
if (win.is_on_all_workspaces())
|
||||
continue;
|
||||
|
||||
let workspaceIndex = win.get_workspace();
|
||||
let workspaceIndex = win.get_workspace().index();
|
||||
emptyWorkspaces[workspaceIndex] = false;
|
||||
}
|
||||
|
||||
@ -555,6 +556,12 @@ const WindowManager = new Lang.Class({
|
||||
Shell.KeyBindingMode.LOGIN_SCREEN,
|
||||
Lang.bind(this, this._startA11ySwitcher));
|
||||
|
||||
this.addKeybinding('pause-resume-tweens',
|
||||
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.NONE,
|
||||
Shell.KeyBindingMode.ALL,
|
||||
Lang.bind(this, this._toggleTweens));
|
||||
|
||||
this.addKeybinding('open-application-menu',
|
||||
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.NONE,
|
||||
@ -742,15 +749,13 @@ const WindowManager = new Lang.Class({
|
||||
if (shouldDim && !window._dimmed) {
|
||||
window._dimmed = true;
|
||||
this._dimmedWindows.push(window);
|
||||
if (!Main.overview.visible)
|
||||
this._dimWindow(window);
|
||||
this._dimWindow(window);
|
||||
} else if (!shouldDim && window._dimmed) {
|
||||
window._dimmed = false;
|
||||
this._dimmedWindows = this._dimmedWindows.filter(function(win) {
|
||||
return win != window;
|
||||
});
|
||||
if (!Main.overview.visible)
|
||||
this._undimWindow(window);
|
||||
this._undimWindow(window);
|
||||
}
|
||||
},
|
||||
|
||||
@ -975,25 +980,29 @@ const WindowManager = new Lang.Class({
|
||||
wgroup.add_actor(switchData.movingWindowBin);
|
||||
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
let window = windows[i];
|
||||
let actor = windows[i];
|
||||
let window = actor.get_meta_window();
|
||||
|
||||
if (!window.meta_window.showing_on_its_workspace())
|
||||
if (!window.showing_on_its_workspace())
|
||||
continue;
|
||||
|
||||
if (this._movingWindow && window.meta_window == this._movingWindow) {
|
||||
switchData.movingWindow = { window: window,
|
||||
parent: window.get_parent() };
|
||||
if (window.is_on_all_workspaces())
|
||||
continue;
|
||||
|
||||
let record = { window: actor,
|
||||
parent: actor.get_parent() };
|
||||
|
||||
if (this._movingWindow && window == this._movingWindow) {
|
||||
switchData.movingWindow = record;
|
||||
switchData.windows.push(switchData.movingWindow);
|
||||
window.reparent(switchData.movingWindowBin);
|
||||
} else if (window.get_workspace() == from) {
|
||||
switchData.windows.push({ window: window,
|
||||
parent: window.get_parent() });
|
||||
window.reparent(switchData.outGroup);
|
||||
} else if (window.get_workspace() == to) {
|
||||
switchData.windows.push({ window: window,
|
||||
parent: window.get_parent() });
|
||||
window.reparent(switchData.inGroup);
|
||||
window.show();
|
||||
actor.reparent(switchData.movingWindowBin);
|
||||
} else if (window.get_workspace().index() == from) {
|
||||
switchData.windows.push(record);
|
||||
actor.reparent(switchData.outGroup);
|
||||
} else if (window.get_workspace().index() == to) {
|
||||
switchData.windows.push(record);
|
||||
actor.reparent(switchData.inGroup);
|
||||
actor.show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,6 +1092,15 @@ const WindowManager = new Lang.Class({
|
||||
Main.panel.toggleAppMenu();
|
||||
},
|
||||
|
||||
_toggleTweens: function() {
|
||||
this._tweensPaused = !this._tweensPaused;
|
||||
const OrigTweener = imports.tweener.tweener;
|
||||
if (this._tweensPaused)
|
||||
OrigTweener.pauseAllTweens();
|
||||
else
|
||||
OrigTweener.resumeAllTweens();
|
||||
},
|
||||
|
||||
_showWorkspaceSwitcher : function(display, screen, window, binding) {
|
||||
if (!Main.sessionMode.hasWorkspaces)
|
||||
return;
|
||||
|
@ -14,6 +14,7 @@ const DND = imports.ui.dnd;
|
||||
const Main = imports.ui.main;
|
||||
const Overview = imports.ui.overview;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const WindowManager = imports.ui.windowManager;
|
||||
|
||||
const WINDOW_DND_SIZE = 256;
|
||||
|
||||
@ -35,6 +36,68 @@ function _interpolate(start, end, step) {
|
||||
return start + (end - start) * step;
|
||||
}
|
||||
|
||||
const WindowCloneLayout = new Lang.Class({
|
||||
Name: 'WindowCloneLayout',
|
||||
Extends: Clutter.LayoutManager,
|
||||
|
||||
_init: function(boundingBox) {
|
||||
this.parent();
|
||||
|
||||
this._boundingBox = boundingBox;
|
||||
},
|
||||
|
||||
get boundingBox() {
|
||||
return this._boundingBox;
|
||||
},
|
||||
|
||||
set boundingBox(b) {
|
||||
this._boundingBox = b;
|
||||
this.layout_changed();
|
||||
},
|
||||
|
||||
_makeBoxForWindow: function(window) {
|
||||
// We need to adjust the position of the actor because of the
|
||||
// consequences of invisible borders -- in reality, the texture
|
||||
// has an extra set of "padding" around it that we need to trim
|
||||
// down.
|
||||
|
||||
// The outer rect (from which we compute the bounding box)
|
||||
// paradoxically is the smaller rectangle, containing the positions
|
||||
// of the visible frame. The input rect contains everything,
|
||||
// including the invisible border padding.
|
||||
let inputRect = window.get_input_rect();
|
||||
|
||||
let box = new Clutter.ActorBox();
|
||||
|
||||
box.set_origin(inputRect.x - this._boundingBox.x,
|
||||
inputRect.y - this._boundingBox.y);
|
||||
box.set_size(inputRect.width, inputRect.height);
|
||||
|
||||
return box;
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(container, forWidth) {
|
||||
return [this._boundingBox.height, this._boundingBox.height];
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(container, forHeight) {
|
||||
return [this._boundingBox.width, this._boundingBox.width];
|
||||
},
|
||||
|
||||
vfunc_allocate: function(container, box, flags) {
|
||||
let clone = container.get_children().forEach(function (child) {
|
||||
let realWindow;
|
||||
if (child == container._delegate._windowClone)
|
||||
realWindow = container._delegate.realWindow;
|
||||
else
|
||||
realWindow = child.source;
|
||||
|
||||
child.allocate(this._makeBoxForWindow(realWindow.meta_window),
|
||||
flags);
|
||||
}, this);
|
||||
},
|
||||
});
|
||||
|
||||
const WindowClone = new Lang.Class({
|
||||
Name: 'WindowClone',
|
||||
|
||||
@ -44,10 +107,7 @@ const WindowClone = new Lang.Class({
|
||||
this.metaWindow._delegate = this;
|
||||
this._workspace = workspace;
|
||||
|
||||
let [borderX, borderY] = this._getInvisibleBorderPadding();
|
||||
this._windowClone = new Clutter.Clone({ source: realWindow.get_texture(),
|
||||
x: -borderX,
|
||||
y: -borderY });
|
||||
this._windowClone = new Clutter.Clone({ source: realWindow.get_texture() });
|
||||
// We expect this.actor to be used for all interaction rather than
|
||||
// this._windowClone; as the former is reactive and the latter
|
||||
// is not, this just works for most cases. However, for DND all
|
||||
@ -55,21 +115,13 @@ const WindowClone = new Lang.Class({
|
||||
// To avoid this, we hide it from pick.
|
||||
Shell.util_set_hidden_from_pick(this._windowClone, true);
|
||||
|
||||
this.origX = realWindow.x + borderX;
|
||||
this.origY = realWindow.y + borderY;
|
||||
|
||||
let outerRect = realWindow.meta_window.get_outer_rect();
|
||||
|
||||
// The MetaShapedTexture that we clone has a size that includes
|
||||
// the invisible border; this is inconvenient; rather than trying
|
||||
// to compensate all over the place we insert a ClutterActor into
|
||||
// the hierarchy that is sized to only the visible portion.
|
||||
this.actor = new St.Widget({ reactive: true,
|
||||
can_focus: true,
|
||||
x: this.origX,
|
||||
y: this.origY,
|
||||
width: outerRect.width,
|
||||
height: outerRect.height });
|
||||
layout_manager: new WindowCloneLayout() });
|
||||
|
||||
this.actor.add_child(this._windowClone);
|
||||
|
||||
@ -79,10 +131,19 @@ const WindowClone = new Lang.Class({
|
||||
this._dragSlot = [0, 0, 0, 0];
|
||||
this._stackAbove = null;
|
||||
|
||||
this._sizeChangedId = this.realWindow.connect('size-changed',
|
||||
this._windowClone._updateId = this.realWindow.connect('size-changed',
|
||||
Lang.bind(this, this._onRealWindowSizeChanged));
|
||||
this._realWindowDestroyId = this.realWindow.connect('destroy',
|
||||
Lang.bind(this, this._disconnectRealWindowSignals));
|
||||
this._windowClone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() {
|
||||
// First destroy the clone and then destroy everything
|
||||
// This will ensure that we never see it in the _disconnectSignals loop
|
||||
this._windowClone.destroy();
|
||||
this.destroy();
|
||||
}));
|
||||
|
||||
this._updateAttachedDialogs();
|
||||
this._computeBoundingBox();
|
||||
this.actor.x = this._boundingBox.x;
|
||||
this.actor.y = this._boundingBox.y;
|
||||
|
||||
let clickAction = new Clutter.ClickAction();
|
||||
clickAction.connect('clicked', Lang.bind(this, this._onClicked));
|
||||
@ -116,6 +177,83 @@ const WindowClone = new Lang.Class({
|
||||
return this._slot;
|
||||
},
|
||||
|
||||
deleteAll: function() {
|
||||
// Delete all windows, starting from the bottom-most (most-modal) one
|
||||
|
||||
let windows = this.actor.get_children();
|
||||
for (let i = windows.length - 1; i >= 1; i--) {
|
||||
let realWindow = windows[i].source;
|
||||
let metaWindow = realWindow.meta_window;
|
||||
|
||||
metaWindow.delete(global.get_current_time());
|
||||
}
|
||||
|
||||
this.metaWindow.delete(global.get_current_time());
|
||||
},
|
||||
|
||||
addAttachedDialog: function(win) {
|
||||
this._doAddAttachedDialog(win, win.get_compositor_private());
|
||||
this._computeBoundingBox();
|
||||
this.emit('size-changed');
|
||||
},
|
||||
|
||||
_doAddAttachedDialog: function(metaWin, realWin) {
|
||||
let clone = new Clutter.Clone({ source: realWin });
|
||||
clone._updateId = realWin.connect('size-changed', Lang.bind(this, function() {
|
||||
this._computeBoundingBox();
|
||||
this.emit('size-changed');
|
||||
}));
|
||||
clone._destroyId = realWin.connect('destroy', Lang.bind(this, function() {
|
||||
clone.destroy();
|
||||
|
||||
this._computeBoundingBox();
|
||||
this.emit('size-changed');
|
||||
}));
|
||||
this.actor.add_child(clone);
|
||||
},
|
||||
|
||||
_updateAttachedDialogs: function() {
|
||||
let iter = Lang.bind(this, function(win) {
|
||||
let actor = win.get_compositor_private();
|
||||
|
||||
if (!actor)
|
||||
return false;
|
||||
if (!win.is_attached_dialog())
|
||||
return false;
|
||||
|
||||
this._doAddAttachedDialog(win, actor);
|
||||
win.foreach_transient(iter);
|
||||
return true;
|
||||
});
|
||||
this.metaWindow.foreach_transient(iter);
|
||||
},
|
||||
|
||||
get boundingBox() {
|
||||
return this._boundingBox;
|
||||
},
|
||||
|
||||
getOriginalPosition: function() {
|
||||
return [this._boundingBox.x, this._boundingBox.y];
|
||||
},
|
||||
|
||||
_computeBoundingBox: function() {
|
||||
let rect = this.metaWindow.get_outer_rect();
|
||||
|
||||
this.actor.get_children().forEach(function (child) {
|
||||
let realWindow;
|
||||
if (child == this._windowClone)
|
||||
realWindow = this.realWindow;
|
||||
else
|
||||
realWindow = child.source;
|
||||
|
||||
let metaWindow = realWindow.meta_window;
|
||||
rect = rect.union(metaWindow.get_outer_rect());
|
||||
}, this);
|
||||
|
||||
this._boundingBox = rect;
|
||||
this.actor.layout_manager.boundingBox = rect;
|
||||
},
|
||||
|
||||
// Find the actor just below us, respecting reparenting done
|
||||
// by DND code
|
||||
getActualStackAbove: function() {
|
||||
@ -149,44 +287,26 @@ const WindowClone = new Lang.Class({
|
||||
this.actor.destroy();
|
||||
},
|
||||
|
||||
_disconnectRealWindowSignals: function() {
|
||||
if (this._sizeChangedId > 0)
|
||||
this.realWindow.disconnect(this._sizeChangedId);
|
||||
this._sizeChangedId = 0;
|
||||
_disconnectSignals: function() {
|
||||
this.actor.get_children().forEach(Lang.bind(this, function (child) {
|
||||
let realWindow;
|
||||
if (child == this._windowClone)
|
||||
realWindow = this.realWindow;
|
||||
else
|
||||
realWindow = child.source;
|
||||
|
||||
if (this._realWindowDestroyId > 0)
|
||||
this.realWindow.disconnect(this._realWindowDestroyId);
|
||||
this._realWindowDestroyId = 0;
|
||||
},
|
||||
|
||||
_getInvisibleBorderPadding: function() {
|
||||
// We need to adjust the position of the actor because of the
|
||||
// consequences of invisible borders -- in reality, the texture
|
||||
// has an extra set of "padding" around it that we need to trim
|
||||
// down.
|
||||
|
||||
// The outer rect paradoxically is the smaller rectangle,
|
||||
// containing the positions of the visible frame. The input
|
||||
// rect contains everything, including the invisible border
|
||||
// padding.
|
||||
let outerRect = this.metaWindow.get_outer_rect();
|
||||
let inputRect = this.metaWindow.get_input_rect();
|
||||
let [borderX, borderY] = [outerRect.x - inputRect.x,
|
||||
outerRect.y - inputRect.y];
|
||||
|
||||
return [borderX, borderY];
|
||||
realWindow.disconnect(child._updateId);
|
||||
realWindow.disconnect(child._destroyId);
|
||||
}));
|
||||
},
|
||||
|
||||
_onRealWindowSizeChanged: function() {
|
||||
let [borderX, borderY] = this._getInvisibleBorderPadding();
|
||||
let outerRect = this.metaWindow.get_outer_rect();
|
||||
this.actor.set_size(outerRect.width, outerRect.height);
|
||||
this._windowClone.set_position(-borderX, -borderY);
|
||||
this._computeBoundingBox();
|
||||
this.emit('size-changed');
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
this._disconnectRealWindowSignals();
|
||||
this._disconnectSignals();
|
||||
|
||||
this.metaWindow._delegate = null;
|
||||
this.actor._delegate = null;
|
||||
@ -454,7 +574,7 @@ const WindowOverlay = new Lang.Class({
|
||||
Lang.bind(this,
|
||||
this._onWindowAdded));
|
||||
|
||||
metaWindow.delete(global.get_current_time());
|
||||
this._windowClone.deleteAll();
|
||||
},
|
||||
|
||||
_windowCanClose: function() {
|
||||
@ -1321,9 +1441,29 @@ const Workspace = new Lang.Class({
|
||||
if (this._lookupIndex (metaWin) != -1)
|
||||
return;
|
||||
|
||||
if (!this._isMyWindow(win) || !this._isOverviewWindow(win))
|
||||
if (!this._isMyWindow(win))
|
||||
return;
|
||||
|
||||
if (!this._isOverviewWindow(win)) {
|
||||
if (metaWin.is_attached_dialog()) {
|
||||
let parent = metaWin.get_transient_for();
|
||||
while (parent.is_attached_dialog())
|
||||
parent = metaWin.get_transient_for();
|
||||
|
||||
let idx = this._lookupIndex (parent);
|
||||
if (idx < 0) {
|
||||
// parent was not created yet, it will take care
|
||||
// of the dialog when created
|
||||
return;
|
||||
}
|
||||
|
||||
let clone = this._windows[idx];
|
||||
clone.addAttachedDialog(metaWin);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let [clone, overlay] = this._addWindowClone(win, false);
|
||||
|
||||
if (win._overviewHint) {
|
||||
@ -1381,39 +1521,46 @@ const Workspace = new Lang.Class({
|
||||
this._recalculateWindowPositions(WindowPositionFlags.ANIMATE | WindowPositionFlags.INITIAL);
|
||||
},
|
||||
|
||||
// Animates the return from Overview mode
|
||||
zoomFromOverview : function() {
|
||||
_leavingOverview: function() {
|
||||
let currentWorkspace = global.screen.get_active_workspace();
|
||||
if (this.metaWorkspace != null && this.metaWorkspace != currentWorkspace)
|
||||
return false;
|
||||
|
||||
this.leavingOverview = true;
|
||||
this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this,
|
||||
this._doneLeavingOverview));
|
||||
|
||||
for (let i = 0; i < this._windows.length; i++) {
|
||||
let clone = this._windows[i];
|
||||
Tweener.removeTweens(clone.actor);
|
||||
|
||||
let overlay = this._windowOverlays[i];
|
||||
if (overlay)
|
||||
overlay.hide();
|
||||
}
|
||||
|
||||
if (this._repositionWindowsId > 0) {
|
||||
Mainloop.source_remove(this._repositionWindowsId);
|
||||
this._repositionWindowsId = 0;
|
||||
}
|
||||
this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this,
|
||||
this._doneLeavingOverview));
|
||||
|
||||
if (this.metaWorkspace != null && this.metaWorkspace != currentWorkspace)
|
||||
return true;
|
||||
},
|
||||
|
||||
// Animates the return from Overview mode
|
||||
zoomFromOverview : function() {
|
||||
if (!this._leavingOverview())
|
||||
return;
|
||||
|
||||
// Position and scale the windows.
|
||||
for (let i = 0; i < this._windows.length; i++) {
|
||||
let clone = this._windows[i];
|
||||
let overlay = this._windowOverlays[i];
|
||||
|
||||
if (overlay)
|
||||
overlay.hide();
|
||||
|
||||
if (clone.metaWindow.showing_on_its_workspace()) {
|
||||
let [origX, origY] = clone.getOriginalPosition();
|
||||
|
||||
Tweener.addTween(clone.actor,
|
||||
{ x: clone.origX,
|
||||
y: clone.origY,
|
||||
{ x: origX,
|
||||
y: origY,
|
||||
scale_x: 1.0,
|
||||
scale_y: 1.0,
|
||||
time: Overview.ANIMATION_TIME,
|
||||
@ -1433,6 +1580,31 @@ const Workspace = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
fadeFromOverview: function() {
|
||||
if (!this._leavingOverview())
|
||||
return;
|
||||
|
||||
for (let i = 0; i < this._windows.length; i++) {
|
||||
let clone = this._windows[i];
|
||||
|
||||
if (clone.metaWindow.showing_on_its_workspace()) {
|
||||
clone.actor.x = clone.origX;
|
||||
clone.actor.y = clone.origY;
|
||||
clone.actor.scale_x = 1.0;
|
||||
clone.actor.scale_y = 1.0;
|
||||
clone.actor.opacity = 0;
|
||||
|
||||
Tweener.addTween(clone.actor,
|
||||
{ opacity: 255,
|
||||
time: Overview.ANIMATION_TIME,
|
||||
transition: 'easeOutQuad'
|
||||
});
|
||||
} else {
|
||||
clone.actor.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
destroy : function() {
|
||||
this.actor.destroy();
|
||||
},
|
||||
@ -1477,8 +1649,7 @@ const Workspace = new Lang.Class({
|
||||
|
||||
// Tests if @win should be shown in the Overview
|
||||
_isOverviewWindow : function (win) {
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
return tracker.is_window_interesting(win.get_meta_window());
|
||||
return !win.get_meta_window().skip_taskbar;
|
||||
},
|
||||
|
||||
// Create a clone of a (non-desktop) window and add it to the window list
|
||||
|
@ -25,7 +25,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
|
||||
width: global.screen_width,
|
||||
height: global.screen_height,
|
||||
style_class: 'workspace-switcher-group' });
|
||||
Main.uiGroup.add_actor(this.actor);
|
||||
Main.layoutManager.osdGroup.add_child(this.actor);
|
||||
|
||||
this._container = new St.BoxLayout({ style_class: 'workspace-switcher-container' });
|
||||
this._list = new Shell.GenericContainer({ style_class: 'workspace-switcher' });
|
||||
|
@ -14,6 +14,7 @@ const Background = imports.ui.background;
|
||||
const DND = imports.ui.dnd;
|
||||
const Main = imports.ui.main;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const WindowManager = imports.ui.windowManager;
|
||||
const Workspace = imports.ui.workspace;
|
||||
const WorkspacesView = imports.ui.workspacesView;
|
||||
|
||||
@ -32,20 +33,49 @@ const WORKSPACE_KEEP_ALIVE_TIME = 100;
|
||||
|
||||
const OVERRIDE_SCHEMA = 'org.gnome.shell.overrides';
|
||||
|
||||
/* A layout manager that requests size only for primary_actor, but then allocates
|
||||
all using a fixed layout */
|
||||
const PrimaryActorLayout = new Lang.Class({
|
||||
Name: 'PrimaryActorLayout',
|
||||
Extends: Clutter.FixedLayout,
|
||||
|
||||
_init: function(primaryActor) {
|
||||
this.parent();
|
||||
|
||||
this.primaryActor = primaryActor;
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(forHeight) {
|
||||
return this.primaryActor.get_preferred_width(forHeight);
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(forWidth) {
|
||||
return this.primaryActor.get_preferred_height(forWidth);
|
||||
},
|
||||
});
|
||||
|
||||
const WindowClone = new Lang.Class({
|
||||
Name: 'WindowClone',
|
||||
|
||||
_init : function(realWindow) {
|
||||
this.actor = new Clutter.Clone({ source: realWindow.get_texture(),
|
||||
this.clone = new Clutter.Clone({ source: realWindow });
|
||||
|
||||
/* Can't use a Shell.GenericContainer because of DND and reparenting... */
|
||||
this.actor = new Clutter.Actor({ layout_manager: new PrimaryActorLayout(this.clone),
|
||||
reactive: true });
|
||||
this.actor._delegate = this;
|
||||
this.actor.add_child(this.clone);
|
||||
this.realWindow = realWindow;
|
||||
this.metaWindow = realWindow.meta_window;
|
||||
|
||||
this._positionChangedId = this.realWindow.connect('position-changed',
|
||||
Lang.bind(this, this._onPositionChanged));
|
||||
this._realWindowDestroyedId = this.realWindow.connect('destroy',
|
||||
Lang.bind(this, this._disconnectRealWindowSignals));
|
||||
this.clone._updateId = this.realWindow.connect('position-changed',
|
||||
Lang.bind(this, this._onPositionChanged));
|
||||
this.clone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() {
|
||||
// First destroy the clone and then destroy everything
|
||||
// This will ensure that we never see it in the _disconnectSignals loop
|
||||
this.clone.destroy();
|
||||
this.destroy();
|
||||
}));
|
||||
this._onPositionChanged();
|
||||
|
||||
this.actor.connect('button-release-event',
|
||||
@ -61,6 +91,21 @@ const WindowClone = new Lang.Class({
|
||||
this._draggable.connect('drag-cancelled', Lang.bind(this, this._onDragCancelled));
|
||||
this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd));
|
||||
this.inDrag = false;
|
||||
|
||||
let iter = Lang.bind(this, function(win) {
|
||||
let actor = win.get_compositor_private();
|
||||
|
||||
if (!actor)
|
||||
return false;
|
||||
if (!win.is_attached_dialog())
|
||||
return false;
|
||||
|
||||
this._doAddAttachedDialog(win, actor);
|
||||
win.foreach_transient(iter);
|
||||
|
||||
return true;
|
||||
});
|
||||
this.metaWindow.foreach_transient(iter);
|
||||
},
|
||||
|
||||
// Find the actor just below us, respecting reparenting done
|
||||
@ -98,25 +143,46 @@ const WindowClone = new Lang.Class({
|
||||
this.actor.destroy();
|
||||
},
|
||||
|
||||
addAttachedDialog: function(win) {
|
||||
this._doAddAttachedDialog(win, win.get_compositor_private());
|
||||
},
|
||||
|
||||
_doAddAttachedDialog: function(metaDialog, realDialog) {
|
||||
let clone = new Clutter.Clone({ source: realDialog });
|
||||
this._updateDialogPosition(realDialog, clone);
|
||||
|
||||
clone._updateId = realDialog.connect('position-changed',
|
||||
Lang.bind(this, this._updateDialogPosition, clone));
|
||||
clone._destroyId = realDialog.connect('destroy', Lang.bind(this, function() {
|
||||
clone.destroy();
|
||||
}));
|
||||
this.actor.add_child(clone);
|
||||
},
|
||||
|
||||
_updateDialogPosition: function(realDialog, cloneDialog) {
|
||||
let metaDialog = realDialog.meta_window;
|
||||
let dialogRect = metaDialog.get_outer_rect();
|
||||
let rect = this.metaWindow.get_outer_rect();
|
||||
|
||||
cloneDialog.set_position(dialogRect.x - rect.x, dialogRect.y - rect.y);
|
||||
},
|
||||
|
||||
_onPositionChanged: function() {
|
||||
let rect = this.metaWindow.get_outer_rect();
|
||||
this.actor.set_position(this.realWindow.x, this.realWindow.y);
|
||||
},
|
||||
|
||||
_disconnectRealWindowSignals: function() {
|
||||
if (this._positionChangedId != 0) {
|
||||
this.realWindow.disconnect(this._positionChangedId);
|
||||
this._positionChangedId = 0;
|
||||
}
|
||||
_disconnectSignals: function() {
|
||||
this.actor.get_children().forEach(function(child) {
|
||||
let realWindow = child.source;
|
||||
|
||||
if (this._realWindowDestroyedId != 0) {
|
||||
this.realWindow.disconnect(this._realWindowDestroyedId);
|
||||
this._realWindowDestroyedId = 0;
|
||||
}
|
||||
realWindow.disconnect(child._updateId);
|
||||
realWindow.disconnect(child._destroyId);
|
||||
});
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
this._disconnectRealWindowSignals();
|
||||
this._disconnectSignals();
|
||||
|
||||
this.actor._delegate = null;
|
||||
|
||||
@ -344,10 +410,26 @@ const WorkspaceThumbnail = new Lang.Class({
|
||||
if (this._lookupIndex (metaWin) != -1)
|
||||
return;
|
||||
|
||||
if (!this._isMyWindow(win) || !this._isOverviewWindow(win))
|
||||
if (!this._isMyWindow(win))
|
||||
return;
|
||||
|
||||
let clone = this._addWindowClone(win);
|
||||
if (this._isOverviewWindow(win)) {
|
||||
this._addWindowClone(win);
|
||||
} else if (metaWin.is_attached_dialog()) {
|
||||
let parent = metaWin.get_transient_for();
|
||||
while (parent.is_attached_dialog())
|
||||
parent = metaWin.get_transient_for();
|
||||
|
||||
let idx = this._lookupIndex (parent);
|
||||
if (idx < 0) {
|
||||
// parent was not created yet, it will take care
|
||||
// of the dialog when created
|
||||
return;
|
||||
}
|
||||
|
||||
let clone = this._windows[idx];
|
||||
clone.addAttachedDialog(metaWin);
|
||||
}
|
||||
},
|
||||
|
||||
_windowAdded : function(metaWorkspace, metaWin) {
|
||||
@ -425,8 +507,7 @@ const WorkspaceThumbnail = new Lang.Class({
|
||||
|
||||
// Tests if @win should be shown in the Overview
|
||||
_isOverviewWindow : function (win) {
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
return tracker.is_window_interesting(win.get_meta_window()) &&
|
||||
return !win.get_meta_window().skip_taskbar &&
|
||||
win.get_meta_window().showing_on_its_workspace();
|
||||
},
|
||||
|
||||
|
@ -145,11 +145,22 @@ const WorkspacesView = new Lang.Class({
|
||||
this._updateWorkspaceActors(false);
|
||||
},
|
||||
|
||||
zoomFromOverview: function() {
|
||||
_leaveOverview: function() {
|
||||
this.actor.remove_clip();
|
||||
},
|
||||
|
||||
for (let w = 0; w < this._workspaces.length; w++)
|
||||
this._workspaces[w].zoomFromOverview();
|
||||
zoomFromOverview: function() {
|
||||
this._leaveOverview();
|
||||
this._workspaces.forEach(function(w) {
|
||||
w.zoomFromOverview();
|
||||
});
|
||||
},
|
||||
|
||||
fadeFromOverview: function() {
|
||||
this._leaveOverview();
|
||||
this._workspaces.forEach(function(w) {
|
||||
w.fadeFromOverview();
|
||||
});
|
||||
},
|
||||
|
||||
syncStacking: function(stackIndices) {
|
||||
@ -237,29 +248,32 @@ const WorkspacesView = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateWorkspaces: function() {
|
||||
let oldNumWorkspaces = this._workspaces.length;
|
||||
let newNumWorkspaces = global.screen.n_workspaces;
|
||||
|
||||
this.scrollAdjustment.upper = newNumWorkspaces;
|
||||
|
||||
if (newNumWorkspaces > oldNumWorkspaces) {
|
||||
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
||||
let metaWorkspace = global.screen.get_workspace_by_index(w);
|
||||
let workspace = new Workspace.Workspace(metaWorkspace, this._monitorIndex);
|
||||
this._workspaces.push(workspace);
|
||||
this.actor.add_actor(workspace.actor);
|
||||
}
|
||||
let needsUpdate = false;
|
||||
for (let j = 0; j < newNumWorkspaces; j++) {
|
||||
let metaWorkspace = global.screen.get_workspace_by_index(j);
|
||||
let workspace;
|
||||
|
||||
if (this._fullGeometry)
|
||||
this._updateWorkspaceActors(false);
|
||||
} else if (newNumWorkspaces < oldNumWorkspaces) {
|
||||
let nRemoved = (newNumWorkspaces - oldNumWorkspaces);
|
||||
let removed = this._workspaces.splice(oldNumWorkspaces, nRemoved);
|
||||
removed.forEach(function(workspace) {
|
||||
workspace.destroy();
|
||||
});
|
||||
if (j >= this._workspaces.length) { /* added */
|
||||
workspace = new Workspace.Workspace(metaWorkspace, this._monitorIndex);
|
||||
this.actor.add_actor(workspace.actor);
|
||||
this._workspaces[j] = workspace;
|
||||
} else {
|
||||
workspace = this._workspaces[j];
|
||||
|
||||
if (workspace.metaWorkspace != metaWorkspace) { /* removed */
|
||||
workspace.destroy();
|
||||
this._workspaces.splice(j, 1);
|
||||
} /* else kept */
|
||||
}
|
||||
}
|
||||
|
||||
if (this._fullGeometry)
|
||||
this._updateWorkspaceActors(false);
|
||||
|
||||
this._syncGeometry();
|
||||
},
|
||||
|
||||
@ -362,6 +376,10 @@ const ExtraWorkspaceView = new Lang.Class({
|
||||
this._workspace.zoomFromOverview();
|
||||
},
|
||||
|
||||
fadeFromOverview: function() {
|
||||
this._workspace.fadeFromOverview();
|
||||
},
|
||||
|
||||
syncStacking: function(stackIndices) {
|
||||
this._workspace.syncStacking(stackIndices);
|
||||
},
|
||||
@ -402,7 +420,7 @@ const WorkspacesDisplay = new Lang.Class({
|
||||
Main.overview.addAction(clickAction);
|
||||
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
||||
|
||||
let panAction = new Clutter.PanAction();
|
||||
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
|
||||
panAction.connect('pan', Lang.bind(this, this._onPan));
|
||||
panAction.connect('gesture-begin', Lang.bind(this, function() {
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
@ -410,7 +428,6 @@ const WorkspacesDisplay = new Lang.Class({
|
||||
return true;
|
||||
}));
|
||||
panAction.connect('gesture-cancel', Lang.bind(this, function() {
|
||||
clickAction.release();
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].endSwipeScroll();
|
||||
}));
|
||||
@ -464,9 +481,18 @@ const WorkspacesDisplay = new Lang.Class({
|
||||
this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
||||
},
|
||||
|
||||
zoomFromOverview: function() {
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].zoomFromOverview();
|
||||
leaveOverview: function(zoomPrimary) {
|
||||
for (let i = 0; i < this._workspacesViews.length; i++) {
|
||||
let view = this._workspacesViews[i];
|
||||
if (i == this._primaryIndex) {
|
||||
if (zoomPrimary)
|
||||
view.zoomFromOverview();
|
||||
else
|
||||
view.fadeFromOverview();
|
||||
} else {
|
||||
view.zoomFromOverview();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
@ -18,7 +18,7 @@ const XdndHandler = new Lang.Class({
|
||||
|
||||
// Used as a drag actor in case we don't have a cursor window clone
|
||||
this._dummy = new Clutter.Actor({ width: 1, height: 1, opacity: 0 });
|
||||
Main.uiGroup.add_actor(this._dummy);
|
||||
Main.layoutManager.sessionGroup.add_actor(this._dummy);
|
||||
this._dummy.hide();
|
||||
|
||||
if (!Meta.is_wayland_compositor())
|
||||
@ -62,14 +62,14 @@ const XdndHandler = new Lang.Class({
|
||||
let cursorWindow = windows[windows.length - 1];
|
||||
|
||||
// FIXME: more reliable way?
|
||||
if (!cursorWindow.is_override_redirect())
|
||||
if (!cursorWindow.get_meta_window().is_override_redirect())
|
||||
return;
|
||||
|
||||
let constraint_position = new Clutter.BindConstraint({ coordinate : Clutter.BindCoordinate.POSITION,
|
||||
source: cursorWindow});
|
||||
|
||||
this._cursorWindowClone = new Clutter.Clone({ source: cursorWindow });
|
||||
Main.uiGroup.add_actor(this._cursorWindowClone);
|
||||
Main.layoutManager.sessionGroup.add_actor(this._cursorWindowClone);
|
||||
|
||||
// Make sure that the clone has the same position as the source
|
||||
this._cursorWindowClone.add_constraint(constraint_position);
|
||||
|
114
po/et.po
114
po/et.po
@ -13,8 +13,8 @@ msgstr ""
|
||||
"Project-Id-Version: gnome-shell MASTER\n"
|
||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-"
|
||||
"shell&keywords=I18N+L10N&component=general\n"
|
||||
"POT-Creation-Date: 2013-11-22 21:44+0000\n"
|
||||
"PO-Revision-Date: 2013-11-18 13:56+0300\n"
|
||||
"POT-Creation-Date: 2014-01-14 01:18+0000\n"
|
||||
"PO-Revision-Date: 2014-01-14 13:33+0300\n"
|
||||
"Last-Translator: Mattias Põldaru <mahfiaz@gmail.com>\n"
|
||||
"Language-Team: Estonian <>\n"
|
||||
"Language: et\n"
|
||||
@ -68,14 +68,14 @@ msgstr ""
|
||||
"Lubab ligipääsu sisemistele silumise ja monitoorimise tööriistadele Alt-F2 "
|
||||
"dialoogi kaudu."
|
||||
|
||||
msgid "Uuids of extensions to enable"
|
||||
msgid "UUIDs of extensions to enable"
|
||||
msgstr "Lubatavate laienduste UUID-d"
|
||||
|
||||
msgid ""
|
||||
"GNOME Shell extensions have a uuid property; this key lists extensions which "
|
||||
"GNOME Shell extensions have a UUID property; this key lists extensions which "
|
||||
"should be loaded. Any extension that wants to be loaded needs to be in this "
|
||||
"list. You can also manipulate this list with the EnableExtension and "
|
||||
"DisableExtension DBus methods on org.gnome.Shell."
|
||||
"DisableExtension D-Bus methods on org.gnome.Shell."
|
||||
msgstr ""
|
||||
"GNOME Shelli laiendustel on UUID omadus; selles võtmes loetletud laiendused "
|
||||
"tuleks laadida. Seda loendit saab muuta kasutades EnableExtension ja "
|
||||
@ -106,11 +106,11 @@ msgstr "Käsudialoogi (Alt-F2) ajalugu"
|
||||
msgid "History for the looking glass dialog"
|
||||
msgstr "Otsingudialoogi ajalugu"
|
||||
|
||||
msgid "Always show the 'Log out' menuitem in the user menu."
|
||||
msgid "Always show the 'Log out' menu item in the user menu."
|
||||
msgstr "Kasutajamenüüs näidatakse alati 'Logi välja' menüükirjet."
|
||||
|
||||
msgid ""
|
||||
"This key overrides the automatic hiding of the 'Log out' menuitem in single-"
|
||||
"This key overrides the automatic hiding of the 'Log out' menu item in single-"
|
||||
"user, single-session situations."
|
||||
msgstr ""
|
||||
"See võti keelab automaatse 'Logi välja' menüükirje peitmise, kui arvutis on "
|
||||
@ -1030,60 +1030,6 @@ msgid_plural "%d Connected Devices"
|
||||
msgstr[0] "%d ühendatud seade"
|
||||
msgstr[1] "%d ühendatud seadet"
|
||||
|
||||
#, javascript-format
|
||||
msgid "Authorization request from %s"
|
||||
msgstr "Autoriseerimise päring seadmelt %s"
|
||||
|
||||
#, javascript-format
|
||||
msgid "Device %s wants to pair with this computer"
|
||||
msgstr "Seade '%s' tahab selle arvutiga paarduda"
|
||||
|
||||
msgid "Allow"
|
||||
msgstr "Luba"
|
||||
|
||||
msgid "Deny"
|
||||
msgstr "Keela"
|
||||
|
||||
#, javascript-format
|
||||
msgid "Device %s wants access to the service '%s'"
|
||||
msgstr "Seade %s soovib ligipääsu teenusele '%s'"
|
||||
|
||||
msgid "Always grant access"
|
||||
msgstr "Luba alati"
|
||||
|
||||
msgid "Grant this time only"
|
||||
msgstr "Luba ainult seekord"
|
||||
|
||||
msgid "Reject"
|
||||
msgstr "Lükka tagasi"
|
||||
|
||||
#. Translators: argument is the device short name */
|
||||
#, javascript-format
|
||||
msgid "Pairing confirmation for %s"
|
||||
msgstr "Paardumise kinnitus seadmele %s"
|
||||
|
||||
#, javascript-format
|
||||
msgid ""
|
||||
"Please confirm whether the Passkey '%06d' matches the one on the device."
|
||||
msgstr "Palun kontrolli, kas parool '%06d' kattub seadme parooliga."
|
||||
|
||||
#. Translators: this is the verb, not the noun */
|
||||
msgid "Matches"
|
||||
msgstr "Kattub"
|
||||
|
||||
msgid "Does not match"
|
||||
msgstr "Ei kattu"
|
||||
|
||||
#, javascript-format
|
||||
msgid "Pairing request for %s"
|
||||
msgstr "Seadmega %s paardumise päring"
|
||||
|
||||
msgid "Please enter the PIN mentioned on the device."
|
||||
msgstr "Palun sisesta seadme poolt öeldav PIN-kood."
|
||||
|
||||
msgid "OK"
|
||||
msgstr "Olgu"
|
||||
|
||||
msgid "Brightness"
|
||||
msgstr "Heledus"
|
||||
|
||||
@ -1300,6 +1246,52 @@ msgstr "Parool ei saa olla tühi"
|
||||
msgid "Authentication dialog was dismissed by the user"
|
||||
msgstr "Kasutaja katkestas autentimisdialoogi"
|
||||
|
||||
#~ msgid "Authorization request from %s"
|
||||
#~ msgstr "Autoriseerimise päring seadmelt %s"
|
||||
|
||||
#~ msgid "Device %s wants to pair with this computer"
|
||||
#~ msgstr "Seade '%s' tahab selle arvutiga paarduda"
|
||||
|
||||
#~ msgid "Allow"
|
||||
#~ msgstr "Luba"
|
||||
|
||||
#~ msgid "Deny"
|
||||
#~ msgstr "Keela"
|
||||
|
||||
#~ msgid "Device %s wants access to the service '%s'"
|
||||
#~ msgstr "Seade %s soovib ligipääsu teenusele '%s'"
|
||||
|
||||
#~ msgid "Always grant access"
|
||||
#~ msgstr "Luba alati"
|
||||
|
||||
#~ msgid "Grant this time only"
|
||||
#~ msgstr "Luba ainult seekord"
|
||||
|
||||
#~ msgid "Reject"
|
||||
#~ msgstr "Lükka tagasi"
|
||||
|
||||
#~ msgid "Pairing confirmation for %s"
|
||||
#~ msgstr "Paardumise kinnitus seadmele %s"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Please confirm whether the Passkey '%06d' matches the one on the device."
|
||||
#~ msgstr "Palun kontrolli, kas parool '%06d' kattub seadme parooliga."
|
||||
|
||||
#~ msgid "Matches"
|
||||
#~ msgstr "Kattub"
|
||||
|
||||
#~ msgid "Does not match"
|
||||
#~ msgstr "Ei kattu"
|
||||
|
||||
#~ msgid "Pairing request for %s"
|
||||
#~ msgstr "Seadmega %s paardumise päring"
|
||||
|
||||
#~ msgid "Please enter the PIN mentioned on the device."
|
||||
#~ msgstr "Palun sisesta seadme poolt öeldav PIN-kood."
|
||||
|
||||
#~ msgid "OK"
|
||||
#~ msgstr "Olgu"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Sorry, no wisdom for you today:\n"
|
||||
#~ "%s"
|
||||
|
662
po/pt_BR.po
662
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
630
po/zh_CN.po
630
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
@ -29,11 +29,9 @@ CLEANFILES += $(service_DATA)
|
||||
|
||||
CLEANFILES += $(gir_DATA) $(typelib_DATA)
|
||||
|
||||
bin_SCRIPTS += gnome-shell-extension-tool gnome-shell-extension-prefs \
|
||||
gnome-shell-perf-tool
|
||||
EXTRA_DIST += gnome-shell-extension-tool.in gnome-shell-extension-prefs.in \
|
||||
gnome-shell-perf-tool.in
|
||||
bin_PROGRAMS = gnome-shell
|
||||
bin_SCRIPTS += gnome-shell-extension-tool gnome-shell-perf-tool
|
||||
EXTRA_DIST += gnome-shell-extension-tool.in gnome-shell-perf-tool.in
|
||||
bin_PROGRAMS = gnome-shell gnome-shell-extension-prefs
|
||||
|
||||
if HAVE_MUTTER_WAYLAND
|
||||
bin_PROGRAMS += gnome-shell-wayland
|
||||
@ -54,9 +52,6 @@ generated_script_substitutions = \
|
||||
gnome-shell-extension-tool: gnome-shell-extension-tool.in Makefile
|
||||
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
|
||||
|
||||
gnome-shell-extension-prefs: gnome-shell-extension-prefs.in Makefile
|
||||
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
|
||||
|
||||
gnome-shell-perf-tool: gnome-shell-perf-tool.in Makefile
|
||||
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
|
||||
|
||||
@ -97,6 +92,7 @@ shell_public_headers_h = \
|
||||
shell-app-usage.h \
|
||||
shell-embedded-window.h \
|
||||
shell-generic-container.h \
|
||||
shell-glsl-quad.h \
|
||||
shell-gtk-embed.h \
|
||||
shell-global.h \
|
||||
shell-invert-lightness-effect.h \
|
||||
@ -133,6 +129,7 @@ libgnome_shell_base_la_SOURCES = \
|
||||
shell-embedded-window-private.h \
|
||||
shell-embedded-window.c \
|
||||
shell-generic-container.c \
|
||||
shell-glsl-quad.c \
|
||||
shell-invert-lightness-effect.c \
|
||||
shell-keyring-prompt.h \
|
||||
shell-keyring-prompt.c \
|
||||
@ -209,6 +206,16 @@ gnome_shell_wayland_LDADD = libgnome-shell-wayland.la libgnome-shell-js.la $(GNO
|
||||
gnome_shell_wayland_DEPENDENCIES = libgnome-shell-wayland.la
|
||||
endif HAVE_MUTTER_WAYLAND
|
||||
|
||||
gnome_shell_extension_prefs_SOURCES = \
|
||||
gnome-shell-extension-prefs.c \
|
||||
$(NULL)
|
||||
nodist_gnome_shell_extension_prefs_SOURCES = \
|
||||
$(top_builddir)/js/js-resources.c \
|
||||
$(top_builddir)/js/js-resources.h \
|
||||
$(NULL)
|
||||
gnome_shell_extension_prefs_CPPFLAGS = $(gnome_shell_cflags)
|
||||
gnome_shell_extension_prefs_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
|
||||
|
||||
########################################
|
||||
|
||||
libgnome_shell_js_la_SOURCES = \
|
||||
|
@ -12,9 +12,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Mark McLoughlin <mark@skynet.ie>
|
||||
|
@ -12,9 +12,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Mark McLoughlin <mark@skynet.ie>
|
||||
|
@ -12,9 +12,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Mark McLoughlin <mark@skynet.ie>
|
||||
|
@ -12,9 +12,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: David Zeuthen <davidz@redhat.com>
|
||||
*
|
||||
|
@ -13,9 +13,7 @@
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Kalev Lember <kalevlember@gmail.com>
|
||||
|
||||
|
52
src/gnome-shell-extension-prefs.c
Normal file
52
src/gnome-shell-extension-prefs.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <girepository.h>
|
||||
#include <gjs/gjs.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
const char *search_path[] = { "resource:///org/gnome/shell", NULL };
|
||||
GError *error = NULL;
|
||||
GjsContext *context;
|
||||
int status;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
g_irepository_prepend_search_path (GNOME_SHELL_PKGLIBDIR);
|
||||
|
||||
context = g_object_new (GJS_TYPE_CONTEXT,
|
||||
"search-path", search_path,
|
||||
NULL);
|
||||
|
||||
if (!gjs_context_define_string_array(context, "ARGV",
|
||||
argc - 1, (const char**)argv + 1,
|
||||
&error))
|
||||
{
|
||||
g_message("Failed to defined ARGV: %s", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (!gjs_context_eval (context,
|
||||
"const Main = imports.extensionPrefs.main; Main.main(ARGV);",
|
||||
-1,
|
||||
"<main>",
|
||||
&status,
|
||||
&error))
|
||||
{
|
||||
g_message ("Execution of main.js threw exception: %s", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$GI_TYPELIB_PATH" ]; then
|
||||
export GI_TYPELIB_PATH=@pkglibdir@
|
||||
else
|
||||
export GI_TYPELIB_PATH=@pkglibdir@:$GI_TYPELIB_PATH
|
||||
fi
|
||||
|
||||
if [ -z "$LD_LIBRARY_PATH" ] ; then
|
||||
export LD_LIBRARY_PATH=@pkglibdir@
|
||||
else
|
||||
export LD_LIBRARY_PATH=@pkglibdir@:$LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
@GJS_CONSOLE@ -I @pkgdatadir@/js -c "const Main = imports.extensionPrefs.main; Main.main(ARGV);" "$@"
|
@ -18,9 +18,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "gtkactionobservable.h"
|
||||
#include "gtkactionobserver.h"
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
@ -67,6 +65,7 @@ struct _GtkActionMuxer
|
||||
|
||||
GHashTable *observed_actions;
|
||||
GHashTable *groups;
|
||||
GHashTable *primary_accels;
|
||||
GtkActionMuxer *parent;
|
||||
};
|
||||
|
||||
@ -83,6 +82,8 @@ enum
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES];
|
||||
|
||||
guint accel_signal;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkActionMuxer *muxer;
|
||||
@ -335,6 +336,39 @@ gtk_action_muxer_action_removed_from_parent (GActionGroup *action_group,
|
||||
gtk_action_muxer_action_removed (muxer, action_name);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_action_muxer_primary_accel_changed (GtkActionMuxer *muxer,
|
||||
const gchar *action_name,
|
||||
const gchar *action_and_target)
|
||||
{
|
||||
Action *action;
|
||||
GSList *node;
|
||||
|
||||
if (!action_name)
|
||||
action_name = strrchr (action_and_target, '|') + 1;
|
||||
|
||||
action = g_hash_table_lookup (muxer->observed_actions, action_name);
|
||||
for (node = action ? action->watchers : NULL; node; node = node->next)
|
||||
gtk_action_observer_primary_accel_changed (node->data, GTK_ACTION_OBSERVABLE (muxer),
|
||||
action_name, action_and_target);
|
||||
g_signal_emit (muxer, accel_signal, 0, action_name, action_and_target);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_action_muxer_parent_primary_accel_changed (GtkActionMuxer *parent,
|
||||
const gchar *action_name,
|
||||
const gchar *action_and_target,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkActionMuxer *muxer = user_data;
|
||||
|
||||
/* If it's in our table then don't let the parent one filter through */
|
||||
if (muxer->primary_accels && g_hash_table_lookup (muxer->primary_accels, action_and_target))
|
||||
return;
|
||||
|
||||
gtk_action_muxer_primary_accel_changed (muxer, action_name, action_and_target);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_action_muxer_query_action (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
@ -379,26 +413,6 @@ gtk_action_muxer_activate_action (GActionGroup *action_group,
|
||||
g_action_group_activate_action (G_ACTION_GROUP (muxer->parent), action_name, parameter);
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
get_platform_data (void)
|
||||
{
|
||||
gchar time[32];
|
||||
GVariantBuilder *builder;
|
||||
GVariant *result;
|
||||
|
||||
g_snprintf (time, 32, "_TIME%d", clutter_get_current_event_time ());
|
||||
|
||||
builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
|
||||
|
||||
g_variant_builder_add (builder, "{sv}", "desktop-startup-id",
|
||||
g_variant_new_string (time));
|
||||
|
||||
result = g_variant_builder_end (builder);
|
||||
g_variant_builder_unref (builder);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_action_muxer_change_action_state (GActionGroup *action_group,
|
||||
const gchar *action_name,
|
||||
@ -411,15 +425,7 @@ gtk_action_muxer_change_action_state (GActionGroup *action_group,
|
||||
group = gtk_action_muxer_find_group (muxer, action_name, &unprefixed_name);
|
||||
|
||||
if (group)
|
||||
{
|
||||
if (G_IS_REMOTE_ACTION_GROUP (group->group))
|
||||
g_remote_action_group_change_action_state_full (G_REMOTE_ACTION_GROUP (group->group),
|
||||
unprefixed_name,
|
||||
state,
|
||||
get_platform_data ());
|
||||
else
|
||||
g_action_group_change_action_state (group->group, unprefixed_name, state);
|
||||
}
|
||||
g_action_group_change_action_state (group->group, unprefixed_name, state);
|
||||
else if (muxer->parent)
|
||||
g_action_group_change_action_state (G_ACTION_GROUP (muxer->parent), action_name, state);
|
||||
}
|
||||
@ -544,6 +550,7 @@ gtk_action_muxer_dispose (GObject *object)
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_action_removed_from_parent, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_parent_action_enabled_changed, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_parent_action_state_changed, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_parent_primary_accel_changed, muxer);
|
||||
|
||||
g_clear_object (&muxer->parent);
|
||||
}
|
||||
@ -623,6 +630,9 @@ gtk_action_muxer_class_init (GObjectClass *class)
|
||||
class->finalize = gtk_action_muxer_finalize;
|
||||
class->dispose = gtk_action_muxer_dispose;
|
||||
|
||||
accel_signal = g_signal_new ("primary-accel-changed", GTK_TYPE_ACTION_MUXER, G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
properties[PROP_PARENT] = g_param_spec_object ("parent", "Parent",
|
||||
"The parent muxer",
|
||||
GTK_TYPE_ACTION_MUXER,
|
||||
@ -745,6 +755,26 @@ gtk_action_muxer_get_parent (GtkActionMuxer *muxer)
|
||||
return muxer->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
emit_changed_accels (GtkActionMuxer *muxer,
|
||||
GtkActionMuxer *parent)
|
||||
{
|
||||
while (parent)
|
||||
{
|
||||
if (parent->primary_accels)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
|
||||
g_hash_table_iter_init (&iter, parent->primary_accels);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
gtk_action_muxer_primary_accel_changed (muxer, NULL, key);
|
||||
}
|
||||
|
||||
parent = parent->parent;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_action_muxer_set_parent:
|
||||
* @muxer: a #GtkActionMuxer
|
||||
@ -772,10 +802,13 @@ gtk_action_muxer_set_parent (GtkActionMuxer *muxer,
|
||||
gtk_action_muxer_action_removed (muxer, *it);
|
||||
g_strfreev (actions);
|
||||
|
||||
emit_changed_accels (muxer, muxer->parent);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_action_added_to_parent, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_action_removed_from_parent, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_parent_action_enabled_changed, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_parent_action_state_changed, muxer);
|
||||
g_signal_handlers_disconnect_by_func (muxer->parent, gtk_action_muxer_parent_primary_accel_changed, muxer);
|
||||
|
||||
g_object_unref (muxer->parent);
|
||||
}
|
||||
@ -794,6 +827,8 @@ gtk_action_muxer_set_parent (GtkActionMuxer *muxer,
|
||||
gtk_action_muxer_action_added (muxer, *it, G_ACTION_GROUP (muxer->parent), *it);
|
||||
g_strfreev (actions);
|
||||
|
||||
emit_changed_accels (muxer, muxer->parent);
|
||||
|
||||
g_signal_connect (muxer->parent, "action-added",
|
||||
G_CALLBACK (gtk_action_muxer_action_added_to_parent), muxer);
|
||||
g_signal_connect (muxer->parent, "action-removed",
|
||||
@ -802,7 +837,72 @@ gtk_action_muxer_set_parent (GtkActionMuxer *muxer,
|
||||
G_CALLBACK (gtk_action_muxer_parent_action_enabled_changed), muxer);
|
||||
g_signal_connect (muxer->parent, "action-state-changed",
|
||||
G_CALLBACK (gtk_action_muxer_parent_action_state_changed), muxer);
|
||||
g_signal_connect (muxer->parent, "primary-accel-changed",
|
||||
G_CALLBACK (gtk_action_muxer_parent_primary_accel_changed), muxer);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (muxer), properties[PROP_PARENT]);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_action_muxer_set_primary_accel (GtkActionMuxer *muxer,
|
||||
const gchar *action_and_target,
|
||||
const gchar *primary_accel)
|
||||
{
|
||||
if (!muxer->primary_accels)
|
||||
muxer->primary_accels = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
if (primary_accel)
|
||||
g_hash_table_insert (muxer->primary_accels, g_strdup (action_and_target), g_strdup (primary_accel));
|
||||
else
|
||||
g_hash_table_remove (muxer->primary_accels, action_and_target);
|
||||
|
||||
gtk_action_muxer_primary_accel_changed (muxer, NULL, action_and_target);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gtk_action_muxer_get_primary_accel (GtkActionMuxer *muxer,
|
||||
const gchar *action_and_target)
|
||||
{
|
||||
if (muxer->primary_accels)
|
||||
{
|
||||
const gchar *primary_accel;
|
||||
|
||||
primary_accel = g_hash_table_lookup (muxer->primary_accels, action_and_target);
|
||||
|
||||
if (primary_accel)
|
||||
return primary_accel;
|
||||
}
|
||||
|
||||
if (!muxer->parent)
|
||||
return NULL;
|
||||
|
||||
return gtk_action_muxer_get_primary_accel (muxer->parent, action_and_target);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gtk_print_action_and_target (const gchar *action_namespace,
|
||||
const gchar *action_name,
|
||||
GVariant *target)
|
||||
{
|
||||
GString *result;
|
||||
|
||||
g_return_val_if_fail (strchr (action_name, '|') == NULL, NULL);
|
||||
g_return_val_if_fail (action_namespace == NULL || strchr (action_namespace, '|') == NULL, NULL);
|
||||
|
||||
result = g_string_new (NULL);
|
||||
|
||||
if (target)
|
||||
g_variant_print_string (target, result, TRUE);
|
||||
g_string_append_c (result, '|');
|
||||
|
||||
if (action_namespace)
|
||||
{
|
||||
g_string_append (result, action_namespace);
|
||||
g_string_append_c (result, '.');
|
||||
}
|
||||
|
||||
g_string_append (result, action_name);
|
||||
|
||||
return g_string_free (result, FALSE);
|
||||
}
|
||||
|
@ -47,6 +47,18 @@ GtkActionMuxer * gtk_action_muxer_get_parent (GtkActi
|
||||
void gtk_action_muxer_set_parent (GtkActionMuxer *muxer,
|
||||
GtkActionMuxer *parent);
|
||||
|
||||
void gtk_action_muxer_set_primary_accel (GtkActionMuxer *muxer,
|
||||
const gchar *action_and_target,
|
||||
const gchar *primary_accel);
|
||||
|
||||
const gchar * gtk_action_muxer_get_primary_accel (GtkActionMuxer *muxer,
|
||||
const gchar *action_and_target);
|
||||
|
||||
/* No better place for this... */
|
||||
gchar * gtk_print_action_and_target (const gchar *action_namespace,
|
||||
const gchar *action_name,
|
||||
GVariant *target);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ACTION_MUXER_H__ */
|
||||
|
@ -157,3 +157,33 @@ gtk_action_observer_action_removed (GtkActionObserver *observer,
|
||||
GTK_ACTION_OBSERVER_GET_IFACE (observer)
|
||||
->action_removed (observer, observable, action_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_action_observer_primary_accel_changed:
|
||||
* @observer: a #GtkActionObserver
|
||||
* @observable: the source of the event
|
||||
* @action_name: the name of the action
|
||||
* @action_and_target: detailed action of the changed accel, in "action and target" format
|
||||
*
|
||||
* This function is called when an action that the observer is
|
||||
* registered to receive events for has one of its accelerators changed.
|
||||
*
|
||||
* Accelerator changes are reported for all targets associated with the
|
||||
* action. The @action_and_target string should be used to check if the
|
||||
* reported target is the one that the observer is interested in.
|
||||
*/
|
||||
void
|
||||
gtk_action_observer_primary_accel_changed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
const gchar *action_and_target)
|
||||
{
|
||||
GtkActionObserverInterface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_ACTION_OBSERVER (observer));
|
||||
|
||||
iface = GTK_ACTION_OBSERVER_GET_IFACE (observer);
|
||||
|
||||
if (iface->primary_accel_changed)
|
||||
iface->primary_accel_changed (observer, observable, action_name, action_and_target);
|
||||
}
|
||||
|
@ -57,6 +57,10 @@ struct _GtkActionObserverInterface
|
||||
void (* action_removed) (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const gchar *action_name);
|
||||
void (* primary_accel_changed) (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
const gchar *action_and_target);
|
||||
};
|
||||
|
||||
GType gtk_action_observer_get_type (void);
|
||||
@ -77,6 +81,10 @@ void gtk_action_observer_action_state_changed (GtkActi
|
||||
void gtk_action_observer_action_removed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const gchar *action_name);
|
||||
void gtk_action_observer_primary_accel_changed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
const gchar *action_and_target);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -12,9 +12,7 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
@ -71,12 +69,14 @@ struct _GtkMenuTracker
|
||||
|
||||
struct _GtkMenuTrackerSection
|
||||
{
|
||||
GMenuModel *model;
|
||||
gpointer model; /* may be a GtkMenuTrackerItem or a GMenuModel */
|
||||
GSList *items;
|
||||
gchar *action_namespace;
|
||||
|
||||
guint separator_label : 1;
|
||||
guint with_separators : 1;
|
||||
guint has_separator : 1;
|
||||
guint is_fake : 1;
|
||||
|
||||
gulong handler;
|
||||
};
|
||||
@ -84,13 +84,14 @@ struct _GtkMenuTrackerSection
|
||||
static GtkMenuTrackerSection * gtk_menu_tracker_section_new (GtkMenuTracker *tracker,
|
||||
GMenuModel *model,
|
||||
gboolean with_separators,
|
||||
gboolean separator_label,
|
||||
gint offset,
|
||||
const gchar *action_namespace);
|
||||
static void gtk_menu_tracker_section_free (GtkMenuTrackerSection *section);
|
||||
|
||||
static GtkMenuTrackerSection *
|
||||
gtk_menu_tracker_section_find_model (GtkMenuTrackerSection *section,
|
||||
GMenuModel *model,
|
||||
gpointer model,
|
||||
gint *offset)
|
||||
{
|
||||
GSList *item;
|
||||
@ -141,8 +142,8 @@ gtk_menu_tracker_section_find_model (GtkMenuTrackerSection *section,
|
||||
*
|
||||
* could_have_separator is true in two situations:
|
||||
*
|
||||
* - our parent section had with_separators defined and we are not the
|
||||
* first section (ie: we should add a separator if we have content in
|
||||
* - our parent section had with_separators defined and there are items
|
||||
* before us (ie: we should add a separator if we have content in
|
||||
* order to divide us from the items above)
|
||||
*
|
||||
* - if we had a 'label' attribute set for this section
|
||||
@ -177,11 +178,13 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
|
||||
{
|
||||
gboolean could_have_separator;
|
||||
|
||||
could_have_separator = (section->with_separators && i > 0) ||
|
||||
g_menu_model_get_item_attribute (section->model, i, "label", "s", NULL);
|
||||
could_have_separator = (section->with_separators && n_items > 0) || subsection->separator_label;
|
||||
|
||||
/* Only pass the parent_model and parent_index in case they may be used to create the separator. */
|
||||
n_items += gtk_menu_tracker_section_sync_separators (subsection, tracker, offset + n_items,
|
||||
could_have_separator, section->model, i);
|
||||
could_have_separator,
|
||||
could_have_separator ? section->model : NULL,
|
||||
could_have_separator ? i : 0);
|
||||
}
|
||||
else
|
||||
n_items++;
|
||||
@ -189,7 +192,7 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
|
||||
i++;
|
||||
}
|
||||
|
||||
should_have_separator = could_have_separator && n_items != 0;
|
||||
should_have_separator = !section->is_fake && could_have_separator && n_items != 0;
|
||||
|
||||
if (should_have_separator > section->has_separator)
|
||||
{
|
||||
@ -214,6 +217,38 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
|
||||
return n_items;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_item_visibility_changed (GtkMenuTrackerItem *item,
|
||||
gboolean is_now_visible,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkMenuTracker *tracker = user_data;
|
||||
GtkMenuTrackerSection *section;
|
||||
gboolean was_visible;
|
||||
gint offset = 0;
|
||||
|
||||
/* remember: the item is our model */
|
||||
section = gtk_menu_tracker_section_find_model (tracker->toplevel, item, &offset);
|
||||
|
||||
was_visible = section->items != NULL;
|
||||
|
||||
if (is_now_visible == was_visible)
|
||||
return;
|
||||
|
||||
if (is_now_visible)
|
||||
{
|
||||
section->items = g_slist_prepend (NULL, NULL);
|
||||
(* tracker->insert_func) (section->model, offset, tracker->user_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
section->items = g_slist_delete_link (section->items, section->items);
|
||||
(* tracker->remove_func) (offset, tracker->user_data);
|
||||
}
|
||||
|
||||
gtk_menu_tracker_section_sync_separators (tracker->toplevel, tracker, 0, FALSE, NULL, 0);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_menu_tracker_section_measure (GtkMenuTrackerSection *section)
|
||||
{
|
||||
@ -277,6 +312,10 @@ gtk_menu_tracker_add_items (GtkMenuTracker *tracker,
|
||||
{
|
||||
GtkMenuTrackerSection *subsection;
|
||||
gchar *action_namespace = NULL;
|
||||
gboolean has_label;
|
||||
|
||||
has_label = g_menu_model_get_item_attribute (model, position + n_items,
|
||||
G_MENU_ATTRIBUTE_LABEL, "s", NULL);
|
||||
|
||||
g_menu_model_get_item_attribute (model, position + n_items,
|
||||
G_MENU_ATTRIBUTE_ACTION_NAMESPACE, "s", &action_namespace);
|
||||
@ -286,11 +325,11 @@ gtk_menu_tracker_add_items (GtkMenuTracker *tracker,
|
||||
gchar *namespace;
|
||||
|
||||
namespace = g_strjoin (".", section->action_namespace, action_namespace, NULL);
|
||||
subsection = gtk_menu_tracker_section_new (tracker, submenu, FALSE, offset, namespace);
|
||||
subsection = gtk_menu_tracker_section_new (tracker, submenu, FALSE, has_label, offset, namespace);
|
||||
g_free (namespace);
|
||||
}
|
||||
else
|
||||
subsection = gtk_menu_tracker_section_new (tracker, submenu, FALSE, offset, section->action_namespace);
|
||||
subsection = gtk_menu_tracker_section_new (tracker, submenu, FALSE, has_label, offset, action_namespace);
|
||||
|
||||
*change_point = g_slist_prepend (*change_point, subsection);
|
||||
g_free (action_namespace);
|
||||
@ -302,10 +341,61 @@ gtk_menu_tracker_add_items (GtkMenuTracker *tracker,
|
||||
|
||||
item = _gtk_menu_tracker_item_new (tracker->observable, model, position + n_items,
|
||||
section->action_namespace, FALSE);
|
||||
(* tracker->insert_func) (item, offset, tracker->user_data);
|
||||
g_object_unref (item);
|
||||
|
||||
*change_point = g_slist_prepend (*change_point, NULL);
|
||||
/* In the case that the item may disappear we handle that by
|
||||
* treating the item that we just created as being its own
|
||||
* subsection. This happens as so:
|
||||
*
|
||||
* - the subsection is created without the possibility of
|
||||
* showing a separator
|
||||
*
|
||||
* - the subsection will have either 0 or 1 item in it at all
|
||||
* times: either the shown item or not (in the case it is
|
||||
* hidden)
|
||||
*
|
||||
* - the created item acts as the "model" for this section
|
||||
* and we use its "visiblity-changed" signal in the same
|
||||
* way that we use the "items-changed" signal from a real
|
||||
* GMenuModel
|
||||
*
|
||||
* We almost never use the '->model' stored in the section for
|
||||
* anything other than lookups and for dropped the ref and
|
||||
* disconnecting the signal when we destroy the menu, and we
|
||||
* need to do exactly those things in this case as well.
|
||||
*
|
||||
* The only other thing that '->model' is used for is in the
|
||||
* case that we want to show a separator, but we will never do
|
||||
* that because separators are not shown for this fake section.
|
||||
*/
|
||||
if (_gtk_menu_tracker_item_may_disappear (item))
|
||||
{
|
||||
GtkMenuTrackerSection *fake_section;
|
||||
|
||||
fake_section = g_slice_new0 (GtkMenuTrackerSection);
|
||||
fake_section->is_fake = TRUE;
|
||||
fake_section->model = g_object_ref (item);
|
||||
fake_section->handler = g_signal_connect (item, "visibility-changed",
|
||||
G_CALLBACK (gtk_menu_tracker_item_visibility_changed),
|
||||
tracker);
|
||||
*change_point = g_slist_prepend (*change_point, fake_section);
|
||||
|
||||
if (_gtk_menu_tracker_item_is_visible (item))
|
||||
{
|
||||
(* tracker->insert_func) (item, offset, tracker->user_data);
|
||||
fake_section->items = g_slist_prepend (NULL, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In the normal case, we store NULL in the linked list.
|
||||
* The measurement and lookup code count NULL always as
|
||||
* exactly 1: an item that will always be there.
|
||||
*/
|
||||
(* tracker->insert_func) (item, offset, tracker->user_data);
|
||||
*change_point = g_slist_prepend (*change_point, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -377,6 +467,7 @@ static GtkMenuTrackerSection *
|
||||
gtk_menu_tracker_section_new (GtkMenuTracker *tracker,
|
||||
GMenuModel *model,
|
||||
gboolean with_separators,
|
||||
gboolean separator_label,
|
||||
gint offset,
|
||||
const gchar *action_namespace)
|
||||
{
|
||||
@ -386,6 +477,7 @@ gtk_menu_tracker_section_new (GtkMenuTracker *tracker,
|
||||
section->model = g_object_ref (model);
|
||||
section->with_separators = with_separators;
|
||||
section->action_namespace = g_strdup (action_namespace);
|
||||
section->separator_label = separator_label;
|
||||
|
||||
gtk_menu_tracker_add_items (tracker, section, §ion->items, offset, model, 0, g_menu_model_get_n_items (model));
|
||||
section->handler = g_signal_connect (model, "items-changed", G_CALLBACK (gtk_menu_tracker_model_changed), tracker);
|
||||
@ -461,7 +553,7 @@ gtk_menu_tracker_new (GtkActionObservable *observable,
|
||||
tracker->remove_func = remove_func;
|
||||
tracker->user_data = user_data;
|
||||
|
||||
tracker->toplevel = gtk_menu_tracker_section_new (tracker, model, with_separators, 0, action_namespace);
|
||||
tracker->toplevel = gtk_menu_tracker_section_new (tracker, model, with_separators, FALSE, 0, action_namespace);
|
||||
gtk_menu_tracker_section_sync_separators (tracker->toplevel, tracker, 0, FALSE, NULL, 0);
|
||||
|
||||
return tracker;
|
||||
@ -473,11 +565,20 @@ gtk_menu_tracker_new_for_item_submenu (GtkMenuTrackerItem *item,
|
||||
GtkMenuTrackerRemoveFunc remove_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
return gtk_menu_tracker_new (_gtk_menu_tracker_item_get_observable (item),
|
||||
_gtk_menu_tracker_item_get_submenu (item),
|
||||
TRUE,
|
||||
_gtk_menu_tracker_item_get_submenu_namespace (item),
|
||||
insert_func, remove_func, user_data);
|
||||
GtkMenuTracker *tracker;
|
||||
GMenuModel *submenu;
|
||||
gchar *namespace;
|
||||
|
||||
submenu = _gtk_menu_tracker_item_get_submenu (item);
|
||||
namespace = _gtk_menu_tracker_item_get_submenu_namespace (item);
|
||||
|
||||
tracker = gtk_menu_tracker_new (_gtk_menu_tracker_item_get_observable (item), submenu,
|
||||
TRUE, namespace, insert_func, remove_func, user_data);
|
||||
|
||||
g_object_unref (submenu);
|
||||
g_free (namespace);
|
||||
|
||||
return tracker;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
|
@ -12,9 +12,7 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
@ -12,9 +12,7 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
@ -22,6 +20,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkmenutrackeritem.h"
|
||||
#include "gtkactionmuxer.h"
|
||||
|
||||
#include "gtkactionmuxer.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* SECTION:gtkmenutrackeritem
|
||||
@ -83,6 +86,7 @@ struct _GtkMenuTrackerItem
|
||||
|
||||
GtkActionObservable *observable;
|
||||
gchar *action_namespace;
|
||||
gchar *action_and_target;
|
||||
GMenuItem *item;
|
||||
GtkMenuTrackerItemRole role : 4;
|
||||
guint is_separator : 1;
|
||||
@ -91,8 +95,14 @@ struct _GtkMenuTrackerItem
|
||||
guint toggled : 1;
|
||||
guint submenu_shown : 1;
|
||||
guint submenu_requested : 1;
|
||||
guint hidden_when : 2;
|
||||
guint is_visible : 1;
|
||||
};
|
||||
|
||||
#define HIDDEN_NEVER 0
|
||||
#define HIDDEN_WHEN_MISSING 1
|
||||
#define HIDDEN_WHEN_DISABLED 2
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_IS_SEPARATOR,
|
||||
@ -109,6 +119,7 @@ enum {
|
||||
};
|
||||
|
||||
static GParamSpec *gtk_menu_tracker_item_pspecs[N_PROPS];
|
||||
static guint gtk_menu_tracker_visibility_changed_signal;
|
||||
|
||||
static void gtk_menu_tracker_item_init_observer_iface (GtkActionObserverInterface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkMenuTrackerItem, gtk_menu_tracker_item, G_TYPE_OBJECT,
|
||||
@ -233,6 +244,46 @@ gtk_menu_tracker_item_class_init (GtkMenuTrackerItemClass *class)
|
||||
g_param_spec_boolean ("submenu-shown", "", "", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
|
||||
|
||||
g_object_class_install_properties (class, N_PROPS, gtk_menu_tracker_item_pspecs);
|
||||
|
||||
gtk_menu_tracker_visibility_changed_signal = g_signal_new ("visibility-changed", GTK_TYPE_MENU_TRACKER_ITEM,
|
||||
G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE,
|
||||
1, G_TYPE_BOOLEAN);
|
||||
}
|
||||
|
||||
/* This syncs up the visibility for the hidden-when='' case. We call it
|
||||
* from the action observer functions on changes to the action group and
|
||||
* on initialisation (via the action observer functions that are invoked
|
||||
* at that time).
|
||||
*/
|
||||
static void
|
||||
gtk_menu_tracker_item_update_visibility (GtkMenuTrackerItem *self)
|
||||
{
|
||||
gboolean visible;
|
||||
|
||||
switch (self->hidden_when)
|
||||
{
|
||||
case HIDDEN_NEVER:
|
||||
visible = TRUE;
|
||||
break;
|
||||
|
||||
case HIDDEN_WHEN_MISSING:
|
||||
visible = self->can_activate;
|
||||
break;
|
||||
|
||||
case HIDDEN_WHEN_DISABLED:
|
||||
visible = self->sensitive;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (visible != self->is_visible)
|
||||
{
|
||||
self->is_visible = visible;
|
||||
g_signal_emit (self, gtk_menu_tracker_visibility_changed_signal, 0, visible);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -288,6 +339,12 @@ gtk_menu_tracker_item_action_added (GtkActionObserver *observer,
|
||||
|
||||
if (action_target)
|
||||
g_variant_unref (action_target);
|
||||
|
||||
/* In case of hidden-when='', we want to Wait until after refreshing
|
||||
* all of the properties to emit the signal that will cause the
|
||||
* tracker to expose us (to prevent too much thrashing).
|
||||
*/
|
||||
gtk_menu_tracker_item_update_visibility (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -307,6 +364,8 @@ gtk_menu_tracker_item_action_enabled_changed (GtkActionObserver *observer,
|
||||
self->sensitive = enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_SENSITIVE]);
|
||||
|
||||
gtk_menu_tracker_item_update_visibility (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -347,33 +406,52 @@ gtk_menu_tracker_item_action_removed (GtkActionObserver *observer,
|
||||
const gchar *action_name)
|
||||
{
|
||||
GtkMenuTrackerItem *self = GTK_MENU_TRACKER_ITEM (observer);
|
||||
gboolean was_sensitive, was_toggled;
|
||||
GtkMenuTrackerItemRole old_role;
|
||||
|
||||
if (!self->can_activate)
|
||||
return;
|
||||
|
||||
was_sensitive = self->sensitive;
|
||||
was_toggled = self->toggled;
|
||||
old_role = self->role;
|
||||
|
||||
self->can_activate = FALSE;
|
||||
self->sensitive = FALSE;
|
||||
self->toggled = FALSE;
|
||||
self->role = GTK_MENU_TRACKER_ITEM_ROLE_NORMAL;
|
||||
|
||||
/* Backwards from adding: we want to remove ourselves from the menu
|
||||
* -before- thrashing the properties.
|
||||
*/
|
||||
gtk_menu_tracker_item_update_visibility (self);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
if (self->sensitive)
|
||||
{
|
||||
self->sensitive = FALSE;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_SENSITIVE]);
|
||||
}
|
||||
if (was_sensitive)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_SENSITIVE]);
|
||||
|
||||
if (self->toggled)
|
||||
{
|
||||
self->toggled = FALSE;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_TOGGLED]);
|
||||
}
|
||||
if (was_toggled)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_TOGGLED]);
|
||||
|
||||
if (self->role != GTK_MENU_TRACKER_ITEM_ROLE_NORMAL)
|
||||
{
|
||||
self->role = GTK_MENU_TRACKER_ITEM_ROLE_NORMAL;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_ROLE]);
|
||||
}
|
||||
if (old_role != GTK_MENU_TRACKER_ITEM_ROLE_NORMAL)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_ROLE]);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_item_primary_accel_changed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
const gchar *action_and_target)
|
||||
{
|
||||
GtkMenuTrackerItem *self = GTK_MENU_TRACKER_ITEM (observer);
|
||||
|
||||
if (g_str_equal (action_and_target, self->action_and_target))
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_ACCEL]);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_item_init_observer_iface (GtkActionObserverInterface *iface)
|
||||
{
|
||||
@ -381,6 +459,7 @@ gtk_menu_tracker_item_init_observer_iface (GtkActionObserverInterface *iface)
|
||||
iface->action_enabled_changed = gtk_menu_tracker_item_action_enabled_changed;
|
||||
iface->action_state_changed = gtk_menu_tracker_item_action_state_changed;
|
||||
iface->action_removed = gtk_menu_tracker_item_action_removed;
|
||||
iface->primary_accel_changed = gtk_menu_tracker_item_primary_accel_changed;
|
||||
}
|
||||
|
||||
GtkMenuTrackerItem *
|
||||
@ -392,6 +471,7 @@ _gtk_menu_tracker_item_new (GtkActionObservable *observable,
|
||||
{
|
||||
GtkMenuTrackerItem *self;
|
||||
const gchar *action_name;
|
||||
const gchar *hidden_when;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ACTION_OBSERVABLE (observable), NULL);
|
||||
g_return_val_if_fail (G_IS_MENU_MODEL (model), NULL);
|
||||
@ -402,30 +482,45 @@ _gtk_menu_tracker_item_new (GtkActionObservable *observable,
|
||||
self->observable = g_object_ref (observable);
|
||||
self->is_separator = is_separator;
|
||||
|
||||
if (!is_separator && g_menu_item_get_attribute (self->item, "hidden-when", "&s", &hidden_when))
|
||||
{
|
||||
if (g_str_equal (hidden_when, "action-disabled"))
|
||||
self->hidden_when = HIDDEN_WHEN_DISABLED;
|
||||
else if (g_str_equal (hidden_when, "action-missing"))
|
||||
self->hidden_when = HIDDEN_WHEN_MISSING;
|
||||
|
||||
/* Ignore other values -- this code may be running in context of a
|
||||
* desktop shell or the like and should not spew criticals due to
|
||||
* application bugs...
|
||||
*
|
||||
* Note: if we just set a hidden-when state, but don't get the
|
||||
* action_name below then our visibility will be FALSE forever.
|
||||
* That's to be expected since the action is missing...
|
||||
*/
|
||||
}
|
||||
|
||||
if (!is_separator && g_menu_item_get_attribute (self->item, "action", "&s", &action_name))
|
||||
{
|
||||
GActionGroup *group = G_ACTION_GROUP (observable);
|
||||
const GVariantType *parameter_type;
|
||||
GVariant *target;
|
||||
gboolean enabled;
|
||||
GVariant *state;
|
||||
gboolean found;
|
||||
|
||||
target = g_menu_item_get_attribute_value (self->item, "target", NULL);
|
||||
|
||||
self->action_and_target = gtk_print_action_and_target (action_namespace, action_name, target);
|
||||
|
||||
if (target)
|
||||
g_variant_unref (target);
|
||||
|
||||
action_name = strrchr (self->action_and_target, '|') + 1;
|
||||
|
||||
state = NULL;
|
||||
|
||||
if (action_namespace)
|
||||
{
|
||||
gchar *full_action;
|
||||
|
||||
full_action = g_strjoin (".", action_namespace, action_name, NULL);
|
||||
gtk_action_observable_register_observer (self->observable, full_action, GTK_ACTION_OBSERVER (self));
|
||||
found = g_action_group_query_action (group, full_action, &enabled, ¶meter_type, NULL, NULL, &state);
|
||||
g_free (full_action);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_action_observable_register_observer (self->observable, action_name, GTK_ACTION_OBSERVER (self));
|
||||
found = g_action_group_query_action (group, action_name, &enabled, ¶meter_type, NULL, NULL, &state);
|
||||
}
|
||||
gtk_action_observable_register_observer (self->observable, action_name, GTK_ACTION_OBSERVER (self));
|
||||
found = g_action_group_query_action (group, action_name, &enabled, ¶meter_type, NULL, NULL, &state);
|
||||
|
||||
if (found)
|
||||
gtk_menu_tracker_item_action_added (GTK_ACTION_OBSERVER (self), observable, NULL, parameter_type, enabled, state);
|
||||
@ -544,11 +639,18 @@ gtk_menu_tracker_item_get_toggled (GtkMenuTrackerItem *self)
|
||||
const gchar *
|
||||
gtk_menu_tracker_item_get_accel (GtkMenuTrackerItem *self)
|
||||
{
|
||||
const gchar *accel = NULL;
|
||||
const gchar *accel;
|
||||
|
||||
g_menu_item_get_attribute (self->item, "accel", "&s", &accel);
|
||||
if (!self->action_and_target)
|
||||
return NULL;
|
||||
|
||||
return accel;
|
||||
if (g_menu_item_get_attribute (self->item, "accel", "&s", &accel))
|
||||
return accel;
|
||||
|
||||
if (!GTK_IS_ACTION_MUXER (self->observable))
|
||||
return NULL;
|
||||
|
||||
return gtk_action_muxer_get_primary_accel (GTK_ACTION_MUXER (self->observable), self->action_and_target);
|
||||
}
|
||||
|
||||
GMenuModel *
|
||||
@ -607,19 +709,10 @@ gtk_menu_tracker_item_activated (GtkMenuTrackerItem *self)
|
||||
if (!self->can_activate)
|
||||
return;
|
||||
|
||||
g_menu_item_get_attribute (self->item, G_MENU_ATTRIBUTE_ACTION, "&s", &action_name);
|
||||
action_name = strrchr (self->action_and_target, '|') + 1;
|
||||
action_target = g_menu_item_get_attribute_value (self->item, G_MENU_ATTRIBUTE_TARGET, NULL);
|
||||
|
||||
if (self->action_namespace)
|
||||
{
|
||||
gchar *full_action;
|
||||
|
||||
full_action = g_strjoin (".", self->action_namespace, action_name, NULL);
|
||||
g_action_group_activate_action (G_ACTION_GROUP (self->observable), full_action, action_target);
|
||||
g_free (full_action);
|
||||
}
|
||||
else
|
||||
g_action_group_activate_action (G_ACTION_GROUP (self->observable), action_name, action_target);
|
||||
g_action_group_activate_action (G_ACTION_GROUP (self->observable), action_name, action_target);
|
||||
|
||||
if (action_target)
|
||||
g_variant_unref (action_target);
|
||||
@ -786,3 +879,15 @@ gtk_menu_tracker_item_request_submenu_shown (GtkMenuTrackerItem *self,
|
||||
else
|
||||
gtk_menu_tracker_item_set_submenu_shown (self, shown);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_menu_tracker_item_is_visible (GtkMenuTrackerItem *self)
|
||||
{
|
||||
return self->is_visible;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_menu_tracker_item_may_disappear (GtkMenuTrackerItem *self)
|
||||
{
|
||||
return self->hidden_when != HIDDEN_NEVER;
|
||||
}
|
||||
|
@ -72,6 +72,10 @@ GMenuModel * _gtk_menu_tracker_item_get_submenu (GtkMenu
|
||||
|
||||
gchar * _gtk_menu_tracker_item_get_submenu_namespace (GtkMenuTrackerItem *self);
|
||||
|
||||
gboolean _gtk_menu_tracker_item_may_disappear (GtkMenuTrackerItem *self);
|
||||
|
||||
gboolean _gtk_menu_tracker_item_is_visible (GtkMenuTrackerItem *self);
|
||||
|
||||
gboolean gtk_menu_tracker_item_get_should_request_show (GtkMenuTrackerItem *self);
|
||||
|
||||
void gtk_menu_tracker_item_activated (GtkMenuTrackerItem *self);
|
||||
|
@ -13,9 +13,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: David Zeuthen <davidz@redhat.com>
|
||||
* Cosimo Cecchi <cosimoc@redhat.com>
|
||||
|
@ -14,9 +14,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Cosimo Cecchi <cosimoc@redhat.com>
|
||||
*
|
||||
|
@ -13,9 +13,7 @@
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Cosimo Cecchi <cosimoc@redhat.com>
|
||||
*
|
||||
|
@ -380,6 +380,8 @@ main (int argc, char **argv)
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
session_mode = (char *) g_getenv ("GNOME_SHELL_SESSION_MODE");
|
||||
|
||||
ctx = meta_get_option_context ();
|
||||
g_option_context_add_main_entries (ctx, gnome_shell_options, GETTEXT_PACKAGE);
|
||||
g_option_context_add_group (ctx, g_irepository_get_option_group ());
|
||||
|
@ -87,8 +87,10 @@ scan_startup_wm_class_to_id (ShellAppSystem *self)
|
||||
|
||||
id = g_app_info_get_id (info);
|
||||
startup_wm_class = g_desktop_app_info_get_startup_wm_class (G_DESKTOP_APP_INFO (info));
|
||||
|
||||
if (startup_wm_class != NULL)
|
||||
g_hash_table_insert (priv->startup_wm_class_to_id, (char *) startup_wm_class, (char *) id);
|
||||
g_hash_table_insert (priv->startup_wm_class_to_id,
|
||||
g_strdup (startup_wm_class), g_strdup (id));
|
||||
}
|
||||
|
||||
g_list_free_full (apps, g_object_unref);
|
||||
@ -120,7 +122,7 @@ shell_app_system_init (ShellAppSystem *self)
|
||||
NULL,
|
||||
(GDestroyNotify)g_object_unref);
|
||||
|
||||
priv->startup_wm_class_to_id = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
priv->startup_wm_class_to_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
monitor = g_app_info_monitor_get ();
|
||||
g_signal_connect (monitor, "changed", G_CALLBACK (installed_changed), self);
|
||||
|
113
src/shell-app.c
113
src/shell-app.c
@ -42,6 +42,8 @@ typedef struct {
|
||||
|
||||
GSList *windows;
|
||||
|
||||
guint interesting_windows;
|
||||
|
||||
/* Whether or not we need to resort the windows; this is done on demand */
|
||||
guint window_sort_stale : 1;
|
||||
|
||||
@ -637,7 +639,7 @@ shell_app_activate_full (ShellApp *app,
|
||||
if (!shell_app_launch (app, timestamp, workspace, &error))
|
||||
{
|
||||
char *msg;
|
||||
msg = g_strdup_printf (_("Failed to launch '%s'"), shell_app_get_name (app));
|
||||
msg = g_strdup_printf (_("Failed to launch “%s”"), shell_app_get_name (app));
|
||||
shell_global_notify_error (global,
|
||||
msg,
|
||||
error->message);
|
||||
@ -889,12 +891,6 @@ shell_app_state_transition (ShellApp *app,
|
||||
state == SHELL_APP_STATE_STARTING));
|
||||
app->state = state;
|
||||
|
||||
if (app->state == SHELL_APP_STATE_STOPPED && app->running_state)
|
||||
{
|
||||
unref_running_state (app->running_state);
|
||||
app->running_state = NULL;
|
||||
}
|
||||
|
||||
_shell_app_system_notify_app_state_changed (shell_app_system_get_default (), app);
|
||||
|
||||
g_object_notify (G_OBJECT (app), "state");
|
||||
@ -924,6 +920,37 @@ shell_app_on_user_time_changed (MetaWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shell_app_sync_running_state (ShellApp *app)
|
||||
{
|
||||
g_return_if_fail (app->running_state != NULL);
|
||||
|
||||
if (app->running_state->interesting_windows == 0)
|
||||
shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
|
||||
else if (app->state != SHELL_APP_STATE_STARTING)
|
||||
shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
shell_app_on_skip_taskbar_changed (MetaWindow *window,
|
||||
GParamSpec *pspec,
|
||||
ShellApp *app)
|
||||
{
|
||||
g_assert (app->running_state != NULL);
|
||||
|
||||
/* we rely on MetaWindow:skip-taskbar only being notified
|
||||
* when it actually changes; when that assumption breaks,
|
||||
* we'll have to track the "interesting" windows themselves
|
||||
*/
|
||||
if (meta_window_is_skip_taskbar (window))
|
||||
app->running_state->interesting_windows--;
|
||||
else
|
||||
app->running_state->interesting_windows++;
|
||||
|
||||
shell_app_sync_running_state (app);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_app_on_ws_switch (MetaScreen *screen,
|
||||
int from,
|
||||
@ -1020,12 +1047,14 @@ _shell_app_add_window (ShellApp *app,
|
||||
app->running_state->windows = g_slist_prepend (app->running_state->windows, g_object_ref (window));
|
||||
g_signal_connect (window, "unmanaged", G_CALLBACK(shell_app_on_unmanaged), app);
|
||||
g_signal_connect (window, "notify::user-time", G_CALLBACK(shell_app_on_user_time_changed), app);
|
||||
g_signal_connect (window, "notify::skip-taskbar", G_CALLBACK(shell_app_on_skip_taskbar_changed), app);
|
||||
|
||||
shell_app_update_app_menu (app, window);
|
||||
shell_app_ensure_busy_watch (app);
|
||||
|
||||
if (app->state != SHELL_APP_STATE_STARTING)
|
||||
shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
|
||||
if (!meta_window_is_skip_taskbar (window))
|
||||
app->running_state->interesting_windows++;
|
||||
shell_app_sync_running_state (app);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (app));
|
||||
|
||||
@ -1043,11 +1072,16 @@ _shell_app_remove_window (ShellApp *app,
|
||||
|
||||
g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_unmanaged), app);
|
||||
g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_user_time_changed), app);
|
||||
g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_skip_taskbar_changed), app);
|
||||
g_object_unref (window);
|
||||
app->running_state->windows = g_slist_remove (app->running_state->windows, window);
|
||||
|
||||
if (app->running_state->windows == NULL)
|
||||
shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
|
||||
if (!meta_window_is_skip_taskbar (window))
|
||||
app->running_state->interesting_windows--;
|
||||
shell_app_sync_running_state (app);
|
||||
|
||||
if (app->running_state && app->running_state->windows == NULL)
|
||||
g_clear_pointer (&app->running_state, unref_running_state);
|
||||
|
||||
g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
|
||||
}
|
||||
@ -1136,7 +1170,7 @@ shell_app_request_quit (ShellApp *app)
|
||||
{
|
||||
MetaWindow *win = iter->data;
|
||||
|
||||
if (!shell_window_tracker_is_window_interesting (win))
|
||||
if (meta_window_is_skip_taskbar (win))
|
||||
continue;
|
||||
|
||||
meta_window_delete (win, shell_global_get_current_time (shell_global_get ()));
|
||||
@ -1197,11 +1231,9 @@ shell_app_launch (ShellApp *app,
|
||||
int workspace,
|
||||
GError **error)
|
||||
{
|
||||
GdkAppLaunchContext *context;
|
||||
gboolean ret;
|
||||
ShellGlobal *global;
|
||||
MetaScreen *screen;
|
||||
GdkDisplay *gdisplay;
|
||||
GAppLaunchContext *context;
|
||||
gboolean ret;
|
||||
|
||||
if (app->info == NULL)
|
||||
{
|
||||
@ -1211,21 +1243,10 @@ shell_app_launch (ShellApp *app,
|
||||
}
|
||||
|
||||
global = shell_global_get ();
|
||||
screen = shell_global_get_screen (global);
|
||||
gdisplay = gdk_screen_get_display (shell_global_get_gdk_screen (global));
|
||||
|
||||
if (timestamp == 0)
|
||||
timestamp = shell_global_get_current_time (global);
|
||||
|
||||
if (workspace < 0)
|
||||
workspace = meta_screen_get_active_workspace_index (screen);
|
||||
|
||||
context = gdk_display_get_app_launch_context (gdisplay);
|
||||
gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
gdk_app_launch_context_set_desktop (context, workspace);
|
||||
context = shell_global_create_app_launch_context (global, timestamp, workspace);
|
||||
|
||||
ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL,
|
||||
G_APP_LAUNCH_CONTEXT (context),
|
||||
context,
|
||||
G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
|
||||
#ifdef HAVE_SYSTEMD
|
||||
app_child_setup, (gpointer)shell_app_get_id (app),
|
||||
@ -1239,6 +1260,32 @@ shell_app_launch (ShellApp *app,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_launch_action:
|
||||
* @app: the #ShellApp
|
||||
* @action_name: the name of the action to launch (as obtained by
|
||||
* g_desktop_app_info_list_actions())
|
||||
* @timestamp: Event timestamp, or 0 for current event timestamp
|
||||
* @workspace: Start on this workspace, or -1 for default
|
||||
*/
|
||||
void
|
||||
shell_app_launch_action (ShellApp *app,
|
||||
const char *action_name,
|
||||
guint timestamp,
|
||||
int workspace)
|
||||
{
|
||||
ShellGlobal *global;
|
||||
GAppLaunchContext *context;
|
||||
|
||||
global = shell_global_get ();
|
||||
context = shell_global_create_app_launch_context (global, timestamp, workspace);
|
||||
|
||||
g_desktop_app_info_launch_action (G_DESKTOP_APP_INFO (app->info),
|
||||
action_name, context);
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_get_app_info:
|
||||
* @app: a #ShellApp
|
||||
@ -1365,11 +1412,9 @@ shell_app_dispose (GObject *object)
|
||||
|
||||
g_clear_object (&app->info);
|
||||
|
||||
if (app->running_state)
|
||||
{
|
||||
while (app->running_state->windows)
|
||||
_shell_app_remove_window (app, app->running_state->windows->data);
|
||||
}
|
||||
while (app->running_state)
|
||||
_shell_app_remove_window (app, app->running_state->windows->data);
|
||||
|
||||
/* We should have been transitioned when we removed all of our windows */
|
||||
g_assert (app->state == SHELL_APP_STATE_STOPPED);
|
||||
g_assert (app->running_state == NULL);
|
||||
|
@ -74,6 +74,11 @@ gboolean shell_app_launch (ShellApp *app,
|
||||
int workspace,
|
||||
GError **error);
|
||||
|
||||
void shell_app_launch_action (ShellApp *app,
|
||||
const char *action_name,
|
||||
guint timestamp,
|
||||
int workspace);
|
||||
|
||||
int shell_app_compare_by_name (ShellApp *app, ShellApp *other);
|
||||
|
||||
int shell_app_compare (ShellApp *app, ShellApp *other);
|
||||
|
@ -48,8 +48,6 @@
|
||||
static ShellGlobal *the_object = NULL;
|
||||
|
||||
static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
|
||||
static void shell_global_on_gc (GjsContext *context,
|
||||
ShellGlobal *global);
|
||||
|
||||
struct _ShellGlobal {
|
||||
GObject parent;
|
||||
@ -98,8 +96,6 @@ struct _ShellGlobal {
|
||||
|
||||
guint32 xdnd_timestamp;
|
||||
|
||||
gint64 last_gc_end_time;
|
||||
|
||||
gboolean has_modal;
|
||||
};
|
||||
|
||||
@ -300,10 +296,7 @@ shell_global_init (ShellGlobal *global)
|
||||
|
||||
global->js_context = g_object_new (GJS_TYPE_CONTEXT,
|
||||
"search-path", search_path,
|
||||
"js-version", "1.8",
|
||||
"gc-notifications", TRUE,
|
||||
NULL);
|
||||
g_signal_connect (global->js_context, "gc", G_CALLBACK (shell_global_on_gc), global);
|
||||
|
||||
g_strfreev (search_path);
|
||||
}
|
||||
@ -1156,13 +1149,6 @@ shell_global_reexec_self (ShellGlobal *global)
|
||||
g_ptr_array_free (arr, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_global_on_gc (GjsContext *context,
|
||||
ShellGlobal *global)
|
||||
{
|
||||
global->last_gc_end_time = g_get_monotonic_time ();
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_notify_error:
|
||||
* @global: a #ShellGlobal
|
||||
@ -1338,6 +1324,8 @@ shell_global_get_current_time (ShellGlobal *global)
|
||||
/**
|
||||
* shell_global_create_app_launch_context:
|
||||
* @global: A #ShellGlobal
|
||||
* @timestamp: the timestamp for the launch (or 0 for current time)
|
||||
* @workspace: a workspace index, or -1 to indicate the current one
|
||||
*
|
||||
* Create a #GAppLaunchContext set up with the correct timestamp, and
|
||||
* targeted to activate on the current workspace.
|
||||
@ -1345,16 +1333,21 @@ shell_global_get_current_time (ShellGlobal *global)
|
||||
* Return value: (transfer full): A new #GAppLaunchContext
|
||||
*/
|
||||
GAppLaunchContext *
|
||||
shell_global_create_app_launch_context (ShellGlobal *global)
|
||||
shell_global_create_app_launch_context (ShellGlobal *global,
|
||||
int timestamp,
|
||||
int workspace)
|
||||
{
|
||||
GdkAppLaunchContext *context;
|
||||
|
||||
context = gdk_display_get_app_launch_context (global->gdk_display);
|
||||
gdk_app_launch_context_set_timestamp (context, shell_global_get_current_time (global));
|
||||
|
||||
// Make sure that the app is opened on the current workspace even if
|
||||
// the user switches before it starts
|
||||
gdk_app_launch_context_set_desktop (context, meta_screen_get_active_workspace_index (global->meta_screen));
|
||||
if (timestamp == 0)
|
||||
timestamp = shell_global_get_current_time (global);
|
||||
gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
|
||||
if (workspace < 0)
|
||||
workspace = meta_screen_get_active_workspace_index (global->meta_screen);
|
||||
gdk_app_launch_context_set_desktop (context, workspace);
|
||||
|
||||
return (GAppLaunchContext *)context;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user