1 /*
2  * Copyright © 2001, 2002 Havoc Pennington
3  * Copyright © 2002 Red Hat, Inc.
4  * Copyright © 2002 Sun Microsystems
5  * Copyright © 2003 Mariano Suarez-Alvarez
6  * Copyright © 2008 Christian Persch
7  * Copyright (C) 2012-2021 MATE Developers
8  *
9  * Mate-terminal is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * Mate-terminal 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
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef TERMINAL_OPTIONS_H
24 #define TERMINAL_OPTIONS_H
25 
26 #include <glib.h>
27 
28 G_BEGIN_DECLS
29 
30 typedef struct
31 {
32 	gboolean remote_arguments;
33 	char   **env;
34 	char    *startup_id;
35 	char    *display_name;
36 	GList   *initial_windows;
37 	gboolean default_window_menubar_forced;
38 	gboolean default_window_menubar_state;
39 	gboolean default_fullscreen;
40 	gboolean default_maximize;
41 	char    *default_role;
42 	char    *default_geometry;
43 	char    *default_working_dir;
44 	char    *default_title;
45 	char   **exec_argv;
46 	char    *default_profile;
47 	gboolean default_profile_is_id;
48 
49 	gboolean  execute;
50 	gboolean  use_factory;
51 	double    zoom;
52 
53 	char    *config_file;
54 	gboolean load_config;
55 	gboolean save_config;
56 	int      initial_workspace;
57 } TerminalOptions;
58 
59 typedef struct
60 {
61 	char *profile;
62 	gboolean profile_is_id;
63 	char **exec_argv;
64 	char *title;
65 	char *working_dir;
66 	double zoom;
67 	guint zoom_set : 1;
68 	guint active : 1;
69 	guint attach_window : 1;
70 } InitialTab;
71 
72 typedef struct
73 {
74 	guint source_tag;
75 
76 	GList *tabs; /* list of InitialTab */
77 
78 	gboolean force_menubar_state;
79 	gboolean menubar_state;
80 
81 	gboolean start_fullscreen;
82 	gboolean start_maximized;
83 
84 	char *geometry;
85 	char *role;
86 
87 } InitialWindow;
88 
89 #define TERMINAL_OPTION_ERROR (g_quark_from_static_string ("terminal-option-error"))
90 
91 typedef enum
92 {
93     TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
94     TERMINAL_OPTION_ERROR_EXCLUSIVE_OPTIONS,
95     TERMINAL_OPTION_ERROR_INVALID_CONFIG_FILE,
96     TERMINAL_OPTION_ERROR_INCOMPATIBLE_CONFIG_FILE
97 } TerminalOptionError;
98 
99 TerminalOptions *terminal_options_parse (const char *working_directory,
100         const char *display_name,
101         const char *startup_id,
102         char **env,
103         gboolean remote_arguments,
104         gboolean ignore_unknown_options,
105         int *argcp,
106         char ***argvp,
107         GError **error,
108         ...) G_GNUC_NULL_TERMINATED;
109 
110 gboolean terminal_options_merge_config (TerminalOptions *options,
111                                         GKeyFile *key_file,
112                                         guint source_tag,
113                                         GError **error);
114 
115 void terminal_options_ensure_window (TerminalOptions *options);
116 
117 void terminal_options_free (TerminalOptions *options);
118 
119 G_END_DECLS
120 
121 #endif /* !TERMINAL_OPTIONS_H */
122