[retro-gtk/c-port: 37/39] truc



commit a0154ccace9964c11a83cba6c7e3b9a8a8f11d8a
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Sep 25 22:21:56 2017 +0200

    truc

 retro-gtk/Makefile.am                    |   31 +----
 retro-gtk/retro-core-private.h           |    1 -
 retro-gtk/retro-core-view-input-device.h |    1 -
 retro-gtk/retro-core-view.c              |    1 -
 retro-gtk/retro-core.c                   |  245 +++++++++++++++++-------------
 retro-gtk/retro-environment.c            |    1 -
 retro-gtk/retro-gtk.h                    |    1 -
 retro-gtk/retro-main-loop.c              |    2 -
 retro-gtk/retro-module-iterator.c        |    2 -
 retro-gtk/retro-module-query.c           |    2 -
 retro-gtk/retro-pa-player.c              |    1 -
 11 files changed, 143 insertions(+), 145 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index 104ea6f..7610a38 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -25,8 +25,6 @@ vapidir = $(datadir)/vala/vapi
 vapi_DATA = retro-gtk-0.12.vapi
 dist_vapi_DATA = retro-gtk-0.12.deps
 
-BUILT_SOURCES = retro-gtk-internal.h
-
 libretro_gtk_la_SOURCES = \
        input/retro-keyboard-key.c \
        \
@@ -54,30 +52,6 @@ libretro_gtk_la_SOURCES = \
        video/retro-video-converter.c \
        $(NULL)
 
-video/retro-video-converter.c: retro-gtk-internal.h
-
-retro-core.c: retro-gtk-internal.h
-
-# retro-core-descriptor.c: retro-gtk-internal.h
-
-retro-core-view.c: retro-gtk-internal.h
-
-retro-core-view-input-device.c: retro-gtk-internal.h
-
-retro-environment.c: retro-gtk-internal.h libretro-environment.h
-
-retro-log.c: retro-gtk-internal.h
-
-retro-main-loop.c: retro-gtk-internal.h
-
-retro-module.c: retro-gtk-internal.h
-
-retro-module-iterator.c: retro-gtk-internal.h
-
-retro-module-query.c: retro-gtk-internal.h
-
-retro-pa-player.c: retro-gtk-internal.h
-
 libretro_gtk_la_LDFLAGS =
 
 libretro_gtk_la_VALAFLAGS = \
@@ -95,8 +69,6 @@ libretro_gtk_la_VALAFLAGS = \
        --thread \
        --target-glib 2.32 \
        --library retro-gtk-0.12 \
-       -H retro-gtk-vala.h \
-       -h retro-gtk-internal.h \
        -X -fPIC -X -shared \
        $(NULL)
 
@@ -112,7 +84,6 @@ retro_gtkinclude_HEADERS = \
        retro-core-view.h \
        retro-device-type.h \
        retro-gtk.h \
-       retro-gtk-vala.h \
        retro-input-descriptor.h \
        retro-input-device.h \
        retro-joypad-id.h \
@@ -150,7 +121,7 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 introspection_sources = $(retro_gtkinclude_HEADERS)
 
-BUILT_SOURCES += libretro-gtk.la Retro-0.12.gir
+BUILT_SOURCES = libretro-gtk.la Retro-0.12.gir
 
 Retro-0.12.gir: $(INTROSPECTION_SCANNER) libretro-gtk.la
 Retro_0_12_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0 Gtk-3.0 cairo-1.0
diff --git a/retro-gtk/retro-core-private.h b/retro-gtk/retro-core-private.h
index 160c53d..688227a 100644
--- a/retro-gtk/retro-core-private.h
+++ b/retro-gtk/retro-core-private.h
@@ -5,7 +5,6 @@
 
 #include "retro-core.h"
 #include "retro-disk-control-callback.h"
-#include "retro-gtk-internal.h"
 #include "retro-module.h"
 #include "retro-options.h"
 #include "retro-pixel-format.h"
diff --git a/retro-gtk/retro-core-view-input-device.h b/retro-gtk/retro-core-view-input-device.h
index fff4a3c..3b91a54 100644
--- a/retro-gtk/retro-core-view-input-device.h
+++ b/retro-gtk/retro-core-view-input-device.h
@@ -6,7 +6,6 @@
 #include <glib-object.h>
 #include "retro-core-view.h"
 #include "retro-device-type.h"
-#include "retro-gtk-internal.h"
 
 G_BEGIN_DECLS
 
diff --git a/retro-gtk/retro-core-view.c b/retro-gtk/retro-core-view.c
index ba81f5f..15e639b 100644
--- a/retro-gtk/retro-core-view.c
+++ b/retro-gtk/retro-core-view.c
@@ -1,7 +1,6 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
 #include <linux/input-event-codes.h>
-#include "retro-gtk-internal.h"
 #include "retro-cairo-display.h"
 #include "retro-core-view.h"
 #include "retro-core-view-input-device.h"
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index e2595f3..87ca223 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -60,6 +60,13 @@ static GRecMutex retro_core_w_mutex = { 0 };
 static RetroCore *retro_core_objects[32];
 static gint retro_core_i = 0;
 
+static void retro_core_set_file_name (RetroCore   *self,
+                                      const gchar *value);
+static void retro_core_set_is_initiated (RetroCore *self,
+                                         gboolean   value);
+static void retro_core_set_game_loaded (RetroCore *self,
+                                        gboolean   value);
+
 /* Private */
 
 static GQuark
@@ -175,12 +182,52 @@ retro_core_get_property (GObject    *object,
 {
   RetroCore *self = RETRO_CORE (object);
 
-  // TODO
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
+  switch (prop_id) {
+  case PROP_API_VERSION:
+    g_value_set_uint (value, retro_core_get_api_version (self));
+
+    break;
+  case PROP_FILE_NAME:
+    g_value_set_string (value, retro_core_get_file_name (self));
+
+    break;
+  case PROP_SYSTEM_DIRECTORY:
+    g_value_set_string (value, retro_core_get_system_directory (self));
+
+    break;
+  case PROP_LIBRETRO_PATH:
+    g_value_set_string (value, retro_core_get_libretro_path (self));
+
+    break;
+  case PROP_CONTENT_DIRECTORY:
+    g_value_set_string (value, retro_core_get_content_directory (self));
+
+    break;
+  case PROP_SAVE_DIRECTORY:
+    g_value_set_string (value, retro_core_get_save_directory (self));
+
+    break;
+  case PROP_IS_INITIATED:
+    g_value_set_boolean (value, retro_core_get_is_initiated (self));
+
+    break;
+  case PROP_GAME_LOADED:
+    g_value_set_boolean (value, retro_core_get_game_loaded (self));
+
+    break;
+  case PROP_SUPPORT_NO_GAME:
+    g_value_set_boolean (value, retro_core_get_support_no_game (self));
+
+    break;
+  case PROP_FRAMES_PER_SECOND:
+    g_value_set_double (value, retro_core_get_frames_per_second (self));
+
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+
+    break;
+  }
 }
 
 static void
@@ -192,11 +239,44 @@ retro_core_set_property (GObject      *object,
   RetroCore *self = RETRO_CORE (object);
 
   // TODO
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
+  switch (prop_id) {
+  case PROP_FILE_NAME:
+    retro_core_set_file_name (self, g_value_get_string (value));
+
+    break;
+  case PROP_SYSTEM_DIRECTORY:
+    retro_core_set_system_directory (self, g_value_get_string (value));
+
+    break;
+  case PROP_LIBRETRO_PATH:
+    retro_core_set_libretro_path (self, g_value_get_string (value));
+
+    break;
+  case PROP_CONTENT_DIRECTORY:
+    retro_core_set_content_directory (self, g_value_get_string (value));
+
+    break;
+  case PROP_SAVE_DIRECTORY:
+    retro_core_set_save_directory (self, g_value_get_string (value));
+
+    break;
+  case PROP_IS_INITIATED:
+    retro_core_set_is_initiated (self, g_value_get_boolean (value));
+
+    break;
+  case PROP_GAME_LOADED:
+    retro_core_set_game_loaded (self, g_value_get_boolean (value));
+
+    break;
+  case PROP_SUPPORT_NO_GAME:
+    retro_core_set_support_no_game (self, g_value_get_boolean (value));
+
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+
+    break;
+  }
 }
 
 static void
@@ -415,16 +495,12 @@ retro_core_set_file_name (RetroCore   *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (g_strcmp0 (value, retro_core_get_file_name (self)) != 0) {
-    const gchar* _tmp0_;
-    gchar* _tmp1_;
-    _tmp0_ = value;
-    _tmp1_ = g_strdup (_tmp0_);
-    g_free (self->file_name);
-    self->file_name = _tmp1_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FILE_NAME]);
-  }
+  if (g_strcmp0 (value, retro_core_get_file_name (self)) == 0)
+    return;
+
+  g_free (self->file_name);
+  self->file_name = g_strdup (value);;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FILE_NAME]);
 }
 
 static void
@@ -433,13 +509,11 @@ retro_core_set_is_initiated (RetroCore *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (retro_core_get_is_initiated (self) != value) {
-    gboolean _tmp0_;
-    _tmp0_ = value;
-    self->is_initiated = _tmp0_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IS_INITIATED]);
-  }
+  if (retro_core_get_is_initiated (self) == value)
+    return;
+
+  self->is_initiated = value;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IS_INITIATED]);
 }
 
 static void
@@ -448,13 +522,11 @@ retro_core_set_game_loaded (RetroCore *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (retro_core_get_game_loaded (self) != value) {
-    gboolean _tmp0_;
-    _tmp0_ = value;
-    self->game_loaded = _tmp0_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_GAME_LOADED]);
-  }
+  if (retro_core_get_game_loaded (self) == value)
+    return;
+
+  self->game_loaded = value;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_GAME_LOADED]);
 }
 
 /**
@@ -1021,16 +1093,12 @@ retro_core_get_system_directory (RetroCore *self)
 void retro_core_set_system_directory (RetroCore *self, const gchar* value) {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (g_strcmp0 (value, retro_core_get_system_directory (self)) != 0) {
-    const gchar* _tmp0_;
-    gchar* _tmp1_;
-    _tmp0_ = value;
-    _tmp1_ = g_strdup (_tmp0_);
-    g_free (self->system_directory);
-    self->system_directory = _tmp1_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SYSTEM_DIRECTORY]);
-  }
+  if (g_strcmp0 (value, retro_core_get_system_directory (self)) == 0)
+    return;
+
+  g_free (self->system_directory);
+  self->system_directory = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SYSTEM_DIRECTORY]);
 }
 
 const gchar *
@@ -1047,29 +1115,20 @@ retro_core_set_libretro_path (RetroCore   *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (g_strcmp0 (value, retro_core_get_libretro_path (self)) != 0) {
-    const gchar* _tmp0_;
-    gchar* _tmp1_;
-    _tmp0_ = value;
-    _tmp1_ = g_strdup (_tmp0_);
-    g_free (self->libretro_path);
-    self->libretro_path = _tmp1_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LIBRETRO_PATH]);
-  }
+  if (g_strcmp0 (value, retro_core_get_libretro_path (self)) == 0)
+    return;
+
+  g_free (self->libretro_path);
+  self->libretro_path = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LIBRETRO_PATH]);
 }
 
 const gchar *
 retro_core_get_content_directory (RetroCore *self)
 {
-  const gchar* result;
-  const gchar* _tmp0_;
-
-  // TODO
   g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
-  _tmp0_ = self->content_directory;
-  result = _tmp0_;
-  return result;
+
+  return self->content_directory;
 }
 
 void
@@ -1078,29 +1137,20 @@ retro_core_set_content_directory (RetroCore   *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (g_strcmp0 (value, retro_core_get_content_directory (self)) != 0) {
-    const gchar* _tmp0_;
-    gchar* _tmp1_;
-    _tmp0_ = value;
-    _tmp1_ = g_strdup (_tmp0_);
-    g_free (self->content_directory);
-    self->content_directory = _tmp1_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTENT_DIRECTORY]);
-  }
+  if (g_strcmp0 (value, retro_core_get_content_directory (self)) == 0)
+    return;
+
+  g_free (self->content_directory);
+  self->content_directory = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTENT_DIRECTORY]);
 }
 
 const gchar *
 retro_core_get_save_directory (RetroCore *self)
 {
-  const gchar* result;
-  const gchar* _tmp0_;
-
-  // TODO
   g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
-  _tmp0_ = self->save_directory;
-  result = _tmp0_;
-  return result;
+
+  return self->save_directory;
 }
 
 void
@@ -1109,16 +1159,12 @@ retro_core_set_save_directory (RetroCore   *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (g_strcmp0 (value, retro_core_get_save_directory (self)) != 0) {
-    const gchar* _tmp0_;
-    gchar* _tmp1_;
-    _tmp0_ = value;
-    _tmp1_ = g_strdup (_tmp0_);
-    g_free (self->save_directory);
-    self->save_directory = _tmp1_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SAVE_DIRECTORY]);
-  }
+  if (g_strcmp0 (value, retro_core_get_save_directory (self)) == 0)
+    return;
+
+  g_free (self->save_directory);
+  self->save_directory = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SAVE_DIRECTORY]);
 }
 
 gboolean
@@ -1132,14 +1178,9 @@ retro_core_get_is_initiated (RetroCore *self)
 gboolean
 retro_core_get_game_loaded (RetroCore *self)
 {
-  gboolean result;
-  gboolean _tmp0_;
-
-  // TODO
   g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
-  _tmp0_ = self->game_loaded;
-  result = _tmp0_;
-  return result;
+
+  return self->game_loaded;
 }
 
 gboolean
@@ -1156,13 +1197,11 @@ retro_core_set_support_no_game (RetroCore *self,
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
-  // TODO
-  if (retro_core_get_support_no_game (self) != value) {
-    gboolean _tmp0_;
-    _tmp0_ = value;
-    self->support_no_game = _tmp0_;
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SUPPORT_NO_GAME]);
-  }
+  if (retro_core_get_support_no_game (self) == value)
+    return;
+
+  self->support_no_game = value;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SUPPORT_NO_GAME]);
 }
 
 gdouble
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index 8572480..9514509 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -1,6 +1,5 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
-#include "retro-gtk-internal.h"
 #include "libretro-environment.h"
 #include "retro-core-private.h"
 
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index b6e16ab..f75837d 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -12,7 +12,6 @@
 #include "retro-core.h"
 #include "retro-core-view.h"
 #include "retro-device-type.h"
-#include "retro-gtk-vala.h"
 #include "retro-input-descriptor.h"
 #include "retro-input-device.h"
 #include "retro-joypad-id.h"
diff --git a/retro-gtk/retro-main-loop.c b/retro-gtk/retro-main-loop.c
index 5820792..8973bd4 100644
--- a/retro-gtk/retro-main-loop.c
+++ b/retro-gtk/retro-main-loop.c
@@ -2,8 +2,6 @@
 
 #include "retro-main-loop.h"
 
-#include "retro-gtk-internal.h"
-
 struct _RetroMainLoop
 {
   GObject parent_instance;
diff --git a/retro-gtk/retro-module-iterator.c b/retro-gtk/retro-module-iterator.c
index 2cc4063..5a0045f 100644
--- a/retro-gtk/retro-module-iterator.c
+++ b/retro-gtk/retro-module-iterator.c
@@ -1,7 +1,5 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
-#include "retro-gtk-internal.h"
-
 #include "retro-module-iterator.h"
 
 struct _RetroModuleIterator
diff --git a/retro-gtk/retro-module-query.c b/retro-gtk/retro-module-query.c
index 45476fd..da5c2c8 100644
--- a/retro-gtk/retro-module-query.c
+++ b/retro-gtk/retro-module-query.c
@@ -2,8 +2,6 @@
 
 #include "retro-module-query.h"
 
-#include "retro-gtk-internal.h"
-
 struct _RetroModuleQuery
 {
   GObject parent_instance;
diff --git a/retro-gtk/retro-pa-player.c b/retro-gtk/retro-pa-player.c
index d86e82e..a8127f5 100644
--- a/retro-gtk/retro-pa-player.c
+++ b/retro-gtk/retro-pa-player.c
@@ -4,7 +4,6 @@
 
 #include <pulse/simple.h>
 #include <pulse/pulseaudio.h>
-#include "retro-gtk-internal.h"
 
 struct _RetroPaPlayer
 {


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