[gtkmm] Fix the build with latest GTK+.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Fix the build with latest GTK+.
- Date: Sun, 17 Oct 2010 21:00:25 +0000 (UTC)
commit 01153318404f23f7f3a89265b4508d73f658e115
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Oct 17 23:00:09 2010 +0200
Fix the build with latest GTK+.
* gtk/gtkmm/comboboxtext.cc: Comment out (wrong anyway) use of
deprecated gtk_combo_box_insert_text().
* gtk/src/combobox.[hg|ccg]: get_entry_text(): Reimplement without using
the deprecated gtk_combo_box_get_active_text().
* gtk/src/main.[hg|ccg]: Remove signal_run() and signal_quit() because they
used the deprecated gtk_init_add(), gtk_quit_add_full() and g
gtk_quit_remove() functions.
ChangeLog | 12 ++++++
gtk/gtkmm/comboboxtext.cc | 4 +-
gtk/src/combobox.ccg | 9 +++++
gtk/src/combobox.hg | 7 ++--
gtk/src/main.ccg | 87 ---------------------------------------------
gtk/src/main.hg | 49 -------------------------
6 files changed, 26 insertions(+), 142 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ca1e4f6..441e203 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-17 Murray Cumming <murrayc murrayc com>
+
+ Fix the build with latest GTK+.
+
+ * gtk/gtkmm/comboboxtext.cc: Comment out (wrong anyway) use of
+ deprecated gtk_combo_box_insert_text().
+ * gtk/src/combobox.[hg|ccg]: get_entry_text(): Reimplement without using
+ the deprecated gtk_combo_box_get_active_text().
+ * gtk/src/main.[hg|ccg]: Remove signal_run() and signal_quit() because they
+ used the deprecated gtk_init_add(), gtk_quit_add_full() and g
+ gtk_quit_remove() functions.
+
2010-10-15 Murray Cumming <murrayc murrayc com>
Depend on latest glibmm version.
diff --git a/gtk/gtkmm/comboboxtext.cc b/gtk/gtkmm/comboboxtext.cc
index ba5d58b..c8859c2 100644
--- a/gtk/gtkmm/comboboxtext.cc
+++ b/gtk/gtkmm/comboboxtext.cc
@@ -59,10 +59,10 @@ void ComboBoxText::append_text(const Glib::ustring& text)
}
}
-void ComboBoxText::insert_text(int position, const Glib::ustring& text)
+void ComboBoxText::insert_text(int /* position */, const Glib::ustring& /* text */)
{
//TODO: We should not use gtk_combo_box_insert_text() here, because that can only be used if gtk_combo_box_new_text() has been used.
- gtk_combo_box_insert_text(gobj(), position, text.c_str());
+ //We will reimplement this class anyway as a wrapper of GtkComboBoxText. gtk_combo_box_insert_text(gobj(), position, text.c_str());
}
void ComboBoxText::prepend_text(const Glib::ustring& text)
diff --git a/gtk/src/combobox.ccg b/gtk/src/combobox.ccg
index 64244bf..8ea117b 100644
--- a/gtk/src/combobox.ccg
+++ b/gtk/src/combobox.ccg
@@ -110,5 +110,14 @@ const Entry* ComboBox::get_entry() const
return dynamic_cast<const Gtk::Entry*>(widget);
}
+Glib::ustring ComboBox::get_entry_text() const
+{
+ const Gtk::Entry* entry = get_entry();
+ if(!entry)
+ return Glib::ustring();
+ else
+ return entry->get_text();
+}
+
} // namespace Gtk
diff --git a/gtk/src/combobox.hg b/gtk/src/combobox.hg
index 1518bc8..d3616f0 100644
--- a/gtk/src/combobox.hg
+++ b/gtk/src/combobox.hg
@@ -115,9 +115,8 @@ public:
_WRAP_METHOD(void set_active(int index), gtk_combo_box_set_active)
_WRAP_METHOD(void set_active(const TreeModel::iterator& iter), gtk_combo_box_set_active_iter)
- //This can be used with either a text-based model (see ComboBoxText) or one that uses has_entry=true,
- //which is awkward. So we rename it.
- _WRAP_METHOD(Glib::ustring get_entry_text() const, gtk_combo_box_get_active_text)
+ //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=612396#c30
+ Glib::ustring get_entry_text() const;
/** Causes no item to be active. See also set_active().
*/
@@ -167,7 +166,7 @@ public:
_WRAP_METHOD(Glib::RefPtr<Atk::Object> get_popup_accessible(), gtk_combo_box_get_popup_accessible, ifdef GTKMM_ATKMM_ENABLED)
_WRAP_METHOD(Glib::RefPtr<const Atk::Object> get_popup_accessible() const, gtk_combo_box_get_popup_accessible, constversion, ifdef GTKMM_ATKMM_ENABLED)
- _IGNORE(gtk_combo_box_append_text, gtk_combo_box_insert_text, gtk_combo_box_prepend_text, gtk_combo_box_remove_text, gtk_combo_box_get_active_text) //These are in ComboBoxText.
+ _IGNORE(gtk_combo_box_append_text, gtk_combo_box_insert_text, gtk_combo_box_prepend_text, gtk_combo_box_remove_text, gtk_combo_box_get_active_text) //deprecated
/** @see Bin::get_child().
*/
diff --git a/gtk/src/main.ccg b/gtk/src/main.ccg
index a27c6c1..1194955 100644
--- a/gtk/src/main.ccg
+++ b/gtk/src/main.ccg
@@ -206,81 +206,6 @@ void GtkMainConnectionNode::list_notify_all()
namespace Gtk
{
-/**** Gtk::RunSig **********************************************************/
-
-sigc::connection RunSig::connect(const RunSig::SlotType& slot)
-{
- GtkMainConnectionNode *const conn_node = new GtkMainConnectionNode(slot);
- const sigc::connection connection(*conn_node->get_slot());
-
- // The callback will be invoked the next time gtk_main() is called.
- gtk_init_add(&RunSig::gtk_callback, conn_node);
-
- conn_node->install(0, 0, false); // there's no gtk_init_remove()
- return connection;
-}
-
-// static
-gboolean RunSig::gtk_callback(gpointer data)
-{
- GtkMainConnectionNode *const conn_node =
- static_cast<GtkMainConnectionNode*>(data);
-
- if(GtkMainConnectionNode::list_remove(conn_node))
- {
- try
- {
- // Recreate the specific SlotType from the generic slot_base.
- SlotType* pSlot = static_cast<SlotType*>(conn_node->get_slot());
- (*pSlot)();
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
-
- // We don't need it anymore, since RunSig is a one-shot signal.
- GtkMainConnectionNode::destroy_notify_handler(conn_node);
- }
-
- return 0;
-}
-
-
-/**** Gtk::QuitSig *********************************************************/
-
-sigc::connection QuitSig::connect(const QuitSig::SlotType& slot, guint main_level)
-{
- GtkMainConnectionNode *const conn_node = new GtkMainConnectionNode(slot);
- const sigc::connection connection(*conn_node->get_slot());
-
- const guint conn_id = gtk_quit_add_full(
- main_level, &QuitSig::gtk_callback, 0 /* marshaller */,
- conn_node, &GtkMainConnectionNode::destroy_notify_handler);
-
- conn_node->install(conn_id, >k_quit_remove, true);
- return connection;
-}
-
-// static
-gboolean QuitSig::gtk_callback(gpointer data)
-{
- try
- {
- // Call the slot:
- GtkMainConnectionNode* node = static_cast<GtkMainConnectionNode*>(data);
- SlotType* pSlot = static_cast<SlotType*>(node->get_slot());
- (*pSlot)();
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
-
- return 0;
-}
-
-
/**** Gtk::KeySnooperSig ***************************************************/
sigc::connection KeySnooperSig::connect(const KeySnooperSig::SlotType& slot)
@@ -315,8 +240,6 @@ gint KeySnooperSig::gtk_callback(GtkWidget* widget, GdkEventKey* event, gpointer
/**** Gtk::Main -- static data *********************************************/
-RunSig Main::signal_run_;
-QuitSig Main::signal_quit_;
KeySnooperSig Main::signal_key_snooper_;
Main* Main::instance_ = 0;
@@ -487,16 +410,6 @@ bool Main::events_pending()
/**** Gtk::Main -- static signal accessors *********************************/
-RunSig& Main::signal_run()
-{
- return signal_run_;
-}
-
-QuitSig& Main::signal_quit()
-{
- return signal_quit_;
-}
-
KeySnooperSig& Main::signal_key_snooper()
{
return signal_key_snooper_;
diff --git a/gtk/src/main.hg b/gtk/src/main.hg
index 44f12d7..f0c9c0a 100644
--- a/gtk/src/main.hg
+++ b/gtk/src/main.hg
@@ -38,32 +38,6 @@ class Window;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//Actually, I'd like to just keep these out of the alphabetical list. murrayc.
-/// Run Signal Class (internal)
-class RunSig
-{
-public:
- typedef sigc::slot<void> SlotType;
-
- sigc::connection connect(const SlotType& slot);
-
-protected:
- static gboolean gtk_callback(gpointer data);
-};
-
-
-/// Quit Signal Class (internal)
-class QuitSig
-{
-public:
- typedef sigc::slot<bool> SlotType;
-
- sigc::connection connect(const SlotType& slot, guint main_level = 0);
-
-protected:
- static gboolean gtk_callback(gpointer data); //gtk+ calls this, which then calls our slot.
-};
-
-
/// KeySnooper Signal Class (internal)
class KeySnooperSig
{
@@ -209,27 +183,6 @@ public:
*/
static bool events_pending();
- /** Run signal
- * @return void
- */
- static RunSig& signal_run();
-
- /** Quit signal
- * You can connect signal handlers to invoke actions when Gtk::Main::quit()
- * has been called. Note that main loops can be nested by calling
- * Gtk::Main::run() recursively, therefore receiving this signal doesn't
- * necessarily mean the application is about to be terminated. If you want
- * to receive a signal only when the last main loop quits, call connect()
- * with <tt>main_level = 1</tt>.
- * @code
- * bool thisclass::mymethod() { return false; }
- * Gtk::Main::signal_quit().connect(sigc::mem_fun(this, &thisclass::mymethod));
- * @endcode
- * @return bool - @c false means callback is removed, @c true means
- * it'll be called again the next the main loop quits.
- */
- static QuitSig& signal_quit();
-
/** KeySnooper signal
* Allows you to channel keypresses to a signal handler
* without registering with the widget.
@@ -263,8 +216,6 @@ protected:
virtual void on_window_hide();
// Signal proxies:
- static RunSig signal_run_;
- static QuitSig signal_quit_;
static KeySnooperSig signal_key_snooper_;
private:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]