Index: libglade/src/xml.ccg
===================================================================
--- libglade/src/xml.ccg	(revision 2071)
+++ libglade/src/xml.ccg	(working copy)
@@ -18,9 +18,9 @@
  */
 
 #include <glade/glade-xml.h>
-#include <gtkmm/button.h>
-#include <gtkmm/menuitem.h>
-#include <gtkmm/toolbutton.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtktoolbutton.h>
 
 namespace Gnome
 {
@@ -253,6 +253,78 @@
     pToolButton->signal_clicked().connect( slot_ );
 }
 
+void Xml::signal_autoconnect(Slots& slots)
+{
+  GHashTableIter iter;
+  const char *handler_name;
+  GList *signals;
+  GHashTable *sig_hash = glade_xml_get_signal_info(gobj());
+  g_hash_table_iter_init(&iter, sig_hash);
+  while (g_hash_table_iter_next(&iter, (gpointer*)&handler_name,
+	(gpointer*)&signals)) {
+    for (; signals != NULL; signals = signals->next) {
+      GladeSignalData *data = (GladeSignalData *)signals->data;
+      const char *widget_name = glade_get_widget_name(
+    	    GTK_WIDGET(data->signal_object));
+      if (!widget_name)
+        continue;
+
+#define CHECK_CONNECT_WIDGET(gnm, gmmnm) do { \
+    if (GTK_IS_##gnm(data->signal_object)) { \
+      Gtk::gmmnm *widget; \
+      get_widget(widget_name, widget); \
+      g_assert(widget); \
+      slots.connect(widget, data->signal_name, handler_name); \
+    } \
+  } while (0)
+
+      CHECK_CONNECT_WIDGET(BUTTON, Button);
+      CHECK_CONNECT_WIDGET(MENU_ITEM, MenuItem);
+      CHECK_CONNECT_WIDGET(TOOL_BUTTON, ToolButton);
+    }
+  }
+}
+
+  Slots::~Slots(void)
+  {
+    for (std::map<Glib::ustring, sigc::slot_base*>::iterator it =
+	    slot_map.begin(); it != slot_map.end(); it++) {
+	delete it->second;
+    }
+    slot_map.clear();
+  }
+
+#define CONNECT_SIG(widg, sig, sig_name, handler_name) \
+  do { \
+    if (sig_name == STR(sig)) \
+      connect(widg->signal_##sig(), handler_name); \
+  } while (0)
+#define DO_CONNECT(sig) CONNECT_SIG(widget, sig, sig_name, handler_name)
+
+  void Slots::connect(Gtk::Button *widget, const Glib::ustring& sig_name,
+	const Glib::ustring& handler_name)
+  {
+    DO_CONNECT(pressed);
+    DO_CONNECT(released);
+    DO_CONNECT(clicked);
+    DO_CONNECT(enter);
+    DO_CONNECT(leave);
+    DO_CONNECT(activate);
+  }
+  void Slots::connect(Gtk::MenuItem *widget, const Glib::ustring& sig_name,
+	const Glib::ustring& handler_name)
+  {
+    DO_CONNECT(activate);
+    DO_CONNECT(activate_item);
+    DO_CONNECT(toggle_size_request);
+    DO_CONNECT(toggle_size_allocate);
+  }
+  void Slots::connect(Gtk::ToolButton *widget, const Glib::ustring& sig_name,
+	const Glib::ustring& handler_name)
+  {
+    DO_CONNECT(clicked);
+  }
+
 } // namespace Glade
 } // namespace Gnome
 
Index: libglade/src/xml.hg
===================================================================
--- libglade/src/xml.hg	(revision 2071)
+++ libglade/src/xml.hg	(working copy)
@@ -18,6 +18,9 @@
  */
 
 #include <gtkmm/container.h>
+#include <gtkmm/button.h>
+#include <gtkmm/menuitem.h>
+#include <gtkmm/toolbutton.h>
 
 _DEFS(libglademm,libglade)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -44,6 +47,85 @@
 };
 
 
+#define _STR(x) #x
+#define STR(x) _STR(x)
+#define GLADEMM_SLOT(n, s) __register_slot(STR(s), &n::s)
+#define GLADEMM_DECLARE_SLOTS(...) \
+virtual void __init_slots(void) \
+{ \
+    __VA_ARGS__; \
+}
+
+class NoSlotException : public Glib::Exception
+{
+public:
+  NoSlotException(const Glib::ustring& name) { str = name; }
+  virtual ~NoSlotException(void) throw() {}
+  virtual Glib::ustring what() const
+  {
+    return str;
+  }
+
+protected:
+  Glib::ustring str;
+};
+
+class Slots : public Glib::Object
+{
+public:
+
+  virtual ~Slots(void);
+
+  template <class T_class>
+  T_class get_slot(const Glib::ustring name)
+  {
+    if (slot_map.empty())
+	__init_slots();
+    std::map<Glib::ustring, sigc::slot_base*>::iterator it =
+	    slot_map.find(name);
+    if (it == slot_map.end())
+	throw NoSlotException(name);
+    T_class *sl = dynamic_cast<T_class*>(it->second);
+    if (!sl)
+	throw Glib::Error(g_quark_from_static_string("wrong_handler_type"), -1,
+		"Wrong handler type");
+    return *sl;
+  }
+
+  template <class T_sig>
+  void connect(T_sig sig, const Glib::ustring& name)
+  {
+    sig.connect(get_slot<typename T_sig::SlotType>(name));
+  }
+
+  void connect(Gtk::Button *widget, const Glib::ustring& sig_name,
+	const Glib::ustring& handler_name);
+  void connect(Gtk::MenuItem *widget, const Glib::ustring& sig_name,
+	const Glib::ustring& handler_name);
+  void connect(Gtk::ToolButton *widget, const Glib::ustring& sig_name,
+	const Glib::ustring& handler_name);
+
+protected:
+  virtual void __init_slots(void) = 0;
+  template <typename T_ret, class T_class>
+  void __register_slot(const Glib::ustring& name,
+	T_ret(T_class::*handler)(void))
+  {
+    T_class *self = dynamic_cast<T_class*>(this);
+    g_assert(self);
+    slot_map[name] = new sigc::slot<T_ret>(sigc::mem_fun(*self, handler));
+  }
+  template <typename T_ret, class T_class, typename T_arg>
+  void __register_slot(const Glib::ustring& name,
+	T_ret(T_class::*handler)(T_arg))
+  {
+    T_class *self = dynamic_cast<T_class*>(this);
+    g_assert(self);
+    slot_map[name] = new sigc::slot<T_ret, T_arg>(sigc::mem_fun(*self, handler));
+  }
+  std::map<Glib::ustring, sigc::slot_base*> slot_map;
+};
+
 class Xml : public Glib::Object
 {
   _CLASS_GOBJECT(Xml, GladeXML, GLADE_XML, Glib::Object, GObject)
@@ -276,6 +358,7 @@
    */
   void connect_clicked(const Glib::ustring& name, const sigc::slot<void>& slot_);
 
+  void signal_autoconnect(Slots& slots);
 
 ///* interface for changing the custom widget handling */
 //typedef GtkWidget *(* GladeXMLCustomWidgetHandler) (GladeXML *xml,
Index: examples/basic/basic.cc
===================================================================
--- examples/basic/basic.cc	(revision 2071)
+++ examples/basic/basic.cc	(working copy)
@@ -4,14 +4,24 @@
 
 Gtk::Dialog* pDialog = 0;
 
+class MySlots : public Gnome::Glade::Slots
+{
+private:
+GLADEMM_DECLARE_SLOTS(
+  GLADEMM_SLOT(MySlots, on_button_clicked)
+);
+
 void on_button_clicked()
 {
   if(pDialog)
     pDialog->hide(); //hide() will cause main::run() to end.
 }
 
+};
+
 int main (int argc, char **argv)
 {
+  MySlots slots;
   Gtk::Main kit(argc, argv);
 
   //Load the Glade file and instiate its widgets:
@@ -35,20 +45,12 @@
     return 1;
   }
 #endif
+  refXml->signal_autoconnect(slots);
 
   //Get the Glade-instantiated Dialog:
-  
   refXml->get_widget("DialogBasic", pDialog);
   if(pDialog)
   {
-    //Get the Glade-instantiated Button, and connect a signal handler:
-    Gtk::Button* pButton = 0;
-    refXml->get_widget("quit_button", pButton);
-    if(pButton)
-    {
-      pButton->signal_clicked().connect( sigc::ptr_fun(on_button_clicked) );
-    }
-
     kit.run(*pDialog);
   }
 
Index: examples/basic/basic.glade
===================================================================
--- examples/basic/basic.glade	(revision 2071)
+++ examples/basic/basic.glade	(working copy)
@@ -35,6 +35,7 @@
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="response_id">0</property>
+	      <signal name="clicked" handler="on_button_clicked" object="NULL"/>
 	    </widget>
 	  </child>
 	</widget>
