[beast: 4/26] BEAST: use Container.list_children() from bseapi.idl



commit 2b8784837ebbcefdabac25b86d55be134a6b6087
Author: Tim Janik <timj gnu org>
Date:   Fri May 27 11:51:32 2016 +0200

    BEAST: use Container.list_children() from bseapi.idl
    
    Signed-off-by: Tim Janik <timj gnu org>

 beast-gtk/bstapp.cc        |   12 ++++++------
 beast-gtk/bstbseutils.cc   |   44 ++++++++++++++++++++++++--------------------
 beast-gtk/bstbusmixer.cc   |    8 ++++----
 beast-gtk/bstsnetrouter.cc |   12 +++++-------
 beast-gtk/bsttreestores.cc |    9 ++++-----
 5 files changed, 43 insertions(+), 42 deletions(-)
---
diff --git a/beast-gtk/bstapp.cc b/beast-gtk/bstapp.cc
index 58e3ca2..7c97885 100644
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@ -1095,8 +1095,6 @@ app_action_check (gpointer data,
   switch (action)
     {
       SfiProxy super;
-      BseIt3mSeq *iseq;
-      guint i;
     case BST_ACTION_NEW_PROJECT:
     case BST_ACTION_OPEN_PROJECT:
     case BST_ACTION_MERGE_PROJECT:
@@ -1109,10 +1107,12 @@ app_action_check (gpointer data,
     case BST_ACTION_SAVE_PROJECT:
       return self->project.is_dirty();
     case BST_ACTION_NEW_SONG:
-      iseq = bse_container_list_children (self->project.proxy_id());
-      for (i = 0; i < iseq->n_items; i++)
-        if (BSE_IS_SONG (iseq->items[i]))
-          return FALSE;
+      {
+        Bse::ItemSeq items = self->project.list_children();
+        for (size_t i = 0; i < items.size(); i++)
+          if (BSE_IS_SONG (items[i].proxy_id()))
+            return FALSE;
+      }
       return TRUE;
     case BST_ACTION_REMOVE_SYNTH:
       super = bst_app_get_current_super (self);
diff --git a/beast-gtk/bstbseutils.cc b/beast-gtk/bstbseutils.cc
index 68c33d8..514cc88 100644
--- a/beast-gtk/bstbseutils.cc
+++ b/beast-gtk/bstbseutils.cc
@@ -10,16 +10,18 @@ bst_project_restore_from_file (Bse::ProjectH project, const gchar *file_name, bo
   /* regardless of how good the restoration worked, try to
    * keep the resulting project in a GUI usable state.
    */
-  BseIt3mSeq *iseq = bse_container_list_children (project.proxy_id());
-  guint i;
-  for (i = 0; i < iseq->n_items; i++)
-    if (BSE_IS_SONG (iseq->items[i]))
-      {
-        /* fixup orphaned parts */
-        bse_song_ensure_track_links (iseq->items[i]);
-        /* songs always need a master bus */
-        bse_song_ensure_master_bus (iseq->items[i]);
-      }
+  Bse::ItemSeq items = project.list_children();
+  for (size_t i = 0; i < items.size(); i++)
+    {
+      SfiProxy item = items[i].proxy_id();
+      if (BSE_IS_SONG (item))
+        {
+          /* fixup orphaned parts */
+          bse_song_ensure_track_links (item);
+          /* songs always need a master bus */
+          bse_song_ensure_master_bus (item);
+        }
+    }
   if (error == 0 && apply_project_file_name)
     {
       bse_proxy_set_data_full (project.proxy_id(), "beast-project-file-name", g_strdup (file_name), g_free);
@@ -39,16 +41,18 @@ bst_project_import_midi_file (Bse::ProjectH project, const gchar *file_name)
   /* regardless of how good the restoration worked, try to
    * keep the resulting project in a GUI usable state.
    */
-  BseIt3mSeq *iseq = bse_container_list_children (project.proxy_id());
-  guint i;
-  for (i = 0; i < iseq->n_items; i++)
-    if (BSE_IS_SONG (iseq->items[i]))
-      {
-        /* fixup orphaned parts */
-        bse_song_ensure_track_links (iseq->items[i]);
-        /* songs always need a master bus */
-        bse_song_ensure_master_bus (iseq->items[i]);
-      }
+  Bse::ItemSeq items = project.list_children();
+  for (size_t i = 0; i < items.size(); i++)
+    {
+      SfiProxy item = items[i].proxy_id();
+      if (BSE_IS_SONG (item))
+        {
+          /* fixup orphaned parts */
+          bse_song_ensure_track_links (item);
+          /* songs always need a master bus */
+          bse_song_ensure_master_bus (item);
+        }
+    }
   return error;
 }
 
diff --git a/beast-gtk/bstbusmixer.cc b/beast-gtk/bstbusmixer.cc
index bf66afb..45718fd 100644
--- a/beast-gtk/bstbusmixer.cc
+++ b/beast-gtk/bstbusmixer.cc
@@ -158,10 +158,10 @@ bus_mixer_set_container (BstItemView *iview,
                          "signal::item_added", bus_mixer_item_added, self,
                          "signal::item_remove", bus_mixer_item_removed, self,
                          NULL);
-      BseIt3mSeq *iseq = bse_container_list_children (iview->container);
-      guint i;
-      for (i = 0; i < iseq->n_items; i++)
-        bus_mixer_item_added (iview->container, iseq->items[i], self);
+      Bse::ContainerH container = Bse::ContainerH::down_cast (bse_server.from_proxy (iview->container));
+      Bse::ItemSeq items = container.list_children();
+      for (size_t i = 0; i < items.size(); i++)
+        bus_mixer_item_added (iview->container, items[i].proxy_id(), self);
     }
 }
 
diff --git a/beast-gtk/bstsnetrouter.cc b/beast-gtk/bstsnetrouter.cc
index d4a9ec5..8487426 100644
--- a/beast-gtk/bstsnetrouter.cc
+++ b/beast-gtk/bstsnetrouter.cc
@@ -331,9 +331,7 @@ void
 bst_snet_router_update (BstSNetRouter *self)
 {
   GnomeCanvas *canvas;
-  BseIt3mSeq *iseq;
   GSList *slist, *csources = NULL;
-  guint i;
 
   assert_return (BST_IS_SNET_ROUTER (self));
 
@@ -343,7 +341,7 @@ bst_snet_router_update (BstSNetRouter *self)
   bst_snet_router_destroy_contents (self);
 
 #if 0
-    {
+  {
       /* add canvas source for the snet itself */
       csource = bst_canvas_source_new (GNOME_CANVAS_GROUP (canvas->root), self->snet);
       bst_canvas_source_set_channel_hints (BST_CANVAS_SOURCE (csource), CHANNEL_HINTS (self));
@@ -351,14 +349,14 @@ bst_snet_router_update (BstSNetRouter *self)
                         "swapped_signal::update_links", bst_snet_router_queue_link_update, self,
                         NULL);
       csources = g_slist_prepend (csources, csource);
-    }
+  }
 #endif
 
   /* walk all child sources */
-  iseq = bse_container_list_children (self->snet.proxy_id());
-  for (i = 0; i < iseq->n_items; i++)
+  Bse::ItemSeq items = self->snet.list_children();
+  for (size_t i = 0; i < items.size(); i++)
     {
-      SfiProxy item = iseq->items[i];
+      SfiProxy item = items[i].proxy_id();
 
       if (BSE_IS_SOURCE (item))
         {
diff --git a/beast-gtk/bsttreestores.cc b/beast-gtk/bsttreestores.cc
index 72fcf2b..ee4a47f 100644
--- a/beast-gtk/bsttreestores.cc
+++ b/beast-gtk/bsttreestores.cc
@@ -328,8 +328,6 @@ bst_child_list_wrapper_setup (GxkListWrapper *self,
   if (parent)
     {
       ProxyStore *ps = g_new0 (ProxyStore, 1);
-      BseIt3mSeq *iseq;
-      guint i;
       ps->self = self;
       ps->row_from_proxy = child_list_wrapper_row_from_proxy;
       ps->u.cl.ipool = sfi_upool_new ();
@@ -340,9 +338,10 @@ bst_child_list_wrapper_setup (GxkListWrapper *self,
                          "signal::item_added", child_list_wrapper_item_added, ps,
                          "signal::item_remove", child_list_wrapper_item_removed, ps,
                          NULL);
-      iseq = bse_container_list_children (ps->u.cl.container);
-      for (i = 0; i < iseq->n_items; i++)
-        child_list_wrapper_item_added (ps->u.cl.container, iseq->items[i], ps);
+      Bse::ContainerH container = Bse::ContainerH::down_cast (bse_server.from_proxy (ps->u.cl.container));
+      Bse::ItemSeq items = container.list_children();
+      for (size_t i = 0; i < items.size(); i++)
+        child_list_wrapper_item_added (ps->u.cl.container, items[i].proxy_id(), ps);
       g_object_set_data_full ((GObject*) self, "ProxyStore", ps, child_list_wrapper_destroy_data);
     }
 }


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