void HIGMessageDialog::add_button(const Gtk::BuiltinStockID& stock_id, Gtk::ResponseType resp, bool is_default) { Gtk::Button *button = manage(new Gtk::Button (stock_id)); button->property_can_default().set_value(true); add_button(button, resp, is_default); }
void BugzillaPreferences::remove_clicked() { // Remove the icon file and call UpdateIconStore (). Gtk::TreeIter iter; iter = icon_tree->get_selection()->get_selected(); if (!iter) { return; } std::string icon_path = (*iter)[m_columns.file_path]; gnote::utils::HIGMessageDialog dialog(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, _("Really remove this icon?"), _("If you remove an icon it is permanently lost.")); Gtk::Button *button; button = manage(new Gtk::Button (Gtk::Stock::CANCEL)); button->property_can_default() = true; button->show (); dialog.add_action_widget (*button, Gtk::RESPONSE_CANCEL); dialog.set_default_response(Gtk::RESPONSE_CANCEL); button = manage(new Gtk::Button (Gtk::Stock::DELETE)); button->property_can_default() = true; button->show (); dialog.add_action_widget (*button, 666); int result = dialog.run (); if (result == 666) { try { sharp::file_delete (icon_path); update_icon_store (); } catch (const sharp::Exception & e) { ERR_OUT("Error removing icon %s: %s", icon_path.c_str(), e.what()); } } }
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); }