Compare commits
9 Commits
edbb7e70d5
...
c4c172ab5e
Author | SHA1 | Date |
---|---|---|
deltragon | c4c172ab5e | |
deltragon | 394028c14c | |
deltragon | 0cc4b127d1 | |
deltragon | fdbc6a39c5 | |
deltragon | ca98ec90f3 | |
deltragon | d234876123 | |
deltragon | 09c4326120 | |
deltragon | b2b5344224 | |
deltragon | eb027f7c06 |
|
@ -164,57 +164,52 @@ class SettingsDialog:
|
||||||
|
|
||||||
def on_reset_menu_clicked(self, button):
|
def on_reset_menu_clicked(self, button):
|
||||||
self.popover.hide()
|
self.popover.hide()
|
||||||
def __confirmation_dialog_response(dialog, result):
|
def __confirmation_dialog_response(widget, response_id):
|
||||||
response_id = dialog.choose_finish(result)
|
if response_id == Gtk.ResponseType.OK:
|
||||||
if response_id == 1:
|
|
||||||
utility.reset_config()
|
utility.reset_config()
|
||||||
self.config = Config()
|
self.config = Config()
|
||||||
# Remove breaks from the container
|
# Remove breaks from the container
|
||||||
self.__clear_children(self.box_short_breaks)
|
self.box_short_breaks.foreach(lambda element: self.box_short_breaks.remove(element))
|
||||||
self.__clear_children(self.box_long_breaks)
|
self.box_long_breaks.foreach(lambda element: self.box_long_breaks.remove(element))
|
||||||
self.__clear_children(self.box_plugins)
|
# Remove plugins from the container
|
||||||
|
self.box_plugins.foreach(lambda element: self.box_plugins.remove(element))
|
||||||
# Initialize again
|
# Initialize again
|
||||||
self.__initialize(self.config)
|
self.__initialize(self.config)
|
||||||
|
widget.destroy()
|
||||||
|
|
||||||
messagedialog = Gtk.AlertDialog()
|
messagedialog = Gtk.MessageDialog(parent=self.window,
|
||||||
messagedialog.set_modal(True)
|
flags=Gtk.DialogFlags.MODAL,
|
||||||
messagedialog.set_buttons(['_Cancel', _("Reset")])
|
type=Gtk.MessageType.WARNING,
|
||||||
messagedialog.set_message(_("Are you sure you want to reset all settings to default?"))
|
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
||||||
messagedialog.set_detail(_("You can't undo this action."))
|
_("Reset"), Gtk.ResponseType.OK),
|
||||||
|
message_format=_("Are you sure you want to reset all settings to default?"))
|
||||||
messagedialog.set_cancel_button(0)
|
messagedialog.connect("response", __confirmation_dialog_response)
|
||||||
messagedialog.set_default_button(0)
|
messagedialog.format_secondary_text(_("You can't undo this action."))
|
||||||
|
messagedialog.show()
|
||||||
messagedialog.choose(self.window, None, __confirmation_dialog_response)
|
|
||||||
|
|
||||||
def __clear_children(self, widget):
|
|
||||||
while widget.get_last_child() is not None:
|
|
||||||
widget.remove(widget.get_last_child())
|
|
||||||
|
|
||||||
def __delete_break(self, break_config, is_short, on_remove):
|
def __delete_break(self, break_config, is_short, on_remove):
|
||||||
"""
|
"""
|
||||||
Remove the break after a confirmation.
|
Remove the break after a confirmation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __confirmation_dialog_response(dialog, result):
|
def __confirmation_dialog_response(widget, response_id):
|
||||||
response_id = dialog.choose_finish(result)
|
if response_id == Gtk.ResponseType.OK:
|
||||||
if response_id == 1:
|
|
||||||
if is_short:
|
if is_short:
|
||||||
self.config.get('short_breaks').remove(break_config)
|
self.config.get('short_breaks').remove(break_config)
|
||||||
else:
|
else:
|
||||||
self.config.get('long_breaks').remove(break_config)
|
self.config.get('long_breaks').remove(break_config)
|
||||||
on_remove()
|
on_remove()
|
||||||
|
widget.destroy()
|
||||||
|
|
||||||
messagedialog = Gtk.AlertDialog()
|
messagedialog = Gtk.MessageDialog(parent=self.window,
|
||||||
messagedialog.set_modal(True)
|
flags=Gtk.DialogFlags.MODAL,
|
||||||
messagedialog.set_buttons(['_Cancel', _("Delete")])
|
type=Gtk.MessageType.WARNING,
|
||||||
messagedialog.set_message(_("Are you sure you want to delete this break?"))
|
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
||||||
messagedialog.set_detail(_("You can't undo this action."))
|
_("Delete"), Gtk.ResponseType.OK),
|
||||||
|
message_format=_("Are you sure you want to delete this break?"))
|
||||||
messagedialog.set_cancel_button(0)
|
messagedialog.connect("response", __confirmation_dialog_response)
|
||||||
messagedialog.set_default_button(0)
|
messagedialog.format_secondary_text(_("You can't undo this action."))
|
||||||
|
messagedialog.show()
|
||||||
messagedialog.choose(self.window, None, __confirmation_dialog_response)
|
|
||||||
|
|
||||||
def __create_plugin_item(self, plugin_config):
|
def __create_plugin_item(self, plugin_config):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue