[cheese] get rid of eog thumbnail



commit e91a050941dc2ccbba85f5ddbcd5e5e32587f8ed
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Sat Aug 7 03:10:00 2010 +0200

    get rid of eog thumbnail
    
    removed eog thumbnail and added cheese thumbnail, which
    uses the best things from nautilus and eog.

 data/pixmaps/thumbnail-frame.png                   |  Bin 908 -> 482 bytes
 src/Makefile.am                                    |    8 +-
 src/thumbview/cheese-thumb-view.c                  |    6 +-
 .../{eog-thumbnail.c => cheese-thumbnail.c}        |   99 ++++++++++---------
 .../{eog-thumbnail.h => cheese-thumbnail.h}        |   25 +++---
 5 files changed, 71 insertions(+), 67 deletions(-)
---
diff --git a/data/pixmaps/thumbnail-frame.png b/data/pixmaps/thumbnail-frame.png
index c2605d5..674b648 100644
Binary files a/data/pixmaps/thumbnail-frame.png and b/data/pixmaps/thumbnail-frame.png differ
diff --git a/src/Makefile.am b/src/Makefile.am
index ff8a80d..6970f89 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,14 +42,14 @@ cheese_SOURCES = \
 	cheese-preferences.vala \
 	thumbview/cheese-gconf.c \
 	thumbview/cheese-thumb-view.c \
-	thumbview/eog-thumb-nav.c \
-	thumbview/eog-thumbnail.c
+	thumbview/cheese-thumbnail.c \
+	thumbview/eog-thumb-nav.c
 
 noinst_HEADERS = \
 	thumbview/cheese-gconf.h \
 	thumbview/cheese-thumb-view.h \
-	thumbview/eog-thumb-nav.h \
-	thumbview/eog-thumbnail.h
+	thumbview/cheese-thumbnail.h \
+	thumbview/eog-thumb-nav.h
 
 cheese_LDADD = \
 	$(top_builddir)/libcheese/libcheesecommon.la \
diff --git a/src/thumbview/cheese-thumb-view.c b/src/thumbview/cheese-thumb-view.c
index 18c1fb7..c39a487 100644
--- a/src/thumbview/cheese-thumb-view.c
+++ b/src/thumbview/cheese-thumb-view.c
@@ -29,7 +29,7 @@
 #include <string.h>
 
 #include "cheese-fileutil.h"
-#include "eog-thumbnail.h"
+#include "cheese-thumbnail.h"
 
 #include "cheese-thumb-view.h"
 
@@ -154,7 +154,7 @@ cheese_thumb_view_thread_append_item (gpointer data)
   }
   else
   {
-    eog_thumbnail_add_frame (&pixbuf);
+    cheese_thumbnail_add_frame (&pixbuf);
   }
 
   gdk_threads_enter ();
@@ -595,7 +595,7 @@ cheese_thumb_view_init (CheeseThumbView *thumb_view)
 
   GFile *file;
 
-  eog_thumbnail_init ();
+  cheese_thumbnail_init ();
 
   priv->store   = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
   priv->n_items = 0;
diff --git a/src/thumbview/eog-thumbnail.c b/src/thumbview/cheese-thumbnail.c
similarity index 75%
rename from src/thumbview/eog-thumbnail.c
rename to src/thumbview/cheese-thumbnail.c
index a19e348..40fe492 100644
--- a/src/thumbview/eog-thumbnail.c
+++ b/src/thumbview/cheese-thumbnail.c
@@ -1,11 +1,12 @@
-/* Eye Of Gnome - Thumbnailing functions
+/*
+ * Copyright © 2010 daniel g. siegel <dgsiegel gnome org>
  *
- * Copyright (C) 2000-2007 The Free Software Foundation
  *
- * Author: Lucas Rocha <lucasr gnome org>
+ * Based on eog and eel code by:
+ *   - Lucas Rocha <lucasr gnome org>
+ *   - Andy Hertzfeld <andy eazel com>
  *
- * Based on eel code (eel/eel-graphic-effects.c) by:
- *      - Andy Hertzfeld <andy eazel com>
+ * Licensed under the GNU General Public License Version 2
  *
  * 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
@@ -18,18 +19,19 @@
  * GNU 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.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* NOTE this is a stripped version of eog-thumbnail which only contains the
- * functions necessary for cheese
- */
 #ifdef HAVE_CONFIG_H
   #include <cheese-config.h>
 #endif
 
-#include "eog-thumbnail.h"
+#include "cheese-thumbnail.h"
+
+#define CHEESE_THUMBNAIL_FRAME_LEFT   3
+#define CHEESE_THUMBNAIL_FRAME_TOP    3
+#define CHEESE_THUMBNAIL_FRAME_RIGHT  3
+#define CHEESE_THUMBNAIL_FRAME_BOTTOM 3
 
 
 static GdkPixbuf *frame = NULL;
@@ -123,14 +125,14 @@ art_rgb_run_alpha (guint8 *buf, guint8 r, guint8 g, guint8 b, int alpha, int n)
 }
 
 static GdkPixbuf *
-eog_thumbnail_stretch_frame_image (GdkPixbuf *frame_image,
-                                   gint       left_offset,
-                                   gint       top_offset,
-                                   gint       right_offset,
-                                   gint       bottom_offset,
-                                   gint       dest_width,
-                                   gint       dest_height,
-                                   gboolean   fill_flag)
+cheese_thumbnail_stretch_frame_image (GdkPixbuf *frame_image,
+                                      gint       left_offset,
+                                      gint       top_offset,
+                                      gint       right_offset,
+                                      gint       bottom_offset,
+                                      gint       dest_width,
+                                      gint       dest_height,
+                                      gboolean   fill_flag)
 {
   GdkPixbuf *result_pixbuf;
   guchar    *pixels_ptr;
@@ -253,38 +255,41 @@ eog_thumbnail_stretch_frame_image (GdkPixbuf *frame_image,
 }
 
 void
-eog_thumbnail_add_frame (GdkPixbuf **thumbnail)
+cheese_thumbnail_add_frame (GdkPixbuf **pixbuf)
 {
-  GdkPixbuf *result_pixbuf;
-  gint       source_width, source_height;
-  gint       dest_width, dest_height;
-
-  source_width  = gdk_pixbuf_get_width (*thumbnail);
-  source_height = gdk_pixbuf_get_height (*thumbnail);
-
-  dest_width  = source_width + 9;
-  dest_height = source_height + 9;
-
-  result_pixbuf = eog_thumbnail_stretch_frame_image (frame,
-                                                     3, 3, 6, 6,
-                                                     dest_width,
-                                                     dest_height,
-                                                     FALSE);
-
-  gdk_pixbuf_copy_area (*thumbnail,
-                        0, 0,
-                        source_width,
-                        source_height,
-                        result_pixbuf,
-                        3, 3);
-
-  g_object_unref (*thumbnail);
-
-  *thumbnail = result_pixbuf;
+  GdkPixbuf *result;
+  int        source_width, source_height;
+  int        dest_width, dest_height;
+  int        left_offset, right_offset, top_offset, bottom_offset;
+
+  left_offset   = CHEESE_THUMBNAIL_FRAME_LEFT;
+  right_offset  = CHEESE_THUMBNAIL_FRAME_RIGHT;
+  top_offset    = CHEESE_THUMBNAIL_FRAME_TOP;
+  bottom_offset = CHEESE_THUMBNAIL_FRAME_BOTTOM;
+
+  source_width  = gdk_pixbuf_get_width (*pixbuf);
+  source_height = gdk_pixbuf_get_height (*pixbuf);
+
+  dest_width  = source_width + left_offset + right_offset;
+  dest_height = source_height + top_offset + bottom_offset;
+
+  result = cheese_thumbnail_stretch_frame_image (frame,
+                                                 left_offset,
+                                                 top_offset,
+                                                 right_offset,
+                                                 bottom_offset,
+                                                 dest_width,
+                                                 dest_height,
+                                                 FALSE);
+
+  gdk_pixbuf_copy_area (*pixbuf, 0, 0, source_width, source_height, result, left_offset, top_offset);
+  g_object_unref (*pixbuf);
+
+  *pixbuf = result;
 }
 
 void
-eog_thumbnail_init (void)
+cheese_thumbnail_init (void)
 {
   if (frame == NULL)
   {
diff --git a/src/thumbview/eog-thumbnail.h b/src/thumbview/cheese-thumbnail.h
similarity index 53%
rename from src/thumbview/eog-thumbnail.h
rename to src/thumbview/cheese-thumbnail.h
index 9bfab10..913d05f 100644
--- a/src/thumbview/eog-thumbnail.h
+++ b/src/thumbview/cheese-thumbnail.h
@@ -1,11 +1,12 @@
-/* Eye Of Gnome - Thumbnailing functions
+/*
+ * Copyright © 2010 daniel g. siegel <dgsiegel gnome org>
  *
- * Copyright (C) 2000-2007 The Free Software Foundation
  *
- * Author: Lucas Rocha <lucasr gnome org>
+ * Based on eog and eel code by:
+ *   - Lucas Rocha <lucasr gnome org>
+ *   - Andy Hertzfeld <andy eazel com>
  *
- * Based on nautilus code (libnautilus-private/nautilus-thumbnail.c) by:
- *      - Andy Hertzfeld <andy eazel com>
+ * Licensed under the GNU General Public License Version 2
  *
  * 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
@@ -18,22 +19,20 @@
  * GNU 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.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _EOG_THUMBNAIL_H_
-#define _EOG_THUMBNAIL_H_
+#ifndef _CHEESE_THUMBNAIL_H_
+#define _CHEESE_THUMBNAIL_H_
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 G_BEGIN_DECLS
 
-void eog_thumbnail_init (void);
+void cheese_thumbnail_init (void);
 
-
-void eog_thumbnail_add_frame (GdkPixbuf **thumbnail);
+void cheese_thumbnail_add_frame (GdkPixbuf **pixbuf);
 
 G_END_DECLS
 
-#endif /* _EOG_THUMBNAIL_H_ */
+#endif /* _CHEESE_THUMBNAIL_H_ */



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