[beast: 39/43] BST: use assert_return and Bse::warning() for runtime warnings



commit be3826d74ae9121f8dac7663d56b6006ca72de67
Author: Tim Janik <timj gnu org>
Date:   Mon Jun 26 02:08:59 2017 +0200

    BST: use assert_return and Bse::warning() for runtime warnings
    
    Signed-off-by: Tim Janik <timj gnu org>

 beast-gtk/bstapp.cc           |    2 +-
 beast-gtk/bsteventrollctrl.cc |    2 +-
 beast-gtk/bstkeybindings.cc   |    2 +-
 beast-gtk/bstmain.cc          |    2 +-
 beast-gtk/bstmenus.cc         |    2 +-
 beast-gtk/bstpianorollctrl.cc |    2 +-
 beast-gtk/bstpreferences.cc   |    6 +++---
 beast-gtk/bstprocedure.cc     |   16 ++++++++--------
 beast-gtk/bstqsampler.cc      |   16 ++++++++--------
 beast-gtk/bstsnetrouter.cc    |    2 +-
 beast-gtk/bstsoundfontview.cc |    2 +-
 beast-gtk/bstutils.cc         |    7 +++----
 12 files changed, 30 insertions(+), 31 deletions(-)
---
diff --git a/beast-gtk/bstapp.cc b/beast-gtk/bstapp.cc
index 985ad2a..e2d127f 100644
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@ -1174,7 +1174,7 @@ app_action_check (gpointer data,
       gxk_radget_sensitize (self, "waves-submenu", BSE_IS_WAVE_REPO (super));
       return TRUE;
     default:
-      g_warning ("BstApp: unknown action: %lu", action);
+      Bse::warning ("BstApp: unknown action: %lu", action);
       return FALSE;
     }
 }
diff --git a/beast-gtk/bsteventrollctrl.cc b/beast-gtk/bsteventrollctrl.cc
index c7d6ac2..e8b6636 100644
--- a/beast-gtk/bsteventrollctrl.cc
+++ b/beast-gtk/bsteventrollctrl.cc
@@ -721,7 +721,7 @@ controller_canvas_drag (BstEventRollController *self,
           self->obj_value = 0;
        }
       if (self->sel_cseq.size())
-       g_warning ("leaking old drag selection (%lu)", self->sel_cseq.size());
+       Bse::warning ("leaking old drag selection (%lu)", self->sel_cseq.size());
       self->sel_cseq.clear();
 
       /* find drag tool */
diff --git a/beast-gtk/bstkeybindings.cc b/beast-gtk/bstkeybindings.cc
index f333de3..a07a170 100644
--- a/beast-gtk/bstkeybindings.cc
+++ b/beast-gtk/bstkeybindings.cc
@@ -255,7 +255,7 @@ key_bindings_check_action (gpointer data,
     case ACTION_LOAD:
       return TRUE;
     default:
-      g_warning ("%s: unknown action: %lu", __func__, action);
+      Bse::warning ("%s: unknown action: %lu", __func__, action);
       return FALSE;
     }
 }
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index c49f9b2..3fe5dfd 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -580,7 +580,7 @@ main_save_rc_files ()
       gchar *file_name = BST_STRDUP_RC_FILE ();
       Bse::Error error = bst_rc_dump (file_name);
       if (error != 0)
-       g_warning ("failed to save rc-file \"%s\": %s", file_name, Bse::error_blurb (error));
+       Bse::warning ("failed to save rc-file \"%s\": %s", file_name, Bse::error_blurb (error));
       g_free (file_name);
     }
 }
diff --git a/beast-gtk/bstmenus.cc b/beast-gtk/bstmenus.cc
index e0bf638..cbd6505 100644
--- a/beast-gtk/bstmenus.cc
+++ b/beast-gtk/bstmenus.cc
@@ -166,7 +166,7 @@ bst_choice_menu_set_item_sensitive (GtkWidget *menu,
          return;
        }
     }
-  g_warning ("unable to find item with id %lu in menu %p", id, menu);
+  Bse::warning ("unable to find item with id %lu in menu %p", id, menu);
 }
 
 GtkWidget*
diff --git a/beast-gtk/bstpianorollctrl.cc b/beast-gtk/bstpianorollctrl.cc
index 3e7f5d3..addf475 100644
--- a/beast-gtk/bstpianorollctrl.cc
+++ b/beast-gtk/bstpianorollctrl.cc
@@ -852,7 +852,7 @@ controller_canvas_drag (BstPianoRollController *self,
          self->obj_velocity = 0;
        }
       if (self->sel_pseq.size())
-       g_warning ("leaking old drag selection (%zu)", self->sel_pseq.size());
+       Bse::warning ("leaking old drag selection (%zu)", self->sel_pseq.size());
       self->sel_pseq.clear();
       self->xoffset = 0;
       self->tick_bound = 0;
diff --git a/beast-gtk/bstpreferences.cc b/beast-gtk/bstpreferences.cc
index 0619482..181cf66 100644
--- a/beast-gtk/bstpreferences.cc
+++ b/beast-gtk/bstpreferences.cc
@@ -320,7 +320,7 @@ bst_preferences_save (BstPreferences *self)
   file_name = BST_STRDUP_RC_FILE ();
   error = bst_rc_dump (file_name);
   if (error != 0)
-    g_warning ("failed to save rc-file \"%s\": %s", file_name, Bse::error_blurb (error));
+    Bse::warning ("failed to save rc-file \"%s\": %s", file_name, Bse::error_blurb (error));
   else
     successfull_rc_dump = TRUE;
   g_free (file_name);
@@ -330,7 +330,7 @@ bst_preferences_save (BstPreferences *self)
   // slist = g_slist_append (slist, bst_pattern_controller_generic_keys());
   error = bst_key_binding_dump (file_name, slist);
   if (error != 0)
-    g_warning ("failed to save keyrc \"%s\": %s", file_name, Bse::error_blurb (error));
+    Bse::warning ("failed to save keyrc \"%s\": %s", file_name, Bse::error_blurb (error));
   g_slist_free (slist);
 
   bst_msg_absorb_config_save();
@@ -338,7 +338,7 @@ bst_preferences_save (BstPreferences *self)
   file_name = g_strdup (bst_skin_config_rcfile ());
   error = bst_skin_dump (file_name);
   if (error != 0)
-    g_warning ("failed to save skinrc \"%s\": %s", file_name, Bse::error_blurb (error));
+    Bse::warning ("failed to save skinrc \"%s\": %s", file_name, Bse::error_blurb (error));
   g_free (file_name);
 }
 
diff --git a/beast-gtk/bstprocedure.cc b/beast-gtk/bstprocedure.cc
index b8c9409..443b7d4 100644
--- a/beast-gtk/bstprocedure.cc
+++ b/beast-gtk/bstprocedure.cc
@@ -89,7 +89,7 @@ bst_procedure_shell_destroy (GtkObject *object)
   BstProcedureShell *self = BST_PROCEDURE_SHELL (object);
 
   if (self->in_execution)
-    g_warning (G_STRLOC ": destroying procedure shell during execution");
+    Bse::warning (G_STRLOC ": destroying procedure shell during execution");
 
   bst_procedure_shell_set_proc (self, NULL);
 
@@ -399,11 +399,11 @@ bst_procedure_shell_preset (BstProcedureShell *self,
              return TRUE;
            }
          else
-           g_warning (G_STRLOC ": cannot convert `%s' value to `%s' for `%s' parameter `%s'",
-                      g_type_name (G_VALUE_TYPE (value)),
-                      g_type_name (G_PARAM_SPEC_VALUE_TYPE (param->pspec)),
-                      g_type_name (G_PARAM_SPEC_TYPE (param->pspec)),
-                      name);
+           Bse::warning (G_STRLOC ": cannot convert `%s' value to `%s' for `%s' parameter `%s'",
+                          g_type_name (G_VALUE_TYPE (value)),
+                          g_type_name (G_PARAM_SPEC_VALUE_TYPE (param->pspec)),
+                          g_type_name (G_PARAM_SPEC_TYPE (param->pspec)),
+                          name);
        }
     }
   /* update parameters from record */
@@ -454,7 +454,7 @@ bst_procedure_exec_internal (const gchar *procedure_name,
   proc = sfi_glue_describe_proc (procedure_name);
   if (!proc)
     {
-      g_warning ("no such procedure \"%s\"", procedure_name);
+      Bse::warning ("no such procedure \"%s\"", procedure_name);
       return;
     }
   proc = sfi_glue_proc_ref (proc);
@@ -474,7 +474,7 @@ bst_procedure_exec_internal (const gchar *procedure_name,
       G_VALUE_COLLECT (&value, var_args, 0, &error);
       if (error)
        {
-         g_warning ("%s: %s", G_STRLOC, error);
+         Bse::warning ("%s: %s", G_STRLOC, error);
          g_free (error);
          break;
        }
diff --git a/beast-gtk/bstqsampler.cc b/beast-gtk/bstqsampler.cc
index 335486d..4f6ace3 100644
--- a/beast-gtk/bstqsampler.cc
+++ b/beast-gtk/bstqsampler.cc
@@ -199,11 +199,11 @@ bst_qsampler_realize (GtkWidget *widget)
   gdk_window_show (qsampler->canvas);
 
   if (!gdk_color_alloc (widget->style->colormap, &qsampler->red))
-    g_warning ("unable to allocate color: { %d, %d, %d }",
-              qsampler->red.red, qsampler->red.green, qsampler->red.blue);
+    Bse::warning ("unable to allocate color: { %d, %d, %d }",
+                  qsampler->red.red, qsampler->red.green, qsampler->red.blue);
   if (!gdk_color_alloc (widget->style->colormap, &qsampler->green))
-    g_warning ("unable to allocate color: { %d, %d, %d }",
-              qsampler->green.red, qsampler->green.green, qsampler->green.blue);
+    Bse::warning ("unable to allocate color: { %d, %d, %d }",
+                  qsampler->green.red, qsampler->green.green, qsampler->green.blue);
   gc_values_mask = GDK_GC_FOREGROUND;
   gc_values.foreground = qsampler->red;
   qsampler->red_gc = gtk_gc_get (widget->style->depth, widget->style->colormap, &gc_values, gc_values_mask);
@@ -234,11 +234,11 @@ bst_qsampler_style_set (GtkWidget *widget,
       gtk_gc_release (qsampler->red_gc);
       gtk_gc_release (qsampler->green_gc);
       if (!gdk_color_alloc (widget->style->colormap, &qsampler->red))
-       g_warning ("unable to allocate color: { %d, %d, %d }",
-                  qsampler->red.red, qsampler->red.green, qsampler->red.blue);
+       Bse::warning ("unable to allocate color: { %d, %d, %d }",
+                      qsampler->red.red, qsampler->red.green, qsampler->red.blue);
       if (!gdk_color_alloc (widget->style->colormap, &qsampler->green))
-       g_warning ("unable to allocate color: { %d, %d, %d }",
-                  qsampler->green.red, qsampler->green.green, qsampler->green.blue);
+       Bse::warning ("unable to allocate color: { %d, %d, %d }",
+                      qsampler->green.red, qsampler->green.green, qsampler->green.blue);
       gc_values_mask = GDK_GC_FOREGROUND;
       gc_values.foreground = qsampler->red;
       qsampler->red_gc = gtk_gc_get (widget->style->depth, widget->style->colormap, &gc_values, 
gc_values_mask);
diff --git a/beast-gtk/bstsnetrouter.cc b/beast-gtk/bstsnetrouter.cc
index 957ec09..6097ae7 100644
--- a/beast-gtk/bstsnetrouter.cc
+++ b/beast-gtk/bstsnetrouter.cc
@@ -172,7 +172,7 @@ bst_snet_router_update_links (BstSNetRouter   *self,
           BstCanvasSource *ocsource = bst_snet_router_csource_from_source (self, osource);
           if (!ocsource)
             {
-              g_warning ("Couldn't figure CanvasSource Item from BSE module \"%s\"", 
bse_item_get_name_or_type (osource));
+              Bse::warning ("Couldn't figure CanvasSource Item from BSE module \"%s\"", 
bse_item_get_name_or_type (osource));
               continue;
             }
           /* find corresponding link */
diff --git a/beast-gtk/bstsoundfontview.cc b/beast-gtk/bstsoundfontview.cc
index 0e40d0b..3b28cb0 100644
--- a/beast-gtk/bstsoundfontview.cc
+++ b/beast-gtk/bstsoundfontview.cc
@@ -78,7 +78,7 @@ bst_sound_font_view_new (SfiProxy sfrepo)
 {
   GtkWidget *sound_font_view;
 
-  g_return_val_if_fail (BSE_IS_SOUND_FONT_REPO (sfrepo), NULL);
+  assert_return (BSE_IS_SOUND_FONT_REPO (sfrepo), NULL);
 
   sound_font_view = gtk_widget_new (BST_TYPE_SOUND_FONT_VIEW, NULL);
   bst_item_view_set_container (BST_ITEM_VIEW (sound_font_view), sfrepo);
diff --git a/beast-gtk/bstutils.cc b/beast-gtk/bstutils.cc
index d7b71ce..cad4584 100644
--- a/beast-gtk/bstutils.cc
+++ b/beast-gtk/bstutils.cc
@@ -1,4 +1,7 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#include "bstmarshal.h"
+#include "bstmarshal.cc"
+
 #include "bstutils.hh"
 
 #include "bstgconfig.hh"
@@ -1321,10 +1324,6 @@ bst_file_scan_find_key (const gchar *file,
 }
 
 
-/* --- generated marshallers --- */
-#include "bstmarshal.cc"
-
-
 // == mouse button checks ==
 static bool
 shift_event (GdkEvent *event)


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