/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/commit.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-11-30 13:25:35 UTC
  • mto: (66.2.6 trunk)
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: v.ladeuil+lp@free.fr-20061130132535-pypv8n8p2lgd0nsl
Fix #73737. Check empty message at commit time.

* dialog.py:
(about): Destroy the dialog unconditionally.
(_message_dialog): Add a 'question' type dialog. Destroy the
dialog unconditionally. Always returns the response, even if
nobody cares.
(question_dialog): New dialog.

* commit.py:
(CommitDialog.display): Give the focus to the commit message text
widget.
(CommitDialog.commit): Requires confirmation to commit with an
empty message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import bzrlib.errors as errors
29
29
from bzrlib import osutils
30
30
 
31
 
from dialog import error_dialog
 
31
from dialog import error_dialog, question_dialog
32
32
from guifiles import GLADEFILENAME
33
33
 
34
34
 
85
85
            error_dialog(_('Directory does not have a working tree'),
86
86
                         _('Operation aborted.'))
87
87
            self.close()
88
 
            return False
 
88
            dialog_shown = False
89
89
        if self.notbranch:
90
90
            error_dialog(_('Directory is not a branch'),
91
91
                         _('You can perform this action only in a branch.'))
92
92
            self.close()
93
 
            return False
 
93
            dialog_shown = False
94
94
        else:
95
95
            if self.wt.branch.get_bound_location() is not None:
96
96
                # we have a checkout, so the local commit checkbox must appear
105
105
            
106
106
            self.textview.modify_font(pango.FontDescription("Monospace"))
107
107
            self.window.show()
108
 
            return True
 
108
            dialog_shown = True
 
109
        if dialog_shown:
 
110
            # Gives the focus to the commit message area
 
111
            self.textview.grab_focus()
 
112
        return dialog_shown
109
113
    
110
114
    def _create_file_view(self):
111
115
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,   # [0] checkbox
259
263
            specific_files = self._get_specific_files()
260
264
        else:
261
265
            specific_files = None
262
 
        
 
266
 
 
267
        if message == '':
 
268
            response = question_dialog('Commit with an empty message ?',
 
269
                                       'You can describe your commit intent'
 
270
                                       +' in the message')
 
271
            if response == gtk.RESPONSE_NO:
 
272
                # Kindly give focus to message area
 
273
                self.textview.grab_focus()
 
274
                return
 
275
 
263
276
        try:
264
 
            self.wt.commit(message, 
 
277
            self.wt.commit(message,
265
278
                           allow_pointless=checkbutton_force.get_active(),
266
279
                           strict=checkbutton_strict.get_active(),
267
280
                           local=self.checkbutton_local.get_active(),