[aisleriot] Simplify code



commit f4e2cbf39f79e6d4646b7929e486f9e68dcb822e
Author: Christian Persch <chpe gnome org>
Date:   Wed Oct 5 20:13:20 2011 +0200

    Simplify code
    
    We only use v3 here, so drop the older bits left over from gnome-games.

 src/ar-stock.c       |   37 ++++++++++---------------------------
 src/lib/ar-runtime.c |   18 ------------------
 src/lib/ar-runtime.h |    1 -
 3 files changed, 10 insertions(+), 46 deletions(-)
---
diff --git a/src/ar-stock.c b/src/ar-stock.c
index bd26cca..307f3c8 100644
--- a/src/ar-stock.c
+++ b/src/ar-stock.c
@@ -251,12 +251,16 @@ ar_stock_init (void)
   gtk_stock_add_static (ar_stock_items, G_N_ELEMENTS (ar_stock_items));
 }
 
-/* Returns a GPL N+ license string for a specific game. */
-static gchar *
-ar_get_licence_version (const gchar * game_name,
-                           int version)
+/**
+ * ar_get_licence:
+ *
+ * Returns: (transfer full): a newly allocated string with a GPL licence notice
+ */
+char *
+ar_get_licence (const gchar *game_name)
 {
-  gchar *license_trans, *license_str;
+  const int version = 3;
+  char *license_trans, *license_str;
 
   static const char license0[] =
     /* %s is replaced with the name of the game in gnome-games. */
@@ -269,35 +273,14 @@ ar_get_licence_version (const gchar * game_name,
        "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.");
-  static const char license2[] =
-    N_("You should have received a copy of the GNU General Public License "
-       "along with %s; if not, write to the Free Software Foundation, Inc., "
-       "51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA");
   static const char license3[] =
     N_("You should have received a copy of the GNU General Public License "
        "along with this program.  If not, see <http://www.gnu.org/licenses/>.");
 
-  if (version >= 3)
-    license_trans = g_strjoin ("\n\n", _(license0), _(license1), _(license3), NULL);
-  else
-    license_trans = g_strjoin ("\n\n", _(license0), _(license1), _(license2), NULL);
-
+  license_trans = g_strjoin ("\n\n", _(license0), _(license1), _(license3), NULL);
   license_str =
     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
- *   ar_runtime_get_gpl_version()
- */
-gchar *
-ar_get_licence (const gchar * game_name)
-{
-  return ar_get_licence_version (game_name, ar_runtime_get_gpl_version ());
-}
diff --git a/src/lib/ar-runtime.c b/src/lib/ar-runtime.c
index f51766f..8c32f74 100644
--- a/src/lib/ar-runtime.c
+++ b/src/lib/ar-runtime.c
@@ -213,7 +213,6 @@ _br_find_exe (GbrInitError *error)
 #endif /* ENABLE_BINRELOC && !G_OS_WIN32 */
 
 static char *app_name;
-static int gpl_version;
 static char *cached_directories[AR_RUNTIME_LAST_DIRECTORY];
 
 typedef struct {
@@ -317,12 +316,6 @@ ar_runtime_init (const char *name)
   retval = TRUE;
 #endif /* ENABLE_BINRELOC */
 
-  if (strcmp (app_name, "aisleriot") == 0) {
-    gpl_version = 3;
-  } else {
-    gpl_version = 2;
-  }
-
   ar_profileend ("ar_runtime_init");
 
   return retval;
@@ -452,17 +445,6 @@ ar_runtime_get_file (ArRuntimeDirectory directory,
 }
 
 /**
- * ar_runtime_get_gpl_version:
- *
- * Returns: the minimum GPL version that the executable is licensed under
- */
-int
-ar_runtime_get_gpl_version (void)
-{
-  return gpl_version;
-}
-
-/**
  * ar_runtime_is_system_prefix:
  *
  * Returns: whether the runtime prefix is "/usr".
diff --git a/src/lib/ar-runtime.h b/src/lib/ar-runtime.h
index f749c0a..a79f80b 100644
--- a/src/lib/ar-runtime.h
+++ b/src/lib/ar-runtime.h
@@ -51,7 +51,6 @@ void            ar_runtime_shutdown         (void);
 const char     *ar_runtime_get_directory    (ArRuntimeDirectory directory);
 char           *ar_runtime_get_file         (ArRuntimeDirectory directory,
                                                 const char *name);
-int             ar_runtime_get_gpl_version  (void);
 gboolean        ar_runtime_is_system_prefix (void);
 
 G_END_DECLS



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