summaryrefslogtreecommitdiff
path: root/capplets/display/xrandr-capplet.c
diff options
context:
space:
mode:
authorClement Lefebvre <[email protected]>2015-09-04 16:00:03 +0100
committerClement Lefebvre <[email protected]>2015-09-04 16:00:03 +0100
commit5afb6c09ed3770753eaf068f1a6f998c8d0b9b07 (patch)
tree60c914d59b7e2ce300b978db362a13f6b31e0f84 /capplets/display/xrandr-capplet.c
parentae8081d9bd6483d58eefa7ef781bc1d690d64278 (diff)
downloadmate-control-center-5afb6c09ed3770753eaf068f1a6f998c8d0b9b07.tar.bz2
mate-control-center-5afb6c09ed3770753eaf068f1a6f998c8d0b9b07.tar.xz
Display settings: Added support to set the primary monitor.
Diffstat (limited to 'capplets/display/xrandr-capplet.c')
-rw-r--r--capplets/display/xrandr-capplet.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 6b09de84..bc91fd32 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -63,6 +63,7 @@ struct App
GtkWidget *panel_checkbox;
GtkWidget *clone_checkbox;
GtkWidget *show_icon_checkbox;
+ GtkWidget *primary_button;
/* We store the event timestamp when the Apply button is clicked */
GtkWidget *apply_button;
@@ -690,6 +691,8 @@ rebuild_gui (App *app)
#endif
gtk_widget_set_sensitive (app->panel_checkbox, sensitive);
+ gtk_widget_set_sensitive (app->primary_button, app->current_output && !mate_rr_output_info_get_primary(app->current_output));
+
app->ignore_gui_changes = FALSE;
}
@@ -2178,6 +2181,24 @@ on_detect_displays (GtkWidget *widget, gpointer data)
}
}
+static void
+set_primary (GtkWidget *widget, gpointer data)
+{
+ App *app = data;
+ int i;
+ MateRROutputInfo **outputs;
+
+ if (!app->current_output)
+ return;
+
+ outputs = mate_rr_config_get_outputs (app->current_configuration);
+ for (i=0; outputs[i]!=NULL; i++) {
+ mate_rr_output_info_set_primary (outputs[i], outputs[i] == app->current_output);
+ }
+
+ gtk_widget_set_sensitive (app->primary_button, !mate_rr_output_info_get_primary(app->current_output));
+}
+
#define MSD_XRANDR_SCHEMA "org.mate.SettingsDaemon.plugins.xrandr"
#define SHOW_ICON_KEY "show-notification-icon"
#define DEFAULT_CONFIGURATION_FILE_KEY "default-configuration-file"
@@ -2511,6 +2532,10 @@ run_application (App *app)
g_signal_connect (_gtk_builder_get_widget (builder, "detect_displays_button"),
"clicked", G_CALLBACK (on_detect_displays), app);
+ app->primary_button = _gtk_builder_get_widget (builder, "primary_button");
+
+ g_signal_connect (app->primary_button, "clicked", G_CALLBACK (set_primary), app);
+
app->show_icon_checkbox = _gtk_builder_get_widget (builder,
"show_notification_icon");