[Xfce4-commits] [xfce/xfce4-settings] 37/67: display: Make primary-display a GtkSwitch
noreply at xfce.org
noreply at xfce.org
Sat Sep 22 11:23:28 CEST 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-settings.
commit ad40e26fb22bc755556d59697b9f3d199f94f4f8
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sun Aug 26 18:15:49 2018 +0200
display: Make primary-display a GtkSwitch
This makes sense because clicking immediately changes the setting.
---
dialogs/display-settings/display-dialog.glade | 43 ++++++++++++++++-----------
dialogs/display-settings/main.c | 23 ++++++++------
2 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index 35f6c78..bc472ce 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -166,23 +166,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="primary">
- <property name="label" translatable="yes">_Primary display</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">This is a hint for panels, docks and desktop to show on this display preferably.</property>
- <property name="margin_left">12</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -276,6 +259,32 @@
<property name="top_attach">5</property>
</packing>
</child>
+ <child>
+ <object class="GtkSwitch" id="primary">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="margin_left">12</property>
+ <property name="label" translatable="yes">Primary Display:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index d165292..ca9aeb9 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -168,8 +168,9 @@ static void display_settings_minimal_extend_right_toggled (GtkToggleButton *b
static void display_settings_minimal_only_display2_toggled (GtkToggleButton *button,
GtkBuilder *builder);
-static void display_setting_primary_toggled (GtkToggleButton *button,
- GtkBuilder *builder);
+static gboolean display_setting_primary_toggled (GtkWidget *widget,
+ gboolean primary,
+ GtkBuilder *builder);
static void display_setting_mirror_displays_populate (GtkBuilder *builder);
@@ -1025,16 +1026,17 @@ display_setting_mirror_displays_populate (GtkBuilder *builder)
builder);
}
-static void
-display_setting_primary_toggled (GtkToggleButton *togglebutton,
+static gboolean
+display_setting_primary_toggled (GtkWidget *widget,
+ gboolean primary,
GtkBuilder *builder)
{
guint m;
if (!xfce_randr)
- return;
+ return FALSE;
- if (gtk_toggle_button_get_active (togglebutton))
+ if (primary)
{
/* Set currently active display as primary */
xfce_randr->status[active_output]=XFCE_OUTPUT_STATUS_PRIMARY;
@@ -1058,6 +1060,9 @@ display_setting_primary_toggled (GtkToggleButton *togglebutton,
/* Apply the changes */
xfce_randr_apply (xfce_randr, "Default", display_channel);
+ gtk_switch_set_state (GTK_SWITCH (widget), primary);
+
+ return TRUE;
}
static void
@@ -1081,8 +1086,8 @@ display_setting_primary_populate (GtkBuilder *builder)
/* Block the "changed" signal to avoid triggering the confirmation dialog */
g_signal_handlers_block_by_func (check, display_setting_primary_toggled,
builder);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
- xfce_randr->status[active_output] != XFCE_OUTPUT_STATUS_SECONDARY);
+ gtk_switch_set_state (GTK_SWITCH (check),
+ xfce_randr->status[active_output] != XFCE_OUTPUT_STATUS_SECONDARY);
/* Unblock the signal */
g_signal_handlers_unblock_by_func (check, display_setting_primary_toggled,
builder);
@@ -1641,7 +1646,7 @@ display_settings_dialog_new (GtkBuilder *builder)
primary = gtk_builder_get_object (builder, "primary");
mirror = gtk_builder_get_object (builder, "mirror-displays");
g_signal_connect (G_OBJECT (check), "state-set", G_CALLBACK (display_setting_output_toggled), builder);
- g_signal_connect (G_OBJECT (primary), "toggled", G_CALLBACK (display_setting_primary_toggled), builder);
+ g_signal_connect (G_OBJECT (primary), "state-set", G_CALLBACK (display_setting_primary_toggled), builder);
g_signal_connect (G_OBJECT (mirror), "toggled", G_CALLBACK (display_setting_mirror_displays_toggled), builder);
if (xfce_randr->noutput > 1)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list