vport rename
This commit is contained in:
parent
e0ec247159
commit
60280f1b89
|
@ -118,6 +118,7 @@ static void ladish_graph_manager_dbus_rename_port(struct dbus_method_call * call
|
||||||
{
|
{
|
||||||
uint64_t port_id;
|
uint64_t port_id;
|
||||||
const char * newname;
|
const char * newname;
|
||||||
|
ladish_port_handle port;
|
||||||
|
|
||||||
if (!dbus_message_get_args(
|
if (!dbus_message_get_args(
|
||||||
call_ptr->message,
|
call_ptr->message,
|
||||||
|
@ -133,7 +134,21 @@ static void ladish_graph_manager_dbus_rename_port(struct dbus_method_call * call
|
||||||
|
|
||||||
log_info("rename port request, graph '%s', port %"PRIu64", newname '%s'", ladish_graph_get_description(graph), port_id, newname);
|
log_info("rename port request, graph '%s', port %"PRIu64", newname '%s'", ladish_graph_get_description(graph), port_id, newname);
|
||||||
|
|
||||||
method_return_new_void(call_ptr);
|
port = ladish_graph_find_port_by_id(graph, port_id);
|
||||||
|
if (port == NULL)
|
||||||
|
{
|
||||||
|
lash_dbus_error(call_ptr, LASH_DBUS_ERROR_INVALID_ARGS, "Cannot rename unknown port");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ladish_graph_rename_port(graph, port, newname))
|
||||||
|
{
|
||||||
|
lash_dbus_error(call_ptr, LASH_DBUS_ERROR_GENERIC, "port rename failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
method_return_new_void(call_ptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ladish_graph_manager_dbus_move_port(struct dbus_method_call * call_ptr)
|
static void ladish_graph_manager_dbus_move_port(struct dbus_method_call * call_ptr)
|
||||||
|
|
|
@ -414,6 +414,13 @@ canvas_set_port_name(
|
||||||
port_ptr->get()->set_name(name);
|
port_ptr->get()->set_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
canvas_get_port_name(
|
||||||
|
canvas_port_handle port)
|
||||||
|
{
|
||||||
|
return port_ptr->get()->name().c_str();
|
||||||
|
}
|
||||||
|
|
||||||
#undef port_ptr
|
#undef port_ptr
|
||||||
#define port1_ptr ((boost::shared_ptr<port_cls> *)port1)
|
#define port1_ptr ((boost::shared_ptr<port_cls> *)port1)
|
||||||
#define port2_ptr ((boost::shared_ptr<port_cls> *)port2)
|
#define port2_ptr ((boost::shared_ptr<port_cls> *)port2)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* LADI Session Handler (ladish)
|
* LADI Session Handler (ladish)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
|
* Copyright (C) 2009, 2010, 2011 Nedko Arnaudov <nedko@arnaudov.name>
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* This file contains the interface to the canvas functionality
|
* This file contains the interface to the canvas functionality
|
||||||
|
@ -140,6 +140,10 @@ canvas_set_port_name(
|
||||||
canvas_port_handle port,
|
canvas_port_handle port,
|
||||||
const char * name);
|
const char * name);
|
||||||
|
|
||||||
|
const char *
|
||||||
|
canvas_get_port_name(
|
||||||
|
canvas_port_handle port);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canvas_add_connection(
|
canvas_add_connection(
|
||||||
canvas_handle canvas,
|
canvas_handle canvas,
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "graph_canvas.h"
|
#include "graph_canvas.h"
|
||||||
#include "../dbus_constants.h"
|
#include "../dbus_constants.h"
|
||||||
#include "../common/catdup.h"
|
#include "../common/catdup.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
struct graph_canvas
|
struct graph_canvas
|
||||||
{
|
{
|
||||||
|
@ -195,11 +196,34 @@ static void fill_module_menu(GtkMenu * menu, void * module_context)
|
||||||
|
|
||||||
#undef client_ptr
|
#undef client_ptr
|
||||||
|
|
||||||
#define port_ptr ((struct client *)port_context)
|
#define port_ptr ((struct port *)port_context)
|
||||||
|
|
||||||
|
static void on_popup_menu_action_port_rename(GtkWidget * menuitem, gpointer port_context)
|
||||||
|
{
|
||||||
|
log_info("on_popup_menu_action_port_rename %"PRIu64, port_ptr->id);
|
||||||
|
|
||||||
|
char * new_name;
|
||||||
|
|
||||||
|
if (name_dialog(_("Rename port"), _("Port name"), canvas_get_port_name(port_ptr->canvas_port), &new_name))
|
||||||
|
{
|
||||||
|
if (!graph_proxy_rename_port(port_ptr->graph_canvas->graph, port_ptr->id, new_name))
|
||||||
|
{
|
||||||
|
error_message_box("Rename failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
free(new_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void fill_port_menu(GtkMenu * menu, void * port_context)
|
static void fill_port_menu(GtkMenu * menu, void * port_context)
|
||||||
{
|
{
|
||||||
|
GtkWidget * menuitem;
|
||||||
|
|
||||||
log_info("fill_port_menu %"PRIu64, port_ptr->id);
|
log_info("fill_port_menu %"PRIu64, port_ptr->id);
|
||||||
|
|
||||||
|
menuitem = gtk_menu_item_new_with_label(_("Rename"));
|
||||||
|
g_signal_connect(menuitem, "activate", (GCallback)on_popup_menu_action_port_rename, port_ptr);
|
||||||
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef port_ptr
|
#undef port_ptr
|
||||||
|
|
Loading…
Reference in New Issue