gtk/controller: add accel menuitem property

This commit is contained in:
Marc-André Lureau 2011-06-16 01:30:43 +02:00 committed by Marc-André Lureau
parent 3bdd8434d9
commit abbfb5779e
2 changed files with 8 additions and 2 deletions

View File

@ -190,8 +190,10 @@ public class Controller: Object {
if (read == 0)
break;
if (warn_if (read != sizeof (SpiceProtocol.Controller.Msg)))
if (warn_if (read != sizeof (SpiceProtocol.Controller.Msg))) {
warning ("read only: " + read.to_string ());
break;
}
var msg = (SpiceProtocol.Controller.Msg*)t;
if (warn_if (msg.size < sizeof (SpiceProtocol.Controller.Msg)))

View File

@ -25,6 +25,7 @@ public class MenuItem: Object {
public int parent_id;
public int id;
public string text;
public string accel;
public SpiceProtocol.Controller.MenuFlags flags;
public MenuItem.from_string (string str) throws SpiceCtrl.Error {
@ -33,7 +34,10 @@ public class MenuItem: Object {
throw new SpiceCtrl.Error.VALUE(""); /* Vala: why is it mandatory to give a string? */
parent_id = int.parse (params[0]);
id = int.parse (params[1]);
text = params[2];
var textaccel = params[2].split ("\t");
text = textaccel[0];
if (textaccel.length > 1)
accel = textaccel[1];
flags = (SpiceProtocol.Controller.MenuFlags)int.parse (params[3]);
submenu = new Menu ();