1 /* Copyright (C) 2009 Dennis Cranston
2  *
3  * This file was modified from gedit (gedit-history-entry.h).
4  * Copyright (C) 2006 Paolo Borelli
5  *
6  * This file is part of MATE Utils.
7  *
8  * MATE Utils is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * MATE Utils is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with MATE Utils.  If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __GSEARCH_HISTORY_ENTRY_H__
23 #define __GSEARCH_HISTORY_ENTRY_H__
24 
25 
26 G_BEGIN_DECLS
27 
28 #define GSEARCH_TYPE_HISTORY_ENTRY             (gsearch_history_entry_get_type())
29 #define GSEARCH_HISTORY_ENTRY(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), GSEARCH_TYPE_HISTORY_ENTRY, GsearchHistoryEntry))
30 #define GSEARCH_HISTORY_ENTRY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),  GSEARCH_TYPE_HISTORY_ENTRY, GsearchHistoryEntryClass))
31 #define GSEARCH_IS_HISTORY_ENTRY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), GSEARCH_TYPE_HISTORY_ENTRY))
32 #define GSEARCH_IS_HISTORY_ENTRY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),  GSEARCH_TYPE_HISTORY_ENTRY))
33 #define GSEARCH_HISTORY_ENTRY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),  GSEARCH_TYPE_HISTORY_ENTRY, GsearchHistoryEntryClass))
34 
35 
36 typedef struct _GsearchHistoryEntry        GsearchHistoryEntry;
37 typedef struct _GsearchHistoryEntryClass   GsearchHistoryEntryClass;
38 typedef struct _GsearchHistoryEntryPrivate GsearchHistoryEntryPrivate;
39 
40 struct _GsearchHistoryEntryClass {
41 	GtkComboBoxClass parent_class;
42 };
43 
44 struct _GsearchHistoryEntry {
45 	GtkComboBox parent_instance;
46 	GsearchHistoryEntryPrivate* priv;
47 };
48 
49 GType gsearch_history_entry_get_type(void) G_GNUC_CONST;
50 
51 GtkWidget* gsearch_history_entry_new(const gchar* history_id, gboolean enable_completion);
52 void gsearch_history_entry_prepend_text(GsearchHistoryEntry* entry, const gchar* text);
53 void gsearch_history_entry_append_text(GsearchHistoryEntry* entry, const gchar* text);
54 void gsearch_history_entry_clear(GsearchHistoryEntry* entry);
55 
56 void gsearch_history_entry_set_history_length(GsearchHistoryEntry* entry, guint max_saved);
57 guint gsearch_history_entry_get_history_length(GsearchHistoryEntry* gentry);
58 
59 gchar* gsearch_history_entry_get_history_id(GsearchHistoryEntry* entry);
60 
61 void gsearch_history_entry_set_enable_completion(GsearchHistoryEntry* entry, gboolean enable);
62 gboolean gsearch_history_entry_get_enable_completion(GsearchHistoryEntry* entry);
63 
64 GtkWidget* gsearch_history_entry_get_entry(GsearchHistoryEntry* entry);
65 
66 typedef gchar* (*GsearchHistoryEntryEscapeFunc)(const gchar* str);
67 
68 void gsearch_history_entry_set_escape_func(GsearchHistoryEntry* entry, GsearchHistoryEntryEscapeFunc escape_func);
69 
70 G_END_DECLS
71 
72 #endif /* __GSEARCH_HISTORY_ENTRY_H__ */
73