patch-deja-dup_preferences_Preferences_vala 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. $OpenBSD: patch-deja-dup_preferences_Preferences_vala,v 1.1 2016/01/17 09:48:59 ajacoutot Exp $
  2. No PackageKit on OpenBSD.
  3. --- deja-dup/preferences/Preferences.vala.orig Sun Jan 17 10:35:28 2016
  4. +++ deja-dup/preferences/Preferences.vala Sun Jan 17 10:36:17 2016
  5. @@ -62,64 +62,6 @@ public class Preferences : Gtk.Grid
  6. }
  7. }
  8. - async void install_duplicity()
  9. - {
  10. - backup_button.sensitive = false;
  11. - restore_button.sensitive = false;
  12. -
  13. - try {
  14. - var task = new Pk.Task();
  15. - var results = yield task.resolve_async(Pk.Filter.NOT_INSTALLED, {"duplicity"}, null, () => {});
  16. - if (results != null && results.get_error_code () == null) {
  17. -
  18. - // Convert from List to array (I don't know why the API couldn't be friendlier...)
  19. - var package_array = results.get_package_array();
  20. - var package_ids = new string[package_array.length + 1];
  21. - package_ids[package_array.length] = null;
  22. - for (var i = 0; i < package_array.length; i++) {
  23. - package_ids[i] = package_array.data[i].get_id();
  24. - }
  25. -
  26. - yield task.install_packages_async(package_ids, null, (p, t) => {
  27. - backup_progress.fraction = p.percentage / 100.0;
  28. - restore_progress.fraction = p.percentage / 100.0;
  29. - });
  30. -
  31. - duplicity_installed = Environment.find_program_in_path("duplicity") != null;
  32. - if (duplicity_installed) {
  33. - backup_desc.everything_installed = true;
  34. - backup_button.label = _("_Back Up Now…");
  35. - restore_desc.everything_installed = true;
  36. - restore_button.label = _("_Restore…");
  37. - auto_switch.sensitive = true;
  38. - }
  39. - }
  40. - }
  41. - catch (Error e) {
  42. - // We don't want to show authorization errors -- either the user clicked
  43. - // cancel or already entered password several times. Don't need to warn them.
  44. - // Oddly enough, I couldn't get error matching to work for this. Maybe the
  45. - // policykit bindings I copied are incomplete.
  46. - if (e.message.contains("org.freedesktop.PolicyKit.Error.NotAuthorized")) {
  47. - warning("%s\n", e.message);
  48. - } else {
  49. - Gtk.MessageDialog dlg = new Gtk.MessageDialog (get_toplevel() as Gtk.Window,
  50. - Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL,
  51. - Gtk.MessageType.ERROR,
  52. - Gtk.ButtonsType.OK,
  53. - "%s", _("Could not install"));
  54. - dlg.format_secondary_text("%s", e.message);
  55. - dlg.run();
  56. - destroy_widget(dlg);
  57. - }
  58. - }
  59. -
  60. - backup_progress.visible = false;
  61. - restore_progress.visible = false;
  62. - backup_button.sensitive = true;
  63. - restore_button.sensitive = true;
  64. - }
  65. -
  66. Gtk.Widget make_settings_page()
  67. {
  68. var settings_page = new Gtk.Grid();
  69. @@ -199,12 +141,7 @@ public class Preferences : Gtk.Grid
  70. w.halign = Gtk.Align.START;
  71. w.expand = false;
  72. (w as Gtk.Button).clicked.connect((b) => {
  73. - if (duplicity_installed) {
  74. - run_deja_dup("--restore", b.get_display().get_app_launch_context());
  75. - } else {
  76. - restore_progress.visible = true;
  77. - install_duplicity.begin();
  78. - }
  79. + run_deja_dup("--restore", b.get_display().get_app_launch_context());
  80. });
  81. restore_button = w as Gtk.Button;
  82. label_sizes.add_widget(w);
  83. @@ -245,12 +182,7 @@ public class Preferences : Gtk.Grid
  84. w.halign = Gtk.Align.START;
  85. w.expand = false;
  86. (w as Gtk.Button).clicked.connect((b) => {
  87. - if (duplicity_installed) {
  88. - run_deja_dup("--backup", b.get_display().get_app_launch_context());
  89. - } else {
  90. - backup_progress.visible = true;
  91. - install_duplicity.begin();
  92. - }
  93. + run_deja_dup("--backup", b.get_display().get_app_launch_context());
  94. });
  95. backup_button = w as Gtk.Button;
  96. label_sizes.add_widget(w);