summaryrefslogtreecommitdiff
path: root/src/terminal-app.h
blob: d6a070e8a8f4c85951ff5cdeadabe487888ed11d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
 * Copyright © 2001 Havoc Pennington
 * Copyright © 2008 Christian Persch
 * Copyright (C) 2012-2021 MATE Developers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef TERMINAL_APP_H
#define TERMINAL_APP_H

#include <gtk/gtk.h>

#include "terminal-encoding.h"
#include "terminal-screen.h"
#include "terminal-options.h"

G_BEGIN_DECLS

/* Terminal conf files */

#define TERMINAL_CONFIG_VERSION             (1) /* Bump this for any changes */
#define TERMINAL_CONFIG_COMPAT_VERSION      (1) /* Bump this for incompatible changes */

#define TERMINAL_CONFIG_GROUP               "MATE Terminal Configuration"
#define TERMINAL_CONFIG_PROP_VERSION        "Version"
#define TERMINAL_CONFIG_PROP_COMPAT_VERSION "CompatVersion"
#define TERMINAL_CONFIG_PROP_WINDOWS        "Windows"

#define TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB       "ActiveTerminal"
#define TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN       "Fullscreen"
#define TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY         "Geometry"
#define TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED        "Maximized"
#define TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE  "MenubarVisible"
#define TERMINAL_CONFIG_WINDOW_PROP_ROLE             "Role"
#define TERMINAL_CONFIG_WINDOW_PROP_TABS             "Terminals"

#define TERMINAL_CONFIG_TERMINAL_PROP_HEIGHT             "Height"
#define TERMINAL_CONFIG_TERMINAL_PROP_COMMAND            "Command"
#define TERMINAL_CONFIG_TERMINAL_PROP_PROFILE_ID         "ProfileID"
#define TERMINAL_CONFIG_TERMINAL_PROP_TITLE              "Title"
#define TERMINAL_CONFIG_TERMINAL_PROP_WIDTH              "Width"
#define TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY  "WorkingDirectory"
#define TERMINAL_CONFIG_TERMINAL_PROP_ZOOM               "Zoom"

/* Configuration */

#define CONF_PREFIX           "org.mate.terminal"
#define CONF_GLOBAL_SCHEMA    CONF_PREFIX ".global"
#define CONF_PROFILES_SCHEMA  CONF_PREFIX ".profiles"
#define CONF_PROFILE_SCHEMA   CONF_PREFIX ".profile"
#define CONF_KEYS_SCHEMA      CONF_PREFIX ".keybindings"
#define CONF_PROFILE_PREFIX   "/org/mate/terminal/profiles/"

#define MATE_TERMINAL_ICON_NAME "utilities-terminal"

#define TERMINAL_APP_DEFAULT_PROFILE        "default-profile"
#define TERMINAL_APP_ENABLE_MENU_BAR_ACCEL  "enable-menu-accels"
#define TERMINAL_APP_ENABLE_MNEMONICS       "enable-mnemonics"
#define TERMINAL_APP_SYSTEM_FONT            "system-font"

/* TerminalApp */

#define TERMINAL_TYPE_APP              (terminal_app_get_type ())
#define TERMINAL_APP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), TERMINAL_TYPE_APP, TerminalApp))
#define TERMINAL_APP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_APP, TerminalAppClass))
#define TERMINAL_IS_APP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), TERMINAL_TYPE_APP))
#define TERMINAL_IS_APP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_APP))
#define TERMINAL_APP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_APP, TerminalAppClass))

typedef struct _TerminalAppClass TerminalAppClass;
typedef struct _TerminalApp TerminalApp;

extern GSettings *settings_global;

GType terminal_app_get_type (void);

TerminalApp* terminal_app_get (void);

void terminal_app_shutdown (void);

gboolean terminal_app_handle_options (TerminalApp *app,
                                      TerminalOptions *options,
                                      gboolean allow_resume,
                                      GError **error);

void terminal_app_edit_profile (TerminalApp     *app,
                                TerminalProfile *profile,
                                GtkWindow       *transient_parent,
                                const char      *widget_name);

void terminal_app_new_profile (TerminalApp     *app,
                               TerminalProfile *default_base_profile,
                               GtkWindow       *transient_parent);

TerminalWindow * terminal_app_new_window   (TerminalApp *app,
        GdkScreen *screen);

TerminalScreen *terminal_app_new_terminal (TerminalApp     *app,
        TerminalWindow  *window,
        TerminalProfile *profile,
        char           **override_command,
        const char      *title,
        const char      *working_dir,
        char           **child_env,
        double           zoom);

TerminalWindow *terminal_app_get_current_window (TerminalApp *app,
                                                 GdkScreen *screen,
                                                 int curr_workspace);

void terminal_app_manage_profiles (TerminalApp     *app,
                                   GtkWindow       *transient_parent);

void terminal_app_edit_keybindings (TerminalApp     *app,
                                    GtkWindow       *transient_parent);
void terminal_app_edit_encodings   (TerminalApp     *app,
                                    GtkWindow       *transient_parent);


GList* terminal_app_get_profile_list (TerminalApp *app);

TerminalProfile* terminal_app_ensure_profile_fallback (TerminalApp *app);

TerminalProfile* terminal_app_get_profile_by_name         (TerminalApp *app,
        const char      *name);

TerminalProfile* terminal_app_get_profile_by_visible_name (TerminalApp *app,
        const char      *name);

/* may return NULL */
TerminalProfile* terminal_app_get_default_profile (TerminalApp *app);

/* never returns NULL if any profiles exist, one is always supposed to */
TerminalProfile* terminal_app_get_profile_for_new_term (TerminalApp *app);

TerminalEncoding *terminal_app_ensure_encoding (TerminalApp *app,
        const char *charset);

GHashTable *terminal_app_get_encodings (TerminalApp *app);

GSList* terminal_app_get_active_encodings (TerminalApp *app);

void terminal_app_save_config (TerminalApp *app,
                               GKeyFile *key_file);

gboolean terminal_app_save_config_file (TerminalApp *app,
                                        const char *file_name,
                                        GError **error);

G_END_DECLS

#endif /* !TERMINAL_APP_H */