From 98d138e730290fd3f41adb9825a7eab8c8613f9c Mon Sep 17 00:00:00 2001
From: Aleksandar Krsteski <alekrsteski@gmail.com>
Date: Tue, 24 Mar 2009 17:27:32 +0100
Subject: [PATCH 2/2] Change opacity to transparency
Change the opacity option in preferences dialog to transparency to make
it more logical and intuitive.
---
data/guake.schemas | 6 +++---
data/prefs.glade | 10 +++++-----
src/guake.py | 16 ++++++++--------
src/prefs.py | 10 +++++-----
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/data/guake.schemas b/data/guake.schemas
index 1f69379..dd6065f 100644
|
a
|
b
|
|
| 218 | 218 | </schema> |
| 219 | 219 | |
| 220 | 220 | <schema> |
| 221 | | <key>/schemas/apps/guake/style/background/opacity</key> |
| 222 | | <applyto>/apps/guake/style/background/opacity</applyto> |
| | 221 | <key>/schemas/apps/guake/style/background/transparency</key> |
| | 222 | <applyto>/apps/guake/style/background/transparency</applyto> |
| 223 | 223 | <owner>guake</owner> |
| 224 | 224 | <type>int</type> |
| 225 | 225 | <default>80</default> |
| 226 | 226 | <locale name="C"> |
| 227 | | <short>Background opacity.</short> |
| | 227 | <short>Background transparency.</short> |
| 228 | 228 | <long>Alpha that will be applied to the terminal |
| 229 | 229 | background.</long> |
| 230 | 230 | </locale> |
diff --git a/data/prefs.glade b/data/prefs.glade
index 06b8f52..69e8c0a 100644
|
a
|
b
|
|
| 736 | 736 | <packing> |
| 737 | 737 | <property name="expand">False</property> |
| 738 | 738 | <property name="fill">False</property> |
| 739 | | <property name="position">1</property> |
| | 739 | <property name="position">2</property> |
| 740 | 740 | </packing> |
| 741 | 741 | </child> |
| 742 | 742 | <child> |
| … |
… |
|
| 747 | 747 | <property name="width_request">140</property> |
| 748 | 748 | <property name="visible">True</property> |
| 749 | 749 | <property name="xalign">0</property> |
| 750 | | <property name="label" translatable="yes">Opacity:</property> |
| | 750 | <property name="label" translatable="yes">Transparency:</property> |
| 751 | 751 | <property name="use_markup">True</property> |
| 752 | 752 | </widget> |
| 753 | 753 | <packing> |
| … |
… |
|
| 756 | 756 | </packing> |
| 757 | 757 | </child> |
| 758 | 758 | <child> |
| 759 | | <widget class="GtkHScale" id="background_opacity"> |
| | 759 | <widget class="GtkHScale" id="background_transparency"> |
| 760 | 760 | <property name="visible">True</property> |
| 761 | 761 | <property name="can_focus">True</property> |
| 762 | 762 | <property name="adjustment">0 0 100 1 10 10</property> |
| 763 | 763 | <property name="draw_value">False</property> |
| 764 | 764 | <property name="value_pos">GTK_POS_RIGHT</property> |
| 765 | | <signal name="value_changed" handler="on_opacity_value_changed"/> |
| | 765 | <signal name="value_changed" handler="on_transparency_value_changed"/> |
| 766 | 766 | </widget> |
| 767 | 767 | <packing> |
| 768 | 768 | <property name="position">1</property> |
| … |
… |
|
| 771 | 771 | </widget> |
| 772 | 772 | <packing> |
| 773 | 773 | <property name="expand">False</property> |
| 774 | | <property name="position">2</property> |
| | 774 | <property name="position">1</property> |
| 775 | 775 | </packing> |
| 776 | 776 | </child> |
| 777 | 777 | </widget> |
diff --git a/src/guake.py b/src/guake.py
index bfc79a3..a71cb04 100644
|
a
|
b
|
|
| 105 | 105 | notify_add(KEY('/style/font/color'), self.fcolor_changed) |
| 106 | 106 | notify_add(KEY('/style/background/color'), self.bgcolor_changed) |
| 107 | 107 | notify_add(KEY('/style/background/image'), self.bgimage_changed) |
| 108 | | notify_add(KEY('/style/background/opacity'), self.bgopacity_changed) |
| | 108 | notify_add(KEY('/style/background/transparency'), self.bgtransparency_changed) |
| 109 | 109 | |
| 110 | 110 | notify_add(KEY('/general/compat_backspace'), self.backspace_changed) |
| 111 | 111 | notify_add(KEY('/general/compat_delete'), self.delete_changed) |
| … |
… |
|
| 256 | 256 | else: |
| 257 | 257 | i.set_background_transparent(True) |
| 258 | 258 | |
| 259 | | def bgopacity_changed(self, client, connection_id, entry, data): |
| 260 | | """If the gconf var style/background/opacity be changed, this |
| 261 | | method will be called and will set the saturation and opacity |
| | 259 | def bgtransparency_changed(self, client, connection_id, entry, data): |
| | 260 | """If the gconf var style/background/transparency be changed, this |
| | 261 | method will be called and will set the saturation and transparency |
| 262 | 262 | properties in all terminals open. |
| 263 | 263 | """ |
| 264 | | opacity = entry.value.get_int() |
| | 264 | transparency = entry.value.get_int() |
| 265 | 265 | for i in self.guake.term_list: |
| 266 | | i.set_background_saturation(opacity / 100.0) |
| | 266 | i.set_background_saturation(transparency / 100.0) |
| 267 | 267 | if self.guake.has_argb: |
| 268 | | i.set_opacity(65535 / 100 * abs(opacity - 100)) |
| | 268 | i.set_opacity(int((100 - transparency) / 100.0 * 65535)) |
| 269 | 269 | |
| 270 | 270 | def backspace_changed(self, client, connection_id, entry, data): |
| 271 | 271 | """If the gconf var compat_backspace be changed, this method |
| … |
… |
|
| 747 | 747 | self.client.notify(KEY('/style/font/color')) |
| 748 | 748 | self.client.notify(KEY('/style/background/color')) |
| 749 | 749 | self.client.notify(KEY('/style/background/image')) |
| 750 | | self.client.notify(KEY('/style/background/opacity')) |
| | 750 | self.client.notify(KEY('/style/background/transparency')) |
| 751 | 751 | self.client.notify(KEY('/general/use_default_font')) |
| 752 | 752 | |
| 753 | 753 | def accel_add(self, *args): |
diff --git a/src/prefs.py b/src/prefs.py
index 3045c0b..0afc5fb 100644
|
a
|
b
|
|
| 198 | 198 | if os.path.isfile(filename or ''): |
| 199 | 199 | self.client.set_string(KEY('/style/background/image'), filename) |
| 200 | 200 | |
| 201 | | def on_opacity_value_changed(self, hscale): |
| 202 | | """Changes the value of background_opacity in gconf |
| | 201 | def on_transparency_value_changed(self, hscale): |
| | 202 | """Changes the value of background_transparency in gconf |
| 203 | 203 | """ |
| 204 | 204 | value = hscale.get_value() |
| 205 | | self.client.set_int(KEY('/style/background/opacity'), int(value)) |
| | 205 | self.client.set_int(KEY('/style/background/transparency'), int(value)) |
| 206 | 206 | |
| 207 | 207 | # compatibility tab |
| 208 | 208 | |
| … |
… |
|
| 447 | 447 | if os.path.isfile(value or ''): |
| 448 | 448 | self.get_widget('background_image').set_filename(value) |
| 449 | 449 | |
| 450 | | value = self.client.get_int(KEY('/style/background/opacity')) |
| 451 | | self.get_widget('background_opacity').set_value(value) |
| | 450 | value = self.client.get_int(KEY('/style/background/transparency')) |
| | 451 | self.get_widget('background_transparency').set_value(value) |
| 452 | 452 | |
| 453 | 453 | # it's a separated method, to be reused. |
| 454 | 454 | self.reload_erase_combos() |