[Xfce4-commits] <thunar:master> Add thunar_history_peek_back() and thunar_history_peek_forward().
Jannis Pohlmann
noreply at xfce.org
Mon Oct 4 17:32:03 CEST 2010
Updating branch refs/heads/master
to 70f0ddefdecfdd5eb0389e4802dee70d7ed02f13 (commit)
from 3a01c1e75fd4ee9a73565946b0fc927dc3c383f7 (commit)
commit 70f0ddefdecfdd5eb0389e4802dee70d7ed02f13
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Mon Oct 4 17:24:49 2010 +0200
Add thunar_history_peek_back() and thunar_history_peek_forward().
These functions allow it to lookup the previous or next file from the
history and can later be used to auto-select subdirectories when walking
back and forth through the history.
thunar/thunar-history.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++
thunar/thunar-history.h | 4 ++-
2 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/thunar/thunar-history.c b/thunar/thunar-history.c
index 90a9499..7134657 100644
--- a/thunar/thunar-history.c
+++ b/thunar/thunar-history.c
@@ -565,3 +565,57 @@ thunar_history_set_action_group (ThunarHistory *history,
g_object_notify (G_OBJECT (history), "action-group");
}
+
+
+/**
+ * thunar_file_history_peek_back:
+ * @history : a #ThunarHistory.
+ *
+ * Returns the previous directory in the history.
+ *
+ * The returned #ThunarFile is owned by the #ThunarHistory and must
+ * not be released by the caller.
+ *
+ * Return value: the previous #ThunarFile in the history.
+ **/
+ThunarFile *
+thunar_history_peek_back (ThunarHistory *history)
+{
+ ThunarFile *result = NULL;
+
+ _thunar_return_val_if_fail (THUNAR_IS_HISTORY (history), NULL);
+
+ /* pick the first (conceptually the last) file in the back list, if there are any */
+ if (history->back_list != NULL)
+ result = history->back_list->data;
+
+ return result;
+}
+
+
+
+/**
+ * thunar_file_history_peek_forward:
+ * @history : a #ThunarHistory.
+ *
+ * Returns the next directory in the history. This often but not always
+ * refers to a child of the current directory.
+ *
+ * The returned #ThunarFile is owned by the #ThunarHistory and must
+ * not be released by the caller.
+ *
+ * Return value: the next #ThunarFile in the history.
+ **/
+ThunarFile *
+thunar_history_peek_forward (ThunarHistory *history)
+{
+ ThunarFile *result = NULL;
+
+ _thunar_return_val_if_fail (THUNAR_IS_HISTORY (history), NULL);
+
+ /* pick the first file in the forward list, if there are any */
+ if (history->forward_list != NULL)
+ result = history->forward_list->data;
+
+ return result;
+}
diff --git a/thunar/thunar-history.h b/thunar/thunar-history.h
index 7f68c7e..0b2a130 100644
--- a/thunar/thunar-history.h
+++ b/thunar/thunar-history.h
@@ -20,7 +20,7 @@
#ifndef __THUNAR_HISTORY_H__
#define __THUNAR_HISTORY_H__
-#include <gtk/gtk.h>
+#include <thunar/thunar-file.h>
G_BEGIN_DECLS;
@@ -41,6 +41,8 @@ ThunarHistory *thunar_history_new (void) G_GNUC_MALLOC;
GtkActionGroup *thunar_history_get_action_group (const ThunarHistory *history);
void thunar_history_set_action_group (ThunarHistory *history,
GtkActionGroup *action_group);
+ThunarFile *thunar_history_peek_back (ThunarHistory *history);
+ThunarFile *thunar_history_peek_forward (ThunarHistory *history);
G_END_DECLS;
More information about the Xfce4-commits
mailing list