[retro-gtk] retro-gobject: Make Core.variables_interface private
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-gobject: Make Core.variables_interface private
- Date: Wed, 25 Jan 2017 14:02:23 +0000 (UTC)
commit f731804fb58cf8ccb09fe303342664b9a1a4126e
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Jan 25 13:45:22 2017 +0100
retro-gobject: Make Core.variables_interface private
Make the variables interface internal.
This simplifies the public API.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gobject/core.vala | 22 ++--------------------
retro-gobject/retro-environment.c | 22 +++-------------------
retro-gobject/variable/options.vala | 2 +-
retro-gobject/variable/variables.vala | 4 ++--
4 files changed, 8 insertions(+), 42 deletions(-)
---
diff --git a/retro-gobject/core.vala b/retro-gobject/core.vala
index 4424051..6c90660 100644
--- a/retro-gobject/core.vala
+++ b/retro-gobject/core.vala
@@ -191,26 +191,6 @@ public class Core : Object {
}
}
- private weak Variables _variables_interface;
- /**
- * The variables interface.
- *
- * Optional.
- * If set, it must be set before {@link init} is called.
- */
- public weak Variables variables_interface {
- get { return _variables_interface; }
- construct set {
- if (_variables_interface != null)
- _variables_interface.core = null;
-
- _variables_interface = value;
-
- if (_variables_interface != null && _variables_interface.core != this)
- _variables_interface.core = this;
- }
- }
-
/**
* The rumble interface.
*
@@ -241,6 +221,7 @@ public class Core : Object {
private extern void set_callbacks ();
internal Module module;
+ internal Variables variables_interface;
internal float aspect_ratio;
internal bool overscan;
@@ -265,6 +246,7 @@ public class Core : Object {
module = new Module (libretro_path);
set_callbacks ();
+ variables_interface = new Retro.Options ();
}
~Core () {
diff --git a/retro-gobject/retro-environment.c b/retro-gobject/retro-environment.c
index f0d31c6..d92ca88 100644
--- a/retro-gobject/retro-environment.c
+++ b/retro-gobject/retro-environment.c
@@ -117,27 +117,16 @@ static gboolean get_system_directory (RetroCore *self, const gchar* *system_dire
}
static gboolean get_variable (RetroCore *self, RetroVariable *variable) {
- RetroVariables *variables;
gchar *result;
- variables = retro_core_get_variables_interface (self);
-
- g_return_val_if_fail (variables != NULL, FALSE);
-
- result = retro_variables_get_variable (variables, variable->key);
+ result = retro_variables_get_variable (self->variables_interface, variable->key);
variable->value = result ? result : "";
return !!result;
}
static gboolean get_variable_update (RetroCore *self, gboolean *update) {
- RetroVariables *variables;
-
- variables = retro_core_get_variables_interface (self);
-
- g_return_val_if_fail (variables != NULL, FALSE);
-
- *update = retro_variables_get_variable_update (variables);
+ *update = retro_variables_get_variable_update (self->variables_interface);
return TRUE;
}
@@ -194,15 +183,10 @@ static gboolean set_system_av_info (RetroCore *self, RetroSystemAvInfo *system_a
}
static gboolean set_variables (RetroCore *self, RetroVariable *variable_array) {
- RetroVariables *variables;
int length;
- variables = retro_core_get_variables_interface (self);
-
- g_return_val_if_fail (variables != NULL, FALSE);
-
for (length = 0 ; variable_array[length].key && variable_array[length].value ; length++);
- retro_variables_set_variable (variables, variable_array, length);
+ retro_variables_set_variable (self->variables_interface, variable_array, length);
return TRUE;
}
diff --git a/retro-gobject/variable/options.vala b/retro-gobject/variable/options.vala
index aa9c1c5..eab3ce2 100644
--- a/retro-gobject/variable/options.vala
+++ b/retro-gobject/variable/options.vala
@@ -31,7 +31,7 @@ private class Option : Object {
*
* The options are defined by the core's variables.
*/
-public class Options: Object, Variables {
+private class Options: Object, Variables {
/**
* The core whose variables will be handled.
*/
diff --git a/retro-gobject/variable/variables.vala b/retro-gobject/variable/variables.vala
index de96af9..4fa78b4 100644
--- a/retro-gobject/variable/variables.vala
+++ b/retro-gobject/variable/variables.vala
@@ -7,7 +7,7 @@ namespace Retro {
*
* Used by a {@link Core} in its environment callback.
*/
-public struct Variable {
+private struct Variable {
/**
* The key of the pair.
*/
@@ -33,7 +33,7 @@ public struct Variable {
/**
* An interface to handle a {@link Core}'s variables.
*/
-public interface Variables : Object {
+private interface Variables : Object {
/**
* The core whose variables will be handled.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]