Add zoom reset action

This commit is contained in:
René Stadler 2011-11-05 23:05:00 +01:00 committed by Stefan Sauer
parent b7654532ba
commit 5b07a1fc39
2 changed files with 11 additions and 4 deletions

View file

@ -219,7 +219,8 @@ class Window (object):
("clear-line-view", gtk.STOCK_CLEAR, None),
("show-about", gtk.STOCK_ABOUT, None),
("enlarge-text", gtk.STOCK_ZOOM_IN, _("Enlarge Text"), "<Ctrl>plus"),
("shrink-text", gtk.STOCK_ZOOM_OUT, _("Shrink Text"), "<Ctrl>minus")])
("shrink-text", gtk.STOCK_ZOOM_OUT, _("Shrink Text"), "<Ctrl>minus"),
("reset-text", gtk.STOCK_ZOOM_100, _("Normal Text Size"), "<Ctrl>0")])
self.actions.add_group (group)
self.actions.reload_file.props.sensitive = False
@ -300,7 +301,8 @@ class Window (object):
"hide-before-line", "hide-after-line", "show-hidden-lines",
"edit-copy-line", "edit-copy-message", "set-base-time",
"hide-log-level", "hide-log-category", "hide-log-object",
"hide-filename", "show-about", "enlarge-text", "shrink-text"):
"hide-filename", "show-about", "enlarge-text", "shrink-text",
"reset-text"):
name = action_name.replace ("-", "_")
action = getattr (self.actions, name)
handler = getattr (self, "handle_%s_action_activate" % (name,))
@ -587,6 +589,10 @@ class Window (object):
self.update_zoom_level (-1)
def handle_reset_text_action_activate (self, action):
self.update_zoom_level (-self.zoom_level)
def update_zoom_level (self, delta_step):
if not delta_step:

View file

@ -35,8 +35,9 @@
<menuitem name="ViewContextMenuCopyMessage" action="edit-copy-message"/>
<menuitem name="ViewContextMenuCopyLine" action="edit-copy-line"/>
<separator/>
<menuitem name="ZoomInMessage" action="enlarge-text"/>
<menuitem name="ZoomOutMessage" action="shrink-text"/>
<menuitem name="ZoomIn" action="enlarge-text"/>
<menuitem name="ZoomOut" action="shrink-text"/>
<menuitem name="Zoom100" action="reset-text"/>
</menu>
<menu name="HelpMenu" action="HelpMenuAction">
<placeholder name="HelpMenuAdditions"/>