Trim trailing white spaces.
[geeqie.git] / src / view_file_list.c
index 60742a0..b0bd169 100644 (file)
@@ -136,55 +136,14 @@ static FileData *vflist_find_data_by_coord(ViewFile *vf, gint x, gint y, GtkTree
        return NULL;
 }
 
-#if 0
-static gint vflist_find_sidecar_list_idx(GList *work, FileData *fd)
-{
-       gint i = 0;
-       while (work)
-               {
-               FileData *fd_p = work->data;
-               if (fd == fd_p) return i;
-
-               i++;
-
-               GList *work2 = fd_p->sidecar_files;
-               while (work2)
-                       {
-                       fd_p = work2->data;
-                       if (fd == fd_p) return i;
-
-                       i++;
-                       work2 = work2->next;
-                       }
-               work = work->next;
-               }
-       return -1;
-}
-
-static gint vflist_sidecar_list_count(GList *work)
-{
-       gint i = 0;
-       while (work)
-               {
-               FileData *fd = work->data;
-               i++;
-
-               GList *work2 = fd->sidecar_files;
-               while (work2)
-                       {
-                       i++;
-                       work2 = work2->next;
-                       }
-               work = work->next;
-               }
-       return i;
-}
-#endif
-
 static gboolean vflist_store_clear_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 {
        FileData *fd;
        gtk_tree_model_get(model, iter, FILE_COLUMN_POINTER, &fd, -1);
+
+       /* it seems that gtk_tree_store_clear may call some callbacks
+          that use the column. Set the pointer to NULL to be safe. */
+       gtk_tree_store_set(GTK_TREE_STORE(model), iter, FILE_COLUMN_POINTER, NULL, -1);
        file_data_unref(fd);
        return FALSE;
 }
@@ -219,27 +178,6 @@ static void vflist_move_cursor(ViewFile *vf, GtkTreeIter *iter)
        gtk_tree_path_free(tpath);
 }
 
-#if 0
-static gint vflist_column_idx(ViewFile *vf, gint store_idx)
-{
-       GList *columns, *work;
-       gint i = 0;
-
-       columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vf->listview));
-       work = columns;
-       while (work)
-               {
-               GtkTreeViewColumn *column = work->data;
-               if (store_idx == GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column), "column_store_idx")))
-                       break;
-               work = work->next;
-               i++;
-               }
-
-       g_list_free(columns);
-       return i;
-}
-#endif
 
 /*
  *-----------------------------------------------------------------------------
@@ -253,8 +191,6 @@ static void vflist_dnd_get(GtkWidget *widget, GdkDragContext *context,
 {
        ViewFile *vf = data;
        GList *list = NULL;
-       gchar *uri_text = NULL;
-       gint total;
 
        if (!VFLIST(vf)->click_fd) return;
 
@@ -315,18 +251,12 @@ static void vflist_drag_data_received(GtkWidget *entry_widget, GdkDragContext *c
 
                if (fd) {
                        /* Add keywords to file */
-                       gchar *str = gtk_selection_data_get_text(selection);
+                       gchar *str = (gchar *) gtk_selection_data_get_text(selection);
                        GList *kw_list = string_to_keywords_list(str);
                        
                        metadata_append_list(fd, KEYWORD_KEY, kw_list);
                        string_list_free(kw_list);
                        g_free(str);
-/*
-file notification should handle this automatically
-                       if (vf->layout && vf->layout->bar_info) {
-                               bar_set_fd(vf->layout->bar_info, fd);
-                       }
-*/
                }
        }
 }
@@ -593,9 +523,6 @@ gboolean vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer dat
 
                gtk_tree_model_get_iter(store, &iter, tpath);
                gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
-#if 0
-               gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
-#endif
                gtk_tree_path_free(tpath);
                }
 
@@ -639,12 +566,10 @@ gboolean vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer dat
                return (gtk_tree_selection_count_selected_rows(selection) > 1);
                }
 
-#if 1
        if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_2BUTTON_PRESS)
                {
                if (vf->layout) layout_image_full_screen_start(vf->layout);
                }
-#endif
 
        return FALSE;
 }
@@ -708,7 +633,6 @@ gboolean vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer d
                gtk_tree_selection_unselect_all(selection);
                gtk_tree_selection_select_iter(selection, &iter);
                vflist_move_cursor(vf, &iter);
-//             return TRUE;// FIXME - expand
                }
 
        return FALSE;
@@ -818,13 +742,6 @@ static void vflist_collapse_cb(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTre
  *-----------------------------------------------------------------------------
  */
 
-/*
-static gboolean vflist_dummy_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
-                                       gboolean path_currently_selected, gpointer data)
-{
-       return TRUE;
-}
-*/
 
 static gchar* vflist_get_formatted(ViewFile *vf, const gchar *name, const gchar *sidecars, const gchar *size, const gchar *time, gboolean expanded)
  {
@@ -1243,7 +1160,7 @@ gint vflist_index_by_fd(ViewFile *vf, FileData *fd)
                while (work2)
                        {
                        /* FIXME: return the same index also for sidecars
-                          it is sufficient for next/prev navigation but it should be rewritten 
+                          it is sufficient for next/prev navigation but it should be rewritten
                           without using indexes at all
                        */
                        FileData *sidecar_fd = work2->data;
@@ -1694,11 +1611,7 @@ static void vflist_listview_set_columns(GtkWidget *listview, gboolean thumb, gbo
 
        gtk_tree_view_column_set_fixed_width(column, options->thumbnails.max_width + 4);
 
-#if GTK_CHECK_VERSION(2,18,0)
        list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
-#else
-       list = gtk_tree_view_column_get_cell_renderers(column);
-#endif
        if (!list) return;
        cell = list->data;
        g_list_free(list);
@@ -1923,10 +1836,6 @@ static void vflist_listview_add_column_toggle(ViewFile *vf, gint n, const gchar
 {
        GtkTreeViewColumn *column;
        GtkCellRenderer *renderer;
-       GtkTreeStore *store;
-       gint index;
-
-       store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)));
 
        renderer = gtk_cell_renderer_toggle_new();
        column = gtk_tree_view_column_new_with_attributes(title, renderer, "active", n, NULL);
@@ -1935,7 +1844,7 @@ static void vflist_listview_add_column_toggle(ViewFile *vf, gint n, const gchar
        g_object_set_data(G_OBJECT(column), "column_store_idx", GUINT_TO_POINTER(n));
        g_object_set_data(G_OBJECT(renderer), "column_store_idx", GUINT_TO_POINTER(n));
 
-       index = gtk_tree_view_append_column(GTK_TREE_VIEW(vf->listview), column);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(vf->listview), column);
        gtk_tree_view_column_set_fixed_width(column, 22);
        gtk_tree_view_column_set_visible(column, vf->marks_enabled);
 
@@ -2062,7 +1971,7 @@ void vflist_thumb_set(ViewFile *vf, gboolean enable)
           - no need to re-read the directory
           - force update because the formatted string has changed
        */
-       if (vf->layout) 
+       if (vf->layout)
                {
                vflist_populate_view(vf, TRUE);
                gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vf->listview));
@@ -2087,7 +1996,6 @@ void vflist_marks_set(ViewFile *vf, gboolean enable)
                }
 
        g_list_free(columns);
-       //vf_refresh(vf);
 }
 
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */