[gnome-games] libgames-support: Make all objects private members private
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] libgames-support: Make all objects private members private
- Date: Fri, 21 Jan 2011 01:23:31 +0000 (UTC)
commit 26f088d599f05257f2da6ca7479212643278b9d3
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Jan 21 12:23:20 2011 +1100
libgames-support: Make all objects private members private
aisleriot/lib/ar-card-theme-svg.c | 1 -
libgames-support/Makefile.am | 2 -
libgames-support/eggdesktopfile.h | 61 +++----
libgames-support/eggsmclient.h | 13 +-
libgames-support/games-clock.c | 60 ++++---
libgames-support/games-clock.h | 10 +-
libgames-support/games-conf.h | 130 +++++++-------
libgames-support/games-controls.c | 77 +++++----
libgames-support/games-controls.h | 42 ++---
libgames-support/games-files.c | 41 +++--
libgames-support/games-files.h | 61 +++----
libgames-support/games-frame.c | 37 +++--
libgames-support/games-frame.h | 25 ++--
libgames-support/games-fullscreen-action.h | 31 ++--
libgames-support/games-gridframe.c | 77 +++++----
libgames-support/games-gridframe.h | 37 ++--
libgames-support/games-help.h | 7 +-
libgames-support/games-pause-action.h | 10 +-
libgames-support/games-preimage-private.h | 40 -----
libgames-support/games-preimage.c | 104 +++++++-----
libgames-support/games-preimage.h | 85 +++++-----
libgames-support/games-runtime.h | 27 +--
libgames-support/games-score.h | 1 +
libgames-support/games-scores-backend.c | 19 +-
libgames-support/games-scores-backend.h | 30 ++--
libgames-support/games-scores-dialog-private.h | 53 ------
libgames-support/games-scores-dialog.c | 225 +++++++++++++-----------
libgames-support/games-scores-dialog.h | 28 ++--
libgames-support/games-scores.c | 2 +-
libgames-support/games-scores.h | 78 ++++-----
libgames-support/games-setgid-io.h | 29 ++-
libgames-support/games-settings.h | 21 +--
libgames-support/games-show.h | 17 +-
libgames-support/games-sound.h | 27 +--
libgames-support/games-stock.h | 8 +-
35 files changed, 731 insertions(+), 785 deletions(-)
---
diff --git a/aisleriot/lib/ar-card-theme-svg.c b/aisleriot/lib/ar-card-theme-svg.c
index 7a05d7b..7861049 100644
--- a/aisleriot/lib/ar-card-theme-svg.c
+++ b/aisleriot/lib/ar-card-theme-svg.c
@@ -26,7 +26,6 @@
#include <gtk/gtk.h>
#include <libgames-support/games-preimage.h>
-#include <libgames-support/games-preimage-private.h>
#include <libgames-support/games-runtime.h>
#include <libgames-support/games-string-utils.h>
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index 6b0d4fb..02ffdd3 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -46,7 +46,6 @@ libgames_support_la_SOURCES += \
games-clock.h \
games-preimage.c \
games-preimage.h \
- games-preimage-private.h \
$(NULL)
endif # !HAVE_HILDON
@@ -75,7 +74,6 @@ libgames_support_la_SOURCES += \
games-scores.h \
games-scores-dialog.c \
games-scores-dialog.h \
- games-scores-dialog-private.h \
games-controls.c \
games-controls.h \
games-scores-backend.c \
diff --git a/libgames-support/eggdesktopfile.h b/libgames-support/eggdesktopfile.h
index 18fe463..8fdd6f9 100644
--- a/libgames-support/eggdesktopfile.h
+++ b/libgames-support/eggdesktopfile.h
@@ -35,17 +35,16 @@ typedef enum {
} EggDesktopFileType;
EggDesktopFile *egg_desktop_file_new (const char *desktop_file_path,
- GError **error);
+ GError **error);
EggDesktopFile *egg_desktop_file_new_from_data_dirs (const char *desktop_file_path,
- GError **error);
+ GError **error);
EggDesktopFile *egg_desktop_file_new_from_dirs (const char *desktop_file_path,
- const char **search_dirs,
- GError **error);
+ const char **search_dirs,
+ GError **error);
EggDesktopFile *egg_desktop_file_new_from_key_file (GKeyFile *key_file,
- const char *source,
- GError **error);
-
+ const char *source,
+ GError **error);
void egg_desktop_file_free (EggDesktopFile *desktop_file);
const char *egg_desktop_file_get_source (EggDesktopFile *desktop_file);
@@ -56,20 +55,20 @@ const char *egg_desktop_file_get_name (EggDesktopFile *deskto
const char *egg_desktop_file_get_icon (EggDesktopFile *desktop_file);
gboolean egg_desktop_file_can_launch (EggDesktopFile *desktop_file,
- const char *desktop_environment);
+ const char *desktop_environment);
gboolean egg_desktop_file_accepts_documents (EggDesktopFile *desktop_file);
gboolean egg_desktop_file_accepts_multiple (EggDesktopFile *desktop_file);
gboolean egg_desktop_file_accepts_uris (EggDesktopFile *desktop_file);
char *egg_desktop_file_parse_exec (EggDesktopFile *desktop_file,
- GSList *documents,
- GError **error);
+ GSList *documents,
+ GError **error);
gboolean egg_desktop_file_launch (EggDesktopFile *desktop_file,
- GSList *documents,
- GError **error,
- ...) G_GNUC_NULL_TERMINATED;
+ GSList *documents,
+ GError **error,
+ ...) G_GNUC_NULL_TERMINATED;
typedef enum {
EGG_DESKTOP_FILE_LAUNCH_CLEARENV = 1,
@@ -112,30 +111,30 @@ typedef enum {
/* Accessors */
gboolean egg_desktop_file_has_key (EggDesktopFile *desktop_file,
- const char *key,
- GError **error);
+ const char *key,
+ GError **error);
char *egg_desktop_file_get_string (EggDesktopFile *desktop_file,
- const char *key,
- GError **error) G_GNUC_MALLOC;
+ const char *key,
+ GError **error) G_GNUC_MALLOC;
char *egg_desktop_file_get_locale_string (EggDesktopFile *desktop_file,
- const char *key,
- const char *locale,
- GError **error) G_GNUC_MALLOC;
+ const char *key,
+ const char *locale,
+ GError **error) G_GNUC_MALLOC;
gboolean egg_desktop_file_get_boolean (EggDesktopFile *desktop_file,
- const char *key,
- GError **error);
+ const char *key,
+ GError **error);
double egg_desktop_file_get_numeric (EggDesktopFile *desktop_file,
- const char *key,
- GError **error);
+ const char *key,
+ GError **error);
char **egg_desktop_file_get_string_list (EggDesktopFile *desktop_file,
- const char *key,
- gsize *length,
- GError **error) G_GNUC_MALLOC;
+ const char *key,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
char **egg_desktop_file_get_locale_string_list (EggDesktopFile *desktop_file,
- const char *key,
- const char *locale,
- gsize *length,
- GError **error) G_GNUC_MALLOC;
+ const char *key,
+ const char *locale,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
/* Errors */
diff --git a/libgames-support/eggsmclient.h b/libgames-support/eggsmclient.h
index f13bcec..64000ef 100644
--- a/libgames-support/eggsmclient.h
+++ b/libgames-support/eggsmclient.h
@@ -51,7 +51,6 @@ typedef enum {
struct _EggSMClient
{
GObject parent;
-
};
struct _EggSMClientClass
@@ -103,19 +102,19 @@ GKeyFile *egg_sm_client_get_state_file (EggSMClient *client);
/* Alternate means of saving state */
void egg_sm_client_set_restart_command (EggSMClient *client,
- int argc,
- const char **argv);
+ int argc,
+ const char **argv);
void egg_sm_client_set_discard_command (EggSMClient *client,
- int argc,
- const char **argv);
+ int argc,
+ const char **argv);
/* Handling "quit_requested" signal */
void egg_sm_client_will_quit (EggSMClient *client,
- gboolean will_quit);
+ gboolean will_quit);
/* Initiate a logout/reboot/shutdown */
gboolean egg_sm_client_end_session (EggSMClientEndStyle style,
- gboolean request_confirmation);
+ gboolean request_confirmation);
G_END_DECLS
diff --git a/libgames-support/games-clock.c b/libgames-support/games-clock.c
index 2b0a4d8..dca49d7 100644
--- a/libgames-support/games-clock.c
+++ b/libgames-support/games-clock.c
@@ -15,6 +15,14 @@
G_DEFINE_TYPE (GamesClock, games_clock, GTK_TYPE_LABEL)
+struct GamesClockPrivate {
+ guint update_timeout_id;
+ gboolean update;
+ gboolean started;
+ time_t start_time;
+ time_t stop_time;
+};
+
static void
clock_paint (GamesClock *clock_widget)
{
@@ -47,19 +55,19 @@ games_clock_update (GamesClock *clock_widget)
static void
games_clock_start_timer (GamesClock *clock_widget)
{
- if (clock_widget->update_timeout_id != 0)
+ if (clock_widget->priv->update_timeout_id != 0)
return;
- clock_widget->update_timeout_id =
+ clock_widget->priv->update_timeout_id =
gdk_threads_add_timeout_seconds (1, (GSourceFunc) games_clock_update, clock_widget);
}
static void
games_clock_stop_timer (GamesClock *clock_widget)
{
- if (clock_widget->update_timeout_id != 0) {
- g_source_remove (clock_widget->update_timeout_id);
- clock_widget->update_timeout_id = 0;
+ if (clock_widget->priv->update_timeout_id != 0) {
+ g_source_remove (clock_widget->priv->update_timeout_id);
+ clock_widget->priv->update_timeout_id = 0;
}
}
@@ -79,15 +87,17 @@ games_clock_class_init (GamesClockClass * klass)
GObjectClass *object_class = (GObjectClass *) klass;
object_class->finalize = games_clock_finalize;
+
+ g_type_class_add_private (object_class, sizeof (GamesClockPrivate));
}
static void
games_clock_init (GamesClock *clock_widget)
{
- clock_widget->update_timeout_id = 0;
- clock_widget->start_time = clock_widget->stop_time = 0;
- clock_widget->started = FALSE;
- clock_widget->update = TRUE;
+ clock_widget->priv->update_timeout_id = 0;
+ clock_widget->priv->start_time = clock_widget->priv->stop_time = 0;
+ clock_widget->priv->started = FALSE;
+ clock_widget->priv->update = TRUE;
/* FIXMEchpe: call clock_paint() instead */
gtk_label_set_text (GTK_LABEL (clock_widget), "00:00:00");
@@ -119,13 +129,13 @@ games_clock_start (GamesClock *clock_widget)
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
- if (clock_widget->started)
+ if (clock_widget->priv->started)
return; /* nothing to do */
- clock_widget->started = TRUE;
- clock_widget->start_time = time (NULL) - (clock_widget->stop_time - clock_widget->start_time);
+ clock_widget->priv->started = TRUE;
+ clock_widget->priv->start_time = time (NULL) - (clock_widget->priv->stop_time - clock_widget->priv->start_time);
- if (clock_widget->update)
+ if (clock_widget->priv->update)
games_clock_start_timer (clock_widget);
}
@@ -140,7 +150,7 @@ games_clock_is_started (GamesClock *clock_widget)
{
g_return_val_if_fail (GAMES_IS_CLOCK (clock_widget), FALSE);
- return clock_widget->started;
+ return clock_widget->priv->started;
}
/**
@@ -155,11 +165,11 @@ games_clock_stop (GamesClock *clock_widget)
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
- if (!clock_widget->started)
+ if (!clock_widget->priv->started)
return;
- clock_widget->started = FALSE;
- clock_widget->stop_time = time (NULL);
+ clock_widget->priv->started = FALSE;
+ clock_widget->priv->stop_time = time (NULL);
games_clock_stop_timer (clock_widget);
clock_paint (clock_widget);
@@ -176,7 +186,7 @@ games_clock_reset (GamesClock *clock_widget)
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
- clock_widget->start_time = clock_widget->stop_time = time (NULL);
+ clock_widget->priv->start_time = clock_widget->priv->stop_time = time (NULL);
clock_paint (clock_widget);
}
@@ -192,10 +202,10 @@ games_clock_get_seconds (GamesClock *clock_widget)
{
g_return_val_if_fail (GAMES_IS_CLOCK (clock_widget), 0);
- if (clock_widget->started)
- return time (NULL) - clock_widget->start_time;
+ if (clock_widget->priv->started)
+ return time (NULL) - clock_widget->priv->start_time;
else
- return clock_widget->stop_time - clock_widget->start_time;
+ return clock_widget->priv->stop_time - clock_widget->priv->start_time;
}
/**
@@ -211,12 +221,12 @@ games_clock_add_seconds (GamesClock *clock_widget,
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
- if (!clock_widget->started) {
+ if (!clock_widget->priv->started) {
g_warning ("Clock not started, cannot add seconds!\n");
return;
}
- clock_widget->start_time -= seconds;
+ clock_widget->priv->start_time -= seconds;
clock_paint (clock_widget);
}
@@ -236,10 +246,10 @@ games_clock_set_update (GamesClock *clock_widget,
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
do_update = do_update != FALSE;
- if (do_update == clock_widget->update)
+ if (do_update == clock_widget->priv->update)
return;
- clock_widget->update = do_update;
+ clock_widget->priv->update = do_update;
if (do_update) {
games_clock_start_timer (clock_widget);
clock_paint (clock_widget);
diff --git a/libgames-support/games-clock.h b/libgames-support/games-clock.h
index e792018..8958c04 100644
--- a/libgames-support/games-clock.h
+++ b/libgames-support/games-clock.h
@@ -23,14 +23,12 @@ G_BEGIN_DECLS
#define GAMES_IS_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_CLOCK))
#define GAMES_IS_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_CLOCK))
+typedef struct GamesClockPrivate GamesClockPrivate;
+
typedef struct {
GtkLabel label;
-
- guint update_timeout_id;
- gboolean update;
- gboolean started;
- time_t start_time;
- time_t stop_time;
+ /*< private >*/
+ GamesClockPrivate *priv;
} GamesClock;
typedef struct {
diff --git a/libgames-support/games-conf.h b/libgames-support/games-conf.h
index 23b701c..7b62f88 100644
--- a/libgames-support/games-conf.h
+++ b/libgames-support/games-conf.h
@@ -35,8 +35,7 @@ typedef struct GamesConfPrivate GamesConfPrivate;
typedef struct {
GObject parent_instance;
-
- /*< private > */
+ /*< private >*/
GamesConfPrivate *priv;
} GamesConf;
@@ -44,68 +43,71 @@ typedef struct {
GObjectClass parent_class;
} GamesConfClass;
-GType games_conf_get_type (void);
-
-gboolean games_conf_initialise (const char *game_name);
-
-void games_conf_shutdown (void);
-
-GamesConf *games_conf_get_default (void);
-
-void games_conf_save (void);
-
-char *games_conf_get_string (const char *group, const char *key,
- GError ** error);
-
-char *games_conf_get_string_with_default (const char *group, const char *key,
- const char *def_value);
-
-void games_conf_set_string (const char *group, const char *key,
- const char *value);
-
-char **games_conf_get_string_list (const char *group, const char *key,
- gsize * n_values, GError ** error);
-
-void games_conf_set_string_list (const char *group, const char *key,
- const char * const *values, gsize n_values);
-
-int games_conf_get_integer (const char *group, const char *key,
- GError ** error);
-
-int games_conf_get_integer_with_default (const char *group, const char *key,
- int def_value);
-
-void games_conf_set_integer (const char *group, const char *key, int value);
-
-int *games_conf_get_integer_list (const char *group, const char *key,
- gsize * n_values, GError ** error);
-
-void games_conf_set_integer_list (const char *group, const char *key,
- int *values, gsize n_values);
-
-gboolean games_conf_get_boolean (const char *group, const char *key,
- GError ** error);
-
-gboolean games_conf_get_boolean_with_default (const char *group, const char *key,
- gboolean def_value);
-
-void games_conf_set_boolean (const char *group, const char *key,
- gboolean value);
-
-double games_conf_get_double (const char *group, const char *key,
- GError ** error);
-
-void games_conf_set_double (const char *group, const char *key, double value);
-
-guint games_conf_get_keyval (const char *group, const char *key,
- GError ** error);
-
-guint games_conf_get_keyval_with_default (const char *group, const char *key,
- guint default_keyval);
-
-void games_conf_set_keyval (const char *group, const char *key, guint value);
-
-void games_conf_add_window (GtkWindow *window, const char *group);
+GType games_conf_get_type (void);
+gboolean games_conf_initialise (const char *game_name);
+void games_conf_shutdown (void);
+GamesConf *games_conf_get_default (void);
+void games_conf_save (void);
+char *games_conf_get_string (const char *group,
+ const char *key,
+ GError ** error);
+char *games_conf_get_string_with_default (const char *group,
+ const char *key,
+ const char *def_value);
+void games_conf_set_string (const char *group,
+ const char *key,
+ const char *value);
+char **games_conf_get_string_list (const char *group,
+ const char *key,
+ gsize * n_values,
+ GError ** error);
+void games_conf_set_string_list (const char *group,
+ const char *key,
+ const char * const *values,
+ gsize n_values);
+int games_conf_get_integer (const char *group,
+ const char *key,
+ GError ** error);
+int games_conf_get_integer_with_default (const char *group,
+ const char *key,
+ int def_value);
+void games_conf_set_integer (const char *group,
+ const char *key,
+ int value);
+int *games_conf_get_integer_list (const char *group,
+ const char *key,
+ gsize * n_values,
+ GError ** error);
+void games_conf_set_integer_list (const char *group,
+ const char *key,
+ int *values,
+ gsize n_values);
+gboolean games_conf_get_boolean (const char *group,
+ const char *key,
+ GError ** error);
+gboolean games_conf_get_boolean_with_default (const char *group,
+ const char *key,
+ gboolean def_value);
+void games_conf_set_boolean (const char *group,
+ const char *key,
+ gboolean value);
+double games_conf_get_double (const char *group,
+ const char *key,
+ GError ** error);
+void games_conf_set_double (const char *group,
+ const char *key,
+ double value);
+guint games_conf_get_keyval (const char *group,
+ const char *key,
+ GError ** error);
+guint games_conf_get_keyval_with_default (const char *group,
+ const char *key,
+ guint default_keyval);
+void games_conf_set_keyval (const char *group,
+ const char *key,
+ guint value);
+void games_conf_add_window (GtkWindow *window,
+ const char *group);
G_END_DECLS
diff --git a/libgames-support/games-controls.c b/libgames-support/games-controls.c
index 12f475a..e97a53e 100644
--- a/libgames-support/games-controls.c
+++ b/libgames-support/games-controls.c
@@ -38,6 +38,19 @@ enum {
N_COLUMNS
};
+/* Class implementation */
+
+G_DEFINE_TYPE (GamesControlsList, games_controls_list, GTK_TYPE_SCROLLED_WINDOW)
+
+struct GamesControlsListPrivate {
+ GtkTreeModel *model;
+ GtkListStore *store;
+ GtkWidget *view;
+
+ char *conf_group;
+ gulong notify_handler_id;
+};
+
static void
accel_edited_cb (GtkCellRendererAccel *cell,
char *path_string,
@@ -54,13 +67,13 @@ accel_edited_cb (GtkCellRendererAccel *cell,
if (!path)
return;
- if (!gtk_tree_model_get_iter (list->model, &iter, path)) {
+ if (!gtk_tree_model_get_iter (list->priv->model, &iter, path)) {
gtk_tree_path_free (path);
return;
}
gtk_tree_path_free (path);
- gtk_tree_model_get (list->model, &iter,
+ gtk_tree_model_get (list->priv->model, &iter,
CONFKEY_COLUMN, &conf_key,
-1);
if (!conf_key)
@@ -68,7 +81,7 @@ accel_edited_cb (GtkCellRendererAccel *cell,
/* Note: the model is updated in the conf notification callback */
/* FIXME: what to do with the modifiers? */
- games_conf_set_keyval (list->conf_group, conf_key, keyval);
+ games_conf_set_keyval (list->priv->conf_group, conf_key, keyval);
g_free (conf_key);
}
@@ -86,13 +99,13 @@ accel_cleared_cb (GtkCellRendererAccel *cell,
if (!path)
return;
- if (!gtk_tree_model_get_iter (list->model, &iter, path)) {
+ if (!gtk_tree_model_get_iter (list->priv->model, &iter, path)) {
gtk_tree_path_free (path);
return;
}
gtk_tree_path_free (path);
- gtk_tree_model_get (list->model, &iter,
+ gtk_tree_model_get (list->priv->model, &iter,
CONFKEY_COLUMN, &conf_key,
DEFAULT_KEYCODE_COLUMN, &default_keyval,
-1);
@@ -101,7 +114,7 @@ accel_cleared_cb (GtkCellRendererAccel *cell,
/* Note: the model is updated in the conf notification callback */
/* FIXME: what to do with the modifiers? */
- games_conf_set_keyval (list->conf_group, conf_key, default_keyval);
+ games_conf_set_keyval (list->priv->conf_group, conf_key, default_keyval);
g_free (conf_key);
}
@@ -114,30 +127,30 @@ conf_value_changed_cb (GamesConf *conf,
GtkTreeIter iter;
gboolean valid;
- if ((group == NULL && list->conf_group != NULL) ||
- (group != NULL && (list->conf_group == NULL ||
- strcmp (group, list->conf_group) != 0)))
+ if ((group == NULL && list->priv->conf_group != NULL) ||
+ (group != NULL && (list->priv->conf_group == NULL ||
+ strcmp (group, list->priv->conf_group) != 0)))
return;
/* find our gconf key in the list store and update it */
- valid = gtk_tree_model_get_iter_first (list->model, &iter);
+ valid = gtk_tree_model_get_iter_first (list->priv->model, &iter);
while (valid) {
char *conf_key;
- gtk_tree_model_get (list->model, &iter,
+ gtk_tree_model_get (list->priv->model, &iter,
CONFKEY_COLUMN, &conf_key,
-1);
if (strcmp (key, conf_key) == 0) {
guint keyval, default_keyval;
- gtk_tree_model_get (list->model, &iter,
+ gtk_tree_model_get (list->priv->model, &iter,
DEFAULT_KEYCODE_COLUMN, &default_keyval,
-1);
- keyval = games_conf_get_keyval_with_default (list->conf_group, key, default_keyval);
+ keyval = games_conf_get_keyval_with_default (list->priv->conf_group, key, default_keyval);
- gtk_list_store_set (list->store, &iter,
+ gtk_list_store_set (list->priv->store, &iter,
KEYCODE_COLUMN, keyval,
KEYMODS_COLUMN, 0 /* FIXME? */,
-1);
@@ -147,14 +160,10 @@ conf_value_changed_cb (GamesConf *conf,
}
g_free (conf_key);
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list->store), &iter);
+ valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list->priv->store), &iter);
}
}
-/* Class implementation */
-
-G_DEFINE_TYPE (GamesControlsList, games_controls_list, GTK_TYPE_SCROLLED_WINDOW)
-
static void
games_controls_list_init (GamesControlsList *list)
{
@@ -185,14 +194,14 @@ games_controls_list_constructor (GType type,
G_TYPE_UINT,
G_TYPE_UINT,
G_TYPE_UINT);
- list->store = store;
- list->model = GTK_TREE_MODEL (store);
+ list->priv->store = store;
+ list->priv->model = GTK_TREE_MODEL (store);
- list->view = gtk_tree_view_new_with_model (list->model);
+ list->priv->view = gtk_tree_view_new_with_model (list->priv->model);
g_object_unref (store);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (list->view), FALSE);
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (list->view), FALSE);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (list->priv->view), FALSE);
+ gtk_tree_view_set_enable_search (GTK_TREE_VIEW (list->priv->view), FALSE);
/* label column */
label_renderer = gtk_cell_renderer_text_new ();
@@ -200,7 +209,7 @@ games_controls_list_constructor (GType type,
label_renderer,
"text", LABEL_COLUMN,
NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (list->view), column);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (list->priv->view), column);
/* key column */
key_renderer = gtk_cell_renderer_accel_new ();
@@ -218,11 +227,11 @@ games_controls_list_constructor (GType type,
"accel-key", KEYCODE_COLUMN,
"accel-mods", KEYMODS_COLUMN,
NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (list->view), column);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (list->priv->view), column);
- gtk_container_add (GTK_CONTAINER (scrolled_window), list->view);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), list->priv->view);
- list->notify_handler_id = g_signal_connect (games_conf_get_default (),
+ list->priv->notify_handler_id = g_signal_connect (games_conf_get_default (),
"value-changed",
G_CALLBACK (conf_value_changed_cb),
list);
@@ -236,9 +245,9 @@ games_controls_list_finalize (GObject *object)
{
GamesControlsList *list = GAMES_CONTROLS_LIST (object);
- g_signal_handler_disconnect (games_conf_get_default (), list->notify_handler_id);
+ g_signal_handler_disconnect (games_conf_get_default (), list->priv->notify_handler_id);
- g_free (list->conf_group);
+ g_free (list->priv->conf_group);
G_OBJECT_CLASS (games_controls_list_parent_class)->finalize (object);
}
@@ -250,6 +259,8 @@ games_controls_list_class_init (GamesControlsListClass *klass)
gobject_class->constructor = games_controls_list_constructor;
gobject_class->finalize = games_controls_list_finalize;
+
+ g_type_class_add_private (gobject_class, sizeof (GamesControlsListPrivate));
}
/* Public API */
@@ -265,7 +276,7 @@ games_controls_list_new (const char *conf_group)
"shadow-type", GTK_SHADOW_IN,
NULL);
- list->conf_group = g_strdup (conf_group);
+ list->priv->conf_group = g_strdup (conf_group);
return GTK_WIDGET (list);
}
@@ -285,9 +296,9 @@ games_controls_list_add_control (GamesControlsList *list,
if (!label)
label = _("Unknown Command");
- keyval = games_conf_get_keyval_with_default (list->conf_group, conf_key, default_keyval);
+ keyval = games_conf_get_keyval_with_default (list->priv->conf_group, conf_key, default_keyval);
- gtk_list_store_insert_with_values (list->store, &iter, -1,
+ gtk_list_store_insert_with_values (list->priv->store, &iter, -1,
CONFKEY_COLUMN, conf_key,
LABEL_COLUMN, label,
KEYCODE_COLUMN, keyval,
diff --git a/libgames-support/games-controls.h b/libgames-support/games-controls.h
index e28bb17..5d641e2 100644
--- a/libgames-support/games-controls.h
+++ b/libgames-support/games-controls.h
@@ -19,35 +19,27 @@ G_BEGIN_DECLS
#define GAMES_IS_CONTROLS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_CONTROLS_LIST))
#define GAMES_CONTROLS_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_CONTROLS_LIST, GamesControlsListClass))
-typedef struct _GamesControlsList GamesControlsList;
-typedef struct _GamesControlsListClass GamesControlsListClass;
+typedef struct GamesControlsListPrivate GamesControlsListPrivate;
-struct _GamesControlsList {
+typedef struct {
GtkScrolledWindow parent_instance;
+ /*< private >*/
+ GamesControlsListPrivate *priv;
+} GamesControlsList;
- GtkTreeModel *model;
- GtkListStore *store;
- GtkWidget *view;
-
- char *conf_group;
- gulong notify_handler_id;
-};
-
-struct _GamesControlsListClass {
+typedef struct {
GtkScrolledWindowClass parent_class;
-};
-
-GType games_controls_list_get_type (void);
-
-GtkWidget *games_controls_list_new (const char *conf_group);
-
-void games_controls_list_add_control (GamesControlsList *list,
- const char *conf_key,
- const char *label,
- guint default_keyval);
-void games_controls_list_add_controls (GamesControlsList *list,
- const char *first_conf_key,
- ...) G_GNUC_NULL_TERMINATED;
+} GamesControlsListClass;
+
+GType games_controls_list_get_type (void);
+GtkWidget *games_controls_list_new (const char *conf_group);
+void games_controls_list_add_control (GamesControlsList *list,
+ const char *conf_key,
+ const char *label,
+ guint default_keyval);
+void games_controls_list_add_controls (GamesControlsList *list,
+ const char *first_conf_key,
+ ...) G_GNUC_NULL_TERMINATED;
G_END_DECLS
#endif /* __GAMES_CONTROLS_H__ */
diff --git a/libgames-support/games-files.c b/libgames-support/games-files.c
index 71bfa9d..7f8e483 100644
--- a/libgames-support/games-files.c
+++ b/libgames-support/games-files.c
@@ -46,16 +46,21 @@
G_DEFINE_TYPE (GamesFileList, games_file_list, G_TYPE_OBJECT)
+struct GamesFileListPrivate
+{
+ GList *list;
+};
+
/* Remove duplicate names form the list */
- static void
- games_file_list_remove_duplicates (GamesFileList * filelist)
+static void
+games_file_list_remove_duplicates (GamesFileList * filelist)
{
GList *l;
if (filelist == NULL)
return;
- l = filelist->list;
+ l = filelist->priv->list;
if ((l == NULL) || (l->next == NULL))
return;
@@ -123,11 +128,11 @@ games_file_list_new (const gchar * glob, ...)
filelist = g_object_new (GAMES_FILE_LIST_TYPE, NULL);
va_start (paths, glob);
- filelist->list = games_file_list_new_internal (glob, paths);
+ filelist->priv->list = games_file_list_new_internal (glob, paths);
va_end (paths);
- filelist->list =
- g_list_sort (filelist->list, (GCompareFunc) g_utf8_collate);
+ filelist->priv->list =
+ g_list_sort (filelist->priv->list, (GCompareFunc) g_utf8_collate);
games_file_list_remove_duplicates (filelist);
return filelist;
@@ -137,7 +142,7 @@ games_file_list_new (const gchar * glob, ...)
void
games_file_list_transform_basename (GamesFileList * filelist)
{
- GList *current = filelist->list;
+ GList *current = filelist->priv->list;
gchar *shortname;
while (current) {
@@ -262,16 +267,16 @@ games_file_list_new_images (const gchar * path1, ...)
filelist = g_object_new (GAMES_FILE_LIST_TYPE, NULL);
- filelist->list = games_file_list_new_images_single (path1);
+ filelist->priv->list = games_file_list_new_images_single (path1);
va_start (paths, path1);
while ((pathentry = va_arg (paths, gchar *)) != NULL) {
- list = g_list_concat (filelist->list,
+ list = g_list_concat (filelist->priv->list,
games_file_list_new_images_single (pathentry));
}
va_end (paths);
- filelist->list =
- g_list_sort (filelist->list, (GCompareFunc) g_utf8_collate);
+ filelist->priv->list =
+ g_list_sort (filelist->priv->list, (GCompareFunc) g_utf8_collate);
games_file_list_remove_duplicates (filelist);
return filelist;
@@ -299,7 +304,7 @@ games_file_list_create_widget (GamesFileList * filelist,
gint itemno;
GtkComboBox *widget;
gchar *visible, *string;
- GList *iter = filelist->list;
+ GList *iter = filelist->priv->list;
gboolean found = FALSE;
widget = GTK_COMBO_BOX (gtk_combo_box_text_new ());
@@ -360,7 +365,7 @@ void
games_file_list_for_each (GamesFileList * filelist, GFunc function,
gpointer userdata)
{
- g_list_foreach (filelist->list, function, userdata);
+ g_list_foreach (filelist->priv->list, function, userdata);
}
/**
@@ -384,7 +389,7 @@ games_file_list_find (GamesFileList * filelist, GCompareFunc function,
{
GList *element;
- element = g_list_find_custom (filelist->list, userdata, function);
+ element = g_list_find_custom (filelist->priv->list, userdata, function);
return element ? g_strdup ((gchar *) element->data) : NULL;
}
@@ -402,7 +407,7 @@ games_file_list_find (GamesFileList * filelist, GCompareFunc function,
gchar *
games_file_list_get_nth (GamesFileList * filelist, gint n)
{
- return (gchar *) g_list_nth_data (filelist->list, n);
+ return (gchar *) g_list_nth_data (filelist->priv->list, n);
}
static void
@@ -413,8 +418,8 @@ games_file_list_finalize (GObject * object)
/* For simplicity we haven't used the dispose method since we can
* guarantee that everything this references doesn't reference itself. */
- g_list_foreach (filelist->list, (GFunc) g_free, NULL);
- g_list_free (filelist->list);
+ g_list_foreach (filelist->priv->list, (GFunc) g_free, NULL);
+ g_list_free (filelist->priv->list);
G_OBJECT_CLASS (games_file_list_parent_class)->finalize (object);
}
@@ -425,6 +430,8 @@ games_file_list_class_init (GamesFileListClass * class)
GObjectClass *oclass = G_OBJECT_CLASS (class);
oclass->finalize = games_file_list_finalize;
+
+ g_type_class_add_private (oclass, sizeof (GamesFileListPrivate));
}
static void
diff --git a/libgames-support/games-files.h b/libgames-support/games-files.h
index 2d49cc5..30e1294 100644
--- a/libgames-support/games-files.h
+++ b/libgames-support/games-files.h
@@ -24,48 +24,43 @@
G_BEGIN_DECLS
-typedef struct _GamesFileList GamesFileList;
-typedef struct _GamesFileListClass GamesFileListClass;
+typedef struct GamesFileListPrivate GamesFileListPrivate;
-struct _GamesFileList {
+typedef struct {
GObject parent;
+ /*< private >*/
+ GamesFileListPrivate *priv;
+} GamesFileList;
- GList *list;
-};
-
-struct _GamesFileListClass {
+typedef struct {
GObjectClass parent;
+} GamesFileListClass;
+
+enum {
+ GAMES_FILE_LIST_REMOVE_EXTENSION = 1 << 0,
+ GAMES_FILE_LIST_REPLACE_UNDERSCORES = 1 << 1,
};
#define GAMES_FILE_LIST_TYPE (games_file_list_get_type ())
#define GAMES_FILE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_FILE_LIST_TYPE, GamesFileList))
-GType games_file_list_get_type (void);
-
-GamesFileList *
-games_file_list_new (const gchar * glob, ...)
- G_GNUC_NULL_TERMINATED;
- GamesFileList *games_file_list_new_images (const gchar * path1,
- ...) G_GNUC_NULL_TERMINATED;
-
- void games_file_list_transform_basename (GamesFileList * list);
-
- void games_file_list_for_each (GamesFileList * filelist, GFunc function,
- gpointer userdata);
-
- gchar *games_file_list_find (GamesFileList * filelist,
- GCompareFunc function, gpointer userdata);
-
- gchar *games_file_list_get_nth (GamesFileList * filelist, gint n);
-
- enum {
- GAMES_FILE_LIST_REMOVE_EXTENSION = 1 << 0,
- GAMES_FILE_LIST_REPLACE_UNDERSCORES = 1 << 1,
- };
-
- GtkWidget *games_file_list_create_widget (GamesFileList * filelist,
- const gchar * selection,
- guint flags);
+GType games_file_list_get_type (void);
+GamesFileList *games_file_list_new (const gchar * glob,
+ ...) G_GNUC_NULL_TERMINATED;
+GamesFileList *games_file_list_new_images (const gchar * path1,
+ ...) G_GNUC_NULL_TERMINATED;
+void games_file_list_transform_basename (GamesFileList * list);
+void games_file_list_for_each (GamesFileList * filelist,
+ GFunc function,
+ gpointer userdata);
+gchar *games_file_list_find (GamesFileList * filelist,
+ GCompareFunc function,
+ gpointer userdata);
+gchar *games_file_list_get_nth (GamesFileList * filelist,
+ gint n);
+GtkWidget *games_file_list_create_widget (GamesFileList * filelist,
+ const gchar * selection,
+ guint flags);
G_END_DECLS
diff --git a/libgames-support/games-frame.c b/libgames-support/games-frame.c
index 524284e..7d11e03 100644
--- a/libgames-support/games-frame.c
+++ b/libgames-support/games-frame.c
@@ -34,6 +34,11 @@ enum {
G_DEFINE_TYPE (GamesFrame, games_frame, GTK_TYPE_VBOX);
+struct GamesFramePrivate {
+ GtkWidget *label;
+ GtkWidget *alignment;
+};
+
static void
games_frame_init (GamesFrame * frame)
{
@@ -45,25 +50,25 @@ games_frame_init (GamesFrame * frame)
gtk_box_set_homogeneous (box, FALSE);
gtk_orientable_set_orientation (GTK_ORIENTABLE (frame), GTK_ORIENTATION_VERTICAL);
- frame->label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (frame->label), 0.0, 0.5);
+ frame->priv->label = gtk_label_new (NULL);
+ gtk_misc_set_alignment (GTK_MISC (frame->priv->label), 0.0, 0.5);
attr_list = pango_attr_list_new ();
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attr_list, attr);
- gtk_label_set_attributes (GTK_LABEL (frame->label), attr_list);
+ gtk_label_set_attributes (GTK_LABEL (frame->priv->label), attr_list);
pango_attr_list_unref (attr_list);
- frame->alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (frame->alignment), 0, 0, 12, 0);
+ frame->priv->alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (frame->priv->alignment), 0, 0, 12, 0);
- gtk_box_pack_start (box, frame->label, FALSE, FALSE, 0);
- gtk_box_pack_start (box, frame->alignment, TRUE, TRUE, 0);
+ gtk_box_pack_start (box, frame->priv->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (box, frame->priv->alignment, TRUE, TRUE, 0);
- gtk_widget_set_no_show_all (frame->label, TRUE);
- gtk_widget_show (frame->alignment);
+ gtk_widget_set_no_show_all (frame->priv->label, TRUE);
+ gtk_widget_show (frame->priv->alignment);
}
static void
@@ -72,11 +77,11 @@ games_frame_add (GtkContainer *container,
{
GamesFrame *frame = GAMES_FRAME (container);
- gtk_container_add (GTK_CONTAINER (frame->alignment), child);
+ gtk_container_add (GTK_CONTAINER (frame->priv->alignment), child);
#ifndef HAVE_HILDON
- games_atk_util_add_atk_relation (frame->label, child, ATK_RELATION_LABEL_FOR);
- games_atk_util_add_atk_relation (child, frame->label, ATK_RELATION_LABELLED_BY);
+ games_atk_util_add_atk_relation (frame->priv->label, child, ATK_RELATION_LABEL_FOR);
+ games_atk_util_add_atk_relation (child, frame->priv->label, ATK_RELATION_LABELLED_BY);
#endif
}
@@ -108,6 +113,8 @@ games_frame_class_init (GamesFrameClass * klass)
object_class->set_property = games_frame_set_property;
container_class->add = games_frame_add;
+ g_type_class_add_private (object_class, sizeof (GamesFramePrivate));
+
g_object_class_install_property
(object_class,
PROP_LABEL,
@@ -147,12 +154,12 @@ games_frame_set_label (GamesFrame *frame,
g_return_if_fail (GAMES_IS_FRAME (frame));
if (label) {
- gtk_label_set_text (GTK_LABEL (frame->label), label);
+ gtk_label_set_text (GTK_LABEL (frame->priv->label), label);
} else {
- gtk_label_set_text (GTK_LABEL (frame->label), "");
+ gtk_label_set_text (GTK_LABEL (frame->priv->label), "");
}
- g_object_set (frame->label, "visible", label && label[0], NULL);
+ g_object_set (frame->priv->label, "visible", label && label[0], NULL);
g_object_notify (G_OBJECT (frame), "label");
}
diff --git a/libgames-support/games-frame.h b/libgames-support/games-frame.h
index 1680bbc..c8705ef 100644
--- a/libgames-support/games-frame.h
+++ b/libgames-support/games-frame.h
@@ -32,25 +32,22 @@ G_BEGIN_DECLS
#define GAMES_IS_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_FRAME))
#define GAMES_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_FRAME, GamesFrameClass))
-typedef struct _GamesFrame GamesFrame;
-typedef struct _GamesFrameClass GamesFrameClass;
+typedef struct GamesFramePrivate GamesFramePrivate;
-struct _GamesFrame {
+typedef struct {
GtkVBox parent_instance;
- GtkWidget *label;
- GtkWidget *alignment;
-};
+ /*< private >*/
+ GamesFramePrivate *priv;
+} GamesFrame;
-struct _GamesFrameClass {
+typedef struct {
GtkVBoxClass parent_class;
-};
+} GamesFrameClass;
-GType games_frame_get_type (void);
-
-GtkWidget *games_frame_new (const char *label);
-
-void games_frame_set_label (GamesFrame *frame,
- const char *label);
+GType games_frame_get_type (void);
+GtkWidget *games_frame_new (const char *label);
+void games_frame_set_label (GamesFrame *frame,
+ const char *label);
G_END_DECLS
diff --git a/libgames-support/games-fullscreen-action.h b/libgames-support/games-fullscreen-action.h
index d814db6..eef5e3d 100644
--- a/libgames-support/games-fullscreen-action.h
+++ b/libgames-support/games-fullscreen-action.h
@@ -34,33 +34,32 @@ typedef struct GamesFullscreenActionPrivate GamesFullscreenActionPrivate;
typedef struct
{
- GtkAction parent_instance;
- GamesFullscreenActionPrivate *priv;
+ GtkAction parent_instance;
+ /*< private >*/
+ GamesFullscreenActionPrivate *priv;
} GamesFullscreenAction;
typedef struct
{
- GtkActionClass parent_class;
+ GtkActionClass parent_class;
} GamesFullscreenActionClass;
typedef enum
{
- GAMES_FULLSCREEN_ACTION_VISIBLE_ALWAYS,
- GAMES_FULLSCREEN_ACTION_VISIBLE_ON_FULLSCREEN,
- GAMES_FULLSCREEN_ACTION_VISIBLE_ON_UNFULLSCREEN
+ GAMES_FULLSCREEN_ACTION_VISIBLE_ALWAYS,
+ GAMES_FULLSCREEN_ACTION_VISIBLE_ON_FULLSCREEN,
+ GAMES_FULLSCREEN_ACTION_VISIBLE_ON_UNFULLSCREEN
} GamesFullscreenActionVisiblePolicy;
-GType games_fullscreen_action_get_type (void);
-
-GamesFullscreenAction *games_fullscreen_action_new (const gchar *name, GtkWindow *window);
-
-void games_fullscreen_action_set_visible_policy (GamesFullscreenAction *action, GamesFullscreenActionVisiblePolicy visible_policy);
-
+GType games_fullscreen_action_get_type (void);
+GamesFullscreenAction *games_fullscreen_action_new (const gchar *name,
+ GtkWindow *window);
+void games_fullscreen_action_set_visible_policy (GamesFullscreenAction *action,
+ GamesFullscreenActionVisiblePolicy visible_policy);
GamesFullscreenActionVisiblePolicy games_fullscreen_action_get_visible_policy (GamesFullscreenAction *action);
-
-void games_fullscreen_action_set_is_fullscreen (GamesFullscreenAction *action, gboolean is_fullscreen);
-
-gboolean games_fullscreen_action_get_is_fullscreen (GamesFullscreenAction *action);
+void games_fullscreen_action_set_is_fullscreen (GamesFullscreenAction *action,
+ gboolean is_fullscreen);
+gboolean games_fullscreen_action_get_is_fullscreen (GamesFullscreenAction *action);
G_END_DECLS
diff --git a/libgames-support/games-gridframe.c b/libgames-support/games-gridframe.c
index 156b4a8..e328fb2 100644
--- a/libgames-support/games-gridframe.c
+++ b/libgames-support/games-gridframe.c
@@ -42,13 +42,26 @@ enum {
G_DEFINE_TYPE (GamesGridFrame, games_grid_frame,GTK_TYPE_BIN)
+struct GamesGridFramePrivate {
+ gint xmult;
+ gint ymult;
+
+ gint xpadding;
+ gint ypadding;
+
+ gfloat xalign;
+ gfloat yalign;
+
+ GtkAllocation old_allocation;
+};
+
void
games_grid_frame_set (GamesGridFrame * frame, gint newxmult, gint newymult)
{
if (newxmult > 0)
- frame->xmult = newxmult;
+ frame->priv->xmult = newxmult;
if (newymult > 0)
- frame->ymult = newymult;
+ frame->priv->ymult = newymult;
gtk_widget_queue_resize (GTK_WIDGET (frame));
}
@@ -58,10 +71,10 @@ games_grid_frame_set_padding (GamesGridFrame * frame, gint newxpadding,
gint newypadding)
{
if (newxpadding >= 0)
- frame->xpadding = newxpadding;
+ frame->priv->xpadding = newxpadding;
if (newypadding >= 0)
- frame->ypadding = newypadding;
+ frame->priv->ypadding = newypadding;
gtk_widget_queue_resize (GTK_WIDGET (frame));
}
@@ -81,8 +94,8 @@ games_grid_frame_set_alignment (GamesGridFrame * frame, gfloat xalign,
else if (yalign > 1.0)
yalign = 1.0;
- frame->xalign = xalign;
- frame->yalign = yalign;
+ frame->priv->xalign = xalign;
+ frame->priv->yalign = yalign;
gtk_widget_queue_resize (GTK_WIDGET (frame));
}
@@ -102,10 +115,10 @@ games_grid_frame_set_property (GObject * object, guint prop_id,
break;
case PROP_X_ALIGN:
games_grid_frame_set_alignment (frame, g_value_get_float (value),
- frame->yalign);
+ frame->priv->yalign);
break;
case PROP_Y_ALIGN:
- games_grid_frame_set_alignment (frame, frame->xalign,
+ games_grid_frame_set_alignment (frame, frame->priv->xalign,
g_value_get_float (value));
break;
case PROP_WIDTH:
@@ -128,22 +141,22 @@ games_grid_frame_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_X_PADDING:
- g_value_set_int (value, frame->xpadding);
+ g_value_set_int (value, frame->priv->xpadding);
break;
case PROP_Y_PADDING:
- g_value_set_int (value, frame->ypadding);
+ g_value_set_int (value, frame->priv->ypadding);
break;
case PROP_X_ALIGN:
- g_value_set_float (value, frame->xalign);
+ g_value_set_float (value, frame->priv->xalign);
break;
case PROP_Y_ALIGN:
- g_value_set_float (value, frame->yalign);
+ g_value_set_float (value, frame->priv->yalign);
break;
case PROP_WIDTH:
- g_value_set_int (value, frame->xmult);
+ g_value_set_int (value, frame->priv->xmult);
break;
case PROP_HEIGHT:
- g_value_set_int (value, frame->ymult);
+ g_value_set_int (value, frame->priv->ymult);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -162,32 +175,32 @@ games_grid_frame_size_allocate (GtkWidget * widget,
gtk_widget_set_allocation (widget, allocation);
- xsize = MAX (1, (allocation->width - frame->xpadding) / frame->xmult);
- ysize = MAX (1, (allocation->height - frame->ypadding) / frame->ymult);
+ xsize = MAX (1, (allocation->width - frame->priv->xpadding) / frame->priv->xmult);
+ ysize = MAX (1, (allocation->height - frame->priv->ypadding) / frame->priv->ymult);
size = MIN (xsize, ysize);
- child_allocation.width = size * frame->xmult + frame->xpadding;
- child_allocation.height = size * frame->ymult + frame->ypadding;
+ child_allocation.width = size * frame->priv->xmult + frame->priv->xpadding;
+ child_allocation.height = size * frame->priv->ymult + frame->priv->ypadding;
child_allocation.x =
- (allocation->width - child_allocation.width) * frame->xalign +
+ (allocation->width - child_allocation.width) * frame->priv->xalign +
allocation->x;
child_allocation.y =
- (allocation->height - child_allocation.height) * frame->yalign +
+ (allocation->height - child_allocation.height) * frame->priv->yalign +
allocation->y;
if (gtk_widget_get_mapped (widget) &&
- (child_allocation.x != frame->old_allocation.x ||
- child_allocation.y != frame->old_allocation.y ||
- child_allocation.width != frame->old_allocation.width ||
- child_allocation.height != frame->old_allocation.height))
+ (child_allocation.x != frame->priv->old_allocation.x ||
+ child_allocation.y != frame->priv->old_allocation.y ||
+ child_allocation.width != frame->priv->old_allocation.width ||
+ child_allocation.height != frame->priv->old_allocation.height))
gdk_window_invalidate_rect (gtk_widget_get_window (widget), allocation, FALSE);
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &child_allocation);
- frame->old_allocation = child_allocation;
+ frame->priv->old_allocation = child_allocation;
}
static void
@@ -204,6 +217,8 @@ games_grid_frame_class_init (GamesGridFrameClass * class)
widget_class->size_allocate = games_grid_frame_size_allocate;
+ g_type_class_add_private (object_class, sizeof (GamesGridFramePrivate));
+
g_object_class_install_property (object_class, PROP_X_PADDING,
g_param_spec_int ("x_padding",
_("X Padding"),
@@ -255,11 +270,11 @@ games_grid_frame_class_init (GamesGridFrameClass * class)
static void
games_grid_frame_init (GamesGridFrame * frame)
{
- frame->xmult = 1;
- frame->ymult = 1;
+ frame->priv->xmult = 1;
+ frame->priv->ymult = 1;
- frame->xalign = 0.5;
- frame->yalign = 0.5;
+ frame->priv->xalign = 0.5;
+ frame->priv->yalign = 0.5;
}
GtkWidget *
@@ -269,8 +284,8 @@ games_grid_frame_new (gint width, gint height)
frame = g_object_new (GAMES_TYPE_GRID_FRAME, NULL);
- frame->xmult = MAX (width, 1);
- frame->ymult = MAX (height, 1);
+ frame->priv->xmult = MAX (width, 1);
+ frame->priv->ymult = MAX (height, 1);
return GTK_WIDGET (frame);
}
diff --git a/libgames-support/games-gridframe.h b/libgames-support/games-gridframe.h
index d4400d6..2a8b32c 100644
--- a/libgames-support/games-gridframe.h
+++ b/libgames-support/games-gridframe.h
@@ -25,39 +25,38 @@
#include <gtk/gtk.h>
G_BEGIN_DECLS
+
#define GAMES_TYPE_GRID_FRAME (games_grid_frame_get_type ())
#define GAMES_GRID_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GRID_FRAME, GamesGridFrame))
#define GAMES_GRID_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GRID_FRAME, GamesGridFrameClass))
#define GAMES_IS_GRID_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GRID_FRAME))
#define GAMES_IS_GRID_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GRID_FRAME))
#define GAMES_GRID_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GRID_FRAME))
-typedef struct _GamesGridFrame {
- GtkBin bin;
-
- gint xmult;
- gint ymult;
-
- gint xpadding;
- gint ypadding;
- gfloat xalign;
- gfloat yalign;
+typedef struct GamesGridFramePrivate GamesGridFramePrivate;
- GtkAllocation old_allocation;
+typedef struct {
+ GtkBin bin;
+ /*< private >*/
+ GamesGridFramePrivate *priv;
} GamesGridFrame;
typedef struct {
GtkBinClass parent;
} GamesGridFrameClass;
-GType games_grid_frame_get_type (void);
-
-GtkWidget *games_grid_frame_new (gint width, gint height);
-void games_grid_frame_set (GamesGridFrame * frame, gint width, gint height);
-void games_grid_frame_set_padding (GamesGridFrame * frame, gint xpadding,
- gint ypadding);
-void games_grid_frame_set_alignment (GamesGridFrame * frame, gfloat xalign,
- gfloat yalign);
+GType games_grid_frame_get_type (void);
+GtkWidget *games_grid_frame_new (gint width,
+ gint height);
+void games_grid_frame_set (GamesGridFrame * frame,
+ gint width,
+ gint height);
+void games_grid_frame_set_padding (GamesGridFrame * frame,
+ gint xpadding,
+ gint ypadding);
+void games_grid_frame_set_alignment (GamesGridFrame * frame,
+ gfloat xalign,
+ gfloat yalign);
G_END_DECLS
#endif /* GAMES_GRID_FRAME_H */
diff --git a/libgames-support/games-help.h b/libgames-support/games-help.h
index 327880c..460e792 100644
--- a/libgames-support/games-help.h
+++ b/libgames-support/games-help.h
@@ -23,10 +23,9 @@
G_BEGIN_DECLS
-void games_help_display (GtkWidget *window,
- const char *doc_module,
- const char *section);
-
+void games_help_display (GtkWidget *window,
+ const char *doc_module,
+ const char *section);
gboolean games_help_display_full (GtkWidget *window,
const char *doc_module,
const char *section,
diff --git a/libgames-support/games-pause-action.h b/libgames-support/games-pause-action.h
index 9dcad92..c73b42c 100644
--- a/libgames-support/games-pause-action.h
+++ b/libgames-support/games-pause-action.h
@@ -33,15 +33,15 @@ typedef struct GamesPauseActionPrivate GamesPauseActionPrivate;
typedef struct
{
- GtkAction parent_instance;
- GamesPauseActionPrivate *priv;
+ GtkAction parent_instance;
+ /*< private >*/
+ GamesPauseActionPrivate *priv;
} GamesPauseAction;
typedef struct
{
- GtkActionClass parent_class;
-
- void (*state_changed)(GamesPauseAction *action);
+ GtkActionClass parent_class;
+ void (*state_changed)(GamesPauseAction *action);
} GamesPauseActionClass;
GType games_pause_action_get_type (void);
diff --git a/libgames-support/games-preimage.c b/libgames-support/games-preimage.c
index bad1771..0e3e6c9 100644
--- a/libgames-support/games-preimage.c
+++ b/libgames-support/games-preimage.c
@@ -38,16 +38,30 @@
#include "games-profile.h"
#include "games-preimage.h"
-#include "games-preimage-private.h"
G_DEFINE_TYPE (GamesPreimage, games_preimage, G_TYPE_OBJECT);
+struct GamesPreimagePrivate {
+ gint width;
+ gint height;
+
+#ifdef HAVE_RSVG
+ RsvgHandle *rsvg_handle;
+ cairo_font_options_t *font_options;
+#endif
+
+ /* raster pixbuf data */
+ GdkPixbuf *pixbuf;
+
+ guint scalable : 1;
+};
+
static void
games_preimage_init (GamesPreimage * preimage)
{
- preimage->scalable = FALSE;
- preimage->width = 0;
- preimage->height = 0;
+ preimage->priv->scalable = FALSE;
+ preimage->priv->width = 0;
+ preimage->priv->height = 0;
}
static void
@@ -56,16 +70,16 @@ games_preimage_finalize (GObject * object)
GamesPreimage *preimage = GAMES_PREIMAGE (object);
#ifdef HAVE_RSVG
- if (preimage->rsvg_handle != NULL) {
- g_object_unref (preimage->rsvg_handle);
+ if (preimage->priv->rsvg_handle != NULL) {
+ g_object_unref (preimage->priv->rsvg_handle);
}
- if (preimage->font_options) {
- cairo_font_options_destroy (preimage->font_options);
+ if (preimage->priv->font_options) {
+ cairo_font_options_destroy (preimage->priv->font_options);
}
#endif
- if (preimage->pixbuf != NULL) {
- g_object_unref (preimage->pixbuf);
+ if (preimage->priv->pixbuf != NULL) {
+ g_object_unref (preimage->priv->pixbuf);
}
G_OBJECT_CLASS (games_preimage_parent_class)->finalize (object);
@@ -78,6 +92,8 @@ games_preimage_class_init (GamesPreimageClass * klass)
oclass->finalize = games_preimage_finalize;
+ g_type_class_add_private (oclass, sizeof (GamesPreimagePrivate));
+
#ifdef HAVE_RSVG
rsvg_init ();
#endif
@@ -103,21 +119,21 @@ games_preimage_render (GamesPreimage * preimage, gint width, gint height)
g_return_val_if_fail (preimage != NULL, NULL);
#ifdef HAVE_RSVG
- if (preimage->scalable) { /* Render vector image */
+ if (preimage->priv->scalable) { /* Render vector image */
pixbuf = games_preimage_render_sub (preimage,
NULL,
width,
height,
0.0, 0.0,
((double) width) /
- ((double) preimage->width),
+ ((double) preimage->priv->width),
((double) height) /
- ((double) preimage->height));
+ ((double) preimage->priv->height));
} else
#endif /* HAVE_RSVG */
{
/* Render raster image */
- pixbuf = gdk_pixbuf_scale_simple (preimage->pixbuf,
+ pixbuf = gdk_pixbuf_scale_simple (preimage->priv->pixbuf,
width, height, GDK_INTERP_BILINEAR);
}
@@ -144,7 +160,7 @@ games_preimage_render_cairo (GamesPreimage * preimage,
g_return_if_fail (preimage != NULL);
#ifdef HAVE_RSVG
- if (preimage->scalable) { /* Render vector image */
+ if (preimage->priv->scalable) { /* Render vector image */
games_preimage_render_cairo_sub (preimage,
cr,
NULL,
@@ -152,9 +168,9 @@ games_preimage_render_cairo (GamesPreimage * preimage,
height,
0.0, 0.0,
((double) width) /
- ((double) preimage->width),
+ ((double) preimage->priv->width),
((double) height) /
- ((double) preimage->height));
+ ((double) preimage->priv->height));
} else
#endif /* HAVE_RSVG */
{
@@ -162,7 +178,7 @@ games_preimage_render_cairo (GamesPreimage * preimage,
/* FIXMEchpe: we don't really need this fallback anymore */
/* Render raster image */
- pixbuf = gdk_pixbuf_scale_simple (preimage->pixbuf,
+ pixbuf = gdk_pixbuf_scale_simple (preimage->priv->pixbuf,
width, height, GDK_INTERP_BILINEAR);
cairo_save (cr);
@@ -244,13 +260,13 @@ games_preimage_render_cairo_sub (GamesPreimage * preimage,
{
cairo_matrix_t matrix;
- if (!preimage->scalable)
+ if (!preimage->priv->scalable)
return;
- if (preimage->font_options) {
- cairo_set_antialias (cr, cairo_font_options_get_antialias (preimage->font_options));
+ if (preimage->priv->font_options) {
+ cairo_set_antialias (cr, cairo_font_options_get_antialias (preimage->priv->font_options));
- cairo_set_font_options (cr, preimage->font_options);
+ cairo_set_font_options (cr, preimage->priv->font_options);
}
cairo_matrix_init_identity (&matrix);
@@ -259,7 +275,7 @@ games_preimage_render_cairo_sub (GamesPreimage * preimage,
cairo_set_matrix (cr, &matrix);
- rsvg_handle_render_cairo_sub (preimage->rsvg_handle, cr, node);
+ rsvg_handle_render_cairo_sub (preimage->priv->rsvg_handle, cr, node);
}
/**
@@ -295,7 +311,7 @@ games_preimage_render_sub (GamesPreimage * preimage,
cairo_surface_t *surface;
cairo_t *cr;
- if (!preimage->scalable)
+ if (!preimage->priv->scalable)
return NULL;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE (1, 6, 0)
@@ -351,13 +367,13 @@ games_preimage_new_from_file (const gchar * filename, GError ** error)
preimage = g_object_new (GAMES_TYPE_PREIMAGE, NULL);
#ifdef HAVE_RSVG
- preimage->rsvg_handle = rsvg_handle_new_from_file (filename, NULL);
- if (preimage->rsvg_handle) {
+ preimage->priv->rsvg_handle = rsvg_handle_new_from_file (filename, NULL);
+ if (preimage->priv->rsvg_handle) {
RsvgDimensionData data;
- preimage->scalable = TRUE;
+ preimage->priv->scalable = TRUE;
- rsvg_handle_get_dimensions (preimage->rsvg_handle, &data);
+ rsvg_handle_get_dimensions (preimage->priv->rsvg_handle, &data);
_games_profile_end ("creating GamesPreimage from %s", filename);
@@ -369,15 +385,15 @@ games_preimage_new_from_file (const gchar * filename, GError ** error)
return NULL;
}
- preimage->width = data.width;
- preimage->height = data.height;
+ preimage->priv->width = data.width;
+ preimage->priv->height = data.height;
return preimage;
}
#endif /* HAVE_RSVG */
/* Not an SVG */
- preimage->scalable = FALSE;
+ preimage->priv->scalable = FALSE;
pixbuf = gdk_pixbuf_new_from_file (filename, error);
_games_profile_end ("creating GamesPreimage from %s", filename);
@@ -387,9 +403,9 @@ games_preimage_new_from_file (const gchar * filename, GError ** error)
return NULL;
}
- preimage->pixbuf = pixbuf;
- preimage->width = gdk_pixbuf_get_width (pixbuf);
- preimage->height = gdk_pixbuf_get_height (pixbuf);
+ preimage->priv->pixbuf = pixbuf;
+ preimage->priv->width = gdk_pixbuf_get_width (pixbuf);
+ preimage->priv->height = gdk_pixbuf_get_height (pixbuf);
return preimage;
}
@@ -408,14 +424,14 @@ games_preimage_set_font_options (GamesPreimage * preimage,
#ifdef HAVE_RSVG
g_return_if_fail (GAMES_IS_PREIMAGE (preimage));
- if (preimage->font_options) {
- cairo_font_options_destroy (preimage->font_options);
+ if (preimage->priv->font_options) {
+ cairo_font_options_destroy (preimage->priv->font_options);
}
if (font_options) {
- preimage->font_options = cairo_font_options_copy (font_options);
+ preimage->priv->font_options = cairo_font_options_copy (font_options);
} else {
- preimage->font_options = NULL;
+ preimage->priv->font_options = NULL;
}
#endif /* HAVE_RSVG */
}
@@ -431,7 +447,7 @@ games_preimage_is_scalable (GamesPreimage * preimage)
{
g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), FALSE);
- return preimage->scalable;
+ return preimage->priv->scalable;
}
/**
@@ -445,7 +461,7 @@ games_preimage_get_width (GamesPreimage * preimage)
{
g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), 0);
- return preimage->width;
+ return preimage->priv->width;
}
/**
@@ -459,7 +475,7 @@ games_preimage_get_height (GamesPreimage * preimage)
{
g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), 0);
- return preimage->height;
+ return preimage->priv->height;
}
/**
@@ -478,12 +494,12 @@ games_preimage_render_unscaled_pixbuf (GamesPreimage * preimage)
g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), NULL);
- if ((unscaled_pixbuf = preimage->pixbuf)) {
+ if ((unscaled_pixbuf = preimage->priv->pixbuf)) {
g_object_ref (unscaled_pixbuf);
} else {
unscaled_pixbuf = games_preimage_render (preimage,
- preimage->width,
- preimage->height);
+ preimage->priv->width,
+ preimage->priv->height);
}
return unscaled_pixbuf;
diff --git a/libgames-support/games-preimage.h b/libgames-support/games-preimage.h
index 15d8df5..e3540a4 100644
--- a/libgames-support/games-preimage.h
+++ b/libgames-support/games-preimage.h
@@ -35,55 +35,52 @@ G_BEGIN_DECLS
#define GAMES_IS_PREIMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREIMAGE))
#define GAMES_GET_PREIMAGE_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREIMAGE, GamesPreimageClass))
-typedef struct _GamesPreimage GamesPreimage;
+typedef struct GamesPreimagePrivate GamesPreimagePrivate;
+
+typedef struct
+{
+ GObject parent;
+ /*< private >*/
+ GamesPreimagePrivate *priv;
+} GamesPreimage;
typedef struct {
GObjectClass parent_class;
} GamesPreimageClass;
-GType games_preimage_get_type (void);
-
-GamesPreimage *games_preimage_new (void);
-
-GamesPreimage *games_preimage_new_from_file (const gchar * filename,
- GError ** error);
-
-void games_preimage_set_font_options (GamesPreimage * preimage,
- const cairo_font_options_t *font_options);
-
-GdkPixbuf *games_preimage_render (GamesPreimage * preimage,
- gint width,
- gint height);
-void games_preimage_render_cairo (GamesPreimage * preimage,
- cairo_t *cr,
- gint width,
- gint height);
-
-GdkPixbuf *games_preimage_render_sub (GamesPreimage * preimage,
- const char *node,
- int width,
- int height,
- double xoffset,
- double yoffset,
- double xzoom, double yzoom);
-
-void games_preimage_render_cairo_sub (GamesPreimage * preimage,
- cairo_t *cr,
- const char *node,
- int width,
- int height,
- double xoffset,
- double yoffset,
- double xzoom,
- double yzoom);
-
-gboolean games_preimage_is_scalable (GamesPreimage * preimage);
-
-gint games_preimage_get_width (GamesPreimage * preimage);
-
-gint games_preimage_get_height (GamesPreimage * preimage);
-
-GdkPixbuf *games_preimage_render_unscaled_pixbuf (GamesPreimage * preimage);
+GType games_preimage_get_type (void);
+GamesPreimage *games_preimage_new (void);
+GamesPreimage *games_preimage_new_from_file (const gchar * filename,
+ GError ** error);
+void games_preimage_set_font_options (GamesPreimage * preimage,
+ const cairo_font_options_t *font_options);
+GdkPixbuf *games_preimage_render (GamesPreimage * preimage,
+ gint width,
+ gint height);
+void games_preimage_render_cairo (GamesPreimage * preimage,
+ cairo_t *cr,
+ gint width,
+ gint height);
+GdkPixbuf *games_preimage_render_sub (GamesPreimage * preimage,
+ const char *node,
+ int width,
+ int height,
+ double xoffset,
+ double yoffset,
+ double xzoom, double yzoom);
+void games_preimage_render_cairo_sub (GamesPreimage * preimage,
+ cairo_t *cr,
+ const char *node,
+ int width,
+ int height,
+ double xoffset,
+ double yoffset,
+ double xzoom,
+ double yzoom);
+gboolean games_preimage_is_scalable (GamesPreimage * preimage);
+gint games_preimage_get_width (GamesPreimage * preimage);
+gint games_preimage_get_height (GamesPreimage * preimage);
+GdkPixbuf *games_preimage_render_unscaled_pixbuf (GamesPreimage * preimage);
G_END_DECLS
diff --git a/libgames-support/games-runtime.h b/libgames-support/games-runtime.h
index 228966e..9eebe67 100644
--- a/libgames-support/games-runtime.h
+++ b/libgames-support/games-runtime.h
@@ -61,27 +61,18 @@ typedef enum {
#endif
} GamesRuntimeDirectory;
-gboolean games_runtime_init (const char *name);
-
+gboolean games_runtime_init (const char *name);
#ifdef HAVE_HILDON
-
-gboolean games_runtime_init_with_osso (const char *name,
- const char *service_name);
-
+gboolean games_runtime_init_with_osso (const char *name,
+ const char *service_name);
osso_context_t* games_runtime_get_osso_context (void);
-
#endif /* HAVE_HILDON */
-
-void games_runtime_shutdown (void);
-
-const char * games_runtime_get_directory (GamesRuntimeDirectory directory);
-
-char * games_runtime_get_file (GamesRuntimeDirectory directory,
- const char *name);
-
-int games_runtime_get_gpl_version (void);
-
-gboolean games_runtime_is_system_prefix (void);
+void games_runtime_shutdown (void);
+const char *games_runtime_get_directory (GamesRuntimeDirectory directory);
+char *games_runtime_get_file (GamesRuntimeDirectory directory,
+ const char *name);
+int games_runtime_get_gpl_version (void);
+gboolean games_runtime_is_system_prefix (void);
G_END_DECLS
diff --git a/libgames-support/games-score.h b/libgames-support/games-score.h
index 6d58a57..7b039a5 100644
--- a/libgames-support/games-score.h
+++ b/libgames-support/games-score.h
@@ -43,6 +43,7 @@ typedef enum {
typedef struct {
GObject parent;
+ /*< private >*/
GamesScorePrivate *priv;
} GamesScore;
diff --git a/libgames-support/games-scores-backend.c b/libgames-support/games-scores-backend.c
index 1dcdf39..25d828f 100644
--- a/libgames-support/games-scores-backend.c
+++ b/libgames-support/games-scores-backend.c
@@ -35,7 +35,8 @@
#include "games-setgid-io.h"
#endif
-struct _GamesScoresBackendPrivate {
+struct GamesScoresBackendPrivate {
+ GList *scores_list;
GamesScoreStyle style;
time_t timestamp;
gchar *filename;
@@ -91,7 +92,7 @@ games_scores_backend_new (GamesScoreStyle style,
backend->priv->timestamp = 0;
backend->priv->style = style;
- backend->scores_list = NULL;
+ backend->priv->scores_list = NULL;
backend->priv->filename = g_build_filename (games_runtime_get_directory (GAMES_RUNTIME_SCORES_DIRECTORY),
fullname, NULL);
g_free (fullname);
@@ -184,17 +185,17 @@ games_scores_backend_get_scores (GamesScoresBackend * self)
if (error != 0)
return NULL;
- if ((info.st_mtime > self->priv->timestamp) || (self->scores_list == NULL)) {
+ if ((info.st_mtime > self->priv->timestamp) || (self->priv->scores_list == NULL)) {
self->priv->timestamp = info.st_mtime;
/* Dump the old list of scores. */
- t = self->scores_list;
+ t = self->priv->scores_list;
while (t != NULL) {
g_object_unref (t->data);
t = g_list_next (t);
}
- g_list_free (self->scores_list);
- self->scores_list = NULL;
+ g_list_free (self->priv->scores_list);
+ self->priv->scores_list = NULL;
/* Lock the file and get the list. */
if (!games_scores_backend_get_lock (self))
@@ -253,7 +254,7 @@ games_scores_backend_get_scores (GamesScoresBackend * self)
}
games_score_set_name (newscore, namestr);
games_score_set_time (newscore, g_ascii_strtoull (timestr, NULL, 10));
- self->scores_list = g_list_append (self->scores_list, newscore);
+ self->priv->scores_list = g_list_append (self->priv->scores_list, newscore);
/* Setup again for the next time around. */
scorestr = eol;
eol = strchr (eol, '\n');
@@ -264,7 +265,7 @@ games_scores_backend_get_scores (GamesScoresBackend * self)
/* FIXME: Sort the scores! We shouldn't rely on the file being sorted. */
- return self->scores_list;
+ return self->priv->scores_list;
#else
return NULL;
#endif /* ENABLE_SETGID */
@@ -283,7 +284,7 @@ games_scores_backend_set_scores (GamesScoresBackend * self, GList * list)
if (!games_scores_backend_get_lock (self))
return FALSE;
- self->scores_list = list;
+ self->priv->scores_list = list;
s = list;
while (s != NULL) {
diff --git a/libgames-support/games-scores-backend.h b/libgames-support/games-scores-backend.h
index 2247cb5..6b20141 100644
--- a/libgames-support/games-scores-backend.h
+++ b/libgames-support/games-scores-backend.h
@@ -41,28 +41,26 @@ G_BEGIN_DECLS
#define GAMES_IS_SCORES_BACKEND_CLASS(kls) (G_TYPE_CHECK_CLASS_TYPE ((kls), GAMES_TYPE_SCORES_BACKEND))
#define GAMES_GET_SCORES_BACKEND_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_SCORES_BACKEND, GamesScoresBackendClass))
-typedef struct _GamesScoresBackend GamesScoresBackend;
-typedef struct _GamesScoresBackendPrivate GamesScoresBackendPrivate;
-typedef struct _GamesScoresBackendClass GamesScoresBackendClass;
+typedef struct GamesScoresBackendPrivate GamesScoresBackendPrivate;
-struct _GamesScoresBackend {
+typedef struct {
GObject object;
- GList *scores_list;
+ /*< private >*/
GamesScoresBackendPrivate *priv;
-};
+} GamesScoresBackend;
-struct _GamesScoresBackendClass {
+typedef struct {
GObjectClass parent_class;
-};
+} GamesScoresBackendClass;
-GType games_scores_backend_get_type (void);
-GamesScoresBackend *games_scores_backend_new (GamesScoreStyle style,
- char *base_name,
- char *name);
-GList *games_scores_backend_get_scores (GamesScoresBackend * self);
-gboolean games_scores_backend_set_scores (GamesScoresBackend * self,
- GList * list);
-void games_scores_backend_discard_scores (GamesScoresBackend * self);
+GType games_scores_backend_get_type (void);
+GamesScoresBackend *games_scores_backend_new (GamesScoreStyle style,
+ char *base_name,
+ char *name);
+GList *games_scores_backend_get_scores (GamesScoresBackend * self);
+gboolean games_scores_backend_set_scores (GamesScoresBackend * self,
+ GList * list);
+void games_scores_backend_discard_scores (GamesScoresBackend * self);
G_END_DECLS
#endif /* GAMES_SCORES_BACKEND_H */
diff --git a/libgames-support/games-scores-dialog.c b/libgames-support/games-scores-dialog.c
index 12d200b..1997484 100644
--- a/libgames-support/games-scores-dialog.c
+++ b/libgames-support/games-scores-dialog.c
@@ -25,23 +25,46 @@
#include <gtk/gtk.h>
#include "games-scores-dialog.h"
-#include "games-scores-dialog-private.h"
#include "games-gtk-compat.h"
G_DEFINE_TYPE (GamesScoresDialog, games_scores_dialog, GTK_TYPE_DIALOG);
+struct GamesScoresDialogPrivate {
+ GtkWidget *message;
+ GtkWidget *hdiv;
+ GtkWidget *combo;
+ GtkWidget *label;
+ GtkWidget *catbar;
+ GtkListStore *list;
+ GtkTreeView *treeview;
+ GtkCellRenderer *namerenderer;
+ GtkTreeViewColumn *column;
+ GtkTreeViewColumn *namecolumn;
+ GamesScores *scores;
+ GHashTable *categories;
+ GHashTable *catindices;
+ gint catcounter;
+ gint hilight;
+ gint sethilight;
+ gboolean preservehilight;
+ gulong cursor_handler_id;
+
+ /* FIXME: This should be a property. */
+ gint style;
+};
+
static void
games_scores_dialog_finalize (GObject *o)
{
GamesScoresDialog *dialog = GAMES_SCORES_DIALOG (o);
- if (dialog->_priv->scores)
- g_object_unref (dialog->_priv->scores);
+ if (dialog->priv->scores)
+ g_object_unref (dialog->priv->scores);
- if (dialog->_priv->categories)
- g_hash_table_destroy (dialog->_priv->categories);
- if (dialog->_priv->catindices)
- g_hash_table_destroy (dialog->_priv->catindices);
+ if (dialog->priv->categories)
+ g_hash_table_destroy (dialog->priv->categories);
+ if (dialog->priv->catindices)
+ g_hash_table_destroy (dialog->priv->catindices);
G_OBJECT_CLASS (games_scores_dialog_parent_class)->finalize (o);
}
@@ -72,13 +95,13 @@ static void games_scores_dialog_add_category (GamesScoresDialog *self,
k = g_strdup (key);
- g_hash_table_insert (self->_priv->categories, k,
- GINT_TO_POINTER (self->_priv->catcounter));
- g_hash_table_insert (self->_priv->catindices,
- GINT_TO_POINTER (self->_priv->catcounter),
+ g_hash_table_insert (self->priv->categories, k,
+ GINT_TO_POINTER (self->priv->catcounter));
+ g_hash_table_insert (self->priv->catindices,
+ GINT_TO_POINTER (self->priv->catcounter),
k);
- self->_priv->catcounter++;
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (self->_priv->combo), name);
+ self->priv->catcounter++;
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (self->priv->combo), name);
}
/* This is a helper function for loading the initial list of categories
@@ -106,7 +129,7 @@ static void games_scores_dialog_set_style (GamesScoresDialog *self,
{
const gchar *header;
- self->_priv->style = style;
+ self->priv->style = style;
switch (style) {
case GAMES_SCORES_STYLE_TIME_DESCENDING:
case GAMES_SCORES_STYLE_TIME_ASCENDING:
@@ -118,7 +141,7 @@ static void games_scores_dialog_set_style (GamesScoresDialog *self,
header = _("Score");
}
- gtk_tree_view_column_set_title (self->_priv->column, header);
+ gtk_tree_view_column_set_title (self->priv->column, header);
}
/**
@@ -135,11 +158,11 @@ static void games_scores_dialog_set_category (GamesScoresDialog *self,
gpointer value;
int idx;
- value = g_hash_table_lookup (self->_priv->categories, key);
+ value = g_hash_table_lookup (self->priv->categories, key);
idx = GPOINTER_TO_INT (value);
- self->_priv->preservehilight = TRUE;
- gtk_combo_box_set_active (GTK_COMBO_BOX (self->_priv->combo), idx);
+ self->priv->preservehilight = TRUE;
+ gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->combo), idx);
}
/**
@@ -157,9 +180,9 @@ GtkWidget * games_scores_dialog_new (GtkWindow *parent_window, GamesScores *scor
{
GamesScoresDialog *dialog = GAMES_SCORES_DIALOG (g_object_new (GAMES_TYPE_SCORES_DIALOG, NULL));
- dialog->_priv->scores = g_object_ref (scores);
+ dialog->priv->scores = g_object_ref (scores);
games_scores_dialog_set_style (dialog, games_scores_get_style (scores));
- dialog->_priv->preservehilight = FALSE;
+ dialog->priv->preservehilight = FALSE;
gtk_window_set_title (GTK_WINDOW (dialog), title);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
@@ -168,8 +191,8 @@ GtkWidget * games_scores_dialog_new (GtkWindow *parent_window, GamesScores *scor
(GamesScoresCategoryForeachFunc) games_scores_dialog_load_categories,
dialog);
- if (dialog->_priv->catcounter <= 1) {
- gtk_widget_hide (dialog->_priv->catbar);
+ if (dialog->priv->catcounter <= 1) {
+ gtk_widget_hide (dialog->priv->catbar);
}
return (GtkWidget *)dialog;
@@ -183,23 +206,23 @@ static void games_scores_dialog_name_edited (GtkCellRendererText *cell,
GtkTreeIter iter;
gchar *old_name = NULL;
- gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (self->_priv->list),
+ gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (self->priv->list),
&iter, path);
/* Get old name for comparison */
- gtk_tree_model_get (GTK_TREE_MODEL (self->_priv->list),
+ gtk_tree_model_get (GTK_TREE_MODEL (self->priv->list),
&iter, 0, &old_name, -1);
- gtk_list_store_set (self->_priv->list, &iter, 0, new_text, -1);
+ gtk_list_store_set (self->priv->list, &iter, 0, new_text, -1);
- games_scores_update_score_name (self->_priv->scores, new_text, old_name);
+ games_scores_update_score_name (self->priv->scores, new_text, old_name);
}
/* Prevent editing of any cell in the high score list but the one we set. */
static void games_scores_dialog_cursor_changed (GtkTreeView *treeview,
GamesScoresDialog *self)
{
- g_object_set (self->_priv->namerenderer, "editable", FALSE, NULL);
+ g_object_set (self->priv->namerenderer, "editable", FALSE, NULL);
}
/* These contortions are to ensure that only the single most-recent
@@ -215,16 +238,16 @@ static gboolean games_scores_dialog_set_edit (GamesScoresDialog *self)
/* Temporarily disable the code that prevents editing when the
* cursor changes position. */
- g_signal_handler_block (self->_priv->treeview,
- self->_priv->cursor_handler_id);
- g_object_set (self->_priv->namerenderer, "editable", TRUE, NULL);
- selection = gtk_tree_view_get_selection (self->_priv->treeview);
- path = gtk_tree_path_new_from_indices (self->_priv->hilight - 1, -1);
+ g_signal_handler_block (self->priv->treeview,
+ self->priv->cursor_handler_id);
+ g_object_set (self->priv->namerenderer, "editable", TRUE, NULL);
+ selection = gtk_tree_view_get_selection (self->priv->treeview);
+ path = gtk_tree_path_new_from_indices (self->priv->hilight - 1, -1);
gtk_tree_selection_select_path (selection, path);
- gtk_tree_view_set_cursor (self->_priv->treeview, path,
- self->_priv->namecolumn, TRUE);
- g_signal_handler_unblock (self->_priv->treeview,
- self->_priv->cursor_handler_id);
+ gtk_tree_view_set_cursor (self->priv->treeview, path,
+ self->priv->namecolumn, TRUE);
+ g_signal_handler_unblock (self->priv->treeview,
+ self->priv->cursor_handler_id);
gtk_tree_path_free (path);
return FALSE;
@@ -234,15 +257,15 @@ static gboolean games_scores_dialog_set_edit (GamesScoresDialog *self)
* editable. */
static void games_scores_dialog_set_hilight_private (GamesScoresDialog *self)
{
- if (self->_priv->hilight == 0) {
- g_object_set (self->_priv->namerenderer, "editable", FALSE, NULL);
+ if (self->priv->hilight == 0) {
+ g_object_set (self->priv->namerenderer, "editable", FALSE, NULL);
return;
}
- if (self->_priv->hilight == self->_priv->sethilight)
+ if (self->priv->hilight == self->priv->sethilight)
return;
- self->_priv->sethilight = self->_priv->hilight;
+ self->priv->sethilight = self->priv->hilight;
/* We can't set the hilight editable immediately in case we are
* still in the process of being created and the editing subwindow
@@ -261,13 +284,13 @@ static void games_scores_dialog_redraw (GamesScoresDialog *self) {
gdouble dscore;
GList *scorelist;
- gtk_list_store_clear (self->_priv->list);
+ gtk_list_store_clear (self->priv->list);
- scorelist = games_scores_get (self->_priv->scores);
+ scorelist = games_scores_get (self->priv->scores);
while (scorelist) {
name = games_score_get_name ((GamesScore *)scorelist->data);
- switch (self->_priv->style) {
+ switch (self->priv->style) {
case GAMES_SCORES_STYLE_TIME_ASCENDING:
case GAMES_SCORES_STYLE_TIME_DESCENDING:
dscore = games_score_get_value_as_time ((GamesScore *)scorelist->data);
@@ -281,8 +304,8 @@ static void games_scores_dialog_redraw (GamesScoresDialog *self) {
score = games_score_get_value_as_plain ((GamesScore *)scorelist->data);
ss = g_strdup_printf ("%d", score);
}
- gtk_list_store_append (self->_priv->list, &iter);
- gtk_list_store_set (self->_priv->list, &iter, 0, name, 1, ss, -1);
+ gtk_list_store_append (self->priv->list, &iter);
+ gtk_list_store_set (self->priv->list, &iter, 0, name, 1, ss, -1);
g_free (ss);
scorelist = g_list_next (scorelist);
}
@@ -303,19 +326,19 @@ static void games_scores_dialog_change_category (GtkComboBox *widget,
/* This seems like a bit of a hack, but since we're trying to
* temporarily change the category it sort of makes sense. */
- catcopy = g_strdup (games_scores_get_category (self->_priv->scores));
+ catcopy = g_strdup (games_scores_get_category (self->priv->scores));
idx = gtk_combo_box_get_active (widget);
- newcat = g_hash_table_lookup (self->_priv->catindices,
+ newcat = g_hash_table_lookup (self->priv->catindices,
GINT_TO_POINTER (idx));
- games_scores_set_category (self->_priv->scores, newcat);
- if (self->_priv->preservehilight) {
- self->_priv->preservehilight = FALSE;
+ games_scores_set_category (self->priv->scores, newcat);
+ if (self->priv->preservehilight) {
+ self->priv->preservehilight = FALSE;
} else {
- self->_priv->hilight = 0;
+ self->priv->hilight = 0;
}
games_scores_dialog_redraw (self);
- games_scores_set_category (self->_priv->scores, catcopy);
+ games_scores_set_category (self->priv->scores, catcopy);
g_free (catcopy);
}
@@ -328,7 +351,7 @@ static void games_scores_dialog_show (GamesScoresDialog *self)
{
const gchar *cat;
- cat = games_scores_get_category (self->_priv->scores);
+ cat = games_scores_get_category (self->priv->scores);
if (cat)
games_scores_dialog_set_category (self, cat);
games_scores_dialog_redraw (self);
@@ -336,8 +359,8 @@ static void games_scores_dialog_show (GamesScoresDialog *self)
/* This is the other half of ensuring the hide/show cycle works properly. */
static void games_scores_dialog_hide (GamesScoresDialog *self) {
- self->_priv->hilight = 0;
- gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (self->_priv->treeview));
+ self->priv->hilight = 0;
+ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (self->priv->treeview));
}
/**
@@ -355,8 +378,8 @@ void games_scores_dialog_set_category_description (GamesScoresDialog *self,
gchar *lstr;
lstr = g_strdup_printf ("<b>%s</b>", description);
- gtk_label_set_markup (GTK_LABEL (self->_priv->label), lstr);
- gtk_label_set_use_underline (GTK_LABEL (self->_priv->label), TRUE);
+ gtk_label_set_markup (GTK_LABEL (self->priv->label), lstr);
+ gtk_label_set_use_underline (GTK_LABEL (self->priv->label), TRUE);
g_free(lstr);
}
@@ -372,12 +395,12 @@ void games_scores_dialog_set_message (GamesScoresDialog *self,
const gchar *message)
{
if ((message == NULL) || (*message == '\0')) {
- gtk_widget_hide (self->_priv->message);
- gtk_widget_hide (self->_priv->hdiv);
+ gtk_widget_hide (self->priv->message);
+ gtk_widget_hide (self->priv->hdiv);
} else {
- gtk_widget_show (self->_priv->message);
- gtk_widget_show (self->_priv->hdiv);
- gtk_label_set_label (GTK_LABEL (self->_priv->message), message);
+ gtk_widget_show (self->priv->message);
+ gtk_widget_show (self->priv->hdiv);
+ gtk_label_set_label (GTK_LABEL (self->priv->message), message);
}
}
@@ -396,7 +419,7 @@ void games_scores_dialog_set_hilight (GamesScoresDialog *self, guint pos)
if ((pos < 1) || (pos > GAMES_SCORES_SIGNIFICANT))
return;
- self->_priv->hilight = pos;
+ self->priv->hilight = pos;
games_scores_dialog_set_hilight_private (self);
}
@@ -456,21 +479,21 @@ static void games_scores_dialog_init (GamesScoresDialog *self)
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- self->_priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GAMES_TYPE_SCORES_DIALOG,
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GAMES_TYPE_SCORES_DIALOG,
GamesScoresDialogPrivate);
- self->_priv->style = GAMES_SCORES_STYLE_PLAIN_DESCENDING;
+ self->priv->style = GAMES_SCORES_STYLE_PLAIN_DESCENDING;
/* These two hashes are the reverse of each other. As an optimisation
* they share the same set of strings (as keys in the first case and
* as data in the second). The first hash is responsible for
* deallocating the memory for the strings. These two are only
* valid as a pair. */
- self->_priv->categories = g_hash_table_new_full (g_str_hash, g_str_equal,
+ self->priv->categories = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
- self->_priv->catindices = g_hash_table_new (g_direct_hash, g_direct_equal);
- self->_priv->catcounter = 0;
- self->_priv->hilight = 0;
- self->_priv->sethilight = -1;
+ self->priv->catindices = g_hash_table_new (g_direct_hash, g_direct_equal);
+ self->priv->catcounter = 0;
+ self->priv->hilight = 0;
+ self->priv->sethilight = -1;
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 2);
@@ -493,51 +516,51 @@ static void games_scores_dialog_init (GamesScoresDialog *self)
GTK_SHADOW_ETCHED_IN);
gtk_box_pack_end (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
- self->_priv->message = gtk_label_new ("");
- gtk_label_set_use_markup (GTK_LABEL (self->_priv->message), TRUE);
- gtk_label_set_justify (GTK_LABEL (self->_priv->message),
+ self->priv->message = gtk_label_new ("");
+ gtk_label_set_use_markup (GTK_LABEL (self->priv->message), TRUE);
+ gtk_label_set_justify (GTK_LABEL (self->priv->message),
GTK_JUSTIFY_CENTER);
- gtk_box_pack_start (GTK_BOX (vbox), self->_priv->message, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), self->priv->message, FALSE, FALSE, 0);
- self->_priv->hdiv = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), self->_priv->hdiv, FALSE, FALSE, 0);
+ self->priv->hdiv = gtk_hseparator_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), self->priv->hdiv, FALSE, FALSE, 0);
- self->_priv->catbar = gtk_hbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (vbox), self->_priv->catbar, FALSE, FALSE, 0);
+ self->priv->catbar = gtk_hbox_new (FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (vbox), self->priv->catbar, FALSE, FALSE, 0);
- self->_priv->label = gtk_label_new (NULL);
- gtk_label_set_use_markup (GTK_LABEL (self->_priv->label), TRUE);
- gtk_box_pack_start (GTK_BOX (self->_priv->catbar), self->_priv->label,
+ self->priv->label = gtk_label_new (NULL);
+ gtk_label_set_use_markup (GTK_LABEL (self->priv->label), TRUE);
+ gtk_box_pack_start (GTK_BOX (self->priv->catbar), self->priv->label,
FALSE, FALSE, 0);
- self->_priv->combo = gtk_combo_box_text_new ();
- gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (self->_priv->combo), FALSE);
- gtk_box_pack_start (GTK_BOX (self->_priv->catbar),
- self->_priv->combo, TRUE, TRUE, 0);
- gtk_label_set_mnemonic_widget (GTK_LABEL (self->_priv->label), self->_priv->combo);
+ self->priv->combo = gtk_combo_box_text_new ();
+ gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (self->priv->combo), FALSE);
+ gtk_box_pack_start (GTK_BOX (self->priv->catbar),
+ self->priv->combo, TRUE, TRUE, 0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (self->priv->label), self->priv->combo);
- g_signal_connect (G_OBJECT (self->_priv->combo), "changed",
+ g_signal_connect (G_OBJECT (self->priv->combo), "changed",
G_CALLBACK (games_scores_dialog_change_category), self);
- self->_priv->list = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
+ self->priv->list = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
- listview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (self->_priv->list));
- self->_priv->treeview = GTK_TREE_VIEW (listview);
- self->_priv->cursor_handler_id =
- g_signal_connect (G_OBJECT (self->_priv->treeview),
+ listview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (self->priv->list));
+ self->priv->treeview = GTK_TREE_VIEW (listview);
+ self->priv->cursor_handler_id =
+ g_signal_connect (G_OBJECT (self->priv->treeview),
"cursor-changed",
G_CALLBACK (games_scores_dialog_cursor_changed), self);
- self->_priv->namerenderer = gtk_cell_renderer_text_new ();
- g_signal_connect (self->_priv->namerenderer, "edited",
+ self->priv->namerenderer = gtk_cell_renderer_text_new ();
+ g_signal_connect (self->priv->namerenderer, "edited",
G_CALLBACK (games_scores_dialog_name_edited), self);
- self->_priv->namecolumn = gtk_tree_view_column_new_with_attributes (_("Name"),
- self->_priv->namerenderer,
+ self->priv->namecolumn = gtk_tree_view_column_new_with_attributes (_("Name"),
+ self->priv->namerenderer,
"text", 0,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (listview),
- GTK_TREE_VIEW_COLUMN (self->_priv->namecolumn));
+ GTK_TREE_VIEW_COLUMN (self->priv->namecolumn));
renderer = gtk_cell_renderer_text_new ();
/* Note that this assumes the default style is plain. */
column = gtk_tree_view_column_new_with_attributes (_("Score"),
@@ -547,7 +570,7 @@ static void games_scores_dialog_init (GamesScoresDialog *self)
g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (listview),
GTK_TREE_VIEW_COLUMN (column));
- self->_priv->column = column;
+ self->priv->column = column;
gtk_container_add (GTK_CONTAINER (scroll), listview);
@@ -555,11 +578,11 @@ static void games_scores_dialog_init (GamesScoresDialog *self)
gtk_window_set_destroy_with_parent (GTK_WINDOW (self), TRUE);
- gtk_widget_grab_focus (self->_priv->combo);
+ gtk_widget_grab_focus (self->priv->combo);
gtk_widget_show_all (vbox);
- gtk_widget_hide (self->_priv->hdiv);
- gtk_widget_hide (self->_priv->message);
+ gtk_widget_hide (self->priv->hdiv);
+ gtk_widget_hide (self->priv->message);
}
/* FIXME: There is basically no range checking. */
diff --git a/libgames-support/games-scores-dialog.h b/libgames-support/games-scores-dialog.h
index a011942..8b168ae 100644
--- a/libgames-support/games-scores-dialog.h
+++ b/libgames-support/games-scores-dialog.h
@@ -52,28 +52,30 @@ typedef enum {
GAMES_SCORES_QUIT_BUTTON = 8,
} GamesScoresButtons;
-typedef struct _GamesScoresDialogPrivate GamesScoresDialogPrivate;
+typedef struct GamesScoresDialogPrivate GamesScoresDialogPrivate;
typedef struct {
GtkDialog dialog;
-
- /* <private> */
- GamesScoresDialogPrivate *_priv;
+ /*< private >*/
+ GamesScoresDialogPrivate *priv;
} GamesScoresDialog;
typedef struct {
GtkDialogClass parent_class;
} GamesScoresDialogClass;
-GType games_scores_dialog_get_type (void);
-
-GtkWidget * games_scores_dialog_new (GtkWindow *parent_window, GamesScores *scores, const gchar *title);
-void games_scores_dialog_set_category_description (GamesScoresDialog *self,
- const gchar *description);
-void games_scores_dialog_set_hilight (GamesScoresDialog *self, guint pos);
-void games_scores_dialog_set_message (GamesScoresDialog *self,
- const gchar *message);
-void games_scores_dialog_set_buttons (GamesScoresDialog *self, guint buttons);
+GType games_scores_dialog_get_type (void);
+GtkWidget *games_scores_dialog_new (GtkWindow *parent_window,
+ GamesScores *scores,
+ const gchar *title);
+void games_scores_dialog_set_category_description (GamesScoresDialog *self,
+ const gchar *description);
+void games_scores_dialog_set_hilight (GamesScoresDialog *self,
+ guint pos);
+void games_scores_dialog_set_message (GamesScoresDialog *self,
+ const gchar *message);
+void games_scores_dialog_set_buttons (GamesScoresDialog *self,
+ guint buttons);
G_END_DECLS
#endif
diff --git a/libgames-support/games-scores.c b/libgames-support/games-scores.c
index a658c72..c2bcdc6 100644
--- a/libgames-support/games-scores.c
+++ b/libgames-support/games-scores.c
@@ -40,7 +40,7 @@ typedef struct {
GamesScoresBackend *backend;
} GamesScoresCategoryInternal;
-struct _GamesScoresPrivate {
+struct GamesScoresPrivate {
GHashTable *categories;
GSList *catsordered;
gchar *currentcat;
diff --git a/libgames-support/games-scores.h b/libgames-support/games-scores.h
index 4ea76ee..8b2ea74 100644
--- a/libgames-support/games-scores.h
+++ b/libgames-support/games-scores.h
@@ -36,69 +36,55 @@ G_BEGIN_DECLS
typedef struct {
gchar *key; /* A unique identifier (warning: this is used to generate the
- * scores file name, so it should match the old domains) */
+ * scores file name, so it should match the old domains) */
gchar *name; /* A human-readable description. */
} GamesScoresCategory;
typedef void (*GamesScoresCategoryForeachFunc) (GamesScoresCategory * cat,
- gpointer data);
+ gpointer data);
#define GAMES_TYPE_SCORES (games_scores_get_type())
#define GAMES_SCORES(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), games_scores_get_type(), GamesScores)
#define GAMES_SCORES_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), games_scores_get_type(), GamesScores const)
#define GAMES_SCORES_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), games_scores_get_type(), GamesScoresClass)
#define GAMES_IS_SCORES(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), games_scores_get_type ())
-
#define GAMES_SCORES_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), games_scores_get_type(), GamesScoresClass)
-typedef struct _GamesScores GamesScores;
-typedef struct _GamesScoresPrivate GamesScoresPrivate;
-typedef struct _GamesScoresClass GamesScoresClass;
+typedef struct GamesScoresPrivate GamesScoresPrivate;
-struct _GamesScores {
+typedef struct {
GObject parent;
+ /*< private >*/
GamesScoresPrivate *priv;
-};
+} GamesScores;
-struct _GamesScoresClass {
+typedef struct {
GObjectClass parent;
-};
-
-GType games_scores_get_type (void);
-
-GamesScores *games_scores_new (const char *app_name,
- const GamesScoresCategory *categories,
- int n_categories,
- const char *categories_context,
- const char *categories_domain,
- int default_category_index,
- GamesScoreStyle style);
-
-void games_scores_set_category (GamesScores * self, gchar * category);
-
-gint games_scores_add_score (GamesScores * self, GamesScore *score);
-
-gint games_scores_add_plain_score (GamesScores * self, guint32 value);
-
-gint games_scores_add_time_score (GamesScores * self, gdouble value);
-
-void games_scores_update_score (GamesScores * self, gchar * new_name);
-
-void games_scores_update_score_name (GamesScores * self, gchar * new_name, gchar * old_name);
-
-GList *games_scores_get (GamesScores * self);
-
-void _games_scores_category_foreach (GamesScores * self,
- GamesScoresCategoryForeachFunc func,
- gpointer userdata);
-
-GamesScoreStyle games_scores_get_style (GamesScores * self);
-
-const gchar *games_scores_get_category (GamesScores * self);
-
-void games_scores_add_category (GamesScores *self,
- const char *key,
- const char *name);
+} GamesScoresClass;
+
+GType games_scores_get_type (void);
+GamesScores *games_scores_new (const char *app_name,
+ const GamesScoresCategory *categories,
+ int n_categories,
+ const char *categories_context,
+ const char *categories_domain,
+ int default_category_index,
+ GamesScoreStyle style);
+void games_scores_set_category (GamesScores * self, gchar * category);
+gint games_scores_add_score (GamesScores * self, GamesScore *score);
+gint games_scores_add_plain_score (GamesScores * self, guint32 value);
+gint games_scores_add_time_score (GamesScores * self, gdouble value);
+void games_scores_update_score (GamesScores * self, gchar * new_name);
+void games_scores_update_score_name (GamesScores * self, gchar * new_name, gchar * old_name);
+GList * games_scores_get (GamesScores * self);
+void _games_scores_category_foreach (GamesScores * self,
+ GamesScoresCategoryForeachFunc func,
+ gpointer userdata);
+GamesScoreStyle games_scores_get_style (GamesScores * self);
+const gchar *games_scores_get_category (GamesScores * self);
+void games_scores_add_category (GamesScores *self,
+ const char *key,
+ const char *name);
G_END_DECLS
diff --git a/libgames-support/games-setgid-io.h b/libgames-support/games-setgid-io.h
index 55c9a12..f6fa4a0 100644
--- a/libgames-support/games-setgid-io.h
+++ b/libgames-support/games-setgid-io.h
@@ -15,15 +15,24 @@
#include <fcntl.h>
#include <unistd.h>
-void setgid_io_init (void);
-int setgid_io_open (const char *path, int flags);
-int setgid_io_close (int fd);
-int setgid_io_read (int fd, char *buffer, int n);
-int setgid_io_write (int fd, const char *buffer, int n);
-off_t setgid_io_seek (int fd, off_t offset, int whence);
-int setgid_io_lock (int fd);
-int setgid_io_unlock (int fd);
-int setgid_io_stat (char *filename, struct stat *buffer);
-int setgid_io_truncate (int fd, int length);
+void setgid_io_init (void);
+int setgid_io_open (const char *path,
+ int flags);
+int setgid_io_close (int fd);
+int setgid_io_read (int fd,
+ char *buffer,
+ int n);
+int setgid_io_write (int fd,
+ const char *buffer,
+ int n);
+off_t setgid_io_seek (int fd,
+ off_t offset,
+ int whence);
+int setgid_io_lock (int fd);
+int setgid_io_unlock (int fd);
+int setgid_io_stat (char *filename,
+ struct stat *buffer);
+int setgid_io_truncate (int fd,
+ int length);
#endif /* GAMES_SETGID_IO_H */
diff --git a/libgames-support/games-settings.h b/libgames-support/games-settings.h
index 152d001..1f9d370 100644
--- a/libgames-support/games-settings.h
+++ b/libgames-support/games-settings.h
@@ -24,17 +24,16 @@
G_BEGIN_DECLS
-void games_settings_get_keyval (GSettings *settings,
- const char *key,
- guint *keyval,
- GdkModifierType *modifiers);
-gboolean games_settings_set_keyval (GSettings *settings,
- const char *key,
- guint keyval,
- GdkModifierType modifiers);
-
-void games_settings_bind_window_state (const char *path,
- GtkWindow *window);
+void games_settings_get_keyval (GSettings *settings,
+ const char *key,
+ guint *keyval,
+ GdkModifierType *modifiers);
+gboolean games_settings_set_keyval (GSettings *settings,
+ const char *key,
+ guint keyval,
+ GdkModifierType modifiers);
+void games_settings_bind_window_state (const char *path,
+ GtkWindow *window);
G_END_DECLS
diff --git a/libgames-support/games-show.h b/libgames-support/games-show.h
index 721d442..4d255eb 100644
--- a/libgames-support/games-show.h
+++ b/libgames-support/games-show.h
@@ -24,15 +24,14 @@
G_BEGIN_DECLS
-gboolean games_show_uri (GdkScreen *screen,
- const char *uri,
- guint32 timestamp,
- GError **error);
-
-void games_show_error (GtkWidget *window,
- GError *error,
- const char *primary_text_format,
- ...) G_GNUC_PRINTF (3, 4);
+gboolean games_show_uri (GdkScreen *screen,
+ const char *uri,
+ guint32 timestamp,
+ GError **error);
+void games_show_error (GtkWidget *window,
+ GError *error,
+ const char *primary_text_format,
+ ...) G_GNUC_PRINTF (3, 4);
G_END_DECLS
diff --git a/libgames-support/games-sound.h b/libgames-support/games-sound.h
index 938c771..13573eb 100644
--- a/libgames-support/games-sound.h
+++ b/libgames-support/games-sound.h
@@ -27,25 +27,18 @@
G_BEGIN_DECLS
gboolean games_sound_is_available (void);
-
-void games_sound_init (GdkScreen *screen);
-
+void games_sound_init (GdkScreen *screen);
#ifndef GDK_MULTIHEAD_SAFE
-void games_sound_play (const gchar *sound_name);
+void games_sound_play (const gchar *sound_name);
#endif
-
-void games_sound_play_for_screen (const gchar *sound_name,
- GdkScreen *screen);
-
-void games_sound_play_for_event (const gchar *sound_name,
- GdkEvent *event);
-
-void games_sound_play_for_widget (const gchar *sound_name,
- GtkWidget *widget);
-
-void games_sound_enable (gboolean enabled);
-
-gboolean games_sound_is_enabled (void);
+void games_sound_play_for_screen (const gchar *sound_name,
+ GdkScreen *screen);
+void games_sound_play_for_event (const gchar *sound_name,
+ GdkEvent *event);
+void games_sound_play_for_widget (const gchar *sound_name,
+ GtkWidget *widget);
+void games_sound_enable (gboolean enabled);
+gboolean games_sound_is_enabled (void);
G_END_DECLS
diff --git a/libgames-support/games-stock.h b/libgames-support/games-stock.h
index 57a3097..8c53854 100644
--- a/libgames-support/games-stock.h
+++ b/libgames-support/games-stock.h
@@ -52,11 +52,9 @@ G_BEGIN_DECLS
#define GAMES_STOCK_RTELEPORT "games-teleport-random"
#define GAMES_STOCK_DEAL_CARDS "games-cards-deal"
-void games_stock_init (void);
-
-void games_stock_prepare_for_statusbar_tooltips (GtkUIManager * ui_manager,
- GtkWidget * statusbar);
-
+void games_stock_init (void);
+void games_stock_prepare_for_statusbar_tooltips (GtkUIManager * ui_manager,
+ GtkWidget * statusbar);
gchar *games_get_license (const gchar * game_name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]