Merge remote-tracking branch 'eMPee584/master'

This commit is contained in:
Lincoln de Sousa 2012-07-26 04:21:38 -04:00
commit 5cc2fb028b
4 changed files with 85 additions and 42 deletions

View File

@ -105,6 +105,18 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/guake/general/start_fullscreen</key>
<applyto>/apps/guake/general/start_fullscreen</applyto>
<owner>guake</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Start fullscreen.</short>
<long>When true, the program will start in fullscreen mode.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/guake/general/window_width</key>
<applyto>/apps/guake/general/window_width</applyto>

View File

@ -337,6 +337,20 @@
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="start_fullscreen">
<property name="label" translatable="yes">Start fullscreen</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_start_fullscreen_toggled"/>
</widget>
<packing>
<property name="position">3</property>
</packing>
</child>
</widget>
</child>
</widget>

View File

@ -193,8 +193,8 @@ class GConfHandler(object):
in guake.
"""
window_rect = self.guake.get_final_window_rect()
self.guake.window.move(window_rect.x, window_rect.y)
self.guake.window.resize(window_rect.width, window_rect.height)
self.guake.window.move(window_rect.x, window_rect.y)
def scrollbar_toggled(self, client, connection_id, entry, data):
"""If the gconf var use_scrollbar be changed, this method will
@ -580,7 +580,7 @@ class Guake(SimpleGladeApp):
self.selected_tab = None
# holds fullscreen status
self.fullscreen = False
self.is_fullscreen = False
# holds the timestamp of the losefocus event
self.losefocus_time = 0
@ -638,6 +638,9 @@ class Guake(SimpleGladeApp):
label = gtk.accelerator_get_label(keyval, mask)
filename = pixmapfile('guake-notification.png')
if self.client.get_bool(KEY('/general/start_fullscreen')):
self.fullscreen()
if not self.hotkeys.bind(key, self.show_hide):
notification = pynotify.Notification(
_('Guake!'),
@ -790,9 +793,8 @@ class Guake(SimpleGladeApp):
if not self.term_list:
self.add_tab()
window_rect = self.get_final_window_rect()
self.window.move(window_rect.x, window_rect.y)
self.window.resize(window_rect.width, window_rect.height)
if not self.is_fullscreen:
self.client.notify(KEY('/general/window_height'))
self.window.show_all()
try:
@ -955,36 +957,39 @@ class Guake(SimpleGladeApp):
def accel_toggle_fullscreen(self, *args):
"""Callback toggle the fullscreen status of the main
window. It uses the toolbar_visible_in_fullscreen variable
from gconf to decide if the tabbar will or not be
shown. Called by the accel key.
window. Called by the accel key.
"""
val = self.client.get_bool(KEY('general/toolbar_visible_in_fullscreen'))
if not self.fullscreen:
self.window.fullscreen()
self.fullscreen = True
# The resizer widget really don't need to be shown in
# fullscreen mode, but tabbar will only be shown if a
# hidden gconf key is false.
self.resizer.hide()
if not val:
self.toolbar.hide()
if not self.is_fullscreen:
self.fullscreen()
else:
self.window.unfullscreen()
self.fullscreen = False
# making sure that tabbar and resizer will come back to
# their default state.
self.client.notify(KEY('/general/window_tabbar'))
self.client.notify(KEY('/general/show_resizer'))
# make sure the window size is correct after returning
# from fullscreen
self.client.notify(KEY('/general/window_height'))
self.unfullscreen()
return True
def fullscreen(self):
self.window.fullscreen()
self.is_fullscreen = True
# The resizer widget really don't need to be shown in
# fullscreen mode, but tabbar will only be shown if a
# hidden gconf key is false.
self.resizer.hide()
if not self.client.get_bool(KEY('general/toolbar_visible_in_fullscreen')):
self.toolbar.hide()
def unfullscreen(self):
self.window.unfullscreen()
self.is_fullscreen = False
# making sure that tabbar and resizer will come back to
# their default state.
self.client.notify(KEY('/general/window_tabbar'))
self.client.notify(KEY('/general/show_resizer'))
# make sure the window size is correct after returning
# from fullscreen. broken on old compiz/metacity versions :C
self.client.notify(KEY('/general/window_height'))
# -- callbacks --
def on_terminal_exited(self, term, widget):
@ -1317,6 +1322,10 @@ def main():
"""
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-f', '--fullscreen', dest='fullscreen',
action='store_true', default=False,
help=_('Put Guake in fullscreen mode'))
parser.add_option('-t', '--toggle-visibility', dest='show_hide',
action='store_true', default=False,
help=_('Toggles the visibility of the terminal window'))
@ -1367,47 +1376,46 @@ def main():
remote_object = DbusManager(instance)
already_running = False
called_with_param = False
only_show_hide = True
if options.show_hide:
remote_object.show_hide()
called_with_param = True
if options.fullscreen:
instance.fullscreen()
if options.show_preferences:
remote_object.show_prefs()
called_with_param = True
only_show_hide = False
if options.new_tab:
remote_object.add_tab(options.new_tab)
called_with_param = True
only_show_hide = False
if options.select_tab:
selected = int(options.select_tab)
remote_object.select_tab(selected)
called_with_param = True
only_show_hide = False
if options.selected_tab:
selected = remote_object.get_selected_tab()
sys.stdout.write('%d\n' % selected)
called_with_param = True
only_show_hide = False
if options.command:
remote_object.execute_command(options.command)
called_with_param = True
only_show_hide = False
if options.rename_tab:
remote_object.rename_current_tab(options.rename_tab)
called_with_param = True
only_show_hide = False
if options.show_about:
remote_object.show_about()
called_with_param = True
only_show_hide = False
if options.quit:
remote_object.quit()
called_with_param = True
only_show_hide = False
if not called_with_param and already_running:
if already_running and only_show_hide:
# here we know that guake was called without any parameter and
# it is already running, so, lets toggle its visibility.
remote_object.show_hide()

View File

@ -172,6 +172,11 @@ class PrefsCallbacks(object):
"""
self.client.set_bool(KEY('/general/window_tabbar'), chk.get_active())
def on_start_fullscreen_toggled(self, chk):
"""Changes the activity of start_fullscreen in gconf
"""
self.client.set_bool(KEY('/general/start_fullscreen'), chk.get_active())
def on_window_height_value_changed(self, hscale):
"""Changes the value of window_height in gconf
"""
@ -478,6 +483,10 @@ class PrefsDialog(SimpleGladeApp):
value = self.client.get_bool(KEY('/general/window_tabbar'))
self.get_widget('window_tabbar').set_active(value)
# start fullscreen
value = self.client.get_bool(KEY('/general/start_fullscreen'))
self.get_widget('start_fullscreen').set_active(value)
# scrollbar
value = self.client.get_bool(KEY('/general/use_scrollbar'))
self.get_widget('use_scrollbar').set_active(value)