Ejemplo n.º 1
0
static void
gimp_thumbnail_set_property (GObject      *object,
                             guint         property_id,
                             const GValue *value,
                             GParamSpec   *pspec)
{
  GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object);

  switch (property_id)
    {
    case PROP_IMAGE_STATE:
      thumbnail->image_state = g_value_get_enum (value);
      break;
    case PROP_IMAGE_URI:
      gimp_thumbnail_set_uri (GIMP_THUMBNAIL (object),
                              g_value_get_string (value));
      break;
    case PROP_IMAGE_MTIME:
      thumbnail->image_mtime = g_value_get_int64 (value);
      break;
    case PROP_IMAGE_FILESIZE:
      thumbnail->image_filesize = g_value_get_int64 (value);
      break;
    case PROP_IMAGE_MIMETYPE:
      g_free (thumbnail->image_mimetype);
      thumbnail->image_mimetype = g_value_dup_string (value);
      break;
    case PROP_IMAGE_WIDTH:
      thumbnail->image_width = g_value_get_int (value);
      break;
    case PROP_IMAGE_HEIGHT:
      thumbnail->image_height = g_value_get_int (value);
      break;
    case PROP_IMAGE_TYPE:
      g_free (thumbnail->image_type);
      thumbnail->image_type = g_value_dup_string (value);
      break;
    case PROP_IMAGE_NUM_LAYERS:
      thumbnail->image_num_layers = g_value_get_int (value);
      break;
    case PROP_THUMB_STATE:
      thumbnail->thumb_state = g_value_get_enum (value);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
Ejemplo n.º 2
0
static void
gimp_thumbnail_finalize (GObject *object)
{
  GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object);

  if (thumbnail->image_uri)
    {
      g_free (thumbnail->image_uri);
      thumbnail->image_uri = NULL;
    }
  if (thumbnail->image_filename)
    {
      g_free (thumbnail->image_filename);
      thumbnail->image_filename = NULL;
    }
  if (thumbnail->image_mimetype)
    {
      g_free (thumbnail->image_mimetype);
      thumbnail->image_mimetype = NULL;
    }
  if (thumbnail->image_type)
    {
      g_free (thumbnail->image_type);
      thumbnail->image_type = NULL;
    }
  if (thumbnail->thumb_filename)
    {
      g_free (thumbnail->thumb_filename);
      thumbnail->thumb_filename = NULL;
    }

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
Ejemplo n.º 3
0
static PyObject *
_wrap_gimp_thumbnail_delete_failure(PyGObject *self)
{
    
    gimp_thumbnail_delete_failure(GIMP_THUMBNAIL(self->obj));
    
    Py_INCREF(Py_None);
    return Py_None;
}
Ejemplo n.º 4
0
static PyObject *
_wrap_gimp_thumbnail_peek_image(PyGObject *self)
{
    gint ret;

    
    ret = gimp_thumbnail_peek_image(GIMP_THUMBNAIL(self->obj));
    
    return pyg_enum_from_gtype(GIMP_TYPE_THUMB_STATE, ret);
}
Ejemplo n.º 5
0
static PyObject *
_wrap_gimp_thumbnail_has_failed(PyGObject *self)
{
    int ret;

    
    ret = gimp_thumbnail_has_failed(GIMP_THUMBNAIL(self->obj));
    
    return PyBool_FromLong(ret);

}
Ejemplo n.º 6
0
static PyObject *
_wrap_gimp_thumbnail_set_uri(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "uri", NULL };
    char *uri;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:Gimp.Thumbnail.set_uri", kwlist, &uri))
        return NULL;
    
    gimp_thumbnail_set_uri(GIMP_THUMBNAIL(self->obj), uri);
    
    Py_INCREF(Py_None);
    return Py_None;
}
Ejemplo n.º 7
0
static PyObject *
_wrap_gimp_thumbnail_delete_others(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "size", NULL };
    PyObject *py_size = NULL;
    GimpThumbSize size;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:Gimp.Thumbnail.delete_others", kwlist, &py_size))
        return NULL;
    if (pyg_enum_get_value(GIMP_TYPE_THUMB_SIZE, py_size, (gpointer)&size))
        return NULL;
    
    gimp_thumbnail_delete_others(GIMP_THUMBNAIL(self->obj), size);
    
    Py_INCREF(Py_None);
    return Py_None;
}
Ejemplo n.º 8
0
static PyObject *
_wrap_gimp_thumbnail_check_thumb(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "size", NULL };
    PyObject *py_size = NULL;
    gint ret;
    GimpThumbSize size;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:Gimp.Thumbnail.check_thumb", kwlist, &py_size))
        return NULL;
    if (pyg_enum_get_value(GIMP_TYPE_THUMB_SIZE, py_size, (gpointer)&size))
        return NULL;
    
    ret = gimp_thumbnail_check_thumb(GIMP_THUMBNAIL(self->obj), size);
    
    return pyg_enum_from_gtype(GIMP_TYPE_THUMB_STATE, ret);
}
Ejemplo n.º 9
0
static PyObject *
_wrap_gimp_thumbnail_set_from_thumb(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "filename", NULL };
    char *filename;
    int ret;
    GError *error = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:Gimp.Thumbnail.set_from_thumb", kwlist, &filename))
        return NULL;
    
    ret = gimp_thumbnail_set_from_thumb(GIMP_THUMBNAIL(self->obj), filename, &error);
    
    if (pyg_error_check(&error))
        return NULL;
    return PyBool_FromLong(ret);

}
Ejemplo n.º 10
0
static PyObject *
_wrap_gimp_thumbnail_save_failure(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "software", NULL };
    char *software;
    int ret;
    GError *error = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:Gimp.Thumbnail.save_failure", kwlist, &software))
        return NULL;
    
    ret = gimp_thumbnail_save_failure(GIMP_THUMBNAIL(self->obj), software, &error);
    
    if (pyg_error_check(&error))
        return NULL;
    return PyBool_FromLong(ret);

}
Ejemplo n.º 11
0
static PyObject *
_wrap_gimp_thumbnail_save_thumb_local(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "pixbuf", "software", NULL };
    PyGObject *pixbuf;
    char *software;
    int ret;
    GError *error = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!s:Gimp.Thumbnail.save_thumb_local", kwlist, &PyGdkPixbuf_Type, &pixbuf, &software))
        return NULL;
    
    ret = gimp_thumbnail_save_thumb_local(GIMP_THUMBNAIL(self->obj), GDK_PIXBUF(pixbuf->obj), software, &error);
    
    if (pyg_error_check(&error))
        return NULL;
    return PyBool_FromLong(ret);

}
Ejemplo n.º 12
0
static PyObject *
_wrap_gimp_thumbnail_load_thumb(PyGObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "size", NULL };
    PyObject *py_size = NULL;
    GdkPixbuf *ret;
    GError *error = NULL;
    GimpThumbSize size;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:Gimp.Thumbnail.load_thumb", kwlist, &py_size))
        return NULL;
    if (pyg_enum_get_value(GIMP_TYPE_THUMB_SIZE, py_size, (gpointer)&size))
        return NULL;
    
    ret = gimp_thumbnail_load_thumb(GIMP_THUMBNAIL(self->obj), size, &error);
    
    if (pyg_error_check(&error))
        return NULL;
    /* pygobject_new handles NULL checking */
    return pygobject_new((GObject *)ret);
}
Ejemplo n.º 13
0
static void
gimp_thumbnail_debug_notify (GObject    *object,
                             GParamSpec *pspec)
{
  GValue       value = { 0, };
  gchar       *str   = NULL;
  const gchar *name;

  g_value_init (&value, pspec->value_type);
  g_object_get_property (object, pspec->name, &value);

  if (G_VALUE_HOLDS_STRING (&value))
    {
      str = g_value_dup_string (&value);
    }
  else if (g_value_type_transformable (pspec->value_type, G_TYPE_STRING))
    {
      GValue  tmp = { 0, };

      g_value_init (&tmp, G_TYPE_STRING);
      g_value_transform (&value, &tmp);

      str = g_value_dup_string (&tmp);

      g_value_unset (&tmp);
    }

  g_value_unset (&value);

  name = GIMP_THUMBNAIL (object)->image_uri;

  g_printerr (" GimpThumb (%s) %s: %s\n",
              name ? name : "(null)", pspec->name, str);

  g_free (str);
}