[beast: 30/31] BSE: move bse server get_version and get_custom_*_dir into bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 30/31] BSE: move bse server get_version and get_custom_*_dir into bseapi.idl
- Date: Mon, 22 Jun 2015 14:40:41 +0000 (UTC)
commit 1f5bc24983518e6764941225a4dae80e38632fb4
Author: Tim Janik <timj gnu org>
Date: Fri Jun 12 19:44:42 2015 +0200
BSE: move bse server get_version and get_custom_*_dir into bseapi.idl
beast-gtk/bstfiledialog.cc | 16 +++++++-------
bse/bseapi.idl | 3 ++
bse/bseserver.cc | 20 +++++++++++++++++++
bse/bseserver.hh | 3 ++
bse/bseserver.proc | 46 --------------------------------------------
tests/bse/cxxbinding.cc | 2 +-
6 files changed, 35 insertions(+), 55 deletions(-)
---
diff --git a/beast-gtk/bstfiledialog.cc b/beast-gtk/bstfiledialog.cc
index 1cab0af..186c14f 100644
--- a/beast-gtk/bstfiledialog.cc
+++ b/beast-gtk/bstfiledialog.cc
@@ -233,12 +233,12 @@ bst_file_dialog_global_effect (void)
static BstFileDialog *singleton = NULL;
if (!singleton)
{
- const gchar *dir = bse_server_get_custom_effect_dir (BSE_SERVER);
+ const String dir = bse_server.get_custom_effect_dir();
singleton = (BstFileDialog*) g_object_new (BST_TYPE_FILE_DIALOG, NULL);
- if (dir)
+ if (!dir.empty())
{
- sfi_make_dirpath (dir);
- gtk_file_selection_complete (singleton->fs, dir);
+ sfi_make_dirpath (dir.c_str());
+ gtk_file_selection_complete (singleton->fs, dir.c_str());
}
}
return singleton;
@@ -250,12 +250,12 @@ bst_file_dialog_global_instrument (void)
static BstFileDialog *singleton = NULL;
if (!singleton)
{
- const gchar *dir = bse_server_get_custom_instrument_dir (BSE_SERVER);
+ const String dir = bse_server.get_custom_instrument_dir();
singleton = (BstFileDialog*) g_object_new (BST_TYPE_FILE_DIALOG, NULL);
- if (dir)
+ if (!dir.empty())
{
- sfi_make_dirpath (dir);
- gtk_file_selection_complete (singleton->fs, dir);
+ sfi_make_dirpath (dir.c_str());
+ gtk_file_selection_complete (singleton->fs, dir.c_str());
}
}
return singleton;
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 19504aa..eb5661a 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -52,6 +52,9 @@ interface Server : Object {
String get_sample_path (); ///< Retrieve sample search path.
String get_effect_path (); ///< Retrieve effect search path.
String get_demo_path (); ///< Retrieve demo search path.
+ String get_custom_instrument_dir (); ///< Retrieve user specific instruments directory.
+ String get_custom_effect_dir (); ///< Retrieve user specific effects directory.
+ String get_version (); ///< Retrieve BSE version.
};
} // Bse
diff --git a/bse/bseserver.cc b/bse/bseserver.cc
index 55cc015..c753225 100644
--- a/bse/bseserver.cc
+++ b/bse/bseserver.cc
@@ -1221,4 +1221,24 @@ ServerImpl::get_demo_path ()
return BSE_PATH_DEMOS;
}
+String
+ServerImpl::get_version ()
+{
+ return BST_VERSION;
+}
+
+String
+ServerImpl::get_custom_effect_dir ()
+{
+ StringVector strings = string_split (BSE_GCONFIG (effect_path), G_SEARCHPATH_SEPARATOR_S);
+ return strings.size() ? strings[0] : "";
+}
+
+String
+ServerImpl::get_custom_instrument_dir ()
+{
+ StringVector strings = string_split (BSE_GCONFIG (instrument_path), G_SEARCHPATH_SEPARATOR_S);
+ return strings.size() ? strings[0] : "";
+}
+
} // Bse
diff --git a/bse/bseserver.hh b/bse/bseserver.hh
index 0f38666..0c5b2fe 100644
--- a/bse/bseserver.hh
+++ b/bse/bseserver.hh
@@ -116,6 +116,9 @@ public:
virtual String get_sample_path () override;
virtual String get_effect_path () override;
virtual String get_demo_path () override;
+ virtual String get_version () override;
+ virtual String get_custom_effect_dir () override;
+ virtual String get_custom_instrument_dir () override;
void send_user_message (const UserMessage &umsg);
static ServerImpl& instance ();
};
diff --git a/bse/bseserver.proc b/bse/bseserver.proc
index 9c43ffd..e912900 100644
--- a/bse/bseserver.proc
+++ b/bse/bseserver.proc
@@ -431,49 +431,3 @@ BODY (BseProcedureClass *proc,
bse_server_start_recording (server, wave_file, n_seconds);
return BSE_ERROR_NONE;
}
-
-METHOD (BseServer, get-version) {
- HELP = "Retrieve BSE version.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("version", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_set_string (out_values++, BST_VERSION);
- return BSE_ERROR_NONE;
-}
-
-METHOD (BseServer, get-custom-effect-dir) {
- HELP = "Retrieve user specific effects directory.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("directory", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- gchar **dirs = g_strsplit (BSE_GCONFIG (effect_path), G_SEARCHPATH_SEPARATOR_S, 2);
- sfi_value_set_string (out_values++, dirs[0]);
- g_strfreev (dirs);
- return BSE_ERROR_NONE;
-}
-
-METHOD (BseServer, get-custom-instrument-dir) {
- HELP = "Retrieve user specific instruments directory.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("directory", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- gchar **dirs = g_strsplit (BSE_GCONFIG (instrument_path), G_SEARCHPATH_SEPARATOR_S, 2);
- sfi_value_set_string (out_values++, dirs[0]);
- g_strfreev (dirs);
- return BSE_ERROR_NONE;
-}
diff --git a/tests/bse/cxxbinding.cc b/tests/bse/cxxbinding.cc
index 4d716f2..f8b361d 100644
--- a/tests/bse/cxxbinding.cc
+++ b/tests/bse/cxxbinding.cc
@@ -47,7 +47,7 @@ main (int argc,
Server server = 1; // FIXME: users may not hardcode this
- g_print ("server.get_custom_instrument_dir()=%s\n", server.get_custom_instrument_dir().c_str());
+ // g_print ("server.get_custom_instrument_dir()=%s\n", server.get_custom_instrument_dir().c_str());
GConfigHandle prefs = GConfig::from_rec (server.bse_preferences ());
prefs->plugin_path = "./.libs/testplugin.so";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]