[glom/glom-1-20] App_WithDoc_Gtk: Improve simple clipboard handlers.



commit 53a034c79989a400f3c031dd1f4664b72db194a4
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Dec 29 22:14:17 2011 +0100

    App_WithDoc_Gtk: Improve simple clipboard handlers.
    
    * glom/bakery/app_withdoc_gtk.cc: Do not use C code. And therefore do
    not use Glib::wrap() strangely.

 ChangeLog                      |    7 +++++++
 glom/bakery/app_withdoc_gtk.cc |   12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 214613c..b0fc63e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-29  Murray Cumming  <murrayc murrayc com>
+
+	App_WithDoc_Gtk: Improve simple clipboard handlers.
+
+	* glom/bakery/app_withdoc_gtk.cc: Do not use C code. And therefore do
+	not use Glib::wrap() strangely.
+
 2011-12-27  David King  <davidk openismus com>
 
 	Add simple clipboard handlers to App_WithDoc_Gtk
diff --git a/glom/bakery/app_withdoc_gtk.cc b/glom/bakery/app_withdoc_gtk.cc
index 1e3f14d..d161836 100644
--- a/glom/bakery/app_withdoc_gtk.cc
+++ b/glom/bakery/app_withdoc_gtk.cc
@@ -573,8 +573,8 @@ void App_WithDoc_Gtk::document_history_remove(const Glib::ustring& file_uri)
 
 void App_WithDoc_Gtk::on_menu_edit_copy_activate()
 {
-  GtkEditable* editable_gobj = (GtkEditable *)this->get_focus()->gobj();
-  Glib::RefPtr<Gtk::Editable> editable = Glib::RefPtr<Gtk::Editable>::cast_dynamic(Glib::wrap(editable_gobj, true));
+  Gtk::Widget* widget = get_focus();
+  Gtk::Editable* editable = dynamic_cast<Gtk::Editable*>(widget);
 
   if(editable)
     editable->copy_clipboard();
@@ -582,8 +582,8 @@ void App_WithDoc_Gtk::on_menu_edit_copy_activate()
 
 void App_WithDoc_Gtk::on_menu_edit_cut_activate()
 {
-  GtkEditable* editable_gobj = (GtkEditable *)this->get_focus()->gobj();
-  Glib::RefPtr<Gtk::Editable> editable = Glib::RefPtr<Gtk::Editable>::cast_dynamic(Glib::wrap(editable_gobj, true));
+  Gtk::Widget* widget = get_focus();
+  Gtk::Editable* editable = dynamic_cast<Gtk::Editable*>(widget);
 
   if(editable)
     editable->cut_clipboard();
@@ -591,8 +591,8 @@ void App_WithDoc_Gtk::on_menu_edit_cut_activate()
 
 void App_WithDoc_Gtk::on_menu_edit_paste_activate()
 {
-  GtkEditable* editable_gobj = (GtkEditable *)this->get_focus()->gobj();
-  Glib::RefPtr<Gtk::Editable> editable = Glib::RefPtr<Gtk::Editable>::cast_dynamic(Glib::wrap(editable_gobj, true));
+  Gtk::Widget* widget = get_focus();
+  Gtk::Editable* editable = dynamic_cast<Gtk::Editable*>(widget);
 
   if(editable)
     editable->paste_clipboard();



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