[beast: 13/39] BEAST: use bse_installpath() and bse_version(), get rid of topconfig.h



commit d3c9eb7eeeaca0fa2147ccc7be2fc3dd44287c70
Author: Tim Janik <timj gnu org>
Date:   Fri Sep 11 23:59:04 2015 +0200

    BEAST: use bse_installpath() and bse_version(), get rid of topconfig.h

 beast-gtk/bstapp.cc         |    3 +--
 beast-gtk/bstdefs.hh        |    3 ++-
 beast-gtk/bstgconfig.cc     |    3 +--
 beast-gtk/bstkeybindings.cc |    6 ++----
 beast-gtk/bstmain.cc        |   36 +++++++++++++++++-------------------
 beast-gtk/bstmsgabsorb.cc   |   15 ++++++---------
 beast-gtk/bstpreferences.cc |    5 ++---
 beast-gtk/bstskinconfig.cc  |    3 +--
 beast-gtk/testgui.cc        |    8 ++++----
 beast-gtk/tsmview.cc        |    7 ++-----
 10 files changed, 38 insertions(+), 51 deletions(-)
---
diff --git a/beast-gtk/bstapp.cc b/beast-gtk/bstapp.cc
index e78f07a..1525104 100644
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@ -1,5 +1,4 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include "topconfig.h"
 #include "bstapp.hh"
 #include "bstparam.hh"
 #include "bstskinconfig.hh"
@@ -1044,7 +1043,7 @@ app_action_exec (gpointer data,
     BROWSE_LOCAL_URL:
       if (docs_url)
         {
-          gchar *local_url = g_strconcat ("file://", BST_PATH_DOCS, "/", docs_url, NULL);
+          gchar *local_url = g_strconcat ("file://", bse_installpath (BSE_INSTALLPATH_PKGDOCDIR).c_str(), 
"/", docs_url, NULL);
           sfi_url_show (local_url);
           g_free (local_url);
         }
diff --git a/beast-gtk/bstdefs.hh b/beast-gtk/bstdefs.hh
index dd920d8..5831600 100644
--- a/beast-gtk/bstdefs.hh
+++ b/beast-gtk/bstdefs.hh
@@ -49,7 +49,8 @@ typedef enum /*< skip >*/
 /* --- constants & defines --- */
 #define        BST_TAG_DIAMETER          (20)
 #define BST_STRDUP_RC_FILE()     (g_strconcat (g_get_home_dir (), "/.beast/beastrc", NULL))
-#define BST_STRDUP_SKIN_PATH()   (g_strconcat (BST_PATH_SKINS, ":~/.beast/skins/:~/.beast/skins/*/", NULL))
+#define BST_STRDUP_SKIN_PATH()   (g_strconcat ("~/.beast/skins/:~/.beast/skins/*/:", \
+                                                bse_installpath (BSE_INSTALLPATH_PKGDATADIR_SKINS).c_str(), 
NULL))
 
 /* --- configuration candidates --- */
 /* mouse button numbers and masks for drag operations */
diff --git a/beast-gtk/bstgconfig.cc b/beast-gtk/bstgconfig.cc
index 94348df..865ca7c 100644
--- a/beast-gtk/bstgconfig.cc
+++ b/beast-gtk/bstgconfig.cc
@@ -100,7 +100,6 @@ bst_gconfig_push_updates (void)
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include "topconfig.h"         /* BST_VERSION */
 #include <sfi/sfistore.hh>     /* we rely on internal API here */
 static void
 accel_map_print (gpointer        data,
@@ -155,7 +154,7 @@ bst_rc_dump (const gchar *file_name)
 
   wstore = sfi_wstore_new ();
 
-  sfi_wstore_printf (wstore, "; rc-file for BEAST v%s\n", BST_VERSION);
+  sfi_wstore_printf (wstore, "; rc-file for BEAST v%s\n", bse_version().c_str());
 
   /* store BstGConfig */
   sfi_wstore_puts (wstore, "\n; BstGConfig Dump\n");
diff --git a/beast-gtk/bstkeybindings.cc b/beast-gtk/bstkeybindings.cc
index 99869a9..b350630 100644
--- a/beast-gtk/bstkeybindings.cc
+++ b/beast-gtk/bstkeybindings.cc
@@ -1,5 +1,4 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include "topconfig.h"  /* BST_PATH_KEYS */
 #include "bstkeybindings.hh"
 #include "bstauxdialogs.hh"
 #include "bstpatternctrl.hh"
@@ -217,7 +216,7 @@ key_bindings_exec_action (gpointer data,
         static GtkWidget *load_dialog = NULL;
         if (!load_dialog)
           load_dialog = bst_file_dialog_create();
-        bst_file_dialog_setup (load_dialog, self, _("Load Key Binding"), BST_PATH_KEYS);
+        bst_file_dialog_setup (load_dialog, self, _("Load Key Binding"), bse_installpath 
(BSE_INSTALLPATH_PKGDATADIR_KEYS).c_str());
         gxk_widget_showraise (load_dialog);
         bst_file_dialog_set_handler (BST_FILE_DIALOG (load_dialog), key_bindings_load_file, self, NULL);
       }
@@ -584,7 +583,6 @@ bst_key_binding_item_pspec (void)
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include "topconfig.h"          /* BST_VERSION */
 #include <sfi/sfistore.hh>       /* we rely on internal API here */
 const gchar*
 bst_key_binding_rcfile (void)
@@ -614,7 +612,7 @@ bst_key_binding_dump (const gchar *file_name,
 
   wstore = sfi_wstore_new ();
 
-  sfi_wstore_printf (wstore, "; key-binding-file for BEAST v%s\n", BST_VERSION);
+  sfi_wstore_printf (wstore, "; key-binding-file for BEAST v%s\n", bse_version().c_str());
 
   /* store BstKeyBinding */
   sfi_wstore_puts (wstore, "\n");
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index d0fb6af..28bab4f 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -10,8 +10,8 @@
 #include "bstusermessage.hh"
 #include "bstparam.hh"
 #include "bstpreferences.hh"
-#include "topconfig.h"
 #include "data/beast-images.h"
+#include "../configure.h"
 #include <unistd.h>
 #include <string.h>
 #include <sys/time.h>
@@ -68,7 +68,7 @@ main (int   argc,
   gchar *string;
   GSource *source;
   /* initialize i18n */
-  bindtextdomain (BST_GETTEXT_DOMAIN, BST_PATH_LOCALE);
+  bindtextdomain (BST_GETTEXT_DOMAIN, bse_installpath (BSE_INSTALLPATH_LOCALEBASE).c_str());
   bind_textdomain_codeset (BST_GETTEXT_DOMAIN, "UTF-8");
   textdomain (BST_GETTEXT_DOMAIN);
   setlocale (LC_ALL, "");
@@ -114,8 +114,8 @@ main (int   argc,
   /* initialize Gtk+ Extension Kit */
   gxk_init ();
   /* documentation search paths */
-  gxk_text_add_tsm_path (BST_PATH_DOCS);
-  gxk_text_add_tsm_path (BST_PATH_IMAGES);
+  gxk_text_add_tsm_path (bse_installpath (BSE_INSTALLPATH_PKGDOCDIR).c_str());
+  gxk_text_add_tsm_path (bse_installpath (BSE_INSTALLPATH_PKGDATADIR_IMAGES).c_str());
   gxk_text_add_tsm_path (".");
   /* now, we can popup the splash screen */
   beast_splash = bst_splash_new ("BEAST-Splash", BST_SPLASH_WIDTH, BST_SPLASH_HEIGHT, 15);
@@ -143,7 +143,7 @@ main (int   argc,
 
   /* show splash images */
   bst_splash_update_item (beast_splash, _("Splash Image"));
-  string = g_strconcat (BST_PATH_IMAGES, G_DIR_SEPARATOR_S, BST_SPLASH_IMAGE, NULL);
+  string = g_strconcat (bse_installpath (BSE_INSTALLPATH_PKGDATADIR_IMAGES).c_str(), G_DIR_SEPARATOR_S, 
BST_SPLASH_IMAGE, NULL);
   anim = gdk_pixbuf_animation_new_from_file (string, NULL);
   g_free (string);
   bst_splash_update ();
@@ -627,22 +627,20 @@ bst_args_process (int *argc_p, char **argv)
        {
          const char *arg = argv[i][12 - 1] == '=' ? argv[i] + 12 : (argv[i + 1] ? argv[i + 1] : "");
           char *freeme = NULL;
-         if (strcmp (arg, "prefix") == 0)
-           g_print ("%s\n", BST_PATH_PREFIX);
-         else if (strcmp (arg, "docs") == 0)
-           g_print ("%s\n", BST_PATH_DOCS);
+          if (strcmp (arg, "docs") == 0)
+           g_print ("%s\n", bse_installpath (BSE_INSTALLPATH_PKGDOCDIR).c_str());
          else if (strcmp (arg, "images") == 0)
-           g_print ("%s\n", BST_PATH_IMAGES);
+           g_print ("%s\n", bse_installpath (BSE_INSTALLPATH_PKGDATADIR_IMAGES).c_str());
          else if (strcmp (arg, "locale") == 0)
-           g_print ("%s\n", BST_PATH_LOCALE);
+           g_print ("%s\n", bse_installpath (BSE_INSTALLPATH_LOCALEBASE).c_str());
          else if (strcmp (arg, "skins") == 0)
            g_print ("%s\n", freeme = BST_STRDUP_SKIN_PATH ());
          else if (strcmp (arg, "keys") == 0)
-           g_print ("%s\n", BST_PATH_KEYS);
+           g_print ("%s\n", bse_installpath (BSE_INSTALLPATH_PKGDATADIR_KEYS).c_str());
          else if (strcmp (arg, "ladspa") == 0)
-           g_print ("%s\n", BSE_PATH_LADSPA);
+           g_print ("%s\n", bse_installpath (BSE_INSTALLPATH_LADSPA).c_str());
          else if (strcmp (arg, "plugins") == 0)
-           g_print ("%s\n", BSE_PATH_PLUGINS);
+           g_print ("%s\n", bse_installpath (BSE_INSTALLPATH_PKGLIBDIR_PLUGINS).c_str());
          else if (strcmp (arg, "samples") == 0)
            printout ("%s\n", bse_server.get_sample_path());
          else if (strcmp (arg, "effects") == 0)
@@ -714,11 +712,11 @@ bst_exit_print_version (void)
   g_print ("Intrinsic code selected according to runtime CPU detection:\n");
   g_print ("%s", Rapicorn::cpu_info().c_str());
   g_print ("\n");
-  g_print ("Prefix:          %s\n", BST_PATH_PREFIX);
-  g_print ("Doc Path:        %s\n", BST_PATH_DOCS);
-  g_print ("Image Path:      %s\n", BST_PATH_IMAGES);
-  g_print ("Locale Path:     %s\n", BST_PATH_LOCALE);
-  g_print ("Keyrc Path:      %s\n", BST_PATH_KEYS);
+  g_print ("Binaries:        %s\n", bse_installpath (BSE_INSTALLPATH_BINDIR).c_str());
+  g_print ("Doc Path:        %s\n", bse_installpath (BSE_INSTALLPATH_PKGDOCDIR).c_str());
+  g_print ("Image Path:      %s\n", bse_installpath (BSE_INSTALLPATH_PKGDATADIR_IMAGES).c_str());
+  g_print ("Locale Path:     %s\n", bse_installpath (BSE_INSTALLPATH_LOCALEBASE).c_str());
+  g_print ("Keyrc Path:      %s\n", bse_installpath (BSE_INSTALLPATH_PKGDATADIR_KEYS).c_str());
   g_print ("Skin Path:       %s\n", freeme = BST_STRDUP_SKIN_PATH());
   printout ("Sample Path:     %s\n", bse_server.get_sample_path());
   printout ("Script Path:     %s\n", bse_server.get_script_path());
diff --git a/beast-gtk/bstmsgabsorb.cc b/beast-gtk/bstmsgabsorb.cc
index c9bfb3b..44c26a3 100644
--- a/beast-gtk/bstmsgabsorb.cc
+++ b/beast-gtk/bstmsgabsorb.cc
@@ -77,8 +77,6 @@ bst_msg_absorb_config_apply (SfiSeq *src_seq)
   set_msg_absorb_config (mconfig);
 }
 
-# include "topconfig.h" /* BST_VERSION */
-
 gboolean
 bst_msg_absorb_config_match (const gchar *config_blurb)
 {
@@ -98,9 +96,9 @@ bst_msg_absorb_config_update (const gchar *config_blurb)
     if (mstrings[i].cstring == config_blurb)
       {
         Bst::MsgAbsorbString &mas = mstrings[i];
-        if (mas.version != BST_VERSION)
+        if (mas.version != bse_version())
           {
-            mas.version = BST_VERSION;
+            mas.version = bse_version();
             changed = TRUE;
           }
         break;
@@ -120,17 +118,17 @@ bst_msg_absorb_config_adjust (const gchar *config_blurb, bool enabled, bool upda
   if (i >= mstrings.size())
     {
       Bst::MsgAbsorbString mas;
-      mas.version = BST_VERSION;
+      mas.version = bse_version();
       mas.cstring = config_blurb;
       mas.enabled = !enabled; // forces change
       i = mstrings.size();
       mstrings.push_back (mas);
     }
-  if (mstrings[i].enabled != enabled || (update_version && BST_VERSION != mstrings[i].version))
+  if (mstrings[i].enabled != enabled || (update_version && bse_version() != mstrings[i].version))
     {
       Bst::MsgAbsorbString &mas = mstrings[i];
       if (update_version)
-        mas.version = BST_VERSION;
+        mas.version = bse_version();
       mas.enabled = enabled;
       return true;
     }
@@ -230,7 +228,6 @@ bst_msg_absorb_config_box_get (GtkWidget *self)
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include "topconfig.h"          /* BST_VERSION */
 #include <sfi/sfistore.hh>       /* we rely on internal API here */
 
 static Bse::ErrorType
@@ -247,7 +244,7 @@ bst_msg_absorb_config_dump (const gchar *file_name)
 
   SfiWStore *wstore = sfi_wstore_new ();
 
-  sfi_wstore_printf (wstore, "; message-absorb-config-file for BEAST v%s\n", BST_VERSION);
+  sfi_wstore_printf (wstore, "; message-absorb-config-file for BEAST v%s\n", bse_version().c_str());
 
   /* store config */
   sfi_wstore_puts (wstore, "\n");
diff --git a/beast-gtk/bstpreferences.cc b/beast-gtk/bstpreferences.cc
index 063eb0c..0b9a069 100644
--- a/beast-gtk/bstpreferences.cc
+++ b/beast-gtk/bstpreferences.cc
@@ -5,7 +5,6 @@
 #include "bstkeybindings.hh"
 #include "bstmsgabsorb.hh"
 #include "bstpatternctrl.hh"
-#include "topconfig.h" /* BST_VERSION */
 #include "bstparam.hh"
 
 
@@ -213,7 +212,7 @@ bst_preferences_default_revert (BstPreferences *self)
 
   rec = sfi_rec_new ();
   sfi_rec_validate (rec, sfi_pspec_get_rec_fields (bst_gconfig_pspec ()));
-  bst_gconfig_set_rec_rc_version (rec, BST_VERSION);
+  bst_gconfig_set_rec_rc_version (rec, bse_version().c_str());
   sfi_rec_swap_fields (self->rec_gconfig, rec);
   sfi_rec_unref (rec);
 
@@ -292,7 +291,7 @@ bst_preferences_load_rc_files (void)
   if (error == Bse::ERROR_FILE_NOT_FOUND)
     {
       /* try loading fallback table */
-      gchar *file = g_strconcat (BST_PATH_KEYS, G_DIR_SEPARATOR_S, "keyrc.us", NULL);
+      gchar *file = g_strconcat (bse_installpath (BSE_INSTALLPATH_PKGDATADIR_KEYS).c_str(), 
G_DIR_SEPARATOR_S, "keyrc.us", NULL);
       error = bst_key_binding_parse (file, slist);
       g_free (file);
     }
diff --git a/beast-gtk/bstskinconfig.cc b/beast-gtk/bstskinconfig.cc
index 97516f2..5fb2625 100644
--- a/beast-gtk/bstskinconfig.cc
+++ b/beast-gtk/bstskinconfig.cc
@@ -185,7 +185,6 @@ bst_skin_config_notify (void)
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include "topconfig.h"          /* BST_VERSION */
 #include <sfi/sfistore.hh>       /* we rely on internal API here */
 Bse::ErrorType
 bst_skin_dump (const gchar *file_name)
@@ -207,7 +206,7 @@ bst_skin_dump (const gchar *file_name)
 
   wstore = sfi_wstore_new ();
 
-  sfi_wstore_printf (wstore, "; skin-file for BEAST v%s\n", BST_VERSION);
+  sfi_wstore_printf (wstore, "; skin-file for BEAST v%s\n", bse_version().c_str());
 
   /* store BstSkinConfig */
   sfi_wstore_puts (wstore, "\n");
diff --git a/beast-gtk/testgui.cc b/beast-gtk/testgui.cc
index a171e60..345cab6 100644
--- a/beast-gtk/testgui.cc
+++ b/beast-gtk/testgui.cc
@@ -1,11 +1,11 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include "topconfig.h"
 #include "bstutils.hh"
 #include "bse/bse.hh"
 #include "bstdbmeter.hh"
 #include "bstparam.hh"
 #include "bstgconfig.hh"
 #include "bstskinconfig.hh"
+#include "../configure.h"
 
 /* --- FIXME: --- */
 gboolean            bst_developer_hints = FALSE;
@@ -75,7 +75,7 @@ main (int   argc,
       char *argv[])
 {
   /* initialize i18n */
-  bindtextdomain (BST_GETTEXT_DOMAIN, BST_PATH_LOCALE);
+  bindtextdomain (BST_GETTEXT_DOMAIN, bse_installpath (BSE_INSTALLPATH_LOCALEBASE).c_str());
   bind_textdomain_codeset (BST_GETTEXT_DOMAIN, "UTF-8");
   textdomain (BST_GETTEXT_DOMAIN);
   setlocale (LC_ALL, "");
@@ -90,8 +90,8 @@ main (int   argc,
   /* initialize Gtk+ Extension Kit */
   gxk_init ();
   /* add documentation search paths */
-  gxk_text_add_tsm_path (BST_PATH_DOCS);
-  gxk_text_add_tsm_path (BST_PATH_IMAGES);
+  gxk_text_add_tsm_path (bse_installpath (BSE_INSTALLPATH_PKGDOCDIR).c_str());
+  gxk_text_add_tsm_path (bse_installpath (BSE_INSTALLPATH_PKGDATADIR_IMAGES).c_str());
   gxk_text_add_tsm_path (".");
   /* initialize BEAST GUI components */
   _bst_init_utils ();
diff --git a/beast-gtk/tsmview.cc b/beast-gtk/tsmview.cc
index a7697e4..64e8b25 100644
--- a/beast-gtk/tsmview.cc
+++ b/beast-gtk/tsmview.cc
@@ -1,8 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
 #include <gxk/gxk.hh>
-
-#include "topconfig.h"
-
 #include <string.h>
 
 #define PRGNAME "tsmview"
@@ -53,8 +50,8 @@ main (int   argc,
   if (!title)
     title = g_strdup (".");
   gxk_text_add_tsm_path (".");
-  gxk_text_add_tsm_path (BST_PATH_DOCS);
-  gxk_text_add_tsm_path (BST_PATH_IMAGES);
+  gxk_text_add_tsm_path (bse_installpath (BSE_INSTALLPATH_PKGDOCDIR).c_str());
+  gxk_text_add_tsm_path (bse_installpath (BSE_INSTALLPATH_PKGDATADIR_IMAGES).c_str());
   sctext = gxk_scroll_text_create (GXK_SCROLL_TEXT_NAVIGATABLE | flags, NULL);
   gxk_scroll_text_enter (sctext, title);
   for (i = 1; i < argc; i++)


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