[gtkmm-documentation] Update chapters 19-27 for gtkmm-4.0



commit b011e295072f0bad7d4a99c9fcd0a96d7d95ddf4
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Feb 23 16:15:51 2017 +0100

    Update chapters 19-27 for gtkmm-4.0
    
     19. Drag and Drop        (only fixed typos)
     20. The Clipboard        (no change)
     21. Printing
     22. Recently Used Documents
     23. Keyboard Events      (no change)
     24. Timeouts, I/O and Idle Functions
     25. Memory management    (no change)
     26. Glade and Gtk::Builder
     27. Internationalization and Localization

 docs/tutorial/C/index-in.docbook                   |   66 +++++++++++---------
 .../book/printing/advanced/printformoperation.cc   |    7 +--
 2 files changed, 38 insertions(+), 35 deletions(-)
---
diff --git a/docs/tutorial/C/index-in.docbook b/docs/tutorial/C/index-in.docbook
index 373bff9..275db15 100644
--- a/docs/tutorial/C/index-in.docbook
+++ b/docs/tutorial/C/index-in.docbook
@@ -4792,7 +4792,7 @@ prefixed with "drag_". These are used for Drag and Drop.
 <title>Sources and Destinations</title>
 <para>
 Things are dragged from <literal>sources</literal> to be dropped on
-<literal>destinations</literal>. Each source and destination has infomation
+<literal>destinations</literal>. Each source and destination has information
 about the data formats that it can send or receive, provided by
 <classname>Gtk::TargetEntry</classname> items. A drop destination will only
 accept a dragged item if they both share a compatible
@@ -4837,7 +4837,7 @@ using these <classname>Gtk::Widget</classname> methods:
 <listitem>
     <para>
         <literal>actions</literal> is an ORed combination of values, which
-        specified which Drag and Drop operations will be possible from this
+        specify which Drag and Drop operations will be possible from this
         source - for instance, copy, move, or link. The user can choose between
         the actions by using modifier keys, such as <keycap>Shift</keycap> to
         change from <literal>copy</literal> to <literal>move</literal>, and
@@ -5373,7 +5373,7 @@ void ExampleWindow::on_printoperation_done(Gtk::PrintOperationResult result, con
 
 <para>Finally, check the status. For instance,
 <programlisting>
-void ExampleWindow::on_printoperation_status_changed(const Glib::RefPtr&lt;PrintFormOperation&gt;&amp; op)
+void ExampleWindow::on_printoperation_status_changed(const Glib::RefPtr&lt;PrintOperation&gt;&amp; op)
 {
   if (op->is_finished())
     //the print job is finished
@@ -5442,14 +5442,12 @@ Gtk::Widget* CustomPrintOperation::on_create_custom_widget()
   set_custom_tab_label(&quot;My custom tab&quot;);
 
   Gtk::Box* hbox = new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 8);
-  hbox-&gt;set_border_width(6);
+  hbox-&gt;set_margin(6);
 
   Gtk::Label* label = Gtk::manage(new Gtk::Label("Enter some text: "));
   hbox-&gt;pack_start(*label, false, false);
-  label-&gt;show();
 
   hbox-&gt;pack_start(m_Entry, false, false);
-  m_Entry.show();
 
   return hbox;
 }
@@ -5688,11 +5686,10 @@ if (info)
     <para>
       <classname>RecentChooser</classname> is an interface that can be
       implemented by widgets displaying the list of recently used files.
-      &gtkmm; provides four built-in implementations for choosing recent files:
+      &gtkmm; provides three built-in implementations for choosing recent files:
       <classname>RecentChooserWidget</classname>,
-      <classname>RecentChooserDialog</classname>,
-      <classname>RecentChooserMenu</classname>, and the deprecated
-      <classname>RecentAction</classname>.
+      <classname>RecentChooserDialog</classname>, and
+      <classname>RecentChooserMenu</classname>.
     </para>
     <para>
       <classname>RecentChooserWidget</classname> is a simple widget for
@@ -5925,7 +5922,7 @@ method that will be called every few milliseconds.
 
 <para>
 <programlisting>
-sigc::connection Glib::SignalTimeout::connect(const sigc::slot&lt;bool&gt;&amp; slot,
+sigc::connection Glib::SignalTimeout::connect(const sigc::slot&lt;bool()&gt;&amp; slot,
                                       unsigned int interval, int priority = Glib::PRIORITY_DEFAULT);
 </programlisting>
 </para>
@@ -5947,7 +5944,7 @@ my_connection.disconnect();
 
 <para>
 Another way of destroying the connection is your signal handler.
-It has to be of the type <classname>sigc::slot&lt;bool&gt;</classname>.
+It has to be of the type <classname>sigc::slot&lt;bool()&gt;</classname>.
 As you see from the definition your signal handler has to return a value of
 the type <literal>bool</literal>. A definition of a sample method might
 look like this:
@@ -5984,8 +5981,8 @@ following method is used to do this:
 
 <para>
 <programlisting>
-sigc::connection Glib::SignalIO::connect(const sigc::slot&lt;bool,Glib::IOCondition&gt;&amp; slot,
-                                 int fd, Glib::IOCondition condition,
+sigc::connection Glib::SignalIO::connect(const sigc::slot&lt;bool(Glib::IOCondition)&gt;&amp; slot,
+                                 Glib::PollFD::fd_t fd, Glib::IOCondition condition,
                                  int priority = Glib::PRIORITY_DEFAULT);
 </programlisting>
 </para>
@@ -6078,7 +6075,7 @@ If you want to specify a method that gets called when nothing else is happening,
 
 <para>
 <programlisting>
-sigc::connection  Glib::SignalIdle::connect(const sigc::slot&lt;bool&gt;&amp; slot,
+sigc::connection  Glib::SignalIdle::connect(const sigc::slot&lt;bool()&gt;&amp; slot,
                                     int priority = Glib::PRIORITY_DEFAULT_IDLE);
 </programlisting>
 </para>
@@ -6493,7 +6490,7 @@ DerivedDialog::DerivedDialog(BaseObjectType* cobject, const Glib::RefPtr&lt;Gtk:
 </para>
 
 <para>
-Starting with &gtkmm; 3.19.7, it's possible to pass additional arguments from
+It's possible to pass additional arguments from
 <methodname>get_widget_derived()</methodname> to the constructor of the derived
 widget. For instance, this call to <methodname>get_widget_derived()</methodname>
 <programlisting>
@@ -6713,7 +6710,7 @@ AC_SUBST(PROGRAMNAME_LOCALEDIR)</programlisting>
           <para>
             Add <literal>INTLTOOL_FILES</literal> to the
             <literal>EXTRA_DIST</literal> list of files. This ensures that when
-            you do a <command>make dist</command>, these commands will be
+            you do a <command>make dist</command>, these files will be
             included in the source tarball.
           </para>
         </listitem>
@@ -6803,7 +6800,7 @@ textdomain(GETTEXT_PACKAGE);</programlisting>
     <title>How gettext works</title>
 
     <para>
-      <application>intltool</application> /
+      The <application>intltool-update</application> or
       <application>xgettext</application> script extracts the strings
       and puts them in a <filename>mypackage.pot</filename> file.
       The translators of your application create their translations by
@@ -6811,9 +6808,9 @@ textdomain(GETTEXT_PACKAGE);</programlisting>
       <filename>localename.po</filename> file. A locale identifies a
       language and an encoding for that language, including date and numerical
       formats. Later, when the text in your source code has changed, the
-      <literal>msmerge</literal> script is used to update the
-      <filename>localename.po</filename> files from the regenerated
-      <filename>.pot</filename> file.
+      <application>msgmerge</application> or <application>intltool-update</application>
+      script is used to update the <filename>localename.po</filename> files from
+      the regenerated <filename>.pot</filename> file.
     </para>
 
     <para>
@@ -6934,14 +6931,15 @@ using <classname>std::string</classname>, so you just need to start using
 <classname>Glib::ustring</classname>.
 </para>
 
-<sect2 id="i18n-ustring-iostreams"><title>Glib::ustring and std::iostreams</title>
+<sect2 id="i18n-ustring-iostreams">
+<title>Glib::ustring and std::iostreams</title>
 <!-- <para>TODO: This section is not clear - it needs to spell things out more clearly and obviously.</para> 
-->
 <para>
 Unfortunately, the integration with the standard iostreams is not completely
 foolproof. &gtkmm; converts <classname>Glib::ustring</classname>s to a
 locale-specific encoding (which usually is not UTF-8) if you output them to an
 <classname>ostream</classname> with <function>operator&lt;&lt;</function>.
-Likewise, retrieving <classname>Glib::ustrings</classname> from
+Likewise, retrieving <classname>Glib::ustring</classname>s from
 <classname>istream</classname> with <function>operator&gt;&gt;</function>
 causes a conversion in the opposite direction. But this scheme breaks down if
 you go through a <classname>std::string</classname>, e.g. by inputting text
@@ -6951,8 +6949,10 @@ contained non-ASCII characters and the current locale is not UTF-8 encoded, the
 result is a corrupted <classname>Glib::ustring</classname>. You can work around
 this with a manual conversion. For instance, to retrieve the
 <classname>std::string</classname> from a <classname>ostringstream</classname>:
-<programlisting>std::ostringstream output;
-output.imbue(std::locale("")); // use the user's locale for this stream
+<programlisting>std::locale::global(std::locale("")); // Set the global locale to the user's preferred 
locale.
+                                      // Usually unnecessary here, because Glib::init()
+                                      // or Gtk::Application::create() does it for you.
+std::ostringstream output;
 output &lt;&lt; percentage &lt;&lt; " % done";
 label-&gt;set_text(Glib::locale_to_utf8(output.str()));</programlisting>
 </para>
@@ -6968,7 +6968,7 @@ label-&gt;set_text(Glib::locale_to_utf8(output.str()));</programlisting>
 <sect2 id="i18n-string-semantics">
         <title>Same strings, different semantics</title>
 
-        <para>Sometimes two english strings are identical but have different meanings in
+        <para>Sometimes two English strings are identical but have different meanings in
 different contexts, so they would probably not be identical when translated. Since the English strings are
           used as look-up keys, this causes problems.</para>
 
@@ -6981,11 +6981,17 @@ add a comment for the translators before the <function>gettext</function> call.
 Such comments will be shown in the <filename>.po</filename> files. For
 instance:
 </para>
-
 <programlisting>// note to translators: don't translate the "[noun]" part - it is
 // just here to distinguish the string from another "jumps" string
 text = strip(gettext("jumps[noun]"), "[noun]");</programlisting>
-      </sect2>
+
+<para>
+If you use <application>Glib</application>'s support macros, it's easier. Use
+<function>C_()</function> instead of <function>_()</function>. For instance:
+</para>
+<programlisting>GLib::ustring text(C_("noun", "jumps"));</programlisting>
+
+</sect2>
 
 <sect2 id="i18n-composition">
   <title>Composition of strings</title>
@@ -7040,7 +7046,7 @@ instance, you cannot use the copyright sign (&copy;).
 
         <para>To work around this, you could write a comment in the
           source code just before the string, telling the translators to
-          use the special character if it is available in their languages. For english, you could then make 
an American English
+          use the special character if it is available in their languages. For English, you could then make 
an American English
           <filename>en_US.po</filename> translation which used that special character.</para>
       </sect2>
     </sect1>
@@ -7061,7 +7067,7 @@ instance, you cannot use the copyright sign (&copy;).
       <para>Then you make sure you update the file
         <filename>POTFILES.in</filename> in the
         <filename>po/</filename> subdirectory
-        (<command>intltool-update -M</command> can help with this) so
+        (<command>intltool-update -m</command> can help with this) so
         that the translators always access updated
         <filename>myprogram.pot</filename> files, and simply freeze
         the strings at least a couple of days before you make a new
diff --git a/examples/book/printing/advanced/printformoperation.cc 
b/examples/book/printing/advanced/printformoperation.cc
index 3a5c621..e993bcc 100644
--- a/examples/book/printing/advanced/printformoperation.cc
+++ b/examples/book/printing/advanced/printformoperation.cc
@@ -155,20 +155,17 @@ Gtk::Widget* PrintFormOperation::on_create_custom_widget()
   set_custom_tab_label("Other");
 
   auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
-  vbox->property_margin() = 12;
+  vbox->set_margin(12);
 
   auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 8));
   vbox->pack_start(*hbox, false, false);
-  hbox->property_margin() = 6;
-  hbox->show();
+  hbox->set_margin(6);
 
   auto label = Gtk::manage(new Gtk::Label("Choose a font: "));
   hbox->pack_start(*label, false, false);
-  label->show();
 
   m_FontButton.set_font_name(m_Font);
   hbox->pack_start(m_FontButton, false, false);
-  m_FontButton.show();
 
   return vbox;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]