[cheese] reindent libcheese code



commit 387b0dc8a6cb2db43527963b1fb478e262d5cb41
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Mon Aug 9 03:55:44 2010 +0200

    reindent libcheese code

 libcheese/cheese-avatar-chooser.c        |   34 +-
 libcheese/cheese-camera-device-monitor.c |   18 +-
 libcheese/cheese-camera-device-monitor.h |    8 +-
 libcheese/cheese-camera-device.c         |   49 +-
 libcheese/cheese-camera-device.h         |    6 +-
 libcheese/cheese-camera.c                |  100 ++--
 libcheese/cheese-camera.h                |   40 +-
 libcheese/cheese-countdown.c             |    4 +-
 libcheese/cheese-effect.c                |   69 +-
 libcheese/cheese-effect.h                |   17 +-
 libcheese/cheese-widget-private.h        |    6 +-
 libcheese/cheese-widget.c                |    7 +-
 libcheese/um-crop-area.c                 | 1049 +++++++++++++++---------------
 libcheese/um-crop-area.h                 |   10 +-
 14 files changed, 729 insertions(+), 688 deletions(-)
---
diff --git a/libcheese/cheese-avatar-chooser.c b/libcheese/cheese-avatar-chooser.c
index 19ddcae..a5e3f6d 100644
--- a/libcheese/cheese-avatar-chooser.c
+++ b/libcheese/cheese-avatar-chooser.c
@@ -163,22 +163,24 @@ state_change_cb (GObject             *object,
                  CheeseAvatarChooser *chooser)
 {
   CheeseAvatarChooserPrivate *priv = CHEESE_AVATAR_CHOOSER_GET_PRIVATE (chooser);
-  CheeseWidgetState state;
+  CheeseWidgetState           state;
+
   g_object_get (object, "state", &state, NULL);
 
-  switch (state) {
-  case CHEESE_WIDGET_STATE_READY:
-    gtk_widget_set_sensitive (priv->take_button, TRUE);
-    gtk_widget_set_sensitive (priv->take_again_button, TRUE);
-    break;
-  case CHEESE_WIDGET_STATE_ERROR:
-    gtk_widget_set_sensitive (priv->take_button, FALSE);
-    gtk_widget_set_sensitive (priv->take_again_button, FALSE);
-    break;
-  case CHEESE_WIDGET_STATE_NONE:
-    break;
-  default:
-    g_assert_not_reached ();
+  switch (state)
+  {
+    case CHEESE_WIDGET_STATE_READY:
+      gtk_widget_set_sensitive (priv->take_button, TRUE);
+      gtk_widget_set_sensitive (priv->take_again_button, TRUE);
+      break;
+    case CHEESE_WIDGET_STATE_ERROR:
+      gtk_widget_set_sensitive (priv->take_button, FALSE);
+      gtk_widget_set_sensitive (priv->take_again_button, FALSE);
+      break;
+    case CHEESE_WIDGET_STATE_NONE:
+      break;
+    default:
+      g_assert_not_reached ();
   }
 }
 
@@ -263,8 +265,8 @@ cheese_avatar_chooser_init (CheeseAvatarChooser *chooser)
                             gtk_label_new ("webcam"));
 
   /* Image tab */
-  priv->image             = um_crop_area_new ();
-  frame                   = gtk_frame_new (NULL);
+  priv->image = um_crop_area_new ();
+  frame       = gtk_frame_new (NULL);
   gtk_container_add (GTK_CONTAINER (frame), priv->image);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
   priv->take_again_button = gtk_button_new_with_mnemonic (_("_Discard photo"));
diff --git a/libcheese/cheese-camera-device-monitor.c b/libcheese/cheese-camera-device-monitor.c
index e54e985..c2e1a29 100644
--- a/libcheese/cheese-camera-device-monitor.c
+++ b/libcheese/cheese-camera-device-monitor.c
@@ -107,14 +107,14 @@ static void
 cheese_camera_device_monitor_added (CheeseCameraDeviceMonitor *monitor,
                                     GUdevDevice               *udevice)
 {
-  const char         *device_file;
-  const char         *product_name;
-  const char         *vendor;
-  const char         *product;
-  const char         *bus;
-  gint                vendor_id   = 0;
-  gint                product_id  = 0;
-  gint                v4l_version = 0;
+  const char *device_file;
+  const char *product_name;
+  const char *vendor;
+  const char *product;
+  const char *bus;
+  gint        vendor_id   = 0;
+  gint        product_id  = 0;
+  gint        v4l_version = 0;
 
   const gchar *devpath = g_udev_device_get_property (udevice, "DEVPATH");
 
@@ -170,7 +170,7 @@ cheese_camera_device_monitor_added (CheeseCameraDeviceMonitor *monitor,
                    "Removing it from device list.", device_file);
       return;
     }
-    product_name  = g_udev_device_get_property (udevice, "ID_V4L_PRODUCT");
+    product_name = g_udev_device_get_property (udevice, "ID_V4L_PRODUCT");
   }
   else if (v4l_version == 0)
   {
diff --git a/libcheese/cheese-camera-device-monitor.h b/libcheese/cheese-camera-device-monitor.h
index fb59cb6..ddfb009 100644
--- a/libcheese/cheese-camera-device-monitor.h
+++ b/libcheese/cheese-camera-device-monitor.h
@@ -52,10 +52,10 @@ struct _CheeseCameraDeviceMonitorClass
   GObjectClass parent_class;
 
   void (*added)(CheeseCameraDeviceMonitor *camera,
-                const char *id,
-                const char *device_file,
-                const char *product_name,
-                int api_version);
+                const char                *id,
+                const char                *device_file,
+                const char                *product_name,
+                int                        api_version);
   void (*removed)(CheeseCameraDeviceMonitor *camera, const char *id);
 };
 
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
index 3d96304..cb02c33 100644
--- a/libcheese/cheese-camera-device.c
+++ b/libcheese/cheese-camera-device.c
@@ -30,10 +30,10 @@
 
 #include "cheese-camera-device.h"
 
-static void     cheese_camera_device_initable_iface_init (GInitableIface  *iface);
-static gboolean cheese_camera_device_initable_init       (GInitable       *initable,
-                                                          GCancellable    *cancellable,
-                                                          GError         **error);
+static void     cheese_camera_device_initable_iface_init (GInitableIface *iface);
+static gboolean cheese_camera_device_initable_init (GInitable    *initable,
+                                                    GCancellable *cancellable,
+                                                    GError      **error);
 
 G_DEFINE_TYPE_WITH_CODE (CheeseCameraDevice, cheese_camera_device, G_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
@@ -79,9 +79,9 @@ typedef struct
   gchar *id;
   const gchar *src;
   gchar *name;
-  gint api;
+  gint   api;
   GstCaps *caps;
-  GList *formats;
+  GList   *formats;
 
   GError *construct_error;
 } CheeseCameraDevicePrivate;
@@ -140,7 +140,7 @@ cheese_webcam_device_filter_caps (CheeseCameraDevice *device, const GstCaps *cap
  *  CHEESE_CAMERA_DEVICE_GET_PRIVATE (device); */
   GstCaps *filter;
   GstCaps *allowed;
-  gint i;
+  gint     i;
 
   filter = gst_caps_new_simple (formats[0],
                                 "framerate", GST_TYPE_FRACTION_RANGE,
@@ -321,7 +321,8 @@ cheese_camera_device_get_caps (CheeseCameraDevice *device)
       priv->caps = cheese_webcam_device_filter_caps (device, caps, supported_formats);
       if (!gst_caps_is_empty (priv->caps))
         cheese_webcam_device_update_format_table (device);
-      else {
+      else
+      {
         g_set_error_literal (&priv->construct_error,
                              CHEESE_CAMERA_DEVICE_ERROR,
                              CHEESE_CAMERA_DEVICE_ERROR_UNSUPPORTED_CAPS,
@@ -330,8 +331,11 @@ cheese_camera_device_get_caps (CheeseCameraDevice *device)
 
       gst_object_unref (pad);
       gst_caps_unref (caps);
-    } else {
-      if (msg) {
+    }
+    else
+    {
+      if (msg)
+      {
         gchar *dbg_info = NULL;
         gst_message_parse_error (msg, &err, &dbg_info);
         GST_WARNING ("Failed to start the capability probing pipeline");
@@ -341,11 +345,12 @@ cheese_camera_device_get_caps (CheeseCameraDevice *device)
                      (dbg_info) ? dbg_info : "no extra debug detail");
         g_error_free (err);
         err = NULL;
+
         /* construct_error is meant to be displayed in the UI
-           (although it currently isn't displayed in cheese),
-           err->message from gstreamer is too technical for this
-           purpose, the idea is warn the user about an error and point
-           him to the logs for more info */
+         * (although it currently isn't displayed in cheese),
+         * err->message from gstreamer is too technical for this
+         * purpose, the idea is warn the user about an error and point
+         * him to the logs for more info */
         g_set_error (&priv->construct_error,
                      CHEESE_CAMERA_DEVICE_ERROR,
                      CHEESE_CAMERA_DEVICE_ERROR_FAILED_INITIALIZATION,
@@ -366,7 +371,7 @@ cheese_camera_device_get_caps (CheeseCameraDevice *device)
 static void
 cheese_camera_device_constructed (GObject *object)
 {
-  CheeseCameraDevice *device = CHEESE_CAMERA_DEVICE (object);
+  CheeseCameraDevice        *device = CHEESE_CAMERA_DEVICE (object);
   CheeseCameraDevicePrivate *priv   =
     CHEESE_CAMERA_DEVICE_GET_PRIVATE (device);
 
@@ -462,8 +467,8 @@ cheese_camera_device_class_init (CheeseCameraDeviceClass *klass)
 
   if (cheese_camera_device_cat == NULL)
     GST_DEBUG_CATEGORY_INIT (cheese_camera_device_cat,
-			     "cheese-camera-device",
-			     0, "Cheese Camera Device");
+                             "cheese-camera-device",
+                             0, "Cheese Camera Device");
 
   object_class->finalize     = cheese_camera_device_finalize;
   object_class->get_property = cheese_camera_device_get_property;
@@ -516,12 +521,12 @@ cheese_camera_device_init (CheeseCameraDevice *device)
 }
 
 static gboolean
-cheese_camera_device_initable_init (GInitable *initable,
+cheese_camera_device_initable_init (GInitable    *initable,
                                     GCancellable *cancellable,
-                                    GError **error)
+                                    GError      **error)
 {
-  CheeseCameraDevice *device = CHEESE_CAMERA_DEVICE (initable);
-  CheeseCameraDevicePrivate *priv =
+  CheeseCameraDevice        *device = CHEESE_CAMERA_DEVICE (initable);
+  CheeseCameraDevicePrivate *priv   =
     CHEESE_CAMERA_DEVICE_GET_PRIVATE (device);
 
   g_return_val_if_fail (CHEESE_IS_CAMERA_DEVICE (initable), FALSE);
@@ -550,7 +555,7 @@ cheese_camera_device_new (const gchar *device_id,
                           const gchar *device_file,
                           const gchar *product_name,
                           gint         api_version,
-                          GError **error)
+                          GError     **error)
 {
   return CHEESE_CAMERA_DEVICE (g_initable_new (CHEESE_TYPE_CAMERA_DEVICE,
                                                NULL, error,
diff --git a/libcheese/cheese-camera-device.h b/libcheese/cheese-camera-device.h
index 56e2773..843a28c 100644
--- a/libcheese/cheese-camera-device.h
+++ b/libcheese/cheese-camera-device.h
@@ -64,10 +64,10 @@ CheeseCameraDevice *cheese_camera_device_new (const gchar *device_id,
                                               const gchar *device_file,
                                               const gchar *product_name,
                                               gint         api_version,
-                                              GError **error);
+                                              GError     **error);
 
-GstCaps *           cheese_camera_device_get_caps_for_format (CheeseCameraDevice *device,
-                                                              CheeseVideoFormat  *format);
+GstCaps *cheese_camera_device_get_caps_for_format (CheeseCameraDevice *device,
+                                                   CheeseVideoFormat  *format);
 CheeseVideoFormat *cheese_camera_device_get_best_format (CheeseCameraDevice *device);
 GList *            cheese_camera_device_get_format_list (CheeseCameraDevice *device);
 
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index fc69d37..01a9287 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -67,7 +67,7 @@ typedef struct
   GstElement *video_enc;
 
   ClutterTexture *video_texture;
-  
+
   GstElement *effect_filter, *csp_post_effect;
   GstElement *video_balance, *csp_post_balance;
   GstElement *camera_tee, *effects_tee;
@@ -211,11 +211,11 @@ cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *ca
       cheese_camera_change_sink (camera, priv->video_display_bin,
                                  priv->photo_save_bin, priv->video_save_bin);
       priv->is_recording = FALSE;
-    }  
+    }
   }
   else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED)
   {
-    if (strcmp(GST_MESSAGE_SRC_NAME (message), "pipeline") == 0)
+    if (strcmp (GST_MESSAGE_SRC_NAME (message), "pipeline") == 0)
     {
       GstState old, new;
       gst_message_parse_state_changed (message, &old, &new, NULL);
@@ -235,19 +235,21 @@ cheese_camera_add_device (CheeseCameraDeviceMonitor *monitor,
                           gint                       api_version,
                           CheeseCamera              *camera)
 {
-  CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
-  GError *error = NULL;
+  CheeseCameraPrivate *priv  = CHEESE_CAMERA_GET_PRIVATE (camera);
+  GError              *error = NULL;
 
   CheeseCameraDevice *device = cheese_camera_device_new (id,
                                                          device_file,
                                                          product_name,
                                                          api_version,
                                                          &error);
+
   if (device == NULL)
     GST_WARNING ("Device initialization for %s failed: %s ",
                  device_file,
                  (error != NULL) ? error->message : "Unknown reason");
-  else  {
+  else
+  {
     g_ptr_array_add (priv->camera_devices, device);
     priv->num_camera_devices++;
   }
@@ -366,29 +368,32 @@ cheese_camera_create_video_display_bin (CheeseCamera *camera, GError **error)
 
   gboolean ok;
   GstPad  *pad;
-  GError *err = NULL;
-  
+  GError  *err = NULL;
+
   priv->video_display_bin = gst_bin_new ("video_display_bin");
 
   cheese_camera_create_camera_source_bin (camera);
-  
+
   if ((priv->camera_tee = gst_element_factory_make ("tee", "camera_tee")) == NULL)
   {
-      cheese_camera_set_error_element_not_found (error, "tee");
+    cheese_camera_set_error_element_not_found (error, "tee");
   }
   if ((priv->effects_tee = gst_element_factory_make ("tee", "effects_tee")) == NULL)
   {
-    cheese_camera_set_error_element_not_found (error, "tee");    
+    cheese_camera_set_error_element_not_found (error, "tee");
   }
   if ((priv->effects_valve = gst_element_factory_make ("valve", "effects_valve")) == NULL)
   {
-    cheese_camera_set_error_element_not_found (error, "effects_valve");    
+    cheese_camera_set_error_element_not_found (error, "effects_valve");
   }
   if ((priv->main_valve = gst_element_factory_make ("valve", "main_valve")) == NULL)
   {
-    cheese_camera_set_error_element_not_found (error, "main_valve");    
+    cheese_camera_set_error_element_not_found (error, "main_valve");
   }
-  priv->effects_downscaler = gst_parse_bin_from_description ("videoscale ! video/x-raw-yuv,width=160,height=120 ! ffmpegcolorspace", TRUE, &err);
+  priv->effects_downscaler = gst_parse_bin_from_description (
+    "videoscale ! video/x-raw-yuv,width=160,height=120 ! ffmpegcolorspace",
+    TRUE,
+    &err);
   if (priv->effects_downscaler == NULL || err != NULL)
   {
     cheese_camera_set_error_element_not_found (error, "effects_downscaler");
@@ -437,7 +442,7 @@ cheese_camera_create_video_display_bin (CheeseCamera *camera, GError **error)
     g_object_set (video_scale, "method", 1, NULL);
   }
 
-  if ((video_sink = clutter_gst_video_sink_new(priv->video_texture)) == NULL)
+  if ((video_sink = clutter_gst_video_sink_new (priv->video_texture)) == NULL)
   {
     cheese_camera_set_error_element_not_found (error, "cluttervideosink");
   }
@@ -447,20 +452,20 @@ cheese_camera_create_video_display_bin (CheeseCamera *camera, GError **error)
     return FALSE;
 
   gst_bin_add_many (GST_BIN (priv->video_display_bin), priv->camera_source_bin,
-		    priv->camera_tee, priv->effects_downscaler, priv->effects_tee,
-		    priv->effects_valve, priv->main_valve,
+                    priv->camera_tee, priv->effects_downscaler, priv->effects_tee,
+                    priv->effects_valve, priv->main_valve,
                     priv->effect_filter, priv->csp_post_effect,
                     priv->video_balance, priv->csp_post_balance,
                     save_tee, save_queue,
                     video_display_queue, video_scale, video_sink, NULL);
 
-  ok = gst_element_link_many (priv->camera_source_bin, priv->camera_tee, NULL);
+  ok  = gst_element_link_many (priv->camera_source_bin, priv->camera_tee, NULL);
   ok &= gst_element_link_many (priv->camera_tee, priv->main_valve, priv->effect_filter,
-                              priv->csp_post_effect,
-                              priv->video_balance, priv->csp_post_balance,
-                              save_tee, NULL);
+                               priv->csp_post_effect,
+                               priv->video_balance, priv->csp_post_balance,
+                               save_tee, NULL);
   ok &= gst_element_link_many (priv->camera_tee, priv->effects_valve,
-			       priv->effects_downscaler, priv->effects_tee, NULL);
+                               priv->effects_downscaler, priv->effects_tee, NULL);
   ok &= gst_element_link_many (save_tee, save_queue, NULL);
   ok &= gst_element_link_many (save_tee, video_display_queue, video_scale, video_sink, NULL);
 
@@ -480,7 +485,7 @@ cheese_camera_relink_camera_source_bin (CheeseCamera *camera)
 {
   CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
 
-  gst_element_unlink (priv->camera_source_bin, priv->camera_tee);  
+  gst_element_unlink (priv->camera_source_bin, priv->camera_tee);
   gst_bin_remove (GST_BIN (priv->video_display_bin), priv->camera_source_bin);
 
   cheese_camera_create_camera_source_bin (camera);
@@ -735,17 +740,17 @@ static void
 cheese_camera_change_effect_filter (CheeseCamera *camera, GstElement *new_filter)
 {
   CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
-  gboolean ok;
+  gboolean             ok;
 
   g_object_set (G_OBJECT (priv->main_valve), "drop", TRUE, NULL);
-  
+
   gst_element_unlink_many (priv->main_valve, priv->effect_filter,
                            priv->csp_post_effect, NULL);
 
-  g_object_ref(priv->effect_filter); 
+  g_object_ref (priv->effect_filter);
   gst_bin_remove (GST_BIN (priv->video_display_bin), priv->effect_filter);
   gst_element_set_state (priv->effect_filter, GST_STATE_NULL);
-  g_object_unref(priv->effect_filter);
+  g_object_unref (priv->effect_filter);
 
   gst_bin_add (GST_BIN (priv->video_display_bin), new_filter);
   ok = gst_element_link_many (priv->main_valve, new_filter,
@@ -755,11 +760,11 @@ cheese_camera_change_effect_filter (CheeseCamera *camera, GstElement *new_filter
   g_return_if_fail (ok);
 
   g_object_set (G_OBJECT (priv->main_valve), "drop", FALSE, NULL);
-  
+
   priv->effect_filter = new_filter;
 }
 
-GstElement*
+GstElement *
 cheese_camera_element_from_effect (CheeseCamera *camera, CheeseEffect *effect)
 {
   char       *effects_pipeline_desc;
@@ -791,6 +796,7 @@ void
 cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect)
 {
   GstElement *effect_filter;
+
   effect_filter = cheese_camera_element_from_effect (camera, effect);
   cheese_camera_change_effect_filter (camera, effect_filter);
 }
@@ -798,7 +804,7 @@ cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect)
 void
 cheese_camera_toggle_effects_pipeline (CheeseCamera *camera, gboolean active)
 {
-  CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);  
+  CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
 
   if (active)
   {
@@ -816,41 +822,40 @@ void
 cheese_camera_connect_effect_texture (CheeseCamera *camera, CheeseEffect *effect, ClutterTexture *texture)
 {
   CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
-  
+
   GstElement *effect_filter;
   GstElement *display_element;
   GstElement *display_queue;
   GstElement *control_valve;
-  gboolean ok;
+  gboolean    ok;
 
   g_object_set (G_OBJECT (priv->effects_valve), "drop", TRUE, NULL);
 
   control_valve = gst_element_factory_make ("valve", NULL);
   g_object_set (G_OBJECT (effect), "control_valve", control_valve, NULL);
-  
+
   display_queue = gst_element_factory_make ("queue", NULL);
 
   effect_filter = cheese_camera_element_from_effect (camera, effect);
 
   display_element = clutter_gst_video_sink_new (texture);
   g_object_set (G_OBJECT (display_element), "async", FALSE, NULL);
- 
+
   gst_bin_add_many (GST_BIN (priv->pipeline), control_valve, effect_filter, display_queue, display_element, NULL);
 
 
 
   ok = gst_element_link_many (priv->effects_tee, control_valve, effect_filter, display_queue, display_element, NULL);
 
-  // HACK: I don't understand GStreamer enough to know why this works.
+  /* HACK: I don't understand GStreamer enough to know why this works. */
   gst_element_set_state (control_valve, GST_STATE_PLAYING);
   gst_element_set_state (effect_filter, GST_STATE_PLAYING);
   gst_element_set_state (display_queue, GST_STATE_PLAYING);
-  gst_element_set_state (display_element, GST_STATE_PLAYING); 
+  gst_element_set_state (display_element, GST_STATE_PLAYING);
 
-  g_object_set (G_OBJECT (priv->effects_valve), "drop", FALSE, NULL);  
+  g_object_set (G_OBJECT (priv->effects_valve), "drop", FALSE, NULL);
 }
 
-
 void
 cheese_camera_start_video_recording (CheeseCamera *camera, char *filename)
 {
@@ -1010,8 +1015,9 @@ cheese_camera_set_property (GObject *object, guint prop_id, const GValue *value,
   {
     case PROP_VIDEO_TEXTURE:
       priv->video_texture = g_value_get_pointer (value);
-      //      g_signal_connect (priv->video_window, "expose-event",
-      //                G_CALLBACK (cheese_camera_expose_cb), self);
+
+      /*      g_signal_connect (priv->video_window, "expose-event", */
+      /*                G_CALLBACK (cheese_camera_expose_cb), self); */
       break;
     case PROP_DEVICE_NAME:
       g_free (priv->device_name);
@@ -1064,11 +1070,11 @@ cheese_camera_class_init (CheeseCameraClass *klass)
                                               G_TYPE_NONE, 0);
 
   camera_signals[STATE_CHANGED] = g_signal_new ("state-changed", G_OBJECT_CLASS_TYPE (klass),
-                                              G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                                              G_STRUCT_OFFSET (CheeseCameraClass, state_changed),
-                                              NULL, NULL,
-                                              g_cclosure_marshal_VOID__INT,
-                                              G_TYPE_NONE, 1, G_TYPE_INT);
+                                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                                                G_STRUCT_OFFSET (CheeseCameraClass, state_changed),
+                                                NULL, NULL,
+                                                g_cclosure_marshal_VOID__INT,
+                                                G_TYPE_NONE, 1, G_TYPE_INT);
 
 
   g_object_class_install_property (object_class, PROP_VIDEO_TEXTURE,
@@ -1207,7 +1213,7 @@ void
 cheese_camera_set_device_by_dev_udi (CheeseCamera *camera, char *udi)
 {
   CheeseCameraPrivate *priv;
-  int i;
+  int                  i;
 
   g_return_if_fail (CHEESE_IS_CAMERA (camera));
 
@@ -1257,6 +1263,7 @@ void
 cheese_camera_set_video_format (CheeseCamera *camera, CheeseVideoFormat *format)
 {
   CheeseCameraPrivate *priv;
+
   g_return_if_fail (CHEESE_IS_CAMERA (camera));
   g_return_if_fail (format != NULL);
 
@@ -1278,6 +1285,7 @@ const CheeseVideoFormat *
 cheese_camera_get_current_video_format (CheeseCamera *camera)
 {
   CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
+
   g_return_val_if_fail (CHEESE_IS_CAMERA (camera), NULL);
 
   return priv->current_format;
diff --git a/libcheese/cheese-camera.h b/libcheese/cheese-camera.h
index 195ff86..958bd34 100644
--- a/libcheese/cheese-camera.h
+++ b/libcheese/cheese-camera.h
@@ -63,36 +63,38 @@ enum CheeseCameraError
 
 GType         cheese_camera_get_type (void);
 CheeseCamera *cheese_camera_new (ClutterTexture *video_texture,
-                                 char      *camera_device_name,
-                                 int        x_resolution,
-                                 int        y_resolution);
+                                 char           *camera_device_name,
+                                 int             x_resolution,
+                                 int             y_resolution);
 
 const CheeseVideoFormat *cheese_camera_get_current_video_format (CheeseCamera *camera);
 void                     cheese_camera_setup (CheeseCamera *camera, char *udi, GError **error);
 void                     cheese_camera_play (CheeseCamera *camera);
 void                     cheese_camera_stop (CheeseCamera *camera);
 void                     cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect);
-void                     cheese_camera_connect_effect_texture (CheeseCamera *camera, CheeseEffect *effect, ClutterTexture *texture);
-void                     cheese_camera_start_video_recording (CheeseCamera *camera, char *filename);
-void                     cheese_camera_stop_video_recording (CheeseCamera *camera);
-gboolean                 cheese_camera_take_photo (CheeseCamera *camera, char *filename);
-gboolean                 cheese_camera_take_photo_pixbuf (CheeseCamera *camera);
-gboolean                 cheese_camera_has_camera (CheeseCamera *camera);
-int                      cheese_camera_get_num_camera_devices (CheeseCamera *camera);
-CheeseCameraDevice *     cheese_camera_get_selected_device (CheeseCamera *camera);
-GPtrArray *              cheese_camera_get_camera_devices (CheeseCamera *camera);
-void                     cheese_camera_set_device_by_dev_file (CheeseCamera *camera, char *file);
-void                     cheese_camera_set_device_by_dev_udi (CheeseCamera *camera, char *udi);
-gboolean                 cheese_camera_switch_camera_device (CheeseCamera *camera);
-GList *                  cheese_camera_get_video_formats (CheeseCamera *camera);
-void                     cheese_camera_set_video_format (CheeseCamera      *camera,
-                                                         CheeseVideoFormat *format);
+void                     cheese_camera_connect_effect_texture (CheeseCamera   *camera,
+                                                               CheeseEffect   *effect,
+                                                               ClutterTexture *texture);
+void                cheese_camera_start_video_recording (CheeseCamera *camera, char *filename);
+void                cheese_camera_stop_video_recording (CheeseCamera *camera);
+gboolean            cheese_camera_take_photo (CheeseCamera *camera, char *filename);
+gboolean            cheese_camera_take_photo_pixbuf (CheeseCamera *camera);
+gboolean            cheese_camera_has_camera (CheeseCamera *camera);
+int                 cheese_camera_get_num_camera_devices (CheeseCamera *camera);
+CheeseCameraDevice *cheese_camera_get_selected_device (CheeseCamera *camera);
+GPtrArray *         cheese_camera_get_camera_devices (CheeseCamera *camera);
+void                cheese_camera_set_device_by_dev_file (CheeseCamera *camera, char *file);
+void                cheese_camera_set_device_by_dev_udi (CheeseCamera *camera, char *udi);
+gboolean            cheese_camera_switch_camera_device (CheeseCamera *camera);
+GList *             cheese_camera_get_video_formats (CheeseCamera *camera);
+void                cheese_camera_set_video_format (CheeseCamera      *camera,
+                                                    CheeseVideoFormat *format);
 gboolean cheese_camera_get_balance_property_range (CheeseCamera *camera,
                                                    gchar *property,
                                                    gdouble *min, gdouble *max, gdouble *def);
 void cheese_camera_set_balance_property (CheeseCamera *camera, gchar *property, gdouble value);
 void cheese_camera_toggle_effects_pipeline (CheeseCamera *camera, gboolean active);
-	
+
 G_END_DECLS
 
 #endif /* __CHEESE_CAMERA_H__ */
diff --git a/libcheese/cheese-countdown.c b/libcheese/cheese-countdown.c
index b3c6a79..43870b2 100644
--- a/libcheese/cheese-countdown.c
+++ b/libcheese/cheese-countdown.c
@@ -333,7 +333,7 @@ do_text (cairo_t    *pContext,
 static gboolean
 on_expose (GtkWidget *widget, GdkEventExpose *pEvent, gpointer data)
 {
-  CheeseCountdownPrivate *priv     = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
+  CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
   GtkAllocation           allocation;
   cairo_t                *pContext = NULL;
   cairo_pattern_t        *pattern;
@@ -347,7 +347,7 @@ on_expose (GtkWidget *widget, GdkEventExpose *pEvent, gpointer data)
   gdouble                 fHeight;
 
   gtk_widget_get_allocation (widget, &allocation);
-  fWidth = (gdouble) allocation.width;
+  fWidth  = (gdouble) allocation.width;
   fHeight = (gdouble) allocation.height;
 
   /* 3 * 26 are the three numbers, 30 is the width of camera-icon.svg */
diff --git a/libcheese/cheese-effect.c b/libcheese/cheese-effect.c
index a1e4905..7045cf1 100644
--- a/libcheese/cheese-effect.c
+++ b/libcheese/cheese-effect.c
@@ -36,7 +36,8 @@ G_DEFINE_TYPE (CheeseEffect, cheese_effect, G_TYPE_OBJECT)
 
 typedef struct _CheeseEffectPrivate CheeseEffectPrivate;
 
-struct _CheeseEffectPrivate {
+struct _CheeseEffectPrivate
+{
   char *name;
   char *pipeline_desc;
   GstElement *control_valve;
@@ -48,18 +49,19 @@ cheese_effect_get_property (GObject *object, guint property_id,
 {
   CheeseEffectPrivate *priv = CHEESE_EFFECT_GET_PRIVATE (object);
 
-  switch (property_id) {
-  case PROP_NAME:
-    g_value_set_string (value, priv->name);
-    break;
-  case PROP_PIPELINE_DESC:
-    g_value_set_string (value, priv->pipeline_desc);
-    break;
-  case PROP_CONTROL_VALVE:
-    g_value_set_object (value, priv->control_valve);
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  switch (property_id)
+  {
+    case PROP_NAME:
+      g_value_set_string (value, priv->name);
+      break;
+    case PROP_PIPELINE_DESC:
+      g_value_set_string (value, priv->pipeline_desc);
+      break;
+    case PROP_CONTROL_VALVE:
+      g_value_set_object (value, priv->control_valve);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   }
 }
 
@@ -69,23 +71,24 @@ cheese_effect_set_property (GObject *object, guint property_id,
 {
   CheeseEffectPrivate *priv = CHEESE_EFFECT_GET_PRIVATE (object);
 
-  switch (property_id) {
-  case PROP_NAME:
-    g_free (priv->name);
-    priv->name = g_value_dup_string (value);
-    break;
-  case PROP_PIPELINE_DESC:
-    g_free (priv->pipeline_desc);
-    priv->pipeline_desc = g_value_dup_string (value);
-    break;
-  case PROP_CONTROL_VALVE:
-    if (priv->control_valve != NULL)
-      g_object_unref (G_OBJECT (priv->control_valve));
-    priv->control_valve = GST_ELEMENT (g_value_get_object (value));
-    g_object_ref (G_OBJECT (priv->control_valve));
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  switch (property_id)
+  {
+    case PROP_NAME:
+      g_free (priv->name);
+      priv->name = g_value_dup_string (value);
+      break;
+    case PROP_PIPELINE_DESC:
+      g_free (priv->pipeline_desc);
+      priv->pipeline_desc = g_value_dup_string (value);
+      break;
+    case PROP_CONTROL_VALVE:
+      if (priv->control_valve != NULL)
+        g_object_unref (G_OBJECT (priv->control_valve));
+      priv->control_valve = GST_ELEMENT (g_value_get_object (value));
+      g_object_ref (G_OBJECT (priv->control_valve));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   }
 }
 
@@ -117,13 +120,13 @@ cheese_effect_class_init (CheeseEffectClass *klass)
                                                         NULL,
                                                         GST_TYPE_ELEMENT,
                                                         G_PARAM_READWRITE));
-
 }
 
 gboolean
 cheese_effect_is_preview_connected (CheeseEffect *self)
 {
   CheeseEffectPrivate *priv = CHEESE_EFFECT_GET_PRIVATE (self);
+
   return priv->control_valve != NULL;
 }
 
@@ -131,6 +134,7 @@ void
 cheese_effect_enable_preview (CheeseEffect *self)
 {
   CheeseEffectPrivate *priv = CHEESE_EFFECT_GET_PRIVATE (self);
+
   g_object_set (G_OBJECT (priv->control_valve), "drop", FALSE, NULL);
 }
 
@@ -138,6 +142,7 @@ void
 cheese_effect_disable_preview (CheeseEffect *self)
 {
   CheeseEffectPrivate *priv = CHEESE_EFFECT_GET_PRIVATE (self);
+
   g_object_set (G_OBJECT (priv->control_valve), "drop", TRUE, NULL);
 }
 
@@ -146,7 +151,7 @@ cheese_effect_init (CheeseEffect *self)
 {
 }
 
-CheeseEffect*
+CheeseEffect *
 cheese_effect_new (void)
 {
   return g_object_new (CHEESE_TYPE_EFFECT, NULL);
diff --git a/libcheese/cheese-effect.h b/libcheese/cheese-effect.h
index 4157d25..0bd72c7 100644
--- a/libcheese/cheese-effect.h
+++ b/libcheese/cheese-effect.h
@@ -24,7 +24,7 @@
 
 G_BEGIN_DECLS
 
-#define CHEESE_TYPE_EFFECT cheese_effect_get_type()
+#define CHEESE_TYPE_EFFECT cheese_effect_get_type ()
 
 #define CHEESE_EFFECT(obj) \
   (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_EFFECT, CheeseEffect))
@@ -41,22 +41,23 @@ G_BEGIN_DECLS
 #define CHEESE_EFFECT_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_EFFECT, CheeseEffectClass))
 
-typedef struct {
+typedef struct
+{
   GObject parent;
 } CheeseEffect;
 
-typedef struct {
+typedef struct
+{
   GObjectClass parent_class;
 } CheeseEffectClass;
 
 GType cheese_effect_get_type (void);
 
-CheeseEffect* cheese_effect_new (void);
-gboolean cheese_effect_is_preview_connected (CheeseEffect* self);
-void cheese_effect_enable_preview (CheeseEffect* self);
-void cheese_effect_disable_preview (CheeseEffect* self);
+CheeseEffect *cheese_effect_new (void);
+gboolean      cheese_effect_is_preview_connected (CheeseEffect *self);
+void          cheese_effect_enable_preview (CheeseEffect *self);
+void          cheese_effect_disable_preview (CheeseEffect *self);
 
 G_END_DECLS
 
 #endif /* _CHEESE_EFFECT_H_ */
-
diff --git a/libcheese/cheese-widget-private.h b/libcheese/cheese-widget-private.h
index 2cba699..886577a 100644
--- a/libcheese/cheese-widget-private.h
+++ b/libcheese/cheese-widget-private.h
@@ -29,11 +29,11 @@ enum
   SPINNER_PAGE = 0,
   WEBCAM_PAGE  = 1,
   PROBLEM_PAGE = 2,
-  LAST_PAGE = 3,
+  LAST_PAGE    = 3,
 };
 
-GObject   *cheese_widget_get_camera (CheeseWidget *widget);
-GObject   *cheese_widget_get_gconf  (CheeseWidget *widget);
+GObject *  cheese_widget_get_camera (CheeseWidget *widget);
+GObject *  cheese_widget_get_gconf (CheeseWidget *widget);
 GtkWidget *cheese_widget_get_video_area (CheeseWidget *widget);
 
 G_END_DECLS
diff --git a/libcheese/cheese-widget.c b/libcheese/cheese-widget.c
index d61b956..99c22d8 100644
--- a/libcheese/cheese-widget.c
+++ b/libcheese/cheese-widget.c
@@ -261,6 +261,7 @@ cheese_widget_set_property (GObject *object, guint prop_id,
       break;
   }
 }
+
 #endif
 
 static void
@@ -352,7 +353,7 @@ static void
 cheese_widget_realize (GtkWidget *widget)
 {
   GdkWindow           *window;
-  CheeseWidgetPrivate *priv  = CHEESE_WIDGET_GET_PRIVATE (widget);
+  CheeseWidgetPrivate *priv = CHEESE_WIDGET_GET_PRIVATE (widget);
 
   GTK_WIDGET_CLASS (cheese_widget_parent_class)->realize (widget);
 
@@ -401,7 +402,7 @@ cheese_widget_class_init (CheeseWidgetClass *klass)
   object_class->set_property = cheese_widget_set_property;
 #endif
   object_class->get_property = cheese_widget_get_property;
-  widget_class->realize = cheese_widget_realize;
+  widget_class->realize      = cheese_widget_realize;
 
   /**
    * CheeseWidget:state:
@@ -463,7 +464,7 @@ cheese_widget_get_camera (CheeseWidget *widget)
 GtkWidget *
 cheese_widget_get_video_area (CheeseWidget *widget)
 {
- CheeseWidgetPrivate *priv;
+  CheeseWidgetPrivate *priv;
 
   g_return_val_if_fail (CHEESE_WIDGET (widget), NULL);
 
diff --git a/libcheese/um-crop-area.c b/libcheese/um-crop-area.c
index d463658..dd79e1d 100644
--- a/libcheese/um-crop-area.c
+++ b/libcheese/um-crop-area.c
@@ -27,17 +27,18 @@
 
 #include "um-crop-area.h"
 
-struct _UmCropAreaPrivate {
-	GdkPixbuf *browse_pixbuf;
-	GdkPixbuf *pixbuf;
-	GdkPixbuf *color_shifted;
-	gdouble scale;
-	GdkRectangle image;
-	GdkCursorType current_cursor;
-	GdkRectangle crop;
-	gint active_region;
-	gint last_press_x;
-	gint last_press_y;
+struct _UmCropAreaPrivate
+{
+  GdkPixbuf *browse_pixbuf;
+  GdkPixbuf *pixbuf;
+  GdkPixbuf *color_shifted;
+  gdouble scale;
+  GdkRectangle image;
+  GdkCursorType current_cursor;
+  GdkRectangle  crop;
+  gint active_region;
+  gint last_press_x;
+  gint last_press_y;
 };
 
 G_DEFINE_TYPE (UmCropArea, um_crop_area, GTK_TYPE_DRAWING_AREA);
@@ -46,283 +47,290 @@ static inline guchar
 shift_color_byte (guchar b,
                   int    shift)
 {
-	return CLAMP(b + shift, 0, 255);
+  return CLAMP (b + shift, 0, 255);
 }
 
 static void
 shift_colors (GdkPixbuf *pixbuf,
-	      gint       red,
-	      gint       green,
-	      gint       blue,
-	      gint       alpha)
+              gint       red,
+              gint       green,
+              gint       blue,
+              gint       alpha)
 {
-	gint x, y, offset, y_offset, rowstride, width, height;
-	guchar *pixels;
-	gint channels;
-
-	width = gdk_pixbuf_get_width (pixbuf);
-	height = gdk_pixbuf_get_height (pixbuf);
-	rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-	pixels = gdk_pixbuf_get_pixels (pixbuf);
-	channels = gdk_pixbuf_get_n_channels (pixbuf);
-
-	for (y = 0; y < height; y++) {
-		y_offset = y * rowstride;
-		for (x = 0; x < width; x++) {
-			offset = y_offset + x * channels;
-			if (red != 0)
-				pixels[offset] = shift_color_byte (pixels[offset], red);
-			if (green != 0)
-				pixels[offset + 1] = shift_color_byte (pixels[offset + 1], green);
-			if (blue != 0)
-				pixels[offset + 2] = shift_color_byte (pixels[offset + 2], blue);
-			if (alpha != 0 && channels >= 4)
-				pixels[offset + 3] = shift_color_byte (pixels[offset + 3], blue);
-		}
-	}
+  gint    x, y, offset, y_offset, rowstride, width, height;
+  guchar *pixels;
+  gint    channels;
+
+  width     = gdk_pixbuf_get_width (pixbuf);
+  height    = gdk_pixbuf_get_height (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+  pixels    = gdk_pixbuf_get_pixels (pixbuf);
+  channels  = gdk_pixbuf_get_n_channels (pixbuf);
+
+  for (y = 0; y < height; y++)
+  {
+    y_offset = y * rowstride;
+    for (x = 0; x < width; x++)
+    {
+      offset = y_offset + x * channels;
+      if (red != 0)
+        pixels[offset] = shift_color_byte (pixels[offset], red);
+      if (green != 0)
+        pixels[offset + 1] = shift_color_byte (pixels[offset + 1], green);
+      if (blue != 0)
+        pixels[offset + 2] = shift_color_byte (pixels[offset + 2], blue);
+      if (alpha != 0 && channels >= 4)
+        pixels[offset + 3] = shift_color_byte (pixels[offset + 3], blue);
+    }
+  }
 }
 
 static void
 update_pixbufs (UmCropArea *area)
 {
-	GtkAllocation allocation;
-	GtkStyle *style;
-	GtkWidget *widget;
-	GdkColor *color;
-	gdouble scale;
-	gint width;
-	gint height;
-	gint dest_x, dest_y, dest_width, dest_height;
-	guint32 pixel;
-
-	widget = GTK_WIDGET (area);
-	gtk_widget_get_allocation (widget, &allocation);
-
-	if (area->priv->pixbuf == NULL ||
-	    gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
-	    gdk_pixbuf_get_height (area->priv->pixbuf) != allocation.height) {
-		if (area->priv->pixbuf != NULL)
-			g_object_unref (area->priv->pixbuf);
-		area->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
-					     allocation.width, allocation.height);
-
-		style = gtk_widget_get_style (widget);
-		color = &style->bg[gtk_widget_get_state (widget)];
-  		pixel = ((color->red & 0xff00) << 16) |
-       			((color->green & 0xff00) << 8) |
-         		 (color->blue & 0xff00);
-		gdk_pixbuf_fill (area->priv->pixbuf, pixel);
-
-		width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
-		height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
-
-		scale = allocation.height / (gdouble)height;
-		if (scale * width > allocation.width)
-		    scale = allocation.width / (gdouble)width;
-
-		dest_width = width * scale;
-		dest_height = height * scale;
-		dest_x = (allocation.width - dest_width) / 2;
-		dest_y = (allocation.height - dest_height) / 2,
-
-		gdk_pixbuf_scale (area->priv->browse_pixbuf,
-				  area->priv->pixbuf,
-				  dest_x, dest_y,
-				  dest_width, dest_height,
-				  dest_x, dest_y,
-				  scale, scale,
-				  GDK_INTERP_BILINEAR);
-
-		if (area->priv->color_shifted)
-			g_object_unref (area->priv->color_shifted);
-		area->priv->color_shifted = gdk_pixbuf_copy (area->priv->pixbuf);
-		shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
-
-		if (area->priv->scale == 0.0) {
-			area->priv->crop.width = 96.0 / scale;
-			area->priv->crop.height = 96.0 / scale;
-			area->priv->crop.x = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) - area->priv->crop.width) / 2;
-			area->priv->crop.y = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) - area->priv->crop.height) / 2;
-		}
-
-		area->priv->scale = scale;
-		area->priv->image.x = dest_x;
-		area->priv->image.y = dest_y;
-		area->priv->image.width = dest_width;
-		area->priv->image.height = dest_height;
-	}
+  GtkAllocation allocation;
+  GtkStyle     *style;
+  GtkWidget    *widget;
+  GdkColor     *color;
+  gdouble       scale;
+  gint          width;
+  gint          height;
+  gint          dest_x, dest_y, dest_width, dest_height;
+  guint32       pixel;
+
+  widget = GTK_WIDGET (area);
+  gtk_widget_get_allocation (widget, &allocation);
+
+  if (area->priv->pixbuf == NULL ||
+      gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
+      gdk_pixbuf_get_height (area->priv->pixbuf) != allocation.height)
+  {
+    if (area->priv->pixbuf != NULL)
+      g_object_unref (area->priv->pixbuf);
+    area->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
+                                         allocation.width, allocation.height);
+
+    style = gtk_widget_get_style (widget);
+    color = &style->bg[gtk_widget_get_state (widget)];
+    pixel = ((color->red & 0xff00) << 16) |
+            ((color->green & 0xff00) << 8) |
+            (color->blue & 0xff00);
+    gdk_pixbuf_fill (area->priv->pixbuf, pixel);
+
+    width  = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
+    height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+
+    scale = allocation.height / (gdouble) height;
+    if (scale * width > allocation.width)
+      scale = allocation.width / (gdouble) width;
+
+    dest_width  = width * scale;
+    dest_height = height * scale;
+    dest_x      = (allocation.width - dest_width) / 2;
+    dest_y      = (allocation.height - dest_height) / 2,
+
+    gdk_pixbuf_scale (area->priv->browse_pixbuf,
+                      area->priv->pixbuf,
+                      dest_x, dest_y,
+                      dest_width, dest_height,
+                      dest_x, dest_y,
+                      scale, scale,
+                      GDK_INTERP_BILINEAR);
+
+    if (area->priv->color_shifted)
+      g_object_unref (area->priv->color_shifted);
+    area->priv->color_shifted = gdk_pixbuf_copy (area->priv->pixbuf);
+    shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
+
+    if (area->priv->scale == 0.0)
+    {
+      area->priv->crop.width  = 96.0 / scale;
+      area->priv->crop.height = 96.0 / scale;
+      area->priv->crop.x      = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) - area->priv->crop.width) / 2;
+      area->priv->crop.y      = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) - area->priv->crop.height) / 2;
+    }
+
+    area->priv->scale        = scale;
+    area->priv->image.x      = dest_x;
+    area->priv->image.y      = dest_y;
+    area->priv->image.width  = dest_width;
+    area->priv->image.height = dest_height;
+  }
 }
 
 static void
-crop_to_widget (UmCropArea    *area,
-                GdkRectangle  *crop)
+crop_to_widget (UmCropArea   *area,
+                GdkRectangle *crop)
 {
-	crop->x = area->priv->image.x + area->priv->crop.x * area->priv->scale;
-	crop->y = area->priv->image.y + area->priv->crop.y * area->priv->scale;
-	crop->width = area->priv->crop.width * area->priv->scale;
-	crop->height = area->priv->crop.height * area->priv->scale;
+  crop->x      = area->priv->image.x + area->priv->crop.x * area->priv->scale;
+  crop->y      = area->priv->image.y + area->priv->crop.y * area->priv->scale;
+  crop->width  = area->priv->crop.width * area->priv->scale;
+  crop->height = area->priv->crop.height * area->priv->scale;
 }
 
-typedef enum {
-	OUTSIDE,
-	INSIDE,
-	TOP,
-	TOP_LEFT,
-	TOP_RIGHT,
-	BOTTOM,
-	BOTTOM_LEFT,
-	BOTTOM_RIGHT,
-	LEFT,
-	RIGHT
+typedef enum
+{
+  OUTSIDE,
+  INSIDE,
+  TOP,
+  TOP_LEFT,
+  TOP_RIGHT,
+  BOTTOM,
+  BOTTOM_LEFT,
+  BOTTOM_RIGHT,
+  LEFT,
+  RIGHT
 } Location;
 
 static gboolean
 um_crop_area_expose (GtkWidget      *widget,
-		     GdkEventExpose *event)
+                     GdkEventExpose *event)
 {
-	GtkStateType state;
-	GtkStyle *style;
-	cairo_t *cr;
-	GdkRectangle area;
-	GdkRectangle crop;
-	GdkWindow *window;
-	gint width, height;
-	UmCropArea *uarea = UM_CROP_AREA (widget);
-
-	if (uarea->priv->browse_pixbuf == NULL)
-		return FALSE;
-
-	update_pixbufs (uarea);
-
-	window = gtk_widget_get_window (widget);
-	style = gtk_widget_get_style (widget);
-	state = gtk_widget_get_state (widget);
-
-	width = gdk_pixbuf_get_width (uarea->priv->pixbuf);
-	height = gdk_pixbuf_get_height (uarea->priv->pixbuf);
-	crop_to_widget (uarea, &crop);
-
-	area.x = 0;
-	area.y = 0;
-	area.width = width;
-	area.height = crop.y;
-	gdk_rectangle_intersect (&area, &event->area, &area);
-	gdk_draw_pixbuf (window,
-	                 style->fg_gc[state],
-			 uarea->priv->color_shifted,
-		 	 area.x, area.y,
-		 	 area.x, area.y,
-		 	 area.width, area.height,
-		 	 GDK_RGB_DITHER_NONE, 0, 0);
-
-	area.x = 0;
-	area.y = crop.y;
-	area.width = crop.x;
-	area.height = crop.height;
-	gdk_rectangle_intersect (&area, &event->area, &area);
-	gdk_draw_pixbuf (window,
-	                 style->fg_gc[state],
-			 uarea->priv->color_shifted,
-		 	 area.x, area.y,
-		 	 area.x, area.y,
-		 	 area.width, area.height,
-		 	 GDK_RGB_DITHER_NONE, 0, 0);
-
-	area.x = crop.x;
-	area.y = crop.y;
-	area.width = crop.width;
-	area.height = crop.height;
-	gdk_rectangle_intersect (&area, &event->area, &area);
-	gdk_draw_pixbuf (window,
-	                 style->fg_gc[state],
-			 uarea->priv->pixbuf,
-			 area.x, area.y,
-			 area.x, area.y,
-			 area.width, area.height,
-			 GDK_RGB_DITHER_NONE, 0, 0);
-
-	area.x = crop.x + crop.width;
-	area.y = crop.y;
-	area.width = width - area.x;
-	area.height = crop.height;
-	gdk_rectangle_intersect (&area, &event->area, &area);
-	gdk_draw_pixbuf (window,
-	                 style->fg_gc[state],
-			 uarea->priv->color_shifted,
-		 	 area.x, area.y,
-		 	 area.x, area.y,
-		 	 area.width, area.height,
-		 	 GDK_RGB_DITHER_NONE, 0, 0);
-
-	area.x = 0;
-	area.y = crop.y + crop.width;
-	area.width = width;
-	area.height = height - area.y;
-	gdk_rectangle_intersect (&area, &event->area, &area);
-	gdk_draw_pixbuf (window,
-	                 style->fg_gc[state],
-			 uarea->priv->color_shifted,
-		 	 area.x, area.y,
-		 	 area.x, area.y,
-		 	 area.width, area.height,
-		 	 GDK_RGB_DITHER_NONE, 0, 0);
-
-	cr = gdk_cairo_create (window);
-	gdk_cairo_rectangle (cr, &event->area);
-	cairo_clip (cr);
-
-	if (uarea->priv->active_region != OUTSIDE) {
-		gint x1, x2, y1, y2;
-		gdk_cairo_set_source_color (cr, &style->white);
-		cairo_set_line_width (cr, 1.0);
-		x1 = crop.x + crop.width / 3.0;
-		x2 = crop.x + 2 * crop.width / 3.0;
-		y1 = crop.y + crop.height / 3.0;
-		y2 = crop.y + 2 * crop.height / 3.0;
-
-		cairo_move_to (cr, x1 + 0.5, crop.y);
-		cairo_line_to (cr, x1 + 0.5, crop.y + crop.height);
-
-		cairo_move_to (cr, x2 + 0.5, crop.y);
-		cairo_line_to (cr, x2 + 0.5, crop.y + crop.height);
-
-		cairo_move_to (cr, crop.x, y1 + 0.5);
-		cairo_line_to (cr, crop.x + crop.width, y1 + 0.5);
-
-		cairo_move_to (cr, crop.x, y2 + 0.5);
-		cairo_line_to (cr, crop.x + crop.width, y2 + 0.5);
-		cairo_stroke (cr);
-	}
-
-	gdk_cairo_set_source_color (cr, &style->black);
-	cairo_set_line_width (cr, 1.0);
-	cairo_rectangle (cr,
-                         crop.x + 0.5,
-                         crop.y + 0.5,
-                         crop.width - 1.0,
-                         crop.height - 1.0);
-        cairo_stroke (cr);
-
-	gdk_cairo_set_source_color (cr, &style->white);
-	cairo_set_line_width (cr, 2.0);
-	cairo_rectangle (cr,
-                         crop.x + 2.0,
-                         crop.y + 2.0,
-                         crop.width - 4.0,
-                         crop.height - 4.0);
-        cairo_stroke (cr);
-
-	cairo_destroy (cr);
-
-	return FALSE;
+  GtkStateType state;
+  GtkStyle    *style;
+  cairo_t     *cr;
+  GdkRectangle area;
+  GdkRectangle crop;
+  GdkWindow   *window;
+  gint         width, height;
+  UmCropArea  *uarea = UM_CROP_AREA (widget);
+
+  if (uarea->priv->browse_pixbuf == NULL)
+    return FALSE;
+
+  update_pixbufs (uarea);
+
+  window = gtk_widget_get_window (widget);
+  style  = gtk_widget_get_style (widget);
+  state  = gtk_widget_get_state (widget);
+
+  width  = gdk_pixbuf_get_width (uarea->priv->pixbuf);
+  height = gdk_pixbuf_get_height (uarea->priv->pixbuf);
+  crop_to_widget (uarea, &crop);
+
+  area.x      = 0;
+  area.y      = 0;
+  area.width  = width;
+  area.height = crop.y;
+  gdk_rectangle_intersect (&area, &event->area, &area);
+  gdk_draw_pixbuf (window,
+                   style->fg_gc[state],
+                   uarea->priv->color_shifted,
+                   area.x, area.y,
+                   area.x, area.y,
+                   area.width, area.height,
+                   GDK_RGB_DITHER_NONE, 0, 0);
+
+  area.x      = 0;
+  area.y      = crop.y;
+  area.width  = crop.x;
+  area.height = crop.height;
+  gdk_rectangle_intersect (&area, &event->area, &area);
+  gdk_draw_pixbuf (window,
+                   style->fg_gc[state],
+                   uarea->priv->color_shifted,
+                   area.x, area.y,
+                   area.x, area.y,
+                   area.width, area.height,
+                   GDK_RGB_DITHER_NONE, 0, 0);
+
+  area.x      = crop.x;
+  area.y      = crop.y;
+  area.width  = crop.width;
+  area.height = crop.height;
+  gdk_rectangle_intersect (&area, &event->area, &area);
+  gdk_draw_pixbuf (window,
+                   style->fg_gc[state],
+                   uarea->priv->pixbuf,
+                   area.x, area.y,
+                   area.x, area.y,
+                   area.width, area.height,
+                   GDK_RGB_DITHER_NONE, 0, 0);
+
+  area.x      = crop.x + crop.width;
+  area.y      = crop.y;
+  area.width  = width - area.x;
+  area.height = crop.height;
+  gdk_rectangle_intersect (&area, &event->area, &area);
+  gdk_draw_pixbuf (window,
+                   style->fg_gc[state],
+                   uarea->priv->color_shifted,
+                   area.x, area.y,
+                   area.x, area.y,
+                   area.width, area.height,
+                   GDK_RGB_DITHER_NONE, 0, 0);
+
+  area.x      = 0;
+  area.y      = crop.y + crop.width;
+  area.width  = width;
+  area.height = height - area.y;
+  gdk_rectangle_intersect (&area, &event->area, &area);
+  gdk_draw_pixbuf (window,
+                   style->fg_gc[state],
+                   uarea->priv->color_shifted,
+                   area.x, area.y,
+                   area.x, area.y,
+                   area.width, area.height,
+                   GDK_RGB_DITHER_NONE, 0, 0);
+
+  cr = gdk_cairo_create (window);
+  gdk_cairo_rectangle (cr, &event->area);
+  cairo_clip (cr);
+
+  if (uarea->priv->active_region != OUTSIDE)
+  {
+    gint x1, x2, y1, y2;
+    gdk_cairo_set_source_color (cr, &style->white);
+    cairo_set_line_width (cr, 1.0);
+    x1 = crop.x + crop.width / 3.0;
+    x2 = crop.x + 2 * crop.width / 3.0;
+    y1 = crop.y + crop.height / 3.0;
+    y2 = crop.y + 2 * crop.height / 3.0;
+
+    cairo_move_to (cr, x1 + 0.5, crop.y);
+    cairo_line_to (cr, x1 + 0.5, crop.y + crop.height);
+
+    cairo_move_to (cr, x2 + 0.5, crop.y);
+    cairo_line_to (cr, x2 + 0.5, crop.y + crop.height);
+
+    cairo_move_to (cr, crop.x, y1 + 0.5);
+    cairo_line_to (cr, crop.x + crop.width, y1 + 0.5);
+
+    cairo_move_to (cr, crop.x, y2 + 0.5);
+    cairo_line_to (cr, crop.x + crop.width, y2 + 0.5);
+    cairo_stroke (cr);
+  }
+
+  gdk_cairo_set_source_color (cr, &style->black);
+  cairo_set_line_width (cr, 1.0);
+  cairo_rectangle (cr,
+                   crop.x + 0.5,
+                   crop.y + 0.5,
+                   crop.width - 1.0,
+                   crop.height - 1.0);
+  cairo_stroke (cr);
+
+  gdk_cairo_set_source_color (cr, &style->white);
+  cairo_set_line_width (cr, 2.0);
+  cairo_rectangle (cr,
+                   crop.x + 2.0,
+                   crop.y + 2.0,
+                   crop.width - 4.0,
+                   crop.height - 4.0);
+  cairo_stroke (cr);
+
+  cairo_destroy (cr);
+
+  return FALSE;
 }
 
-typedef enum {
-	BELOW,
-	LOWER,
-	BETWEEN,
-	UPPER,
-	ABOVE
+typedef enum
+{
+  BELOW,
+  LOWER,
+  BETWEEN,
+  UPPER,
+  ABOVE
 } Range;
 
 static Range
@@ -330,323 +338,332 @@ find_range (gint x,
             gint min,
             gint max)
 {
-	gint tolerance = 12;
-
-	if (x < min - tolerance)
-		return BELOW;
-	if (x <= min + tolerance)
-		return LOWER;
-	if (x < max - tolerance)
-		return BETWEEN;
-	if (x <= max + tolerance)
-		return UPPER;
-	return ABOVE;
+  gint tolerance = 12;
+
+  if (x < min - tolerance)
+    return BELOW;
+  if (x <= min + tolerance)
+    return LOWER;
+  if (x < max - tolerance)
+    return BETWEEN;
+  if (x <= max + tolerance)
+    return UPPER;
+  return ABOVE;
 }
 
 static Location
 find_location (GdkRectangle *rect,
-	       gint          x,
-	       gint          y)
+               gint          x,
+               gint          y)
 {
-	Range x_range, y_range;
-	Location location[5][5] = {
-		{ OUTSIDE, OUTSIDE,     OUTSIDE, OUTSIDE,      OUTSIDE },
-		{ OUTSIDE, TOP_LEFT,    TOP,     TOP_RIGHT,    OUTSIDE },
-		{ OUTSIDE, LEFT,        INSIDE,  RIGHT,        OUTSIDE },
-		{ OUTSIDE, BOTTOM_LEFT, BOTTOM,  BOTTOM_RIGHT, OUTSIDE },
-		{ OUTSIDE, OUTSIDE,     OUTSIDE, OUTSIDE,      OUTSIDE }
-	};
-
-	x_range = find_range (x, rect->x, rect->x + rect->width);
-	y_range = find_range (y, rect->y, rect->y + rect->height);
-
-	return location[y_range][x_range];
+  Range    x_range, y_range;
+  Location location[5][5] = {
+    {OUTSIDE, OUTSIDE,     OUTSIDE, OUTSIDE,      OUTSIDE},
+    {OUTSIDE, TOP_LEFT,    TOP,     TOP_RIGHT,    OUTSIDE},
+    {OUTSIDE, LEFT,        INSIDE,  RIGHT,        OUTSIDE},
+    {OUTSIDE, BOTTOM_LEFT, BOTTOM,  BOTTOM_RIGHT, OUTSIDE},
+    {OUTSIDE, OUTSIDE,     OUTSIDE, OUTSIDE,      OUTSIDE}
+  };
+
+  x_range = find_range (x, rect->x, rect->x + rect->width);
+  y_range = find_range (y, rect->y, rect->y + rect->height);
+
+  return location[y_range][x_range];
 }
 
 static void
 update_cursor (UmCropArea *area,
-               gint           x,
-               gint           y)
+               gint        x,
+               gint        y)
 {
-	gint cursor_type;
-	GdkRectangle crop;
-
-	crop_to_widget (area, &crop);
-
-	switch (find_location (&crop, x, y)) {
-	case OUTSIDE:
-		cursor_type = GDK_LEFT_PTR;
-		break;
-	case TOP_LEFT:
-		cursor_type = GDK_TOP_LEFT_CORNER;
-		break;
-	case TOP:
-		cursor_type = GDK_TOP_SIDE;
-		break;
-	case TOP_RIGHT:
-		cursor_type = GDK_TOP_RIGHT_CORNER;
-		break;
-	case LEFT:
-		cursor_type = GDK_LEFT_SIDE;
-		break;
-	case INSIDE:
-		cursor_type = GDK_FLEUR;
-		break;
-	case RIGHT:
-		cursor_type = GDK_RIGHT_SIDE;
-		break;
-	case BOTTOM_LEFT:
-		cursor_type = GDK_BOTTOM_LEFT_CORNER;
-		break;
-	case BOTTOM:
-		cursor_type = GDK_BOTTOM_SIDE;
-		break;
-	case BOTTOM_RIGHT:
-		cursor_type = GDK_BOTTOM_RIGHT_CORNER;
-		break;
-	}
-
-	if (cursor_type != area->priv->current_cursor) {
-		GdkCursor *cursor = gdk_cursor_new (cursor_type);
-		gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
-		gdk_cursor_unref (cursor);
-		area->priv->current_cursor = cursor_type;
-	}
+  gint         cursor_type;
+  GdkRectangle crop;
+
+  crop_to_widget (area, &crop);
+
+  switch (find_location (&crop, x, y))
+  {
+    case OUTSIDE:
+      cursor_type = GDK_LEFT_PTR;
+      break;
+    case TOP_LEFT:
+      cursor_type = GDK_TOP_LEFT_CORNER;
+      break;
+    case TOP:
+      cursor_type = GDK_TOP_SIDE;
+      break;
+    case TOP_RIGHT:
+      cursor_type = GDK_TOP_RIGHT_CORNER;
+      break;
+    case LEFT:
+      cursor_type = GDK_LEFT_SIDE;
+      break;
+    case INSIDE:
+      cursor_type = GDK_FLEUR;
+      break;
+    case RIGHT:
+      cursor_type = GDK_RIGHT_SIDE;
+      break;
+    case BOTTOM_LEFT:
+      cursor_type = GDK_BOTTOM_LEFT_CORNER;
+      break;
+    case BOTTOM:
+      cursor_type = GDK_BOTTOM_SIDE;
+      break;
+    case BOTTOM_RIGHT:
+      cursor_type = GDK_BOTTOM_RIGHT_CORNER;
+      break;
+  }
+
+  if (cursor_type != area->priv->current_cursor)
+  {
+    GdkCursor *cursor = gdk_cursor_new (cursor_type);
+    gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
+    gdk_cursor_unref (cursor);
+    area->priv->current_cursor = cursor_type;
+  }
 }
 
-static gboolean 
+static gboolean
 um_crop_area_motion_notify_event (GtkWidget      *widget,
-				  GdkEventMotion *event)
+                                  GdkEventMotion *event)
 {
-	gint x, y;
-	gint x2, y2;
-	gint delta_x, delta_y;
-	gint width, height, d;
-	UmCropArea *area = UM_CROP_AREA (widget);
-
-	width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
-	height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
-
-	x = (event->x - area->priv->image.x) / area->priv->scale;
-	y = (event->y - area->priv->image.y) / area->priv->scale;
-	x = CLAMP (x, 0, width);
-	y = CLAMP (y, 0, height);
-
-	delta_x = x - area->priv->last_press_x;
-	delta_y = y - area->priv->last_press_y;
-	area->priv->last_press_x = x;
-	area->priv->last_press_y = y;
-
-	x2 = area->priv->crop.x + area->priv->crop.width;
-	y2 = area->priv->crop.y + area->priv->crop.height;
-
-	switch (area->priv->active_region) {
- 	case INSIDE:
-		area->priv->crop.x = CLAMP (area->priv->crop.x + delta_x, 0, width - area->priv->crop.width);
-		area->priv->crop.y = CLAMP (area->priv->crop.y + delta_y, 0, height - area->priv->crop.height);
-		break;
-
-	case TOP_LEFT:
-		d = MAX (x2 - x, y2 - y);
-		if (d < 48 / area->priv->scale)
-			d = 48 / area->priv->scale;
-		if (x2 - d < 0)
-			d = x2;
-		if (y2 - d < 0)
-			d = y2;
-		area->priv->crop.x = x2 - d;
-		area->priv->crop.y = y2 - d;
-		area->priv->crop.width = area->priv->crop.height = d;
-		break;
-
-	case TOP:
-	case TOP_RIGHT:
-		d = MAX (y2 - y, x - area->priv->crop.x);
-		if (d < 48 / area->priv->scale)
-			d = 48 / area->priv->scale;
-		if (area->priv->crop.x + d > width)
-			d = width - area->priv->crop.x;
-		if (y2 - d < 0)
-			d = y2;
-		area->priv->crop.y = y2 - d;
-		area->priv->crop.width = area->priv->crop.height = d;
-		break;
-
-	case LEFT:
-	case BOTTOM_LEFT:
-		d = MAX (x2 - x, y - area->priv->crop.y);
-		if (d < 48 / area->priv->scale)
-			d = 48 / area->priv->scale;
-		if (area->priv->crop.y + d > height)
-			d = height - area->priv->crop.y;
-		if (x2 - d < 0)
-			d = x2;
-		area->priv->crop.x = x2 - d;
-		area->priv->crop.width = area->priv->crop.height = d;
-		break;
-
-	case RIGHT:
-	case BOTTOM_RIGHT:
-	case BOTTOM:
-		area->priv->crop.width = MAX (x - area->priv->crop.x, y - area->priv->crop.y);
-		if (area->priv->crop.width < 48 / area->priv->scale)
-			area->priv->crop.width = 48 / area->priv->scale;
-		if (area->priv->crop.x + area->priv->crop.width > width)
-			area->priv->crop.width = width - area->priv->crop.x;
-		area->priv->crop.height = area->priv->crop.width;
-		if (area->priv->crop.y + area->priv->crop.height > height)
-			area->priv->crop.height = height - area->priv->crop.y;
-		area->priv->crop.width = area->priv->crop.height;
-		break;
-
-	case OUTSIDE:
-		break;
-	default: ;
-	}
-
-	update_cursor (area, event->x, event->y);
-	gtk_widget_queue_draw (widget);
-
-	return FALSE;
+  gint        x, y;
+  gint        x2, y2;
+  gint        delta_x, delta_y;
+  gint        width, height, d;
+  UmCropArea *area = UM_CROP_AREA (widget);
+
+  width  = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
+  height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+
+  x = (event->x - area->priv->image.x) / area->priv->scale;
+  y = (event->y - area->priv->image.y) / area->priv->scale;
+  x = CLAMP (x, 0, width);
+  y = CLAMP (y, 0, height);
+
+  delta_x                  = x - area->priv->last_press_x;
+  delta_y                  = y - area->priv->last_press_y;
+  area->priv->last_press_x = x;
+  area->priv->last_press_y = y;
+
+  x2 = area->priv->crop.x + area->priv->crop.width;
+  y2 = area->priv->crop.y + area->priv->crop.height;
+
+  switch (area->priv->active_region)
+  {
+    case INSIDE:
+      area->priv->crop.x = CLAMP (area->priv->crop.x + delta_x, 0, width - area->priv->crop.width);
+      area->priv->crop.y = CLAMP (area->priv->crop.y + delta_y, 0, height - area->priv->crop.height);
+      break;
+
+    case TOP_LEFT:
+      d = MAX (x2 - x, y2 - y);
+      if (d < 48 / area->priv->scale)
+        d = 48 / area->priv->scale;
+      if (x2 - d < 0)
+        d = x2;
+      if (y2 - d < 0)
+        d = y2;
+      area->priv->crop.x     = x2 - d;
+      area->priv->crop.y     = y2 - d;
+      area->priv->crop.width = area->priv->crop.height = d;
+      break;
+
+    case TOP:
+    case TOP_RIGHT:
+      d = MAX (y2 - y, x - area->priv->crop.x);
+      if (d < 48 / area->priv->scale)
+        d = 48 / area->priv->scale;
+      if (area->priv->crop.x + d > width)
+        d = width - area->priv->crop.x;
+      if (y2 - d < 0)
+        d = y2;
+      area->priv->crop.y     = y2 - d;
+      area->priv->crop.width = area->priv->crop.height = d;
+      break;
+
+    case LEFT:
+    case BOTTOM_LEFT:
+      d = MAX (x2 - x, y - area->priv->crop.y);
+      if (d < 48 / area->priv->scale)
+        d = 48 / area->priv->scale;
+      if (area->priv->crop.y + d > height)
+        d = height - area->priv->crop.y;
+      if (x2 - d < 0)
+        d = x2;
+      area->priv->crop.x     = x2 - d;
+      area->priv->crop.width = area->priv->crop.height = d;
+      break;
+
+    case RIGHT:
+    case BOTTOM_RIGHT:
+    case BOTTOM:
+      area->priv->crop.width = MAX (x - area->priv->crop.x, y - area->priv->crop.y);
+      if (area->priv->crop.width < 48 / area->priv->scale)
+        area->priv->crop.width = 48 / area->priv->scale;
+      if (area->priv->crop.x + area->priv->crop.width > width)
+        area->priv->crop.width = width - area->priv->crop.x;
+      area->priv->crop.height = area->priv->crop.width;
+      if (area->priv->crop.y + area->priv->crop.height > height)
+        area->priv->crop.height = height - area->priv->crop.y;
+      area->priv->crop.width = area->priv->crop.height;
+      break;
+
+    case OUTSIDE:
+      break;
+    default:;
+  }
+
+  update_cursor (area, event->x, event->y);
+  gtk_widget_queue_draw (widget);
+
+  return FALSE;
 }
 
 static gboolean
 um_crop_area_button_press_event (GtkWidget      *widget,
-				 GdkEventButton *event)
+                                 GdkEventButton *event)
 {
-	GdkRectangle crop;
-	UmCropArea *area = UM_CROP_AREA (widget);
+  GdkRectangle crop;
+  UmCropArea  *area = UM_CROP_AREA (widget);
 
-	crop_to_widget (area, &crop);
+  crop_to_widget (area, &crop);
 
-	area->priv->last_press_x = (event->x - area->priv->image.x) / area->priv->scale;
-	area->priv->last_press_y = (event->y - area->priv->image.y) / area->priv->scale;
-	area->priv->active_region = find_location (&crop, event->x, event->y);
+  area->priv->last_press_x  = (event->x - area->priv->image.x) / area->priv->scale;
+  area->priv->last_press_y  = (event->y - area->priv->image.y) / area->priv->scale;
+  area->priv->active_region = find_location (&crop, event->x, event->y);
 
-	gtk_widget_queue_draw (widget);
+  gtk_widget_queue_draw (widget);
 
-	return FALSE;
+  return FALSE;
 }
 
 static gboolean
 um_crop_area_button_release_event (GtkWidget      *widget,
-				   GdkEventButton *event)
+                                   GdkEventButton *event)
 {
-	UmCropArea *area = UM_CROP_AREA (widget);
+  UmCropArea *area = UM_CROP_AREA (widget);
 
-	area->priv->last_press_x = -1;
-	area->priv->last_press_y = -1;
-	area->priv->active_region = OUTSIDE;
+  area->priv->last_press_x  = -1;
+  area->priv->last_press_y  = -1;
+  area->priv->active_region = OUTSIDE;
 
-	gtk_widget_queue_draw (widget);
+  gtk_widget_queue_draw (widget);
 
-	return FALSE;
+  return FALSE;
 }
 
 static void
 um_crop_area_finalize (GObject *object)
 {
-	UmCropArea *area = UM_CROP_AREA (object);
-
-	if (area->priv->browse_pixbuf) {
-		g_object_unref (area->priv->browse_pixbuf);
-		area->priv->browse_pixbuf = NULL;
-	}
-	if (area->priv->pixbuf) {
-		g_object_unref (area->priv->pixbuf);
-		area->priv->pixbuf = NULL;
-	}
-	if (area->priv->color_shifted) {
-		g_object_unref (area->priv->color_shifted);
-		area->priv->color_shifted = NULL;
-	}
+  UmCropArea *area = UM_CROP_AREA (object);
+
+  if (area->priv->browse_pixbuf)
+  {
+    g_object_unref (area->priv->browse_pixbuf);
+    area->priv->browse_pixbuf = NULL;
+  }
+  if (area->priv->pixbuf)
+  {
+    g_object_unref (area->priv->pixbuf);
+    area->priv->pixbuf = NULL;
+  }
+  if (area->priv->color_shifted)
+  {
+    g_object_unref (area->priv->color_shifted);
+    area->priv->color_shifted = NULL;
+  }
 }
 
 static void
 um_crop_area_class_init (UmCropAreaClass *klass)
 {
-	GObjectClass   *object_class = G_OBJECT_CLASS (klass);
-	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-	object_class->finalize     = um_crop_area_finalize;
-	widget_class->expose_event = um_crop_area_expose;
-	widget_class->button_press_event = um_crop_area_button_press_event;
-	widget_class->button_release_event = um_crop_area_button_release_event;
-	widget_class->motion_notify_event = um_crop_area_motion_notify_event;
+  object_class->finalize             = um_crop_area_finalize;
+  widget_class->expose_event         = um_crop_area_expose;
+  widget_class->button_press_event   = um_crop_area_button_press_event;
+  widget_class->button_release_event = um_crop_area_button_release_event;
+  widget_class->motion_notify_event  = um_crop_area_motion_notify_event;
 
-	g_type_class_add_private (klass, sizeof (UmCropAreaPrivate));
+  g_type_class_add_private (klass, sizeof (UmCropAreaPrivate));
 }
 
 static void
 um_crop_area_init (UmCropArea *area)
 {
-	area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), UM_TYPE_CROP_AREA,
-						   UmCropAreaPrivate));
-
-	gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
-			       GDK_BUTTON_PRESS_MASK |
-			       GDK_BUTTON_RELEASE_MASK);
-
-	area->priv->scale = 0.0;
-	area->priv->image.x = 0;
-	area->priv->image.y = 0;
-	area->priv->image.width = 0;
-	area->priv->image.height = 0;
-	area->priv->active_region = OUTSIDE;
+  area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), UM_TYPE_CROP_AREA,
+                                             UmCropAreaPrivate));
+
+  gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
+                         GDK_BUTTON_PRESS_MASK |
+                         GDK_BUTTON_RELEASE_MASK);
+
+  area->priv->scale         = 0.0;
+  area->priv->image.x       = 0;
+  area->priv->image.y       = 0;
+  area->priv->image.width   = 0;
+  area->priv->image.height  = 0;
+  area->priv->active_region = OUTSIDE;
 }
 
 GtkWidget *
 um_crop_area_new (void)
 {
-	return g_object_new (UM_TYPE_CROP_AREA, NULL);
+  return g_object_new (UM_TYPE_CROP_AREA, NULL);
 }
 
 GdkPixbuf *
 um_crop_area_get_picture (UmCropArea *area)
 {
-	return gdk_pixbuf_new_subpixbuf (area->priv->browse_pixbuf,
-					 area->priv->crop.x, area->priv->crop.y,
-					 area->priv->crop.width, area->priv->crop.height);
+  return gdk_pixbuf_new_subpixbuf (area->priv->browse_pixbuf,
+                                   area->priv->crop.x, area->priv->crop.y,
+                                   area->priv->crop.width, area->priv->crop.height);
 }
 
 void
 um_crop_area_set_picture (UmCropArea *area,
-			  GdkPixbuf  *pixbuf)
+                          GdkPixbuf  *pixbuf)
 {
-	int width;
-	int height;
-
-	if (area->priv->browse_pixbuf) {
-		g_object_unref (area->priv->browse_pixbuf);
-		area->priv->browse_pixbuf = NULL;
-	}
-	if (pixbuf) {
-		area->priv->browse_pixbuf = g_object_ref (pixbuf);
-		width = gdk_pixbuf_get_width (pixbuf);
-		height = gdk_pixbuf_get_height (pixbuf);
-	} else {
-		width = 0;
-		height = 0;
-	}
+  int width;
+  int height;
+
+  if (area->priv->browse_pixbuf)
+  {
+    g_object_unref (area->priv->browse_pixbuf);
+    area->priv->browse_pixbuf = NULL;
+  }
+  if (pixbuf)
+  {
+    area->priv->browse_pixbuf = g_object_ref (pixbuf);
+    width                     = gdk_pixbuf_get_width (pixbuf);
+    height                    = gdk_pixbuf_get_height (pixbuf);
+  }
+  else
+  {
+    width  = 0;
+    height = 0;
+  }
 
 #if 0
-	gtk_widget_get_allocation (um->browse_drawing_area, &allocation);
-	um->priv->crop.width = 96;
-	um->priv->crop.height = 96;
-	um->priv->crop.x = (allocation.width - um->priv->crop.width) / 2;
-	um->priv->crop.y = (allocation.height - um->priv->crop.height) / 2;
+  gtk_widget_get_allocation (um->browse_drawing_area, &allocation);
+  um->priv->crop.width  = 96;
+  um->priv->crop.height = 96;
+  um->priv->crop.x      = (allocation.width - um->priv->crop.width) / 2;
+  um->priv->crop.y      = (allocation.height - um->priv->crop.height) / 2;
 #else
-	area->priv->crop.width = 96;
-	area->priv->crop.height = 96;
-	area->priv->crop.x = (width - area->priv->crop.width) / 2;
-	area->priv->crop.y = (height - area->priv->crop.height) / 2;
+  area->priv->crop.width  = 96;
+  area->priv->crop.height = 96;
+  area->priv->crop.x      = (width - area->priv->crop.width) / 2;
+  area->priv->crop.y      = (height - area->priv->crop.height) / 2;
 #endif
-	area->priv->scale = 0.0;
-	area->priv->image.x = 0;
-	area->priv->image.y = 0;
-	area->priv->image.width = 0;
-	area->priv->image.height = 0;
+  area->priv->scale        = 0.0;
+  area->priv->image.x      = 0;
+  area->priv->image.y      = 0;
+  area->priv->image.width  = 0;
+  area->priv->image.height = 0;
 
-	gtk_widget_queue_draw (GTK_WIDGET (area));
+  gtk_widget_queue_draw (GTK_WIDGET (area));
 }
-
diff --git a/libcheese/um-crop-area.h b/libcheese/um-crop-area.h
index c1767ad..6db90f8 100644
--- a/libcheese/um-crop-area.h
+++ b/libcheese/um-crop-area.h
@@ -27,13 +27,13 @@ G_BEGIN_DECLS
 
 #define UM_TYPE_CROP_AREA (um_crop_area_get_type ())
 #define UM_CROP_AREA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_CROP_AREA, \
-                                                                           UmCropArea))
+                                                                  UmCropArea))
 #define UM_CROP_AREA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_CROP_AREA, \
-                                                                        UmCropAreaClass))
+                                                               UmCropAreaClass))
 #define UM_IS_CROP_AREA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_CROP_AREA))
 #define UM_IS_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_CROP_AREA))
 #define UM_CROP_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_CROP_AREA, \
-                                                                          UmCropAreaClass))
+                                                                 UmCropAreaClass))
 
 typedef struct _UmCropAreaClass UmCropAreaClass;
 typedef struct _UmCropArea UmCropArea;
@@ -54,8 +54,8 @@ GType um_crop_area_get_type (void) G_GNUC_CONST;
 
 GtkWidget *um_crop_area_new (void);
 GdkPixbuf *um_crop_area_get_picture (UmCropArea *area);
-void um_crop_area_set_picture (UmCropArea *area,
-			       GdkPixbuf  *pixbuf);
+void       um_crop_area_set_picture (UmCropArea *area,
+                                     GdkPixbuf  *pixbuf);
 
 G_END_DECLS
 



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