1818 */
1919
2020public class MouseTouchpad.ClickingView : Switchboard .SettingsPage {
21- private GLib . Settings ? xsettings;
22- private GLib . Settings interface_settings;
23-
2421 public ClickingView () {
2522 Object (
2623 header: _(" Behavior" ),
@@ -160,17 +157,13 @@ public class MouseTouchpad.ClickingView : Switchboard.SettingsPage {
160157
161158 child = content_area;
162159
163- var xsettings_schema = SettingsSchemaSource.get_default ().lookup (
164- "org .gnome .settings -daemon .plugins .xsettings ",
165- true
166- );
167- if (xsettings_schema != null ) {
168- xsettings = new GLib .Settings (" org.gnome.settings-daemon.plugins.xsettings" );
169- }
160+ var action_group = new SimpleActionGroup ();
161+ action_group.add_action (new GLib .Settings ("org .gnome .desktop .interface ").create_action ("gtk -enable -primary -paste "));
170162
171- interface_settings = new GLib . Settings ( " org.gnome.desktop.interface " );
163+ insert_action_group (" clicking ", action_group );
172164
173165 var primary_paste_switch = new Gtk .Switch () {
166+ action_name = " clicking.gtk-enable-primary-paste" ,
174167 halign = Gtk . Align . END ,
175168 valign = Gtk . Align . CENTER
176169 };
@@ -183,21 +176,6 @@ public class MouseTouchpad.ClickingView : Switchboard.SettingsPage {
183176 content_area.attach (primary_paste_header , 0 , 8 );
184177 content_area.attach (primary_paste_switch , 1 , 8 );
185178
186- primary_paste_switch.notify["active"].connect (() => {
187- on_primary_paste_switch_changed (primary_paste_switch);
188- });
189-
190- var current_x_value = false ;
191- if (xsettings != null ) {
192- var value = xsettings. get_value (" overrides" ). lookup_value (" Gtk/EnablePrimaryPaste" , VariantType . INT32 );
193- if (value != null ) {
194- current_x_value = value . get_int32 () == 1 ;
195- }
196- }
197-
198- var current_wayland_value = interface_settings.get_boolean ("gtk -enable -primary -paste ");
199- primary_paste_switch. active = current_wayland_value || current_x_value;
200-
201179 var a11y_mouse_settings = new GLib .Settings (" org.gnome.desktop.a11y.mouse" );
202180 a11y_mouse_settings.bind (
203181 "secondary -click -enabled ",
@@ -251,17 +229,4 @@ public class MouseTouchpad.ClickingView : Switchboard.SettingsPage {
251229 return true ;
252230 });
253231 }
254-
255- private void on_primary_paste_switch_changed (Gtk .Switch switch ) {
256- if (xsettings != null ) {
257- var overrides = xsettings. get_value (" overrides" );
258- var dict = new VariantDict (overrides);
259- dict. insert_value (" Gtk/EnablePrimaryPaste" , new Variant .int32 (switch . active ? 1 : 0 ));
260-
261- overrides = dict. end ();
262- xsettings. set_value (" overrides" , overrides);
263- }
264-
265- interface_settings. set_boolean (" gtk-enable-primary-paste" , switch . active);
266- }
267232}
0 commit comments