r3275 - in software/ui: data/html src

Miriam Ruiz baby-guest at alioth.debian.org
Sat Jul 7 21:01:14 UTC 2007


Author: baby-guest
Date: 2007-07-07 21:01:14 +0000 (Sat, 07 Jul 2007)
New Revision: 3275

Added:
   software/ui/data/html/about.en.html
   software/ui/src/aux.cpp
   software/ui/src/aux.h
Removed:
   software/ui/data/html/help.en.html
Modified:
   software/ui/src/Makefile.am
   software/ui/src/games.cpp
   software/ui/src/pkgbrowser.cpp
   software/ui/src/ui.fld
Log:
Moved HTMLView to auxiliary file



Copied: software/ui/data/html/about.en.html (from rev 3273, software/ui/data/html/help.en.html)
===================================================================
--- software/ui/data/html/about.en.html	                        (rev 0)
+++ software/ui/data/html/about.en.html	2007-07-07 21:01:14 UTC (rev 3275)
@@ -0,0 +1,18 @@
+<center><h1>GoPlay!</h1></center><br />
+<br />&nbsp;<br />
+Copyright (C) 2007  <a href="mailto:little_miry at yahoo.es">Miriam Ruiz</a><br />
+Copyright (C) 2007  <a href="mailto:enrico at debian.org">Enrico Zini</a><br />
+<br />&nbsp;<br />
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+<br />&nbsp;<br />
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+<br />&nbsp;<br />
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Deleted: software/ui/data/html/help.en.html
===================================================================
--- software/ui/data/html/help.en.html	2007-07-07 20:47:42 UTC (rev 3274)
+++ software/ui/data/html/help.en.html	2007-07-07 21:01:14 UTC (rev 3275)
@@ -1,18 +0,0 @@
-<h1>This Program</h1><br />
-<br />&nbsp;<br />
-Copyright (C) 2007  Miriam Ruiz &lt;little_miry at yahoo.es&gt;<br />
-Copyright (C) 2007  Enrico Zini &lt;enrico at debian.org&gt;<br />
-<br />&nbsp;<br />
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-<br />&nbsp;<br />
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-<br />&nbsp;<br />
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Modified: software/ui/src/Makefile.am
===================================================================
--- software/ui/src/Makefile.am	2007-07-07 20:47:42 UTC (rev 3274)
+++ software/ui/src/Makefile.am	2007-07-07 21:01:14 UTC (rev 3275)
@@ -10,6 +10,7 @@
 	pkgbrowser.cpp \
 	filter.cpp \
 	windows.cpp \
+	aux.cpp \
 	games.cpp
 games_LDFLAGS = $(LIBEPT_LIBS) `fltk-config --ldflags --use-images`
 

Added: software/ui/src/aux.cpp
===================================================================
--- software/ui/src/aux.cpp	                        (rev 0)
+++ software/ui/src/aux.cpp	2007-07-07 21:01:14 UTC (rev 3275)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2007  Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "aux.h"
+#include "common.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <string>
+
+bool HTMLView::ExternalBrowser(const char *uri)
+{
+	pid_t pid = -1;
+	if ((pid=fork()) == -1)
+	{
+		ERROR_PRINTF("fork: %s\n", strerror(errno));
+		return false;
+	}
+
+	if (strchr(uri, '"')) return false; /* No "s allowed in the uri for the moment */
+
+	if (pid) /* A positive (non-negative) PID indicates the parent process */
+		return true;
+
+	/* A zero PID indicates that this is the child process */
+	std::string command = std::string("/usr/bin/x-www-browser \"") + uri +"\"";
+	if (execl("/bin/sh", "sh", "-c", command.c_str(), (char *) 0) == -1)
+		ERROR_PRINTF("exec: %s\n", strerror(errno));
+
+	exit(1); /* This point should never be reached */
+}
+
+HTMLView::HTMLView(int xx, int yy, int ww, int hh, const char *l) : Fl_Help_View(xx, yy, ww, hh, l)
+{
+	link(HTMLView::link_cb);
+}
+
+const char *HTMLView::link_cb(Fl_Widget *w, const char *uri)
+{
+	printf("PackageView::link_cb(): Widget=0x%lX, URI=\"%s\"\n", (unsigned long)w, uri);
+
+	if (!strncasecmp("http:", uri, 5) || !strncasecmp("mailto:", uri, 7) ||
+		!strncasecmp("ftp:", uri, 4) || !strncasecmp("https:", uri, 6))
+	{
+		HTMLView::ExternalBrowser(uri);
+	}
+
+	return NULL;
+}

Added: software/ui/src/aux.h
===================================================================
--- software/ui/src/aux.h	                        (rev 0)
+++ software/ui/src/aux.h	2007-07-07 21:01:14 UTC (rev 3275)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2007  Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _games_aux_h
+#define _games_aux_h
+
+#include <FL/Fl.H>
+#include <FL/Fl_Help_View.H>
+
+class HTMLView : public Fl_Help_View
+{
+public:
+	HTMLView(int xx, int yy, int ww, int hh, const char *l = 0);
+
+	static bool ExternalBrowser(const char *uri);
+
+private:
+	static const char *link_cb(Fl_Widget *w, const char *uri);
+};
+
+#endif

Modified: software/ui/src/games.cpp
===================================================================
--- software/ui/src/games.cpp	2007-07-07 20:47:42 UTC (rev 3274)
+++ software/ui/src/games.cpp	2007-07-07 21:01:14 UTC (rev 3275)
@@ -382,7 +382,7 @@
 		mainui.engine->setInstalledFilter(Engine::ANY);
 
 		mainui.Screenshot(new Fl_PNG_Image(FILE_NO_SCREENSHOT));
-		mainui.AboutView->load(HTMLDIR "/help.en.html");
+		mainui.AboutView->load(HTMLDIR "/about.en.html");
 
 		UpdateUILists(mainui);
 

Modified: software/ui/src/pkgbrowser.cpp
===================================================================
--- software/ui/src/pkgbrowser.cpp	2007-07-07 20:47:42 UTC (rev 3274)
+++ software/ui/src/pkgbrowser.cpp	2007-07-07 21:01:14 UTC (rev 3275)
@@ -32,6 +32,7 @@
 #include "ui.h"
 #include "common.h"
 #include "filter.h"
+#include "aux.h"
 
 #include "Environment.h"
 #include "GamesOptions.h"
@@ -44,12 +45,6 @@
 #include <limits.h>
 #include <sys/stat.h>
 
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
 #include <FL/Fl_PNG_Image.H>
 #include <FL/Fl_JPEG_Image.H>
 #include <FL/Fl_BMP_Image.H>
@@ -494,43 +489,3 @@
 	}
 	return ret;
 }
-
-PackageView::PackageView(int xx, int yy, int ww, int hh, const char *l) : Fl_Help_View(xx, yy, ww, hh, l)
-{
-	link(PackageView::link_cb);
-}
-
-static bool ExternalBrowser(const char *uri)
-{
-	pid_t pid = -1;
-	if ((pid=fork()) == -1)
-	{
-		ERROR_PRINTF("fork: %s\n", strerror(errno));
-		return false;
-	}
-
-	if (strchr(uri, '"')) return false; /* No "s allowed in the uri for the moment */
-
-	if (pid) /* A positive (non-negative) PID indicates the parent process */
-		return true;
-
-	/* A zero PID indicates that this is the child process */
-	string command = string("/usr/bin/x-www-browser \"") + uri +"\"";
-	if (execl("/bin/sh", "sh", "-c", command.c_str(), (char *) 0) == -1)
-		ERROR_PRINTF("exec: %s\n", strerror(errno));
-
-	exit(1); /* This point should never be reached */
-}
-
-const char *PackageView::link_cb(Fl_Widget *w, const char *uri)
-{
-	printf("PackageView::link_cb(): Widget=0x%lX, URI=\"%s\"\n", (unsigned long)w, uri);
-
-	if (!strncasecmp("http:", uri, 5) || !strncasecmp("mailto:", uri, 7) ||
-		!strncasecmp("ftp:", uri, 4) || !strncasecmp("https:", uri, 6))
-	{
-		ExternalBrowser(uri);
-	}
-
-	return NULL;
-}

Modified: software/ui/src/ui.fld
===================================================================
--- software/ui/src/ui.fld	2007-07-07 20:47:42 UTC (rev 3274)
+++ software/ui/src/ui.fld	2007-07-07 21:01:14 UTC (rev 3275)
@@ -8,6 +8,12 @@
 decl {class Engine;} {public
 } 
 
+decl {\#include "common.h"} {selected public
+} 
+
+decl {\#include "aux.h"} {public
+} 
+
 decl {\#include "pkgbrowser.h"} {public
 } 
 
@@ -128,7 +134,7 @@
       }
       Fl_Help_View InfoView {
         xywh {385 260 320 170}
-        class PackageView
+        class HTMLView
       }
     }
     code {Window->size_range(710, 500);} {}
@@ -137,11 +143,12 @@
   }
   Function {CreateAboutWindow()} {open
   } {
-    Fl_Window AboutWindow {open selected
+    Fl_Window AboutWindow {open
       xywh {727 534 520 430} type Double visible
     } {
       Fl_Help_View AboutView {
         xywh {5 75 510 350}
+        class HTMLView
       }
       Fl_Button {} {
         image {../data/icons/Rating.png} xywh {400 5 90 90} box NO_BOX deactivate




More information about the Pkg-games-commits mailing list