Remove commented out code.
[geeqie.git] / src / view_dir_list.c
index e0f4ca4..4f34da7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Geeqie
  * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
  *
  * Author: John Ellis
  *
@@ -96,7 +96,7 @@ static void vdlist_scroll_to_row(ViewDir *vd, FileData *fd, gfloat y_align)
 {
        GtkTreeIter iter;
 
-       if (GTK_WIDGET_REALIZED(vd->view) && vd_find_row(vd, fd, &iter))
+       if (gtk_widget_get_realized(vd->view) && vd_find_row(vd, fd, &iter))
                {
                GtkTreeModel *store;
                GtkTreePath *tpath;
@@ -107,7 +107,7 @@ static void vdlist_scroll_to_row(ViewDir *vd, FileData *fd, gfloat y_align)
                gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE);
                gtk_tree_path_free(tpath);
 
-               if (!GTK_WIDGET_HAS_FOCUS(vd->view)) gtk_widget_grab_focus(vd->view);
+               if (!gtk_widget_has_focus(vd->view)) gtk_widget_grab_focus(vd->view);
                }
 }
 
@@ -138,18 +138,20 @@ static gboolean vdlist_populate(ViewDir *vd, gboolean clear)
        GList *old_list;
        gboolean ret;
        FileData *fd;
+       SortType sort_type = SORT_NAME;
+       gboolean sort_ascend = TRUE;
 
        old_list = VDLIST(vd)->list;
 
        ret = filelist_read(vd->dir_fd, NULL, &VDLIST(vd)->list);
-       VDLIST(vd)->list = filelist_sort(VDLIST(vd)->list, SORT_NAME, TRUE);
+       VDLIST(vd)->list = filelist_sort(VDLIST(vd)->list, sort_type, sort_ascend);
 
        /* add . and .. */
 
        if (strcmp(vd->dir_fd->path, G_DIR_SEPARATOR_S) != 0)
                {
                filepath = g_build_filename(vd->dir_fd->path, "..", NULL);
-               fd = file_data_new_simple(filepath);
+               fd = file_data_new_dir(filepath);
                VDLIST(vd)->list = g_list_prepend(VDLIST(vd)->list, fd);
                g_free(filepath);
                }
@@ -157,7 +159,7 @@ static gboolean vdlist_populate(ViewDir *vd, gboolean clear)
        if (options->file_filter.show_dot_directory)
                {
                filepath = g_build_filename(vd->dir_fd->path, ".", NULL);
-               fd = file_data_new_simple(filepath);
+               fd = file_data_new_dir(filepath);
                VDLIST(vd)->list = g_list_prepend(VDLIST(vd)->list, fd);
                g_free(filepath);
        }
@@ -215,7 +217,7 @@ static gboolean vdlist_populate(ViewDir *vd, gboolean clear)
                                        }
                                else
                                        {
-                                       match = filelist_sort_compare_filedata_full(fd, old_fd, SORT_NAME, TRUE);
+                                       match = filelist_sort_compare_filedata_full(fd, old_fd, sort_type, sort_ascend);
 
                                        if (match == 0) g_warning("multiple fd for the same path");
                                        }
@@ -287,7 +289,7 @@ static gboolean vdlist_populate(ViewDir *vd, gboolean clear)
 gboolean vdlist_set_fd(ViewDir *vd, FileData *dir_fd)
 {
        gboolean ret;
-       gchar *old_path = NULL;
+       gchar *old_path = NULL; /* Used to store directory for walking up */
 
        if (!dir_fd) return FALSE;
        if (vd->dir_fd == dir_fd) return TRUE;
@@ -299,7 +301,7 @@ gboolean vdlist_set_fd(ViewDir *vd, FileData *dir_fd)
                base = remove_level_from_path(vd->dir_fd->path);
                if (strcmp(base, dir_fd->path) == 0)
                        {
-                       old_path = g_strdup(vd->dir_fd->name);
+                       old_path = g_strdup(filename_from_path(vd->dir_fd->path));
                        }
                g_free(base);
                }
@@ -329,7 +331,7 @@ gboolean vdlist_set_fd(ViewDir *vd, FileData *dir_fd)
                return ret;
                }
 
-       if (GTK_WIDGET_REALIZED(vd->view))
+       if (gtk_widget_get_realized(vd->view))
                {
                gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vd->view), 0, 0);
                }
@@ -347,7 +349,7 @@ gboolean vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer dat
        ViewDir *vd = data;
        GtkTreePath *tpath;
 
-       if (event->keyval != GDK_Menu) return FALSE;
+       if (event->keyval != GDK_KEY_Menu) return FALSE;
 
        gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &tpath, NULL);
        if (tpath)