1 /* Copyright (C) 2004 Vincent Noel <vnoel@cox.net>
2  * Copyright (C) 2008 Cosimo Cecchi <cosimoc@gnome.org>
3  * Copyright (C) 2012-2021 MATE Developers
4  *
5  * This file is part of MATE Utils.
6  *
7  * MATE Utils is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * MATE Utils is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with MATE Utils.  If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __LOGVIEW_PREFS_H__
22 #define __LOGVIEW_PREFS_H__
23 
24 #include "logview-filter.h"
25 
26 #define LOGVIEW_TYPE_PREFS logview_prefs_get_type()
27 #define LOGVIEW_PREFS(obj) \
28   (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOGVIEW_TYPE_PREFS, LogviewPrefs))
29 #define LOGVIEW_PREFS_CLASS(klass) \
30   (G_TYPE_CHECK_CLASS_CAST ((klass), LOGVIEW_TYPE_PREFS, LogviewPrefsClass))
31 #define LOGVIEW_IS_PREFS(obj) \
32   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOGVIEW_TYPE_PREFS))
33 #define LOGVIEW_IS_PREFS_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_TYPE ((klass), LOGVIEW_TYPE_PREFS))
35 #define LOGVIEW_PREFS_GET_CLASS(obj) \
36   (G_TYPE_INSTANCE_GET_CLASS ((obj), LOGVIEW_TYPE_PREFS, LogviewPrefsClass))
37 
38 typedef struct _LogviewPrefs LogviewPrefs;
39 typedef struct _LogviewPrefsClass LogviewPrefsClass;
40 typedef struct _LogviewPrefsPrivate LogviewPrefsPrivate;
41 
42 struct _LogviewPrefs {
43   GObject parent;
44   LogviewPrefsPrivate *priv;
45 };
46 
47 struct _LogviewPrefsClass {
48   GObjectClass parent_class;
49 
50   /* signals */
51   void (* system_font_changed)  (LogviewPrefs *prefs,
52                                  const char *font_name);
53   void (* have_tearoff_changed) (LogviewPrefs *prefs,
54                                  gboolean have_tearoff);
55   void (* filters_changed)      (LogviewPrefs *prefs);
56 };
57 
58 GType          logview_prefs_get_type (void);
59 
60 /* public methods */
61 
62 LogviewPrefs *  logview_prefs_get (void);
63 void            logview_prefs_store_window_size       (LogviewPrefs *prefs,
64                                                        int width, int height);
65 void            logview_prefs_get_stored_window_size  (LogviewPrefs *prefs,
66                                                        int *width, int *height);
67 char *          logview_prefs_get_monospace_font_name (LogviewPrefs *prefs);
68 gboolean        logview_prefs_get_have_tearoff        (LogviewPrefs *prefs);
69 void            logview_prefs_store_log               (LogviewPrefs *prefs,
70                                                        GFile *file);
71 void            logview_prefs_remove_stored_log       (LogviewPrefs *prefs,
72                                                        GFile *target);
73 gchar **        logview_prefs_get_stored_logfiles     (LogviewPrefs *prefs);
74 void            logview_prefs_store_fontsize          (LogviewPrefs *prefs,
75                                                        int fontsize);
76 int             logview_prefs_get_stored_fontsize     (LogviewPrefs *prefs);
77 void            logview_prefs_store_active_logfile    (LogviewPrefs *prefs,
78                                                        const char *filename);
79 char *          logview_prefs_get_active_logfile      (LogviewPrefs *prefs);
80 
81 GList *         logview_prefs_get_filters             (LogviewPrefs *prefs);
82 void            logview_prefs_remove_filter           (LogviewPrefs *prefs,
83                                                        const gchar* name);
84 void            logview_prefs_add_filter              (LogviewPrefs *prefs,
85                                                        LogviewFilter *filter);
86 LogviewFilter * logview_prefs_get_filter              (LogviewPrefs *prefs,
87                                                        const gchar *name);
88 
89 #endif /* __LOG_PREFS_H__ */
90