[Goodies-commits] r3647 - in ristretto/trunk: . src

Stephan Arts stephan at xfce.org
Tue Nov 27 19:32:54 CET 2007


Author: stephan
Date: 2007-11-27 18:32:54 +0000 (Tue, 27 Nov 2007)
New Revision: 3647

Modified:
   ristretto/trunk/ChangeLog
   ristretto/trunk/src/main_window.c
   ristretto/trunk/src/navigator.c
Log:
Update ChangeLog
Add shortcuts for rotating
Fix thumbnail scaling when thumbnails are first generated (Bug #3693)


Modified: ristretto/trunk/ChangeLog
===================================================================
--- ristretto/trunk/ChangeLog	2007-11-26 22:21:41 UTC (rev 3646)
+++ ristretto/trunk/ChangeLog	2007-11-27 18:32:54 UTC (rev 3647)
@@ -1,4 +1,10 @@
-2007-11-25: 
+xxxx-xx-xx:
+	* src/main_window.c:
+	  - Add keyboard-shortcuts for rotating
+	* src/navigator.c:
+	  - Fix thumbnail-scaling when thumbnail is first generated (Bug #3693)
+
+2007-11-25: Release 0.0.13
 	* src/main.c:
 	  - Fix segfault when running ristretto with unknown cli-options
 	* src/picture-viewer.c:

Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c	2007-11-26 22:21:41 UTC (rev 3646)
+++ ristretto/trunk/src/main_window.c	2007-11-27 18:32:54 UTC (rev 3647)
@@ -456,6 +456,19 @@
     window->priv->menus.view.rotate.menu_item_rotate_cw = gtk_image_menu_item_new_with_mnemonic(_("Rotate _Right"));
     window->priv->menus.view.rotate.menu_item_rotate_ccw = gtk_image_menu_item_new_with_mnemonic(_("Rotate _Left"));
 
+    gtk_widget_add_accelerator(window->priv->menus.view.rotate.menu_item_rotate_cw,
+                               "activate",
+                               accel_group,
+                               GDK_bracketright,
+                               GDK_CONTROL_MASK,
+                               GTK_ACCEL_VISIBLE);
+    gtk_widget_add_accelerator(window->priv->menus.view.rotate.menu_item_rotate_ccw,
+                               "activate",
+                               accel_group,
+                               GDK_bracketleft,
+                               GDK_CONTROL_MASK,
+                               GTK_ACCEL_VISIBLE);
+
     gtk_menu_shell_append(GTK_MENU_SHELL(window->priv->menus.view.rotate.menu),
             window->priv->menus.view.rotate.menu_item_rotate_cw);
     gtk_menu_shell_append(GTK_MENU_SHELL(window->priv->menus.view.rotate.menu),
@@ -1067,6 +1080,12 @@
                 rstto_main_window_set_show_thumbnail_viewer(RSTTO_MAIN_WINDOW(window),
                         !(RSTTO_MAIN_WINDOW(window)->priv->settings.thumbnail_viewer_visibility));
                 break;
+            case GDK_bracketleft:
+                cb_rstto_main_window_rotate_ccw(NULL, RSTTO_MAIN_WINDOW(window));
+                break;
+            case GDK_bracketright:
+                cb_rstto_main_window_rotate_cw(NULL, RSTTO_MAIN_WINDOW(window));
+                break;
         }
     }
     return TRUE;

Modified: ristretto/trunk/src/navigator.c
===================================================================
--- ristretto/trunk/src/navigator.c	2007-11-26 22:21:41 UTC (rev 3646)
+++ ristretto/trunk/src/navigator.c	2007-11-27 18:32:54 UTC (rev 3647)
@@ -801,19 +801,39 @@
             {
                 if (!thunar_vfs_thumb_factory_store_thumbnail(navigator->factory, pixbuf, info, NULL))
                 {
+                    g_critical("Storing thumbnail failed");
                 }
-                entry->thumb = gdk_pixbuf_scale_simple(pixbuf, size, size, GDK_INTERP_BILINEAR);
+
+                gint width = gdk_pixbuf_get_width(pixbuf);
+                gint height = gdk_pixbuf_get_height(pixbuf);
+
+                if (width > height)
+                {
+                    entry->thumb = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, gdk_pixbuf_get_bits_per_sample(pixbuf), size, height*size/width);
+                }
+                else
+                {
+                    entry->thumb = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, gdk_pixbuf_get_bits_per_sample(pixbuf), width*size/height, size);
+                }
+                gdk_pixbuf_scale(pixbuf, entry->thumb,
+                                 0, 0, 
+                                 gdk_pixbuf_get_width(entry->thumb),
+                                 gdk_pixbuf_get_height(entry->thumb),
+                                 0, 0,
+                                 ((gdouble)gdk_pixbuf_get_width(entry->thumb)) / (gdouble)width,
+                                 ((gdouble)gdk_pixbuf_get_height(entry->thumb)) / (gdouble)height,
+                                 GDK_INTERP_BILINEAR);
             }
             else
             {
                 thumbnail = thunar_vfs_path_dup_string(info->path);
-                entry->thumb = gdk_pixbuf_new_from_file_at_size(thumbnail, size, size, NULL);
+                entry->thumb = gdk_pixbuf_new_from_file_at_scale(thumbnail, size, size, TRUE, NULL);
                 g_free(thumbnail);
             }
         }
         else
         {
-            entry->thumb = gdk_pixbuf_new_from_file_at_size(thumbnail, size, size, NULL);
+            entry->thumb = gdk_pixbuf_new_from_file_at_scale(thumbnail, size, size, TRUE, NULL);
             g_free(thumbnail);
         }
     }




More information about the Goodies-commits mailing list