[Goodies-commits] r3705 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Sat Dec 15 10:51:39 CET 2007


Author: stephan
Date: 2007-12-15 09:51:39 +0000 (Sat, 15 Dec 2007)
New Revision: 3705

Added:
   ristretto/trunk/src/thumbnail.c
   ristretto/trunk/src/thumbnail.h
   ristretto/trunk/src/thumbnail_bar.c
   ristretto/trunk/src/thumbnail_bar.h
Modified:
   ristretto/trunk/src/Makefile.am
   ristretto/trunk/src/main_window.c
   ristretto/trunk/src/navigator.c
   ristretto/trunk/src/navigator.h
   ristretto/trunk/src/thumbnail_viewer.c
Log:
Add replacement for thumbnail-viewer. It is still a bit broken at the moment.



Modified: ristretto/trunk/src/Makefile.am
===================================================================
--- ristretto/trunk/src/Makefile.am	2007-12-14 14:28:06 UTC (rev 3704)
+++ ristretto/trunk/src/Makefile.am	2007-12-15 09:51:39 UTC (rev 3705)
@@ -5,6 +5,8 @@
     main_window.c main_window.h \
 	navigator.c navigator.h \
 	picture_viewer.c picture_viewer.h \
+	thumbnail.c thumbnail.h \
+	thumbnail_bar.c thumbnail_bar.h \
 	thumbnail_viewer.c thumbnail_viewer.h
 
 ristretto_CFLAGS = \

Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c	2007-12-14 14:28:06 UTC (rev 3704)
+++ ristretto/trunk/src/main_window.c	2007-12-15 09:51:39 UTC (rev 3705)
@@ -25,6 +25,7 @@
 
 #include "navigator.h"
 #include "thumbnail_viewer.h"
+#include "thumbnail_bar.h"
 #include "picture_viewer.h"
 #include "main_window.h"
 
@@ -298,7 +299,7 @@
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
 
     window->priv->navigator = rstto_navigator_new();
-    window->priv->thumbnail_viewer = rstto_thumbnail_viewer_new(window->priv->navigator);
+    window->priv->thumbnail_viewer = rstto_thumbnail_bar_new(window->priv->navigator);
     window->priv->picture_viewer = rstto_picture_viewer_new(window->priv->navigator);
 
     window->priv->manager = gtk_recent_manager_get_default();
@@ -862,7 +863,7 @@
     gtk_container_remove(GTK_CONTAINER(window->priv->containers.paned), window->priv->containers.s_window);
     gtk_widget_destroy(window->priv->containers.paned);
 
-    rstto_thumbnail_viewer_set_orientation(RSTTO_THUMBNAIL_VIEWER(window->priv->thumbnail_viewer), orientation);
+    //rstto_thumbnail_viewer_set_orientation(RSTTO_THUMBNAIL_VIEWER(window->priv->thumbnail_viewer), orientation);
 
     switch (orientation)
     {
@@ -886,6 +887,7 @@
 void
 rstto_main_window_set_show_thumbnail_viewer(RsttoMainWindow *window, gboolean visibility)
 {
+    /*
     window->priv->settings.thumbnail_viewer_visibility = visibility;
     if (visibility == TRUE)
     {
@@ -910,6 +912,7 @@
             GTK_CHECK_MENU_ITEM(window->priv->menus.view.show_thumbnail_viewer.menu_item_thumbnail_viewer_hide),
             TRUE);
     }
+    */
 }
 
 void

Modified: ristretto/trunk/src/navigator.c
===================================================================
--- ristretto/trunk/src/navigator.c	2007-12-14 14:28:06 UTC (rev 3704)
+++ ristretto/trunk/src/navigator.c	2007-12-15 09:51:39 UTC (rev 3705)
@@ -782,7 +782,7 @@
 }
 
 GdkPixbuf *
-rstto_navigator_get_entry_thumb(RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gint size)
+rstto_navigator_entry_get_thumb(RsttoNavigatorEntry *entry, gint size)
 {
     if(entry->thumb)    
     {
@@ -793,13 +793,13 @@
     else
     {
         ThunarVfsInfo *info = rstto_navigator_entry_get_info(entry);
-        gchar *thumbnail = thunar_vfs_thumb_factory_lookup_thumbnail(navigator->factory, info);
+        gchar *thumbnail = thunar_vfs_thumb_factory_lookup_thumbnail(entry->navigator->factory, info);
         if (thumbnail == NULL)
         {
-            GdkPixbuf *pixbuf = thunar_vfs_thumb_factory_generate_thumbnail(navigator->factory, info);
+            GdkPixbuf *pixbuf = thunar_vfs_thumb_factory_generate_thumbnail(entry->navigator->factory, info);
             if (pixbuf != NULL)
             {
-                if (!thunar_vfs_thumb_factory_store_thumbnail(navigator->factory, pixbuf, info, NULL))
+                if (!thunar_vfs_thumb_factory_store_thumbnail(entry->navigator->factory, pixbuf, info, NULL))
                 {
                     g_critical("Storing thumbnail failed");
                 }

Modified: ristretto/trunk/src/navigator.h
===================================================================
--- ristretto/trunk/src/navigator.h	2007-12-14 14:28:06 UTC (rev 3704)
+++ ristretto/trunk/src/navigator.h	2007-12-15 09:51:39 UTC (rev 3705)
@@ -133,7 +133,7 @@
 void
 rstto_navigator_flip_entry(RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gboolean horizontal);
 GdkPixbuf *
-rstto_navigator_get_entry_thumb(RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gint size);
+rstto_navigator_entry_get_thumb(RsttoNavigatorEntry *entry, gint size);
 ExifData *
 rstto_navigator_entry_get_exif_data (RsttoNavigatorEntry *entry);
 

Added: ristretto/trunk/src/thumbnail.c
===================================================================
--- ristretto/trunk/src/thumbnail.c	                        (rev 0)
+++ ristretto/trunk/src/thumbnail.c	2007-12-15 09:51:39 UTC (rev 3705)
@@ -0,0 +1,248 @@
+/*
+ *  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.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkmarshal.h>
+#include <string.h>
+
+#include <thunar-vfs/thunar-vfs.h>
+#include <libexif/exif-data.h>
+
+#include "navigator.h"
+#include "thumbnail.h"
+
+struct _RsttoThumbnailPriv
+{
+    RsttoNavigatorEntry *entry;
+    gboolean             selected;
+};
+
+static GtkWidgetClass *parent_class = NULL;
+
+static void
+rstto_thumbnail_init(RsttoThumbnail *);
+static void
+rstto_thumbnail_class_init(RsttoThumbnailClass *);
+static void
+rstto_thumbnail_destroy(GtkObject *object);
+
+static void
+rstto_thumbnail_size_request(GtkWidget *, GtkRequisition *);
+static void
+rstto_thumbnail_size_allocate(GtkWidget *, GtkAllocation *);
+static gboolean 
+rstto_thumbnail_expose(GtkWidget *, GdkEventExpose *);
+
+static void
+rstto_thumbnail_paint(RsttoThumbnail *thumb);
+
+static void
+cb_rstto_thumbnail_toggled(RsttoThumbnail *thumb, gpointer user_data);
+
+GType
+rstto_thumbnail_get_type ()
+{
+    static GType rstto_thumbnail_type = 0;
+
+    if (!rstto_thumbnail_type)
+    {
+        static const GTypeInfo rstto_thumbnail_info = 
+        {
+            sizeof (RsttoThumbnailClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) rstto_thumbnail_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL,
+            sizeof (RsttoThumbnail),
+            0,
+            (GInstanceInitFunc) rstto_thumbnail_init,
+            NULL
+        };
+
+        rstto_thumbnail_type = g_type_register_static (GTK_TYPE_BUTTON, "RsttoThumbnail", &rstto_thumbnail_info, 0);
+    }
+    return rstto_thumbnail_type;
+}
+
+static void
+rstto_thumbnail_init(RsttoThumbnail *thumb)
+{
+    thumb->priv = g_new0(RsttoThumbnailPriv, 1);
+
+    gtk_widget_set_redraw_on_allocate(GTK_WIDGET(thumb), TRUE);
+    gtk_widget_set_events (GTK_WIDGET(thumb),
+                           GDK_BUTTON_PRESS_MASK);
+}
+
+static void
+rstto_thumbnail_class_init(RsttoThumbnailClass *thumb_class)
+{
+    GtkWidgetClass *widget_class;
+    GtkObjectClass *object_class;
+
+    widget_class = (GtkWidgetClass*)thumb_class;
+    object_class = (GtkObjectClass*)thumb_class;
+
+    parent_class = g_type_class_peek_parent(thumb_class);
+
+    widget_class->expose_event = rstto_thumbnail_expose;
+
+    widget_class->size_request = rstto_thumbnail_size_request;
+    widget_class->size_allocate = rstto_thumbnail_size_allocate;
+
+    object_class->destroy = rstto_thumbnail_destroy;
+}
+
+static void
+rstto_thumbnail_size_request(GtkWidget *widget, GtkRequisition *requisition)
+{
+    requisition->height = 70;
+    requisition->width = 70;
+}
+
+static void
+rstto_thumbnail_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
+{
+    RsttoThumbnail *thumb = RSTTO_THUMBNAIL(widget);
+    gint border_width =  0;
+    widget->allocation = *allocation;
+
+    if (GTK_WIDGET_REALIZED(widget))
+    {
+         g_debug("CA: %d:%d", allocation->x, allocation->y);
+         gdk_window_move_resize (widget->window,
+            allocation->x + border_width,
+            allocation->y + border_width,
+            allocation->width - border_width * 2,
+            allocation->height - border_width * 2);
+    }
+}
+
+static gboolean
+rstto_thumbnail_expose(GtkWidget *widget, GdkEventExpose *event)
+{
+    RsttoThumbnail *thumb = RSTTO_THUMBNAIL(widget);
+
+    if (GTK_WIDGET_REALIZED (widget))
+    {
+        rstto_thumbnail_paint(thumb);
+    }
+
+    return FALSE;
+}
+
+static void
+rstto_thumbnail_destroy(GtkObject *object)
+{
+
+}
+
+static void
+rstto_thumbnail_paint(RsttoThumbnail *thumb)
+{
+    GdkPixmap *pixmap = NULL;
+    GtkWidget *widget = GTK_WIDGET(thumb);
+
+    GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(widget->window));
+    GdkGC *gc_bg_normal = gdk_gc_new(GDK_DRAWABLE(widget->window));
+    GdkGC *gc_bg_selected = gdk_gc_new(GDK_DRAWABLE(widget->window));
+
+    gdk_gc_set_foreground(gc_bg_selected,
+                        &(widget->style->bg[GTK_STATE_SELECTED]));
+    gdk_gc_set_foreground(gc_bg_normal,
+                        &(widget->style->bg[GTK_STATE_NORMAL]));
+
+    if(thumb->priv->entry)
+    {
+        GdkPixbuf *pixbuf = rstto_navigator_entry_get_thumb(
+                                thumb->priv->entry,
+                                widget->allocation.height - 4);
+
+        pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, widget->allocation.height, -1);
+
+        gdk_gc_set_foreground(gc, &widget->style->fg[GTK_STATE_NORMAL]);
+
+        if(thumb->priv->selected == TRUE)
+        {
+            gdk_draw_rectangle(GDK_DRAWABLE(pixmap),
+                            gc_bg_selected,
+                            TRUE,
+                            0, 0, 
+                            widget->allocation.width,
+                            widget->allocation.height);
+        }
+        else
+        {
+            gdk_draw_rectangle(GDK_DRAWABLE(pixmap),
+                            gc_bg_normal,
+                            TRUE,
+                            0, 0, 
+                            widget->allocation.width,
+                            widget->allocation.height);
+        }
+
+        if(pixbuf)
+        {
+            gdk_draw_pixbuf(GDK_DRAWABLE(pixmap),
+                            gc,
+                            pixbuf,
+                            0, 0,
+                            (0.5 * (widget->allocation.width - gdk_pixbuf_get_width(pixbuf))),
+                            (0.5 * (widget->allocation.height - gdk_pixbuf_get_height(pixbuf))),
+                            -1, -1,
+                            GDK_RGB_DITHER_NORMAL,
+                            0, 0);
+        }
+
+        gdk_draw_drawable(GDK_DRAWABLE(widget->window),
+            gc,
+            pixmap,
+            0, 0,
+            0, 0,
+            widget->allocation.width,
+            widget->allocation.height);
+
+    }
+}
+
+GtkWidget *
+rstto_thumbnail_new(RsttoNavigatorEntry *entry)
+{
+    g_return_val_if_fail(entry != NULL, NULL);
+
+    RsttoThumbnail *thumb = g_object_new(RSTTO_TYPE_THUMBNAIL, NULL);
+
+    thumb->priv->entry = entry;
+
+#if GTK_CHECK_VERSION(2,12,0)
+    ThunarVfsInfo *info = rstto_navigator_entry_get_info(thumb->priv->entry);
+    
+    gtk_widget_set_tooltip_text(GTK_WIDGET(thumb), thunar_vfs_path_dup_string(info->path));
+#endif
+
+    return GTK_WIDGET(thumb);
+}
+
+/* CALLBACKS */
+/*************/
+
+static void
+cb_rstto_thumbnail_toggled(RsttoThumbnail *thumb, gpointer user_data)
+{
+
+}

Added: ristretto/trunk/src/thumbnail.h
===================================================================
--- ristretto/trunk/src/thumbnail.h	                        (rev 0)
+++ ristretto/trunk/src/thumbnail.h	2007-12-15 09:51:39 UTC (rev 3705)
@@ -0,0 +1,65 @@
+/*
+ *  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_THUMBNAIL_H__
+#define __RISTRETTO_THUMBNAIL_H__
+
+G_BEGIN_DECLS
+
+#define RSTTO_TYPE_THUMBNAIL rstto_thumbnail_get_type()
+
+#define RSTTO_THUMBNAIL(obj)( \
+        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                RSTTO_TYPE_THUMBNAIL, \
+                RsttoThumbnail))
+
+#define RSTTO_IS_THUMBNAIL(obj)( \
+        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                RSTTO_TYPE_THUMBNAIL))
+
+#define RSTTO_THUMBNAIL_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_CAST ((klass), \
+                RSTTO_TYPE_THUMBNAIL, \
+                RsttoThumbnailClass))
+
+#define RSTTO_IS_THUMBNAIL_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                RSTTO_TYPE_THUMBNAIL()))
+
+typedef struct _RsttoThumbnailPriv RsttoThumbnailPriv;
+
+typedef struct _RsttoThumbnail RsttoThumbnail;
+
+struct _RsttoThumbnail
+{
+    GtkButton         parent;
+    RsttoThumbnailPriv *priv;
+};
+
+typedef struct _RsttoThumbnailClass RsttoThumbnailClass;
+
+struct _RsttoThumbnailClass
+{
+    GtkButtonClass  parent_class;
+};
+
+GType      rstto_thumbnail_get_type();
+
+GtkWidget *rstto_thumbnail_new();
+
+G_END_DECLS
+
+#endif /* __RISTRETTO_THUMBNAIL_H__ */

Added: ristretto/trunk/src/thumbnail_bar.c
===================================================================
--- ristretto/trunk/src/thumbnail_bar.c	                        (rev 0)
+++ ristretto/trunk/src/thumbnail_bar.c	2007-12-15 09:51:39 UTC (rev 3705)
@@ -0,0 +1,333 @@
+/*
+ *  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.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkmarshal.h>
+#include <string.h>
+
+#include <thunar-vfs/thunar-vfs.h>
+#include <libexif/exif-data.h>
+
+#include "navigator.h"
+#include "thumbnail.h"
+#include "thumbnail_bar.h"
+
+struct _RsttoThumbnailBarPriv
+{
+    GtkOrientation  orientation;
+    RsttoNavigator *navigator;
+    gint dimension;
+    gint offset;
+    gboolean auto_center;
+    gint begin;
+    gint end;
+    GSList *thumbs;
+};
+
+static void
+rstto_thumbnail_bar_init(RsttoThumbnailBar *);
+static void
+rstto_thumbnail_bar_class_init(RsttoThumbnailBarClass *);
+static void
+rstto_thumbnail_bar_destroy(GtkObject *object);
+
+static void
+rstto_thumbnail_bar_size_request(GtkWidget *, GtkRequisition *);
+static void
+rstto_thumbnail_bar_size_allocate(GtkWidget *, GtkAllocation *);
+
+static void
+rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child);
+static void
+rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child);
+static void
+rstto_thumbnail_bar_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
+static GType
+rstto_thumbnail_bar_child_type(GtkContainer *container);
+
+static GtkWidgetClass *parent_class = NULL;
+
+static void
+cb_rstto_thumbnail_bar_nav_new_entry (RsttoNavigator *nav,
+                                    gint nr,
+                                    RsttoNavigatorEntry *entry,
+                                    RsttoThumbnailBar *bar);
+static void
+cb_rstto_thumbnail_bar_nav_iter_changed (RsttoNavigator *nav,
+                                       gint nr,
+                                       RsttoNavigatorEntry *entry,
+                                       RsttoThumbnailBar *bar);
+static void
+cb_rstto_thumbnail_bar_nav_reordered (RsttoNavigator *nav,
+                                    RsttoThumbnailBar *bar);
+
+GType
+rstto_thumbnail_bar_get_type ()
+{
+    static GType rstto_thumbnail_bar_type = 0;
+
+    if (!rstto_thumbnail_bar_type)
+    {
+        static const GTypeInfo rstto_thumbnail_bar_info = 
+        {
+            sizeof (RsttoThumbnailBarClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) rstto_thumbnail_bar_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL,
+            sizeof (RsttoThumbnailBar),
+            0,
+            (GInstanceInitFunc) rstto_thumbnail_bar_init,
+            NULL
+        };
+
+        rstto_thumbnail_bar_type = g_type_register_static (GTK_TYPE_CONTAINER, "RsttoThumbnailBar", &rstto_thumbnail_bar_info, 0);
+    }
+    return rstto_thumbnail_bar_type;
+}
+
+
+static void
+rstto_thumbnail_bar_init(RsttoThumbnailBar *bar)
+{
+    bar->priv = g_new0(RsttoThumbnailBarPriv, 1);
+
+    bar->priv->auto_center = TRUE;
+
+	GTK_WIDGET_SET_FLAGS(bar, GTK_NO_WINDOW);
+	gtk_widget_set_redraw_on_allocate(GTK_WIDGET(bar), FALSE);
+    bar->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+
+}
+
+static void
+rstto_thumbnail_bar_class_init(RsttoThumbnailBarClass *bar_class)
+{
+    GtkWidgetClass *widget_class;
+    GtkContainerClass *container_class;
+
+    widget_class = (GtkWidgetClass*)bar_class;
+    container_class = (GtkContainerClass*)bar_class;
+
+    parent_class = g_type_class_peek_parent(bar_class);
+
+    widget_class->size_request = rstto_thumbnail_bar_size_request;
+    widget_class->size_allocate = rstto_thumbnail_bar_size_allocate;
+
+	container_class->add = rstto_thumbnail_bar_add;
+	container_class->remove = rstto_thumbnail_bar_remove;
+	container_class->forall = rstto_thumbnail_bar_forall;
+	container_class->child_type = rstto_thumbnail_bar_child_type;
+
+	gtk_widget_class_install_style_property (widget_class,
+		g_param_spec_int ("spacing",
+		_("Spacing"),
+		_("The amount of space between the thumbnails"),
+		0, G_MAXINT, 3,
+		G_PARAM_READABLE));
+}
+
+static void
+rstto_thumbnail_bar_size_request(GtkWidget *widget, GtkRequisition *requisition)
+{
+    requisition->height = 70;
+    requisition->width = 70;
+}
+
+static void
+rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
+{
+    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
+    gint border_width =  0;
+    widget->allocation = *allocation;
+    GtkAllocation child_allocation;
+    GtkRequisition child_requisition;
+
+    child_allocation.x = allocation->x + border_width;
+    child_allocation.y = allocation->y + border_width;
+    child_allocation.width = 70 - border_width;
+    child_allocation.height = 70 - border_width;
+
+    GSList *iter = bar->priv->thumbs;
+
+    /*
+    if (GTK_WIDGET_REALIZED (widget))
+    {
+        gdk_window_move_resize (widget->window,
+                              allocation->x + border_width,
+                              allocation->y + border_width,
+                              allocation->width - border_width * 2,
+                              allocation->height - border_width * 2);
+    }
+    */
+  
+
+    switch(bar->priv->orientation)
+    {
+        case GTK_ORIENTATION_HORIZONTAL:
+            if(iter)
+            {
+                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
+                gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
+                /*
+                if (child_allocation.x < (allocation->x + allocation->width))
+                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
+                else
+                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
+                    */
+
+                child_allocation.x += child_requisition.width;
+                iter = g_slist_next(iter);
+            }
+            break;
+        case GTK_ORIENTATION_VERTICAL:
+            break;
+    }
+}
+
+GtkWidget *
+rstto_thumbnail_bar_new(RsttoNavigator *navigator)
+{
+    RsttoThumbnailBar *bar;
+
+    bar = g_object_new(RSTTO_TYPE_THUMBNAIL_BAR, NULL);
+
+    bar->priv->navigator = navigator;
+
+    g_signal_connect(G_OBJECT(navigator), "new-entry", G_CALLBACK(cb_rstto_thumbnail_bar_nav_new_entry), bar);
+    g_signal_connect(G_OBJECT(navigator), "iter-changed", G_CALLBACK(cb_rstto_thumbnail_bar_nav_iter_changed), bar);
+    g_signal_connect(G_OBJECT(navigator), "reordered", G_CALLBACK(cb_rstto_thumbnail_bar_nav_reordered), bar);
+
+    return (GtkWidget *)bar;
+}
+
+/*
+ * rstto_thumbnail_bar_set_orientation:
+ *
+ * @bar      : ThumbnailBar
+ * @orientation :
+ *
+ */
+void
+rstto_thumbnail_bar_set_orientation (RsttoThumbnailBar *bar, GtkOrientation orientation)
+{
+    bar->priv->orientation = orientation;
+}
+
+/*
+ * rstto_thumbnail_bar_get_orientation:
+ *
+ * @bar      : ThumbnailBar
+ *
+ * Return value : GtkOrientation
+ *
+ */
+GtkOrientation
+rstto_thumbnail_bar_get_orientation (RsttoThumbnailBar *bar)
+{
+    return bar->priv->orientation;
+}
+
+static void
+rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child)
+{
+	g_return_if_fail(GTK_IS_WIDGET(child));
+    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
+
+	gtk_widget_set_parent(child, GTK_WIDGET(container));
+
+    bar->priv->thumbs = g_slist_append(bar->priv->thumbs, child);
+}
+
+static void
+rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child)
+{
+	g_return_if_fail(GTK_IS_WIDGET(child));
+
+    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
+	gboolean widget_was_visible;
+
+	widget_was_visible = GTK_WIDGET_VISIBLE(child);
+
+    bar->priv->thumbs = g_slist_remove(bar->priv->thumbs, child);
+
+	gtk_widget_unparent(child);
+
+	/* remove from list is somewhere else */
+	if(widget_was_visible)
+		gtk_widget_queue_resize(GTK_WIDGET(container));
+}
+
+static void
+rstto_thumbnail_bar_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data)
+{
+    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
+
+    g_return_if_fail(callback != NULL);
+
+    g_slist_foreach(bar->priv->thumbs, (GFunc)callback, callback_data);
+
+}
+
+static GType
+rstto_thumbnail_bar_child_type(GtkContainer *container)
+{
+    return RSTTO_TYPE_THUMBNAIL;
+}
+
+/*
+ * cb_rstto_thumbnail_bar_nav_new_entry :
+ *
+ * @nav    : RsttoNavigator 
+ * @nr     : nr
+ * @entry  :
+ * @bar :
+ *
+ */
+static void
+cb_rstto_thumbnail_bar_nav_new_entry(RsttoNavigator *nav, gint nr, RsttoNavigatorEntry *entry, RsttoThumbnailBar *bar)
+{
+    GtkWidget *thumb = rstto_thumbnail_new(entry);
+    gtk_container_add(GTK_CONTAINER(bar), thumb);
+}
+
+/*
+ * cb_rstto_thumbnail_bar_nav_iter_changed :
+ *
+ * @nav    : RsttoNavigator 
+ * @nr     : nr
+ * @entry  :
+ * @bar :
+ *
+ */
+static void
+cb_rstto_thumbnail_bar_nav_iter_changed(RsttoNavigator *nav, gint nr, RsttoNavigatorEntry *entry, RsttoThumbnailBar *bar)
+{
+}
+
+/*
+ * cb_rstto_thumbnail_bar_nav_reordered :
+ *
+ * @nav    : RsttoNavigator 
+ * @bar :
+ *
+ */
+static void
+cb_rstto_thumbnail_bar_nav_reordered (RsttoNavigator *nav, RsttoThumbnailBar *bar)
+{
+}

Added: ristretto/trunk/src/thumbnail_bar.h
===================================================================
--- ristretto/trunk/src/thumbnail_bar.h	                        (rev 0)
+++ ristretto/trunk/src/thumbnail_bar.h	2007-12-15 09:51:39 UTC (rev 3705)
@@ -0,0 +1,68 @@
+/*
+ *  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_THUMBNAIL_BAR_H__
+#define __RISTRETTO_THUMBNAIL_BAR_H__
+
+G_BEGIN_DECLS
+
+#define RSTTO_TYPE_THUMBNAIL_BAR rstto_thumbnail_bar_get_type()
+
+#define RSTTO_THUMBNAIL_BAR(obj)( \
+        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                RSTTO_TYPE_THUMBNAIL_BAR, \
+                RsttoThumbnailBar))
+
+#define RSTTO_IS_THUMBNAIL_BAR(obj)( \
+        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                RSTTO_TYPE_THUMBNAIL_BAR))
+
+#define RSTTO_THUMBNAIL_BAR_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_CAST ((klass), \
+                RSTTO_TYPE_THUMBNAIL_BAR, \
+                RsttoThumbnailBarClass))
+
+#define RSTTO_IS_THUMBNAIL_BAR_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                RSTTO_TYPE_THUMBNAIL_BAR()))
+
+typedef struct _RsttoThumbnailBarPriv RsttoThumbnailBarPriv;
+
+typedef struct _RsttoThumbnailBar RsttoThumbnailBar;
+
+struct _RsttoThumbnailBar
+{
+    GtkContainer           parent;
+    RsttoThumbnailBarPriv *priv;
+};
+
+typedef struct _RsttoThumbnailBarClass RsttoThumbnailBarClass;
+
+struct _RsttoThumbnailBarClass
+{
+    GtkContainerClass  parent_class;
+};
+
+GType      rstto_thumbnail_bar_get_type();
+
+GtkWidget *rstto_thumbnail_bar_new();
+
+void       rstto_thumbnail_bar_set_orientation (RsttoThumbnailBar *, GtkOrientation);
+GtkOrientation  rstto_thumbnail_bar_get_orientation (RsttoThumbnailBar *);
+
+G_END_DECLS
+
+#endif /* __RISTRETTO_THUMBNAIL_BAR_H__ */

Modified: ristretto/trunk/src/thumbnail_viewer.c
===================================================================
--- ristretto/trunk/src/thumbnail_viewer.c	2007-12-14 14:28:06 UTC (rev 3704)
+++ ristretto/trunk/src/thumbnail_viewer.c	2007-12-15 09:51:39 UTC (rev 3705)
@@ -496,7 +496,7 @@
     GdkPixmap *pixmap = NULL;
     if (entry)
     {
-        GdkPixbuf *pixbuf = rstto_navigator_get_entry_thumb(viewer->priv->navigator, entry, viewer->priv->dimension - 4);
+        GdkPixbuf *pixbuf = rstto_navigator_entry_get_thumb(entry, viewer->priv->dimension - 4);
         pixmap = gdk_pixmap_new(widget->window, viewer->priv->dimension, viewer->priv->dimension, -1);
 
         if(selected)




More information about the Goodies-commits mailing list