[gnome-control-center] user-accounts: Rename UmCropArea to CcCropArea



commit d3c93d92497ba796427245fab266658e6d330086
Author: David King <amigadave amigadave com>
Date:   Wed Oct 15 13:40:08 2014 +0100

    user-accounts: Rename UmCropArea to CcCropArea
    
    Cheese has an internal copy of UmCropArea, and exports the corresponding
    um_crop_area_get_type() as part of libcheese-gtk. This leads to a crash
    when taking a photo in the avatar chooser, as the control center copy of
    the get_type() function is used. Renaming the function in Cheese would
    be an ABI break, so at this stage it is best to do the rename in the
    control center instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697039

 panels/user-accounts/Makefile.am                   |    4 +-
 .../{um-crop-area.c => cc-crop-area.c}             |   64 ++++++++++----------
 .../{um-crop-area.h => cc-crop-area.h}             |   48 +++++++-------
 panels/user-accounts/um-photo-dialog.c             |   12 ++--
 4 files changed, 64 insertions(+), 64 deletions(-)
---
diff --git a/panels/user-accounts/Makefile.am b/panels/user-accounts/Makefile.am
index 5ef4c33..1de5719 100644
--- a/panels/user-accounts/Makefile.am
+++ b/panels/user-accounts/Makefile.am
@@ -37,8 +37,8 @@ libuser_accounts_la_SOURCES =         \
        pw-utils.c                      \
        um-photo-dialog.h               \
        um-photo-dialog.c               \
-       um-crop-area.h                  \
-       um-crop-area.c                  \
+       cc-crop-area.h                  \
+       cc-crop-area.c                  \
        um-fingerprint-dialog.h         \
        um-fingerprint-dialog.c         \
        um-utils.h                      \
diff --git a/panels/user-accounts/um-crop-area.c b/panels/user-accounts/cc-crop-area.c
similarity index 94%
rename from panels/user-accounts/um-crop-area.c
rename to panels/user-accounts/cc-crop-area.c
index 2f2461c..1b6e407 100644
--- a/panels/user-accounts/um-crop-area.c
+++ b/panels/user-accounts/cc-crop-area.c
@@ -26,9 +26,9 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include "um-crop-area.h"
+#include "cc-crop-area.h"
 
-struct _UmCropAreaPrivate {
+struct _CcCropAreaPrivate {
         GdkPixbuf *browse_pixbuf;
         GdkPixbuf *pixbuf;
         GdkPixbuf *color_shifted;
@@ -44,7 +44,7 @@ struct _UmCropAreaPrivate {
         gdouble aspect;
 };
 
-G_DEFINE_TYPE (UmCropArea, um_crop_area, GTK_TYPE_DRAWING_AREA);
+G_DEFINE_TYPE (CcCropArea, cc_crop_area, GTK_TYPE_DRAWING_AREA);
 
 static inline guchar
 shift_color_byte (guchar b,
@@ -87,7 +87,7 @@ shift_colors (GdkPixbuf *pixbuf,
 }
 
 static void
-update_pixbufs (UmCropArea *area)
+update_pixbufs (CcCropArea *area)
 {
         gint width;
         gint height;
@@ -160,7 +160,7 @@ update_pixbufs (UmCropArea *area)
 }
 
 static void
-crop_to_widget (UmCropArea    *area,
+crop_to_widget (CcCropArea    *area,
                 GdkRectangle  *crop)
 {
         crop->x = area->priv->image.x + area->priv->crop.x * area->priv->scale;
@@ -183,12 +183,12 @@ typedef enum {
 } Location;
 
 static gboolean
-um_crop_area_draw (GtkWidget *widget,
+cc_crop_area_draw (GtkWidget *widget,
                    cairo_t   *cr)
 {
         GdkRectangle crop;
         gint width, height;
-        UmCropArea *uarea = UM_CROP_AREA (widget);
+        CcCropArea *uarea = CC_CROP_AREA (widget);
 
         if (uarea->priv->browse_pixbuf == NULL)
                 return FALSE;
@@ -301,7 +301,7 @@ find_location (GdkRectangle *rect,
 }
 
 static void
-update_cursor (UmCropArea *area,
+update_cursor (CcCropArea *area,
                gint           x,
                gint           y)
 {
@@ -373,10 +373,10 @@ eval_radial_line (gdouble center_x, gdouble center_y,
 }
 
 static gboolean
-um_crop_area_motion_notify_event (GtkWidget      *widget,
+cc_crop_area_motion_notify_event (GtkWidget      *widget,
                                   GdkEventMotion *event)
 {
-        UmCropArea *area = UM_CROP_AREA (widget);
+        CcCropArea *area = CC_CROP_AREA (widget);
         gint x, y;
         gint delta_x, delta_y;
         gint width, height;
@@ -634,10 +634,10 @@ um_crop_area_motion_notify_event (GtkWidget      *widget,
 }
 
 static gboolean
-um_crop_area_button_press_event (GtkWidget      *widget,
+cc_crop_area_button_press_event (GtkWidget      *widget,
                                  GdkEventButton *event)
 {
-        UmCropArea *area = UM_CROP_AREA (widget);
+        CcCropArea *area = CC_CROP_AREA (widget);
         GdkRectangle crop;
 
         if (area->priv->browse_pixbuf == NULL)
@@ -657,10 +657,10 @@ um_crop_area_button_press_event (GtkWidget      *widget,
 }
 
 static gboolean
-um_crop_area_button_release_event (GtkWidget      *widget,
+cc_crop_area_button_release_event (GtkWidget      *widget,
                                    GdkEventButton *event)
 {
-        UmCropArea *area = UM_CROP_AREA (widget);
+        CcCropArea *area = CC_CROP_AREA (widget);
         GdkRectangle crop;
 
         if (area->priv->browse_pixbuf == NULL)
@@ -680,9 +680,9 @@ um_crop_area_button_release_event (GtkWidget      *widget,
 }
 
 static void
-um_crop_area_finalize (GObject *object)
+cc_crop_area_finalize (GObject *object)
 {
-        UmCropArea *area = UM_CROP_AREA (object);
+        CcCropArea *area = CC_CROP_AREA (object);
 
         if (area->priv->browse_pixbuf) {
                 g_object_unref (area->priv->browse_pixbuf);
@@ -699,25 +699,25 @@ um_crop_area_finalize (GObject *object)
 }
 
 static void
-um_crop_area_class_init (UmCropAreaClass *klass)
+cc_crop_area_class_init (CcCropAreaClass *klass)
 {
         GObjectClass   *object_class = G_OBJECT_CLASS (klass);
         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-        object_class->finalize = um_crop_area_finalize;
-        widget_class->draw = um_crop_area_draw;
-        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 = cc_crop_area_finalize;
+        widget_class->draw = cc_crop_area_draw;
+        widget_class->button_press_event = cc_crop_area_button_press_event;
+        widget_class->button_release_event = cc_crop_area_button_release_event;
+        widget_class->motion_notify_event = cc_crop_area_motion_notify_event;
 
-        g_type_class_add_private (klass, sizeof (UmCropAreaPrivate));
+        g_type_class_add_private (klass, sizeof (CcCropAreaPrivate));
 }
 
 static void
-um_crop_area_init (UmCropArea *area)
+cc_crop_area_init (CcCropArea *area)
 {
-        area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), UM_TYPE_CROP_AREA,
-                                                   UmCropAreaPrivate));
+        area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), CC_TYPE_CROP_AREA,
+                                                   CcCropAreaPrivate));
 
         gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
                                GDK_BUTTON_PRESS_MASK |
@@ -735,13 +735,13 @@ um_crop_area_init (UmCropArea *area)
 }
 
 GtkWidget *
-um_crop_area_new (void)
+cc_crop_area_new (void)
 {
-        return g_object_new (UM_TYPE_CROP_AREA, NULL);
+        return g_object_new (CC_TYPE_CROP_AREA, NULL);
 }
 
 GdkPixbuf *
-um_crop_area_get_picture (UmCropArea *area)
+cc_crop_area_get_picture (CcCropArea *area)
 {
         gint width, height;
 
@@ -757,7 +757,7 @@ um_crop_area_get_picture (UmCropArea *area)
 }
 
 void
-um_crop_area_set_picture (UmCropArea *area,
+cc_crop_area_set_picture (CcCropArea *area,
                           GdkPixbuf  *pixbuf)
 {
         int width;
@@ -791,7 +791,7 @@ um_crop_area_set_picture (UmCropArea *area,
 }
 
 void
-um_crop_area_set_min_size (UmCropArea *area,
+cc_crop_area_set_min_size (CcCropArea *area,
                            gint        width,
                            gint        height)
 {
@@ -804,7 +804,7 @@ um_crop_area_set_min_size (UmCropArea *area,
 }
 
 void
-um_crop_area_set_constrain_aspect (UmCropArea *area,
+cc_crop_area_set_constrain_aspect (CcCropArea *area,
                                    gboolean    constrain)
 {
         if (constrain) {
diff --git a/panels/user-accounts/um-crop-area.h b/panels/user-accounts/cc-crop-area.h
similarity index 52%
rename from panels/user-accounts/um-crop-area.h
rename to panels/user-accounts/cc-crop-area.h
index 8992957..38657c6 100644
--- a/panels/user-accounts/um-crop-area.h
+++ b/panels/user-accounts/cc-crop-area.h
@@ -17,49 +17,49 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _UM_CROP_AREA_H_
-#define _UM_CROP_AREA_H_
+#ifndef _CC_CROP_AREA_H_
+#define _CC_CROP_AREA_H_
 
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
 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))
-#define UM_CROP_AREA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_CROP_AREA, \
-                                                                        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))
+#define CC_TYPE_CROP_AREA (cc_crop_area_get_type ())
+#define CC_CROP_AREA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_CROP_AREA, \
+                                                                           CcCropArea))
+#define CC_CROP_AREA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_CROP_AREA, \
+                                                                        CcCropAreaClass))
+#define CC_IS_CROP_AREA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_CROP_AREA))
+#define CC_IS_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_CROP_AREA))
+#define CC_CROP_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_CROP_AREA, \
+                                                                          CcCropAreaClass))
 
-typedef struct _UmCropAreaClass UmCropAreaClass;
-typedef struct _UmCropArea UmCropArea;
-typedef struct _UmCropAreaPrivate UmCropAreaPrivate;
+typedef struct _CcCropAreaClass CcCropAreaClass;
+typedef struct _CcCropArea CcCropArea;
+typedef struct _CcCropAreaPrivate CcCropAreaPrivate;
 
-struct _UmCropAreaClass {
+struct _CcCropAreaClass {
         GtkDrawingAreaClass parent_class;
 };
 
-struct _UmCropArea {
+struct _CcCropArea {
         GtkDrawingArea parent_instance;
-        UmCropAreaPrivate *priv;
+        CcCropAreaPrivate *priv;
 };
 
-GType      um_crop_area_get_type             (void) G_GNUC_CONST;
+GType      cc_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,
+GtkWidget *cc_crop_area_new                  (void);
+GdkPixbuf *cc_crop_area_get_picture          (CcCropArea *area);
+void       cc_crop_area_set_picture          (CcCropArea *area,
                                               GdkPixbuf  *pixbuf);
-void       um_crop_area_set_min_size         (UmCropArea *area,
+void       cc_crop_area_set_min_size         (CcCropArea *area,
                                               gint        width,
                                               gint        height);
-void       um_crop_area_set_constrain_aspect (UmCropArea *area,
+void       cc_crop_area_set_constrain_aspect (CcCropArea *area,
                                               gboolean    constrain);
 
 G_END_DECLS
 
-#endif /* _UM_CROP_AREA_H_ */
+#endif /* _CC_CROP_AREA_H_ */
diff --git a/panels/user-accounts/um-photo-dialog.c b/panels/user-accounts/um-photo-dialog.c
index 13fa8e7..31205c8 100644
--- a/panels/user-accounts/um-photo-dialog.c
+++ b/panels/user-accounts/um-photo-dialog.c
@@ -36,7 +36,7 @@
 #endif /* HAVE_CHEESE */
 
 #include "um-photo-dialog.h"
-#include "um-crop-area.h"
+#include "cc-crop-area.h"
 #include "um-utils.h"
 
 #define ROW_SPAN 6
@@ -70,7 +70,7 @@ crop_dialog_response (GtkWidget     *dialog,
                 return;
         }
 
-        pb = um_crop_area_get_picture (UM_CROP_AREA (um->crop_area));
+        pb = cc_crop_area_get_picture (CC_CROP_AREA (um->crop_area));
         pb2 = gdk_pixbuf_scale_simple (pb, 96, 96, GDK_INTERP_BILINEAR);
 
         set_user_icon_data (um->user, pb2);
@@ -105,10 +105,10 @@ um_photo_dialog_crop (UmPhotoDialog *um,
                           G_CALLBACK (crop_dialog_response), um);
 
         /* Content */
-        um->crop_area           = um_crop_area_new ();
-        um_crop_area_set_min_size (UM_CROP_AREA (um->crop_area), 48, 48);
-        um_crop_area_set_constrain_aspect (UM_CROP_AREA (um->crop_area), TRUE);
-        um_crop_area_set_picture (UM_CROP_AREA (um->crop_area), pixbuf);
+        um->crop_area           = cc_crop_area_new ();
+        cc_crop_area_set_min_size (CC_CROP_AREA (um->crop_area), 48, 48);
+        cc_crop_area_set_constrain_aspect (CC_CROP_AREA (um->crop_area), TRUE);
+        cc_crop_area_set_picture (CC_CROP_AREA (um->crop_area), pixbuf);
         frame                   = gtk_frame_new (NULL);
         gtk_container_add (GTK_CONTAINER (frame), um->crop_area);
         gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);


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