[glibmm] Gio::Application: open(): Added a single-file method overload.



commit fd11ed067971932bcaacf5de1d96954009e70f5d
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 4 10:52:38 2011 +0100

    Gio::Application: open(): Added a single-file method overload.
    
    * gio/src/application.[hg|ccg]: Added an open() overload that takes a single
    Gio::File instead of a vector of Gio::Files.

 ChangeLog               |    7 +++++++
 gio/src/application.ccg |    7 +++++++
 gio/src/application.hg  |   19 +++++++++++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3138327..a9a0507 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-03-04  Murray Cumming  <murrayc murrayc com>
 
+	Gio::Application: open(): Added a single-file method overload.
+
+	* gio/src/application.[hg|ccg]: Added an open() overload that takes a single 
+	Gio::File instead of a vector of Gio::Files.
+
+2011-03-04  Murray Cumming  <murrayc murrayc com>
+
 	Gio::Application: Fix a signal definition.
 
 	* gio/src/application.hg: The command-line signal returns an int, not a bool.
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
index 9f0a410..d4297b4 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -194,6 +194,13 @@ void Application::open(const type_vec_files& files, const Glib::ustring& hint)
     hint.c_str());
 }
 
+void Application::open(const Glib::RefPtr<Gio::File>& file, const Glib::ustring& hint)
+{
+  type_vec_files files(1);
+  files.push_back(file);
+  open(files, hint);
+}
+
 bool Application::register_application()
 {
   GError* gerror = 0;
diff --git a/gio/src/application.hg b/gio/src/application.hg
index 0bf60cc..7559525 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -136,6 +136,25 @@ public:
    */
   void open(const type_vec_files& files, const Glib::ustring& hint = Glib::ustring());
   _IGNORE(g_application_open)
+  
+  /* Opens the given file.
+   *
+   * In essence, this results in the open signal being emitted
+   * in the primary instance.
+   *
+   * @a hint is simply passed through to the open signal.  It is
+   * intended to be used by applications that have multiple modes for
+   * opening files (eg: "view" vs "edit", etc).
+   *
+   * The application must be registered before calling this mwethod
+   * and it must have the APPLICATION_HANDLES_OPEN flag set.
+   *
+   * @param file The file to open. This must be non-empty.
+   * @param hint A hint.
+   *
+   * @newin{2,28}
+   */
+  void open(const Glib::RefPtr<Gio::File>& file, const Glib::ustring& hint = Glib::ustring());
 
   _WRAP_METHOD(int run(int argc, char** argv), g_application_run)
   //TODO: g_application_run_with_arguments)



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