/*
- * Geeqie
- * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: John Ellis
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * 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 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "main.h"
FileData *fd;
SortType sort_type = SORT_NAME;
gboolean sort_ascend = TRUE;
+ gchar *link = NULL;
+
+ if (vd->layout)
+ {
+ sort_type = vd->layout->options.dir_view_list_sort.method;
+ sort_ascend = vd->layout->options.dir_view_list_sort.ascend;
+ }
old_list = VDLIST(vd)->list;
ret = filelist_read(vd->dir_fd, NULL, &VDLIST(vd)->list);
VDLIST(vd)->list = filelist_sort(VDLIST(vd)->list, sort_type, sort_ascend);
- /* add . */
+ /* add . and .. */
+
+ if (options->file_filter.show_parent_directory && strcmp(vd->dir_fd->path, G_DIR_SEPARATOR_S) != 0)
+ {
+ filepath = g_build_filename(vd->dir_fd->path, "..", NULL);
+ fd = file_data_new_dir(filepath);
+ VDLIST(vd)->list = g_list_prepend(VDLIST(vd)->list, fd);
+ g_free(filepath);
+ }
if (options->file_filter.show_dot_directory)
{
if (access_file(fd->path, R_OK | X_OK) && fd->name)
{
- if (fd->name[0] == '.' && fd->name[1] == '\0')
+ if (islink(fd->path))
+ {
+ pixbuf = vd->pf->link;
+ }
+ else if (fd->name[0] == '.' && fd->name[1] == '\0')
{
pixbuf = vd->pf->open;
}
match = -1;
}
+ if (islink(fd->path))
+ {
+ link = realpath(fd->path, NULL);
+ }
+ else
+ {
+ link = NULL;
+ }
+
if (match < 0)
{
GtkTreeIter new;
DIR_COLUMN_POINTER, fd,
DIR_COLUMN_ICON, pixbuf,
DIR_COLUMN_NAME, fd->name,
+ DIR_COLUMN_LINK, link,
DIR_COLUMN_DATE, date,
-1);
gtk_list_store_set(store, &iter,
DIR_COLUMN_ICON, pixbuf,
DIR_COLUMN_NAME, fd->name,
+ DIR_COLUMN_LINK, link,
DIR_COLUMN_DATE, date,
-1);
vd->drop_fd = NULL;
filelist_free(old_list);
+ g_free(link);
return ret;
}
ret = vdlist_populate(vd, TRUE);
- if (old_path)
- {
- /* scroll to make last path visible */
- FileData *found = NULL;
- GList *work;
-
- work = VDLIST(vd)->list;
- while (work && !found)
- {
- FileData *fd = work->data;
- if (strcmp(old_path, fd->name) == 0) found = fd;
- work = work->next;
- }
-
- if (found) vdlist_scroll_to_row(vd, found, 0.5);
-
- g_free(old_path);
- return ret;
- }
+ /* scroll to make last path visible */
+ FileData *found = NULL;
+ GList *work;
- if (gtk_widget_get_realized(vd->view))
+ work = VDLIST(vd)->list;
+ while (work && !found)
{
- gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vd->view), 0, 0);
+ FileData *fd = work->data;
+ if (!old_path || strcmp(old_path, fd->name) == 0) found = fd;
+ work = work->next;
}
+ if (found) vdlist_scroll_to_row(vd, found, 0.5);
+
+ if (old_path) g_free(old_path);
+
return ret;
}
}
vd->click_fd = fd;
- vd_color_set(vd, vd->click_fd, TRUE);
+
+ if (options->view_dir_list_single_click_enter)
+ vd_color_set(vd, vd->click_fd, TRUE);
if (bevent->button == MOUSE_BUTTON_RIGHT)
{
vd->popup = vd_pop_menu(vd, vd->click_fd);
gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL,
bevent->button, bevent->time);
+ return TRUE;
}
- return TRUE;
+ return options->view_dir_list_single_click_enter;
}
void vdlist_destroy_cb(GtkWidget *widget, gpointer data)
vd->type = DIRVIEW_LIST;
- store = gtk_list_store_new(5, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
+ store = gtk_list_store_new(6, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING);
vd->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
g_object_unref(store);
gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column);
+ gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(vd->view), DIR_COLUMN_LINK);
+
return vd;
}
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */