[Xfce4-commits] <postler:master> Implement a menu item and shortcut for View Source

Christian Dywan noreply at xfce.org
Sat May 29 16:40:03 CEST 2010


Updating branch refs/heads/master
         to ef8b131ef2307f99686899f4d9bd45a80e16f605 (commit)
       from 22d2424a21552a9ecd503280f5c077102d10a0b5 (commit)

commit ef8b131ef2307f99686899f4d9bd45a80e16f605
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat May 29 16:38:28 2010 +0200

    Implement a menu item and shortcut for View Source

 postler/postler-bureau.vala  |   16 ++++++++++++++++
 postler/postler-content.vala |    3 +--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 526bc2d..088eb77 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -41,6 +41,8 @@ public class Postler.Bureau : Gtk.Window {
                 <menu action="Edit">
                     <menuitem action="HideRead"/>
                     <separator/>
+                    <menuitem action="ViewSource"/>
+                    <separator/>
                     <menuitem action="Search"/>
                     <separator/>
                     <menuitem action="Preferences"/>
@@ -63,6 +65,8 @@ public class Postler.Bureau : Gtk.Window {
                 <toolitem action="View">
                     <menu action="View">
                         <menuitem action="HideRead"/>
+                        <separator/>
+                        <menuitem action="ViewSource"/>
                     </menu>
                 </toolitem>
                 <separator/>
@@ -101,6 +105,10 @@ public class Postler.Bureau : Gtk.Window {
         search.grab_focus ();
     }
 
+    void action_view_source () {
+        Postler.App.spawn_module ("source", content.last_location);
+    }
+
     void action_preferences () {
         /* TODO */
     }
@@ -146,6 +154,8 @@ public class Postler.Bureau : Gtk.Window {
         { "Edit", null, N_("_Edit") },
         { "Search", Gtk.STOCK_FIND, null, "<Ctrl>s",
           N_("Search the selected folder"), action_search },
+        { "ViewSource", null, N_("View _Source"), "<Ctrl><Alt>u",
+          N_("View the source of the message"), action_view_source },
         { "Preferences", Gtk.STOCK_PREFERENCES, null, "<Ctrl><Alt>p",
           N_("Configure the application preferences"), action_preferences },
         { "Help", null, N_("_Help") },
@@ -220,6 +230,7 @@ public class Postler.Bureau : Gtk.Window {
         actions.get_action ("MessageReply").sensitive = false;
         actions.get_action ("MessageReplyAll").sensitive = false;
         actions.get_action ("MessageForward").sensitive = false;
+        actions.get_action ("ViewSource").sensitive = false;
         messages.notify["selected-location"].connect ((object, pspec) => {
             Postler.Messages messages = object as Postler.Messages;
             bool state = messages.selected_location != null;
@@ -233,6 +244,11 @@ public class Postler.Bureau : Gtk.Window {
             bool state = content.reply_to_all != null;
             actions.get_action ("MessageReplyAll").sensitive = state;
         });
+        content.notify["last-location"].connect ((object, pspec) => {
+            Postler.Content content = object as Postler.Content;
+            bool state = content.last_location != null;
+            actions.get_action ("ViewSource").sensitive = state;
+        });
         scrolled = new Postler.ScrolledWindow (content);
         vpaned.pack2 (scrolled, false, true);
         shelf.show_all ();
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 020d7f7..140360a 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -17,8 +17,7 @@ struct Postler.EmoticonMapping {
 }
 
 public class Postler.Content : WebKit.WebView {
-    string last_location;
-
+    public string? last_location { get; set; }
     public string? subject { get; set; }
     public string? reply_to { get; set; }
     public string? reply_to_all { get; set; }



More information about the Xfce4-commits mailing list