Skip to content

Commit

Permalink
Expose cursor_shape in preferences (Fix #505)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
  • Loading branch information
gsemet committed Apr 21, 2015
1 parent c73ce3b commit 3ac065e
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 29 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Verison 0.7.0:
- Fix issue with the quit confirmation dialog box (#499)
- Add shortcut for transparency level (#481)
- Add label to tell user how to disable a shortcut (#488)
- Expose cursor_shape and blink cursor method in pref window (#505)

Version 0.6.2:
- Packaging issue fixes
Expand Down
130 changes: 101 additions & 29 deletions data/prefs.glade
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,16 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="use_vte_titles">
<property name="label" translatable="yes">Use VTE titles for tab names</property>
<widget class="GtkCheckButton" id="window_losefocus">
<property name="label" translatable="yes">Hide on lose focus</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_use_vte_titles_toggled" swapped="no"/>
<signal name="toggled" handler="on_window_losefocus_toggled" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
Expand All @@ -465,16 +465,16 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="window_losefocus">
<property name="label" translatable="yes">Hide on lose focus</property>
<widget class="GtkCheckButton" id="use_vte_titles">
<property name="label" translatable="yes">Use VTE titles for tab names</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_window_losefocus_toggled" swapped="no"/>
<signal name="toggled" handler="on_use_vte_titles_toggled" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -1108,8 +1108,8 @@
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="n_rows">5</property>
<property name="n_columns">4</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
Expand Down Expand Up @@ -1157,7 +1157,7 @@
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"/>
Expand All @@ -1178,21 +1178,6 @@
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="labelx3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Background color:</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
Expand Down Expand Up @@ -1225,7 +1210,88 @@
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox11">
<widget class="GtkLabel" id="labelx3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Background color:</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label54">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Cursor shape:</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label35">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Cursor blink mode:</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="cursor_blink_mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="items" translatable="yes">Follow GTK+ setting
Blink on
Blink off</property>
<signal name="changed" handler="on_blink_cursor_toggled" swapped="no"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="cursor_shape">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="items" translatable="yes">Block
I-Beam
Underline</property>
<signal name="changed" handler="on_cursor_shape_changed" swapped="no"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
Expand All @@ -1248,13 +1314,19 @@
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"/>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
Expand Down
25 changes: 25 additions & 0 deletions src/guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,17 @@ def on_palette_name_changed(self, combo):
PALETTES[palette_index])
self.set_palette_colors(PALETTES[palette_index])

def on_cursor_shape_changed(self, combo):
"""Changes the value of cursor_shape in gconf
"""
index = combo.get_active()
self.client.set_int(KEY('/style/cursor_shape'), index)

def on_blink_cursor_toggled(self, chk):
"""Changes the value of blink_cursor in gconf
"""
self.client.set_int(KEY('/style/cursor_blink_mode'), chk.get_active())

def on_palette_color_set(self, btn):
"""Changes the value of palette in gconf
"""
Expand All @@ -621,6 +632,12 @@ def set_palette_name(self, palette):
if palette == PALETTES[i]:
self.get_widget('palette_name').set_active(i)

def set_cursor_shape(self, shape_index):
self.get_widget('cursor_shape').set_active(shape_index)

def set_cursor_blink_mode(self, mode_index):
self.get_widget('cursor_blink_mode').set_active(mode_index)

def set_palette_colors(self, palette):
"""Updates the color buttons with the given palette
"""
Expand Down Expand Up @@ -831,6 +848,14 @@ def load_configs(self):
self.set_palette_name(value)
self.set_palette_colors(value)

# cursor shape
value = self.client.get_int(KEY('/style/cursor_shape'))
self.set_cursor_shape(value)

# cursor blink
value = self.client.get_int(KEY('/style/cursor_blink_mode'))
self.set_cursor_blink_mode(value)

# background image
value = self.client.get_string(KEY('/style/background/image'))
if os.path.isfile(value or ''):
Expand Down

0 comments on commit 3ac065e

Please sign in to comment.