Commit Graph

37 Commits

Author SHA1 Message Date
Colin Walters
6aaf4b87d5 Major ShellApp API cleanup, startup notification, window focus handling
This patch combines several high level changes which are conceptually
independent but in practice rather intertwined.

* Add a "state" property to ShellApp which reflects whether it's
  stopped, starting, or started.  This will allow us to later clean
  up all the callers that are using ".get_windows().length > 0" as
  a proxy for this property
* Replace shell_app_launch with shell_app_activate and shell_app_open_new_window
  A lot of code was calling .launch, but it's signficantly clearer
  if we call this ".open_new_window()", and later if we gain the ability
  to call into an application's menu, we can implement this correctly rather
  than trying to update all .launch callers.
* Because ShellApp now has a "starting" state, rebase panel.js on top of
  this so that when we get a startup-notification sequence for an app
  and transition it to starting, it becomes the focus app, and panel.js
  cleanly just tracks the focus app, rather than bouncing between SN
  sequences.  This removes display of non-app startup sequences, which
  I consider an acceptable action in light of the committed changes
  to startup-notification and GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=614755
2010-04-12 16:32:21 -04:00
Colin Walters
c92ce5983d Consume startup-notification APPLICATION_ID
This patch ensures we're showing the correct data when doing
startup-notification.

https://bugzilla.gnome.org/show_bug.cgi?id=612833
2010-03-30 17:36:05 -04:00
Colin Walters
fe52a9e1a1 Add shell_app_system_get_app_for_path
Allows looking up an app given an absolute path to its
desktop file; will be used for startup-notification.

https://bugzilla.gnome.org/show_bug.cgi?id=612833
2010-03-30 17:36:04 -04:00
Colin Walters
3aea09b614 Fix app icon fading
The way we were loading data into a CoglTexture, then pulling it out
and manipulating it on the CPU, then loading it back into a texture
was a bit lame.

Clean things up a bit here by loading directly into the CPU, doing
the fading, then creating a texture.

Also cache the faded data in StTextureCache.

https://bugzilla.gnome.org/show_bug.cgi?id=612759
2010-03-13 12:50:38 -05:00
Colin Walters
22948b3d39 Merge St.TextureCache and Shell.TextureCache
Brute force merge these two by essentially replacing St.TextureCache
with a (renamed) Shell.TextureCache.

One function was added for convenience, namely "st_texture_cache_load_file_simple".
St.TextureCache had a function to load a texture from a filename, and it
returned NULL on error but only half the callers actually checked this.  This
function is better.

https://bugzilla.gnome.org/show_bug.cgi?id=607500
2010-03-05 16:19:40 -05:00
Maxim Ermilov
c793d7d0a4 get_app_for_window_direct search ShellApp by window, before create.
https://bugzilla.gnome.org/show_bug.cgi?id=610324
2010-02-21 03:19:24 +03:00
Florian Müllner
f8acd0f6f6 Match on executable names as well
Include matches on desktop entries' exec property in addition to the
name and comment ones.

https://bugzilla.gnome.org/show_bug.cgi?id=606743
2010-01-15 23:03:18 +01:00
Colin Walters
288eae91e2 [ShellAppSystem] Initialize collation keys for info on-demand
In case of duplicate infos structures with the same id, the
info structures we get from looking up the id in app_id_to_info
aren't necessarily the same as those we used to match, so we
can't rely on matching to implicitly initialize info->casefolded_name.

Since the name collation key isn't used in matching results,
just in sorting, init it on-demand in the sorting which is also more
efficient.
2009-12-18 12:36:16 -05:00
Colin Walters
b7646d18ae Add search.js, rebase search system on top
The high level goal is to separate the concern of searching for
things with display of those things; for example in newer mockups,
applications are displayed exactly the same as they look in the
AppWell.

Another goal was optimizing for speed; for example,
application search was pushed mostly down into C, and we avoid
lowercasing and normalizing every item over and over.

https://bugzilla.gnome.org/show_bug.cgi?id=603523
2009-12-18 10:07:22 -05:00
Dan Winship
dd8f05c81d include "config.h" in all .c files
Also, fix shell-global.c to actually compile with config.h included.

Was supposed to fix bug 602802, but doesn't...
2009-11-24 09:15:35 -05:00
Dan Winship
8334b063f1 Deal with title-less windows
https://bugzilla.gnome.org/show_bug.cgi?id=601290
2009-11-13 16:04:17 -05:00
Colin Walters
e941e8088b Split ShellAppMonitor into ShellWindowTracker, ShellAppUsage
The two parts were mapping windows to applications, and
recording application usage statistics.  The latter part
(now called ShellAppUsage) is much more naturally built on top of
the former (now called ShellWindowTracker).

ShellWindowTracker retains the startup-notification handling.

ShellWindowTracker also gains a focus-app property, which is
what most things in the shell UI are interested in (instead of
window focus).

ShellAppSystem moves to exporting ShellApp from more of its
public API, rather than ShellAppInfo.  ShellAppSystem also
ensures that ShellApp instances are unique by holding
a hash on the ids.

ShellApp's private API is split off into a shell-app-private.h,
so shell-app.h can be included in shell-app-system.h.

Favorites handling is removed from ShellAppSystem, now inside
appFavorites.js.

Port all of the JavaScript for these changes.

https://bugzilla.gnome.org/show_bug.cgi?id=598646
2009-10-20 12:55:07 -04:00
Colin Walters
2f2df61093 Cache applications for a menu
Rather than recomputing this each time someone asks, have a
cache of the apps for a given menu.

https://bugzilla.gnome.org/show_bug.cgi?id=597167
2009-10-02 19:30:42 -04:00
Colin Walters
90e6769638 Fix memory leak in getting applications from menu
https://bugzilla.gnome.org/show_bug.cgi?id=595321
2009-09-22 18:13:09 -04:00
Colin Walters
19fa0b5d5b Unref GIcon we use internally
https://bugzilla.gnome.org/show_bug.cgi?id=595321
2009-09-21 18:22:40 -04:00
Jon Nettleton
7f88e02a26 Convert on_tree_changed to a gboolean returning false.
This fixes commit 0a29cf6195 and
g_timer_add_full running in an endless loop.

http://bugzilla.gnome.org/show_bug.cgi?id=592608
2009-09-07 11:13:38 -04:00
Jon Nettleton
0a29cf6195 Compress notifications of menu changes with a timeout.
GMenu currently gives us a separate notification on the entire
menu tree for each node in the tree that might potentially have
changed. (See http://bugzilla.gnome.org/show_bug.cgi?id=172046.)
Compress these with a timeout to avoid doing a lot of extra work.

http://bugzilla.gnome.org/show_bug.cgi?id=592608
2009-09-04 19:24:47 -04:00
Colin Walters
24a5c3c19a Add "mozilla" as a vendor prefix
Clean up the vendor prefix handling a bit, and add "mozilla" so that
we pick up "mozilla-firefox.desktop" from Firefox's (recent?) change
to have a WM_CLASS of "Firefox".
2009-08-27 01:49:15 -04:00
Colin Walters
58690c210e [ShellAppSystem] fix missing break; in _unref 2009-08-21 13:19:28 -04:00
Colin Walters
d94606587b Add shell_app_system_create_from_window
For various cases such as when we don't know a .desktop file
for a window, it's desirable to "fake" an application from
the contents of a MetaWindow*.
2009-08-18 23:00:47 -04:00
Colin Walters
557f9ceb97 Bug 591590 - Fix some applications not appearing in menu
Use the correct address for the entry, instead of treating the
ShellAppInfo pointer as one.
2009-08-13 13:02:29 -04:00
Colin Walters
74eac21870 Add application menu area to panel
This is a start at the "Active Appliction Item" component of the
shell design.  Currently we just show the currently focused
application.  When launching a new application, we show that as well.

The implementation here is not complete; basically when launching
we de-focus the active one, and the application well shows the
most recent startup sequence.

This kind of fails in the case of multiple sequences, and we
also don't correctly de-focus the current window in other
launch paths.
2009-08-11 13:09:41 -04:00
Siegfried-Angel Gevatter Pujals
185ccecec1 Make <AppSystem>.load_from_desktop_file() raise an exception again
Pass the error variable to g_key_file_load_from_data_dirs in
Shell.AppSystem.get_default().load_from_desktop_file again, and
use a try/catch in places.js.
2009-08-09 18:32:22 +02:00
Siegfried-Angel Gevatter Pujals
205c57d6af Fix FTBFS and crash triggered by <AppSystem>.load_from_desktop_file()
- Avoid error '"iconname" may be used uninitialized in this function'
  by initializing said variable to NULL.

- Define shell_util_get_file_description as static (like the other
  similar functions) to avoid another compiler error.

- Don't save errors from g_key_file_load_from_data_dirs into the
  variable "error" (ie. pass NULL to it instead). Without this,
  gnome-shell crashes if the key file can't be found (with message
  "Error invoking Shell.load_from_desktop_file: Valid key file could
  not be found in search dirs").

- Check the result of the load_from_desktop_file() call in places.js,
  as it may be null.
2009-08-09 17:39:17 +02:00
Colin Walters
9bd22dc033 ShellAppSystem: Support loading a .desktop file directly
Previously, ShellAppSystem only loaded (and cached) the set of
.desktop files from applications.menu and settings.menu, using
the gnome-menus library.  The ShellAppInfo structure was
a "hidden typedef" for GMenuTreeEntry.

But we need to support loading an arbitrary .desktop file.  Thus,
refactor the ShellAppInfo into a real struct, with a refcount,
and allow it to point to either a GMenuTreeEntry or a GKeyFile.

Also, in the case where we fail to lookup an icon for an
application, ensure we return a 0 opacity texture.
2009-08-09 09:53:06 -04:00
Colin Walters
687a87d3d0 Define stable ordering for application favorites and running apps
For both of these, because of optimizations a few patches ago, we
ended up relying on hash table ordering which caused instability
in the application well among other things. Define an ordering
for both.

The favorites is just the order of the GConf keys, and new items
get appended.  In the future we should allow insertion at any
point which the grid could use.

For running applications order, define a new "initially_seen_sequence"
transient variable which is just an monotonically incrementing
integer assigned to an application for the first time we saw it
running in this session.  When an application is closed, it's reset.
2009-08-08 15:47:49 -04:00
Siegfried-Angel Gevatter Pujals
93ea4b07c1 Add appInfo.get_desktop_file_path method
Add shell_app_info_get_desktop_file_path, matching *_get_executable,
*_get_id, etc. This is useful for Zeitgeist.
2009-07-29 23:40:23 +02:00
Colin Walters
cc2d3fd56d Major rework of application data structures and caching
Before, we looked up application data in several ways; the ShellAppSystem
exported just application ids (though it parsed the .desktop files internally),
and we'd create a Gio.DesktopAppInfo object (reparsing the desktop file again),
wrapping that inside a JavaScript AppInfo class, and finally the AppDisplay
would again parse the .desktop file to get the categories.

Also, to look up applications by id previously, we traversed the entire
menu structure each time.

Some qualities such as the NoDisplay flag were not easily exposed in the old
system.  And if we wanted to expose them we'd have to change several different
application information wrapper classes.

All in all, it was quite suboptimal.

The theme of this new code is basically "just use libgnome-menus".  We do
not call into Gio for app lookups anymore.  The new Shell.AppInfo class
is a disguised pointer for the GMenuTreeEntry item.

To fix the caching, we keep a simple hash table of desktop id -> ShellAppInfo.
2009-07-08 11:33:47 -04:00
Owen W. Taylor
8ee740e425 Don't include NoDisplay items, except for window identification
Searching across NoDisplay desktop items can produce weird
results to the user (including duplicates, and items that
aren't really applications at all.) So, don't include them
normally.

But continue including NoDisplay items when we look up the
desktop file for a window, since we want to catch applications
like Evince and Nautilus which are otherwise NoDisplay.

http://bugzilla.gnome.org/show_bug.cgi?id=587548
2009-07-04 15:07:10 +01:00
Colin Walters
09d9d91297 Include NoDisplay applications in application data
For now, we want to get Evince and Nautilus at least in the application
list.
2009-06-30 18:16:39 -04:00
Colin Walters
88c9a23866 ShellAppSystem: Add favorites API and shell_app_system_lookup_basename
Add a GConf key for favorites, and API for retrieving them.

Also add shell_app_system_lookup_basename, which we use from
the app monitor to look up WM_CLASS ids.
2009-06-30 16:35:16 -04:00
Colin Walters
e7771b4eb0 Make ShellAppMonitor and ShellAppSystem singletons, remove unused code in appDisplay
We shouldn't create multiple instances of either.  Also remove a bit
of unused code in appDisplay.
2009-06-18 12:27:19 -04:00
Colin Walters
4314c6e57f Close memory leaks in ShellAppMonitor, ShellAppSystem, ShellTextureCache
Unref'ing the GdkPixbuf is particularly critical.  Some smaller fixes
also included.
2009-06-16 17:31:47 -04:00
Colin Walters
8b1d7e3407 Fix transfer of application setting ids
It's cached, should be (transfer none).
2009-06-12 11:27:27 -04:00
Colin Walters
5416f53351 Bug 581944 - Fully rebase on ShellAppSystem, don't use Gio to load apps
To avoid loading applications from two different systems, use
ShellAppSystem solely.  This unifies the initial load and the
reload.

Extend ShellAppSystem to also load settings/preferences, and
ensure they appear in the search.
2009-05-26 10:52:56 -04:00
Colin Walters
ff7940b87f Recursively flatten menus
This is a quick-fix which at least shows entries from nested
menus such as Wine.  It also enables us to load "settings.menu".
2009-05-14 13:04:37 -04:00
Colin Walters
b632801c7c Rename ShellAppMonitor to ShellAppSystem
This makes it clearer that really we're now an API, not just a
monitor.
2009-04-22 15:34:14 -04:00