[gnome-control-center] notifications: don't fail if a referenced application does not exist



commit e6e35a2cc9e15241f297ade091624affa3a56150
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Mar 27 00:57:05 2013 +0100

    notifications: don't fail if a referenced application does not exist
    
    If we have settings for an app, but we don't have a desktop file, it
    is likely the app was uninstalled, so just ignore it and avoid the
    criticals.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696665

 panels/notifications/cc-notifications-panel.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/panels/notifications/cc-notifications-panel.c b/panels/notifications/cc-notifications-panel.c
index c9dace7..44fd8ca 100644
--- a/panels/notifications/cc-notifications-panel.c
+++ b/panels/notifications/cc-notifications-panel.c
@@ -270,13 +270,20 @@ maybe_add_app_id (CcNotificationsPanel *panel,
   full_app_id = g_settings_get_string (settings, "application-id");
   app_info = G_APP_INFO (g_desktop_app_info_new (full_app_id));
 
-  app = g_slice_new (Application);
-  app->canonical_app_id = g_strdup (canonical_app_id);
-  app->settings = settings;
-  app->app_info = app_info;
+  if (app_info == NULL) {
+    /* The application cannot be found, probably it was uninstalled */
+    g_object_unref (settings);
+  } else {
+    app = g_slice_new (Application);
+    app->canonical_app_id = g_strdup (canonical_app_id);
+    app->settings = settings;
+    app->app_info = app_info;
+
+    add_application (panel, app);
+  }
 
-  add_application (panel, app);
   g_free (path);
+  g_free (full_app_id);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]