~umang/indicator-stickynotes/trunk

« back to all changes in this revision

Viewing changes to stickynotes/gui.py

  • Committer: Umang Varma
  • Date: 2015-07-02 02:51:57 UTC
  • Revision ID: git-v1:81a471f092caaf5fcd8327a827848b7da9a6689b
Implement import/export feature

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
 
120
120
    # workaround which is based on deleting a sticky note and re-initializing
121
121
    # it. 
122
 
    def show(self, widget=None, event=None):
 
122
    def show(self, widget=None, event=None, reload_from_backend=False):
123
123
        """Shows the stickynotes window"""
124
124
 
125
 
        # store sticky note's settings
126
 
        self.update_note()
 
125
        # don't overwrite settings if loading from backend
 
126
        if not reload_from_backend:
 
127
            # store sticky note's settings
 
128
            self.update_note()
 
129
        else:
 
130
            # Categories may have changed in backend
 
131
            self.populate_menu()
127
132
 
128
133
        # destroy its main window
129
134
        self.winMain.destroy()
301
306
    winAbout.destroy()
302
307
    return ret
303
308
 
304
 
def show_export_file_chooser():
305
 
    winChoose = Gtk.FileChooserDialog(_("Export Data"), None,
306
 
            Gtk.FileChooserAction.SAVE, (Gtk.STOCK_CANCEL,
307
 
            Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT))
308
 
    winChoose.set_do_overwrite_confirmation(True)
309
 
    response = winChoose.run()
310
 
    filename = None
311
 
    if response == Gtk.ResponseType.ACCEPT:
312
 
        filename =  winChoose.get_filename()
313
 
    winChoose.destroy()
314
 
    return filename
315
 
 
316
309
class SettingsCategory:
317
310
    """Widgets that handle properties of a category"""
318
311
    def __init__(self, settingsdialog, cat):