~ubuntu-branches/ubuntu/quantal/gnome-terminal/quantal-proposed

« back to all changes in this revision

Viewing changes to debian/patches/02_add_transparency_properties.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-23 21:41:22 UTC
  • Revision ID: james.westby@ubuntu.com-20100323214122-33ybqw824ud7c5j3
Tags: 2.29.6-0ubuntu5
* Revert the previous changes to add a new profile, as changing
  the default profile on upgrade is suboptimal, and there are better
  ways to implement the visual changes
  - Removed patches:
    + 02_rename_default_profile.patch
    + 03_add_new_profiles_on_upgrade.patch
    + 04_change_fallback_profile.patch
  - Delete debian/gnome-terminal-ambiance.schemas
  - Delete ebian/gnome-termina-data.gconf-defaults
  - debian/rules:
    + Don't install custom schema
* Add debian/patches/02_add_transparency_properties.patch:
  - This patch allows the background transparency to be controlled from
    the GTK theme (using "TerminalScreen::background-darkness"). In
    addition to this, the background colour and text colour are already
    themable from the GTK theme (by setting the "text[NORMAL]" and
    "base[NORMAL]" colours for the TerminalScreen class)
* debian/gnome-terminal-data.postinst:
  - Fix up the system gconf defaults when upgrading from a previous 
    unstable version which had the extra profile. Users upgrading from
    this will probably still need to remove the "Ambiance" profile
    manually from their configuration though (there's not an easy way
    to do this automatically, and it only affects users upgrading
    from previous unstable versions)
* This fixes LP: #532511 and LP: #542144

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Nur -x '*.orig' -x '*~' gnome-terminal-2.29.6/src/gnome-terminal.schemas.in gnome-terminal-2.29.6.new/src/gnome-terminal.schemas.in
 
2
--- gnome-terminal-2.29.6/src/gnome-terminal.schemas.in 2010-01-14 01:00:12.000000000 +0000
 
3
+++ gnome-terminal-2.29.6.new/src/gnome-terminal.schemas.in     2010-03-25 17:38:30.149950030 +0000
 
4
@@ -672,6 +672,21 @@
 
5
     </schema>
 
6
 
 
7
     <schema>
 
8
+      <key>/schemas/apps/gnome-terminal/profiles/Default/use_theme_background</key>
 
9
+      <applyto>/apps/gnome-terminal/profiles/Default/use_theme_background</applyto>
 
10
+      <owner>gnome-terminal</owner>
 
11
+      <type>bool</type>
 
12
+      <default>true</default>
 
13
+      <locale name="C">
 
14
+         <short>Whether to use the transparency setting from the theme for the terminal widget</short>
 
15
+         <long>
 
16
+        If true, the transparency setting defined in the theme will be used for defining the 
 
17
+        background type of the terminal, instead of the settings provided by the user.
 
18
+         </long>
 
19
+      </locale>
 
20
+    </schema>
 
21
+
 
22
+    <schema>
 
23
       <key>/schemas/apps/gnome-terminal/profiles/Default/use_system_font</key>
 
24
       <applyto>/apps/gnome-terminal/profiles/Default/use_system_font</applyto>
 
25
       <owner>gnome-terminal</owner>
 
26
diff -Nur -x '*.orig' -x '*~' gnome-terminal-2.29.6/src/terminal-profile.c gnome-terminal-2.29.6.new/src/terminal-profile.c
 
27
--- gnome-terminal-2.29.6/src/terminal-profile.c        2009-12-15 06:50:36.000000000 +0000
 
28
+++ gnome-terminal-2.29.6.new/src/terminal-profile.c    2010-03-25 17:38:30.149950030 +0000
 
29
@@ -83,6 +83,7 @@
 
30
   PROP_USE_SKEY,
 
31
   PROP_USE_SYSTEM_FONT,
 
32
   PROP_USE_THEME_COLORS,
 
33
+  PROP_USE_THEME_BACKGROUND,
 
34
   PROP_VISIBLE_NAME,
 
35
   PROP_WORD_CHARS,
 
36
   LAST_PROP
 
37
@@ -122,6 +123,7 @@
 
38
 #define KEY_USE_SKEY "use_skey"
 
39
 #define KEY_USE_SYSTEM_FONT "use_system_font"
 
40
 #define KEY_USE_THEME_COLORS "use_theme_colors"
 
41
+#define KEY_USE_THEME_BACKGROUND "use_theme_background"
 
42
 #define KEY_VISIBLE_NAME "visible_name"
 
43
 #define KEY_WORD_CHARS "word_chars"
 
44
 
 
45
@@ -161,6 +163,7 @@
 
46
 #define DEFAULT_USE_SKEY              (TRUE)
 
47
 #define DEFAULT_USE_SYSTEM_FONT       (TRUE)
 
48
 #define DEFAULT_USE_THEME_COLORS      (TRUE)
 
49
+#define DEFAULT_USE_THEME_BACKGROUND  (TRUE)
 
50
 #define DEFAULT_VISIBLE_NAME          (N_("Unnamed"))
 
51
 #define DEFAULT_WORD_CHARS            ("-A-Za-z0-9,./?%&#:_=+@~")
 
52
 
 
53
@@ -1157,6 +1160,21 @@
 
54
         g_object_notify (object, TERMINAL_PROFILE_BACKGROUND_IMAGE);
 
55
         break;
 
56
 
 
57
+      case PROP_BACKGROUND_TYPE:
 
58
+        /* This next one is a temporary hack as we are UI frozen. Basically, it means that
 
59
+         * selecting a solid background will use the background settings defined in the
 
60
+         * theme. This should have it's own button though */
 
61
+        if (g_value_get_enum (value) == TERMINAL_BACKGROUND_SOLID)
 
62
+          {
 
63
+            g_value_set_boolean (g_value_array_get_nth (priv->properties, PROP_USE_THEME_BACKGROUND), TRUE);
 
64
+          }
 
65
+        else
 
66
+          {
 
67
+            g_value_set_boolean (g_value_array_get_nth (priv->properties, PROP_USE_THEME_BACKGROUND), FALSE);
 
68
+          }
 
69
+        g_object_notify (object, TERMINAL_PROFILE_USE_THEME_BACKGROUND);
 
70
+        break;
 
71
+
 
72
       default:
 
73
         break;
 
74
     }
 
75
@@ -1304,6 +1322,7 @@
 
76
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY);
 
77
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT);
 
78
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS);
 
79
+  TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_BACKGROUND, DEFAULT_USE_THEME_BACKGROUND, KEY_USE_THEME_BACKGROUND);
 
80
 
 
81
   TERMINAL_PROFILE_PROPERTY_BOXED (BACKGROUND_COLOR, GDK_TYPE_COLOR, KEY_BACKGROUND_COLOR);
 
82
   TERMINAL_PROFILE_PROPERTY_BOXED (BOLD_COLOR, GDK_TYPE_COLOR, KEY_BOLD_COLOR);
 
83
diff -Nur -x '*.orig' -x '*~' gnome-terminal-2.29.6/src/terminal-profile.h gnome-terminal-2.29.6.new/src/terminal-profile.h
 
84
--- gnome-terminal-2.29.6/src/terminal-profile.h        2009-12-15 06:50:36.000000000 +0000
 
85
+++ gnome-terminal-2.29.6.new/src/terminal-profile.h    2010-03-25 17:38:30.177448148 +0000
 
86
@@ -101,6 +101,7 @@
 
87
 #define TERMINAL_PROFILE_USE_SKEY               "use-skey"
 
88
 #define TERMINAL_PROFILE_USE_SYSTEM_FONT        "use-system-font"
 
89
 #define TERMINAL_PROFILE_USE_THEME_COLORS       "use-theme-colors"
 
90
+#define TERMINAL_PROFILE_USE_THEME_BACKGROUND  "use-theme-background"
 
91
 #define TERMINAL_PROFILE_VISIBLE_NAME           "visible-name"
 
92
 #define TERMINAL_PROFILE_WORD_CHARS             "word-chars"
 
93
 
 
94
diff -Nur -x '*.orig' -x '*~' gnome-terminal-2.29.6/src/terminal-screen.c gnome-terminal-2.29.6.new/src/terminal-screen.c
 
95
--- gnome-terminal-2.29.6/src/terminal-screen.c 2010-01-14 00:49:48.000000000 +0000
 
96
+++ gnome-terminal-2.29.6.new/src/terminal-screen.c     2010-03-25 17:40:08.697470314 +0000
 
97
@@ -325,13 +325,27 @@
 
98
 {
 
99
   TerminalScreen *screen = TERMINAL_SCREEN (widget);
 
100
   TerminalScreenPrivate *priv = screen->priv;
 
101
+  TerminalProfile *profile = priv->profile;
 
102
   TerminalBackgroundType bg_type;
 
103
+  gfloat style_darkness;
 
104
 
 
105
   GTK_WIDGET_CLASS (terminal_screen_parent_class)->realize (widget);
 
106
 
 
107
   g_assert (priv->window != NULL);
 
108
 
 
109
+  gtk_widget_style_get (widget,
 
110
+                        "background-darkness", &style_darkness,
 
111
+                        NULL);
 
112
+
 
113
   /* FIXME: Don't enable this if we have a compmgr. */
 
114
+  if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_BACKGROUND))
 
115
+    {
 
116
+      bg_type = style_darkness < 1 ? TERMINAL_BACKGROUND_TRANSPARENT : TERMINAL_BACKGROUND_SOLID;
 
117
+    }
 
118
+  else
 
119
+    {
 
120
+      bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
 
121
+    }
 
122
   bg_type = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
 
123
   vte_terminal_set_background_transparent (VTE_TERMINAL (screen),
 
124
                                            bg_type == TERMINAL_BACKGROUND_TRANSPARENT &&
 
125
@@ -339,6 +353,65 @@
 
126
 }
 
127
 
 
128
 static void
 
129
+update_background (TerminalScreen *screen)
 
130
+{
 
131
+  TerminalScreenPrivate *priv = screen->priv;
 
132
+  TerminalBackgroundType bg_type;
 
133
+  TerminalProfile *profile = priv->profile;
 
134
+  VteTerminal *vte_terminal = VTE_TERMINAL (screen);
 
135
+  gfloat style_darkness;
 
136
+  gdouble opacity;
 
137
+  gboolean use_theme_background;
 
138
+
 
139
+  gtk_widget_style_get (GTK_WIDGET (screen),
 
140
+                        "background-darkness", &style_darkness,
 
141
+                        NULL);
 
142
+  use_theme_background = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_BACKGROUND);
 
143
+
 
144
+  if (use_theme_background)
 
145
+    {
 
146
+      bg_type = style_darkness < 1 ? TERMINAL_BACKGROUND_TRANSPARENT : TERMINAL_BACKGROUND_SOLID;
 
147
+    }
 
148
+  else
 
149
+    {
 
150
+      bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
 
151
+    }
 
152
+
 
153
+  if (bg_type == TERMINAL_BACKGROUND_IMAGE)
 
154
+    {
 
155
+      vte_terminal_set_background_image (vte_terminal,
 
156
+                                         terminal_profile_get_property_object (profile, TERMINAL_PROFILE_BACKGROUND_IMAGE));
 
157
+      vte_terminal_set_scroll_background (vte_terminal,
 
158
+                                          terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_BACKGROUND));
 
159
+    }
 
160
+  else
 
161
+    {
 
162
+      vte_terminal_set_background_image (vte_terminal, NULL);
 
163
+      vte_terminal_set_scroll_background (vte_terminal, FALSE);
 
164
+    }
 
165
+
 
166
+  if (bg_type == TERMINAL_BACKGROUND_IMAGE ||
 
167
+      bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
 
168
+    {
 
169
+      opacity = use_theme_background ? (gdouble) style_darkness : terminal_profile_get_property_double (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS);
 
170
+      vte_terminal_set_background_saturation (vte_terminal,
 
171
+                                              1.0 - opacity);
 
172
+      vte_terminal_set_opacity (vte_terminal,
 
173
+                                0xffff * opacity);
 
174
+    }
 
175
+  else
 
176
+    {
 
177
+      vte_terminal_set_background_saturation (vte_terminal, 1.0); /* normal color */
 
178
+      vte_terminal_set_opacity (vte_terminal, 0xffff);
 
179
+    }
 
180
+
 
181
+  /* FIXME: Don't enable this if we have a compmgr. */
 
182
+  vte_terminal_set_background_transparent (vte_terminal,
 
183
+                                           bg_type == TERMINAL_BACKGROUND_TRANSPARENT &&
 
184
+                                           (!priv->window || !terminal_window_uses_argb_visual (priv->window)));
 
185
+}
 
186
+
 
187
+static void
 
188
 terminal_screen_style_set (GtkWidget *widget,
 
189
                            GtkStyle *previous_style)
 
190
 {
 
191
@@ -349,6 +422,7 @@
 
192
     style_set (widget, previous_style);
 
193
 
 
194
   update_color_scheme (screen);
 
195
+  update_background (screen);
 
196
 
 
197
   if (GTK_WIDGET_REALIZED (widget))
 
198
     terminal_screen_change_font (screen);
 
199
@@ -628,6 +702,12 @@
 
200
                          G_TYPE_STRV,
 
201
                          G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
202
 
 
203
+  gtk_widget_class_install_style_property
 
204
+    (widget_class,
 
205
+     g_param_spec_float ("background-darkness", NULL, NULL,
 
206
+                         0, 1, 1,
 
207
+                         G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
208
+
 
209
   g_type_class_add_private (object_class, sizeof (TerminalScreenPrivate));
 
210
 
 
211
   /* Precompile the regexes */
 
212
@@ -936,7 +1016,6 @@
 
213
   GObject *object = G_OBJECT (screen);
 
214
   VteTerminal *vte_terminal = VTE_TERMINAL (screen);
 
215
   const char *prop_name;
 
216
-  TerminalBackgroundType bg_type;
 
217
 
 
218
   if (pspec)
 
219
     prop_name = pspec->name;
 
220
@@ -1028,42 +1107,9 @@
 
221
       prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE) ||
 
222
       prop_name == I_(TERMINAL_PROFILE_BACKGROUND_IMAGE) ||
 
223
       prop_name == I_(TERMINAL_PROFILE_BACKGROUND_DARKNESS) ||
 
224
-      prop_name == I_(TERMINAL_PROFILE_SCROLL_BACKGROUND))
 
225
-    {
 
226
-      bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
 
227
-
 
228
-      if (bg_type == TERMINAL_BACKGROUND_IMAGE)
 
229
-        {
 
230
-          vte_terminal_set_background_image (vte_terminal,
 
231
-                                             terminal_profile_get_property_object (profile, TERMINAL_PROFILE_BACKGROUND_IMAGE));
 
232
-          vte_terminal_set_scroll_background (vte_terminal,
 
233
-                                              terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_BACKGROUND));
 
234
-        }
 
235
-      else
 
236
-        {
 
237
-          vte_terminal_set_background_image (vte_terminal, NULL);
 
238
-          vte_terminal_set_scroll_background (vte_terminal, FALSE);
 
239
-        }
 
240
-
 
241
-      if (bg_type == TERMINAL_BACKGROUND_IMAGE ||
 
242
-          bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
 
243
-        {
 
244
-          vte_terminal_set_background_saturation (vte_terminal,
 
245
-                                                  1.0 - terminal_profile_get_property_double (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
 
246
-          vte_terminal_set_opacity (vte_terminal,
 
247
-                                    0xffff * terminal_profile_get_property_double (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
 
248
-        }
 
249
-      else
 
250
-        {
 
251
-          vte_terminal_set_background_saturation (vte_terminal, 1.0); /* normal color */
 
252
-          vte_terminal_set_opacity (vte_terminal, 0xffff);
 
253
-        }
 
254
-      
 
255
-      /* FIXME: Don't enable this if we have a compmgr. */
 
256
-      vte_terminal_set_background_transparent (vte_terminal,
 
257
-                                               bg_type == TERMINAL_BACKGROUND_TRANSPARENT &&
 
258
-                                               (!priv->window || !terminal_window_uses_argb_visual (priv->window)));
 
259
-    }
 
260
+      prop_name == I_(TERMINAL_PROFILE_SCROLL_BACKGROUND) ||
 
261
+      prop_name == I_(TERMINAL_PROFILE_USE_THEME_BACKGROUND))
 
262
+    update_background (screen);
 
263
 
 
264
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING))
 
265
   vte_terminal_set_backspace_binding (vte_terminal,