Skip to content

Commit

Permalink
Merge pull request #362 from svtdragon/master
Browse files Browse the repository at this point in the history
Re-add horizontal align and width to fix #258
  • Loading branch information
gsemet committed Aug 11, 2014
2 parents 3e5cd0b + 0f28686 commit 150fb80
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 5 deletions.
6 changes: 3 additions & 3 deletions data/guake.schemas
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@
<key>/schemas/apps/guake/general/window_width</key>
<applyto>/apps/guake/general/window_width</applyto>
<owner>guake</owner>
<type>float</type>
<type>int</type>
<default>100</default>
<locale name="C">
<short>Window Width.</short>
<short>Window width.</short>
<long>Percent of the screen that will be used by guake
terminal horizontally.</long>
</locale>
Expand All @@ -224,7 +224,7 @@
<type>int</type>
<default>50</default>
<locale name="C">
<short>Window size.</short>
<short>Window height.</short>
<long>Percent of the screen that will be used by guake
terminal vertically.</long>
</locale>
Expand Down
135 changes: 134 additions & 1 deletion data/prefs.glade
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
39 changes: 38 additions & 1 deletion src/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
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
Expand Down Expand Up @@ -274,6 +277,23 @@ def on_window_height_value_changed(self, hscale):
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):
Expand Down Expand Up @@ -586,9 +606,26 @@ def load_configs(self):
value = self.client.get_bool(KEY('/general/use_vte_titles'))
self.get_widget('use_vte_titles').set_active(value)

value = self.client.get_int(KEY('/general/window_height'))
try:
value = self.client.get_int(KEY('/general/window_height'))
except:
value = self.client.get_float(KEY('/general/window_height'))
self.get_widget('window_height').set_value(value)

try:
value = self.client.get_int(KEY('/general/window_width'))
except:
value = self.client.get_float(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)

Expand Down

0 comments on commit 150fb80

Please sign in to comment.