[gnome-games/gsoc-seed-games] [lightsoff] Initial implementation of About dialog.



commit b208513ac0dc693a3bdd4318e11306ee3bfb10df
Author: Tim Horton <hortont svn gnome org>
Date:   Wed Jun 24 17:26:43 2009 -0400

    [lightsoff] Initial implementation of About dialog.

 lightsoff/About.js       |   30 ++++++++++++++++++++++++++++++
 lightsoff/Makefile.am    |    2 ++
 lightsoff/main-window.ui |    1 +
 lightsoff/main.js.in     |    5 +++++
 4 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/lightsoff/About.js b/lightsoff/About.js
new file mode 100644
index 0000000..f34ed25
--- /dev/null
+++ b/lightsoff/About.js
@@ -0,0 +1,30 @@
+Gtk = imports.gi.Gtk;
+GnomeGamesSupport = imports.gi.GnomeGamesSupport;
+
+main = imports.main;
+
+// How do we do translation from Seed?
+
+function show_about_dialog()
+{
+	var about_dialog = new Gtk.AboutDialog();
+	about_dialog.program_name = "Lights Off";
+	about_dialog.version = "1.0";
+	about_dialog.comments = "Turn off all the lights\n\nLights Off is a part of GNOME Games.";
+	about_dialog.copyright = "Copyright \xa9 2009 Tim Horton";
+	about_dialog.license = GnomeGamesSupport.get_license("Gnometris"); // FIXME
+	about_dialog.wrap_license = true;
+	about_dialog.logo_icon_name = "gnome-lightsoff";
+	about_dialog.website = "http://www.gnome.org/projects/gnome-games/";;
+	about_dialog.website_label = "GNOME Games web site"; // this doesn't work for anyone
+
+	about_dialog.set_authors(["Tim Horton"]);
+
+	// TODO: some form of wrapper so we can use gtk_show_about_dialog instead
+	// of faking all of its window-management-related stuff
+
+	about_dialog.set_transient_for(main.window);
+	about_dialog.run();
+	
+	about_dialog.hide();
+}
diff --git a/lightsoff/Makefile.am b/lightsoff/Makefile.am
index 4acb966..782cc70 100644
--- a/lightsoff/Makefile.am
+++ b/lightsoff/Makefile.am
@@ -2,6 +2,7 @@ SUBDIRS = themes
 
 lojsdir = $(pkgdatadir)/lightsoff
 lojs_DATA = \
+	About.js \
 	Arrow.js \
 	Board.js \
 	Light.js \
@@ -23,6 +24,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
 CLEANFILES = main.js $(desktop_DATA)
 
 EXTRA_DIST = \
+	About.js \
 	Arrow.js \
 	Board.js \
 	Light.js \
diff --git a/lightsoff/main-window.ui b/lightsoff/main-window.ui
index d0fe963..8c0ae28 100644
--- a/lightsoff/main-window.ui
+++ b/lightsoff/main-window.ui
@@ -65,6 +65,7 @@
                     <property name="visible">True</property>
                     <child>
                       <object class="GtkImageMenuItem" id="imagemenuitem20">
+                        <signal name="activate" handler="show_about"/>
                         <property name="label">gtk-about</property>
                         <property name="visible">True</property>
                         <property name="use_underline">True</property>
diff --git a/lightsoff/main.js.in b/lightsoff/main.js.in
index d2cc8cf..5684c70 100755
--- a/lightsoff/main.js.in
+++ b/lightsoff/main.js.in
@@ -14,11 +14,16 @@ GnomeGamesSupport.stock_init();
 
 Game = imports.Game;
 Settings = imports.Settings;
+About = imports.About;
 
 handlers = {
 	show_settings: function(selector, ud)
 	{
 		Settings.show_settings();
+	},
+	show_about: function(selector, ud)
+	{
+		About.show_about_dialog();
 	}
 };
 



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