[libvtemm] Methods now use reference to Gtk::Adjustment, instead of pointer.



commit c4a7219c0f6a13e229aaabaa0e31d07e14f00c7c
Author: Krzesimir Nowak <krnowak svn gnome org>
Date:   Fri May 15 13:06:58 2009 +0200

    Methods now use reference to Gtk::Adjustment, instead of pointer.
    
    * NEWS: mentioned about newly changed API.
    * examples/simple/simple.cc: Some formatting changes. Adapted to
    new API (in initializer list).
    * examples/simple/simple.h: Member widgets are now private, not
    protected.
    * src/libvtemm/g/terminal.hg: get_adjustment now returns
    a reference to Gtk::Adjustment, instead of pointer.
    'set-scroll-adjustment' takes references, instead of pointers.
    * tools/m4/convert_libvtemm.m4: Changed conversion from pointer
    to reference.
---
 NEWS                         |    5 +++--
 examples/simple/simple.cc    |   13 +++++++------
 examples/simple/simple.h     |    3 +--
 src/libvtemm/g/terminal.hg   |    6 +++---
 tools/m4/convert_libvtemm.m4 |    2 +-
 5 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index a6474cf..efe5e9a 100644
--- a/NEWS
+++ b/NEWS
@@ -16,8 +16,9 @@
 
 * This release is API/ABI _incompatible_ with previous releases.
 (deprecated methods and reaper were removed, beep signal have a default
-signal handler, 'commit' signal, get_cursor_position and get_padding
-have changed prototypes.)
+signal handler, 'commit' signal, 'set-scroll-adjustments' signal,
+get_cursor_position and get_padding have changed prototypes, get_adjustment now
+returns a reference instead of pointer.)
 * API is bumped to version 1.1.
 * libvtemm-1.1 is can be installed in parallel with version 1.0.
 * Dependencies: vte >= 0.20, gtkmm-2.4 >= 2.14, glibmm-2.4 >= 2.18.
diff --git a/examples/simple/simple.cc b/examples/simple/simple.cc
index 6975b63..d6ba6ab 100644
--- a/examples/simple/simple.cc
+++ b/examples/simple/simple.cc
@@ -27,14 +27,14 @@
 
 #include "simple.h"
 
-static
-std::string get_shell();
+static std::string
+get_shell();
 
 Simple::Simple()
 :
   m_box(),
   m_terminal(),
-  m_scrollbar(*(m_terminal.get_adjustment()))
+  m_scrollbar(m_terminal.get_adjustment())
 {
   // first put everything into their proper places, then set them up.
   // add terminal to box.
@@ -77,15 +77,16 @@ Simple::Simple()
 Simple::~Simple()
 {}
 
-void Simple::on_child_exited()
+void
+Simple::on_child_exited()
 {
   hide();
 }
 
 // static
 
-static
-std::string get_shell()
+static std::string
+get_shell()
 {
   uid_t uid(getuid());
   passwd* pwd(getpwuid(uid));
diff --git a/examples/simple/simple.h b/examples/simple/simple.h
index 9248e53..a022265 100644
--- a/examples/simple/simple.h
+++ b/examples/simple/simple.h
@@ -29,11 +29,10 @@ class Simple : public Gtk::Window
 public:
   Simple();
   virtual ~Simple();
-
 protected:
   //Signal handlers:
   virtual void on_child_exited();
-
+private:
   //Member widgets:
   Gtk::HBox m_box;
   Gnome::Vte::Terminal m_terminal;
diff --git a/src/libvtemm/g/terminal.hg b/src/libvtemm/g/terminal.hg
index b0ecb86..a325319 100644
--- a/src/libvtemm/g/terminal.hg
+++ b/src/libvtemm/g/terminal.hg
@@ -181,8 +181,8 @@ public:
   _WRAP_METHOD(void set_pty(int pty_master), vte_terminal_set_pty)
   _WRAP_METHOD(int get_pty() const, vte_terminal_get_pty)
 
-  _WRAP_METHOD(Gtk::Adjustment* get_adjustment(), vte_terminal_get_adjustment)
-  _WRAP_METHOD(Gtk::Adjustment const* get_adjustment() const, vte_terminal_get_adjustment, constversion)
+  _WRAP_METHOD(Gtk::Adjustment& get_adjustment(), vte_terminal_get_adjustment)
+  _WRAP_METHOD(const Gtk::Adjustment& get_adjustment() const, vte_terminal_get_adjustment, constversion)
   _WRAP_METHOD(long get_char_width() const, vte_terminal_get_char_width)
   _WRAP_METHOD(long get_char_height() const, vte_terminal_get_char_height)
 //  _WRAP_METHOD(long get_char_descent() const, vte_terminal_get_char_descent, deprecated)
@@ -255,7 +255,7 @@ dnl // C prototype: void commit(gchar* text, guint size)
   _WRAP_SIGNAL(void text_scrolled(int delta), "text-scrolled")
   _WRAP_SIGNAL(void copy_clipboard(), "copy-clipboard")
   _WRAP_SIGNAL(void paste_clipboard(), "paste-clipboard")
-  _WRAP_SIGNAL(void set_scroll_adjustments(Gtk::Adjustment* hadjustment, Gtk::Adjustment* vadjustment), "set-scroll-adjustments", no_default_handler)
+  _WRAP_SIGNAL(void set_scroll_adjustments(Gtk::Adjustment& hadjustment, Gtk::Adjustment& vadjustment), "set-scroll-adjustments", no_default_handler)
   _WRAP_SIGNAL(void beep(), "beep")
   
   _WRAP_PROPERTY("allow-bold", bool)
diff --git a/tools/m4/convert_libvtemm.m4 b/tools/m4/convert_libvtemm.m4
index 821fa81..bb6c6e2 100644
--- a/tools/m4/convert_libvtemm.m4
+++ b/tools/m4/convert_libvtemm.m4
@@ -18,7 +18,7 @@ _CONVERSION(`Gtk::MenuShell&', `GtkMenuShell*',`($3).gobj()')
 _CONVERSION(`long&',`glong*',`&($3)')
 _CONVERSION(`Gdk::Cursor&',`GdkCursor*',`($3).gobj_copy()')
 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
-_CONVERSION(`GtkAdjustment*',`Gtk::Adjustment*',`Glib::wrap($3)')
+_CONVERSION(`GtkAdjustment*',`Gtk::Adjustment&',`*(Glib::wrap($3))')
 _CONVERSION(`const Terminal&',`VteTerminal*', __FR2P)
 _CONVERSION(`const std::string&', `const char*', `($3).c_str()')
 _CONVERSION(`const StdStringArrayHandle&', `char**', `const_cast<char**>(($3).data())')



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