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

Nick Schermer noreply at xfce.org
Sat Aug 28 22:54:01 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to 3d98bf008a032f693fab02848dc7e99dcfec9058 (commit)
       from 2faea37f571987be6b07decc73330c38ba5b1a84 (commit)

commit 3d98bf008a032f693fab02848dc7e99dcfec9058
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