[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Improves the "last active output not disabled" dialog

Jérôme Guelfucci noreply at xfce.org
Sun Jul 4 12:16:04 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to a9bdb69e6cec954e46948d5dc6b5f59d909af646 (commit)
       from 36a873cb6707a72f226b5ebcccbdca9a9efafb7a (commit)

commit a9bdb69e6cec954e46948d5dc6b5f59d909af646
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Sat Jul 3 22:28:32 2010 +0200

    Improves the "last active output not disabled" dialog
    
    Only log a warning in xfce4-settings-helper, and move the error popup to
    xfce4-display-settings.

 dialogs/display-settings/main.c  |   38 +++++++++++++++++++++++++++++++++++---
 xfce4-settings-helper/displays.c |    6 ++----
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index e4a6c59..6e6ffad 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -128,6 +128,25 @@ XfceRandrLegacy *xfce_randr_legacy = NULL;
 
 
 
+#ifdef HAS_RANDR_ONE_POINT_TWO
+static guint
+display_settings_get_n_active_outputs (void)
+{
+    guint n, count = 0;
+
+    g_assert (xfce_randr != NULL);
+
+    for (n = 0; n < xfce_randr->noutput; ++n)
+    {
+        if (xfce_randr->mode[n] != None)
+            ++count;
+    }
+    return count;
+}
+#endif
+
+
+
 static gboolean
 display_setting_combo_box_get_value (GtkComboBox *combobox,
                                      gint        *value)
@@ -824,9 +843,22 @@ display_setting_output_toggled (GtkToggleButton *togglebutton,
     }
     else
     {
-        XFCE_RANDR_MODE (xfce_randr) = None;
-        /* Apply the changes */
-        xfce_randr_apply (xfce_randr, "Default", display_channel);
+        /* prevents the user from disabling everything… */
+        if (display_settings_get_n_active_outputs () > 1)
+        {
+            XFCE_RANDR_MODE (xfce_randr) = None;
+            /* Apply the changes */
+            xfce_randr_apply (xfce_randr, "Default", display_channel);
+        }
+        else
+        {
+            xfce_dialog_show_warning (NULL,
+                                      _("The last active output must not be disabled, the system would"
+                                        " be unusable."),
+                                      _("Selected output not disabled"));
+            /* set it back to active */
+            gtk_toggle_button_set_active (togglebutton, TRUE);
+        }
     }
 }
 
diff --git a/xfce4-settings-helper/displays.c b/xfce4-settings-helper/displays.c
index 34a929e..3385e7b 100644
--- a/xfce4-settings-helper/displays.c
+++ b/xfce4-settings-helper/displays.c
@@ -636,10 +636,8 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper,
 
             if (nactive == 1)
             {
-                xfce_dialog_show_warning (NULL,
-                                          _("The last active screen must not be disabled, the system would"
-                                            " be unusable."),
-                                          _("%s (%s) was not disabled"), str_value, output->info->name);
+                xfconf_channel_set_bool (helper->channel, property, TRUE);
+                g_warning ("Last active output (%s) not disabled.", output->info->name);
                 continue;
             }
             crtc = xfce_displays_helper_find_crtc_by_id (resources, crtcs,



More information about the Xfce4-commits mailing list