[libvtemm] SlotSelectedCallback API change.



commit e2c29319e3edf421e851585b418618a5f73af269
Author: Krzesimir Nowak <krnowak svn gnome org>
Date:   Tue May 19 16:45:06 2009 +0200

    SlotSelectedCallback API change.
    
    * src/libvtemm/g/terminal.hg: Changed SlotSelectedCallback
    [removed Terminal& parameter]. Added new static methods
    [always_selected, never_selected] for use in SlotSelectedCallback.
    * src/libvtemm/g/terminal.ccg: Changes in
    SignalProxy_selected_gtk_callback due to changes in
    SlotSelectedCallback - got rid of wrapping VteTerminal. Remodeled
    return statements. Defined always_selected and never_selected.
---
 src/libvtemm/g/terminal.ccg |   26 +++++++++++++++++---------
 src/libvtemm/g/terminal.hg  |   21 ++++++++++++++++++++-
 2 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/src/libvtemm/g/terminal.ccg b/src/libvtemm/g/terminal.ccg
index 708ec8b..fa95b5e 100644
--- a/src/libvtemm/g/terminal.ccg
+++ b/src/libvtemm/g/terminal.ccg
@@ -29,30 +29,38 @@ namespace Vte
 namespace Private
 {
 
-gboolean
-SignalProxy_selected_gtk_callback(VteTerminal *terminal, glong column, glong row, gpointer data)
+static gboolean
+SignalProxy_selected_gtk_callback(VteTerminal *terminal, glong column, glong row, gpointer user_data)
 {
-  bool selected = true;
-  Gnome::Vte::Terminal::SlotSelectedCallback* the_slot = static_cast<Gnome::Vte::Terminal::SlotSelectedCallback*>(data);
-  //Gnome::Vte::Terminal temp(terminal);
-  //Gnome::Vte::Terminal temp = *(Glib::wrap(terminal, true));
+  Gnome::Vte::Terminal::SlotSelectedCallback* the_slot = static_cast<Gnome::Vte::Terminal::SlotSelectedCallback*>(user_data);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
 #endif // GLIBMM_EXCEPTIONS_ENABLED
-    // true or false, hm?
-    selected = (*the_slot)(*(Glib::wrap(terminal)), column, row);
+    return static_cast<gboolean>((*the_slot)(column, row));
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   }
   catch (...)
   {
     Glib::exception_handlers_invoke();
   }
+  return TRUE;
 #endif // GLIBMM_EXCEPTIONS_ENABLED
-  return static_cast<int>(selected);
 }
 } // namespace Private
 
+bool
+Terminal::always_selected(long, long)
+{
+  return true;
+}
+
+bool
+Terminal::never_selected(long, long)
+{
+  return false;
+}
+
 TextAndCharAttrs
 Terminal::get_text(const Gnome::Vte::Terminal::SlotSelectedCallback& slot) const
 {
diff --git a/src/libvtemm/g/terminal.hg b/src/libvtemm/g/terminal.hg
index e0fe689..d4a32af 100644
--- a/src/libvtemm/g/terminal.hg
+++ b/src/libvtemm/g/terminal.hg
@@ -142,13 +142,32 @@ public:
 
   _WRAP_METHOD(void reset(bool full, bool clear_history), vte_terminal_reset)
 
-  typedef sigc::slot<bool, Terminal& /* terminal */, long /* column */, long /* row */> SlotSelectedCallback;
+  /** For instance,
+   * bool on_selected(long column, long row);
+   *
+   * @see get_text(), get_text_include_trailing_spaces(), get_text_range().
+   */
+  typedef sigc::slot<bool, long /* column */, long /* row */> SlotSelectedCallback;
+  
+  /** Convenience callback, which always returns %true.
+   *
+   * @see get_text(), get_text_include_trailing_spaces(), get_text_range().
+   */
+  static bool always_selected(long, long);
+  
+  /** Convenience callback, which always returns %false.
+   *
+   * @see get_text(), get_text_include_trailing_spaces(), get_text_range().
+   */
+  static bool never_selected(long, long);
+  
   _WRAP_METHOD_DOCS_ONLY(vte_terminal_get_text)
   TextAndCharAttrs get_text(const SlotSelectedCallback& slot) const;
   _WRAP_METHOD_DOCS_ONLY(vte_terminal_get_text_include_trailing_spaces)
   TextAndCharAttrs get_text_include_trailing_spaces(const SlotSelectedCallback& slot) const;
   _WRAP_METHOD_DOCS_ONLY(vte_terminal_get_text_range)
   TextAndCharAttrs get_text_range(long start_row, long start_col, long end_row, long end_col, const SlotSelectedCallback& slot) const;
+  
   _WRAP_METHOD_DOCS_ONLY(vte_terminal_get_cursor_position)
   CursorPosition get_cursor_position() const;
 



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