]>
Commit | Line | Data |
---|---|---|
d7796de8 ER |
1 | --- a/src/profile-editor.c |
2 | +++ a/src/profile-editor.c | |
3 | @@ -755,6 +755,29 @@ bool_to_scrollbar_policy (const GValue *value, | |
4 | return g_variant_new_string (g_value_get_boolean (value) ? "always" : "never"); | |
5 | } | |
6 | ||
7 | +static gboolean | |
8 | +maybestring_to_string (GValue *value, | |
9 | + GVariant *variant, | |
10 | + gpointer user_data) | |
11 | +{ | |
12 | + const char *default_value = (const char *) user_data; | |
13 | + gs_free const char *str; | |
14 | + | |
15 | + g_variant_get (variant, "ms", &str); | |
16 | + g_value_set_string (value, str != NULL ? str : default_value); | |
17 | + | |
18 | + return TRUE; | |
19 | +} | |
20 | + | |
21 | +static GVariant * | |
22 | +string_to_maybestring (const GValue *value, | |
23 | + const GVariantType *expected_type, | |
24 | + gpointer user_data) | |
25 | +{ | |
26 | + return g_variant_new_maybe(G_VARIANT_TYPE_STRING, | |
27 | + g_variant_new_string (g_value_get_string (value))); | |
28 | +} | |
29 | + | |
30 | /** | |
31 | * terminal_profile_edit: | |
32 | * @profile: a #GSettings | |
33 | @@ -1060,6 +1083,16 @@ terminal_profile_edit (GSettings *profile, | |
34 | gtk_builder_get_object (builder, | |
35 | "use-theme-colors-checkbutton"), | |
36 | "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); | |
37 | + g_settings_bind_with_mapping (profile, | |
38 | + TERMINAL_PROFILE_WORD_CHAR_EXCEPTIONS_KEY, | |
39 | + gtk_builder_get_object (builder, | |
40 | + "word-char-exceptions-entry"), | |
41 | + "text", | |
42 | + G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, | |
43 | + (GSettingsBindGetMapping) maybestring_to_string, | |
44 | + (GSettingsBindSetMapping) string_to_maybestring, | |
45 | + (gpointer) g_strdup (GNOME_TERMINAL_WORD_CHAR_EXCEPTIONS_DEFAULT), /* work around const-ness issue */ | |
46 | + g_free); | |
47 | g_settings_bind (profile, TERMINAL_PROFILE_AUDIBLE_BELL_KEY, | |
48 | gtk_builder_get_object (builder, "bell-checkbutton"), | |
49 | "active", | |
50 | --- a/src/profile-preferences.ui | |
51 | +++ a/src/profile-preferences.ui | |
52 | @@ -424,6 +424,35 @@ | |
53 | </packing> | |
54 | </child> | |
55 | <child> | |
56 | + <object class="GtkLabel" id="word-char-exceptions-entry-label"> | |
57 | + <property name="visible">True</property> | |
58 | + <property name="can_focus">False</property> | |
59 | + <property name="xalign">0</property> | |
60 | + <property name="label" translatable="yes">_Word characters:</property> | |
61 | + <property name="use_underline">True</property> | |
62 | + <property name="justify">center</property> | |
63 | + <property name="mnemonic_widget">word-char-exceptions-entry</property> | |
64 | + </object> | |
65 | + <packing> | |
66 | + <property name="left_attach">0</property> | |
67 | + <property name="right_attach">1</property> | |
68 | + <property name="top_attach">4</property> | |
69 | + <property name="bottom_attach">5</property> | |
70 | + </packing> | |
71 | + </child> | |
72 | + <child> | |
73 | + <object class="GtkEntry" id="word-char-exceptions-entry"> | |
74 | + <property name="visible">True</property> | |
75 | + <property name="can_focus">True</property> | |
76 | + </object> | |
77 | + <packing> | |
78 | + <property name="left_attach">1</property> | |
79 | + <property name="right_attach">4</property> | |
80 | + <property name="top_attach">4</property> | |
81 | + <property name="bottom_attach">5</property> | |
82 | + </packing> | |
83 | + </child> | |
84 | + <child> | |
85 | <object class="GtkCheckButton" id="bell-checkbutton"> | |
86 | <property name="label" translatable="yes">Terminal _bell</property> | |
87 | <property name="visible">True</property> | |
88 | @@ -434,8 +463,8 @@ | |
89 | <packing> | |
90 | <property name="left_attach">0</property> | |
91 | <property name="right_attach">4</property> | |
92 | - <property name="top_attach">4</property> | |
93 | - <property name="bottom_attach">5</property> | |
94 | + <property name="top_attach">5</property> | |
95 | + <property name="bottom_attach">6</property> | |
96 | </packing> | |
97 | </child> | |
98 | <child> | |
99 | @@ -452,8 +481,8 @@ | |
100 | <packing> | |
101 | <property name="left_attach">0</property> | |
102 | <property name="right_attach">1</property> | |
103 | - <property name="top_attach">5</property> | |
104 | - <property name="bottom_attach">6</property> | |
105 | + <property name="top_attach">6</property> | |
106 | + <property name="bottom_attach">7</property> | |
107 | </packing> | |
108 | </child> | |
109 | <child> | |
110 | @@ -468,8 +497,8 @@ | |
111 | <packing> | |
112 | <property name="left_attach">0</property> | |
113 | <property name="right_attach">1</property> | |
114 | - <property name="top_attach">6</property> | |
115 | - <property name="bottom_attach">7</property> | |
116 | + <property name="top_attach">7</property> | |
117 | + <property name="bottom_attach">8</property> | |
118 | </packing> | |
119 | </child> | |
120 | <child> | |
121 | @@ -484,8 +513,8 @@ | |
122 | <packing> | |
123 | <property name="left_attach">0</property> | |
124 | <property name="right_attach">1</property> | |
125 | - <property name="top_attach">7</property> | |
126 | - <property name="bottom_attach">8</property> | |
127 | + <property name="top_attach">8</property> | |
128 | + <property name="bottom_attach">9</property> | |
129 | </packing> | |
130 | </child> | |
131 | <child> | |
132 | @@ -500,8 +529,8 @@ | |
133 | <packing> | |
134 | <property name="left_attach">0</property> | |
135 | <property name="right_attach">1</property> | |
136 | - <property name="top_attach">8</property> | |
137 | - <property name="bottom_attach">9</property> | |
138 | + <property name="top_attach">9</property> | |
139 | + <property name="bottom_attach">10</property> | |
140 | </packing> | |
141 | </child> | |
142 | <child> | |
143 | @@ -517,8 +546,8 @@ | |
144 | <packing> | |
145 | <property name="left_attach">1</property> | |
146 | <property name="right_attach">4</property> | |
147 | - <property name="top_attach">8</property> | |
148 | - <property name="bottom_attach">9</property> | |
149 | + <property name="top_attach">9</property> | |
150 | + <property name="bottom_attach">10</property> | |
151 | </packing> | |
152 | </child> | |
153 | </object> | |
154 | --- a/src/terminal-app.h | |
155 | +++ a/src/terminal-app.h | |
156 | @@ -33,6 +33,20 @@ G_BEGIN_DECLS | |
157 | ||
158 | #define MONOSPACE_FONT_KEY_NAME "monospace-font-name" | |
159 | ||
160 | +/* Vte allows to set either a string, or NULL. In the latter case (which is | |
161 | + * its default on startup) it uses a built-in set. This is a reasonable | |
162 | + * behavior for all the apps out there that don't wish to bother with this | |
163 | + * setting. However, there's no way to query what that string is (the getter | |
164 | + * API call returns NULL) and we can't safely assume that it won't change over | |
165 | + * time. So for a graphical frontend that wants to expose this option to the | |
166 | + * user, either the UI becomes too complicated and user-unfriendly (with a | |
167 | + * checkbox whether to use the default, which is then not shown), or it | |
168 | + * forgets about vte's default and always set a non-NULL value. Go for the | |
169 | + * latter approach of course, yet copy vte-0.40's default to be our default | |
170 | + * too. | |
171 | + */ | |
172 | +#define GNOME_TERMINAL_WORD_CHAR_EXCEPTIONS_DEFAULT "-#%&+,./=?@\\_~\302\267" | |
173 | + | |
174 | /* TerminalApp */ | |
175 | ||
176 | #define TERMINAL_TYPE_APP (terminal_app_get_type ()) | |
177 | --- a/src/terminal-screen.c | |
178 | +++ a/src/terminal-screen.c | |
179 | @@ -801,6 +801,8 @@ terminal_screen_profile_changed_cb (GSettings *profile, | |
180 | { | |
181 | gs_free char *word_char_exceptions; | |
182 | g_settings_get (profile, TERMINAL_PROFILE_WORD_CHAR_EXCEPTIONS_KEY, "ms", &word_char_exceptions); | |
183 | + if (word_char_exceptions == NULL) | |
184 | + word_char_exceptions = g_strdup (GNOME_TERMINAL_WORD_CHAR_EXCEPTIONS_DEFAULT); | |
185 | vte_terminal_set_word_char_exceptions (vte_terminal, word_char_exceptions); | |
186 | } | |
187 |