Catch studio appeared/disappeared signals in gladish

This commit is contained in:
Nedko Arnaudov 2009-07-27 00:47:15 +03:00
parent f1aa5f96be
commit e221c2c209
3 changed files with 36 additions and 10 deletions

View File

@ -214,6 +214,7 @@ Patchage::Patchage(int argc, char** argv)
_session = new session();
_project_list = new project_list(this, _session);
_project_list_viewport->hide();
_lash = new lash_proxy(_session);
@ -554,11 +555,19 @@ Patchage::buffer_size_changed()
}
void
Patchage::set_lash_availability(
bool lash_active)
Patchage::set_studio_availability(
bool available)
{
_project_list->set_lash_availability(lash_active);
_menu_view_projects->set_active(lash_active);
if (available)
{
_main_win->set_title("Active Studio - LADI Session Handler");
}
else
{
_main_win->set_title("LADI Session Handler");
}
_project_list->set_lash_availability(available);
_menu_view_projects->set_active(available);
}
void

View File

@ -61,7 +61,7 @@ public:
void update_state();
void store_window_location();
void set_lash_availability(bool lash_active);
void set_studio_availability(bool available);
void set_a2j_status(unsigned int status);
void load_project_ask();

View File

@ -95,6 +95,8 @@ lash_proxy_impl::init()
_server_responding = false;
patchage_dbus_add_match("type='signal',interface='" DBUS_INTERFACE_DBUS "',member=NameOwnerChanged,arg0='" LASH_SERVICE "'");
patchage_dbus_add_match("type='signal',interface='" LASH_IFACE_CONTROL "',member=StudioAppeared");
patchage_dbus_add_match("type='signal',interface='" LASH_IFACE_CONTROL "',member=StudioDisappeared");
patchage_dbus_add_match("type='signal',interface='" LASH_IFACE_CONTROL "',member=ProjectAppeared");
patchage_dbus_add_match("type='signal',interface='" LASH_IFACE_CONTROL "',member=ProjectDisappeared");
patchage_dbus_add_match("type='signal',interface='" LASH_IFACE_CONTROL "',member=ProjectNameChanged");
@ -110,9 +112,9 @@ lash_proxy_impl::init()
// get initial list of projects
// calling any method to updates server responding status
// this also actiavtes lash object if it not activated already
fetch_loaded_projects();
//fetch_loaded_projects();
g_app->set_lash_availability(_server_responding);
g_app->set_studio_availability(false);
}
bool
@ -167,7 +169,7 @@ lash_proxy_impl::dbus_message_hook(
assert(proxy);
lash_proxy_impl * me = reinterpret_cast<lash_proxy_impl *>(proxy);
//info_msg("dbus_message_hook() called.");
info_msg("dbus_message_hook() called.");
// Handle signals we have subscribed for in attach()
@ -193,18 +195,33 @@ lash_proxy_impl::dbus_message_hook(
if (old_owner[0] == '\0')
{
info_msg((string)"LASH activated.");
g_app->set_lash_availability(true);
}
else if (new_owner[0] == '\0')
{
info_msg((string)"LASH deactivated.");
g_app->set_lash_availability(false);
g_app->set_studio_availability(false);
me->_server_responding = false;
}
return DBUS_HANDLER_RESULT_HANDLED;
}
if (dbus_message_is_signal(message, LASH_IFACE_CONTROL, "StudioAppeared"))
{
info_msg((string)"Studio appeared.");
g_app->set_studio_availability(true);
return DBUS_HANDLER_RESULT_HANDLED;
}
if (dbus_message_is_signal(message, LASH_IFACE_CONTROL, "StudioDisappeared"))
{
info_msg((string)"Studio disappeared.");
g_app->set_studio_availability(false);
return DBUS_HANDLER_RESULT_HANDLED;
}
if (dbus_message_is_signal(message, LASH_IFACE_CONTROL, "ProjectAppeared"))
{
if (!dbus_message_get_args( message, &g_dbus_error,