Commit edbedef7 authored by Murray Cumming's avatar Murray Cumming Committed by Murray Cumming
Browse files

Ported to gtkmm 2.4 - mostly just use of libsigc++ 2 syntax, and not using

2004-04-04  Murray Cumming  <murrayc@murrayc.com>

        * Ported to gtkmm 2.4 - mostly just use of libsigc++ 2 syntax, and
        not using the old Toolbar STL-style API.
parent 933c04eb
2004-04-04 Murray Cumming <murrayc@murrayc.com>
* Ported to gtkmm 2.4 - mostly just use of libsigc++ 2 syntax, and
not using the old Toolbar STL-style API.
0.6.0:
2003-12-07 Murray Cumming <murrayc@usa.net>
......
......@@ -6,12 +6,10 @@ regexxer is a nifty search/replace tool for the desktop user. It features
recursive search through directory trees and Perl-style regular expressions
(using libpcre).
regexxer is programmed in C++ and uses gtkmm2 (the C++ wrapper for GTK+ 2.0)
regexxer is programmed in C++ and uses gtkmm (the C++ wrapper for GTK+)
for the GUI. The user interface is similar to the project-wide search/replace
dialog in the Sniff+ IDE, but regexxer aims to surpass it.
The primary audience of this tool are Linux/Unix users who are tired of
typing find/grep/sed/awk/perl command lines. But since GLib is used to
abstract the platform the code should be portable to Windows or any other OS
with relatively low effort.
typing find/grep/sed/awk/perl command lines.
......@@ -34,7 +34,7 @@ AC_CHECK_HEADERS([sys/types.h sys/stat.h])
AC_CHECK_FUNCS([umask])
AC_CHECK_TYPES([mode_t])
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.0 >= 2.2.8 gconfmm-2.0 >= 2.0.0 gnome-vfsmm-2.0 >= 1.3.5])
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.3.7 gconfmm-2.6 >= 2.5.0 gnome-vfsmm-2.6 >= 2.5.0])
AC_SUBST([GTKMM_CFLAGS])
AC_SUBST([GTKMM_LIBS])
......
......@@ -20,7 +20,6 @@
#include "aboutdialog.h"
#include <glib.h>
#include <atkmm.h>
#include <gtkmm/alignment.h>
#include <gtkmm/box.h>
......
......@@ -26,6 +26,7 @@
#include <gtkmm/menubar.h>
#include <gtkmm/stock.h>
#include <gtkmm/toolbar.h>
#include <gtkmm/separatortoolitem.h>
#include <memory>
#include <config.h>
......@@ -42,7 +43,7 @@ void add_menu_stock(Gtk::MenuBar::MenuList& items, const Gtk::StockID& stock_id,
}
void add_menu_stock(Gtk::MenuBar::MenuList& items, const Gtk::StockID& stock_id,
const Gtk::Menu::AccelKey& accel_key, Regexxer::ControlItem& control)
const Gtk::AccelKey& accel_key, Regexxer::ControlItem& control)
{
items.push_back(Gtk::Menu_Helpers::StockMenuElem(stock_id, accel_key, control.slot()));
control.add_widget(items.back());
......@@ -57,7 +58,7 @@ void add_menu_image(Gtk::MenuBar::MenuList& items, const Gtk::StockID& stock_id,
}
void add_menu_image(Gtk::MenuBar::MenuList& items, const Gtk::StockID& stock_id,
const Glib::ustring& label, const Gtk::Menu::AccelKey& accel_key,
const Glib::ustring& label, const Gtk::AccelKey& accel_key,
Regexxer::ControlItem& control)
{
items.push_back(Gtk::Menu_Helpers::ImageMenuElem(
......@@ -65,11 +66,13 @@ void add_menu_image(Gtk::MenuBar::MenuList& items, const Gtk::StockID& stock_id,
control.add_widget(items.back());
}
void add_tool_stock(Gtk::Toolbar::ToolList& tools, const Gtk::StockID& stock_id,
void add_tool_stock(Gtk::Toolbar& toolbar, const Gtk::StockID& stock_id,
Regexxer::ControlItem& control)
{
tools.push_back(Gtk::Toolbar_Helpers::StockElem(stock_id, control.slot()));
control.add_widget(*tools.back().get_widget());
Gtk::ToolButton* item = Gtk::manage(new Gtk::ToolButton(stock_id));
toolbar.append(*item, control.slot());
control.add_widget(*item);
}
void add_widget_button(Regexxer::ControlItem& control, Gtk::Button& button)
......@@ -101,19 +104,19 @@ void ControlItem::activate()
signal_activate_(); // emit
}
SigC::Slot0<void> ControlItem::slot()
sigc::slot<void> ControlItem::slot()
{
return SigC::slot(*this, &ControlItem::activate);
return sigc::mem_fun(*this, &ControlItem::activate);
}
void ControlItem::connect(const SigC::Slot0<void>& slot_activated)
void ControlItem::connect(const sigc::slot<void>& slot_activated)
{
signal_activate_.connect(slot_activated);
}
void ControlItem::add_widget(Gtk::Widget& widget)
{
signal_set_sensitive_.connect(SigC::slot(widget, &Gtk::Widget::set_sensitive));
signal_set_sensitive_.connect(sigc::mem_fun(widget, &Gtk::Widget::set_sensitive));
widget.set_sensitive(enabled_ && group_enabled_);
}
......@@ -157,7 +160,7 @@ ControlGroup::~ControlGroup()
void ControlGroup::add(ControlItem& control)
{
signal_set_enabled_.connect(SigC::slot(control, &ControlItem::set_group_enabled));
signal_set_enabled_.connect(sigc::mem_fun(control, &ControlItem::set_group_enabled));
control.set_group_enabled(enabled_);
}
......@@ -273,24 +276,21 @@ Gtk::MenuBar* Controller::create_menubar()
Gtk::Toolbar* Controller::create_toolbar()
{
using namespace Gtk;
using namespace Gtk::Toolbar_Helpers;
std::auto_ptr<Toolbar> toolbar (new Toolbar());
ToolList& tools = toolbar->tools();
Toolbar* toolbar = new Toolbar();
add_tool_stock(*toolbar, Stock::SAVE, save_file);
add_tool_stock(*toolbar, StockID("regexxer-save-all"), save_all);
toolbar->append( *(Gtk::manage(new SeparatorToolItem())) );
add_tool_stock(*toolbar, Stock::UNDO, undo);
add_tool_stock(tools, Stock::SAVE, save_file);
add_tool_stock(tools, StockID("regexxer-save-all"), save_all);
toolbar->append( *(Gtk::manage(new SeparatorToolItem())) );
add_tool_stock(*toolbar, Stock::PREFERENCES, preferences);
tools.push_back(Space());
add_tool_stock(tools, Stock::UNDO, undo);
toolbar->append( *(Gtk::manage(new SeparatorToolItem())) );
add_tool_stock(*toolbar, Stock::QUIT, quit);
tools.push_back(Space());
add_tool_stock(tools, Stock::PREFERENCES, preferences);
tools.push_back(Space());
add_tool_stock(tools, Stock::QUIT, quit);
return toolbar.release();
return toolbar;
}
Gtk::Widget* Controller::create_action_area()
......
......@@ -35,16 +35,16 @@ class Widget;
namespace Regexxer
{
class ControlItem : public SigC::Object
class ControlItem : public sigc::trackable
{
public:
explicit ControlItem(bool enable = false);
virtual ~ControlItem();
void activate();
SigC::Slot0<void> slot();
sigc::slot<void> slot();
void connect(const SigC::Slot0<void>& slot_activated);
void connect(const sigc::slot<void>& slot_activated);
void add_widget(Gtk::Widget& widget);
......@@ -53,8 +53,8 @@ public:
bool is_enabled() const;
private:
SigC::Signal0<void> signal_activate_;
SigC::Signal1<void,bool> signal_set_sensitive_;
sigc::signal<void> signal_activate_;
sigc::signal<void,bool> signal_set_sensitive_;
bool enabled_;
bool group_enabled_;
......
......@@ -743,8 +743,9 @@ void FileBuffer::remove_match_at_iter(const FileBuffer::iterator& start)
{
if(!start.get_marks().empty())
{
FileBuffer::iterator iter_copy = start;
typedef std::list< Glib::RefPtr<Mark> > MarkList;
const MarkList marks (start.get_marks());
const MarkList marks (iter_copy.get_marks());
for(MarkList::const_iterator pmark = marks.begin(); pmark != marks.end(); ++pmark)
{
......@@ -844,8 +845,9 @@ void FileBuffer::apply_tag_current()
// static
bool FileBuffer::is_match_start(const iterator& where)
{
iterator iter_copy = where;
typedef std::list< Glib::RefPtr<Mark> > MarkList;
const MarkList marks (where.get_marks());
const MarkList marks (iter_copy.get_marks());
return (std::find_if(marks.begin(), marks.end(), &MatchData::is_match_mark) != marks.end());
}
......
......@@ -72,11 +72,11 @@ public:
void decrement_stamp();
void undo_remove_match(const MatchDataPtr& match, int offset);
SigC::Signal1<void,int> signal_match_count_changed;
SigC::Signal1<void,BoundState> signal_bound_state_changed;
sigc::signal<void, int> signal_match_count_changed;
sigc::signal<void, BoundState> signal_bound_state_changed;
Util::QueuedSignal signal_preview_line_changed;
SigC::Signal0<bool> signal_pulse;
SigC::Signal1<void,UndoActionPtr> signal_undo_stack_push;
sigc::signal<bool> signal_pulse;
sigc::signal<void, UndoActionPtr> signal_undo_stack_push;
protected:
FileBuffer();
......
......@@ -55,7 +55,7 @@ FileTree::FileTree()
treestore_->set_sort_column_id(TreeStore::DEFAULT_SORT_COLUMN_ID, SORT_ASCENDING);
treestore_->signal_sort_column_changed().connect(
SigC::slot(*this, &FileTree::on_treestore_sort_column_changed));
sigc::mem_fun(*this, &FileTree::on_treestore_sort_column_changed));
{
Column *const column = new Column("File");
......@@ -68,8 +68,8 @@ FileTree::FileTree()
column->pack_start(*manage(cell_filename));
column->add_attribute(cell_filename->property_text(), model_columns.filename);
column->set_cell_data_func(*cell_icon, SigC::slot(*this, &FileTree::icon_cell_data_func));
column->set_cell_data_func(*cell_filename, SigC::slot(*this, &FileTree::text_cell_data_func));
column->set_cell_data_func(*cell_icon, sigc::mem_fun(*this, &FileTree::icon_cell_data_func));
column->set_cell_data_func(*cell_filename, sigc::mem_fun(*this, &FileTree::text_cell_data_func));
column->set_resizable(true);
......@@ -84,7 +84,7 @@ FileTree::FileTree()
column->pack_start(*manage(cell_matchcount));
column->add_attribute(cell_matchcount->property_text(), model_columns.matchcount);
column->set_cell_data_func(*cell_matchcount, SigC::slot(*this, &FileTree::text_cell_data_func));
column->set_cell_data_func(*cell_matchcount, sigc::mem_fun(*this, &FileTree::text_cell_data_func));
column->set_alignment(1.0);
cell_matchcount->property_xalign() = 1.0;
......@@ -97,7 +97,7 @@ FileTree::FileTree()
const Glib::RefPtr<Gtk::TreeSelection> selection = get_selection();
selection->set_select_function(&FileTree::select_func);
selection->signal_changed().connect(SigC::slot(*this, &FileTree::on_selection_changed));
selection->signal_changed().connect(sigc::mem_fun(*this, &FileTree::on_selection_changed));
}
FileTree::~FileTree()
......@@ -166,7 +166,7 @@ void FileTree::save_all_files()
{
Util::ScopedBlock block (conn_modified_changed_);
treestore_->foreach(SigC::bind(SigC::slot(*this, &FileTree::save_file_at_iter), &error_list));
treestore_->foreach_iter(sigc::bind(sigc::mem_fun(*this, &FileTree::save_file_at_iter), &error_list));
}
if(error_list)
......@@ -228,7 +228,7 @@ void FileTree::find_matches(Pcre::Pattern& pattern, bool multiple)
ScopedBlockSorting block_sort (*this);
FindMatchesData find_data (pattern, multiple);
treestore_->foreach(SigC::bind(SigC::slot(*this, &FileTree::find_matches_at_iter), &find_data));
treestore_->foreach_iter(sigc::bind(sigc::mem_fun(*this, &FileTree::find_matches_at_iter), &find_data));
}
signal_bound_state_changed(); // emit
......@@ -249,8 +249,8 @@ void FileTree::replace_all_matches(const Glib::ustring& substitution)
ScopedBlockSorting block_sort (*this);
ReplaceMatchesData replace_data (*this, substitution);
treestore_->foreach(SigC::bind(
SigC::slot(*this, &FileTree::replace_matches_at_iter),
treestore_->foreach_iter(sigc::bind(
sigc::mem_fun(*this, &FileTree::replace_matches_at_iter),
&replace_data));
signal_undo_stack_push(replace_data.undo_stack); // emit
......@@ -574,7 +574,7 @@ bool FileTree::find_matches_at_iter(const Gtk::TreeModel::iterator& iter, FindMa
const Glib::RefPtr<FileBuffer> buffer = fileinfo->buffer;
g_assert(buffer);
Util::ScopedConnection conn (buffer->signal_pulse.connect(signal_pulse.slot()));
Util::ScopedConnection conn(buffer->signal_pulse.connect( sigc::mem_fun(*this, &FileTree::on_buffer_pulse) ));
const int old_match_count = buffer->get_match_count();
const int new_match_count = buffer->find_matches(find_data->pattern, find_data->multiple);
......@@ -602,6 +602,11 @@ bool FileTree::find_matches_at_iter(const Gtk::TreeModel::iterator& iter, FindMa
return false;
}
bool FileTree::on_buffer_pulse()
{
return signal_pulse.emit();
}
bool FileTree::replace_matches_at_iter(const Gtk::TreeModel::iterator& iter,
ReplaceMatchesData* replace_data)
{
......@@ -633,7 +638,7 @@ bool FileTree::replace_matches_at_iter(const Gtk::TreeModel::iterator& iter,
Util::ScopedConnection conn1 (buffer->signal_undo_stack_push.
connect(replace_data->slot_undo_stack_push));
Util::ScopedConnection conn2 (buffer->signal_pulse.connect(signal_pulse.slot()));
Util::ScopedConnection conn2( buffer->signal_pulse.connect( sigc::mem_fun(*this, &FileTree::on_buffer_pulse) ));
buffer->replace_all_matches(replace_data->substitution);
}
......@@ -812,13 +817,13 @@ void FileTree::on_selection_changed()
if(!fileinfo->load_failed)
{
conn_match_count_ = fileinfo->buffer->signal_match_count_changed.
connect(SigC::slot(*this, &FileTree::on_buffer_match_count_changed));
connect(sigc::mem_fun(*this, &FileTree::on_buffer_match_count_changed));
conn_modified_changed_ = fileinfo->buffer->signal_modified_changed().
connect(SigC::slot(*this, &FileTree::on_buffer_modified_changed));
connect(sigc::mem_fun(*this, &FileTree::on_buffer_modified_changed));
conn_undo_stack_push_ = fileinfo->buffer->signal_undo_stack_push.
connect(SigC::slot(*this, &FileTree::on_buffer_undo_stack_push));
connect(sigc::mem_fun(*this, &FileTree::on_buffer_undo_stack_push));
}
last_selected_rowref_.reset(new TreeRowRef(treestore_, Gtk::TreePath(iter)));
......
......@@ -70,17 +70,19 @@ public:
void set_fallback_encoding(const std::string& fallback_encoding);
std::string get_fallback_encoding() const;
SigC::Signal2<void,FileInfoPtr,int> signal_switch_buffer;
SigC::Signal0<void> signal_bound_state_changed;
SigC::Signal0<void> signal_file_count_changed;
SigC::Signal0<void> signal_match_count_changed;
SigC::Signal0<void> signal_modified_count_changed;
SigC::Signal0<bool> signal_pulse;
SigC::Signal1<void,UndoActionPtr> signal_undo_stack_push;
sigc::signal<void, FileInfoPtr, int> signal_switch_buffer;
sigc::signal<void> signal_bound_state_changed;
sigc::signal<void> signal_file_count_changed;
sigc::signal<void> signal_match_count_changed;
sigc::signal<void> signal_modified_count_changed;
sigc::signal<bool> signal_pulse;
sigc::signal<void, UndoActionPtr> signal_undo_stack_push;
protected:
virtual void on_style_changed(const Glib::RefPtr<Gtk::Style>& previous_style);
virtual bool on_buffer_pulse();
private:
class TreeRowRef;
class MessageList;
......
......@@ -149,7 +149,7 @@ FileTree::ReplaceMatchesData::ReplaceMatchesData(FileTree& filetree_,
filetree (filetree_),
substitution (substitution_),
undo_stack (new UndoStack()),
slot_undo_stack_push (SigC::slot_class(*this, &FileTree::ReplaceMatchesData::undo_stack_push))
slot_undo_stack_push (sigc::mem_fun(*this, &FileTree::ReplaceMatchesData::undo_stack_push))
{}
FileTree::ReplaceMatchesData::~ReplaceMatchesData()
......
......@@ -155,7 +155,7 @@ struct FileTree::ReplaceMatchesData
const Glib::ustring substitution;
FileTree::TreeRowRefPtr row_reference;
UndoStackPtr undo_stack;
const SigC::Slot1<void,UndoActionPtr> slot_undo_stack_push;
const sigc::slot<void, UndoActionPtr> slot_undo_stack_push;
void undo_stack_push(UndoActionPtr undo_action);
......
......@@ -70,7 +70,7 @@ public:
FileErrorDialog::FileErrorDialog(Gtk::Window& parent, const Glib::ustring& message,
Gtk::MessageType type, const Regexxer::FileTree::Error& error)
:
Gtk::MessageDialog(parent, message, type, Gtk::BUTTONS_OK, true)
Gtk::MessageDialog(parent, message, false, type, Gtk::BUTTONS_OK, true)
{
using namespace Gtk;
......@@ -156,29 +156,26 @@ MainWindow::MainWindow()
busy_action_iteration_ (0),
undo_stack_ (new UndoStack())
{
using SigC::bind;
using SigC::slot;
set_title_filename();
set_default_size(640, 450);
add(*Gtk::manage(create_main_vbox()));
controller_.save_file .connect(slot(*this, &MainWindow::on_save_file));
controller_.save_all .connect(slot(*this, &MainWindow::on_save_all));
controller_.undo .connect(slot(*this, &MainWindow::on_undo));
controller_.preferences .connect(slot(*this, &MainWindow::on_preferences));
controller_.quit .connect(slot(*this, &MainWindow::on_quit));
controller_.info .connect(slot(*this, &MainWindow::on_info));
controller_.find_files .connect(slot(*this, &MainWindow::on_find_files));
controller_.find_matches.connect(slot(*this, &MainWindow::on_exec_search));
controller_.next_file .connect(bind(slot(*this, &MainWindow::on_go_next_file), true));
controller_.prev_file .connect(bind(slot(*this, &MainWindow::on_go_next_file), false));
controller_.next_match .connect(bind(slot(*this, &MainWindow::on_go_next), true));
controller_.prev_match .connect(bind(slot(*this, &MainWindow::on_go_next), false));
controller_.replace .connect(slot(*this, &MainWindow::on_replace));
controller_.replace_file.connect(slot(*this, &MainWindow::on_replace_file));
controller_.replace_all .connect(slot(*this, &MainWindow::on_replace_all));
controller_.save_file .connect(sigc::mem_fun(*this, &MainWindow::on_save_file));
controller_.save_all .connect(sigc::mem_fun(*this, &MainWindow::on_save_all));
controller_.undo .connect(sigc::mem_fun(*this, &MainWindow::on_undo));
controller_.preferences .connect(sigc::mem_fun(*this, &MainWindow::on_preferences));
controller_.quit .connect(sigc::mem_fun(*this, &MainWindow::on_quit));
controller_.info .connect(sigc::mem_fun(*this, &MainWindow::on_info));
controller_.find_files .connect(sigc::mem_fun(*this, &MainWindow::on_find_files));
controller_.find_matches.connect(sigc::mem_fun(*this, &MainWindow::on_exec_search));
controller_.next_file .connect(sigc::bind(sigc::mem_fun(*this, &MainWindow::on_go_next_file), true));
controller_.prev_file .connect(sigc::bind(sigc::mem_fun(*this, &MainWindow::on_go_next_file), false));
controller_.next_match .connect(sigc::bind(sigc::mem_fun(*this, &MainWindow::on_go_next), true));
controller_.prev_match .connect(sigc::bind(sigc::mem_fun(*this, &MainWindow::on_go_next), false));
controller_.replace .connect(sigc::mem_fun(*this, &MainWindow::on_replace));
controller_.replace_file.connect(sigc::mem_fun(*this, &MainWindow::on_replace_file));
controller_.replace_all .connect(sigc::mem_fun(*this, &MainWindow::on_replace_all));
show_all_children();
load_configuration();
......@@ -188,28 +185,28 @@ MainWindow::MainWindow()
entry_pattern_->set_text("*");
button_recursive_->set_active(true);
statusline_->signal_cancel_clicked.connect(slot(*this, &MainWindow::on_busy_action_cancel));
statusline_->signal_cancel_clicked.connect(sigc::mem_fun(*this, &MainWindow::on_busy_action_cancel));
filetree_->signal_switch_buffer.connect(
slot(*this, &MainWindow::on_filetree_switch_buffer));
sigc::mem_fun(*this, &MainWindow::on_filetree_switch_buffer));
filetree_->signal_bound_state_changed.connect(
slot(*this, &MainWindow::on_filetree_bound_state_changed));
sigc::mem_fun(*this, &MainWindow::on_filetree_bound_state_changed));
filetree_->signal_file_count_changed.connect(
slot(*this, &MainWindow::on_filetree_file_count_changed));
sigc::mem_fun(*this, &MainWindow::on_filetree_file_count_changed));
filetree_->signal_match_count_changed.connect(
slot(*this, &MainWindow::on_filetree_match_count_changed));
sigc::mem_fun(*this, &MainWindow::on_filetree_match_count_changed));
filetree_->signal_modified_count_changed.connect(
slot(*this, &MainWindow::on_filetree_modified_count_changed));
sigc::mem_fun(*this, &MainWindow::on_filetree_modified_count_changed));
filetree_->signal_pulse.connect(
slot(*this, &MainWindow::on_busy_action_pulse));
sigc::mem_fun(*this, &MainWindow::on_busy_action_pulse));
filetree_->signal_undo_stack_push.connect(
slot(*this, &MainWindow::on_undo_stack_push));
sigc::mem_fun(*this, &MainWindow::on_undo_stack_push));
}
MainWindow::~MainWindow()
......@@ -305,7 +302,7 @@ Gtk::Widget* MainWindow::create_left_pane()
Button *const button_folder = new ImageLabelButton(Stock::OPEN, "Fol_der:", true);
table->attach(*manage(button_folder), 0, 1, 0, 1, FILL, AttachOptions(0));
button_folder->signal_clicked().connect(SigC::slot(*this, &MainWindow::on_select_folder));
button_folder->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_select_folder));
Label *const label_pattern = new Label("Pattern:", 0.0, 0.5);
table->attach(*manage(label_pattern), 0, 1, 1, 2, FILL, AttachOptions(0));
......@@ -322,7 +319,7 @@ Gtk::Widget* MainWindow::create_left_pane()
entry_folder_ ->signal_activate().connect(controller_.find_files.slot());
entry_pattern_->signal_activate().connect(controller_.find_files.slot());
entry_pattern_->signal_changed ().connect(SigC::slot(*this, &MainWindow::on_entry_pattern_changed));
entry_pattern_->signal_changed ().connect(sigc::mem_fun(*this, &MainWindow::on_entry_pattern_changed));
Box *const hbox = new HBox(false, 6 /* HIG */);
table->attach(*manage(hbox), 0, 2, 2, 3, EXPAND|FILL, AttachOptions(0));
......@@ -386,7 +383,7 @@ Gtk::Widget* MainWindow::create_right_pane()
entry_regex_ ->signal_activate().connect(controller_.find_matches.slot());
entry_substitution_->signal_activate().connect(controller_.find_matches.slot());
entry_substitution_->signal_changed ().connect(SigC::slot(*this, &MainWindow::update_preview));
entry_substitution_->signal_changed ().connect(sigc::mem_fun(*this, &MainWindow::update_preview));
Box *const hbox_options = new HBox(false, 6 /* HIG */);
table->attach(*manage(hbox_options), 2, 3, 0, 1, FILL, AttachOptions(0));
......@@ -446,7 +443,7 @@ bool MainWindow::confirm_quit_request()
return true;
const Glib::ustring message = "Some files haven't been saved yet.\nQuit anyway?";
Gtk::MessageDialog dialog (*this, message, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true);
Gtk::MessageDialog dialog (*this, message, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true);
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_OK);
......@@ -492,7 +489,7 @@ void MainWindow::on_find_files()
if(filetree_->get_modified_count() > 0)
{
const Glib::ustring message = "Some files haven't been saved yet.\nContinue anyway?";
Gtk::MessageDialog dialog (*this, message, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK_CANCEL, true);
Gtk::MessageDialog dialog (*this, message, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK_CANCEL, true);
if(dialog.run() != Gtk::RESPONSE_OK)
return;
......@@ -517,7 +514,7 @@ void MainWindow::on_find_files()
catch(const Pcre::Error& error)
{
const Glib::ustring message = "The file search pattern is invalid.";
Gtk::MessageDialog dialog (*this, message, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
Gtk::MessageDialog dialog (*this, message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run();
}
catch(const FileTree::Error& error)
......@@ -560,7 +557,7 @@ void MainWindow::on_exec_search()
message += ":\n";
message += error.what();
Gtk::MessageDialog dialog (*this, message, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
Gtk::MessageDialog dialog (*this, message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run();
if(offset >= 0 && offset < entry_regex_->get_text_length())
......@@ -584,7 +581,7 @@ void MainWindow::on_exec_search()
// not end up where we want to. So do that by installing an idle handler.
Glib::signal_idle().connect(
SigC::slot(*this, &MainWindow::after_exec_search),
sigc::mem_fun(*this, &MainWindow::after_exec_search),
Glib::PRIORITY_HIGH_IDLE + 25); // slightly less than redraw (+20)
}
}
......@@ -607,7 +604,7 @@ void MainWindow::on_filetree_switch_buffer(FileInfoPtr fileinfo, int file_index)
if(old_buffer)
{
std::for_each(buffer_connections_.begin(), buffer_connections_.end(),
std::mem_fun_ref(&SigC::Connection::disconnect));
std::mem_fun_ref(&sigc::connection::disconnect));
buffer_connections_.clear();
old_buffer->forget_current_match();
......@@ -625,16 +622,16 @@ void MainWindow::on_filetree_switch_buffer(FileInfoPtr fileinfo, int file_index)
if(!fileinfo->load_failed)
{
buffer_connections_.push_back(buffer->signal_match_count_changed.
connect(SigC::slot(*this, &MainWindow::on_buffer_match_count_changed)));
connect(sigc::mem_fun(*this, &MainWindow::on_buffer_match_count_changed)));
buffer_connections_.push_back(buffer->signal_modified_changed().
connect(SigC::slot(*this, &MainWindow::on_buffer_modified_changed)));
connect(sigc::mem_fun(*this, &MainWindow::on_buffer_modified_changed)));
buffer_connections_.push_back(buffer->signal_bound_state_changed.
connect(SigC::slot(*this, &MainWindow::on_buffer_bound_state_changed)));
connect(sigc::mem_fun(*this, &MainWindow::on_buffer_bound_state_changed)));
buffer_connections_.push_back(buffer->signal_preview_line_changed.
connect(SigC::slot(*this, &MainWindow::update_preview)));
connect(sigc::mem_fun(*this, &MainWindow::update_preview)));
}
set_title_filename(Util::filename_to_utf8_fallback(fileinfo->fullname));
......@@ -779,7 +776,7 @@ void MainWindow::on_save_file()
const std::list<Glib::ustring>& error_list = error.get_error_list();
g_assert(error_list.size() == 1);
Gtk::MessageDialog dialog (*this, error_list.front(), Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
Gtk::MessageDialog dialog (*this, error_list.front(), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run();
}
}
......@@ -846,12 +843,9 @@ void MainWindow::update_preview()
if(pos > 0)
{
using SigC::slot;
using SigC::bind;
using SigC::bind_return;
Glib::signal_idle().connect(
bind_return(bind(slot(*entry_preview_, &Gtk::Editable::set_position), pos), false),
sigc::bind_return(sigc::bind(sigc::mem_fun(*entry_preview_, &Gtk::Editable::set_position), pos), false),