[gnome-control-center] wacom: Refactor calibrator finalization into separate function



commit 65bd735937f43e14103da79adce5e4dd4ad8e0d6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jan 22 21:49:19 2016 +0100

    wacom: Refactor calibrator finalization into separate function
    
    Instead of calling the delete event handler everywhere.

 panels/wacom/calibrator/calibrator-gui.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/panels/wacom/calibrator/calibrator-gui.c b/panels/wacom/calibrator/calibrator-gui.c
index 1855be5..214c886 100644
--- a/panels/wacom/calibrator/calibrator-gui.c
+++ b/panels/wacom/calibrator/calibrator-gui.c
@@ -150,10 +150,8 @@ on_allocation_changed (ClutterActor          *actor,
   resize_display (area);
 }
 
-static gboolean
-on_delete_event (GtkWidget *widget,
-                 GdkEvent  *event,
-                 CalibArea *area)
+static void
+calib_area_notify_finish (CalibArea *area)
 {
   clutter_timeline_stop (CLUTTER_TIMELINE (area->clock_timeline));
 
@@ -165,15 +163,21 @@ on_delete_event (GtkWidget *widget,
   gtk_widget_hide (area->window);
 
   (*area->callback) (area, area->user_data);
+}
 
+static gboolean
+on_delete_event (GtkWidget *widget,
+                 GdkEvent  *event,
+                 CalibArea *area)
+{
+  calib_area_notify_finish (area);
   return TRUE;
 }
 
 static gboolean
 draw_success_end_wait_callback (CalibArea *area)
 {
-  on_delete_event (NULL, NULL, area);
-
+  calib_area_notify_finish (area);
   return FALSE;
 }
 
@@ -246,7 +250,7 @@ set_calibration_status (CalibArea *area)
     }
   else
     {
-      on_delete_event (NULL, NULL, area);
+      calib_area_notify_finish (area);
     }
 }
 
@@ -383,8 +387,7 @@ on_key_release_event(ClutterActor    *actor,
       return FALSE;
     }
 
-  on_delete_event (area->window, NULL, area);
-
+  calib_area_notify_finish (area);
   return FALSE;
 }
 
@@ -397,7 +400,7 @@ on_focus_out_event (GtkWidget *widget,
     return FALSE;
 
   /* If the calibrator window loses focus, simply bail out... */
-  on_delete_event (widget, NULL, area);
+  calib_area_notify_finish (area);
 
   return FALSE;
 }


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