1 /* logview-log.h - object representation of a logfile
3 * Copyright (C) 1998 Cesar Miquel <miquel@df.uba.ar>
4 * Copyright (C) 2008 Cosimo Cecchi <cosimoc@gnome.org>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #ifndef __LOGVIEW_LOG_H__
25 #define __LOGVIEW_LOG_H__
27 #include <glib-object.h>
32 #define LOGVIEW_TYPE_LOG logview_log_get_type()
33 #define LOGVIEW_LOG(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOGVIEW_TYPE_LOG, LogviewLog))
35 #define LOGVIEW_LOG_CLASS(klass) \
36 (G_TYPE_CHECK_CLASS_CAST ((klass), LOGVIEW_TYPE_LOG, LogviewLogClass))
37 #define LOGVIEW_IS_LOG(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOGVIEW_TYPE_LOG))
39 #define LOGVIEW_IS_LOG_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_TYPE ((klass), LOGVIEW_TYPE_LOG))
41 #define LOGVIEW_LOG_GET_CLASS(obj) \
42 (G_TYPE_INSTANCE_GET_CLASS ((obj), LOGVIEW_TYPE_LOG, LogviewLogClass))
44 typedef struct _LogviewLog LogviewLog
;
45 typedef struct _LogviewLogClass LogviewLogClass
;
46 typedef struct _LogviewLogPrivate LogviewLogPrivate
;
48 /* callback signatures for async I/O operations */
50 typedef void (* LogviewCreateCallback
) (LogviewLog
*log
,
53 typedef void (* LogviewNewLinesCallback
) (LogviewLog
*log
,
59 #define LOGVIEW_ERROR_QUARK g_quark_from_static_string ("logview-error")
63 LOGVIEW_ERROR_PERMISSION_DENIED
,
65 LOGVIEW_ERROR_NOT_SUPPORTED
,
66 LOGVIEW_ERROR_NOT_A_LOG
71 LogviewLogPrivate
*priv
;
74 struct _LogviewLogClass
{
75 GObjectClass parent_class
;
78 void (* log_changed
) (LogviewLog
*log
);
81 GType
logview_log_get_type (void);
85 /* these two do I/O, so they are wrapped async */
86 void logview_log_create (const char *filename
,
87 LogviewCreateCallback callback
,
89 void logview_log_create_from_gfile (GFile
*file
,
90 LogviewCreateCallback callback
,
92 void logview_log_read_new_lines (LogviewLog
*log
,
93 LogviewNewLinesCallback callback
,
96 const char * logview_log_get_display_name (LogviewLog
*log
);
97 time_t logview_log_get_timestamp (LogviewLog
*log
);
98 goffset
logview_log_get_file_size (LogviewLog
*log
);
99 const char ** logview_log_get_cached_lines (LogviewLog
*log
);
100 guint
logview_log_get_cached_lines_number (LogviewLog
*log
);
101 GSList
* logview_log_get_days_for_cached_lines (LogviewLog
*log
);
102 gboolean
logview_log_has_new_lines (LogviewLog
*log
);
103 char * logview_log_get_uri (LogviewLog
*log
);
104 GFile
* logview_log_get_gfile (LogviewLog
*log
);
105 gboolean
logview_log_get_has_days (LogviewLog
*log
);
109 #endif /* __LOGVIEW_LOG_H__ */