1 /* 2 * fm-nav-history.h 3 * 4 * Copyright 2009 PCMan <pcman.tw@gmail.com> 5 * Copyright 2012 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua> 6 * 7 * This file is a part of the Libfm library. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 */ 23 24 25 #ifndef __FM_NAV_HISTORY_H__ 26 #define __FM_NAV_HISTORY_H__ 27 28 #include <glib-object.h> 29 #include "fm-path.h" 30 31 G_BEGIN_DECLS 32 33 /* FIXME: Do we really need GObject for such a simple data structure? */ 34 35 #define FM_NAV_HISTORY_TYPE (fm_nav_history_get_type()) 36 #define FM_NAV_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ 37 FM_NAV_HISTORY_TYPE, FmNavHistory)) 38 #define FM_NAV_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\ 39 FM_NAV_HISTORY_TYPE, FmNavHistoryClass)) 40 #define FM_IS_NAV_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\ 41 FM_NAV_HISTORY_TYPE)) 42 #define FM_IS_NAV_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\ 43 FM_NAV_HISTORY_TYPE)) 44 45 typedef struct _FmNavHistory FmNavHistory; 46 typedef struct _FmNavHistoryItem FmNavHistoryItem; 47 typedef struct _FmNavHistoryClass FmNavHistoryClass; 48 49 /** 50 * FmNavHistoryItem 51 * @path: active path to folder 52 * @scroll_pos: how much folder was scrolled in view 53 */ 54 struct _FmNavHistoryItem 55 { 56 FmPath* path; 57 int scroll_pos; 58 /*< private >*/ 59 int _reserved1; 60 gpointer _reserved2; 61 }; 62 63 GType fm_nav_history_get_type (void); 64 FmNavHistory* fm_nav_history_new (void); 65 66 #define FM_NAV_HISTORY_DEFAULT_SIZE 10 67 68 #ifndef FM_DISABLE_DEPRECATED 69 /* The returned GList belongs to FmNavHistory and shouldn't be freed. */ 70 const GList* fm_nav_history_list(FmNavHistory* nh); 71 const FmNavHistoryItem* fm_nav_history_get_cur(FmNavHistory* nh); 72 const GList* fm_nav_history_get_cur_link(FmNavHistory* nh); 73 void fm_nav_history_back(FmNavHistory* nh, int old_scroll_pos); 74 gboolean fm_nav_history_can_forward(FmNavHistory* nh); 75 void fm_nav_history_forward(FmNavHistory* nh, int old_scroll_pos); 76 void fm_nav_history_jump(FmNavHistory* nh, GList* l, int old_scroll_pos); 77 #endif 78 guint fm_nav_history_get_cur_index(FmNavHistory* nh); 79 FmPath* fm_nav_history_get_nth_path(FmNavHistory* nh, guint n); 80 FmPath* fm_nav_history_go_to(FmNavHistory* nh, guint n, gint old_scroll_pos); 81 gint fm_nav_history_get_scroll_pos(FmNavHistory* nh); 82 gboolean fm_nav_history_can_back(FmNavHistory* nh); 83 void fm_nav_history_chdir(FmNavHistory* nh, FmPath* path, gint old_scroll_pos); 84 void fm_nav_history_clear(FmNavHistory* nh); 85 void fm_nav_history_set_max(FmNavHistory* nh, guint num); 86 87 G_END_DECLS 88 89 #endif /* __FM_NAV_HISTORY_H__ */ 90