[gnome-documents] main-window: add an About dialog



commit 1820e44dcdf6d87a5a9f8243e101bd88048e1ac3
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Feb 29 17:23:10 2012 -0500

    main-window: add an About dialog

 src/Makefile-js.am |    8 ++++++--
 src/Makefile.am    |    5 ++++-
 src/application.js |   18 +++++++++++++++---
 src/config.js.in   |    3 +++
 src/mainWindow.js  |   27 +++++++++++++++++++++++++++
 5 files changed, 55 insertions(+), 6 deletions(-)
---
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 7adbc07..1f5c0a9 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -37,12 +37,16 @@ BUILT_SOURCES += path.js
 
 path.js: Makefile path.js.in
 	$(AM_V_GEN) $(do_subst) $(srcdir)/path.js.in > $@
+config.js: Makefile config.js.in
+	$(AM_V_GEN) $(do_subst) $(srcdir)/config.js.in > $@
 
 nodist_js_DATA = \
-    path.js
+    path.js \
+    config.js
 
 CLEANFILES += \
     $(BUILT_SOURCES)
 
 EXTRA_DIST += \
-    path.js.in
\ No newline at end of file
+    path.js.in \
+    config.js.in
diff --git a/src/Makefile.am b/src/Makefile.am
index da98791..ae3d560 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,10 @@ do_subst = sed -e 's|@abs_top_srcdir[ ]|$(abs_top_srcdir)|g' \
                -e 's|@libexecdir[ ]|$(libexecdir)|g' \
                -e 's|@pkglibdir[ ]|$(pkglibdir)|g' \
                -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g' \
-               -e 's|@GJS_CONSOLE[ ]|$(GJS_CONSOLE)|g'
+               -e 's|@GJS_CONSOLE[ ]|$(GJS_CONSOLE)|g' \
+               -e 's|@PACKAGE_NAME[ ]|$(PACKAGE_NAME)|g' \
+               -e 's|@PACKAGE_VERSION[ ]|$(PACKAGE_VERSION)|g' \
+               -e 's|@GETTEXT_PACKAGE[ ]|$(GETTEXT_PACKAGE)|g'
 
 include $(INTROSPECTION_MAKEFILE)
 include Makefile-lib.am
diff --git a/src/application.js b/src/application.js
index 7afd87e..acf5d47 100644
--- a/src/application.js
+++ b/src/application.js
@@ -86,6 +86,13 @@ Application.prototype = {
 	    }));
 	this.application.add_action(quitAction);
 
+        let aboutAction = new Gio.SimpleAction({ name: 'about' });
+        aboutAction.connect('activate', Lang.bind(this,
+            function() {
+                this._mainWindow.showAbout();
+            }));
+        this.application.add_action(aboutAction);
+
         let fsAction = new Gio.SimpleAction({ name: 'fullscreen' });
         fsAction.connect('activate', Lang.bind(this,
             function() {
@@ -113,13 +120,18 @@ Application.prototype = {
         this.application.add_action(viewAsAction);
 
 	let menu = new Gio.Menu();
-        menu.append(_("Fullscreen"), 'app.fullscreen');
-	menu.append(_("Quit"), 'app.quit');
 
         let viewAs = new Gio.Menu();
         viewAs.append(_("Grid"), 'app.view-as::icon');
         viewAs.append(_("List"), 'app.view-as::list');
-        menu.prepend_section(_("View as"), viewAs);
+        menu.append_section(_("View as"), viewAs);
+
+        let docActions = new Gio.Menu();
+        docActions.append(_("Fullscreen"), 'app.fullscreen');
+        menu.append_section(null, docActions);
+
+        menu.append(_("About Documents"), 'app.about');
+        menu.append(_("Quit"), 'app.quit');
 
 	this.application.set_app_menu(menu);
     },
diff --git a/src/config.js.in b/src/config.js.in
new file mode 100644
index 0000000..519365b
--- /dev/null
+++ b/src/config.js.in
@@ -0,0 +1,3 @@
+const PACKAGE_NAME = '@PACKAGE_NAME@';
+const PACKAGE_VERSION = '@PACKAGE_VERSION@';
+const GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
\ No newline at end of file
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 493b370..7fb6c8c 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -28,6 +28,7 @@ const GtkClutter = imports.gi.GtkClutter;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
+const Config = imports.config;
 const Embed = imports.embed;
 const Global = imports.global;
 const Searchbar = imports.searchbar;
@@ -283,5 +284,31 @@ MainWindow.prototype = {
         this._saveWindowGeometry();
 
         return false;
+    },
+
+    showAbout: function() {
+        let aboutDialog = new Gtk.AboutDialog();
+
+        aboutDialog.artists = [ 'Jakub Steiner <jimmac gmail com>' ];
+        aboutDialog.authors = [ 'Cosimo Cecchi <cosimoc gnome org>',
+                                'Florian M' + String.fromCharCode(0x00FC) + 'llner <fmuellner gnome org>',
+                                'William Jon McCann <william jon mccann gmail com>' ];
+        aboutDialog.translator_credits = _("translator-credits");
+        aboutDialog.program_name = _("GNOME Documents");
+        aboutDialog.comments = _("A document manager application");
+        aboutDialog.copyright = 'Copyright ' + String.fromCharCode(0x00A9) + ' 2011' + String.fromCharCode(0x2013) + '2012 Red Hat, Inc.';
+        aboutDialog.license_type = Gtk.License.GPL_2_0;
+        aboutDialog.logo_icon_name = 'gnome-documents';
+        aboutDialog.version = Config.PACKAGE_VERSION;
+        aboutDialog.website = 'http://live.gnome.org/GnomeDocuments';
+        aboutDialog.wrap_license = true;
+
+        aboutDialog.modal = true;
+        aboutDialog.transient_for = this.window;
+
+        aboutDialog.show();
+        aboutDialog.connect('response', function() {
+            aboutDialog.destroy();
+        });
     }
 };



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