Commit c0a5a828 authored by Michael Terry's avatar Michael Terry

Fix all current deprecation warnings.

These changes drop support for desktop environments that don't support
GtkNotification.
parent f072305f
......@@ -85,5 +85,5 @@ configure_file(input: 'org.gnome.DejaDup.policy.in',
resources = gnome.compile_resources('resources', 'resources.xml',
source_dir: ['ui'])
message('You may need to recompile your gsettings schemas or regenerate
your icon cache after installation.')
message('''You may need to recompile your gsettings schemas or regenerate
your icon cache after installation.''')
......@@ -326,7 +326,7 @@ public abstract class AssistantOperation : Assistant
l.halign = Gtk.Align.START;
l.max_width_chars = 50;
l.wrap = true;
l.margin_left = 12;
l.margin_start = 12;
l.use_markup = true;
page.attach(l, 0, rows++, 1, 1);
backend_install_packages = l;
......
......@@ -186,7 +186,7 @@ public class AssistantRestoreMissing : AssistantRestore {
treeview.set_headers_visible (true);
filelistwindow.add_with_viewport(treeview);
filelistwindow.add(treeview);
return page;
}
......@@ -252,10 +252,10 @@ public class AssistantRestoreMissing : AssistantRestore {
if (!fileobj.query_exists(null) && !this.allfiles_prev.lookup_extended(filestr, null, null)) {
if(fileobj.has_parent(this.list_directory)) {
var fs = new DeletedFile(filestr, op.time);
var fs = new DeletedFile(filestr, op.get_time());
this.listmodel.append (out this.deleted_iter);
this.listmodel.set (this.deleted_iter, 0, false, 1, fs.filename(), 2, op.time.format("%c"));
this.listmodel.set (this.deleted_iter, 0, false, 1, fs.filename(), 2, op.get_time().format("%c"));
this.allfiles_prev.insert(fileobj.get_path(), fs);
}
......
......@@ -31,7 +31,6 @@ using GLib;
public class MountOperationAssistant : MountOperation
{
public string label_button {get; set;}
public string label_help {get; set;}
public string label_title {get; set; default = _("Connect to Server");}
public string label_username {get; set; default = _("_Username");}
......@@ -160,14 +159,6 @@ public class MountOperationAssistant : MountOperation
label = new Gtk.Label("");
layout.pack_start(label, false, false, 0);
if (label_button != null) {
var alignment = new Gtk.Alignment(0.5f, 0.5f, 0, 0);
var button = new Gtk.Button.with_mnemonic(label_button);
button.clicked.connect(() => {button_clicked();});
alignment.add(button);
layout.pack_start(alignment, false, false, 0);
}
if ((flags & AskPasswordFlags.ANONYMOUS_SUPPORTED) != 0) {
anonymous_w = new Gtk.RadioButton.with_mnemonic(null, _("Connect _anonymously"));
anonymous_w.toggled.connect((b) => {check_valid_inputs();});
......@@ -274,8 +265,6 @@ public class MountOperationAssistant : MountOperation
var valid = is_anonymous() ||
(is_valid_entry(username_w) &&
is_valid_entry(domain_w));
if (label_button != null)
valid = false; // buttons are used for backend-driven authentication
assist.allow_forward(valid);
}
......
......@@ -247,14 +247,13 @@ public class Preferences : Gtk.Grid
table.halign = Gtk.Align.CENTER;
row = 0;
var align = new Gtk.Alignment(0.0f, 0.5f, 0.0f, 0.0f);
w = new DejaDup.PreferencesPeriodicSwitch();
align.add(w);
w.halign = Gtk.Align.START;
label = new Gtk.Label.with_mnemonic(_("_Automatic backup"));
label.mnemonic_widget = w;
label.xalign = 1.0f;
table.attach(label, 0, row, 1, 1);
table.attach(align, 1, row, 1, 1);
table.attach(w, 1, row, 1, 1);
++row;
w = new DejaDup.ConfigPeriod(DejaDup.PERIODIC_PERIOD_KEY);
......@@ -308,8 +307,8 @@ public class Preferences : Gtk.Grid
Gtk.Grid new_panel()
{
var table = new Gtk.Grid();
table.margin_left = PAGE_HMARGIN;
table.margin_right = PAGE_HMARGIN;
table.margin_start = PAGE_HMARGIN;
table.margin_end = PAGE_HMARGIN;
table.margin_top = PAGE_VMARGIN;
table.margin_bottom = PAGE_VMARGIN;
return table;
......
......@@ -19,17 +19,10 @@
using GLib;
public Gtk.Window? prompt(Gtk.Application app)
public void prompt(Gtk.Application app)
{
DejaDup.update_prompt_time();
// In GNOME Shell, we show a notification. Elsewhere, we show a dialog.
if (DejaDup.get_shell() == DejaDup.ShellEnv.GNOME) {
show_prompt_notification(app);
return null;
}
else
return show_prompt_dialog(app);
show_prompt_notification(app);
}
string get_header()
......@@ -69,30 +62,3 @@ void show_prompt_notification(Gtk.Application app)
app.send_notification("prompt", note);
}
Gtk.Window show_prompt_dialog(Gtk.Application app)
{
var dlg = new Gtk.MessageDialog(null, 0, Gtk.MessageType.INFO,
Gtk.ButtonsType.NONE, "%s", get_header());
dlg.format_secondary_text("%s", get_body());
dlg.skip_taskbar_hint = false;
dlg.set_title(_("Backups"));
var img = new Gtk.Image.from_icon_name("org.gnome.DejaDup", Gtk.IconSize.DIALOG);
img.yalign = 0.0f;
img.show();
dlg.set_image(img);
dlg.add_buttons(get_cancel_button(true), Gtk.ResponseType.REJECT,
get_ok_button(true), Gtk.ResponseType.ACCEPT);
dlg.response.connect((dlg, resp) => {
if (resp == Gtk.ResponseType.REJECT)
app.activate_action("prompt-cancel", null);
else if (resp == Gtk.ResponseType.ACCEPT)
app.activate_action("prompt-ok", null);
DejaDup.destroy_widget(dlg);
});
DejaDup.show_background_window_for_shell(dlg);
return dlg;
}
......@@ -19,36 +19,11 @@
using GLib;
/**
* There are two modes for 'shell' integration:
* 1) GNOME Shell
* 2) Legacy
*
* GNOME Shell:
* No status icon at all.
* Actions on persistent notifications.
* Automatic-start and success notifications.
*
* Legacy:
* Standard GTK+ status icon.
* Success notification.
*/
public abstract class StatusIcon : Object
{
public static StatusIcon create(Gtk.Window window, DejaDup.Operation op, bool automatic)
{
StatusIcon instance = null;
switch (DejaDup.get_shell()) {
case DejaDup.ShellEnv.GNOME:
instance = new ShellStatusIcon(window, op, automatic);
break;
default:
instance = new LegacyStatusIcon(window, op, automatic);
break;
}
return instance;
return new ShellStatusIcon(window, op, automatic);
}
public signal void show_window(bool user_click);
......@@ -123,31 +98,3 @@ class ShellStatusIcon : StatusIcon
}
}
class LegacyStatusIcon : StatusIcon
{
public LegacyStatusIcon(Gtk.Window window, DejaDup.Operation op, bool automatic)
{
Object(window: window, op: op, automatic: automatic);
}
Gtk.StatusIcon icon;
construct {
icon = new Gtk.StatusIcon();
icon.icon_name = "org.gnome.DejaDup";
icon.title = Environment.get_application_name();
icon.activate.connect(() => {show_window(true);});
update_progress();
}
protected override void update_progress()
{
var tooltip = "";
if (this.action != null)
tooltip = this.action;
if (this.progress > 0)
tooltip = tooltip + "\n" + _("%.1f%% complete").printf(this.progress * 100);
icon.set_tooltip_text(tooltip);
}
}
ar
bg
bs
ca
cs
da
de
el
en_AU
en_GB
eo
es
eu
fi
fr
gl
he
hr
hu
id
it
ja
ko
ku
lt
my
nb
nl
oc
pa
pl
ps
pt_BR
ru
sk
sl
sr
sv
th
tr
vi
zh_CN
zh_TW
......@@ -16,51 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
help_linguas = [
'ar',
'bg',
'bs',
'ca',
'cs',
'da',
'de',
'el',
'en_AU',
'en_GB',
'eo',
'es',
'eu',
'fi',
'fr',
'gl',
'he',
'hr',
'hu',
'id',
'it',
'ja',
'ko',
'ku',
'lt',
'my',
'nb',
'nl',
'oc',
'pa',
'pl',
'ps',
'pt_BR',
'ru',
'sk',
'sl',
'sr',
'sv',
'th',
'tr',
'vi',
'zh_CN',
'zh_TW']
gnome.yelp('org.gnome.DejaDup',
sources: ['backup-auto.page',
'backup-first.page',
......@@ -75,11 +30,9 @@ gnome.yelp('org.gnome.DejaDup',
'restore-worst-case.page',
'support.page'],
media: ['figures/deja-dup-icon.png'],
languages: help_linguas,
symlink_media: true)
validate_help_linguas = find_program('./validate-linguas')
test('help-linguas', validate_help_linguas,
env: ['LC_ALL=C.UTF-8',
'LINGUAS=' + ' '.join(help_linguas)],
env: ['LC_ALL=C.UTF-8'],
workdir: meson.current_source_dir())
......@@ -18,7 +18,7 @@
# along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
available=$(ls */ -1d | cut -d/ -f1 | grep -v '^C$')
linguas=$(echo $LINGUAS | sed 's/ /\n/g')
linguas=$(cat LINGUAS)
test -n "$linguas"
test "$available" = "$linguas"
......@@ -133,9 +133,7 @@ public class DejaDupApp : Gtk.Application
send_delay_notification(reason);
}
else if (options.contains("prompt")) {
var toplevel = prompt(this);
if (toplevel != null)
add_window(toplevel);
prompt(this);
} else {
activate();
}
......
......@@ -33,24 +33,6 @@ public void show_uri(Gtk.Window? parent, string link)
}
}
public enum ShellEnv {
NONE,
GNOME,
LEGACY
}
private ShellEnv shell = ShellEnv.NONE;
public ShellEnv get_shell()
{
if (shell == ShellEnv.NONE) {
// Use Legacy unless we detect a different shell.
var desktop = Environment.get_variable("XDG_CURRENT_DESKTOP");
shell = desktop.contains("GNOME") ? ShellEnv.GNOME : ShellEnv.LEGACY;
}
return shell;
}
bool user_focused(Gtk.Widget win, Gdk.EventFocus e)
{
((Gtk.Window)win).urgency_hint = false;
......
......@@ -22,8 +22,9 @@ using GLib;
namespace DejaDup {
public class OperationFiles : Operation {
public signal void listed_current_files(string date, string file);
public Time time {get; set;} // Default value is 1900-01-00 00:00:00; since epoch hasn't happened yet, its default %s value is -1
public File source {get; construct;}
private Time time; // Default value is 1900-01-00 00:00:00; since epoch hasn't happened yet, its default %s value is -1
public OperationFiles(Backend backend,
Time? time_in,
......@@ -33,6 +34,11 @@ public class OperationFiles : Operation {
time = time_in;
}
public Time get_time()
{
return time;
}
protected override void connect_to_job()
{
job.listed_current_files.connect((d, date, file) => {listed_current_files(date, file);});
......
......@@ -242,15 +242,15 @@ internal class DuplicityInstance : Object
}
void kill_child() {
Posix.kill((Posix.pid_t)child_pid, Posix.SIGKILL);
Posix.kill((Posix.pid_t)child_pid, Posix.Signal.KILL);
}
void stop_child() {
Posix.kill((Posix.pid_t)child_pid, Posix.SIGSTOP);
Posix.kill((Posix.pid_t)child_pid, Posix.Signal.STOP);
}
void cont_child() {
Posix.kill((Posix.pid_t)child_pid, Posix.SIGCONT);
Posix.kill((Posix.pid_t)child_pid, Posix.Signal.CONT);
}
async void read_log_lines()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment