[Xfce4-commits] <xfce4-panel:devel> Span monitor is only active when no output is selected.
Nick Schermer
noreply at xfce.org
Mon Feb 1 13:28:01 CET 2010
Updating branch refs/heads/devel
to 34199005a7ed4745dcf3b7ad064bd922cd16ea10 (commit)
from bd84395fd3c1dda8df8c014dce4101336bad8ab2 (commit)
commit 34199005a7ed4745dcf3b7ad064bd922cd16ea10
Author: Nick Schermer <nick at xfce.org>
Date: Mon Feb 1 13:10:10 2010 +0100
Span monitor is only active when no output is selected.
panel/panel-preferences-dialog.c | 25 +++++++++++++++++------
panel/panel-window.c | 39 +++++++++++++++++++++----------------
2 files changed, 40 insertions(+), 24 deletions(-)
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index cc9f1c2..bcb7482 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -342,6 +342,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
gboolean output_selected = FALSE;
gint n = 0, i;
gchar *name, *title;
+ gboolean span_monitors_sensitive = FALSE;
/* remove all the active bindings */
panel_preferences_dialog_bindings_unbind (dialog);
@@ -373,11 +374,6 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
n_monitors = gdk_screen_get_n_monitors (screen);
}
- /* show or hide the span-monitors option */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "span-monitors");
- panel_return_if_fail (GTK_IS_WIDGET (object));
- g_object_set (G_OBJECT (object), "visible", n_monitors > 1, NULL);
-
/* update the output selector */
object = gtk_builder_get_object (GTK_BUILDER (dialog), "output-name");
panel_return_if_fail (GTK_IS_COMBO_BOX (object));
@@ -401,6 +397,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
output_selected = TRUE;
+ span_monitors_sensitive = TRUE;
}
if (n_screens > 1)
@@ -476,16 +473,23 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
{
/* hide the selector */
selector_visible = FALSE;
+ span_monitors_sensitive = TRUE;
}
- g_free (output_name);
-
g_signal_handler_unblock (G_OBJECT (object), dialog->output_changed_handler_id);
/* update visibility of the output selector */
object = gtk_builder_get_object (GTK_BUILDER (dialog), "output-box");
panel_return_if_fail (GTK_IS_WIDGET (object));
g_object_set (G_OBJECT (object), "visible", selector_visible, NULL);
+
+ /* monitor spanning is only active when no output is selected */
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "span-monitors");
+ panel_return_if_fail (GTK_IS_WIDGET (object));
+ gtk_widget_set_sensitive (GTK_WIDGET (object), span_monitors_sensitive);
+ g_object_set (G_OBJECT (object), "visible", n_monitors > 1, NULL);
+
+ g_free (output_name);
}
@@ -497,6 +501,7 @@ panel_preferences_dialog_output_changed (GtkComboBox *combobox,
GtkTreeIter iter;
GtkTreeModel *model;
gchar *output_name = NULL;
+ GObject *object;
panel_return_if_fail (GTK_IS_COMBO_BOX (combobox));
panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
@@ -507,6 +512,12 @@ panel_preferences_dialog_output_changed (GtkComboBox *combobox,
model = gtk_combo_box_get_model (combobox);
gtk_tree_model_get (model, &iter, OUTPUT_NAME, &output_name, -1);
g_object_set (G_OBJECT (dialog->active), "output-name", output_name, NULL);
+
+ /* monitor spanning does not work when an output is selected */
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "span-monitors");
+ panel_return_if_fail (GTK_IS_WIDGET (object));
+ gtk_widget_set_sensitive (GTK_WIDGET (object), output_name == NULL);
+
g_free (output_name);
}
}
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 4ed8208..a8a56d1 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -587,7 +587,13 @@ panel_window_set_property (GObject *object,
case PROP_OUTPUT_NAME:
g_free (window->output_name);
- window->output_name = g_value_dup_string (value);
+
+ val_string = g_value_get_string (value);
+ if (exo_str_is_empty (val_string))
+ window->output_name = NULL;
+ else
+ window->output_name = g_strdup (val_string);
+
panel_window_screen_layout_changed (window->screen, window);
break;
@@ -1615,9 +1621,21 @@ panel_window_screen_layout_changed (GdkScreen *screen,
n_monitors, window->output_name,
PANEL_DEBUG_BOOL (window->span_monitors));
- if (window->output_name != NULL
- && strncmp (window->output_name, "screen-", 7) == 0
- && sscanf (window->output_name, "screen-%d", &screen_num) == 1)
+ if (window->output_name == NULL
+ && (window->span_monitors || n_monitors == 1))
+ {
+ get_screen_geometry:
+
+ /* get the screen geometry we also use this if there is only
+ * one monitor and no output is choosen, as a fast-path */
+ a.x = a.y = 0;
+ a.width = gdk_screen_get_width (screen);
+ a.height = gdk_screen_get_height (screen);
+ panel_return_if_fail (a.width > 0 && a.height > 0);
+ }
+ else if (window->output_name != NULL
+ && strncmp (window->output_name, "screen-", 7) == 0
+ && sscanf (window->output_name, "screen-%d", &screen_num) == 1)
{
/* check if the panel is on the correct screen */
if (gdk_screen_get_number (screen) != screen_num)
@@ -1645,19 +1663,6 @@ panel_window_screen_layout_changed (GdkScreen *screen,
/* screen is correct, get geometry and continue */
goto get_screen_geometry;
}
- else if (window->span_monitors
- || (n_monitors == 1
- && window->output_name == NULL))
- {
- get_screen_geometry:
-
- /* get the screen geometry we also use this if there is only
- * one monitor and no output is choosen, as a fast-path */
- a.x = a.y = 0;
- a.width = gdk_screen_get_width (screen);
- a.height = gdk_screen_get_height (screen);
- panel_return_if_fail (a.width > 0 && a.height > 0);
- }
else
{
if (exo_str_is_empty (window->output_name))
More information about the Xfce4-commits
mailing list