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="pt-BR">

  <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>Enrico Nicoletto</mal:name>
      <mal:email>liverig@gmail.com</mal:email>
      <mal:years>2009</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Rafael Fontenelle</mal:name>
      <mal:email>rafaelff@gnome.org</mal:email>
      <mal:years>2013, 2014, 2016, 2017</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Isaac Ferreira Filho</mal:name>
      <mal:email>isaacmob@riseup.net</mal:email>
      <mal:years>2018</mal:years>
    </mal:credit>
  </info>

  <title>Adicionando <gui>Ajuda</gui> ao menu de aplicativo</title>

  <links type="series" style="floatend">
    <title>Configure a ajuda</title>
  </links>

  <p>A maioria dos aplicativos do GNOME deveria ter um menu aplicativo. O item de menu <gui style="menuitem">Ajuda</gui> deveria estar em cima do item de menu <gui style="menuitem">Sobre</gui>.</p>

  <example>
  <note>
    <p>Esse exemplo, baseado no <app href="https://git.gnome.org/browse/cheese/tree/src/cheese-main.vala">Cheese</app>, supõe que seu aplicativo esteja escrito em Vala. Ele vai ser um pouco diferente para outras linguagens de programação.</p>
  </note>

  <p>Adiciona o item <gui style="menuitem">Ajuda</gui> à lista de ações:</p>
  <code>
   private const GLib.ActionEntry action_entries[] = {
        <input>{ "ajuda", on_help },</input>
        { "sobre", on_about },
        { "sair", on_quit }
    };

   add_action_entries (action_entries, my_Gtk_Application);
</code>

  <p>Adiciona o item de menu <gui style="menuitem">Help</gui> ao menu de aplicativo:</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>Vê a ajuda com o <app>Yelp</app> quando o item de menu <gui style="menuitem">Help</gui> for clicado:</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 ("Erro ao abrir a ajuda: %s", err.message);
    }
  }
</code>

  <p>Para fazer ligação com uma seção no <file>index.page</file>, use <code>"help:<input>nome-aplicativo</input>/index#<input>id-seção</input>"</code>.</p>

  </example>
</page>