[Xfce4-commits] <ristretto:ristretto-0.0> Expose the image_compare func and use it for the thumbnailbar

Stephan Arts noreply at xfce.org
Sun Oct 23 19:16:08 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to 385afa8b8407183b319c26c416cf7b329d5b0f06 (commit)
       from c6b2411bd4c96a227b8b46b80012e98639a417a1 (commit)

commit 385afa8b8407183b319c26c416cf7b329d5b0f06
Author: Stephan Arts <stephan at xfce.org>
Date:   Mon Jun 1 00:19:29 2009 +0200

    Expose the image_compare func and use it for the thumbnailbar

 ChangeLog           |   10 ++++++++++
 src/image_list.c    |    6 ++++++
 src/image_list.h    |    2 ++
 src/thumbnail_bar.c |   12 ++++++++----
 4 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 73b41ea..96691e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-06-01  Stephan Arts <stephan at xfce.org>
+
+	* src/image_list.h
+	  src/image_list.c
+	  src/thumbnail_bar.c: Expose compare_func, and use it in the thumbnailbar
+
+2009-06-01  Stephan Arts <stephan at xfce.org>
+
+	* src/*: Rename Navigator to ImageList, makes more sense
+
 2009-05-26  Stephan Arts <stephan at xfce.org>
 
 	* src/picture_viewer.c: Show an 'inactive' image when there is no
diff --git a/src/image_list.c b/src/image_list.c
index 7703a46..94d2842 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -454,3 +454,9 @@ rstto_image_list_iter_clone (RsttoImageListIter *iter)
 
     return new_iter;
 }
+
+GCompareFunc
+rstto_image_list_get_compare_func (RsttoImageList *image_list)
+{
+    return cb_rstto_image_list_image_name_compare_func;
+}
diff --git a/src/image_list.h b/src/image_list.h
index dfd750b..cef78d3 100644
--- a/src/image_list.h
+++ b/src/image_list.h
@@ -113,6 +113,8 @@ void        rstto_image_list_remove_image (RsttoImageList *image_list, RsttoImag
 gboolean    rstto_image_list_iter_find_image (RsttoImageListIter *iter, RsttoImage *image);
 RsttoImageListIter *rstto_image_list_iter_clone (RsttoImageListIter *iter);
 
+GCompareFunc rstto_image_list_get_compare_func (RsttoImageList *image_list);
+
 
 G_END_DECLS
 
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index 1533497..37352d7 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -105,7 +105,7 @@ static void
 cb_rstto_thumbnail_bar_thumbnail_clicked (GtkWidget *thumb, RsttoThumbnailBar *bar);
 
 static gint
-cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b);
+cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer);
 
 GType
 rstto_thumbnail_bar_get_type ()
@@ -546,7 +546,7 @@ rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child)
 
 	gtk_widget_set_parent(child, GTK_WIDGET(container));
 
-    bar->priv->thumbs = g_list_insert_sorted (bar->priv->thumbs, child, (GCompareFunc)cb_rstto_thumbnail_bar_compare);
+    bar->priv->thumbs = g_list_insert_sorted_with_data (bar->priv->thumbs, child, (GCompareDataFunc)cb_rstto_thumbnail_bar_compare, bar);
 }
 
 static void
@@ -586,9 +586,13 @@ rstto_thumbnail_bar_child_type(GtkContainer *container)
 }
 
 static gint
-cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b)
+cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer user_data)
 {
-    return -1;
+    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
+    RsttoImage *a_i = rstto_thumbnail_get_image (a);
+    RsttoImage *b_i = rstto_thumbnail_get_image (b);
+
+    return rstto_image_list_get_compare_func (bar->priv->image_list) (a_i, b_i);
 }
 
 static gboolean


More information about the Xfce4-commits mailing list