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

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


Updating branch refs/heads/master
         to f5c10bb8280e44d6200c91a12d6cb7091343b72e (commit)
       from 92cbbd79df85d5412b654e9708a5c274dae573ba (commit)

commit f5c10bb8280e44d6200c91a12d6cb7091343b72e
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