Merge pull request #357 from svtdragon/master

Add preferences option for horizontal alignment
This commit is contained in:
Stibbons 2014-08-08 18:52:03 +02:00
commit 3a396fe87d
3 changed files with 167 additions and 2 deletions

View File

@ -67,7 +67,8 @@ the gtk-2 version:
Ubuntu
------
Under Debian/Ubuntu, the following command should install all the build
Under Debian/Ubuntu, make sure you have source code repositories
enabled, then the following command should install all the build
dependencies::
sudo apt-get build-dep guake

View File

@ -674,7 +674,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ypad">6</property>
<property name="label" translatable="yes">&lt;b&gt;Main Window height&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Main Window Height&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
@ -688,6 +688,139 @@
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkHScale" id="window_width">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="update_policy">discontinuous</property>
<property name="adjustment">50 10 110 10 10 10</property>
<property name="digits">0</property>
<property name="draw_value">False</property>
<property name="value_pos">right</property>
<signal name="value_changed" handler="on_window_width_value_changed" swapped="no"/>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label33">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ypad">6</property>
<property name="label" translatable="yes">&lt;b&gt;Main Window Width&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkRadioButton" id="radiobutton_align_left">
<property name="label" translatable="yes">Left</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="draw_indicator">True</property>
<signal name="toggled" handler="on_window_halign_value_changed" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_align_center">
<property name="label" translatable="yes">Center</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="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_align_left</property>
<signal name="toggled" handler="on_window_halign_value_changed" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_align_right">
<property name="label" translatable="yes">Right</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="draw_indicator">True</property>
<property name="group">radiobutton_align_left</property>
<signal name="toggled" handler="on_window_halign_value_changed" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label34">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ypad">6</property>
<property name="label" translatable="yes">&lt;b&gt;Main Window Horizontal Alignment&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</widget>
</child>
<child>

View File

@ -33,6 +33,9 @@ from guake.common import get_binaries_from_path
from guake.common import gladefile
from guake.common import hexify_color
from guake.common import pixmapfile
from guake.globals import ALIGN_CENTER
from guake.globals import ALIGN_LEFT
from guake.globals import ALIGN_RIGHT
from guake.globals import GCONF_PATH
from guake.globals import KEY
from guake.globals import LOCALE_DIR
@ -270,6 +273,23 @@ class PrefsCallbacks(object):
val = hscale.get_value()
self.client.set_int(KEY('/general/window_height'), int(val))
def on_window_width_value_changed(self, wscale):
"""Changes the value of window_width in gconf
"""
val = wscale.get_value()
self.client.set_int(KEY('/general/window_width'), int(val))
def on_window_halign_value_changed(self, halign_button):
"""Changes the value of window_halignment in gconf
"""
if halign_button.get_active():
which_align = {
'radiobutton_align_left': ALIGN_LEFT,
'radiobutton_align_right': ALIGN_RIGHT,
'radiobutton_align_center': ALIGN_CENTER
}
self.client.set_int(KEY('/general/window_halignment'), which_align[halign_button.get_name()])
# scrolling tab
def on_use_scrollbar_toggled(self, chk):
@ -585,6 +605,17 @@ class PrefsDialog(SimpleGladeApp):
value = self.client.get_int(KEY('/general/window_height'))
self.get_widget('window_height').set_value(value)
value = self.client.get_int(KEY('/general/window_width'))
self.get_widget('window_width').set_value(value)
value = self.client.get_int(KEY('/general/window_halignment'))
which_button = {
ALIGN_RIGHT: 'radiobutton_align_right',
ALIGN_LEFT: 'radiobutton_align_left',
ALIGN_CENTER: 'radiobutton_align_center'
}
self.get_widget(which_button[value]).set_active(True)
value = self.client.get_bool(KEY('/general/open_tab_cwd'))
self.get_widget('open_tab_cwd').set_active(value)