/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: Szilveszter Farkas (Phanatic)
  • Date: 2006-10-31 21:09:50 UTC
  • mfrom: (91.1.9 trunk)
  • Revision ID: Szilveszter.Farkas@gmail.com-20061031210950-3cdc975d423126e4
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import pango
27
27
 
28
28
import bzrlib.errors as errors
 
29
from bzrlib import osutils
29
30
 
30
31
from dialog import error_dialog
31
 
from gladefile import GLADEFILENAME
 
32
from guifiles import GLADEFILENAME
32
33
 
33
34
 
34
35
class CommitDialog:
35
36
    """ Display Commit dialog and perform the needed actions. """
36
37
    def __init__(self, wt, wtpath, standalone=False):
37
38
        """ Initialize the Commit dialog.
38
 
        @param  wt:         bzr working tree object
39
 
        @param  wtpath:     path to working tree root
40
 
        @param  standalone: when used in gcommit command as standalone window
 
39
        :param  wt:         bzr working tree object
 
40
        :param  wtpath:     path to working tree root
 
41
        :param  standalone: when used in gcommit command as standalone window
41
42
                            this argument should be True
42
43
        """
43
44
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_commit', 'olive-gtk')
75
76
 
76
77
        if self.standalone:
77
78
            dic["on_button_commit_cancel_clicked"] = self.quit
 
79
            self.window.connect("delete_event", gtk.main_quit)
78
80
        
79
81
        # Connect the signals to the handlers
80
82
        self.glade.signal_autoconnect(dic)
107
109
            
108
110
    
109
111
    def _create_file_view(self):
110
 
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
111
 
                                        gobject.TYPE_STRING,
112
 
                                        gobject.TYPE_STRING)
 
112
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,   # [0] checkbox
 
113
                                        gobject.TYPE_STRING,    # [1] path to display
 
114
                                        gobject.TYPE_STRING,    # [2] changes type
 
115
                                        gobject.TYPE_STRING)    # [3] real path
113
116
        self.file_view.set_model(self.file_store)
114
117
        crt = gtk.CellRendererToggle()
115
118
        crt.set_property("activatable", True)
122
125
                                     gtk.CellRendererText(), text=2))
123
126
 
124
127
        for path, id, kind in self.delta.added:
125
 
            self.file_store.append([ True, path, _('added') ])
 
128
            marker = osutils.kind_marker(kind)
 
129
            self.file_store.append([ True, path+marker, _('added'), path ])
126
130
 
127
131
        for path, id, kind in self.delta.removed:
128
 
            self.file_store.append([ True, path, _('removed') ])
 
132
            marker = osutils.kind_marker(kind)
 
133
            self.file_store.append([ True, path+marker, _('removed'), path ])
129
134
 
130
135
        for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
131
 
            self.file_store.append([ True, oldpath, _('renamed') ])
 
136
            marker = osutils.kind_marker(kind)
 
137
            if text_modified or meta_modified:
 
138
                changes = _('renamed and modified')
 
139
            else:
 
140
                changes = _('renamed')
 
141
            self.file_store.append([ True,
 
142
                                     oldpath+marker + '  =>  ' + newpath+marker,
 
143
                                     changes,
 
144
                                     newpath
 
145
                                   ])
132
146
 
133
147
        for path, id, kind, text_modified, meta_modified in self.delta.modified:
134
 
            self.file_store.append([ True, path, _('modified') ])
 
148
            marker = osutils.kind_marker(kind)
 
149
            self.file_store.append([ True, path+marker, _('modified'), path ])
135
150
    
136
151
    def _create_pending_merges(self):
137
152
        liststore = gtk.ListStore(gobject.TYPE_STRING,
159
174
        it = self.file_store.get_iter_first()
160
175
        while it:
161
176
            if self.file_store.get_value(it, 0):
162
 
                ret.append(self.file_store.get_value(it, 1))
 
177
                # get real path from hidden column 3
 
178
                ret.append(self.file_store.get_value(it, 3))
163
179
            it = self.file_store.iter_next(it)
164
180
 
165
181
        return ret