vclient rename

This commit is contained in:
Nedko Arnaudov 2011-06-01 04:48:53 +03:00
parent 19d7d762f8
commit 0bb1d523d7
4 changed files with 50 additions and 1 deletions

View File

@ -96,6 +96,7 @@ static void ladish_graph_manager_dbus_rename_client(struct dbus_method_call * ca
{
uint64_t client_id;
const char * newname;
ladish_client_handle client;
if (!dbus_message_get_args(
call_ptr->message,
@ -111,7 +112,21 @@ static void ladish_graph_manager_dbus_rename_client(struct dbus_method_call * ca
log_info("rename client request, graph '%s', client %"PRIu64", newname '%s'", ladish_graph_get_description(graph), client_id, newname);
method_return_new_void(call_ptr);
client = ladish_graph_find_client_by_id(graph, client_id);
if (client == NULL)
{
lash_dbus_error(call_ptr, LASH_DBUS_ERROR_INVALID_ARGS, "Cannot rename unknown client");
return;
}
if (!ladish_graph_rename_client(graph, client, newname))
{
lash_dbus_error(call_ptr, LASH_DBUS_ERROR_GENERIC, "client rename failed");
}
else
{
method_return_new_void(call_ptr);
}
}
static void ladish_graph_manager_dbus_rename_port(struct dbus_method_call * call_ptr)

View File

@ -350,6 +350,14 @@ canvas_set_module_name(
const char * name)
{
module_ptr->get()->set_name(name);
module_ptr->get()->resize();
}
const char *
canvas_get_module_name(
canvas_module_handle module)
{
return module_ptr->get()->name().c_str();
}
bool
@ -412,6 +420,7 @@ canvas_set_port_name(
const char * name)
{
port_ptr->get()->set_name(name);
port_ptr->get()->module().lock()->resize();
}
const char *

View File

@ -116,6 +116,10 @@ canvas_set_module_name(
canvas_module_handle module,
const char * name);
const char *
canvas_get_module_name(
canvas_module_handle module);
bool
canvas_create_port(
canvas_handle canvas,

View File

@ -173,6 +173,23 @@ module_location_changed(
y_str);
}
static void on_popup_menu_action_client_rename(GtkWidget * menuitem, gpointer module_context)
{
log_info("on_popup_menu_action_client_rename %"PRIu64, client_ptr->id);
char * new_name;
if (name_dialog(_("Rename client"), _("Client name"), canvas_get_module_name(client_ptr->canvas_module), &new_name))
{
if (!graph_proxy_rename_client(client_ptr->owner_ptr->graph, client_ptr->id, new_name))
{
error_message_box("Rename failed");
}
free(new_name);
}
}
static void on_popup_menu_action_split(GtkWidget * menuitem, gpointer module_context)
{
//log_info("on_popup_menu_action_split");
@ -185,6 +202,10 @@ static void fill_module_menu(GtkMenu * menu, void * module_context)
log_info("fill_module_menu %"PRIu64, client_ptr->id);
menuitem = gtk_menu_item_new_with_label(_("Client rename"));
g_signal_connect(menuitem, "activate", (GCallback)on_popup_menu_action_client_rename, client_ptr);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
if (client_ptr->inport_count != 0 &&
client_ptr->outport_count != 0)
{