[gnome-control-center] mouse: Connect signal handlers swapped



commit 3dc77a68e63df809f9e8e6c1be3c0f0e0e8d5427
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed May 30 11:23:14 2018 +1200

    mouse: Connect signal handlers swapped

 panels/mouse/gnome-mouse-properties.c  | 29 +++++++++++------------------
 panels/mouse/gnome-mouse-properties.ui |  6 +++---
 panels/mouse/gnome-mouse-test.c        | 15 ++++++---------
 panels/mouse/gnome-mouse-test.ui       |  4 ++--
 4 files changed, 22 insertions(+), 32 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 8c93381b6..5af129391 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -131,17 +131,14 @@ setup_touchpad_options (CcMouseProperties *self)
 }
 
 static void
-two_finger_scrolling_changed_event (GtkSwitch *button,
-                                   gboolean   state,
-                                   gpointer user_data)
+two_finger_scrolling_changed_event (CcMouseProperties *self,
+                                   gboolean           state)
 {
-       CcMouseProperties *self = user_data;
-
        if (self->changing_scroll)
                return;
 
        g_settings_set_boolean (self->touchpad_settings, "two-finger-scrolling-enabled", state);
-       gtk_switch_set_state (button, state);
+       gtk_switch_set_state (GTK_SWITCH (self->two_finger_scrolling_switch), state);
 
        if (state && gtk_widget_get_visible (self->edge_scrolling_row)) {
                /* Disable edge scrolling if two-finger scrolling is enabled */
@@ -150,17 +147,14 @@ two_finger_scrolling_changed_event (GtkSwitch *button,
 }
 
 static void
-edge_scrolling_changed_event (GtkSwitch *button,
-                             gboolean   state,
-                             gpointer user_data)
+edge_scrolling_changed_event (CcMouseProperties *self,
+                             gboolean           state)
 {
-       CcMouseProperties *self = user_data;
-
        if (self->changing_scroll)
                return;
 
        g_settings_set_boolean (self->touchpad_settings, "edge-scrolling-enabled", state);
-       gtk_switch_set_state (button, state);
+       gtk_switch_set_state (GTK_SWITCH (self->edge_scrolling_switch), state);
 
        if (state && gtk_widget_get_visible (self->two_finger_scrolling_row)) {
                /* Disable two-finger scrolling if edge scrolling is enabled */
@@ -329,17 +323,16 @@ device_changed (GsdDeviceManager *device_manager,
 }
 
 static void
-on_content_size_changed (GtkWidget     *widget,
-                         GtkAllocation *allocation,
-                         gpointer       data)
+on_content_size_changed (CcMouseProperties *self,
+                        GtkAllocation     *allocation)
 {
        if (allocation->height < 490) {
-               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
                                                GTK_POLICY_NEVER, GTK_POLICY_NEVER);
        } else {
-               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
+               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
                                                GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-               gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (widget), 490);
+               gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (self->scrolled_window), 490);
        }
 }
 
diff --git a/panels/mouse/gnome-mouse-properties.ui b/panels/mouse/gnome-mouse-properties.ui
index d23c66d16..12c9876fa 100644
--- a/panels/mouse/gnome-mouse-properties.ui
+++ b/panels/mouse/gnome-mouse-properties.ui
@@ -25,7 +25,7 @@
         <property name="can_focus">True</property>
         <property name="shadow_type">none</property>
         <property name="hscrollbar_policy">never</property>
-        <signal name="size-allocate" handler="on_content_size_changed"/>
+        <signal name="size-allocate" handler="on_content_size_changed" object="CcMouseProperties" 
swapped="yes"/>
         <child>
           <object class="GtkBox" id="prefs_widget">
             <property name="visible">True</property>
@@ -653,7 +653,7 @@
                                         <property name="can_focus">True</property>
                                         <property name="halign">end</property>
                                         <property name="valign">center</property>
-                                        <signal name="state-set" 
handler="two_finger_scrolling_changed_event"/>
+                                        <signal name="state-set" 
handler="two_finger_scrolling_changed_event" object="CcMouseProperties" swapped="yes"/>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
@@ -707,7 +707,7 @@
                                         <property name="can_focus">True</property>
                                         <property name="halign">end</property>
                                         <property name="valign">center</property>
-                                        <signal name="state-set" handler="edge_scrolling_changed_event"/>
+                                        <signal name="state-set" handler="edge_scrolling_changed_event" 
object="CcMouseProperties" swapped="yes"/>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
diff --git a/panels/mouse/gnome-mouse-test.c b/panels/mouse/gnome-mouse-test.c
index 1db81763a..3e29e67b7 100644
--- a/panels/mouse/gnome-mouse-test.c
+++ b/panels/mouse/gnome-mouse-test.c
@@ -183,9 +183,7 @@ setup_scroll_image (CcMouseTest *self)
 /* Callback issued when the user clicks the double click testing area. */
 
 static gboolean
-button_drawing_area_button_press_event (GtkWidget *widget,
-                                       GdkEventButton *event,
-                                       CcMouseTest *self)
+button_drawing_area_button_press_event (CcMouseTest *self, GdkEventButton *event)
 {
        gint double_click_time;
 
@@ -236,17 +234,16 @@ button_drawing_area_button_press_event (GtkWidget *widget,
 }
 
 static gboolean
-button_drawing_area_draw_event (GtkWidget *widget,
-                               cairo_t *cr,
-                               CcMouseTest *self)
+button_drawing_area_draw_event (CcMouseTest *self,
+                                cairo_t     *cr)
 {
        gdouble center_x, center_y, size;
        GdkRGBA inner_color, outer_color;
        cairo_pattern_t *pattern;
 
-       size = MAX (MIN (gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)), 
1);
-       center_x = gtk_widget_get_allocated_width (widget) / 2.0;
-       center_y = gtk_widget_get_allocated_height (widget) / 2.0;
+       size = MAX (MIN (gtk_widget_get_allocated_width (self->button_drawing_area), 
gtk_widget_get_allocated_height (self->button_drawing_area)), 1);
+       center_x = gtk_widget_get_allocated_width (self->button_drawing_area) / 2.0;
+       center_y = gtk_widget_get_allocated_height (self->button_drawing_area) / 2.0;
 
        switch (self->double_click_state) {
        case DOUBLE_CLICK_TEST_ON:
diff --git a/panels/mouse/gnome-mouse-test.ui b/panels/mouse/gnome-mouse-test.ui
index 8e9ca19db..d547331ec 100644
--- a/panels/mouse/gnome-mouse-test.ui
+++ b/panels/mouse/gnome-mouse-test.ui
@@ -76,8 +76,8 @@
                         <property name="margin_top">20</property>
                         <property name="margin_bottom">20</property>
                         <property name="hexpand">True</property>
-                        <signal name="button_press_event" handler="button_drawing_area_button_press_event"/>
-                        <signal name="draw" handler="button_drawing_area_draw_event"/>
+                        <signal name="button_press_event" handler="button_drawing_area_button_press_event" 
object="CcMouseTest" swapped="yes"/>
+                        <signal name="draw" handler="button_drawing_area_draw_event" object="CcMouseTest" 
swapped="yes"/>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]