[vino] Avoid a crash when showing the preferences



commit 22f6575b32675ae38567efd3ed8e2362bbc9240d
Author: David King <amigadave amigadave com>
Date:   Mon Oct 19 14:48:44 2015 +0100

    Avoid a crash when showing the preferences
    
    Show an error message when the preferences desktop file is not found,
    such as if gnome-control-center is not installed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756654

 server/vino-status-icon.c      |    5 +++++
 server/vino-status-tube-icon.c |    9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/server/vino-status-icon.c b/server/vino-status-icon.c
index 53eec02..aaab0af 100644
--- a/server/vino-status-icon.c
+++ b/server/vino-status-icon.c
@@ -202,6 +202,11 @@ vino_status_icon_preferences (VinoStatusIcon *icon)
   info = g_desktop_app_info_new ("gnome-sharing-panel.desktop");
   if (info == NULL)
     info = g_desktop_app_info_new ("vino-preferences.desktop");
+  if (info == NULL)
+    {
+      vino_util_show_error (NULL, _("Error displaying preferences"), NULL);
+      return;
+    }
   context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
   if (!g_app_info_launch (G_APP_INFO (info), NULL, G_APP_LAUNCH_CONTEXT (context), &error))
     {
diff --git a/server/vino-status-tube-icon.c b/server/vino-status-tube-icon.c
index 0a23a23..e5cbb11 100644
--- a/server/vino-status-tube-icon.c
+++ b/server/vino-status-tube-icon.c
@@ -165,7 +165,14 @@ vino_status_tube_icon_preferences (VinoStatusTubeIcon *icon)
   GError *error = NULL;
 
   screen = gtk_status_icon_get_screen (GTK_STATUS_ICON (icon));
-  info = g_desktop_app_info_new ("vino-preferences.desktop");
+  info = g_desktop_app_info_new ("gnome-sharing-panel.desktop");
+  if (info == NULL)
+    info = g_desktop_app_info_new ("vino-preferences.desktop");
+  if (info == NULL)
+    {
+      vino_util_show_error (NULL, _("Error displaying preferences"), NULL);
+      return;
+    }
   context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
   if (!g_app_info_launch (G_APP_INFO (info), NULL, G_APP_LAUNCH_CONTEXT (context), &error))
     {


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