[beast: 6/14] GXK: use gxk diagnostics and BSE_CONVENIENCE
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 6/14] GXK: use gxk diagnostics and BSE_CONVENIENCE
- Date: Thu, 23 Mar 2017 17:13:51 +0000 (UTC)
commit 9325f575256a81ea162db4d7588580da4dec2174
Author: Tim Janik <timj gnu org>
Date: Tue Mar 14 00:46:00 2017 +0100
GXK: use gxk diagnostics and BSE_CONVENIENCE
Signed-off-by: Tim Janik <timj gnu org>
beast-gtk/gxk/Makefile.am | 2 +-
beast-gtk/gxk/gxk.hh | 2 +-
beast-gtk/gxk/gxkglobals.hh | 8 +++++---
beast-gtk/gxk/gxklogadjustment.cc | 28 ++++++++++++++--------------
beast-gtk/gxk/gxkparam.cc | 36 ++++++++++++++++++------------------
beast-gtk/gxk/gxkrackitem.cc | 2 +-
beast-gtk/gxk/gxkradget.cc | 14 +++++++-------
beast-gtk/gxk/gxksimplelabel.cc | 8 ++++----
beast-gtk/gxk/gxkspline.cc | 24 ++++++++++++------------
beast-gtk/gxk/gxkstatusbar.hh | 2 +-
beast-gtk/gxk/gxktexttools.cc | 4 ++--
beast-gtk/gxk/gxktexttools.hh | 2 +-
beast-gtk/gxk/splinetest.cc | 6 +++---
13 files changed, 70 insertions(+), 68 deletions(-)
---
diff --git a/beast-gtk/gxk/Makefile.am b/beast-gtk/gxk/Makefile.am
index d2041af..5fc84bc 100644
--- a/beast-gtk/gxk/Makefile.am
+++ b/beast-gtk/gxk/Makefile.am
@@ -5,7 +5,7 @@ SUBDIRS =
AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/beast-gtk -I$(top_builddir)/beast-gtk
-I$(srcdir) # -I.. for <gxk/*.h> includes
DEFS += @DEFINE__FILE_DIR__@ -DGTK_DISABLE_COMPAT_H -DGXK_COMPILATION -DG_LOG_DOMAIN=\"GXK\" #
-DGTK_DISABLE_DEPRECATED -DG_DISABLE_CONST_RETURNS -DGTK_ENABLE_BROKEN
-AM_CXXFLAGS += $(GXK_CFLAGS) $(BSE_CFLAGS) $(RAPICORN_CFLAGS) -DRAPICORN_CONVENIENCE
+AM_CXXFLAGS += $(GXK_CFLAGS) $(BSE_CFLAGS) $(RAPICORN_CFLAGS) -DBSE_CONVENIENCE
AM_CFLAGS += $(GXK_CFLAGS)
noinst_LIBRARIES = libgxk.a
diff --git a/beast-gtk/gxk/gxk.hh b/beast-gtk/gxk/gxk.hh
index 461c1e7..67d871a 100644
--- a/beast-gtk/gxk/gxk.hh
+++ b/beast-gtk/gxk/gxk.hh
@@ -2,8 +2,8 @@
#ifndef __GXK_H__
#define __GXK_H__
-#include <sfi/glib-extra.hh>
#include <gtk/gtk.h>
+#include <sfi/bcore.hh>
#include <gxk/glewidgets.h>
#include <gxk/gxkaction.hh>
diff --git a/beast-gtk/gxk/gxkglobals.hh b/beast-gtk/gxk/gxkglobals.hh
index eb9c507..53ec7f6 100644
--- a/beast-gtk/gxk/gxkglobals.hh
+++ b/beast-gtk/gxk/gxkglobals.hh
@@ -2,8 +2,8 @@
#ifndef __GXK_GLOBALS_H__
#define __GXK_GLOBALS_H__
-#include <sfi/glib-extra.hh>
#include <gtk/gtk.h>
+#include <sfi/bcore.hh>
/* --- i18n and gettext helpers --- */
#ifdef GXK_COMPILATION
@@ -15,8 +15,10 @@
/* --- macros --- */
-#define GXK_TOOLTIPS (gxk_globals->tooltips)
-
+#define GXK_TOOLTIPS (gxk_globals->tooltips)
+#define gxk_printout(...) Bse::printerr (__VA_ARGS__)
+#define gxk_printerr(...) Bse::printerr (__VA_ARGS__)
+#define gxk_warning(...) Bse::printerr ("Gxk: warning: %s\n", Bse::string_format (__VA_ARGS__))
/* --- typedefs & structures --- */
typedef void (*GxkFreeFunc) (gpointer data);
diff --git a/beast-gtk/gxk/gxklogadjustment.cc b/beast-gtk/gxk/gxklogadjustment.cc
index 6f3f2c2..271d674 100644
--- a/beast-gtk/gxk/gxklogadjustment.cc
+++ b/beast-gtk/gxk/gxklogadjustment.cc
@@ -106,9 +106,9 @@ adapter_adjustment_adjust_ranges (GxkAdapterAdjustment *self)
if (0)
{
GtkAdjustment *client = self->client;
- printerr ("Tadj(%p): range-changed: [%f %f] (%f %f %f), client(%p): [%f %f] (%f %f %f)\n",
- self, adj->lower, adj->upper, adj->step_increment, adj->page_increment, adj->page_size,
- client, client->lower, client->upper, client->step_increment, client->page_increment,
client->page_size);
+ gxk_printerr ("Tadj(%p): range-changed: [%f %f] (%f %f %f), client(%p): [%f %f] (%f %f %f)\n",
+ self, adj->lower, adj->upper, adj->step_increment, adj->page_increment,
adj->page_size,
+ client, client->lower, client->upper, client->step_increment,
client->page_increment, client->page_size);
}
if (!self->block_client)
{
@@ -136,9 +136,9 @@ adapter_adjustment_client_value_changed (GxkAdapterAdjustment *self)
adj->value = adapter_adjustment_convert (self, GXK_ADAPTER_ADJUSTMENT_CONVERT_FROM_CLIENT,
client->value);
adj->value = CLAMP (adj->value, adj->lower, adj->upper - adj->page_size);
if (0)
- printerr ("Tadj(%p): value-changed: [%f %f] %g client(%p): [%f %f] %g\n",
- self, adj->lower, adj->upper, adj->value,
- client, client->lower, client->upper, client->value);
+ gxk_printerr ("Tadj(%p): value-changed: [%f %f] %g client(%p): [%f %f] %g\n",
+ self, adj->lower, adj->upper, adj->value,
+ client, client->lower, client->upper, client->value);
if (!self->block_client)
{
self->block_client++;
@@ -406,11 +406,11 @@ log_adjustment_adjust_ranges (GxkLogAdjustment *self)
if (0)
{
GtkAdjustment *client = self->client;
- printerr ("ladj: client-changed: [%f %f] (%f %f %f) center: %g CLIENT: [%f %f]\n",
- adj->lower, adj->upper,
- adj->step_increment, adj->page_increment, adj->page_size,
- self->center,
- client ? client->lower : -99.777, client ? client->upper : -99.777);
+ gxk_printerr ("ladj: client-changed: [%f %f] (%f %f %f) center: %g CLIENT: [%f %f]\n",
+ adj->lower, adj->upper,
+ adj->step_increment, adj->page_increment, adj->page_size,
+ self->center,
+ client ? client->lower : -99.777, client ? client->upper : -99.777);
}
if (!self->block_client)
@@ -432,9 +432,9 @@ log_adjustment_client_value_changed (GxkLogAdjustment *self)
adj->value = CLAMP (adj->value, adj->lower, adj->upper);
if (0)
- printerr ("ladj: client-value-changed: [%f %f] %g CLIENT: [%f %f] %g\n",
- adj->lower, adj->upper, adj->value,
- client->lower, client->upper, client->value);
+ gxk_printerr ("ladj: client-value-changed: [%f %f] %g CLIENT: [%f %f] %g\n",
+ adj->lower, adj->upper, adj->value,
+ client->lower, client->upper, client->value);
if (!self->block_client)
{
diff --git a/beast-gtk/gxk/gxkparam.cc b/beast-gtk/gxk/gxkparam.cc
index 3103d36..f532e97 100644
--- a/beast-gtk/gxk/gxkparam.cc
+++ b/beast-gtk/gxk/gxkparam.cc
@@ -642,21 +642,21 @@ param_score_editor (const GxkParamEditor *editor,
}
if (annotate)
- printerr (" %s(%s): fundamental=%s derived=%s%s%s editing=%s bonus=%+d%s%s: ",
- editor->ident.name, editor->ident.nick,
- g_type_name (editor->type_match.type),
- editor->type_match.type_name ? editor->type_match.type_name : "<any>",
- editor->type_match.all_int_nums ? "(all-ints)" : "",
- editor->type_match.all_float_nums ? "(all-floats)" : "",
- editor->features.editing ? "yes" : "no",
- editor->features.rating,
- editor->features.options ? " options=" : "",
- editor->features.options ? editor->features.options : "");
+ gxk_printerr (" %s(%s): fundamental=%s derived=%s%s%s editing=%s bonus=%+d%s%s: ",
+ editor->ident.name, editor->ident.nick,
+ g_type_name (editor->type_match.type),
+ editor->type_match.type_name ? editor->type_match.type_name : "<any>",
+ editor->type_match.all_int_nums ? "(all-ints)" : "",
+ editor->type_match.all_float_nums ? "(all-floats)" : "",
+ editor->features.editing ? "yes" : "no",
+ editor->features.rating,
+ editor->features.options ? " options=" : "",
+ editor->features.options ? editor->features.options : "");
if (type_mismatch || option_mismatch) /* bail out on mismatches */
{
if (annotate)
- printerr ("%s mismatch\n", type_mismatch ? "type" : "option");
+ gxk_printerr ("%s mismatch\n", type_mismatch ? "type" : "option");
return 0;
}
@@ -674,7 +674,7 @@ param_score_editor (const GxkParamEditor *editor,
rating += bonus; /* bonus is provided for overcomming additional mismatch possibilities */
if (annotate)
- printerr ("%d\n", rating);
+ gxk_printerr ("%d\n", rating);
return rating;
}
@@ -732,12 +732,12 @@ gxk_param_editor_debug_score (GParamSpec *pspec)
GSList *slist;
assert_return (G_IS_PARAM_SPEC (pspec));
const gchar *options = g_param_spec_get_options (pspec);
- printerr ("GxkParamEditor: rating for pspec: name=%s fundamental=%s type=%s options=%s nick=\"%s\"
blurb=\"%s\"\n",
- pspec->name,
- g_type_name (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec))),
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
- options ? options : "",
- g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec));
+ gxk_printerr ("GxkParamEditor: rating for pspec: name=%s fundamental=%s type=%s options=%s nick=\"%s\"
blurb=\"%s\"\n",
+ pspec->name,
+ g_type_name (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec))),
+ g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+ options ? options : "",
+ g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec));
for (slist = _param_editor_list; slist; slist = slist->next)
{
GxkParamEditor *editor = (GxkParamEditor*) slist->data;
diff --git a/beast-gtk/gxk/gxkrackitem.cc b/beast-gtk/gxk/gxkrackitem.cc
index fd8ff86..64a06ea 100644
--- a/beast-gtk/gxk/gxkrackitem.cc
+++ b/beast-gtk/gxk/gxkrackitem.cc
@@ -240,7 +240,7 @@ gxk_rack_item_button_press (GxkRackItem *self,
if (event->button == 3)
{
}
- printout ("rack-item, button-%u pressed\n", event->button);
+ gxk_printout ("rack-item, button-%u pressed\n", event->button);
}
void
diff --git a/beast-gtk/gxk/gxkradget.cc b/beast-gtk/gxk/gxkradget.cc
index 785994a..31877b6 100644
--- a/beast-gtk/gxk/gxkradget.cc
+++ b/beast-gtk/gxk/gxkradget.cc
@@ -462,7 +462,7 @@ parse_formula (const gchar *c,
}
args = g_slist_prepend (args, g_strndup (last, c - last));
if (!*c)
- printerr ("malformed formula: $(%s\n", start);
+ gxk_warning ("malformed formula: $(%s", start);
else
c++; /* ')' */
if (args)
@@ -1120,7 +1120,7 @@ property_value_from_string (GtkType widget_type,
break;
}
if (0 && G_VALUE_TYPE (value) && strchr (pvalue, '$'))
- printout ("property[%s]: expr=%s result=%s GValue=%s\n", pspec->name, pvalue, exvalue,
g_strdup_value_contents (value));
+ gxk_printout ("property[%s]: expr=%s result=%s GValue=%s\n", pspec->name, pvalue, exvalue,
g_strdup_value_contents (value));
g_free (exvalue);
}
@@ -1354,7 +1354,7 @@ radget_add_to_parent (GxkRadget *parent,
}
}
else
- printerr ("GXK: no such pack property: %s,%s,%s\n", G_OBJECT_TYPE_NAME (parent),
G_OBJECT_TYPE_NAME (radget), pname);
+ gxk_warning ("no such pack property: %s,%s,%s", G_OBJECT_TYPE_NAME (parent), G_OBJECT_TYPE_NAME
(radget), pname);
}
gxk_radget_free_args (args);
}
@@ -1405,7 +1405,7 @@ radget_apply_hooks (GxkRadget *radget,
}
}
else
- printerr ("GXK: no such hook property: %s (radget=%s)\n", hname, G_OBJECT_TYPE_NAME (radget));
+ gxk_warning ("no such hook property: %s (radget=%s)", hname, G_OBJECT_TYPE_NAME (radget));
}
/* cleanup */
while (n_pops--)
@@ -2102,7 +2102,7 @@ gxk_radget_register_hook (GParamSpec *pspec,
assert_return (hook_func != NULL);
if (find_hook (pspec->name, NULL))
{
- printerr ("GXK: not re-registering hook property: %s\n", pspec->name);
+ gxk_warning ("not re-registering hook property: %s", pspec->name);
return;
}
RadgetHook *hook = g_new0 (RadgetHook, 1);
@@ -2398,10 +2398,10 @@ mf_println (GSList *args,
while (argiter)
{
gchar *arg = argiter_exp (&argiter, env);
- printout ("%s", arg ? arg : "(null)");
+ gxk_printout ("%s", arg ? arg : "(null)");
g_free (arg);
}
- printout ("\n");
+ gxk_printout ("\n");
return NULL;
}
diff --git a/beast-gtk/gxk/gxksimplelabel.cc b/beast-gtk/gxk/gxksimplelabel.cc
index c0771c8..ec14467 100644
--- a/beast-gtk/gxk/gxksimplelabel.cc
+++ b/beast-gtk/gxk/gxksimplelabel.cc
@@ -291,10 +291,10 @@ simple_label_mnemonic_activate (GtkWidget *widget,
GTK_IS_MENU_ITEM (parent))
{
gboolean cc = gtk_widget_mnemonic_activate (parent, group_cycling);
- printout ("simple_label_mnemonic_activate: %s: %u (%d %d %d %d)\n", G_OBJECT_TYPE_NAME (parent),
cc,
- GTK_WIDGET_CAN_FOCUS (parent), GTK_WIDGET_GET_CLASS (parent)->activate_signal,
- (parent->parent && GTK_IS_NOTEBOOK (parent->parent)),
- GTK_IS_MENU_ITEM (parent));
+ gxk_printout ("simple_label_mnemonic_activate: %s: %u (%d %d %d %d)\n", G_OBJECT_TYPE_NAME
(parent), cc,
+ GTK_WIDGET_CAN_FOCUS (parent), GTK_WIDGET_GET_CLASS (parent)->activate_signal,
+ (parent->parent && GTK_IS_NOTEBOOK (parent->parent)),
+ GTK_IS_MENU_ITEM (parent));
return cc;
}
parent = parent->parent;
diff --git a/beast-gtk/gxk/gxkspline.cc b/beast-gtk/gxk/gxkspline.cc
index da04a9a..ac64c9e 100644
--- a/beast-gtk/gxk/gxkspline.cc
+++ b/beast-gtk/gxk/gxkspline.cc
@@ -366,8 +366,8 @@ gxk_spline_findx (const GxkSpline *spline,
static guint caller_sum, caller_times;
caller_sum += iteration_counter;
caller_times++;
- printerr ("spline_findx: iters=%u (avg=%f) x=%.17g y=%.17g approx=%.17g dx=%.17g dy=%.17g\n",
- iteration_counter, caller_sum / (double) caller_times, x, y, z, xmax-xmin, z-y);
+ gxk_printerr ("spline_findx: iters=%u (avg=%f) x=%.17g y=%.17g approx=%.17g dx=%.17g dy=%.17g\n",
+ iteration_counter, caller_sum / (double) caller_times, x, y, z, xmax-xmin, z-y);
}
return x;
}
@@ -392,38 +392,38 @@ gxk_spline_free (GxkSpline *spline)
void
gxk_spline_dump (GxkSpline *spline)
{
- printerr ("GxkSpline[%u] = {\n", spline->n_segs);
- printerr (" // x, y, yd2, ymin, ymax, ex1, ex2\n");
+ gxk_printerr ("GxkSpline[%u] = {\n", spline->n_segs);
+ gxk_printerr (" // x, y, yd2, ymin, ymax, ex1, ex2\n");
guint i;
for (i = 0; i < spline->n_segs; i++)
{
GxkSplineSegment *seg = spline->segs + i;
- printerr (" { %-+.17g, %-+.17g, %-+.17g, %-+.17g, %-+.17g, %-+.17g, %-+.17g },",
- seg->x, seg->y, seg->yd2, seg->ymin, seg->ymax, seg->ex1, seg->ex2);
+ gxk_printerr (" { %-+.17g, %-+.17g, %-+.17g, %-+.17g, %-+.17g, %-+.17g, %-+.17g },",
+ seg->x, seg->y, seg->yd2, seg->ymin, seg->ymax, seg->ex1, seg->ex2);
const double test_epsilon = 0.0000001;
if (isfinite (seg->ex1))
{
- printerr ("\n ");
+ gxk_printerr ("\n ");
double s1 = gxk_spline_y (spline, seg->ex1 - test_epsilon);
double s2 = gxk_spline_y (spline, seg->ex1);
double s3 = gxk_spline_y (spline, seg->ex1 - test_epsilon);
const char *judge = (s2 - s1) * (s2 - s3) < 0 ? "FAIL" : "OK";
if (s2 - s1 == 0 || s2 - s3 == 0)
judge = "BROKEN"; /* test_epsilon too small */
- printerr ("// extremum%u check: %s", 1, judge);
+ gxk_printerr ("// extremum%u check: %s", 1, judge);
}
if (isfinite (seg->ex2))
{
- printerr ("\n ");
+ gxk_printerr ("\n ");
double s1 = gxk_spline_y (spline, seg->ex2 - test_epsilon);
double s2 = gxk_spline_y (spline, seg->ex2);
double s3 = gxk_spline_y (spline, seg->ex2 - test_epsilon);
const char *judge = (s2 - s1) * (s2 - s3) < 0 ? "FAIL" : "OK";
if (s2 - s1 == 0 || s2 - s3 == 0)
judge = "BROKEN"; /* test_epsilon too small */
- printerr ("// extremum%u check: %s", 2, judge);
+ gxk_printerr ("// extremum%u check: %s", 2, judge);
}
- printerr ("\n");
+ gxk_printerr ("\n");
}
- printerr ("};\n");
+ gxk_printerr ("};\n");
}
diff --git a/beast-gtk/gxk/gxkstatusbar.hh b/beast-gtk/gxk/gxkstatusbar.hh
index d831c33..8ff0343 100644
--- a/beast-gtk/gxk/gxkstatusbar.hh
+++ b/beast-gtk/gxk/gxkstatusbar.hh
@@ -33,7 +33,7 @@ void gxk_status_enable_error_bell (gboolean enable_error_be
void gxk_status_set (gfloat percentage,
const gchar *message,
const gchar *status_msg);
-#define gxk_status_printf(percentage, status_msg, ...) gxk_status_set (percentage, status_msg,
Rapicorn::string_format (__VA_ARGS__).c_str())
+#define gxk_status_printf(percentage, status_msg, ...) gxk_status_set (percentage, status_msg,
Bse::string_format (__VA_ARGS__).c_str())
void gxk_status_clear (void);
void gxk_status_window_push (gpointer widget);
void gxk_status_window_pop (void);
diff --git a/beast-gtk/gxk/gxktexttools.cc b/beast-gtk/gxk/gxktexttools.cc
index a8b8d25..8a59e03 100644
--- a/beast-gtk/gxk/gxktexttools.cc
+++ b/beast-gtk/gxk/gxktexttools.cc
@@ -1958,8 +1958,8 @@ scroll_text_reload (GtkWidget *sctext)
);
while (n--)
{
- std::string istr = string_format ("<%u> ", flist[n]->d_ino);
- g_string_append (gstring, string_format (" %.20s ", istr).c_str());
+ std::string istr = Bse::string_format ("<%u> ", flist[n]->d_ino);
+ g_string_append (gstring, Bse::string_format (" %.20s ", istr).c_str());
g_string_append (gstring, "<span tag='hyperlink'><xlink ref='");
tmp = g_strconcat (file, "/", flist[n]->d_name, NULL);
g_string_add_xmlstr (gstring, tmp);
diff --git a/beast-gtk/gxk/gxktexttools.hh b/beast-gtk/gxk/gxktexttools.hh
index 88f18e4..aabe5a2 100644
--- a/beast-gtk/gxk/gxktexttools.hh
+++ b/beast-gtk/gxk/gxktexttools.hh
@@ -55,7 +55,7 @@ void gxk_scroll_text_append_file (GtkWidget *sctext,
const gchar *file_name);
void gxk_scroll_text_append_file_tsm (GtkWidget *sctext,
const gchar *file_name);
-#define gxk_scroll_text_aprintf(sctext, ...) gxk_scroll_text_append (sctext,
Rapicorn::string_format (__VA_ARGS__).c_str())
+#define gxk_scroll_text_aprintf(sctext, ...) gxk_scroll_text_append (sctext, Bse::string_format
(__VA_ARGS__).c_str())
void gxk_scroll_text_pop_indent (GtkWidget *sctext);
GtkTextView* gxk_scroll_text_get_text_view (GtkWidget *sctext);
void gxk_text_add_tsm_path (const gchar *path);
diff --git a/beast-gtk/gxk/splinetest.cc b/beast-gtk/gxk/splinetest.cc
index 36f1a2a..a2c3bc1 100644
--- a/beast-gtk/gxk/splinetest.cc
+++ b/beast-gtk/gxk/splinetest.cc
@@ -16,14 +16,14 @@ spline_test (GxkSpline *spline,
double x = spline->segs[i - 1].x + k * (spline->segs[i].x - spline->segs[i - 1].x) / interval_steps;
double y1 = gxk_spline_y (spline, x);
if (!swap)
- printout ("%-+24.18g %-+24.18g\n", x, y1);
+ gxk_printout ("%-+24.18g %-+24.18g\n", x, y1);
else if (1)
- printout ("%-+24.18g %-+24.18g\n", y1, x);
+ gxk_printout ("%-+24.18g %-+24.18g\n", y1, x);
else
{
double z = gxk_spline_findx (spline, y1);
double y2 = gxk_spline_y (spline, z);
- printout ("%-+24.18g %-+24.18g # findx=%-+24.18g dx=%-+24.18f (%u) dy=%-+24.18g (%u)\n", x, y1,
z, x-z, x==z, y1 - y2, y1==y2);
+ gxk_printout ("%-+24.18g %-+24.18g # findx=%-+24.18g dx=%-+24.18f (%u) dy=%-+24.18g (%u)\n", x,
y1, z, x-z, x==z, y1 - y2, y1==y2);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]