[baobab/wip/vala: 30/65] More work on the App menu



commit 8d2455a62406ccff892b944d233926c51bb93e32
Author: Paolo Borelli <pborelli gnome org>
Date:   Tue Jan 17 19:08:32 2012 +0100

    More work on the App menu

 data/baobab-menu.ui         |   18 +++++++++---------
 src/baobab-application.vala |    8 --------
 src/baobab-window.vala      |   37 ++++++++++++++++++++++++++++++++++++-
 3 files changed, 45 insertions(+), 18 deletions(-)
---
diff --git a/data/baobab-menu.ui b/data/baobab-menu.ui
index 20a612a..8918f1b 100644
--- a/data/baobab-menu.ui
+++ b/data/baobab-menu.ui
@@ -3,19 +3,19 @@
   <!-- interface-requires gtk+ 3.0 -->
   <menu id="appmenu">
     <section>
-      <item label="_Help" action="app.help" accel="F1"/>
-      <item label="_About" action="app.about"/>
+      <item label="_Scan Home" action="win.scan-home" accel="&lt;Primary&gt;h"/>
+      <item label="Scan _Filesystem" action="win.scan-filesystem" accel="&lt;Primary&gt;f"/>
+      <item label="Scan F_older" action="win.scan-folder" accel="&lt;Primary&gt;o"/>
+    </section>
+    <section>
+      <item label="_Help" action="win.help" accel="F1"/>
+      <item label="_About" action="win.about"/>
+    </section>
+    <section>
       <item label="_Quit" action="app.quit" accel="&lt;Primary&gt;q"/>
     </section>
   </menu>
   <menu id="menubar">
-    <submenu label="_Analyzer">
-      <section>
-        <item label="_Scan Home" action="win.scan-home" accel="&lt;Primary&gt;h"/>
-        <item label="Scan _Filesystem" action="win.scan-filesystem" accel="&lt;Primary&gt;f"/>
-        <item label="Scan F_older" action="win.scan-folder" accel="&lt;Primary&gt;o"/>
-      </section>
-    </submenu>
     <submenu label="_View">
       <section>
         <item label="_Stop" action="win.stop"/>
diff --git a/src/baobab-application.vala b/src/baobab-application.vala
index 8f65b51..83256ea 100644
--- a/src/baobab-application.vala
+++ b/src/baobab-application.vala
@@ -3,8 +3,6 @@ namespace Baobab {
 		static Application baobab;
 
 		private const GLib.ActionEntry[] action_entries = {
-			{ "help", on_help_activate },
-			{ "about", on_about_activate },
 			{ "quit", on_quit_activate }
 		};
 
@@ -99,12 +97,6 @@ namespace Baobab {
 			return app.ui_settings;
 		}
 
-		void on_help_activate () {
-		}
-
-		void on_about_activate () {
-		}
-
 		void on_quit_activate () {
 		}
 	}
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 88fecc7..b26a602 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -19,7 +19,9 @@ namespace Baobab {
 			{ "show-statusbar", on_show_statusbar },
 			{ "show-allocated", on_show_allocated },
 			{ "expand-all", on_expand_all },
-			{ "collapse-all", on_collapse_all }
+			{ "collapse-all", on_collapse_all },
+			{ "help", on_help_activate },
+			{ "about", on_about_activate }
 		};
 
 		protected struct ActionState {
@@ -154,6 +156,39 @@ namespace Baobab {
 			treeview.collapse_all ();
 		}
 
+		void on_help_activate () {
+			try {
+				Gtk.show_uri (get_screen (), "help:baobab", Gtk.get_current_event_time ());
+			} catch (Error e) {
+				warning ("Failed to show help: %s", e.message);
+			}
+		}
+
+		void on_about_activate () {
+			const string authors[] = {
+				"Ryan Lortie <desrt desrt ca>",
+				"Fabio Marzocca <thesaltydog gmail com>",
+				"Paolo Borelli <pborelli gnome com>",
+				"BenoÃt Dejean <benoit placenet org>",
+				"Igalia (rings-chart and treemap widget) <www.igalia.com>"
+			};
+
+			const string copyright = "Copyright \xc2\xa9 2005-2011 Fabio Marzocca, Paolo Borelli, BenoÃt Dejean, Igalia\n" +
+			                         "Copyright \xc2\xa9 2011-2012 Ryan Lortie, Paolo Borelli\n";
+
+			Gtk.show_about_dialog (this,
+			                       "program-name", _("Baobab"),
+			                       "logo-icon-name", "baobab",
+			                       "version", Config.VERSION,
+			                       "comments", "A graphical tool to analyze disk usage.",
+			                       "copyright", copyright,
+			                       "license-type", Gtk.License.GPL_2_0,
+			                       "wrap-license", false,
+			                       "authors", authors,
+			                       "translator-credits", _("translator-credits"),
+			                       null);
+		}
+
 		void on_drag_data_received (Gtk.Widget widget, Gdk.DragContext context, int x, int y,
 		                            Gtk.SelectionData selection_data, uint target_type, uint time) {
 			File dir = null;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]