2006-05-21 18:11:05 -05:00
|
|
|
/*
|
2005-10-13 14:08:18 +00:00
|
|
|
* moohistorylist.h
|
|
|
|
*
|
2010-11-07 01:20:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@sourceforge.net>
|
2005-10-13 14:08:18 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* This file is part of medit. medit is free software; you can
|
|
|
|
* redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License,
|
|
|
|
* or (at your option) any later version.
|
2005-10-13 14:08:18 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
2005-10-13 14:08:18 +00:00
|
|
|
*/
|
|
|
|
|
2007-04-12 10:31:28 -05:00
|
|
|
#ifndef MOO_HISTORY_LIST_H
|
|
|
|
#define MOO_HISTORY_LIST_H
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
#include <gtk/gtktreemodel.h>
|
|
|
|
#include <mooutils/moomenumgr.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2010-12-08 01:17:17 -08:00
|
|
|
#define MOO_TYPE_HISTORY_ITEM (moo_history_list_item_get_type ())
|
2005-10-13 14:08:18 +00:00
|
|
|
#define MOO_TYPE_HISTORY_LIST (moo_history_list_get_type ())
|
|
|
|
#define MOO_HISTORY_LIST(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_HISTORY_LIST, MooHistoryList))
|
|
|
|
#define MOO_HISTORY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_HISTORY_LIST, MooHistoryListClass))
|
|
|
|
#define MOO_IS_HISTORY_LIST(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_HISTORY_LIST))
|
|
|
|
#define MOO_IS_HISTORY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_HISTORY_LIST))
|
|
|
|
#define MOO_HISTORY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_HISTORY_LIST, MooHistoryListClass))
|
|
|
|
|
2010-12-08 01:17:17 -08:00
|
|
|
typedef struct _MooHistoryListItem MooHistoryListItem;
|
2005-10-13 14:08:18 +00:00
|
|
|
typedef struct _MooHistoryList MooHistoryList;
|
|
|
|
typedef struct _MooHistoryListPrivate MooHistoryListPrivate;
|
|
|
|
typedef struct _MooHistoryListClass MooHistoryListClass;
|
|
|
|
|
2010-12-08 01:17:17 -08:00
|
|
|
typedef char *(*MooHistoryDisplayFunc) (const char *item,
|
|
|
|
gpointer data);
|
|
|
|
typedef gboolean (*MooHistoryCompareFunc) (const char *text,
|
|
|
|
MooHistoryListItem *item,
|
|
|
|
gpointer data);
|
2005-10-13 14:08:18 +00:00
|
|
|
|
2010-12-08 01:17:17 -08:00
|
|
|
struct _MooHistoryListItem
|
2005-10-13 14:08:18 +00:00
|
|
|
{
|
|
|
|
char *data;
|
|
|
|
char *display;
|
|
|
|
guint builtin : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooHistoryList
|
|
|
|
{
|
|
|
|
GObject parent;
|
|
|
|
|
|
|
|
MooHistoryListPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooHistoryListClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2010-12-08 01:17:17 -08:00
|
|
|
void (*activate_item) (MooHistoryList *list,
|
|
|
|
MooHistoryListItem *item,
|
|
|
|
gpointer menu_data);
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
void (*changed) (MooHistoryList *list);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GType moo_history_list_get_type (void) G_GNUC_CONST;
|
2010-12-08 01:17:17 -08:00
|
|
|
GType moo_history_list_item_get_type (void) G_GNUC_CONST;
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
MooHistoryList *moo_history_list_new (const char *user_id);
|
2007-11-03 12:51:40 -05:00
|
|
|
MooHistoryList *moo_history_list_get (const char *user_id);
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
GtkTreeModel *moo_history_list_get_model (MooHistoryList *list);
|
|
|
|
|
|
|
|
void moo_history_list_add (MooHistoryList *list,
|
|
|
|
const char *item);
|
|
|
|
void moo_history_list_add_filename (MooHistoryList *list,
|
|
|
|
const char *filename);
|
|
|
|
void moo_history_list_add_full (MooHistoryList *list,
|
|
|
|
const char *item,
|
|
|
|
const char *display_item);
|
|
|
|
|
2006-06-04 12:30:45 -05:00
|
|
|
char *moo_history_list_get_last_item (MooHistoryList *list);
|
|
|
|
|
2005-11-02 15:49:35 +00:00
|
|
|
void moo_history_list_remove (MooHistoryList *list,
|
|
|
|
const char *item);
|
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
void moo_history_list_set_display_func (MooHistoryList *list,
|
|
|
|
MooHistoryDisplayFunc func,
|
|
|
|
gpointer data);
|
2006-08-19 12:09:05 -05:00
|
|
|
void moo_history_list_set_tip_func (MooHistoryList *list,
|
|
|
|
MooHistoryDisplayFunc func,
|
|
|
|
gpointer data);
|
2005-10-13 14:08:18 +00:00
|
|
|
void moo_history_list_set_compare_func (MooHistoryList *list,
|
|
|
|
MooHistoryCompareFunc func,
|
|
|
|
gpointer data);
|
|
|
|
char *moo_history_list_display_basename (const char *entry,
|
|
|
|
gpointer data);
|
2006-04-26 18:13:57 -05:00
|
|
|
char *moo_history_list_display_filename (const char *entry,
|
|
|
|
gpointer data);
|
2005-10-13 14:08:18 +00:00
|
|
|
|
2006-11-11 21:45:43 -06:00
|
|
|
/* must free the result */
|
2010-12-08 01:17:17 -08:00
|
|
|
MooHistoryListItem *moo_history_list_get_item (MooHistoryList *list,
|
2006-11-11 21:45:43 -06:00
|
|
|
GtkTreeIter *iter);
|
|
|
|
gboolean moo_history_list_find (MooHistoryList *list,
|
|
|
|
const char *text,
|
|
|
|
GtkTreeIter *iter);
|
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
gboolean moo_history_list_is_empty (MooHistoryList *list);
|
|
|
|
guint moo_history_list_n_user_entries (MooHistoryList *list);
|
|
|
|
guint moo_history_list_get_max_entries (MooHistoryList *list);
|
|
|
|
void moo_history_list_set_max_entries (MooHistoryList *list,
|
|
|
|
guint num);
|
|
|
|
|
2006-08-22 23:24:04 -05:00
|
|
|
void _moo_history_list_load (MooHistoryList *list);
|
2005-11-15 05:56:39 +00:00
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
void moo_history_list_add_builtin (MooHistoryList *list,
|
|
|
|
const char *item,
|
|
|
|
const char *display_item);
|
|
|
|
|
|
|
|
MooMenuMgr *moo_history_list_get_menu_mgr (MooHistoryList *list);
|
|
|
|
|
2010-12-08 01:17:17 -08:00
|
|
|
MooHistoryListItem *moo_history_list_item_new (const char *data,
|
2005-10-13 14:08:18 +00:00
|
|
|
const char *display,
|
|
|
|
gboolean builtin);
|
2010-12-08 01:17:17 -08:00
|
|
|
MooHistoryListItem *moo_history_list_item_copy (const MooHistoryListItem *item);
|
|
|
|
void moo_history_list_item_free (MooHistoryListItem *item);
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2007-04-12 10:31:28 -05:00
|
|
|
#endif /* MOO_HISTORY_LIST_H */
|