[Xfce4-commits] <ristretto:master> Re-implement exif auto-rotation

Stephan Arts noreply at xfce.org
Tue Oct 18 18:54:06 CEST 2011


Updating branch refs/heads/master
         to a7e517df26c36ccde58c4cb536007447214363c3 (commit)
       from 39f7d71c465a3131fc5922c1ef639be51d5dbb40 (commit)

commit a7e517df26c36ccde58c4cb536007447214363c3
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Oct 18 19:43:35 2011 +0200

    Re-implement exif auto-rotation

 NEWS                         |    6 +++
 src/file.c                   |   47 ++++++++++++++-----
 src/file.h                   |   10 ++++-
 src/image_list.c             |    1 +
 src/image_viewer.c           |  103 +++++++++++++++++++++++-------------------
 src/image_viewer.h           |   13 +----
 src/main.c                   |    1 +
 src/main_window.c            |   37 ++++++++-------
 src/properties_dialog.c      |    1 +
 src/thumbnail.c              |    1 +
 src/thumbnail_bar.c          |    1 +
 src/thumbnailer.c            |    1 +
 src/util.h                   |   37 +++++++++++++++
 src/wallpaper_manager.c      |    1 +
 src/xfce_wallpaper_manager.c |    1 +
 15 files changed, 173 insertions(+), 88 deletions(-)

diff --git a/NEWS b/NEWS
index 5fb8690..1610a69 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+x.x.x
+=====
+- Re-introduce autorotation based on the exif-orientation tag, a
+  regression since 0.0.93
+- Prevent segmentation fault when an error occurs while loading an image
+
 0.2.0
 =====
 - Fix bug #6866 (Improve the sorting algorythm for filenames)
diff --git a/src/file.c b/src/file.c
index c4a4d83..24f5f59 100644
--- a/src/file.c
+++ b/src/file.c
@@ -25,6 +25,7 @@
 
 #include <libxfce4util/libxfce4util.h>
 
+#include "util.h"
 #include "file.h"
 
 static void
@@ -100,6 +101,7 @@ struct _RsttoFilePriv
     gchar *path;
 
     ExifData *exif_data;
+    RsttoImageOrientation orientation;
 };
 
 
@@ -213,7 +215,6 @@ rstto_file_new ( GFile *file )
     o_file->priv->file = file;
     g_object_ref (file);
 
-
     open_files = g_list_append (open_files, o_file);
 
     return o_file;
@@ -339,10 +340,9 @@ rstto_file_get_modified_time ( RsttoFile *file )
     return time_;
 }
 
-gchar *
+ExifEntry *
 rstto_file_get_exif ( RsttoFile *file, ExifTag id )
 {
-    gchar *val = NULL;
     ExifEntry *exif_entry = NULL;
 
     /* If there is no exif-data object, try to create it */
@@ -352,21 +352,42 @@ rstto_file_get_exif ( RsttoFile *file, ExifTag id )
     }
     if ( NULL != file->priv->exif_data )
     {
-        exif_entry = exif_data_get_entry (
+        return exif_data_get_entry (
                 file->priv->exif_data,
                 id );
-        if ( NULL != exif_entry )
+    }
+    return NULL;
+}
+
+RsttoImageOrientation
+rstto_file_get_orientation ( RsttoFile *file )
+{
+    ExifEntry *exif_entry = NULL;
+    if (file->priv->orientation == 0 )
+    {
+        exif_entry = rstto_file_get_exif (file, EXIF_TAG_ORIENTATION);
+        if (NULL != exif_entry)
         {
-            switch ( id )
-            {
-                default:
-                    val = g_new0 (gchar, 20);
-                    exif_entry_get_value (exif_entry, val, 20);
-                    break;
-            }
+            file->priv->orientation = exif_get_short (
+                    exif_entry->data,
+                    exif_data_get_byte_order (exif_entry->parent->parent));
+
+            exif_entry_free (exif_entry);
+        }
+        if (file->priv->orientation == 0)
+        {
+            /* Default orientation */
+            file->priv->orientation = RSTTO_IMAGE_ORIENT_NONE;
         }
 
     }
+    return file->priv->orientation;
+}
 
-    return val;
+void
+rstto_file_set_orientation (
+        RsttoFile *file ,
+        RsttoImageOrientation orientation )
+{
+    file->priv->orientation = orientation;
 }
diff --git a/src/file.h b/src/file.h
index 9ace0de..e632b9a 100644
--- a/src/file.h
+++ b/src/file.h
@@ -86,9 +86,17 @@ rstto_file_get_content_type ( RsttoFile * );
 guint64
 rstto_file_get_modified_time ( RsttoFile *);
 
-gchar *
+ExifEntry *
 rstto_file_get_exif ( RsttoFile *, ExifTag );
 
+RsttoImageOrientation
+rstto_file_get_orientation ( RsttoFile * );
+
+void
+rstto_file_set_orientation (
+        RsttoFile * ,
+        RsttoImageOrientation );
+
 
 G_END_DECLS
 
diff --git a/src/image_list.c b/src/image_list.c
index 1ee2179..ac1f291 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -28,6 +28,7 @@
 
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "image_list.h"
 #include "settings.h"
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 5268f5a..64bc18a 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -23,6 +23,8 @@
 #include <gio/gio.h>
 #include <libexif/exif-data.h>
 
+#include "util.h"
+
 #include "file.h"
 #include "image_viewer.h"
 #include "settings.h"
@@ -56,7 +58,7 @@ struct _RsttoImageViewerPriv
     RsttoImageViewerTransaction *transaction;
     GdkPixbuf                   *pixbuf;
     GdkPixbuf                   *dst_pixbuf;
-    RsttoImageViewerOrientation  orientation;
+    RsttoImageOrientation        orientation;
     gdouble                      quality;
 
 
@@ -112,6 +114,7 @@ struct _RsttoImageViewerTransaction
     gint              image_height;
     gdouble           image_scale;
     gdouble           scale;
+    RsttoImageOrientation orientation;
 
     /* File I/O data */
     /*****************/
@@ -896,7 +899,7 @@ rstto_image_viewer_set_file (
         RsttoImageViewer *viewer,
         RsttoFile *file,
         gdouble scale,
-        RsttoImageViewerOrientation orientation)
+        RsttoImageOrientation orientation)
 {
     
     /*
@@ -1216,13 +1219,15 @@ rstto_image_viewer_set_motion_state (RsttoImageViewer *viewer, RsttoImageViewerM
 void
 rstto_image_viewer_set_orientation (
         RsttoImageViewer *viewer, 
-        RsttoImageViewerOrientation orientation)
+        RsttoImageOrientation orientation)
 {
     viewer->priv->orientation = orientation;
+    rstto_file_set_orientation (viewer->priv->file, orientation);
+
     rstto_image_viewer_queued_repaint (viewer, TRUE);
 }
 
-RsttoImageViewerOrientation
+RsttoImageOrientation
 rstto_image_viewer_get_orientation (RsttoImageViewer *viewer)
 {
     return viewer->priv->orientation;
@@ -1420,6 +1425,8 @@ cb_rstto_image_loader_size_prepared (GdkPixbufLoader *loader, gint width, gint h
          */
         transaction->image_scale = 1.0;
     }
+
+    transaction->orientation = rstto_file_get_orientation (transaction->file);
 }
 
 static void
@@ -1434,6 +1441,7 @@ cb_rstto_image_loader_closed (GdkPixbufLoader *loader, RsttoImageViewerTransacti
         viewer->priv->image_scale = transaction->image_scale;
         viewer->priv->image_width = transaction->image_width;
         viewer->priv->image_height = transaction->image_height;
+        viewer->priv->orientation = transaction->orientation;
 
         viewer->priv->transaction = NULL;
         rstto_image_viewer_queued_repaint (viewer, TRUE);
@@ -1515,8 +1523,17 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
     {
         switch (viewer->priv->orientation)
         {
-            case RSTTO_IMAGE_VIEWER_ORIENT_NONE:
-            case RSTTO_IMAGE_VIEWER_ORIENT_180:
+            case RSTTO_IMAGE_ORIENT_90:
+            case RSTTO_IMAGE_ORIENT_270:
+                hadjustment = viewer->vadjustment;
+                vadjustment = viewer->hadjustment;
+
+                v_scale = (gdouble)(GTK_WIDGET (viewer)->allocation.height) / (gdouble)viewer->priv->image_width;
+                h_scale = (gdouble)(GTK_WIDGET (viewer)->allocation.width) / (gdouble)viewer->priv->image_height;
+                break;
+            case RSTTO_IMAGE_ORIENT_NONE:
+            case RSTTO_IMAGE_ORIENT_180:
+            default:
                 hadjustment = viewer->hadjustment;
                 vadjustment = viewer->vadjustment;
 
@@ -1524,14 +1541,6 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
                 h_scale = (gdouble)(GTK_WIDGET (viewer)->allocation.width) / (gdouble)viewer->priv->image_width;
                 break;
 
-            case RSTTO_IMAGE_VIEWER_ORIENT_90:
-            case RSTTO_IMAGE_VIEWER_ORIENT_270:
-                hadjustment = viewer->vadjustment;
-                vadjustment = viewer->hadjustment;
-
-                v_scale = (gdouble)(GTK_WIDGET (viewer)->allocation.height) / (gdouble)viewer->priv->image_width;
-                h_scale = (gdouble)(GTK_WIDGET (viewer)->allocation.width) / (gdouble)viewer->priv->image_height;
-                break;
         }
 
         width = gdk_pixbuf_get_width (viewer->priv->pixbuf);
@@ -1611,32 +1620,7 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
          */
         switch (viewer->priv->orientation)
         {
-            case RSTTO_IMAGE_VIEWER_ORIENT_NONE:
-                if ((gtk_adjustment_get_page_size (vadjustment) + 
-                        gtk_adjustment_get_value(vadjustment)) > (viewer->priv->image_height*viewer->priv->scale))
-                {
-                    gtk_adjustment_set_value (vadjustment,
-                            (height*relative_scale) -
-                            gtk_adjustment_get_page_size (vadjustment));
-                }
-                if ((gtk_adjustment_get_page_size (hadjustment) + 
-                        gtk_adjustment_get_value(hadjustment)) > (viewer->priv->image_width*viewer->priv->scale))
-                {
-                    gtk_adjustment_set_value (hadjustment,
-                            (width*relative_scale) - 
-                            gtk_adjustment_get_page_size (hadjustment));
-                }
-                gtk_adjustment_set_upper (hadjustment, (gdouble)width*(viewer->priv->scale/viewer->priv->image_scale));
-                gtk_adjustment_set_upper (vadjustment, (gdouble)height*(viewer->priv->scale/viewer->priv->image_scale));
-
-                subpixbuf_x_offset = (gint)(gtk_adjustment_get_value (hadjustment) / relative_scale);
-                subpixbuf_y_offset = (gint)(gtk_adjustment_get_value (vadjustment) / relative_scale);
-                subpixbuf_width = (gint)((gtk_adjustment_get_page_size (hadjustment) / relative_scale) < width)?
-                               (gtk_adjustment_get_page_size (hadjustment) / relative_scale)+1:(width);
-                subpixbuf_height = (gint)((gtk_adjustment_get_page_size (vadjustment) / relative_scale) < height)?
-                               (gtk_adjustment_get_page_size (vadjustment) / relative_scale)+1:(height);
-                break;
-            case RSTTO_IMAGE_VIEWER_ORIENT_180:
+            case RSTTO_IMAGE_ORIENT_180:
                 gtk_adjustment_set_upper (hadjustment, (gdouble)width*(viewer->priv->scale/viewer->priv->image_scale));
                 gtk_adjustment_set_upper (vadjustment, (gdouble)height*(viewer->priv->scale/viewer->priv->image_scale));
                 subpixbuf_x_offset = (gint)((gtk_adjustment_get_upper(hadjustment) - 
@@ -1650,7 +1634,7 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
                 subpixbuf_height = (gint)((gtk_adjustment_get_page_size (vadjustment) / relative_scale) < height)?
                                (gtk_adjustment_get_page_size (vadjustment) / relative_scale)+1:(height);
                 break;
-            case RSTTO_IMAGE_VIEWER_ORIENT_270:
+            case RSTTO_IMAGE_ORIENT_270:
                 gtk_adjustment_set_upper (hadjustment, (gdouble)width*(viewer->priv->scale/viewer->priv->image_scale));
                 gtk_adjustment_set_upper (vadjustment, (gdouble)height*(viewer->priv->scale/viewer->priv->image_scale));
 
@@ -1678,7 +1662,7 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
                 subpixbuf_height = (gint)((gtk_adjustment_get_page_size (vadjustment) / relative_scale) < height)?
                                (gtk_adjustment_get_page_size (vadjustment) / relative_scale)+1:(height);
                 break;
-            case RSTTO_IMAGE_VIEWER_ORIENT_90:
+            case RSTTO_IMAGE_ORIENT_90:
                 gtk_adjustment_set_upper (hadjustment, (gdouble)width*(viewer->priv->scale/viewer->priv->image_scale));
                 gtk_adjustment_set_upper (vadjustment, (gdouble)height*(viewer->priv->scale/viewer->priv->image_scale));
 
@@ -1706,6 +1690,32 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
                 subpixbuf_height = (gint)((gtk_adjustment_get_page_size (vadjustment) / relative_scale) < height)?
                                (gtk_adjustment_get_page_size (vadjustment) / relative_scale)+1:(height);
                 break;
+            case RSTTO_IMAGE_ORIENT_NONE:
+            default:
+                if ((gtk_adjustment_get_page_size (vadjustment) + 
+                        gtk_adjustment_get_value(vadjustment)) > (viewer->priv->image_height*viewer->priv->scale))
+                {
+                    gtk_adjustment_set_value (vadjustment,
+                            (height*relative_scale) -
+                            gtk_adjustment_get_page_size (vadjustment));
+                }
+                if ((gtk_adjustment_get_page_size (hadjustment) + 
+                        gtk_adjustment_get_value(hadjustment)) > (viewer->priv->image_width*viewer->priv->scale))
+                {
+                    gtk_adjustment_set_value (hadjustment,
+                            (width*relative_scale) - 
+                            gtk_adjustment_get_page_size (hadjustment));
+                }
+                gtk_adjustment_set_upper (hadjustment, (gdouble)width*(viewer->priv->scale/viewer->priv->image_scale));
+                gtk_adjustment_set_upper (vadjustment, (gdouble)height*(viewer->priv->scale/viewer->priv->image_scale));
+
+                subpixbuf_x_offset = (gint)(gtk_adjustment_get_value (hadjustment) / relative_scale);
+                subpixbuf_y_offset = (gint)(gtk_adjustment_get_value (vadjustment) / relative_scale);
+                subpixbuf_width = (gint)((gtk_adjustment_get_page_size (hadjustment) / relative_scale) < width)?
+                               (gtk_adjustment_get_page_size (hadjustment) / relative_scale)+1:(width);
+                subpixbuf_height = (gint)((gtk_adjustment_get_page_size (vadjustment) / relative_scale) < height)?
+                               (gtk_adjustment_get_page_size (vadjustment) / relative_scale)+1:(height);
+                break;
         }
 
         if (subpixbuf_x_offset < 0)
@@ -1746,22 +1756,23 @@ cb_rstto_image_viewer_queued_repaint (RsttoImageViewer *viewer)
 
             switch (viewer->priv->orientation)
             {
-                case RSTTO_IMAGE_VIEWER_ORIENT_180:
+                case RSTTO_IMAGE_ORIENT_180:
                     tmp_pixbuf2 = gdk_pixbuf_rotate_simple (tmp_pixbuf, GDK_PIXBUF_ROTATE_UPSIDEDOWN);
                     g_object_unref (tmp_pixbuf);
                     tmp_pixbuf = tmp_pixbuf2;
                     break;
-                case RSTTO_IMAGE_VIEWER_ORIENT_270:
+                case RSTTO_IMAGE_ORIENT_270:
                     tmp_pixbuf2 = gdk_pixbuf_rotate_simple (tmp_pixbuf, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE);
                     g_object_unref (tmp_pixbuf);
                     tmp_pixbuf = tmp_pixbuf2;
                     break;
-                case RSTTO_IMAGE_VIEWER_ORIENT_90:
+                case RSTTO_IMAGE_ORIENT_90:
                     tmp_pixbuf2 = gdk_pixbuf_rotate_simple (tmp_pixbuf, GDK_PIXBUF_ROTATE_CLOCKWISE);
                     g_object_unref (tmp_pixbuf);
                     tmp_pixbuf = tmp_pixbuf2;
                     break;
-                case RSTTO_IMAGE_VIEWER_ORIENT_NONE:
+                case RSTTO_IMAGE_ORIENT_NONE:
+                default:
                     break;
             }
 
diff --git a/src/image_viewer.h b/src/image_viewer.h
index 0dcbaaa..9f93097 100644
--- a/src/image_viewer.h
+++ b/src/image_viewer.h
@@ -21,13 +21,6 @@
 
 G_BEGIN_DECLS
 
-typedef enum
-{
-  RSTTO_IMAGE_VIEWER_ORIENT_NONE,
-  RSTTO_IMAGE_VIEWER_ORIENT_90,
-  RSTTO_IMAGE_VIEWER_ORIENT_180,
-  RSTTO_IMAGE_VIEWER_ORIENT_270
-} RsttoImageViewerOrientation;
 
 #define RSTTO_TYPE_IMAGE_VIEWER rstto_image_viewer_get_type()
 
@@ -84,7 +77,7 @@ rstto_image_viewer_set_file (
         RsttoImageViewer *viewer,
         RsttoFile *file,
         gdouble scale,
-        RsttoImageViewerOrientation orientation);
+        RsttoImageOrientation orientation);
 
 void
 rstto_image_viewer_set_scale (
@@ -98,9 +91,9 @@ rstto_image_viewer_get_scale (
 void
 rstto_image_viewer_set_orientation (
         RsttoImageViewer *viewer, 
-        RsttoImageViewerOrientation orientation);
+        RsttoImageOrientation orientation);
 
-RsttoImageViewerOrientation
+RsttoImageOrientation
 rstto_image_viewer_get_orientation (RsttoImageViewer *viewer);
 
 void
diff --git a/src/main.c b/src/main.c
index 99cb512..ca29b35 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,6 +30,7 @@
 #include <libxfce4util/libxfce4util.h>
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "image_list.h"
 #include "settings.h"
diff --git a/src/main_window.c b/src/main_window.c
index f9e90f4..23318ab 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -32,6 +32,7 @@
 #include <cairo/cairo.h>
 
 #include "settings.h"
+#include "util.h"
 #include "file.h"
 #include "image_list.h"
 #include "image_viewer.h"
@@ -903,7 +904,7 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
                     RSTTO_IMAGE_VIEWER(window->priv->image_viewer),
                     cur_file,
                     -1.0,
-                    RSTTO_IMAGE_VIEWER_ORIENT_NONE);
+                    0);
 
             app_list = g_app_info_get_all_for_type (content_type);
 
@@ -941,7 +942,7 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
             gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
             gtk_widget_set_sensitive (menu_item, FALSE);
 
-            rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER(window->priv->image_viewer), NULL, -1, RSTTO_IMAGE_VIEWER_ORIENT_NONE);
+            rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER(window->priv->image_viewer), NULL, -1, 0);
 
 
             menu_item = gtk_image_menu_item_new_with_label (_("Empty"));
@@ -2433,17 +2434,17 @@ cb_rstto_main_window_rotate_cw (GtkWidget *widget, RsttoMainWindow *window)
     switch (rstto_image_viewer_get_orientation (viewer))
     {
         default:
-        case RSTTO_IMAGE_VIEWER_ORIENT_NONE:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_90);
+        case RSTTO_IMAGE_ORIENT_NONE:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_90);
             break;
-        case RSTTO_IMAGE_VIEWER_ORIENT_90:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_180);
+        case RSTTO_IMAGE_ORIENT_90:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_180);
             break;
-        case RSTTO_IMAGE_VIEWER_ORIENT_180:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_270);
+        case RSTTO_IMAGE_ORIENT_180:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_270);
             break;
-        case RSTTO_IMAGE_VIEWER_ORIENT_270:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_NONE);
+        case RSTTO_IMAGE_ORIENT_270:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_NONE);
             break;
     }
 }
@@ -2462,17 +2463,17 @@ cb_rstto_main_window_rotate_ccw (GtkWidget *widget, RsttoMainWindow *window)
     switch (rstto_image_viewer_get_orientation (viewer))
     {
         default:
-        case RSTTO_IMAGE_VIEWER_ORIENT_NONE:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_270);
+        case RSTTO_IMAGE_ORIENT_NONE:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_270);
             break;
-        case RSTTO_IMAGE_VIEWER_ORIENT_90:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_NONE);
+        case RSTTO_IMAGE_ORIENT_90:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_NONE);
             break;
-        case RSTTO_IMAGE_VIEWER_ORIENT_180:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_90);
+        case RSTTO_IMAGE_ORIENT_180:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_90);
             break;
-        case RSTTO_IMAGE_VIEWER_ORIENT_270:
-            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_VIEWER_ORIENT_180);
+        case RSTTO_IMAGE_ORIENT_270:
+            rstto_image_viewer_set_orientation (viewer, RSTTO_IMAGE_ORIENT_180);
             break;
     }
 }
diff --git a/src/properties_dialog.c b/src/properties_dialog.c
index 4af5507..b955ce2 100644
--- a/src/properties_dialog.c
+++ b/src/properties_dialog.c
@@ -25,6 +25,7 @@
 #include <libxfce4util/libxfce4util.h>
 
 #include "settings.h"
+#include "util.h"
 #include "file.h"
 #include "properties_dialog.h"
 
diff --git a/src/thumbnail.c b/src/thumbnail.c
index b531492..649181b 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -23,6 +23,7 @@
 
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "image_list.h"
 #include "thumbnail.h"
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index 27be636..6633355 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -24,6 +24,7 @@
 #include <libxfce4ui/libxfce4ui.h>
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "image_list.h"
 #include "thumbnail.h"
diff --git a/src/thumbnailer.c b/src/thumbnailer.c
index 3bc5c67..f0149e0 100644
--- a/src/thumbnailer.c
+++ b/src/thumbnailer.c
@@ -27,6 +27,7 @@
 
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "thumbnail.h"
 #include "thumbnailer.h"
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 0000000..334cddb
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (c) Stephan Arts 2011 <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __RISTRETTO_UTIL_H__
+#define __RISTRETTO_UTIL_H__
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+  RSTTO_IMAGE_ORIENT_NONE = 1,
+  RSTTO_IMAGE_ORIENT_FLIP_HORIZONTAL,
+  RSTTO_IMAGE_ORIENT_180,
+  RSTTO_IMAGE_ORIENT_FLIP_VERTICAL,
+  RSTTO_IMAGE_ORIENT_FLIP_TRANSPOSE,
+  RSTTO_IMAGE_ORIENT_90,
+  RSTTO_IMAGE_ORIENT_FLIP_TRANSVERSE,
+  RSTTO_IMAGE_ORIENT_270,
+  RSTTO_IMAGE_ORIENT_NOT_DETERMINED,
+} RsttoImageOrientation;
+
+#endif /* __RSTTO_UTIL_H__ */
diff --git a/src/wallpaper_manager.c b/src/wallpaper_manager.c
index 8914d7f..4a57a34 100644
--- a/src/wallpaper_manager.c
+++ b/src/wallpaper_manager.c
@@ -26,6 +26,7 @@
 
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "wallpaper_manager.h"
 
diff --git a/src/xfce_wallpaper_manager.c b/src/xfce_wallpaper_manager.c
index aded7b3..f2873f0 100644
--- a/src/xfce_wallpaper_manager.c
+++ b/src/xfce_wallpaper_manager.c
@@ -28,6 +28,7 @@
 
 #include <libexif/exif-data.h>
 
+#include "util.h"
 #include "file.h"
 #include "monitor_chooser.h"
 #include "wallpaper_manager.h"


More information about the Xfce4-commits mailing list