2
# -*- coding: UTF-8 -*-
 
 
5
This module contains the application object that manages the windows
 
 
6
on screen, and can be used to create new windows of various types.
 
 
9
__copyright__ = "Copyright © 2005 Canonical Ltd."
 
 
10
__author__    = "Scott James Remnant <scott@ubuntu.com>"
 
 
18
from branchwin import BranchWindow
 
 
19
from diffwin import DiffWindow
 
 
22
class BzrkApp(object):
 
 
23
    """Application manager.
 
 
25
    This object manages the bzrk application, creating and managing
 
 
26
    individual branch windows and ensuring the application exits when
 
 
27
    the last window is closed.
 
 
30
    def show(self, branch, start, maxnum):
 
 
31
        """Open a new window to show the given branch."""
 
 
32
        window = BranchWindow(self)
 
 
33
        window.set_branch(branch, start, maxnum)
 
 
34
        window.connect("destroy", self._destroy_cb)
 
 
37
    def show_diff(self, branch, revid, parentid):
 
 
38
        """Open a new window to show a diff between the given revisions."""
 
 
40
        rev_tree = branch.repository.revision_tree(revid)
 
 
41
        parent_tree = branch.repository.revision_tree(parentid)
 
 
42
        description = revid + " - " + branch.nick
 
 
43
        window.set_diff(description, rev_tree, parent_tree)
 
 
46
    def _destroy_cb(self, widget):
 
 
47
        """Callback for when a window we manage is destroyed."""
 
 
51
        """Start the GTK+ main loop."""
 
 
55
        """Stop the GTK+ main loop."""