Blob Blame History Raw
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="dev-help-appmenu" xml:lang="es">

  <info>
    <link type="seealso" xref="dev-help"/>
    <revision version="0.1" date="2013-06-19" status="review"/>

    <credit type="author copyright">
      <name>Radina Matic</name>
      <email its:translate="no">radina.matic@gmail.com</email>
      <years>2013</years>
    </credit>
    <credit type="editor">
      <name>Ekaterina Gerasimova</name>
      <email its:translate="no">kittykat3756@gmail.com</email>
      <years>2013</years>
    </credit>

    <include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>

  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Daniel Mustieles</mal:name>
      <mal:email>daniel.mustieles@gmail.com</mal:email>
      <mal:years>2011-2017</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Jorge González</mal:name>
      <mal:email>jorgegonz@svn.gnome.org</mal:email>
      <mal:years>2007-2010</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Mario Carrión</mal:name>
      <mal:email>mario@monouml.org</mal:email>
      <mal:years>2006</mal:years>
    </mal:credit>
  </info>

  <title>Añadir <gui>Ayuda</gui> al menú de la aplicación</title>

  <links type="series" style="floatend">
    <title>Configurar la ayuda</title>
  </links>

  <p>La mayoría de las aplicaciones de GNOME deben tener su menú de aplicación. El elemento de menú <gui style="menuitem">Ayuda</gui> debe estar encima del elemento <gui style="menuitem">Acerca de</gui>.</p>

  <example>
  <note>
    <p>Este ejemplo, basado en <app href="https://git.gnome.org/browse/cheese/tree/src/cheese-main.vala">Cheese</app>, asume que su aplicación está escrita en Vala. Será ligeramente diferente para otros lenguajes de programación.</p>
  </note>

  <p>Añadir el elemento <gui style="menuitem">Ayuda</gui> a la lista de acciones:</p>
  <code>
   private const GLib.ActionEntry action_entries[] = {
        <input>{ "help", on_help },</input>
        { "about", on_about },
        { "quit", on_quit }
    };

   add_action_entries (action_entries, my_Gtk_Application);
</code>

  <p>Añadir el elemento <gui style="menuitem">Ayuda</gui> al menú de la aplicación:</p>

<code>
  var menu = new GLib.Menu ();
  var section = new GLib.Menu ();

  <input>var item = new GLib.MenuItem (_("_Help"), "app.help");
  item.set_attribute ("accel", "s", "F1");
  section.append_item (item);</input>
</code>

  <p>Ver la ayuda con <app>Yelp</app> cuando se pulsa el elemento <gui style="menuitem">Ayuda</gui> del menú:</p>

<code>
  private void on_help ()
  {
    var screen = main_window.get_screen ();
    try
    {
      Gtk.show_uri (screen, <input>"help:cheese"</input>, Gtk.get_current_event_time ());
    }
    catch (Error err)
    {
      message ("Error opening help: %s", err.message);
    }
  }
</code>

  <p>Para enlazar a una sección en el archivo <file>index.page</file>, use <code>"help:<input>nombre_aplicación</input>/index#<input>id_sección</input>"</code>.</p>

  </example>
</page>