[gedit-plugins/gnome-3-8] terminal: follow gnome-terminal profile settings
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/gnome-3-8] terminal: follow gnome-terminal profile settings
- Date: Fri, 24 May 2013 10:51:21 +0000 (UTC)
commit 6d3ec9a16c826d605332ce6ee249135cc6f0ad6f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu May 23 13:04:15 2013 +0200
terminal: follow gnome-terminal profile settings
....gnome.gedit.plugins.terminal.gschema.xml.in.in | 25 ++++++++++--
plugins/terminal/terminal.py | 40 ++++++++++++++-----
2 files changed, 49 insertions(+), 16 deletions(-)
---
diff --git a/plugins/terminal/org.gnome.gedit.plugins.terminal.gschema.xml.in.in
b/plugins/terminal/org.gnome.gedit.plugins.terminal.gschema.xml.in.in
index 1e12151..b589da0 100644
--- a/plugins/terminal/org.gnome.gedit.plugins.terminal.gschema.xml.in.in
+++ b/plugins/terminal/org.gnome.gedit.plugins.terminal.gschema.xml.in.in
@@ -11,7 +11,7 @@
</enum>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gedit.plugins.terminal"
path="/org/gnome/gedit/plugins/terminal/">
- <key name="silent-bell" type="b">
+ <key name="audible-bell" type="b">
<default>true</default>
<_summary>Whether to silence terminal bell</_summary>
<_description>
@@ -41,14 +41,14 @@
terminal.
</_description>
</key>
- <key name="scrollback-on-keystroke" type="b">
+ <key name="scroll-on-keystroke" type="b">
<default>true</default>
<_summary>Whether to scroll to the bottom when a key is pressed</_summary>
<_description>
If true, pressing a key jumps the scrollbar to the bottom.
</_description>
</key>
- <key name="scrollback-on-output" type="b">
+ <key name="scroll-on-output" type="b">
<default>false</default>
<_summary>Whether to scroll to the bottom when there's new output</_summary>
<_description>
@@ -91,8 +91,23 @@
a color name such as "red").
</_description>
</key>
- <key name="palette" type="s">
-
<default>'#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC'</default>
+ <key name="palette" type="as">
+ <default>["#2E2E34343636",
+ "#CCCC00000000",
+ "#4E4E9A9A0606",
+ "#C4C4A0A00000",
+ "#34346565A4A4",
+ "#757550507B7B",
+ "#060698209A9A",
+ "#D3D3D7D7CFCF",
+ "#555557575353",
+ "#EFEF29292929",
+ "#8A8AE2E23434",
+ "#FCFCE9E94F4F",
+ "#72729F9FCFCF",
+ "#ADAD7F7FA8A8",
+ "#3434E2E2E2E2",
+ "#EEEEEEEEECEC"]</default>
<_summary>Palette for terminal applications</_summary>
<_description>
Terminals have a 16-color palette that applications inside
diff --git a/plugins/terminal/terminal.py b/plugins/terminal/terminal.py
index 9513379..533248c 100644
--- a/plugins/terminal/terminal.py
+++ b/plugins/terminal/terminal.py
@@ -58,6 +58,8 @@ class GeditTerminal(Gtk.Box):
self.system_settings.connect("changed::monospace-font-name", self.font_changed)
self._vte = Vte.Terminal()
+ self._vte.set_background_image(None)
+ self._vte.set_background_transparent(False)
self.reconfigure_vte()
self._vte.set_size(self._vte.get_column_count(), 5)
self._vte.set_size_request(200, 50)
@@ -97,9 +99,28 @@ class GeditTerminal(Gtk.Box):
def do_grab_focus(self):
self._vte.grab_focus()
+ def settings_try_new(self, schema):
+ schemas = Gio.Settings.list_schemas()
+ if not schemas:
+ return None
+
+ for s in schemas:
+ if s == schema:
+ return Gio.Settings.new(schema)
+
+ return None
+
def get_profile_settings(self):
- #FIXME return either the gnome-terminal settings or the gedit one
- return Gio.Settings.new("org.gnome.gedit.plugins.terminal")
+ profiles = self.settings_try_new("org.gnome.Terminal.ProfilesList")
+
+ if profiles:
+ default_path = "/org/gnome/terminal/legacy/profiles:/:" + profiles.get_string("default")
+ settings = Gio.Settings.new_with_path("org.gnome.Terminal.Legacy.Profile",
+ default_path)
+ else:
+ settings = Gio.Settings.new("org.gnome.gedit.plugins.terminal")
+
+ return settings
def get_font(self):
if self.profile_settings.get_boolean("use-system-font"):
@@ -134,9 +155,9 @@ class GeditTerminal(Gtk.Box):
if bg_color != "":
bg = Gdk.RGBA()
parsed = bg.parse(bg_color)
- str_colors = self.profile_settings.get_string("palette")
- if str_colors != "":
- for str_color in str_colors.split(':'):
+ str_colors = self.profile_settings.get_strv("palette")
+ if str_colors:
+ for str_color in str_colors:
try:
rgba = Gdk.RGBA()
rgba.parse(str_color)
@@ -144,17 +165,14 @@ class GeditTerminal(Gtk.Box):
except:
palette = []
break
- if (len(palette) not in (0, 8, 16, 24)):
- palette = []
self._vte.set_colors_rgba(fg, bg, palette)
-
self._vte.set_cursor_blink_mode(self.profile_settings.get_enum("cursor-blink-mode"))
self._vte.set_cursor_shape(self.profile_settings.get_enum("cursor-shape"))
- self._vte.set_audible_bell(not self.profile_settings.get_boolean("silent-bell"))
+ self._vte.set_audible_bell(self.profile_settings.get_boolean("audible-bell"))
self._vte.set_allow_bold(self.profile_settings.get_boolean("allow-bold"))
- self._vte.set_scroll_on_keystroke(self.profile_settings.get_boolean("scrollback-on-keystroke"))
- self._vte.set_scroll_on_output(self.profile_settings.get_boolean("scrollback-on-output"))
+ self._vte.set_scroll_on_keystroke(self.profile_settings.get_boolean("scroll-on-keystroke"))
+ self._vte.set_scroll_on_output(self.profile_settings.get_boolean("scroll-on-output"))
self._vte.set_word_chars(self.profile_settings.get_string("word-chars"))
self._vte.set_emulation(self.defaults['emulation'])
self._vte.set_visible_bell(self.defaults['visible_bell'])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]