[Xfce4-commits] <xfce4-settings:master> Add fallback support for proprietary drivers.

Nick Schermer noreply at xfce.org
Sat Aug 28 23:05:17 CEST 2010


Updating branch refs/heads/master
         to 261f0f29b3a81b93afef17653eda1b19bf213bc8 (commit)
       from b7137a0fcee35f515401eded0a8bc02b672b2934 (commit)

commit 261f0f29b3a81b93afef17653eda1b19bf213bc8
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Aug 28 22:53:08 2010 +0200

    Add fallback support for proprietary drivers.

 dialogs/display-settings/main.c       |   53 ++++++++++++++++++++++++++------
 dialogs/display-settings/xfce-randr.c |    2 +-
 2 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index fe34153..42ad2cd 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1020,13 +1020,17 @@ display_settings_minimal_dialog_response (GtkDialog  *dialog,
 gint
 main (gint argc, gchar **argv)
 {
-    GtkWidget  *dialog;
-    GtkBuilder *builder;
-    GError     *error = NULL;
-    GdkDisplay *display;
-    gboolean    succeeded = TRUE;
-    gint        event_base, error_base;
-    guint       first, second;
+    GtkWidget   *dialog;
+    GtkBuilder  *builder;
+    GError      *error = NULL;
+    GdkDisplay  *display;
+    gboolean     succeeded = TRUE;
+    gint         event_base, error_base;
+    guint        first, second;
+    gchar       *command;
+    const gchar *alternative = NULL;
+    const gchar *alternative_icon = NULL;
+    gint         response;
 
     /* Setup translation domain */
     xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -1098,9 +1102,38 @@ main (gint argc, gchar **argv)
 
         if (!xfce_randr)
         {
-            xfce_dialog_show_error (NULL, error, _("Unable to start the Xfce Display Settings"));
-            g_error_free (error);
-            succeeded = FALSE;
+            command = g_find_program_in_path ("nvidia-settings");
+            if (command != NULL)
+            {
+                alternative = _("NVIDIA Settings");
+                alternative_icon = "nvidia-settings";
+            }
+            else
+            {
+                command = g_find_program_in_path ("amdcccle");
+                if (command != NULL)
+                {
+                    alternative = _("ATI Settings");
+                    alternative_icon = "ccc_small";
+                }
+            }
+
+            response = xfce_message_dialog (NULL, NULL, GTK_STOCK_DIALOG_ERROR,
+                                            _("Unable to start the Xfce Display Settings"),
+                                            error ? error->message : NULL,
+                                            GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+                                            alternative != NULL ?XFCE_BUTTON_TYPE_MIXED : NULL,
+                                            alternative_icon, alternative, GTK_RESPONSE_OK, NULL);
+            g_clear_error (&error);
+
+            if (response == GTK_RESPONSE_OK
+                && !g_spawn_command_line_async (command, &error))
+            {
+                xfce_dialog_show_error (NULL, error, _("Unable to launch the proprietary driver settings"));
+                g_error_free (error);
+            }
+
+            g_free (command);
 
             goto cleanup;
         }
diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index 8ff6996..15a7558 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -289,7 +289,7 @@ xfce_randr_new (GdkDisplay  *display,
         xfce_randr_free (randr);
 
         /* set error */
-        g_set_error (error, 0, 0, _("This system has a fake RandR 1.2 support."));
+        g_set_error (error, 0, 0, _("The video driver does not support video outputs"));
 
         /* return nothing */
         return NULL;



More information about the Xfce4-commits mailing list