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.
This commit is contained in:
Siegfried-Angel Gevatter Pujals 2009-08-09 18:32:22 +02:00
parent f96193dc8c
commit 185ccecec1
2 changed files with 8 additions and 2 deletions

View File

@ -65,7 +65,13 @@ Places.prototype = {
this._menuBox.append(home.actor, Big.BoxPackFlags.NONE); this._menuBox.append(home.actor, Big.BoxPackFlags.NONE);
let networkApp = Shell.AppSystem.get_default().load_from_desktop_file('gnome-network-scheme.desktop'); let networkApp = null;
try {
networkApp = Shell.AppSystem.get_default().load_from_desktop_file('gnome-network-scheme.desktop');
} catch(e) {
log("Cannot create \"Network\" item: " + e);
}
if (networkApp != null) { if (networkApp != null) {
let networkIcon = networkApp.create_icon_texture(PLACES_ICON_SIZE); let networkIcon = networkApp.create_icon_texture(PLACES_ICON_SIZE);
let network = new PlaceDisplay(networkApp.get_name(), networkIcon, Lang.bind(this, function () { let network = new PlaceDisplay(networkApp.get_name(), networkIcon, Lang.bind(this, function () {

View File

@ -652,7 +652,7 @@ shell_app_system_load_from_desktop_file (ShellAppSystem *system,
{ {
char *app_path = g_build_filename ("applications", filename, NULL); char *app_path = g_build_filename ("applications", filename, NULL);
success = g_key_file_load_from_data_dirs (keyfile, app_path, &full_path, success = g_key_file_load_from_data_dirs (keyfile, app_path, &full_path,
G_KEY_FILE_NONE, NULL); G_KEY_FILE_NONE, error);
g_free (app_path); g_free (app_path);
} }