nemiver r911 - in trunk: . src/persp/dbgperspective



Author: dodji
Date: Thu Aug 21 22:05:31 2008
New Revision: 911
URL: http://svn.gnome.org/viewvc/nemiver?rev=911&view=rev

Log:
Close #545842 - Missing shortcut to set a breakpoint in current file.

	* src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc:
	  (SetBreakpointDialog::Priv::update_ok_button_sensitivity):
	  In MODE_SOURCE_LOCATION mode, allow the OK button to be
	  sensitive even when the user only typed in the line number.
	  It should not be mandatory to type in the file name.
	* src/persp/dbgperspective/nmv-dbg-perspective.cc:
	  (DBGPerspective::set_breakpoint_from_dialog):
	  If the user only typed the line number of the breakpoint to set,
	  assume she wants to set the breakpoint in the current file.
	  This should close:
	  #545842 - Missing shortcut to set a breakpoint in current file.


Modified:
   trunk/ChangeLog
   trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
   trunk/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc

Modified: trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc	(original)
+++ trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc	Thu Aug 21 22:05:31 2008
@@ -5536,7 +5536,17 @@
             {
                 UString filename;
                 filename = a_dialog.file_name ();
-                THROW_IF_FAIL (filename != "");
+                if (filename.empty ()) {
+                    // if the user didn't set any filename, let's assume
+                    // she wants to set a breakpoint in the current file.
+                    SourceEditor *source_editor =
+                                        get_current_source_editor ();
+                    THROW_IF_FAIL (source_editor);
+                    source_editor->get_file_name (filename);
+                    THROW_IF_FAIL (!filename.empty ());
+                    LOG_DD ("setting filename to current file name: "
+                            << filename);
+                }
                 int line = a_dialog.line_number ();
                 LOG_DD ("setting breakpoint in file "
                         << filename << " at line " << line);

Modified: trunk/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc	(original)
+++ trunk/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc	Thu Aug 21 22:05:31 2008
@@ -82,7 +82,8 @@
         a_dialog.set_default_response (Gtk::RESPONSE_OK);
 
         okbutton =
-            ui_utils::get_widget_from_glade<Gtk::Button> (a_glade, "okbutton");
+            ui_utils::get_widget_from_glade<Gtk::Button> (a_glade,
+                                                          "okbutton");
         THROW_IF_FAIL (okbutton);
         okbutton->set_sensitive (false);
 
@@ -165,11 +166,10 @@
 
         switch (a_mode) {
             case MODE_SOURCE_LOCATION:
-                // make sure there's something in both entries
-                if (!entry_filename->get_text ().empty () &&
-                    !entry_line->get_text ().empty () &&
-                    // make sure the line number field is a valid number
-                    atoi(entry_line->get_text ().c_str ())) {
+                // make sure there's something in the line number entry,
+                // at least, and that something is a valid number.
+                if (!entry_line->get_text ().empty ()
+                    && atoi (entry_line->get_text ().c_str ())) {
                     okbutton->set_sensitive (true);
                 } else {
                     okbutton->set_sensitive (false);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]