[retro-gtk] Name all callbacks *_cb()



commit b9b4532c8441d41bc5671f05e06d4d93eb23a24e
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat Feb 22 21:37:39 2020 +0500

    Name all callbacks *_cb()

 retro-gtk/retro-cairo-display.c  | 10 +++++-----
 retro-gtk/retro-core-view.c      | 24 ++++++++++++------------
 retro-gtk/retro-core.c           |  6 +++---
 retro-gtk/retro-gl-display.c     |  8 ++++----
 retro-runner/retro-environment.c | 30 +++++++++++++++---------------
 retro-runner/retro-pa-player.c   | 20 ++++++++++----------
 tests/retro-reftest.c            |  4 ++--
 7 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/retro-gtk/retro-cairo-display.c b/retro-gtk/retro-cairo-display.c
index f5e96ec..1fbbbcd 100644
--- a/retro-gtk/retro-cairo-display.c
+++ b/retro-gtk/retro-cairo-display.c
@@ -12,7 +12,7 @@ struct _RetroCairoDisplay
   GdkPixbuf *pixbuf;
   RetroVideoFilter filter;
   gfloat aspect_ratio;
-  gulong on_video_output_id;
+  gulong video_output_cb_id;
 };
 
 G_DEFINE_TYPE (RetroCairoDisplay, retro_cairo_display, GTK_TYPE_DRAWING_AREA)
@@ -231,7 +231,7 @@ retro_cairo_display_init (RetroCairoDisplay *self)
 }
 
 static void
-on_video_output (RetroCore         *sender,
+video_output_cb (RetroCore         *sender,
                  RetroPixdata      *pixdata,
                  RetroCairoDisplay *self)
 {
@@ -264,15 +264,15 @@ retro_cairo_display_set_core (RetroCairoDisplay *self,
     return;
 
   if (self->core != NULL) {
-    g_signal_handler_disconnect (G_OBJECT (self->core), self->on_video_output_id);
+    g_signal_handler_disconnect (G_OBJECT (self->core), self->video_output_cb_id);
     g_clear_object (&self->core);
   }
 
   if (core != NULL) {
     self->core = g_object_ref (core);
-    self->on_video_output_id =
+    self->video_output_cb_id =
       g_signal_connect_object (core, "video-output",
-                               (GCallback) on_video_output, self, 0);
+                               (GCallback) video_output_cb, self, 0);
   }
 }
 
diff --git a/retro-gtk/retro-core-view.c b/retro-gtk/retro-core-view.c
index d09f28d..157ba23 100644
--- a/retro-gtk/retro-core-view.c
+++ b/retro-gtk/retro-core-view.c
@@ -180,7 +180,7 @@ static gboolean get_key_state (RetroCoreView *self,
                                guint16        hardware_keycode);
 
 static gboolean
-on_key_press_event (GtkWidget     *source,
+key_press_event_cb (GtkWidget     *source,
                     GdkEventKey   *event,
                     RetroCoreView *self)
 {
@@ -203,7 +203,7 @@ on_key_press_event (GtkWidget     *source,
 }
 
 static gboolean
-on_key_release_event (GtkWidget     *source,
+key_release_event_cb (GtkWidget     *source,
                       GdkEventKey   *event,
                       RetroCoreView *self)
 {
@@ -216,7 +216,7 @@ on_key_release_event (GtkWidget     *source,
 }
 
 static gboolean
-on_button_press_event (GtkWidget      *source,
+button_press_event_cb (GtkWidget      *source,
                        GdkEventButton *event,
                        RetroCoreView  *self)
 {
@@ -244,7 +244,7 @@ on_button_press_event (GtkWidget      *source,
 }
 
 static gboolean
-on_button_release_event (GtkWidget      *source,
+button_release_event_cb (GtkWidget      *source,
                          GdkEventButton *event,
                          RetroCoreView  *self)
 {
@@ -256,7 +256,7 @@ on_button_release_event (GtkWidget      *source,
 }
 
 static gboolean
-on_focus_out_event (GtkWidget     *source,
+focus_out_event_cb (GtkWidget     *source,
                     GdkEventFocus *event,
                     RetroCoreView *self)
 {
@@ -272,7 +272,7 @@ on_focus_out_event (GtkWidget     *source,
 }
 
 static gboolean
-on_motion_notify_event (GtkWidget      *source,
+motion_notify_event_cb (GtkWidget      *source,
                         GdkEventMotion *event,
                         RetroCoreView  *self)
 {
@@ -486,12 +486,12 @@ retro_core_view_init (RetroCoreView *self)
   self->key_joypad_mapping = retro_key_joypad_mapping_new_default ();
   self->mouse_button_state = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, g_free);
 
-  g_signal_connect_object (self, "key-press-event", (GCallback) on_key_press_event, self, 0);
-  g_signal_connect_object (self, "key-release-event", (GCallback) on_key_release_event, self, 0);
-  g_signal_connect_object (self, "button-press-event", (GCallback) on_button_press_event, self, 0);
-  g_signal_connect_object (self, "button-release-event", (GCallback) on_button_release_event, self, 0);
-  g_signal_connect_object (self, "focus-out-event", (GCallback) on_focus_out_event, self, 0);
-  g_signal_connect_object (self, "motion-notify-event", (GCallback) on_motion_notify_event, self, 0);
+  g_signal_connect_object (self, "key-press-event", (GCallback) key_press_event_cb, self, 0);
+  g_signal_connect_object (self, "key-release-event", (GCallback) key_release_event_cb, self, 0);
+  g_signal_connect_object (self, "button-press-event", (GCallback) button_press_event_cb, self, 0);
+  g_signal_connect_object (self, "button-release-event", (GCallback) button_release_event_cb, self, 0);
+  g_signal_connect_object (self, "focus-out-event", (GCallback) focus_out_event_cb, self, 0);
+  g_signal_connect_object (self, "motion-notify-event", (GCallback) motion_notify_event_cb, self, 0);
 }
 
 /* Public */
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 761d7a9..c2a2a6f 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -630,7 +630,7 @@ exit_cb (RetroRunnerProcess *process,
 }
 
 static gboolean
-on_key_event (GtkWidget   *widget,
+key_event_cb (GtkWidget   *widget,
               GdkEventKey *event,
               RetroCore   *self)
 {
@@ -1713,13 +1713,13 @@ retro_core_set_keyboard (RetroCore *self,
     self->key_press_event_id =
       g_signal_connect_object (widget,
                                "key-press-event",
-                               G_CALLBACK (on_key_event),
+                               G_CALLBACK (key_event_cb),
                                self,
                                0);
     self->key_release_event_id =
       g_signal_connect_object (widget,
                                "key-release-event",
-                               G_CALLBACK (on_key_event),
+                               G_CALLBACK (key_event_cb),
                                self,
                                0);
     self->keyboard_widget = widget;
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index 30f4193..a6a3a0f 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -15,7 +15,7 @@ struct _RetroGLDisplay
   GdkPixbuf *pixbuf;
   RetroVideoFilter filter;
   gfloat aspect_ratio;
-  gulong on_video_output_id;
+  gulong video_output_cb_id;
 
   RetroGLSLFilter *glsl_filter[RETRO_VIDEO_FILTER_COUNT];
   GLuint texture;
@@ -355,7 +355,7 @@ retro_gl_display_init (RetroGLDisplay *self)
 }
 
 static void
-on_video_output (RetroCore      *sender,
+video_output_cb (RetroCore      *sender,
                  RetroPixdata   *pixdata,
                  RetroGLDisplay *self)
 {
@@ -385,13 +385,13 @@ retro_gl_display_set_core (RetroGLDisplay *self,
     return;
 
   if (self->core != NULL) {
-    g_signal_handler_disconnect (G_OBJECT (self->core), self->on_video_output_id);
+    g_signal_handler_disconnect (G_OBJECT (self->core), self->video_output_cb_id);
     g_clear_object (&self->core);
   }
 
   if (core != NULL) {
     self->core = g_object_ref (core);
-    self->on_video_output_id = g_signal_connect_object (core, "video-output", (GCallback) on_video_output, 
self, 0);
+    self->video_output_cb_id = g_signal_connect_object (core, "video-output", (GCallback) video_output_cb, 
self, 0);
   }
 }
 
diff --git a/retro-runner/retro-environment.c b/retro-runner/retro-environment.c
index 8ae8844..b8f90d1 100644
--- a/retro-runner/retro-environment.c
+++ b/retro-runner/retro-environment.c
@@ -108,7 +108,7 @@ rumble_callback_set_rumble_state (guint             port,
 }
 
 static void
-on_log (guint level, const gchar *format, ...)
+log_cb (guint level, const gchar *format, ...)
 {
   RetroCore *self = retro_core_get_instance ();
   const gchar *log_domain;
@@ -236,7 +236,7 @@ static gboolean
 get_log_callback (RetroCore        *self,
                   RetroLogCallback *cb)
 {
-  cb->log = on_log;
+  cb->log = log_cb;
 
   return TRUE;
 }
@@ -513,7 +513,7 @@ environment_core_command (RetroCore *self,
 /* Core callbacks */
 
 static gboolean
-on_environment_interface (unsigned cmd,
+environment_interface_cb (unsigned cmd,
                           gpointer data)
 {
   RetroCore *self = retro_core_get_instance ();
@@ -522,7 +522,7 @@ on_environment_interface (unsigned cmd,
 }
 
 static void
-on_video_refresh (guint8 *data,
+video_refresh_cb (guint8 *data,
                   guint   width,
                   guint   height,
                   gsize   pitch)
@@ -548,11 +548,11 @@ on_video_refresh (guint8 *data,
 gpointer
 retro_core_get_module_video_refresh_cb (RetroCore *self)
 {
-  return on_video_refresh;
+  return video_refresh_cb;
 }
 
 static void
-on_audio_sample (gint16 left,
+audio_sample_cb (gint16 left,
                  gint16 right)
 {
   RetroCore *self = retro_core_get_instance ();
@@ -568,7 +568,7 @@ on_audio_sample (gint16 left,
 }
 
 static gsize
-on_audio_sample_batch (gint16 *data,
+audio_sample_batch_cb (gint16 *data,
                        gint    frames)
 {
   RetroCore *self = retro_core_get_instance ();
@@ -585,7 +585,7 @@ on_audio_sample_batch (gint16 *data,
 }
 
 static void
-on_input_poll ()
+input_poll_cb ()
 {
   RetroCore *self = retro_core_get_instance ();
 
@@ -593,7 +593,7 @@ on_input_poll ()
 }
 
 static gint16
-on_input_state (guint port,
+input_state_cb (guint port,
                 guint device,
                 guint index,
                 guint id)
@@ -615,7 +615,7 @@ retro_core_set_environment_interface (RetroCore *self)
 
   module = self->module;
   set_environment = retro_module_get_set_environment (module);
-  set_environment (on_environment_interface);
+  set_environment (environment_interface_cb);
 }
 
 // TODO This is internal, make it private as soon as possible.
@@ -636,9 +636,9 @@ retro_core_set_callbacks (RetroCore *self)
   set_input_poll = retro_module_get_set_input_poll (module);
   set_input_state = retro_module_get_set_input_state (module);
 
-  set_video_refresh (on_video_refresh);
-  set_audio_sample (on_audio_sample);
-  set_audio_sample_batch (on_audio_sample_batch);
-  set_input_poll (on_input_poll);
-  set_input_state (on_input_state);
+  set_video_refresh (video_refresh_cb);
+  set_audio_sample (audio_sample_cb);
+  set_audio_sample_batch (audio_sample_batch_cb);
+  set_input_poll (input_poll_cb);
+  set_input_state (input_state_cb);
 }
diff --git a/retro-runner/retro-pa-player.c b/retro-runner/retro-pa-player.c
index 5f2720d..6f553c3 100644
--- a/retro-runner/retro-pa-player.c
+++ b/retro-runner/retro-pa-player.c
@@ -13,8 +13,8 @@ struct _RetroPaPlayer
 {
   GObject parent_instance;
   RetroCore *core;
-  gulong on_audio_output_id;
-  gulong on_iterated_id;
+  gulong audio_output_cb_id;
+  gulong iterated_cb_id;
   GArray *buffer;
   gdouble sample_rate;
   pa_simple *simple;
@@ -139,7 +139,7 @@ resample (RetroPaPlayer *self,
 }
 
 static void
-on_audio_output (RetroCore     *sender,
+audio_output_cb (RetroCore     *sender,
                  gint16        *data,
                  int            length,
                  gdouble        sample_rate,
@@ -149,7 +149,7 @@ on_audio_output (RetroCore     *sender,
 }
 
 static void
-on_iterated (RetroCore     *core,
+iterated_cb (RetroCore     *core,
              RetroPaPlayer *self)
 {
   gdouble sample_rate, speed_rate;
@@ -209,24 +209,24 @@ retro_pa_player_set_core (RetroPaPlayer *self,
 
   if (self->core != NULL) {
     g_signal_handler_disconnect (G_OBJECT (self->core),
-                                 self->on_audio_output_id);
+                                 self->audio_output_cb_id);
     g_signal_handler_disconnect (G_OBJECT (self->core),
-                                 self->on_iterated_id);
+                                 self->iterated_cb_id);
     g_clear_object (&self->core);
   }
 
   if (core != NULL) {
     self->core = g_object_ref (core);
-    self->on_audio_output_id =
+    self->audio_output_cb_id =
       g_signal_connect_object (core,
                                "audio-output",
-                               (GCallback) on_audio_output,
+                               (GCallback) audio_output_cb,
                                self,
                                0);
-    self->on_iterated_id =
+    self->iterated_cb_id =
       g_signal_connect_object (core,
                                "iterated",
-                               (GCallback) on_iterated,
+                               (GCallback) iterated_cb,
                                self,
                                0);
   }
diff --git a/tests/retro-reftest.c b/tests/retro-reftest.c
index 468dda1..e813839 100644
--- a/tests/retro-reftest.c
+++ b/tests/retro-reftest.c
@@ -250,7 +250,7 @@ pixdata_equal (GdkPixbuf  *test,
 }
 
 static void
-on_video_output (RetroReftestData *data,
+video_output_cb (RetroReftestData *data,
                  RetroPixdata     *pixdata)
 {
   if (pixdata == NULL)
@@ -697,7 +697,7 @@ retro_reftest_setup_for_file (GFile *file)
   g_list_free (frames);
   retro_reftest_data_unref (data);
 
-  g_signal_connect_swapped (data->core, "video-output", (GCallback) on_video_output, data);
+  g_signal_connect_swapped (data->core, "video-output", (GCallback) video_output_cb, data);
 }
 
 int


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