Exemple #1
0
/**
 * cheese_avatar_widget_get_picture:
 * @widget: a #CheeseAvatarWidget dialogue
 *
 * Returns the portion of image selected through the builtin cropping tool,
 * after a picture has been captured on the webcam.
 *
 * Return value: a #GdkPixbuf object, or %NULL if no picture has been taken yet
 */
GdkPixbuf *
cheese_avatar_widget_get_picture (CheeseAvatarWidget *widget)
{
    CheeseAvatarWidgetPrivate *priv;

    g_return_val_if_fail (CHEESE_IS_AVATAR_WIDGET (widget), NULL);

    priv = cheese_avatar_widget_get_instance_private (widget);

    return um_crop_area_get_picture (UM_CROP_AREA (priv->image));
}
Exemple #2
0
static void
cheese_avatar_widget_get_property (GObject *object, guint prop_id,
                                   GValue *value, GParamSpec *pspec)
{
    CheeseAvatarWidgetPrivate *priv;

    priv = cheese_avatar_widget_get_instance_private (CHEESE_AVATAR_WIDGET (object));

    switch (prop_id)
    {
    case PROP_PIXBUF:
        g_value_set_object (value, um_crop_area_get_picture (UM_CROP_AREA (priv->image)));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
static void
crop_dialog_response (GtkWidget     *dialog,
                      gint           response_id,
                      UmPhotoDialog *um)
{
        GdkPixbuf *pb, *pb2;

        if (response_id != GTK_RESPONSE_ACCEPT) {
                um->crop_area = NULL;
                gtk_widget_destroy (dialog);
                return;
        }

        pb = um_crop_area_get_picture (UM_CROP_AREA (um->crop_area));
        pb2 = gdk_pixbuf_scale_simple (pb, 96, 96, GDK_INTERP_BILINEAR);

        um_user_set_icon_data (um->user, pb2);

        g_object_unref (pb2);
        g_object_unref (pb);

        um->crop_area = NULL;
        gtk_widget_destroy (dialog);
}