[gtkmm-documentation] * docs/tutorial/C/gtkmm-tut.xml: Clipboard: Paste: Discovering Available
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtkmm-documentation] * docs/tutorial/C/gtkmm-tut.xml: Clipboard: Paste: Discovering Available
- Date: Tue, 2 Jun 2009 04:58:30 -0400 (EDT)
commit 1ea3ff0beaf2f6614a3fb9a6fcfe5da9a14cf285
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jun 2 10:57:46 2009 +0200
* docs/tutorial/C/gtkmm-tut.xml: Clipboard: Paste: Discovering Available
Targets: Corrected the parameter types of the callback slot based on the
correctly-compiling code in examples/book/clipboard/ideal/examplewindow.cc.
Bug #583702 (Jason Curole)
---
ChangeLog | 7 +++++++
docs/tutorial/C/gtkmm-tut.xml | 22 ++++++++--------------
examples/book/clipboard/ideal/examplewindow.cc | 10 +++++-----
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8d130a6..b76adef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-02 Murray Cumming <murrayc murrayc com>
+
+ * docs/tutorial/C/gtkmm-tut.xml: Clipboard: Paste: Discovering Available
+ Targets: Corrected the parameter types of the callback slot based on the
+ correctly-compiling code in examples/book/clipboard/ideal/examplewindow.cc.
+ Bug #583702 (Jason Curole)
+
2009-05-23 Armin Burgmeier <armin openismus com>
* docs/tutorial/C/gtkmm-tut.xml: Fixed a typo in the introduction
diff --git a/docs/tutorial/C/gtkmm-tut.xml b/docs/tutorial/C/gtkmm-tut.xml
index 6398370..2c0a8b5 100644
--- a/docs/tutorial/C/gtkmm-tut.xml
+++ b/docs/tutorial/C/gtkmm-tut.xml
@@ -5054,23 +5054,17 @@ with the information. For instance:
In your callback, compare the list of available targets with those that your application supports for pasting. You could enable or disable a Paste menu item, depending on whether pasting is currently possible. For instance:
</para>
<programlisting>void ExampleWindow::on_clipboard_received_targets(
- const Gtk::SelectionData& selection_data)
+ const Glib::StringArrayHandle& targets_array)
{
- bool bPasteIsPossible = false;
-
- //Get the list of available clipboard targets:
- typedef std::list<Glib::ustring> type_listTargets;
- type_listTargets targets = selection_data.get_targets();
+ // Get the list of available clipboard targets:
+ std::list<std::string> targets = targets_array;
- //and see if one is suitable:
- for(type_listTargets::const_iterator iter = targets.begin();
- iter != targets.end(); ++iter)
- {
- if(*iter == "example_custom_target")
- bPasteIsPossible = true;
- }
+ const bool bPasteIsPossible =
+ std::find(targets.begin(), targets.end(),
+ example_target_custom) != targets.end();
- //Do something, depending on whether bPasteIsPossible is true.
+ // Enable/Disable the Paste button appropriately:
+ m_Button_Paste.set_sensitive(bPasteIsPossible);
}</programlisting>
</sect2>
diff --git a/examples/book/clipboard/ideal/examplewindow.cc b/examples/book/clipboard/ideal/examplewindow.cc
index 89b9ac0..4037ed8 100644
--- a/examples/book/clipboard/ideal/examplewindow.cc
+++ b/examples/book/clipboard/ideal/examplewindow.cc
@@ -106,8 +106,8 @@ void ExampleWindow::on_button_paste()
//Tell the clipboard to call our method when it is ready:
Glib::RefPtr<Gtk::Clipboard> refClipboard = Gtk::Clipboard::get();
- refClipboard->request_contents(example_target_custom, sigc::mem_fun(*this,
- &ExampleWindow::on_clipboard_received) );
+ refClipboard->request_contents(example_target_custom,
+ sigc::mem_fun(*this, &ExampleWindow::on_clipboard_received) );
update_paste_status();
}
@@ -184,14 +184,14 @@ void ExampleWindow::update_paste_status()
}
void ExampleWindow::on_clipboard_received_targets(
- const Glib::StringArrayHandle& targets_array)
+ const Glib::StringArrayHandle& targets_array)
{
// Get the list of available clipboard targets:
std::list<std::string> targets = targets_array;
const bool bPasteIsPossible =
- std::find(targets.begin(), targets.end(),
- example_target_custom) != targets.end();
+ std::find(targets.begin(), targets.end(),
+ example_target_custom) != targets.end();
// Enable/Disable the Paste button appropriately:
m_Button_Paste.set_sensitive(bPasteIsPossible);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]