[gtkmm] Application: Added get_windows() and create() without argc and argv.



commit 4d169c94b68aa8d7988f755b0d9ae931a8eb1ee9
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 30 19:32:44 2010 +0200

    Application: Added get_windows() and create() without argc and argv.
    
    * gtk/src/gtk_methods.defs: Regenerated with h2defs.py.
    * gtk/src/application.[hg|ccg]: Added get_windows.
    Added a create() overload without the argc and argv parameters, because
    they may be NULL.
    * tools/extra_defs_gen/generate_defs_gtk.cc: Added GtkApplication.

 ChangeLog                                 |   10 ++++++
 gtk/src/application.ccg                   |   30 +----------------
 gtk/src/application.hg                    |   20 ++++++++++--
 gtk/src/gtk_methods.defs                  |   50 +++++++++++++++-------------
 tools/extra_defs_gen/generate_defs_gtk.cc |    1 +
 5 files changed, 57 insertions(+), 54 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d0574e2..136a491 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-07-30  Murray Cumming  <murrayc murrayc com>
 
+	Application: Added get_windows() and create() without argc and argv.
+
+	* gtk/src/gtk_methods.defs: Regenerated with h2defs.py.
+	* gtk/src/application.[hg|ccg]: Added get_windows.
+	Added a create() overload without the argc and argv parameters, because 
+	they may be NULL.
+	* tools/extra_defs_gen/generate_defs_gtk.cc: Added GtkApplication.
+
+2010-07-30  Murray Cumming  <murrayc murrayc com>
+
 	Added Gtk::Application.
 
 	* gtk/src/filelist.am:
diff --git a/gtk/src/application.ccg b/gtk/src/application.ccg
index ea88e6a..43b125f 100644
--- a/gtk/src/application.ccg
+++ b/gtk/src/application.ccg
@@ -20,41 +20,15 @@
 
 #include <gtk/gtk.h>
 
-#include <gtkmm/menu.h>
-#include <gtkmm/menuitem.h>
-#include <gtkmm/toolitem.h>
-#include <gtkmm/image.h>
-#include <gtkmm/widget.h>
-
-typedef Gtk::Action Action; 
-
 namespace Gtk
 {
 
-Action::Action(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
-:
-  _CONSTRUCT("name", name.c_str(), "stock_id", stock_id.get_c_str(), "label", (label.empty() ? 0 : label.c_str()),  "tooltip", (tooltip.empty() ? 0 : tooltip.c_str()))
-{}
-
-Action::Action(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
-:
-  _CONSTRUCT("name", name.c_str(), "icon_name", icon_name.c_str(), "label", (label.empty() ? 0 : label.c_str()),  "tooltip", (tooltip.empty() ? 0 : tooltip.c_str()))
-{}
-
-Glib::RefPtr<Action> Action::create(const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
+Glib::RefPtr<Application> Application::create(const Glib::ustring& appid)
 {
-  return Glib::RefPtr<Action>( new Action(name, Gtk::StockID(), label, tooltip) );
+  return Glib::wrap(gtk_application_new(appid.c_str(), 0, 0));
 }
 
-Glib::RefPtr<Action> Action::create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
-{
-  return Glib::RefPtr<Action>( new Action(name, stock_id, label, tooltip) );
-}
 
-Glib::RefPtr<Action> Action::create_with_icon_name(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
-{
-  return Glib::RefPtr<Action>( new Action(name, icon_name, label, tooltip) );
-}
 
 } // namespace Gtk
 
diff --git a/gtk/src/application.hg b/gtk/src/application.hg
index 5df0dfd..7846410 100644
--- a/gtk/src/application.hg
+++ b/gtk/src/application.hg
@@ -19,6 +19,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 
 #include <giomm/application.h>
 #include <gtkmm/window.h>
+#include <gtkmm/actiongroup.h>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(giomm/private/application_p.h)
@@ -29,23 +30,36 @@ namespace Gtk
 /** TODO
  */
 class Application
-  : public Gio::Application,
+  : public Gio::Application
 {
 protected:
   _CLASS_GOBJECT(Application, GtkApplication, GTK_APPLICATION, Gio::Application, GApplication)
-  _IMPLEMENTS_INTERFACE(Buildable)
 
 public:
-  //TODO: _WRAP_METHOD(static Glib::RefPtr<Application> create(int& argc, gchar**& argv, const Glib::ustring& appid), gtk_application_new)
+
+#m4 _CONVERSION(`int& ',`gint**',`&($3)')
+#m4 _CONVERSION(`char**&',`gchar***',`&($3)')
+  _WRAP_METHOD(static Glib::RefPtr<Application> create(const Glib::ustring& appid, int& argc, char**& argv), gtk_application_new)
+  
+  //TODO: Documentation
+  static Glib::RefPtr<Application> create(const Glib::ustring& appid);
   
   _WRAP_METHOD(void set_action_group(const Glib::RefPtr<ActionGroup>& group), gtk_application_set_action_group)
   
   _WRAP_METHOD(Window* get_window(), gtk_application_get_window)
   _WRAP_METHOD(const Window* get_window() const, gtk_application_get_window)
+  
+#m4 _CONVERSION(`const GSList*',`Glib::SListHandle<Window*>',`$2(const_cast<GSList*>($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(Glib::SListHandle<Window*> get_windows(), gtk_application_get_windows)
+  
+#m4 _CONVERSION(`const GSList*',`Glib::SListHandle<const Window*>',`$2(const_cast<GSList*>($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(Glib::SListHandle<const Window*> get_windows() const, gtk_application_get_windows)
     
   _WRAP_METHOD(void add_window(Window& window), gtk_application_add_window)
   _WRAP_METHOD(void run(), gtk_application_run)
   _WRAP_METHOD(void quit(), gtk_application_quit)
+  
+  _WRAP_PROPERTY("window", Gtk::Window*);
 };
 
 } // namespace Gtk
diff --git a/gtk/src/gtk_methods.defs b/gtk/src/gtk_methods.defs
index 715202a..de33320 100644
--- a/gtk/src/gtk_methods.defs
+++ b/gtk/src/gtk_methods.defs
@@ -4025,6 +4025,12 @@
   (return-type "GtkWindow*")
 )
 
+(define-method get_windows
+  (of-object "GtkApplication")
+  (c-name "gtk_application_get_windows")
+  (return-type "const-GSList*")
+)
+
 (define-method add_window
   (of-object "GtkApplication")
   (c-name "gtk_application_add_window")
@@ -9725,14 +9731,6 @@
 
 ;; From gtkhandlebox.h
 
-(define-function int
-  (c-name "int")
-  (return-type "signed")
-  (parameters
-    '("snap_edge-:" "3")
-  )
-)
-
 (define-function gtk_handle_box_get_type
   (c-name "gtk_handle_box_get_type")
   (return-type "GType")
@@ -16758,6 +16756,21 @@
   (return-type "gboolean")
 )
 
+(define-method set_limit
+  (of-object "GtkRecentChooser")
+  (c-name "gtk_recent_chooser_set_limit")
+  (return-type "none")
+  (parameters
+    '("gint" "limit")
+  )
+)
+
+(define-method get_limit
+  (of-object "GtkRecentChooser")
+  (c-name "gtk_recent_chooser_get_limit")
+  (return-type "gint")
+)
+
 (define-method set_local_only
   (of-object "GtkRecentChooser")
   (c-name "gtk_recent_chooser_set_local_only")
@@ -17189,21 +17202,6 @@
   )
 )
 
-(define-method set_limit
-  (of-object "GtkRecentManager")
-  (c-name "gtk_recent_manager_set_limit")
-  (return-type "none")
-  (parameters
-    '("gint" "limit")
-  )
-)
-
-(define-method get_limit
-  (of-object "GtkRecentManager")
-  (c-name "gtk_recent_manager_get_limit")
-  (return-type "gint")
-)
-
 (define-method get_items
   (of-object "GtkRecentManager")
   (c-name "gtk_recent_manager_get_items")
@@ -28618,6 +28616,12 @@
   (return-type "GType")
 )
 
+(define-function gtk_requisition_new
+  (c-name "gtk_requisition_new")
+  (is-constructor-of "GtkRequisition")
+  (return-type "GtkRequisition*")
+)
+
 (define-method copy
   (of-object "GtkRequisition")
   (c-name "gtk_requisition_copy")
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 86948a0..195237b 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -61,6 +61,7 @@ int main(int argc, char** argv)
             << get_defs( GTK_TYPE_ACTIVATABLE )
             << get_defs( GTK_TYPE_ADJUSTMENT )
             << get_defs( GTK_TYPE_ALIGNMENT)
+            << get_defs( GTK_TYPE_APPLICATION )
             << get_defs( GTK_TYPE_ARROW )
             << get_defs( GTK_TYPE_ASPECT_FRAME )
             << get_defs( GTK_TYPE_ASSISTANT )



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