/*
- * Geeqie
- * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2010 The Geeqie Team
+ * Copyright (C) 2006 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"
{
GdkCursor *cursor = NULL;
- if (!widget || !widget->window) return;
+ if (!widget || !gtk_widget_get_window(widget)) return;
if (cursor_type > -1) cursor = gdk_cursor_new(cursor_type);
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
if (cursor) gdk_cursor_unref(cursor);
gdk_flush();
}
return list;
}
-/*
- *----------------------------------------------------------------------------
- * misc
- *----------------------------------------------------------------------------
- */
-
-#if 0
-static void vdtree_row_deleted_cb(GtkTreeModel *tree_model, GtkTreePath *tpath, gpointer data)
-{
- GtkTreeIter iter;
- NodeData *nd;
-
- gtk_tree_model_get_iter(tree_model, &iter, tpath);
- gtk_tree_model_get(tree_model, &iter, DIR_COLUMN_POINTER, &nd, -1);
-
- if (!nd) return;
-
- file_data_unref(nd->fd);
- g_free(nd);
-}
-#endif
/*
*----------------------------------------------------------------------------
time_t current_time;
GtkTreeIter child;
NodeData *nd;
+ gboolean add_hidden = FALSE;
store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1);
DEBUG_1("Too frequent update of %s", nd->fd->path);
return TRUE;
}
- if (nd->fd->version == nd->version) return TRUE;
+ file_data_check_changed_files(nd->fd); /* make sure we have recent info */
}
- vdtree_busy_push(vd);
-
- filelist_read(nd->fd, NULL, &list);
-
/* when hidden files are not enabled, and the user enters a hidden path,
* allow the tree to display that path by specifically inserting the hidden entries
*/
n = strlen(nd->fd->path);
if (target_fd->path[n] == G_DIR_SEPARATOR && target_fd->path[n+1] == '.')
- {
- gchar *name8;
+ add_hidden = TRUE;
+ }
- n++;
+ if (nd->expanded && (!force && !add_hidden) && nd->fd->version == nd->version)
+ return TRUE;
- while (target_fd->path[n] != '\0' && target_fd->path[n] != G_DIR_SEPARATOR) n++;
- name8 = g_strndup(target_fd->path, n);
+ vdtree_busy_push(vd);
- if (isdir(name8))
- {
- list = g_list_prepend(list, file_data_new_dir(name8));
- }
+ filelist_read(nd->fd, NULL, &list);
+
+ if (add_hidden)
+ {
+ gint n;
+ gchar *name8;
- g_free(name8);
+ n = strlen(nd->fd->path) + 1;
+
+ while (target_fd->path[n] != '\0' && target_fd->path[n] != G_DIR_SEPARATOR) n++;
+ name8 = g_strndup(target_fd->path, n);
+
+ if (isdir(name8))
+ {
+ list = g_list_prepend(list, file_data_new_dir(name8));
}
+
+ g_free(name8);
}
old = NULL;
gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &old_tpath, NULL);
tpath = gtk_tree_model_get_path(store, &iter);
-
+
if (!old_tpath || gtk_tree_path_compare(tpath, old_tpath) != 0)
{
/* setting the cursor scrolls the view; do not do that unless it is necessary */
gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE);
-
+
/* gtk_tree_view_set_cursor scrolls the window itself, but it sometimes
does not work (switch from dir_list to dir_tree) */
tree_view_row_make_visible(GTK_TREE_VIEW(vd->view), &iter, TRUE);
return TRUE;
}
-#if 0
-const gchar *vdtree_get_path(ViewDir *vd)
-{
- return vd->path;
-}
-#endif
-
void vdtree_refresh(ViewDir *vd)
{
vdtree_populate_path(vd, vd->dir_fd, FALSE, TRUE);
switch (event->keyval)
{
- case GDK_Menu:
+ case GDK_KEY_Menu:
vd->click_fd = fd;
vd_color_set(vd, vd->click_fd, TRUE);
return TRUE;
break;
- case GDK_plus:
- case GDK_Right:
- case GDK_KP_Add:
+ case GDK_KEY_plus:
+ case GDK_KEY_Right:
+ case GDK_KEY_KP_Add:
if (fd)
{
vdtree_populate_path_by_iter(vd, &iter, FALSE, vd->dir_fd);