summaryrefslogtreecommitdiff
path: root/tumbler/tumbler-enum-types.c
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2009-05-22 01:48:00 +0200
committerJannis Pohlmann <jannis@xfce.org>2009-05-22 01:48:00 +0200
commitefab2f56c73c1dec60a14c83a5aff6a5620f7bbc (patch)
treeb8fcee37105b2228a6d6aff319d2a111643e2d92 /tumbler/tumbler-enum-types.c
parent2c9ff27c04812b52b4ba9ed02cd1c4c89da9b851 (diff)
downloadtumbler-efab2f56c73c1dec60a14c83a5aff6a5620f7bbc.tar.gz
Add error domain, TumblerThumbnailFlavor and thumbnail helper functions.
This commit adds the TUMBLER_ERROR_DOMAIN and TUMBLER_ERROR defines and a TumblerErrorEnum with currently only containing TUMBLER_ERROR_FAILED. Also new is the TumblerThumbnailFlavor enum type, together with a few utility functions related to creating thumbnails: - tumbler_thumbnail_get_flavors() returns all flavors supported by the current build of tumbler, - tumbler_thumbnail_flavor_get_size() returns the size corresponding to a flavor (e.g. 128 for TUMBLER_THUMBNAIL_FLAVOR_NORMAL), - tumbler_thumbnail_flavor_get_directory() returns a GFile pointing to the flavor directory (e.g. $HOME/.thumbnails/normal/ for TUMBLER_THUMBNAIL_FLAVOR_NORMAL), - tumbler_thumbnail_get_file() returns a GFile pointing to the thumbnail destination file of an URI and a flavor, - tumbler_thumbnail_create_and_open_file() tries to create such a GFile and also tries to open it for writing, returning the GFileOutputStream if possible.
Diffstat (limited to 'tumbler/tumbler-enum-types.c')
-rw-r--r--tumbler/tumbler-enum-types.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/tumbler/tumbler-enum-types.c b/tumbler/tumbler-enum-types.c
new file mode 100644
index 0000000..34f020c
--- /dev/null
+++ b/tumbler/tumbler-enum-types.c
@@ -0,0 +1,52 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <glib-object.h>
+
+#include <tumbler/tumbler-enum-types.h>
+
+
+
+GType
+tumbler_thumbnail_flavor_get_type (void)
+{
+ GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ {
+ static const GEnumValue values[] =
+ {
+ { TUMBLER_THUMBNAIL_FLAVOR_INVALID, "TUMBLER_THUMBNAIL_FLAVOR_INVALID", N_ ("Invalid"), },
+ { TUMBLER_THUMBNAIL_FLAVOR_NORMAL, "TUMBLER_THUMBNAIL_FLAVOR_NORMAL", N_ ("Normal"), },
+ { TUMBLER_THUMBNAIL_FLAVOR_LARGE, "TUMBLER_THUMBNAIL_FLAVOR_LARGE", N_ ("Large"), },
+ { TUMBLER_THUMBNAIL_FLAVOR_CROPPED, "TUMBLER_THUMBNAIL_FLAVOR_CROPPED", N_ ("Cropped"), },
+ { 0, NULL, NULL, },
+ };
+
+ type = g_enum_register_static ("TumblerThumbnailFlavor", values);
+ }
+
+ return type;
+}