[gtkmm-documentation] Application example: Added comments.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Application example: Added comments.
- Date: Tue, 18 Jan 2011 21:11:32 +0000 (UTC)
commit 5b0678e769163bfec205687cfb94d2fd8c66a5c5
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jan 18 22:11:24 2011 +0100
Application example: Added comments.
* examples/book/application/exampleapplication.cc:
* examples/book/application/main.cc: Added some comments now that I think I
know what this does. Add a TODO suggesting that we move Gtk::Main inside
Application, removing the Gtk::Main API.
ChangeLog | 9 +++++++++
examples/book/application/exampleapplication.cc | 4 +++-
examples/book/application/main.cc | 8 ++++++--
3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b3ac6d5..6ad4592 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-18 Murray Cumming <murrayc murrayc com>
+
+ Application example: Added comments.
+
+ * examples/book/application/exampleapplication.cc:
+ * examples/book/application/main.cc: Added some comments now that I think I
+ know what this does. Add a TODO suggesting that we move Gtk::Main inside
+ Application, removing the Gtk::Main API.
+
2011-01-17 Murray Cumming <murrayc murrayc com>
Clipboard example: Fix the build.
diff --git a/examples/book/application/exampleapplication.cc b/examples/book/application/exampleapplication.cc
index d0ac30c..a23a5c8 100644
--- a/examples/book/application/exampleapplication.cc
+++ b/examples/book/application/exampleapplication.cc
@@ -26,7 +26,9 @@ ExampleApplication::ExampleApplication(const Glib::ustring& appid, Gio::Applicat
void ExampleApplication::create_window(const Glib::RefPtr<Gio::File>& file)
{
Gtk::Window* window = new ExampleWindow(file);
- add_window(*window);
+
+ //Make sure that the application runs for as long this window is still open:
+ add_window(*window);
//Delete the window when it is hidden.
//That's enough for this simple example.
diff --git a/examples/book/application/main.cc b/examples/book/application/main.cc
index afa0fab..2089d3a 100644
--- a/examples/book/application/main.cc
+++ b/examples/book/application/main.cc
@@ -1,4 +1,4 @@
-/* gtkmm example Copyright (C) 2002 gtkmm development team
+/* gtkmm example Copyright (C) 2010 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -27,13 +27,17 @@ void on_open(const Gio::Application::type_vec_files& /* files */,
int main(int argc, char *argv[])
{
- Gtk::Main kit(argc, argv);
+ Gtk::Main kit(argc, argv); //TODO: Make this unnecessary: Put it in Gtk::Application.
ExampleApplication application(
"org.gtkmm.examples.application",
Gio::APPLICATION_HANDLES_OPEN);
application.signal_open().connect( sigc::ptr_fun(on_open) );
+ // Start the application, showing the initial window,
+ // and opening extra windows for any files that it is asked to open,
+ // for instance as a command-line parameter.
+ // run() will return when the last window has been closed by the user.
const int status = application.run(argc, argv);
return status;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]