Trim trailing white spaces on empty lines.
[geeqie.git] / src / pan-item.c
index 1190091..b4539a7 100644 (file)
@@ -1,6 +1,7 @@
 /*
- * GQview
+ * Geeqie
  * (C) 2006 John Ellis
+ * Copyright (C) 2008 - 2012 The Geeqie Team
  *
  * Author: John Ellis
  *
@@ -10,7 +11,7 @@
  */
 
 
-#include "gqview.h"
+#include "main.h"
 #include "pan-types.h"
 
 
@@ -358,7 +359,7 @@ static PangoLayout *pan_item_text_layout(PanItem *pi, GtkWidget *widget)
                {
                PangoAttrList *pal;
                PangoAttribute *pa;
-               
+
                pal = pango_attr_list_new();
                if (pi->text_attr & PAN_TEXT_ATTR_BOLD)
                        {
@@ -449,6 +450,7 @@ PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y)
        PanItem *pi;
 
        pi = g_new0(PanItem, 1);
+
        pi->type = PAN_ITEM_THUMB;
        pi->fd = fd;
        pi->x = x;
@@ -456,10 +458,6 @@ PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y)
        pi->width = PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2;
        pi->height = PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2;
 
-       pi->pixbuf = NULL;
-
-       pi->queued = FALSE;
-
        pw->list = g_list_prepend(pw->list, pi);
 
        return pi;
@@ -522,8 +520,8 @@ gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRe
                                     &rx, &ry, &rw, &rh))
                        {
                        gdk_pixbuf_composite(pi->pixbuf, pixbuf, rx - x, ry - y, rw, rh,
-                                            (double) tx - x,
-                                            (double) ty - y,
+                                            (gdouble) tx - x,
+                                            (gdouble) ty - y,
                                             1.0, 1.0, GDK_INTERP_NEAREST,
                                             255);
                        }
@@ -662,8 +660,8 @@ gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRe
                if (pi->pixbuf)
                        {
                        gdk_pixbuf_composite(pi->pixbuf, pixbuf, rx - x, ry - y, rw, rh,
-                                            (double) pi->x - x,
-                                            (double) pi->y - y,
+                                            (gdouble) pi->x - x,
+                                            (gdouble) pi->y - y,
                                             1.0, 1.0, GDK_INTERP_NEAREST,
                                             pi->color_a);
                        }
@@ -724,7 +722,7 @@ PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key)
 /* when ignore_case and partial are TRUE, path should be converted to lower case */
 static GList *pan_item_find_by_path_l(GList *list, GList *search_list,
                                      PanItemType type, const gchar *path,
-                                     gint ignore_case, gint partial)
+                                     gboolean ignore_case, gboolean partial)
 {
        GList *work;
 
@@ -736,9 +734,9 @@ static GList *pan_item_find_by_path_l(GList *list, GList *search_list,
                pi = work->data;
                if ((pi->type == type || type == PAN_ITEM_NONE) && pi->fd)
                        {
-                       gint match = FALSE;
+                       gboolean match = FALSE;
 
-                       if (path[0] == '/')
+                       if (path[0] == G_DIR_SEPARATOR)
                                {
                                if (pi->fd->path && strcmp(path, pi->fd->path) == 0) match = TRUE;
                                }
@@ -761,7 +759,7 @@ static GList *pan_item_find_by_path_l(GList *list, GList *search_list,
                                        }
                                else if (ignore_case)
                                        {
-                                       if (strcasecmp(path, pi->fd->name) == 0) match = TRUE;
+                                       if (g_ascii_strcasecmp(path, pi->fd->name) == 0) match = TRUE;
                                        }
                                else
                                        {
@@ -779,12 +777,12 @@ static GList *pan_item_find_by_path_l(GList *list, GList *search_list,
 
 /* when ignore_case and partial are TRUE, path should be converted to lower case */
 GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path,
-                            gint ignore_case, gint partial)
+                            gboolean ignore_case, gboolean partial)
 {
        GList *list = NULL;
 
        if (!path) return NULL;
-       if (partial && path[0] == '/') return NULL;
+       if (partial && path[0] == G_DIR_SEPARATOR) return NULL;
 
        list = pan_item_find_by_path_l(list, pw->list_static, type, path, ignore_case, partial);
        list = pan_item_find_by_path_l(list, pw->list, type, path, ignore_case, partial);
@@ -792,6 +790,14 @@ GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path,
        return g_list_reverse(list);
 }
 
+GList *pan_item_find_by_fd(PanWindow *pw, PanItemType type, FileData *fd,
+                          gboolean ignore_case, gboolean partial)
+{
+       if (!fd) return NULL;
+       return pan_item_find_by_path(pw, type, fd->path, ignore_case, partial);
+}
+
+
 static PanItem *pan_item_find_by_coord_l(GList *list, PanItemType type, gint x, gint y, const gchar *key)
 {
        GList *work;
@@ -840,8 +846,6 @@ PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gc
        ta = g_new0(PanTextAlignment, 1);
 
        ta->pw = pw;
-       ta->column1 = NULL;
-       ta->column2 = NULL;
        ta->x = x;
        ta->y = y;
        ta->key = g_strdup(key);
@@ -959,5 +963,4 @@ void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box)
                y += height;
                }
 }
-
-
+/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */