gnome-games r8512 - trunk/libgames-support



Author: chpe
Date: Tue Jan  6 18:20:59 2009
New Revision: 8512
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8512&view=rev

Log:
Fix licence version in about dialogue if GPL3 components are enabled.

Modified:
   trunk/libgames-support/games-runtime.c
   trunk/libgames-support/games-runtime.h
   trunk/libgames-support/games-stock.c

Modified: trunk/libgames-support/games-runtime.c
==============================================================================
--- trunk/libgames-support/games-runtime.c	(original)
+++ trunk/libgames-support/games-runtime.c	Tue Jan  6 18:20:59 2009
@@ -35,6 +35,7 @@
 #include "games-runtime.h"
 
 static char *app_name;
+static int gpl_version;
 static char *cached_directories[GAMES_RUNTIME_LAST_DIRECTORY];
 #ifdef G_OS_WIN32
 static char *module_path;
@@ -121,6 +122,13 @@
   retval = TRUE;
 #endif
 
+#if defined(ENABLE_CARD_THEME_FORMAT_KDE) || defined(ENABLE_CARD_THEME_FORMAT_SLICED) || defined(ENABLE_CARD_THEME_FORMAT_PYSOL)
+  if (strcmp (app_name, "aisleriot") == 0 || strcmp (app_name, "blackjack") == 0) {
+    gpl_version = 3;
+  } else
+#endif
+  gpl_version = 2;
+
   _games_profile_end ("games_runtime_init");
 
   return retval;
@@ -224,3 +232,14 @@
 
   return g_build_filename (dir, name, NULL);
 }
+
+/**
+ * games_runtime_get_gpl_version:
+ *
+ * Returns: the minimum GPL version that the executable is licensed under
+ */
+int
+games_runtime_get_gpl_version (void)
+{
+  return gpl_version;
+}

Modified: trunk/libgames-support/games-runtime.h
==============================================================================
--- trunk/libgames-support/games-runtime.h	(original)
+++ trunk/libgames-support/games-runtime.h	Tue Jan  6 18:20:59 2009
@@ -69,6 +69,8 @@
 char * games_runtime_get_file (GamesRuntimeDirectory directory,
                                const char *name);
 
+int games_runtime_get_gpl_version (void);
+
 G_END_DECLS
 
 #endif /* !GAMES_RUNTIME_H */

Modified: trunk/libgames-support/games-stock.c
==============================================================================
--- trunk/libgames-support/games-stock.c	(original)
+++ trunk/libgames-support/games-stock.c	Tue Jan  6 18:20:59 2009
@@ -395,9 +395,10 @@
   gtk_stock_add_static (games_stock_items, G_N_ELEMENTS (games_stock_items));
 }
 
-/* Returns a GPL 2+ license string for a specific game. */
-gchar *
-games_get_license (const gchar * game_name)
+/* Returns a GPL N+ license string for a specific game. */
+static gchar *
+games_get_license_version (const gchar * game_name,
+                           int version)
 {
   gchar *license_trans, *license_str;
 
@@ -405,7 +406,7 @@
     /* %s is replaced with the name of the game in gnome-games. */
     N_("%s 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 "
+       "the Free Software Foundation; either version %d of the License, or "
        "(at your option) any later version.");
   static const char license1[] =
     N_("%s is distributed in the hope that it will be useful, "
@@ -443,8 +444,21 @@
 #endif /* ! GTK+ 2.8.0 */
 
   license_str =
-    g_strdup_printf (license_trans, game_name, game_name, game_name);
+    g_strdup_printf (license_trans, game_name, version, game_name, game_name);
   g_free (license_trans);
 
   return license_str;
 }
+
+/**
+ * gamess_get_licence:
+ *
+ * Returns: a newly allocated string with a GPL licence notice. The GPL version used
+ *   depends on the game and the configure options and is determined from
+ *   games_runtime_get_gpl_version()
+ */
+gchar *
+games_get_license (const gchar * game_name)
+{
+  return games_get_license_version (game_name, games_runtime_get_gpl_version ());
+}



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