[Xfce4-commits] <postler:master> Implement 'View' action with MenuAction class

Christian Dywan noreply at xfce.org
Sat May 29 01:52:01 CEST 2010


Updating branch refs/heads/master
         to 9c66b06990cd4949d9c6eaacf6a4cbd6d2d978de (commit)
       from 4ca8199ad692805b8dd0555349abaf177cec303b (commit)

commit 9c66b06990cd4949d9c6eaacf6a4cbd6d2d978de
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat May 29 01:23:10 2010 +0200

    Implement 'View' action with MenuAction class

 postler/postler-bureau.vala     |    4 ++--
 postler/postler-menuaction.vala |   27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index dbc7556..979c97c 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -63,7 +63,6 @@ public class Postler.Bureau : Gtk.Window {
                     </menu>
                 </toolitem>
                 <separator/>
-                <toolitem action="Preferences"/>
                 <toolitem action="About"/>
             </toolbar>
         </ui>
@@ -137,7 +136,6 @@ public class Postler.Bureau : Gtk.Window {
         { "Quit", Gtk.STOCK_QUIT, null, "<Ctrl>q",
           N_("Quit the application"), action_quit },
         { "Edit", null, N_("_Edit") },
-        { "View", Gtk.STOCK_PROPERTIES, N_("_View") },
         { "Preferences", Gtk.STOCK_PREFERENCES, null, "<Ctrl><Alt>p",
           N_("Configure the application preferences"), action_preferences },
         { "Help", null, N_("_Help") },
@@ -165,6 +163,8 @@ public class Postler.Bureau : Gtk.Window {
         actions.set_translation_domain (Config.GETTEXT_PACKAGE);
         actions.add_actions (action_entries, this);
         actions.add_toggle_actions  (toggle_entries, this);
+        actions.add_action (new Postler.ViewAction ("View",
+            _("_View"), _("View"), Gtk.STOCK_PREFERENCES));
         ui.insert_action_group (actions, 0);
         try {
             ui.add_ui_from_string (ui_markup, -1);
diff --git a/postler/postler-menuaction.vala b/postler/postler-menuaction.vala
new file mode 100644
index 0000000..21af59a
--- /dev/null
+++ b/postler/postler-menuaction.vala
@@ -0,0 +1,27 @@
+/*
+ Copyright (C) 2010 Christian Dywan <christian at twotoasts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See the file COPYING for the full license text.
+*/
+
+const string GETTEXT_PACKAGE_MENUACTION = Config.GETTEXT_PACKAGE;
+
+public class Postler.MenuAction : Gtk.Action {
+    Gtk.ToolItem toolitem;
+
+    public ViewAction (string? name, string? label, string? tooltip,
+        string? stock_id) {
+        Object (name: name, label: label, tooltip: tooltip, stock_id: stock_id);
+    }
+
+    override unowned Gtk.Widget create_tool_item () {
+        toolitem = new Gtk.MenuToolButton.from_stock (stock_id);
+        return toolitem;
+    }
+}
+



More information about the Xfce4-commits mailing list