[nemiver] Find dialog is no more modal
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Find dialog is no more modal
- Date: Sat, 1 May 2010 20:30:59 +0000 (UTC)
commit 66f98f9984aea09ac5fcbed1c7425e1c96566102
Author: Dodji Seketeli <dodji gnome org>
Date: Sat May 1 22:23:24 2010 +0200
Find dialog is no more modal
* src/persp/dbgperspective/glade/findtextdialog.glade: Don't
make the dialog modal.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::on_find_text_response_signal): New signal
handler.
(DBGPerspective::get_find_text_dialog): Connect the new signal
handler above to the "signal_reponse" signal of the find text" dialog.
When the user clicks on a button of the dialog, the search is
driven by DBGPerspective::on_find_text_response_signal.
(DBGPerspective::find_in_current_file): Do not drive the search
here -- in a modal way -- anymore.
* src/persp/dbgperspective/nmv-dialog.[cc|h] (Dialog::show,
Dialog::signal_response): New fns.
* src/persp/dbgperspective/nmv-find-text-dialog.[cc|h]
(FindTextDialog::clear_selection_before_search): New fn.
.../dbgperspective/glade/findtextdialog.glade | 2 +-
src/persp/dbgperspective/nmv-dbg-perspective.cc | 88 +++++++++++--------
src/persp/dbgperspective/nmv-dialog.cc | 16 ++++
src/persp/dbgperspective/nmv-dialog.h | 4 +
src/persp/dbgperspective/nmv-find-text-dialog.cc | 17 ++++-
src/persp/dbgperspective/nmv-find-text-dialog.h | 3 +
6 files changed, 91 insertions(+), 39 deletions(-)
---
diff --git a/src/persp/dbgperspective/glade/findtextdialog.glade b/src/persp/dbgperspective/glade/findtextdialog.glade
index 99f663c..4fbd347 100644
--- a/src/persp/dbgperspective/glade/findtextdialog.glade
+++ b/src/persp/dbgperspective/glade/findtextdialog.glade
@@ -8,7 +8,7 @@
<property name="title" translatable="yes">Find text</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
+ <property name="modal">False</property>
<property name="default_width">150</property>
<property name="default_height">100</property>
<property name="resizable">True</property>
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 7e397d8..5841f19 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -285,6 +285,7 @@ private:
void on_show_commands_action ();
void on_show_errors_action ();
void on_show_target_output_action ();
+ void on_find_text_response_signal (int);
void on_breakpoint_delete_action
(const IDebugger::BreakPoint& a_breakpoint);
void on_breakpoint_go_to_source_action
@@ -1532,6 +1533,7 @@ void
DBGPerspective::on_show_target_output_action ()
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
+
NEMIVER_TRY
Glib::RefPtr<Gtk::ToggleAction> action =
@@ -1546,6 +1548,51 @@ DBGPerspective::on_show_target_output_action ()
}
void
+DBGPerspective::on_find_text_response_signal (int a_response)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+
+ if (a_response != Gtk::RESPONSE_OK) {
+ get_find_text_dialog ().hide ();
+ return;
+ }
+
+ SourceEditor * editor = get_current_source_editor ();
+ if (editor == 0)
+ return;
+
+ UString search_str;
+ FindTextDialog& find_text_dialog = get_find_text_dialog ();
+ find_text_dialog.get_search_string (search_str);
+ if (search_str == "")
+ return;
+
+ Gtk::TextIter start, end;
+ if (!editor->do_search (search_str, start, end,
+ find_text_dialog.get_match_case (),
+ find_text_dialog.get_match_entire_word (),
+ find_text_dialog.get_search_backward (),
+ find_text_dialog.clear_selection_before_search ())) {
+ UString message;
+ if (find_text_dialog.get_wrap_around ()) {
+ message = _("Reached end of file");
+ find_text_dialog.clear_selection_before_search (true);
+ } else {
+ message.printf (_("Could not find string %s"),
+ search_str.c_str ());
+ find_text_dialog.clear_selection_before_search (false);
+ }
+ ui_utils::display_info (message);
+ } else {
+ find_text_dialog.clear_selection_before_search (false);
+ }
+
+ NEMIVER_CATCH
+}
+
+void
DBGPerspective::on_breakpoint_delete_action
(const IDebugger::BreakPoint& a_breakpoint)
{
@@ -4582,6 +4629,9 @@ DBGPerspective::get_find_text_dialog ()
THROW_IF_FAIL (m_priv);
if (!m_priv->find_text_dialog) {
m_priv->find_text_dialog.reset (new FindTextDialog (plugin_path ()));
+ m_priv->find_text_dialog->signal_response ().connect
+ (sigc::mem_fun (*this,
+ &DBGPerspective::on_find_text_response_signal));
}
THROW_IF_FAIL (m_priv->find_text_dialog);
@@ -5048,43 +5098,7 @@ DBGPerspective::find_in_current_file ()
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
- SourceEditor *editor = get_current_source_editor ();
- THROW_IF_FAIL (editor);
-
- FindTextDialog& find_text_dialog = get_find_text_dialog ();
-
- bool clear_selection=false;
- for (;;) {
- int result = find_text_dialog.run ();
- if (result != Gtk::RESPONSE_OK) {
- break;
- }
-
- UString search_str;
- find_text_dialog.get_search_string (search_str);
- if (search_str == "") {break;}
-
- Gtk::TextIter start, end;
- if (!editor->do_search (search_str, start, end,
- find_text_dialog.get_match_case (),
- find_text_dialog.get_match_entire_word (),
- find_text_dialog.get_search_backward (),
- clear_selection)) {
- UString message;
- if (find_text_dialog.get_wrap_around ()) {
- message = _("Reached end of file");
- clear_selection = true;
- } else {
- message.printf (_("Could not find string %s"),
- search_str.c_str ());
- clear_selection = false;
- }
- ui_utils::display_info (message);
- } else {
- clear_selection = false;
- }
- }
- find_text_dialog.hide ();
+ get_find_text_dialog ().show ();
}
void
diff --git a/src/persp/dbgperspective/nmv-dialog.cc b/src/persp/dbgperspective/nmv-dialog.cc
index e335883..9c12f25 100644
--- a/src/persp/dbgperspective/nmv-dialog.cc
+++ b/src/persp/dbgperspective/nmv-dialog.cc
@@ -103,6 +103,14 @@ Dialog::run ()
}
void
+Dialog::show ()
+{
+ THROW_IF_FAIL (m_priv);
+ THROW_IF_FAIL (m_priv->dialog);
+ return m_priv->dialog->show ();
+}
+
+void
Dialog::hide ()
{
THROW_IF_FAIL (m_priv);
@@ -110,5 +118,13 @@ Dialog::hide ()
return m_priv->dialog->hide ();
}
+Glib::SignalProxy1<void, int>
+Dialog::signal_response ()
+{
+ THROW_IF_FAIL (m_priv);
+ THROW_IF_FAIL (m_priv->dialog);
+ return m_priv->dialog->signal_response ();
+}
+
}//end namespace nemiver
diff --git a/src/persp/dbgperspective/nmv-dialog.h b/src/persp/dbgperspective/nmv-dialog.h
index 4e51bd8..6aae7a9 100644
--- a/src/persp/dbgperspective/nmv-dialog.h
+++ b/src/persp/dbgperspective/nmv-dialog.h
@@ -74,8 +74,12 @@ public:
virtual gint run ();
+ virtual void show ();
+
virtual void hide ();
+ Glib::SignalProxy1<void, int> signal_response ();
+
};//end class nemiver
NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/persp/dbgperspective/nmv-find-text-dialog.cc b/src/persp/dbgperspective/nmv-find-text-dialog.cc
index a5fd8e3..4fc41c5 100644
--- a/src/persp/dbgperspective/nmv-find-text-dialog.cc
+++ b/src/persp/dbgperspective/nmv-find-text-dialog.cc
@@ -56,6 +56,7 @@ class FindTextDialog::Priv {
Glib::RefPtr<Gtk::ListStore> searchterm_store;
Gtk::TextIter match_start;
Gtk::TextIter match_end;
+ bool clear_selection_before_search;
Priv ();
@@ -64,7 +65,8 @@ public:
Priv (Gtk::Dialog &a_dialog,
const Glib::RefPtr<Gnome::Glade::Xml> &a_glade) :
dialog (a_dialog),
- glade (a_glade)
+ glade (a_glade),
+ clear_selection_before_search (false)
{
a_dialog.set_default_response (Gtk::RESPONSE_OK);
connect_dialog_signals ();
@@ -292,6 +294,19 @@ FindTextDialog::set_search_backward (bool a_flag)
m_priv->get_search_backwards_check_button ()->set_active (a_flag);
}
+bool
+FindTextDialog::clear_selection_before_search () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->clear_selection_before_search;
+}
+
+void
+FindTextDialog::clear_selection_before_search (bool a)
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->clear_selection_before_search = a;
+}
NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/persp/dbgperspective/nmv-find-text-dialog.h b/src/persp/dbgperspective/nmv-find-text-dialog.h
index ade01b5..a16c1c7 100644
--- a/src/persp/dbgperspective/nmv-find-text-dialog.h
+++ b/src/persp/dbgperspective/nmv-find-text-dialog.h
@@ -63,6 +63,9 @@ public:
bool get_search_backward () const;
void set_search_backward (bool a_flag);
+
+ bool clear_selection_before_search () const;
+ void clear_selection_before_search (bool);
};//end FindTextDialog
NEMIVER_END_NAMESPACE (nemiver)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]