[Xfce4-commits] <xfce4-settings:bluesabre/display-settings> Really fix items' sensitivity, for real this time
Simon Steinbeiss
noreply at xfce.org
Thu Oct 18 23:38:10 CEST 2012
Updating branch refs/heads/bluesabre/display-settings
to 90d0b481bdb27d926558a1d401e12d3bfb58d2cf (commit)
from a8d32fb57656bcee83f067c66909828904a5a6d7 (commit)
commit 90d0b481bdb27d926558a1d401e12d3bfb58d2cf
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date: Wed Oct 17 23:27:43 2012 +0200
Really fix items' sensitivity, for real this time
Signed-off-by: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
dialogs/display-settings/main.c | 53 +++++++++++++++++++++-----------------
1 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 0ee24b9..eb66c75 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -385,7 +385,7 @@ static void
display_setting_positions_populate (GtkBuilder *builder)
{
GtkTreeModel *model;
- GObject *combobox;
+ GObject *combobox, *mirror_displays;
GtkTreeIter iter;
guint n;
@@ -394,9 +394,15 @@ display_setting_positions_populate (GtkBuilder *builder)
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
gtk_list_store_clear (GTK_LIST_STORE (model));
- /* Only make the combobox interactive if there is more than one output */
- gtk_widget_set_sensitive (GTK_WIDGET (combobox),
- display_settings_get_n_active_outputs () > 1);
+ /* Only make the combobox interactive if there is more than one output,
+ and if they are not in mirror mode */
+ mirror_displays = gtk_builder_get_object (builder, "mirror-displays");
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mirror_displays)) ||
+ display_settings_get_n_active_outputs () <= 1)
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (combobox), FALSE);
+ return;
+ }
/* Disconnect the "changed" signal to avoid triggering the confirmation
* dialog */
@@ -440,18 +446,24 @@ static void
display_setting_active_displays_populate (GtkBuilder *builder)
{
GtkTreeModel *model;
- GObject *combobox;
+ GObject *combobox, *mirror_displays;
guint n;
GtkTreeIter iter;
/* Get the active-displays combo box store and clear it */
combobox = gtk_builder_get_object (builder, "randr-active-displays");
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
- gtk_list_store_clear (GTK_LIST_STORE (model));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
- /* Only make the combobox interactive if there is more than one output */
- gtk_widget_set_sensitive (GTK_WIDGET (combobox),
- display_settings_get_n_active_outputs () > 1);
+ /* Only make the combobox interactive if there is more than one output,
+ and if they are not in mirror mode */
+ mirror_displays = gtk_builder_get_object (builder, "mirror-displays");
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mirror_displays)) ||
+ display_settings_get_n_active_outputs () <= 1)
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (combobox), FALSE);
+ return;
+ }
/* Disconnect the "changed" signal to avoid triggering the confirmation
* dialog */
@@ -1100,12 +1112,16 @@ display_setting_mirror_displays_toggled (GtkToggleButton *togglebutton,
if (!xfce_randr)
return;
- if (xfce_randr->noutput <= 1)
- return;
-
positions = gtk_builder_get_object (builder, "randr-position");
active_displays = gtk_builder_get_object (builder, "randr-active-displays");
+ if (display_settings_get_n_active_outputs () <= 1)
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (positions), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (active_displays), FALSE);
+ return;
+ }
+
if (gtk_toggle_button_get_active (togglebutton))
{
/* Activate mirror-mode with a single mode for all of them */
@@ -1164,7 +1180,7 @@ display_setting_mirror_displays_populate (GtkBuilder *builder)
check = gtk_builder_get_object (builder, "mirror-displays");
/* Can outputs be cloned? */
- if (xfce_randr->noutput > 1)
+ if (display_settings_get_n_active_outputs () > 1)
mode = xfce_randr_clonable_mode (xfce_randr);
gtk_widget_set_sensitive (GTK_WIDGET (check), mode != None);
@@ -1276,7 +1292,6 @@ display_settings_treeview_selection_changed (GtkTreeSelection *selection,
{
GtkTreeModel *model;
GtkTreeIter iter;
- GObject *mirror_displays, *position_combo, *display_combo;
GtkWidget *popup;
gboolean has_selection;
gint active_id, previous_id;
@@ -1302,16 +1317,6 @@ display_settings_treeview_selection_changed (GtkTreeSelection *selection,
display_setting_rotations_populate (builder);
display_setting_reflections_populate (builder);
- mirror_displays = gtk_builder_get_object (builder, "mirror-displays");
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mirror_displays)))
- {
- position_combo = gtk_builder_get_object (builder, "randr-position");
- display_combo = gtk_builder_get_object (builder, "randr-active-displays");
-
- gtk_widget_set_sensitive (GTK_WIDGET (position_combo), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (display_combo), FALSE);
- }
-
/* redraw the two (old active, new active) popups */
popup = g_hash_table_lookup (display_popups, GINT_TO_POINTER (previous_id));
if (popup)
More information about the Xfce4-commits
mailing list