Commit Graph

97 Commits

Author SHA1 Message Date
Jasper St. Pierre
40c966fcd6 app-system: Remove lookup_app_for_path
It's absurdly silly. Just modify the one place that uses it
to be better.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-11-02 20:12:37 -04:00
Jasper St. Pierre
d9245598a4 app-system: Remove known_vendor_prefixes
This does remove support for legacy prefixed app infos with
subdirs, but since we want to remove support for the menu spec,
let's not even bother.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-11-02 20:12:37 -04:00
Jasper St. Pierre
03b0f4b16b app-system: Remove get_tree
Make clients construct their own gmenu tree if they need it.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-11-02 20:12:37 -04:00
Jasper St. Pierre
2daa0d057b app-system: Map wmclass to ID rather than apps
This makes the refcounting and memory management easier to understand.
2013-11-02 20:12:36 -04:00
Jasper St. Pierre
76eca409a3 app-system: Don't use gmenu_tree_entry_get_desktop_app_info
It's a broken method when it comes to giving us a useful GDesktopAppInfo,
and it's hard to fix libgmenu properly, so simply recreate the app info
using the desktop file ID that libgmenu has.
2013-11-02 20:12:36 -04:00
Jasper St. Pierre
d84b018ba7 app: Port to be based on GDesktopAppInfo
We weren't using the GMenuTreeEntry for anything special anymore,
so remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-11-02 20:12:36 -04:00
Jasper St. Pierre
027c3d1661 app-system: Remove lookup_app_by_tree_entry
We want to move away from gnome-menus eventually, so the simple
utility method isn't really worth keeping around. Reimplement it
in the one place that uses it.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-11-02 20:12:36 -04:00
Jasper St. Pierre
27cac10d0c appDisplay: Use a proper string key for the app search provider
Since we're going to be caching results based on the result ID,
we need to return a string-based result ID to cache on.

https://bugzilla.gnome.org/show_bug.cgi?id=704912
2013-10-30 13:00:47 -04:00
Michael Catanzaro
9291594330 app-system: remove outdated comment
This parameter was removed before 3.2 but the comment stuck around.
2013-10-12 10:09:36 -05:00
Jasper St. Pierre
3a4782cc64 app-system: Fix some enum warnings
https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-10-02 09:49:03 -04:00
Giovanni Campagna
2acd23b14c ShellAppSystem: handle desktop files with capital letters
This is needed to handle applications that are converted to
reverse dns notation, if their application ID includes capital
letters (as it is often the case for DBus names)

https://bugzilla.gnome.org/show_bug.cgi?id=706252
2013-08-18 22:05:44 +02:00
Giovanni Campagna
2a95273b79 ShellWindowTracker: complete WM_CLASS fix
Chromium (but not google-chrome) has a StartupWMClass in the desktop
file, so we must match the instance part first to have chrome
web apps working.
Also, we must take care of apps without a wm_class or instance at
all.

https://bugzilla.gnome.org/show_bug.cgi?id=673657
2013-08-08 14:15:34 +02:00
Giovanni Campagna
db75734774 Use StartupWMClass to associate window and applications
Some applications (such as most Java apps, as well as Chrome Web apps) ship
with desktop files that have the wrong name, but whose StartupWMClass
field contains the right value. Therefore first check that key, against
both the class and instance part of WM_CLASS, and only use the filename
if nothing else works.

https://bugzilla.gnome.org/show_bug.cgi?id=673657
2013-08-07 12:17:42 +02:00
Jasper St. Pierre
c72ae375c8 app-system: Remove last real use of shell_app_get_tree_entry
We want to replace our GMenuTreeEntries with GDesktopAppInfos

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-05-12 14:45:36 -04:00
Jasper St. Pierre
0fd6ae5330 app-system: Use g_hash_table_iter_remove
glib now provides an iteration-safe way to remove items from
the hash table, so use it instead of building a separate list.

https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-05-12 14:44:42 -04:00
Jasper St. Pierre
c8792ccfa6 app-system: Kill an unused warning
https://bugzilla.gnome.org/show_bug.cgi?id=698486
2013-05-12 14:44:42 -04:00
Giovanni Campagna
3044a6b517 Remove builtin settings search provider
It is now provided as a remote provider by gnome-control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=690824
2013-02-18 16:56:45 +01:00
Jasper St. Pierre
754df5ebe2 shell-app-system: Ensure that we correctly order subsearches
As we use g_slist_prepend for efficiency when building the list
of results before ordering it, we need to make sure we traverse
the list of previous results backwards so that it's built in
the same order.

https://bugzilla.gnome.org/show_bug.cgi?id=693936
2013-02-16 13:33:45 -05:00
Jasper St. Pierre
5d1de33026 Use the standard apps tree for gnome-control-center panels desktop files
gnome-control-center is planning on removing its own tree in the
future. Since it already installs these applications into
/usr/share/applications, just use this for now.

https://bugzilla.gnome.org/show_bug.cgi?id=692483
2013-01-26 19:56:01 -05:00
Jasper St. Pierre
f2ba49fa35 app-system: Remove unused get_settings_tree method
The last use for this is long-gone.

https://bugzilla.gnome.org/show_bug.cgi?id=692483
2013-01-26 19:56:00 -05:00
Aleksander Morgado
5308d12239 search: skip combining diacritical marks in search operations
https://bugzilla.gnome.org/show_bug.cgi?id=648587
2012-12-12 17:41:45 +01:00
Jasper St. Pierre
df56ff4f09 app-system: Don't show items with NoDisplay parents in the search
Additionally, require gnome-menus 3.5.3, as we're using new API
introduced there.

https://bugzilla.gnome.org/show_bug.cgi?id=658176
2012-06-21 16:03:48 -04:00
Jasper St. Pierre
96cdc9c4eb app-system: Use g_slist_free_full
https://bugzilla.gnome.org/show_bug.cgi?id=658176
2012-06-21 16:03:48 -04:00
Jasper St. Pierre
3b4ad5cd7d app-system: Clean up imports
https://bugzilla.gnome.org/show_bug.cgi?id=658176
2012-06-21 16:03:48 -04:00
Jasper St. Pierre
196f6c241a appDisplay: Don't show apps in NoDisplay categories in the All view
We explicitly include NoDisplay applications in the ShellAppSystem because
we want app tracking for them, but we explicitly filter NoDisplay applications
out when showing them to the user because we don't want to show them to the
user. We also based our "All" apps view on a flattened list of apps. While
we did check for NoDisplay on the app item itself, we didn't check against
its parents. Refactor the app display view to not use a separate flat list
of applications, but instead a concatenation of all the applications in all
the loaded categories.

https://bugzilla.gnome.org/show_bug.cgi?id=658176
2012-06-11 13:55:59 -04:00
Jasper St. Pierre
2e8881b77c notificationDaemon: Match app based on WM_CLASS
Most tray applets won't have an associated window in the same PID. We
need to fall back to the WM_CLASS in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=673761
2012-04-27 15:49:18 -04:00
Giovanni Campagna
55a4517cd1 Fix documentation warnings
gobject-introspection now emits many more warnings for malformed
comments, and they fail the build.

https://bugzilla.gnome.org/show_bug.cgi?id=673656
2012-04-09 19:57:51 +02:00
Florian Müllner
b990ed2c23 app-system: Don't assume that gmenu_tree_load_sync() sets error
The function may return FALSE without setting the GError, so don't
assume it is set to prevent a crash in that case. While at it, free
the GError we were leaking before.

https://bugzilla.gnome.org/show_bug.cgi?id=670418
2012-02-20 11:41:57 +01:00
Jasper St. Pierre
b40b19997a shell: Use generic marshaller
https://bugzilla.gnome.org/show_bug.cgi?id=662152
2012-01-25 19:03:48 -05:00
Jasper St. Pierre
8d6ab32b9a shell-app-system: Add Debian to the vendor prefixes
It seems that Debian has their own prefixes in something like
debian-xterm.desktop. To properly do application matching in these cases,
we need to strip the debian- prefix.

https://bugzilla.gnome.org/show_bug.cgi?id=665647
2012-01-25 02:11:11 -05:00
Florian Müllner
aee3c6f041 shell-app: Remove MATCH_MULTIPLE_{PREFIX,SUFFIX}
We originally OR'ed search terms and favored results which matched
multiple times to get more relevant results. When changing search
to AND search terms, the semantics of "multiple matches" were
changed to refer to a single term matching multiple criteria (name,
executable), which seemed like a good idea at the time.

However in practice this just results in applications whose
user-visible name matches the executable name on disk being
favored over applications using a more generic name, which
isn't too useful (in particular when taking usage frequency
into account).

https://bugzilla.gnome.org/show_bug.cgi?id=623372
2011-10-13 17:46:45 +02:00
Florian Müllner
da83ad561b app-system: Consider usage frequency in search results
Application search results are internally categorized in four sets,
multiple and single prefix matches and multiple and single substring
matches. Each set is currently sorted alphabetically by application
name when concatenating the sets to the final result.
Change the last step to sort each set by usage frequency instead,
which is more likely to favor the most relevant match than
"arbitrary" alphabetic order.

https://bugzilla.gnome.org/show_bug.cgi?id=623372
2011-10-13 17:46:45 +02:00
Colin Walters
3833124d66 apps: Uniquify application instances explicitly by id
Commit 0af108211c introduced a
regression where applications that appear in multiple categories were
duplicated in the "All Apps" list, because we switched from
uniquifying on desktop file ID to the GMenuTreeEntry.

Switch back to keeping the set of apps based on ID.  To flesh this
out, we keep the ShellApp instance for a given ID around forever, and
when we're loading new contents, we replace the GMenuTreeEntry inside
the app. That means callers still get new data.

We still keep around the running app list, though we could just
recompute it from the app list now.

https://bugzilla.gnome.org/show_bug.cgi?id=659351
2011-09-20 13:56:53 -04:00
Colin Walters
e5e1b52abf apps: Unify code for apps/settings loading more
The apps and settings loading code duplicated the part to traverse a
GMenuTree.  Unify this by adding a new function to return a flattened
set.

This will also be useful for a future change to how we store apps -
this way we can look at both the current set of apps and the new set.

https://bugzilla.gnome.org/show_bug.cgi?id=659351
2011-09-20 13:56:53 -04:00
Colin Walters
0af108211c apps: Ensure running apps override new .desktop file data
This patch fixes the "apps vanish from alt-TAB bug".

If a "package system" rips away and possibly replaces .desktop files
at some random time, we have historically used inotify to detect this
and reread state (in a racy way, but...).  In GNOME 2, this was
generally not too problematic because the menu widget was totally
separate from the list of windows - and the data they operate on was
disjoint as well.

In GNOME 3 we unify these, and this creates architectural problems
because the windows are tied to the app.

What this patch tries to do is, when rereading the application state,
if we have a running application, we keep that app around instead of
making a new instance.  This ensures we preserve any state such as the
set of open windows.

This requires moving the running state into ShellAppSystem.  Adjust
callers as necessary, and while we're at it drop the unused "contexts"
stuff.

This is just a somewhat quick band-aid; a REAL fix would require us
having low-level control over application installation.  As long as
we're on top of random broken tar+wget wrappers, it will be gross.

A slight future improvement to this patch would add an explicit
"merge" between the old and new data.  I think probably we always keep
around the ShellApp corresponding to a given ID, but replace its
GMenuTreeEntry.

https://bugzilla.gnome.org/show_bug.cgi?id=657990
2011-09-05 17:29:41 -04:00
Jasper St. Pierre
5d138e1b79 appDisplay: Don't show NoDisplay items in the Applications tab 2011-08-29 15:56:07 -04:00
Colin Walters
c5de239e25 shell_util_normalize_and_casefold: New utility function
Merge the duplicated copies into shell-util.
2011-08-10 13:00:06 -04:00
Colin Walters
10dcc100e9 Kill off ShellAppInfo, move into ShellApp
This dramatically thins down and sanitizes the application code.

The ShellAppSystem changes in a number of ways:
* Preferences are special cased more explicitly; they aren't apps,
  they're shortcuts for an app), and we don't have many of them, so
  don't need e.g. the optimizations in ShellAppSystem for searching.
* get_app() changes to lookup_app() and returns null if an app isn't
  found.  The semantics where it tried to find the .desktop file
  if we didn't know about it were just broken; I am pretty sure no
  caller needs this, and if they do we'll fix them.
* ShellAppSystem maintains two indexes on apps (by desktop file id
  and by GMenuTreeEntry), but is no longer in the business of
  dealing with GMenuTree as far as hierarchy and categories go.  That
  is moved up into js/ui/appDisplay.js.  Actually, it flattens both
  apps and settings.

Also, ShellWindowTracker is now the sole reference-owner for
window-backed apps.  We still do the weird "window:0x1234beef" id
for these apps, but a reference is not stored in ShellAppSystem.

The js/ui/appDisplay.js code is rewritten, and sucks a lot less.
Variable names are clearer:

_apps -> _appIcons
_filterApp -> _visibleApps
_filters -> _categoryBox

Similarly for function names.  We no longer call (for every app) a
recursive lookup in GMenuTree to see if it's in a particular section
on every category switch; it's all cached.

NOTE - this intentionally reverts the incremental loading code from
commit 7813c5b93f.  It's fast enough
here without that.

https://bugzilla.gnome.org/show_bug.cgi?id=648149
2011-08-10 12:59:32 -04:00
Florian Müllner
004c5cf287 shell-app-system: Load settings apps
When porting to the new gnome-menus API in commit 8f3bdd4f1, the
initial loading of settings apps was left out, so settings panels
are neither found nor can be launched from the top panel menus.
2011-08-02 22:17:50 +02:00
Colin Walters
8f3bdd4f1a Port to new gnome-menus API
Since gnome-menus is now introspectable, eventually we can drop
ShellAppSystem entirely.  For now though, just do the basic port.

https://bugzilla.gnome.org/show_bug.cgi?id=648149
2011-08-01 13:42:17 -04:00
Colin Walters
c97a8602a1 ShellAppSystem: Only search gnomecc.menu for preferences
settings.menu was removed in gnome-menus commit
b68bcd27f44ce2c494f6e3cd9695890b9c02af04; gnomecc.menu is the intended
replacement.

(On Red Hat Linux derived systems, settings.menu continues to exist)

https://bugzilla.gnome.org/show_bug.cgi?id=645063
2011-03-25 10:35:38 -04:00
Maxim Ermilov
77cdb17cee ShellAppSystem: dynamically generate known_vendor_prefixes
It create prefix based on desktop file's id and desktop file's path and vendor_prefix.
https://bugzilla.gnome.org/show_bug.cgi?id=620464
2011-03-20 23:39:38 +03:00
William Jon McCann
dd99ed73a9 Fallback to using a generic when requested image isn't found
Use a type specific generic image when the requested icon
can't be loaded instead of using an empty texture.

https://bugzilla.gnome.org/show_bug.cgi?id=644668
2011-03-17 14:02:04 -04:00
Colin Walters
fea8b6da2f Remove broken ShellAppSystem API and all consumers
In commit 9bd22dc0, I introduced an API to load an arbitrary
.desktop file, not necessarily from the menu path.  It turns
out this function was broken because it created ShellApp instances
that were *different* from ones that were cached normally.

As far as I can tell, we didn't initially use it.  Then later
Util.spawnDesktop was created which used this function.

Remove this broken function and all callers; if we're loading
.desktop files from *outside* the menu path, we can look at
readding.

This patch also kills off Util.spawnDesktop in favor of callers
talking to ShellAppSystem directly, now that the latter reports
errors.

https://bugzilla.gnome.org/show_bug.cgi?id=644402
2011-03-16 15:07:22 -04:00
Dan Winship
e187961d72 src: update for mutter include reorganization
https://bugzilla.gnome.org/show_bug.cgi?id=641724
2011-03-07 18:33:33 -05:00
Colin Walters
95e6eae23b Fixes for previous ShellAppSystem patch a138f59c
Wasn't amended by mistake.
2011-02-08 14:38:24 -05:00
Colin Walters
a138f59cb0 Use new GLib application API for launching
Launch child processes more directly; we retrieve the PID, and
use it to keep track of the .desktop file we launched.

Now, when we get a window, since the X window has a PID, we
have a pretty strong association.

.desktop file <-> PID <-> window

And can thus map window back to .desktop file.

https://bugzilla.gnome.org/show_bug.cgi?id=637745
2011-02-08 10:43:39 -05:00
Dan Winship
13edecde6c Remove set-but-unused variables, to appease gcc 4.6
https://bugzilla.gnome.org/show_bug.cgi?id=640447
2011-01-24 13:35:03 -05:00
Giovanni Campagna
21ac225981 StIcon: add support for GIcon
Add a "gicon" property so that a GIcon can be used instead of an
icon name, while still getting icon recoloring from the theme.
Also include a compatibility wrapper in libshell until GJS has
support for interface static methods.

https://bugzilla.gnome.org/show_bug.cgi?id=622451
2010-11-16 22:11:27 +01:00
Owen W. Taylor
aed6375a2d Move StIconType to st-types.h from st-texture-cache.h
StIconType will be used by a new StIcon class, so move it to the
header file of common enumerations. Including st-types.h which had
the St single-include check revealed that st-texture-cache.h didn't
have that check and several places were including that directly.
Fix that up.

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:25 -05:00