[glibmm] Gio::Application: Add missing virtual functions and methods.



commit dc9c8c157625ffc0b76c991508ce84c134b497ca
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Fri Feb 24 00:57:17 2012 -0500

    Gio::Application: Add missing virtual functions and methods.
    
    	* gio/src/application.{ccg,hg}: Add the rest of the virtual functions
    	-- all except the one with a GVariantBuilder parameter because that
    	type is not wrapped yet.  Also add the [set|get]_default() methods
    	wrapping the respective C functions.
    	* gio/src/gio_vfuncs.defs: Add the rest of GApplication's virtual
    	function definitions so they can be wrapped.
    	* tools/m4/convert_gio.m4: Add GApplication conversions.

 ChangeLog               |   12 ++++++++++++
 gio/src/application.ccg |    6 ++++++
 gio/src/application.hg  |   29 ++++++++++++++++++-----------
 gio/src/gio_vfuncs.defs |   39 +++++++++++++++++++++++++++++++++++++++
 tools/m4/convert_gio.m4 |    4 ++++
 5 files changed, 79 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b1c1187..a1b7cd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2012-02-24  Josà Alburquerque  <jaalburquerque gmail com>
 
+	Gio::Application: Add missing virtual functions and methods.
+
+	* gio/src/application.{ccg,hg}: Add the rest of the virtual functions
+	-- all except the one with a GVariantBuilder parameter because that
+	type is not wrapped yet.  Also add the [set|get]_default() methods
+	wrapping the respective C functions.
+	* gio/src/gio_vfuncs.defs: Add the rest of GApplication's virtual
+	function definitions so they can be wrapped.
+	* tools/m4/convert_gio.m4: Add GApplication conversions.
+
+2012-02-24  Josà Alburquerque  <jaalburquerque gmail com>
+
 	giomm: Add class docs to recently added Application related classes.
 
 	* gio/src/actionmap.hg:
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
index 25b0a63..2942d75 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -121,6 +121,12 @@ Application::Application(const Glib::ustring& application_id, ApplicationFlags f
   
 }
 
+//static
+void Application::unset_default()
+{
+  g_application_set_default(0);
+}
+
 void Application_Class::open_callback(GApplication* self, GFile** files, 
   gint n_files, const gchar *hint)
 {
diff --git a/gio/src/application.hg b/gio/src/application.hg
index 9c231b5..2fa3912 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -159,7 +159,13 @@ public:
   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)
+
+  _WRAP_METHOD(static void set_default(const Glib::RefPtr<Application>& application), g_application_set_default)
+
+  /// Unsets any existing default application.
+  static void unset_default();
+
+  _WRAP_METHOD(static Glib::RefPtr<Application> get_default(), g_application_get_default)
 
   _WRAP_PROPERTY("action-group", Glib::RefPtr<ActionGroup>)
   _WRAP_PROPERTY("application-id", Glib::ustring)
@@ -177,6 +183,7 @@ public:
   //We wrap the open signal without _WRAP_SIGNAL(), because we need to change its parameters.
   //See bug https://bugzilla.gnome.org/show_bug.cgi?id=637457
   Glib::SignalProxy2< void,  const type_vec_files&, const Glib::ustring& > signal_open();
+  _IGNORE_SIGNAL(open)
 
 #m4 _CONVERSION(`GApplicationCommandLine*', `const Glib::RefPtr<ApplicationCommandLine>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(int command_line(const Glib::RefPtr<ApplicationCommandLine>& command_line), "command-line")
@@ -196,16 +203,16 @@ protected:
 #m4 _CONVERSION(`gchar***', `char**&',`*($3)')
   _WRAP_VFUNC(bool local_command_line(char**& arguments, int& exit_status), local_command_line)
   
-/* TODO:
-  void                      (* before_emit)         (GApplication              *application,
-                                                     GVariant                  *platform_data);
-  void                      (* after_emit)          (GApplication              *application,
-                                                     GVariant                  *platform_data);
-  void                      (* add_platform_data)   (GApplication              *application,
-                                                     GVariantBuilder           *builder);
-  void                      (* quit_mainloop)       (GApplication              *application);
-  void                      (* run_mainloop)        (GApplication              *application);
-*/
+#m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3,true)')
+
+  _WRAP_VFUNC(void before_emit(const Glib::VariantBase& platform_data), "before_emit")
+  _WRAP_VFUNC(void after_emit(const Glib::VariantBase& platform_data), "after_emit")
+
+  //TODO: File a bug about GVariantBuilder not being registered with the GType system first
+  //_WRAP_VFUNC(void add_platform_data(Glib::VariantBuilder* builder), "add_platform_data")
+
+  _WRAP_VFUNC(void quit_mainloop(), "quit_mainloop")
+  _WRAP_VFUNC(void run_mainloop(), "run_mainloop")
 
 
 private:
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index ed7d359..6d31ec2 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -161,6 +161,45 @@
   )
 )
 
+(define-vfunc before_emit
+  (of-object "GApplication")
+  (return-type "void")
+  (parameters
+   '("GVariant*" "platform_data")
+  )
+)
+
+(define-vfunc after_emit
+  (of-object "GApplication")
+  (return-type "void")
+  (parameters
+   '("GVariant*" "platform_data")
+  )
+)
+
+(define-vfunc add_platform_data
+  (of-object "GApplication")
+  (return-type "void")
+  (parameters
+   '("GVariantBuilder*" "builder")
+  )
+)
+
+(define-vfunc quit_mainloop
+  (of-object "GApplication")
+  (return-type "void")
+)
+
+(define-vfunc run_mainloop
+  (of-object "GApplication")
+  (return-type "void")
+)
+
+(define-vfunc shutdown
+  (of-object "GApplication")
+  (return-type "void")
+)
+
 ; GAsyncInitable
 
 (define-vfunc init_async
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index ec787ae..35446f1 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -52,7 +52,11 @@ _CONVERSION(`Glib::RefPtr<AppInfo>',`GAppInfo*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`GAppInfo*',`const Glib::RefPtr<AppInfo>&',`Glib::wrap($3)')
 _CONVERSION(`const Glib::ListHandle< Glib::RefPtr<Gio::File> >&',`GList*',`$3.data()')
 
+# Application
 _CONVERSION(`GApplication*',`Glib::RefPtr<Application>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Application>&',`GApplication*',__CONVERT_CONST_REFPTR_TO_P)
+
+# ApplicationCommandLine
 _CONVERSION(`const Glib::RefPtr<ApplicationCommandLine>&',`GApplicationCommandLine*',__CONVERT_CONST_REFPTR_TO_P)
 
 # AsyncResult



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