[retro-gtk/wip/aplazas/expose-options: 74/75] Drop Variables interface



commit 644acbb55f471513201b172b1bc56cbac878a97e
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Sep 11 20:10:58 2017 +0200

    Drop Variables interface
    
    Remove the Variables interface as there is only one implementation of it
    and no need for a different one. This makes the code simpler.

 retro-gtk/retro-core.c            |    2 +-
 retro-gtk/retro-environment.c     |    9 ++++-----
 retro-gtk/variable/options.vala   |    2 +-
 retro-gtk/variable/variables.vala |   33 ---------------------------------
 4 files changed, 6 insertions(+), 40 deletions(-)
---
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index d925c85..9b76858 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -668,7 +668,7 @@ retro_core_constructor (RetroCore   *self,
   g_free (libretro_path);
 
   retro_core_set_callbacks (self);
-  self->variables_interface = RETRO_VARIABLES (retro_options_new ());
+  self->variables_interface = retro_options_new ();
 }
 
 // FIXME Make static as soon as possible.
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index b401556..059375c 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -197,8 +197,8 @@ get_variable (RetroCore     *self,
 {
   gchar *result;
 
-  result = retro_variables_get_variable (self->variables_interface,
-                                         variable->key);
+  result = retro_options_get_variable (self->variables_interface,
+                                       variable->key);
   variable->value = result ? result : "";
 
   return !!result;
@@ -208,7 +208,7 @@ static gboolean
 get_variable_update (RetroCore *self,
                      gboolean  *update)
 {
-  *update = retro_variables_get_variable_update (self->variables_interface);
+  *update = retro_options_get_variable_update (self->variables_interface);
 
   return TRUE;
 }
@@ -304,8 +304,7 @@ set_variables (RetroCore     *self,
   for (length = 0 ;
        variable_array[length].key && variable_array[length].value ;
        length++);
-  retro_variables_set_variable (self->variables_interface,
-                                variable_array, length);
+  retro_options_set_variable (self->variables_interface, variable_array, length);
 
   return TRUE;
 }
diff --git a/retro-gtk/variable/options.vala b/retro-gtk/variable/options.vala
index 05072b8..9b8c870 100644
--- a/retro-gtk/variable/options.vala
+++ b/retro-gtk/variable/options.vala
@@ -31,7 +31,7 @@ private class Option : Object {
  *
  * The options are defined by the core's variables.
  */
-private class Options: Object, Variables {
+private class Options: Object {
        /**
         * The core whose variables will be handled.
         */
diff --git a/retro-gtk/variable/variables.vala b/retro-gtk/variable/variables.vala
index 8ca6251..aefaac8 100644
--- a/retro-gtk/variable/variables.vala
+++ b/retro-gtk/variable/variables.vala
@@ -30,38 +30,5 @@ private struct Variable {
        public string? value;
 }
 
-/**
- * An interface to handle a {@link Core}'s variables.
- */
-private interface Variables : Object {
-       /**
-        * The core whose variables will be handled.
-        */
-       public abstract Core core { get; set; }
-
-       /**
-        * Gets the value for a variable.
-        *
-        * @param key the key of the variable whose value should be returned
-        * @return the value of the variable or //null// if the key doesn't exist
-        */
-       public abstract string? get_variable (string key);
-
-       /**
-        * Sets a set of variables to handle.
-        *
-        * @param variables the variables to handle
-        */
-       public abstract void set_variable (Variable[] variables);
-
-       /**
-        * Gets whether a value have been updated since last call to
-        * {@link get_variable}.
-        *
-        * @return //true// if a variable have been updated, //false// otherwise
-        */
-       public abstract bool get_variable_update ();
-}
-
 }
 


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