[beast: 14/31] BSE: move bse_server.get_*_path to bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 14/31] BSE: move bse_server.get_*_path to bseapi.idl
- Date: Mon, 22 Jun 2015 14:39:20 +0000 (UTC)
commit a06986bda53bfb548053ee2f03a37c6b292ad49f
Author: Tim Janik <timj gnu org>
Date: Fri Jun 12 17:04:48 2015 +0200
BSE: move bse_server.get_*_path to bseapi.idl
beast-gtk/bstapp.cc | 2 +-
beast-gtk/bstfiledialog.cc | 8 ++--
beast-gtk/bstmain.cc | 25 +++++-----
beast-gtk/bstparam-searchpath.cc | 5 +-
bse/bseapi.idl | 7 +++
bse/bseserver.cc | 43 +++++++++++++++++
bse/bseserver.hh | 21 +++++---
bse/bseserver.proc | 98 --------------------------------------
bse/bsewave.cc | 9 ++--
sfi/glib-extra.cc | 12 -----
sfi/glib-extra.hh | 2 -
11 files changed, 87 insertions(+), 145 deletions(-)
---
diff --git a/beast-gtk/bstapp.cc b/beast-gtk/bstapp.cc
index cca4cc3..7d23c87 100644
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@ -678,7 +678,7 @@ demo_entries_setup (void)
{
if (!demo_entries)
{
- SfiRing *files = sfi_file_crawler_list_files (bse_server_get_demo_path (BSE_SERVER), "*.bse",
GFileTest (0));
+ SfiRing *files = sfi_file_crawler_list_files (bse_server.get_demo_path().c_str(), "*.bse", GFileTest
(0));
while (files)
{
char *file = (char*) sfi_ring_pop_head (&files);
diff --git a/beast-gtk/bstfiledialog.cc b/beast-gtk/bstfiledialog.cc
index 231a4a9..1cab0af 100644
--- a/beast-gtk/bstfiledialog.cc
+++ b/beast-gtk/bstfiledialog.cc
@@ -319,7 +319,7 @@ bst_file_dialog_set_mode (BstFileDialog *self,
{
case BST_FILE_DIALOG_LOAD_WAVE:
g_free (self->search_path);
- self->search_path = g_strdup (bse_server_get_sample_path (BSE_SERVER));
+ self->search_path = g_strdup (bse_server.get_sample_path().c_str());
self->search_filter = NULL;
gtk_widget_show (self->spage);
gxk_notebook_set_current_page_widget (GTK_NOTEBOOK (self->notebook), self->fpage);
@@ -327,7 +327,7 @@ bst_file_dialog_set_mode (BstFileDialog *self,
break;
case BST_FILE_DIALOG_LOAD_WAVE_LIB:
g_free (self->search_path);
- self->search_path = g_strdup (bse_server_get_sample_path (BSE_SERVER));
+ self->search_path = g_strdup (bse_server.get_sample_path().c_str());
self->search_filter = NULL;
gtk_widget_show (self->spage);
gxk_notebook_set_current_page_widget (GTK_NOTEBOOK (self->notebook), self->spage);
@@ -335,7 +335,7 @@ bst_file_dialog_set_mode (BstFileDialog *self,
break;
case BST_FILE_DIALOG_MERGE_EFFECT:
g_free (self->search_path);
- self->search_path = g_strdup (bse_server_get_effect_path (BSE_SERVER));
+ self->search_path = g_strdup (bse_server.get_effect_path().c_str());
self->search_filter = "*";
gtk_widget_show (self->spage);
gxk_notebook_set_current_page_widget (GTK_NOTEBOOK (self->notebook), self->spage);
@@ -343,7 +343,7 @@ bst_file_dialog_set_mode (BstFileDialog *self,
break;
case BST_FILE_DIALOG_MERGE_INSTRUMENT:
g_free (self->search_path);
- self->search_path = g_strdup (bse_server_get_instrument_path (BSE_SERVER));
+ self->search_path = g_strdup (bse_server.get_instrument_path().c_str());
self->search_filter = "*";
gtk_widget_show (self->spage);
gxk_notebook_set_current_page_widget (GTK_NOTEBOOK (self->notebook), self->spage);
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index 67d151e..f2da824 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -642,15 +642,15 @@ bst_args_process (int *argc_p, char **argv)
else if (strcmp (arg, "plugins") == 0)
g_print ("%s\n", BSE_PATH_PLUGINS);
else if (strcmp (arg, "samples") == 0)
- g_print ("%s\n", bse_server_get_sample_path (BSE_SERVER));
+ printout ("%s\n", bse_server.get_sample_path());
else if (strcmp (arg, "effects") == 0)
- g_print ("%s\n", bse_server_get_effect_path (BSE_SERVER));
+ printout ("%s\n", bse_server.get_effect_path());
else if (strcmp (arg, "scripts") == 0)
- g_print ("%s\n", bse_server_get_script_path (BSE_SERVER));
+ printout ("%s\n", bse_server.get_script_path());
else if (strcmp (arg, "instruments") == 0)
- g_print ("%s\n", bse_server_get_instrument_path (BSE_SERVER));
+ printout ("%s\n", bse_server.get_instrument_path());
else if (strcmp (arg, "demo") == 0)
- g_print ("%s\n", bse_server_get_demo_path (BSE_SERVER));
+ printout ("%s\n", bse_server.get_demo_path());
else
{
if (arg[0])
@@ -691,7 +691,6 @@ bst_exit_print_version (void)
{
assert (bse_server != NULL); // we need BSE
String s;
- const gchar *c;
gchar *freeme = NULL;
g_print ("BEAST version %s (%s)\n", BST_VERSION, BST_VERSION_HINT);
g_print ("Libraries: ");
@@ -719,13 +718,13 @@ bst_exit_print_version (void)
g_print ("Locale Path: %s\n", BST_PATH_LOCALE);
g_print ("Keyrc Path: %s\n", BST_PATH_KEYS);
g_print ("Skin Path: %s\n", freeme = BST_STRDUP_SKIN_PATH());
- g_print ("Sample Path: %s\n", bse_server_get_sample_path (BSE_SERVER));
- g_print ("Script Path: %s\n", bse_server_get_script_path (BSE_SERVER));
- g_print ("Effect Path: %s\n", bse_server_get_effect_path (BSE_SERVER));
- g_print ("Instrument Path: %s\n", bse_server_get_instrument_path (BSE_SERVER));
- g_print ("Demo Path: %s\n", bse_server_get_demo_path (BSE_SERVER));
- g_print ("Plugin Path: %s\n", bse_server_get_plugin_path (BSE_SERVER));
- g_print ("LADSPA Path: %s:$LADSPA_PATH\n", bse_server_get_ladspa_path (BSE_SERVER));
+ printout ("Sample Path: %s\n", bse_server.get_sample_path());
+ printout ("Script Path: %s\n", bse_server.get_script_path());
+ printout ("Effect Path: %s\n", bse_server.get_effect_path());
+ printout ("Instrument Path: %s\n", bse_server.get_instrument_path());
+ printout ("Demo Path: %s\n", bse_server.get_demo_path());
+ printout ("Plugin Path: %s\n", bse_server.get_plugin_path());
+ printout ("LADSPA Path: %s:$LADSPA_PATH\n", bse_server.get_ladspa_path());
g_print ("\n");
g_print ("BEAST comes with ABSOLUTELY NO WARRANTY.\n");
g_print ("You may redistribute copies of BEAST under the terms of\n");
diff --git a/beast-gtk/bstparam-searchpath.cc b/beast-gtk/bstparam-searchpath.cc
index 27ec2d2..0feb167 100644
--- a/beast-gtk/bstparam-searchpath.cc
+++ b/beast-gtk/bstparam-searchpath.cc
@@ -54,9 +54,8 @@ param_searchpath_add (GtkWidget *dialog,
{
GtkWidget *widget = (GtkWidget*) user_data;
const char *path = gtk_entry_get_text (GTK_ENTRY (widget));
- gchar *str = g_path_concat (path, file, NULL);
- gtk_entry_set_text (GTK_ENTRY (widget), str);
- g_free (str);
+ String spath = Rapicorn::Path::searchpath_join (path, file);
+ gtk_entry_set_text (GTK_ENTRY (widget), spath.c_str());
param_searchpath_change_value (widget);
}
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 191f512..19504aa 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -45,6 +45,13 @@ interface Server : Object {
Object from_proxy (int64 proxyid); ///< Find an Object from its associated BseObject
proxy id.
String get_mp3_version (); ///< Retrieve BSE MP3 handler version.
String get_vorbis_version (); ///< Retrieve BSE Vorbis handler version.
+ String get_ladspa_path (); ///< Retrieve ladspa search path.
+ String get_plugin_path (); ///< Retrieve plugin search path.
+ String get_script_path (); ///< Retrieve script search path.
+ String get_instrument_path (); ///< Retrieve instrument search path.
+ String get_sample_path (); ///< Retrieve sample search path.
+ String get_effect_path (); ///< Retrieve effect search path.
+ String get_demo_path (); ///< Retrieve demo search path.
};
} // Bse
diff --git a/bse/bseserver.cc b/bse/bseserver.cc
index 96031f8..55cc015 100644
--- a/bse/bseserver.cc
+++ b/bse/bseserver.cc
@@ -17,6 +17,7 @@
#include <unistd.h>
#include <string.h>
#include "bsepcmmodule.cc"
+#include "topconfig.h"
#include "gsldatahandle-mad.hh"
#include "gslvorbis-enc.hh"
using namespace Bse;
@@ -1178,4 +1179,46 @@ ServerImpl::get_vorbis_version ()
return "Ogg/Vorbis " + gsl_vorbis_encoder_version();
}
+String
+ServerImpl::get_ladspa_path ()
+{
+ return Path::searchpath_join (BSE_PATH_LADSPA, BSE_GCONFIG (ladspa_path));
+}
+
+String
+ServerImpl::get_plugin_path ()
+{
+ return Path::searchpath_join (BSE_PATH_PLUGINS, BSE_GCONFIG (plugin_path));
+}
+
+String
+ServerImpl::get_script_path ()
+{
+ return Path::searchpath_join (BSE_PATH_SCRIPTS, BSE_GCONFIG (script_path));
+}
+
+String
+ServerImpl::get_instrument_path ()
+{
+ return Path::searchpath_join (BSE_PATH_INSTRUMENTS, BSE_GCONFIG (instrument_path));
+}
+
+String
+ServerImpl::get_sample_path ()
+{
+ return Path::searchpath_join (BSE_PATH_SAMPLES, BSE_GCONFIG (sample_path));
+}
+
+String
+ServerImpl::get_effect_path ()
+{
+ return Path::searchpath_join (BSE_PATH_EFFECTS, BSE_GCONFIG (effect_path));
+}
+
+String
+ServerImpl::get_demo_path ()
+{
+ return BSE_PATH_DEMOS;
+}
+
} // Bse
diff --git a/bse/bseserver.hh b/bse/bseserver.hh
index 7019335..0f38666 100644
--- a/bse/bseserver.hh
+++ b/bse/bseserver.hh
@@ -104,13 +104,20 @@ class ServerImpl : public virtual ServerIface, public virtual ObjectImpl {
protected:
virtual ~ServerImpl ();
public:
- explicit ServerImpl (BseObject*);
- virtual TestObjectIfaceP get_test_object () override;
- virtual ObjectIfaceP from_proxy (int64_t proxyid) override;
- virtual std::string get_mp3_version () override;
- virtual std::string get_vorbis_version () override;
- void send_user_message (const UserMessage &umsg);
- static ServerImpl& instance ();
+ explicit ServerImpl (BseObject*);
+ virtual TestObjectIfaceP get_test_object () override;
+ virtual ObjectIfaceP from_proxy (int64_t proxyid) override;
+ virtual String get_mp3_version () override;
+ virtual String get_vorbis_version () override;
+ virtual String get_ladspa_path () override;
+ virtual String get_plugin_path () override;
+ virtual String get_script_path () override;
+ virtual String get_instrument_path () override;
+ virtual String get_sample_path () override;
+ virtual String get_effect_path () override;
+ virtual String get_demo_path () override;
+ void send_user_message (const UserMessage &umsg);
+ static ServerImpl& instance ();
};
} // Bse
diff --git a/bse/bseserver.proc b/bse/bseserver.proc
index a3f7b38..9c43ffd 100644
--- a/bse/bseserver.proc
+++ b/bse/bseserver.proc
@@ -446,34 +446,6 @@ BODY (BseProcedureClass *proc,
return BSE_ERROR_NONE;
}
-METHOD (BseServer, get-demo-path) {
- HELP = "Retrieve demo search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_set_string (out_values++, BSE_PATH_DEMOS);
- return BSE_ERROR_NONE;
-}
-
-METHOD (BseServer, get-sample-path) {
- HELP = "Retrieve sample search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_SAMPLES, BSE_GCONFIG (sample_path), NULL));
- return BSE_ERROR_NONE;
-}
-
METHOD (BseServer, get-custom-effect-dir) {
HELP = "Retrieve user specific effects directory.";
IN = bse_param_spec_object ("server", "Server", NULL,
@@ -490,20 +462,6 @@ BODY (BseProcedureClass *proc,
return BSE_ERROR_NONE;
}
-METHOD (BseServer, get-effect-path) {
- HELP = "Retrieve effect search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_EFFECTS, BSE_GCONFIG (effect_path), NULL));
- return BSE_ERROR_NONE;
-}
-
METHOD (BseServer, get-custom-instrument-dir) {
HELP = "Retrieve user specific instruments directory.";
IN = bse_param_spec_object ("server", "Server", NULL,
@@ -519,59 +477,3 @@ BODY (BseProcedureClass *proc,
g_strfreev (dirs);
return BSE_ERROR_NONE;
}
-
-METHOD (BseServer, get-instrument-path) {
- HELP = "Retrieve instrument search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_INSTRUMENTS, BSE_GCONFIG (instrument_path),
NULL));
- return BSE_ERROR_NONE;
-}
-
-METHOD (BseServer, get-script-path) {
- HELP = "Retrieve script search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_SCRIPTS, BSE_GCONFIG (script_path), NULL));
- return BSE_ERROR_NONE;
-}
-
-METHOD (BseServer, get-plugin-path) {
- HELP = "Retrieve plugin search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_PLUGINS, BSE_GCONFIG (plugin_path), NULL));
- return BSE_ERROR_NONE;
-}
-
-METHOD (BseServer, get-ladspa-path) {
- HELP = "Retrieve ladspa search path.";
- IN = bse_param_spec_object ("server", "Server", NULL,
- BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("path", NULL, NULL, NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_LADSPA, BSE_GCONFIG (ladspa_path), NULL));
- return BSE_ERROR_NONE;
-}
diff --git a/bse/bsewave.cc b/bse/bsewave.cc
index 6d1658f..777a92b 100644
--- a/bse/bsewave.cc
+++ b/bse/bsewave.cc
@@ -263,13 +263,13 @@ bse_wave_load_wave_file (BseWave *self,
if (!g_path_is_absolute (file_name)) /* resolve relative path using search dir */
{
- char *sample_path;
+ String sample_path;
SfiRing *files, *walk;
if (bse_main_args->override_sample_path)
- sample_path = g_strdup (bse_main_args->override_sample_path);
+ sample_path = bse_main_args->override_sample_path;
else
- sample_path = g_path_concat (BSE_PATH_SAMPLES, BSE_GCONFIG (sample_path), NULL);
- files = sfi_file_crawler_list_files (sample_path, file_name, G_FILE_TEST_IS_REGULAR);
+ sample_path = Rapicorn::Path::searchpath_join (BSE_PATH_SAMPLES, BSE_GCONFIG (sample_path));
+ files = sfi_file_crawler_list_files (sample_path.c_str(), file_name, G_FILE_TEST_IS_REGULAR);
for (walk = files; walk; walk = sfi_ring_walk (files, walk))
{
@@ -279,7 +279,6 @@ bse_wave_load_wave_file (BseWave *self,
g_free (fname);
}
sfi_ring_free (files);
- g_free (sample_path);
}
else
{
diff --git a/sfi/glib-extra.cc b/sfi/glib-extra.cc
index a1a8a79..dd242b8 100644
--- a/sfi/glib-extra.cc
+++ b/sfi/glib-extra.cc
@@ -198,18 +198,6 @@ g_intern_strconcat (const gchar *first_string,
return c;
}
-gchar*
-g_path_concat (const gchar *first_path,
- ...)
-{
- va_list args;
- gchar *s;
- va_start (args, first_path);
- s = delim_concat_varargs (first_path, G_SEARCHPATH_SEPARATOR, args);
- va_end (args);
- return s;
-}
-
GString*
g_string_prefix_lines (GString *gstring,
const gchar *pstr)
diff --git a/sfi/glib-extra.hh b/sfi/glib-extra.hh
index c80ef09..c5dceeb 100644
--- a/sfi/glib-extra.hh
+++ b/sfi/glib-extra.hh
@@ -73,8 +73,6 @@ gchar* g_strdup_lstrip (const gchar *string);
const gchar* g_intern_strconcat (const gchar *first_string,
...) G_GNUC_NULL_TERMINATED;
-gchar* g_path_concat (const gchar *first_path,
- ...) G_GNUC_NULL_TERMINATED;
GString* g_string_prefix_lines (GString *gstring,
const gchar *pstr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]