[beast/devel: 42/77] BST: initialize global bse_server variable with BSE remote origin



commit 3f8d95516cc5a2eb20c1e552604f26830dce138a
Author: Tim Janik <timj gnu org>
Date:   Tue Apr 9 02:18:22 2013 +0200

    BST: initialize global bse_server variable with BSE remote origin

 beast-gtk/bstdefs.hh  |   10 ++++++++++
 beast-gtk/bstmain.cc  |   15 ++++++++-------
 beast-gtk/bstutils.cc |    3 +++
 beast-gtk/bstutils.hh |    5 +++++
 4 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/beast-gtk/bstdefs.hh b/beast-gtk/bstdefs.hh
index 7c6711d..dd920d8 100644
--- a/beast-gtk/bstdefs.hh
+++ b/beast-gtk/bstdefs.hh
@@ -4,7 +4,10 @@
 #include <gxk/gxk.hh>
 #include <libintl.h>
 #include "bstzoomedwindow.hh"
+#include "bse/bse.hh"
+
 G_BEGIN_DECLS
+
 /* --- generic constants --- */
 typedef enum {
   BST_QUANTIZE_NONE            = 0,
@@ -18,9 +21,12 @@ typedef enum {
   BST_QUANTIZE_NOTE_128                = 128,
   BST_QUANTIZE_TACT            = 65535
 } BstQuantizationType;
+
 typedef struct _BstKeyBinding BstKeyBinding;
+
 /* choose IDs that are unlikely to clash with category IDs */
 #define BST_COMMON_ROLL_TOOL_FIRST     (G_MAXINT - 100000)
+
 typedef enum /*< skip >*/
 {
   BST_COMMON_ROLL_TOOL_NONE,
@@ -39,10 +45,12 @@ typedef enum /*< skip >*/
   BST_COMMON_ROLL_TOOL_MOVE_TICK_RIGHT,
   BST_COMMON_ROLL_TOOL_LAST
 } BstCommonRollTool;
+
 /* --- 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))
+
 /* --- configuration candidates --- */
 /* mouse button numbers and masks for drag operations */
 #define BST_DRAG_BUTTON_COPY     (1)
@@ -50,6 +58,7 @@ typedef enum /*< skip >*/
 #define BST_DRAG_BUTTON_MOVE     (2)
 #define BST_DRAG_BUTTON_MOVE_MASK (GDK_BUTTON2_MASK)
 #define BST_DRAG_BUTTON_CONTEXT   (3) /* delete, clone, linkdup */
+
 /* --- miscellaneous --- */
 #define        BST_DVL_HINTS           (bst_developer_hints != FALSE)
 #define        BST_DBG_EXT             (bst_debug_extensions != FALSE)
@@ -58,6 +67,7 @@ typedef enum /*< skip >*/
     if (GTK_IS_OBJECT (object)) \
       g_signal_emit_by_name (object, "notify::generic-change", NULL); \
 } G_STMT_END
+
 /* --- i18n and gettext helpers --- */
 #define BEAST_GETTEXT_DOMAIN (NULL)
 #define _(str) dgettext (BEAST_GETTEXT_DOMAIN, str)
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index a0bd16e..4695b9c 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -1,7 +1,6 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
 #include "bstutils.hh"
 #include "bstcxxutils.hh"
-#include "bse/bse.hh"
 #include "bstapp.hh"
 #include "bstsplash.hh"
 #include "bstxkb.hh"
@@ -216,6 +215,10 @@ main (int   argc,
     }
   /* listen to BseServer notification */
   bst_splash_update_entity (beast_splash, _("Dialogs"));
+
+  // hook up Bse aida IDL with main loop
+  bst_init_aida_idl();
+
   bst_message_connect_to_server ();
   _bst_init_radgets ();
   /* install message dialog handler */
@@ -363,9 +366,6 @@ main (int   argc,
   gtk_widget_hide (beast_splash);
   bst_splash_release_grab (beast_splash);
 
-  // hook up Bse aida IDL with main loop
-  bst_init_aida_idl();
-
   /* away into the main loop */
   while (bst_main_loop_running)
     {
@@ -432,6 +432,7 @@ echo_test_handler (const std::string &msg)
 static void
 bst_init_aida_idl()
 {
+  assert (bse_server == NULL);
   // hook Aida connection into our main loop
   Bse::AidaGlibSource *source = Bse::AidaGlibSource::create (Bse::ServerH::__aida_connection__());
   g_source_set_priority (source, G_PRIORITY_DEFAULT);
@@ -439,13 +440,13 @@ bst_init_aida_idl()
   // fetch initial remote object reference
   auto aidabsekeys = Rapicorn::string_split ("CxxStub:AidaServerConnection:idl_file=\\bbse/bseapi.idl", ":");
   Rapicorn::Aida::SmartHandle smh = Bse::ServerH::__aida_connection__()->remote_origin (aidabsekeys);
-  Bse::ServerH server = Rapicorn::Aida::ObjectBroker::smart_handle_down_cast<Bse::ServerH> (smh);
-  g_assert (server != NULL);
+  bse_server = Rapicorn::Aida::ObjectBroker::smart_handle_down_cast<Bse::ServerH> (smh);
+  assert (bse_server != NULL);
 
   // performa Bse Aida test
   if (0)
     {
-      Bse::TestObjectH test = server.get_test_object();
+      Bse::TestObjectH test = bse_server.get_test_object();
       test.sig_echo_reply() += echo_test_handler;
       const int test_result = test.echo_test ("foo");
       g_assert (test_result == 3);
diff --git a/beast-gtk/bstutils.cc b/beast-gtk/bstutils.cc
index 1960187..6be12ad 100644
--- a/beast-gtk/bstutils.cc
+++ b/beast-gtk/bstutils.cc
@@ -20,10 +20,13 @@
 #include <string.h>
 /* --- generated enums --- */
 #include "bstenum_arrays.cc"     /* enum string value arrays plus include directives */
+
 /* --- prototypes --- */
 static void     _bst_init_idl                   (void);
 /* --- variables --- */
 static GtkIconFactory *stock_icon_factory = NULL;
+Bse::ServerH bse_server;
+
 /* --- functions --- */
 void
 _bst_init_utils (void)
diff --git a/beast-gtk/bstutils.hh b/beast-gtk/bstutils.hh
index ba8eef9..926c8fa 100644
--- a/beast-gtk/bstutils.hh
+++ b/beast-gtk/bstutils.hh
@@ -7,6 +7,11 @@
 #include "bstcluehunter.hh"
 /* generated type IDs, idl types */
 #include "bstgentypes.h"
+
+
+// == Bse Server (BSE remote origin) ==
+extern Bse::ServerH bse_server;
+
 G_BEGIN_DECLS
 /* --- GUI utilities --- */
 void           bst_status_eprintf             (BseErrorType     error,


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