Beispiel #1
0
 void HIGMessageDialog::add_button (const Glib::RefPtr<Gdk::Pixbuf> & pixbuf, 
                                    const Glib::ustring & label_text, 
                                    Gtk::ResponseType resp, bool is_default)
 {
   Gtk::Button *button = manage(new Gtk::Button());
   Gtk::Image *image = manage(new Gtk::Image(pixbuf));
   // NOTE: This property is new to GTK+ 2.10, but we don't
   //       really need the line because we're just setting
   //       it to the default value anyway.
   //button.ImagePosition = Gtk::PositionType.Left;
   button->set_image(*image);
   button->set_label(label_text);
   button->set_use_underline(true);
   button->property_can_default().set_value(true);
   
   add_button (button, resp, is_default);
 }
void PreferencesWindow::setup_button(const Glib::ustring &widget,
				     const Glib::ustring &key)
{
  Glib::RefPtr<Gnome::Conf::Client> &client
    = MainWindow::instance().gconf_client;
  Glib::ustring dir = MainWindow::instance().gconf_dir;

  Gtk::Button *button;
  
  ui->get_widget(widget, button);
  button->set_use_underline(false);
  button->set_label(client->get_string(dir + key));
  button->signal_clicked()
    .connect(sigc::bind(sigc::mem_fun(*this,
				   &PreferencesWindow::on_button_pressed),
			button, key));
  client->notify_add(dir + key,
		     sigc::bind(sigc::mem_fun(*this, &PreferencesWindow
					   ::button_listener),
				button));
}