~glatzor/software-center/force-bad-quality

« back to all changes in this revision

Viewing changes to softwarecenter/view/dialogs.py

  • Committer: sebi at glatzor
  • Date: 2011-04-14 12:17:07 UTC
  • Revision ID: sebi@glatzor.de-20110414121707-v8z2uey7c6wlb9zp
Allow to specify an alternative action for error and message dialogs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
                  secondary=None, 
83
83
                  details=None,
84
84
                  buttons=gtk.BUTTONS_OK, 
85
 
                  type=gtk.MESSAGE_INFO):
 
85
                  type=gtk.MESSAGE_INFO,
 
86
                  alternative_action=None):
86
87
    """ run a dialog """
87
88
    dialog = DetailsMessageDialog(parent=parent, title=title,
88
89
                                  primary=primary, secondary=secondary,
89
90
                                  details=details, type=type, 
90
91
                                  buttons=buttons)
 
92
    if alternative_action:
 
93
        dialog.add_button(alternative_action, gtk.RESPONSE_YES)
91
94
    result = dialog.run()
92
95
    dialog.destroy()
93
96
    return result
94
97
 
95
 
def error(parent, primary, secondary, details=None):
 
98
def error(parent, primary, secondary, details=None, alternative_action=None):
96
99
    """ show a untitled error dialog """
97
100
    return messagedialog(parent=parent,
98
101
                         primary=primary, 
99
102
                         secondary=secondary,
100
103
                         details=details,
101
 
                         type=gtk.MESSAGE_ERROR)
 
104
                         type=gtk.MESSAGE_ERROR,
 
105
                         alternative_action=alternative_action)
102
106
 
103
107
 
104
108
class FullsizeScreenshotDialog(gtk.Dialog):