Ejemplo n.º 1
0
GamesScoresBackend *
games_scores_backend_new (GamesScoreStyle style,
                          char *base_name,
                          char *name)
{
  GamesScoresBackend *backend;
  char *pkguserdatadir;

  backend = GAMES_SCORES_BACKEND (g_object_new (GAMES_TYPE_SCORES_BACKEND,
                                                NULL));

  backend->priv->timestamp = 0;
  backend->priv->style = style;
  backend->priv->scores_list = NULL;
  pkguserdatadir = g_build_filename (g_get_user_data_dir (), base_name, NULL);
  backend->priv->filename = g_build_filename (pkguserdatadir, name, NULL);

  if (access (pkguserdatadir, O_RDWR) == -1) {
    /* Don't return NULL because games-scores.c does not
     * expect it, and can't do anything about it anyway. */
    mkdir (pkguserdatadir, 0775);
  }
  backend->priv->fd = -1;

  return backend;
}
Ejemplo n.º 2
0
GamesScoresBackend *
games_scores_backend_new (GamesScoreStyle style,
			  char *base_name,
                          char *name)
{
  GamesScoresBackend *backend;
  gchar *fullname;

  backend = GAMES_SCORES_BACKEND (g_object_new (GAMES_TYPE_SCORES_BACKEND,
						NULL));

  if (name[0] == '\0')		/* Name is "" */
    fullname = g_strjoin (".", base_name, "scores", NULL);
  else
    fullname = g_strjoin (".", base_name, name, "scores", NULL);

  backend->priv->timestamp = 0;
  backend->priv->style = style;
  backend->scores_list = NULL;
  backend->priv->filename = g_build_filename (games_runtime_get_directory (GAMES_RUNTIME_SCORES_DIRECTORY),
                                              fullname, NULL);
  g_free (fullname);

  backend->priv->fd = -1;

  return backend;
}
Ejemplo n.º 3
0
static void
games_scores_backend_finalize (GObject *object)
{
  GamesScoresBackend *backend = GAMES_SCORES_BACKEND (object);
  GamesScoresBackendPrivate *priv = backend->priv;

  g_free (priv->filename);
  /* FIXME: more to do? */

  G_OBJECT_CLASS (games_scores_backend_parent_class)->finalize (object);
}