~umang/indicator-stickynotes/trunk

« back to all changes in this revision

Viewing changes to stickynotes/gui.py

  • Committer: Umang Varma
  • Date: 2015-07-02 16:43:01 UTC
  • Revision ID: git-v1:1888c61ea392380299497ed6ff1ec6ae87673a5f
Generate Gtk.MessageDialog from code instead of Glade

Most dialogs now have parents (settings being the only exception)

Show diffs side-by-side

added added

removed removed

Lines of Context:
257
257
        return False
258
258
 
259
259
    def delete(self, *args):
260
 
        confirm = self.confirmDelete.run()
261
 
        self.confirmDelete.hide()
262
 
        if confirm == 1:
 
260
        winConfirm = Gtk.MessageDialog(self.winMain, None,
 
261
                Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE,
 
262
                _("Are you sure you want to delete this note?"))
 
263
        winConfirm.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
 
264
                Gtk.STOCK_DELETE, Gtk.ResponseType.ACCEPT)
 
265
        confirm = winConfirm.run()
 
266
        winConfirm.destroy()
 
267
        if confirm == Gtk.ResponseType.ACCEPT:
263
268
            self.note.delete()
264
269
            self.winMain.destroy()
265
270
            return False
316
321
        self.path = os.path.abspath(os.path.join(os.path.dirname(__file__),
317
322
            '..'))
318
323
        self.builder.add_objects_from_file(os.path.join(self.path,
319
 
            "SettingsCategory.glade"), ["catExpander", "confirmDelete", "adjShadow"])
 
324
            "SettingsCategory.glade"), ["catExpander"])
320
325
        self.builder.connect_signals(self)
321
326
        widgets = ["catExpander", "lExp", "cbBG", "cbText", "eName",
322
327
                "confirmDelete", "fbFont"]
350
355
 
351
356
    def delete_cat(self, *args):
352
357
        """Delete a category"""
353
 
        confirm = self.confirmDelete.run()
354
 
        self.confirmDelete.hide()
355
 
        if confirm == 1:
 
358
        winConfirm = Gtk.MessageDialog(self.settingsdialog.wSettings, None,
 
359
                Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE,
 
360
                _("Are you sure you want to delete this category?"))
 
361
        winConfirm.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
 
362
                Gtk.STOCK_DELETE, Gtk.ResponseType.ACCEPT)
 
363
        confirm = winConfirm.run()
 
364
        winConfirm.destroy()
 
365
        if confirm == Gtk.ResponseType.ACCEPT:
356
366
            self.settingsdialog.delete_category(self.cat)
357
367
 
358
368
    def make_default(self, *args):