Commit Graph

79 Commits

Author SHA1 Message Date
Cosimo Cecchi
642bf2b778 theme: convert stylesheet loading to GFile
In preparation to making it a GResource.

https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:54:00 -07:00
Florian Müllner
4d64bbcf7d extensionSystem: Fix reloading on version-validation changes
The current code only works for enabled extensions, which means
that extensions that were marked OUT_OF_DATE cannot be enabled
without a restart when disabling the version check.
Fix this by reloading all extensions while making sure to only
enable any extensions when we're supposed to.

https://bugzilla.gnome.org/show_bug.cgi?id=736185
2014-09-06 22:06:07 +02:00
Adel Gadllah
1af40b1345 extensionSystem: Add a gsettings key to disable version validation
Add a key 'disable-extension-version-validation' key that disables
the validation of extension's claimed to be supported shell version
with the shell version and just load all extensions unconditionally.

https://bugzilla.gnome.org/show_bug.cgi?id=724683
2014-02-19 17:07:38 +01:00
Jasper St. Pierre
da4238ec68 Synchronize shell startup
The asynchronous nature of extension loading, session loading, and more,
makes the code racy as to what is initialized first, and hard to debug.
Additionally, since gjs is single-threaded, the only code we're running
in a thread anyway is readdir, which is going to be I/O bound, so the
code here is actually likely to be faster.

Drop this in favor of some good old fashioned synchronous loading.
2013-11-04 11:50:20 -05:00
Sebastien Lafargue
2c538d247b catch more errors on extensions enable() and disable()
https://bugzilla.gnome.org/show_bug.cgi?id=688331
2013-10-26 16:35:47 +02:00
Tomeu Vizoso
88ce65266e Disable all extensions in reverse order
So we avoid having to disable and enable an extension that is to
be disabled later anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=700784
2013-05-22 07:51:23 +02:00
Florian Müllner
2344706462 extensionSystem: Allow extensions to provide mode-specific styling
Allow extensions to integrate with modes that provide a distinct
style by providing a mode-specific stylesheet.

https://bugzilla.gnome.org/show_bug.cgi?id=693219
2013-02-05 19:54:17 +01:00
Florian Müllner
378df515d0 extensionSystem: Fix error reporting in lg / ListExtensionErrors()
Commit c99e8eb29 removed this line probably accidentally, as no
effort has been made to replace consumers in lookingGlass and
shellDBus.

https://bugzilla.gnome.org/show_bug.cgi?id=690173
2012-12-13 19:55:33 +01:00
Florian Müllner
31f75e4607 extensionSystem: Add support for mode-specific extensions
As currently envisioned, the fallback replacement in 3.8 should be
a separate session at the login screen. As we will use extensions
to implement this mode, we need a way to specify extensions per
session rather than per user, so add a session-mode property for
extensions that should be loaded in addition to the user-defined
ones.

https://bugzilla.gnome.org/show_bug.cgi?id=689305
2012-12-05 21:56:57 +01:00
Jasper St. Pierre
ca73017100 extensionSystem: Don't spam the error log with OUT_OF_DATE errors
Nobody cares

https://bugzilla.gnome.org/show_bug.cgi?id=689108
2012-11-26 15:11:58 -05:00
Giovanni Campagna
77c15b76b5 Fix extension styling
St.Theme.load_stylesheet() does not queue a theme context change, so
any styling of widgets created before will not be updated. To fix this,
load the stylesheet before the extension builds its own UI in enable()

https://bugzilla.gnome.org/show_bug.cgi?id=682128
2012-09-13 22:41:17 +02:00
Jasper St. Pierre
ca2e09fe8b sessionMode: Allow changing the session mode at runtime
Since we eventually want to add a system for changing the top panel
contents depending on the current state of the shell, let's use the
"session mode" feature for this, and add a mechanism for updating the
session mode at runtime. Add support for every key besides the two
functional keys, and make all the components update automatically when the
session mode is changed. Add a new lock-screen mode, and make the lock
screen change to this when locked.

https://bugzilla.gnome.org/show_bug.cgi?id=683156
2012-09-04 18:42:44 -03:00
Jasper St. Pierre
4ca2697271 shellDBus: Fix reloadExtension
We need to recreate and reimport the extension here, not just reimport
the same exact code.

https://bugzilla.gnome.org/show_bug.cgi?id=682578
2012-08-23 22:57:46 -03:00
Jasper St. Pierre
4696bfbb80 extensionSystem: Make unloadExtension take an extension object, not a UUID
For consistency with loadExtension.

https://bugzilla.gnome.org/show_bug.cgi?id=682578
2012-08-23 22:57:45 -03:00
Jasper St. Pierre
e1ec89a133 extensionSystem: Fix error emitting when enabling/disabling
We don't have an extension object here.
2012-07-11 22:46:59 -04:00
Jasper St. Pierre
c99e8eb29d extensionSystem: Be saner at error handling
Use our native JS error system in the "extension system" API, only
using the signal/log-based error reporting at the last mile. Additionally,
delete the directory if loading the extension failed, and report the error
back over DBus.

https://bugzilla.gnome.org/show_bug.cgi?id=679099
2012-07-02 18:29:56 -04:00
Jasper St. Pierre
75570b7995 extensionSystem: Add a method to unload an extension
https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:09 -04:00
Jasper St. Pierre
3290bfae68 extensionSystem: Remove the two-step initialize
Initially, extensions were loaded after they shell had fully created
the session and all objects, but this didn't allow extensions easy
ways to monkey patch prototypes, as most functions had already been
bound. Remove the historical vestigal function, and just merge the
two together.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:09 -04:00
Jasper St. Pierre
0805d7a35f extensionSystem: Make the init function optional
A large amount of extensions have something like this in them:

    function init() {}

Since we have encouraged extension authors to try and not make any
changes in init, it feels weird and strange to have to create an
initialization function that does nothing. From now on, don't require
it.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:09 -04:00
Jasper St. Pierre
11278a0814 extensionSystem: Load/unload stylesheets on enable/disable
I'm not entirely sure why this wasn't caught earlier.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:08 -04:00
Jasper St. Pierre
86de6f5861 extensionUtils: Create and load the extension object when scanning
This reduces some duplicate code when loading extensions.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:08 -04:00
Jasper St. Pierre
498b023989 extensionUtils: Use signals rather than callbacks for finding extensions
This allows us to move to a file-monitor based approach in the future.

Since we need signals, we convert the current set of functions to an
object we attach signals too, leading to the new ExtensionFinder object.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:08 -04:00
Jasper St. Pierre
5265884af9 extensionUtils: Remove userExtensionsDir
Make this less stateful

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:08 -04:00
Jasper St. Pierre
3ff51da529 extensionSystem: Split off the extension downloader into a separate file
This keeps all UI out of the extension system, leaving it strictly for
loading and unloading extensions.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-12 17:16:08 -04:00
Jasper St. Pierre
c7b4022283 extensionSystem: Initialize the HTTP session after parse time
We really shouldn't be creating GObjects while we're still parsing other
files for performance and clarity reasons.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
2012-06-11 13:07:40 -04:00
Jasper St. Pierre
a7ecc4cdd6 Revert "extensionSystem: Initialize the HTTP session after parse time"
This reverts commit df5298d59c.
2012-06-11 13:06:14 -04:00
Jasper St. Pierre
df5298d59c extensionSystem: Initialize the HTTP session after parse time
We really shouldn't be creating GObjects while we're still parsing other
files for performance and clarity reasons.
2012-06-11 13:04:56 -04:00
Jasper St. Pierre
3f942302d1 extensionSystem: Show an icon in the install dialog
https://bugzilla.gnome.org/show_bug.cgi?id=676837
2012-05-25 18:25:51 -04:00
Jasper St. Pierre
96396163cf extensionSystem: Replace Shell.write_soup_message_to_stream with GBytes usage
https://bugzilla.gnome.org/show_bug.cgi?id=676837
2012-05-25 18:25:51 -04:00
Jasper St. Pierre
0c736c4561 extensionSystem: Use Gio.File.new_tmp
https://bugzilla.gnome.org/show_bug.cgi?id=676837
2012-05-25 18:25:51 -04:00
Jasper St. Pierre
33ad9d1035 extensionSystem: Clean up
https://bugzilla.gnome.org/show_bug.cgi?id=676837
2012-05-25 18:25:51 -04:00
Jasper St. Pierre
d57658d059 extensionSystem: Remove custom CA file handling
libsoup (well, glib-networking) now handles this automatically

https://bugzilla.gnome.org/show_bug.cgi?id=676837
2012-05-25 18:25:51 -04:00
Jasper St. Pierre
031206cf1f extensionSystem: Remove now-unused version_tag, clean up other code as well
https://bugzilla.gnome.org/show_bug.cgi?id=676837
2012-05-25 18:25:51 -04:00
Jasper St. Pierre
ce041a3190 js: Don't use global.log*
These are "deprecated", and are just references to the gjs logging functoins

https://bugzilla.gnome.org/show_bug.cgi?id=675790
2012-05-18 14:09:00 -04:00
Jasper St. Pierre
3a01aaf7fb extensionSystem: Don't spam stdout with "Loaded extension"
https://bugzilla.gnome.org/show_bug.cgi?id=675790
2012-05-18 14:09:00 -04:00
Jasper St. Pierre
b095319a16 extensionSystem: Make it a non-fatal error to re-load an extension
https://bugzilla.gnome.org/show_bug.cgi?id=673613
2012-04-09 14:02:31 -03:00
Giovanni Campagna
64ce622f83 ExtensionSystem: fix uninstalling from website
uninstall function was still referring to the old state and error
objects, which were removed by the refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=671134
2012-03-01 20:45:32 +01:00
Giovanni Campagna
772638c78e ExtensionSystem: fix installing from website
loadExtension() fails if the extension object is already created,
but the installation dialog was creating a dummy object in the
downloading state. Since nothing requires that (and the object is
not in the correct format anyway), just kill it.

https://bugzilla.gnome.org/show_bug.cgi?id=671134
2012-03-01 20:45:32 +01:00
Giovanni Campagna
d0cd6ba47d extensionSystem: fix runtime enable()/disable() after last changes
disableExtension still used the old way to retrieve the state object,
and enableExtension called loadExtension at a time that would
always fail.

https://bugzilla.gnome.org/show_bug.cgi?id=669694
2012-02-08 23:29:39 +01:00
Jasper St. Pierre
a622aba7eb extensionUtils: Create and allow access to a new "extension" object
The "extension" object is what I previously called the "helper" object.
It contains the extension importer object as well as the metadata object.
Things that were previously added on to the metadata (state, path, dir, etc.)
are now part of this new "extension" object.

With the new importer changes brought on by the extension prefs tool,
extensions are left without a way to import submodules at the global scope,
which would make them rely on techniques like:

  var MySubModule;

  function init(meta) {
      MySubModule = meta.importer.mySubModule;
  }

That is, there's now a lot more meaningless boilerplate that nobody wants
to write and nobody wants to reivew.

Let's solve this with a few clever hacks.
Allow extensions to get their current extension object with:

  let extension = imports.misc.extensionUtils.getCurrentExtension();

As such, extensions can now get their own extension object before the
'init' method is called, so they can import submodules or do other things
at the module scope:

  const MySubModule = extension.imports.mySubModule;
  const dataPath = GLib.build_filenamev([extension.path, 'awesome-data.json']);

https://bugzilla.gnome.org/show_bug.cgi?id=668429
2012-02-07 16:00:37 -05:00
Jasper St. Pierre
80ff6ff797 Move a lot of miscellaneous code related to extensions into a new module
ExtensionUtils is a new module that has a lot of miscellaneous things related
to loading extensions and the extension system put into a place that does not
depend on Shell or St.

Note that this will break extensions that have with multiple files by replacing
the old uuid-based importer with an object directly on the meta object.

https://bugzilla.gnome.org/show_bug.cgi?id=668429
2012-02-07 16:00:37 -05:00
Jasper St. Pierre
2f27b94757 extensionSystem: Fix an error related to extension importing
If an extension fails to import, we will pass the error object
to logExtensionError, which fails to pass it onto DBus as an
error object is not a string. To fix, convert the error object
to a string before passing it to logExtensionError.

https://bugzilla.gnome.org/show_bug.cgi?id=668429
2012-02-07 16:00:37 -05:00
Jasper St. Pierre
b2f33e2895 Split off the extension importing stuff into a new library, 'ShellJS'
This allows us to create a separate utility to import things from
shell extensions that does not have the entire Shell stack built up

https://bugzilla.gnome.org/show_bug.cgi?id=668429
2012-02-07 16:00:37 -05:00
Jasper St. Pierre
bbb83656bf extensionSystem: Set the proper 'enabled' and 'type' parameters
When installing an extension at runtime, we accidentally swapped the 'type'
and 'enabled' parameters. While this doesn't directly affect anything right
now, as everything works coincidentally, future patches that look at the
'type' parameter to decide what to do would get the wrong answer.
2011-11-30 22:04:00 -05:00
Giovanni Campagna
987099ea55 Port ModalDialog to the class framework
Similar to the previous commits, time to port shell modal dialogs
to the class framework.

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Jasper St. Pierre
203c5db5eb extensionSystem: Remove duplciated version check
This piece of accidentally duplicated code made sure that the OUT_OF_DATE
status was never set.

https://bugzilla.gnome.org/show_bug.cgi?id=662967
2011-10-28 16:12:52 -04:00
Jasper St. Pierre
cf44234323 extensionSystem: Fix rebasing of extensions
We need to remove the extension from the order after it's disabled

https://bugzilla.gnome.org/show_bug.cgi?id=662704
2011-10-27 17:21:54 -04:00
Jasper St. Pierre
cc94076ffb extensionSystem: Fix deferred loading of extensions
We need to show the list of installed extensions on EGO, so we can't defer
loading by not creating the extension meta.

https://bugzilla.gnome.org/show_bug.cgi?id=662704
2011-10-27 17:21:49 -04:00
Jasper St. Pierre
fd1b3b4fee extensionSystem: Rebase the extension order list to help prevent conflicts
When two extensions monkey-patch the same area, enable() and disable() may
behave badly and completely wreck things. To solve this, when disabling
an extension, "rebase" the extension list so that monkey patches should be
added and removed in order.

https://bugzilla.gnome.org/show_bug.cgi?id=661815
2011-10-20 17:38:48 -04:00
Jasper St. Pierre
4ae2a0b2a5 extensionSystem: Only load importers for enabled extensions
Rather than loading and enabling all extensions at Shell init time, save some
time and gain some basic security by not loading extensions if they're
not enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=661815
2011-10-20 17:38:48 -04:00