[Xfce4-commits] <postler:master> Implement zoom via Ctrl+Plus, Ctrl+Wheel and context menu

Christian Dywan noreply at xfce.org
Sun Nov 28 23:26:04 CET 2010


Updating branch refs/heads/master
         to 82497faf94705b3e67923e51aac2002a77761110 (commit)
       from 8592c77422688e8b36e34febb1c19570c757f382 (commit)

commit 82497faf94705b3e67923e51aac2002a77761110
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Nov 27 16:55:19 2010 +0100

    Implement zoom via Ctrl+Plus, Ctrl+Wheel and context menu

 postler/postler-bureau.vala  |   14 ++++++++++++++
 postler/postler-content.vala |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index eb0f999..944c215 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -48,6 +48,8 @@ public class Postler.Bureau : Gtk.Window {
                 </menu>
                 <menu action="Edit">
                     <menuitem action="HideRead"/>
+                    <menuitem action="ZoomIn"/>
+                    <menuitem action="ZoomOut"/>
                     <separator/>
                     <menuitem action="Fullscreen"/>
                     <menuitem action="ViewSource"/>
@@ -297,6 +299,14 @@ public class Postler.Bureau : Gtk.Window {
                     Gtk.get_current_event_time ());
     }
 
+    void action_zoom_in () {
+        content.zoom_in ();
+    }
+
+    void action_zoom_out () {
+        content.zoom_out ();
+    }
+
     void action_fullscreen () {
         Gtk.Orientation orientation;
         if ((window.get_state () & Gdk.WindowState.FULLSCREEN) == 0) {
@@ -377,6 +387,10 @@ public class Postler.Bureau : Gtk.Window {
           N_("Save the current search"), action_save_search },
         { "View", Gtk.STOCK_PROPERTIES, N_("_View"), "",
           null, action_view },
+        { "ZoomIn", Gtk.STOCK_ZOOM_IN, N_("_Enlarge Text"), "<Ctrl>plus",
+          N_("Enlarge message text"), action_zoom_in },
+         { "ZoomOut", Gtk.STOCK_ZOOM_OUT, N_("Sh_rink Text"), "<Ctrl>minus",
+          N_("Shrink message text"), action_zoom_out },
         { "Fullscreen", Gtk.STOCK_FULLSCREEN, null, "F11",
           N_("View the message in fullscreen"), action_fullscreen },
         { "ViewSource", null, N_("View _Source"), "<Ctrl><Alt>u",
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index f6bc64a..c9331c3 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -194,6 +194,25 @@ public class Postler.Content : WebKit.WebView {
         });
         menuitem.show ();
         menu.append (menuitem);
+
+        menuitem = new Gtk.SeparatorMenuItem ();
+        menuitem.show ();
+        menu.append (menuitem);
+        menuitem = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ZOOM_IN, null);
+        menuitem.label = _("_Enlarge Text");
+        menuitem.activate.connect ((menuitem) => {
+            zoom_in ();
+        });
+        menuitem.show ();
+        menu.append (menuitem);
+        menuitem = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ZOOM_OUT, null);
+        menuitem.label = _("Sh_rink Text");
+        menuitem.activate.connect ((menuitem) => {
+            zoom_out ();
+        });
+        menuitem.show ();
+        menu.append (menuitem);
+
         if (last_location.has_prefix ("view-source:"))
             return;
 
@@ -953,5 +972,18 @@ public class Postler.Content : WebKit.WebView {
         /* Forward new windows, we never open new windows of our own */
         return this;
     }
+
+    public override bool scroll_event (Gdk.EventScroll event) {
+        if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
+            if (event.direction == Gdk.ScrollDirection.UP) {
+                zoom_in ();
+                return true;
+            } else if (event.direction == Gdk.ScrollDirection.DOWN) {
+                zoom_out ();
+                return true;
+            }
+        }
+        return false;
+    }
 }
 



More information about the Xfce4-commits mailing list