diff --git a/data/Application.css b/data/Application.css
index 7f51954..9016560 100644
--- a/data/Application.css
+++ b/data/Application.css
@@ -12,6 +12,6 @@ button.pathbar {
padding: 0 6px;
}
-.combo {
- padding: 2.5px 3px;
+.linked .combo {
+ padding: 2.5px 3px;
}
\ No newline at end of file
diff --git a/src/API/IFileOperations.vala b/src/API/IFileOperations.vala
index ca65469..e78c9aa 100644
--- a/src/API/IFileOperations.vala
+++ b/src/API/IFileOperations.vala
@@ -20,8 +20,7 @@ namespace Taxi {
public signal void operation_added (IOperationInfo operation);
public signal void operation_removed (IOperationInfo operation);
- public signal int ask_overwrite (File destination);
-
+
public async abstract bool delete_recursive (
File file,
Cancellable? cancellable
diff --git a/src/Application.vala b/src/Application.vala
index f7e9151..e6086bc 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -67,7 +67,7 @@ public class Taxi.Taxi : Gtk.Application {
settings.bind ("maximized", main_window, "maximized", SettingsBindFlags.SET);
- main_window.show ();
+ main_window.present ();
}
public static int main (string[] args) {
diff --git a/src/Backend/FileOperations.vala b/src/Backend/FileOperations.vala
index 8592c1a..df16574 100644
--- a/src/Backend/FileOperations.vala
+++ b/src/Backend/FileOperations.vala
@@ -125,7 +125,7 @@ namespace Taxi {
} else if (file_type == FileType.REGULAR) {
var tmp_flag = *flags;
if (*flags == FileCopyFlags.NONE && destination.query_exists ()) {
- switch ((ConflictFlag)ask_overwrite (destination)) {
+ switch ((ConflictFlag) ask_overwrite (destination)) {
case ConflictFlag.REPLACE_ALL:
*flags = FileCopyFlags.OVERWRITE;
tmp_flag = *flags;
@@ -138,6 +138,7 @@ namespace Taxi {
return;
}
}
+
yield source.copy_async (
destination,
tmp_flag,
@@ -149,4 +150,39 @@ namespace Taxi {
}
}
}
+
+ private int ask_overwrite (File destination) {
+ var message_dialog = new Granite.MessageDialog (
+ _("Replace existing file?"),
+ _("\"%s\" already exists. You can replace this file, replace all conflicting files or choose not to replace the file by skipping.".printf (destination.get_basename ())),
+ new ThemedIcon ("dialog-warning"),
+ Gtk.ButtonsType.CANCEL
+ ) {
+ modal = true
+ };
+
+ var replace_all_button = new Gtk.Button.with_label (_("Replace All Conflicts"));
+ message_dialog.add_action_widget (replace_all_button, ConflictFlag.REPLACE_ALL);
+
+ var skip_button = new Gtk.Button.with_label (_("Skip"));
+ message_dialog.add_action_widget (skip_button, ConflictFlag.SKIP);
+
+ var replace_button = new Gtk.Button.with_label (_("Replace"));
+ replace_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
+ message_dialog.add_action_widget (replace_button, ConflictFlag.REPLACE);
+
+ message_dialog.show ();
+
+ int response = 0;
+ var loop = new MainLoop ();
+ message_dialog.response.connect ((response_id) => {
+ response = response_id;
+ message_dialog.destroy ();
+ loop.quit();
+ });
+
+ loop.run();
+
+ return response;
+ }
}
diff --git a/src/Frontend/MainWindow.vala b/src/Frontend/MainWindow.vala
index d42d42f..bcce8c4 100644
--- a/src/Frontend/MainWindow.vala
+++ b/src/Frontend/MainWindow.vala
@@ -27,11 +27,12 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
private Gtk.MenuButton bookmark_menu_button;
private Gtk.Stack alert_stack;
private ConnectBox connect_box;
- private Granite.Placeholder welcome;
private FilePane local_pane;
private FilePane remote_pane;
private GLib.Uri conn_uri;
- private GLib.Settings saved_state;
+ private Gtk.Popover bookmark_popover;
+ private Gtk.Box welcome_box;
+ private Gtk.Label title_label;
public MainWindow (
Gtk.Application application,
@@ -83,12 +84,8 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
child = operations_button
};
- bookmark_list = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
- margin_top = 6,
- margin_bottom = 6,
- margin_start = 3,
- margin_end = 3
- };
+ bookmark_list = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
+ bookmark_list.add_css_class (Granite.STYLE_CLASS_MENU);
var bookmark_scrollbox = new Gtk.ScrolledWindow () {
child = bookmark_list,
@@ -97,7 +94,7 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
propagate_natural_height = true,
};
- var bookmark_popover = new Gtk.Popover () {
+ bookmark_popover = new Gtk.Popover () {
child = bookmark_scrollbox,
width_request = 250
};
@@ -108,6 +105,7 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
popover = bookmark_popover,
valign = CENTER
};
+ bookmark_menu_button.add_css_class (Granite.STYLE_CLASS_LARGE_ICONS);
update_bookmark_menu ();
@@ -118,11 +116,27 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
header_bar.pack_start (spinner_revealer);
header_bar.pack_start (bookmark_menu_button);
- welcome = new Granite.Placeholder (_("Connect")) {
- description = _("Type a URL and press 'Enter' to connect to a server."),
- vexpand = true
+ var app_icon = new Gtk.Image.from_icon_name ("com.github.alecaddd.taxi") {
+ pixel_size = 64
};
+ title_label = new Gtk.Label (_("Connect"));
+ title_label.add_css_class (Granite.STYLE_CLASS_H1_LABEL);
+
+ var description_label = new Gtk.Label (_("Type a URL and press 'Enter' to\nconnect to a server.")) {
+ justify = CENTER
+ };
+
+ welcome_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6) {
+ hexpand = true,
+ vexpand = true,
+ halign = CENTER,
+ valign = CENTER
+ };
+ welcome_box.append (app_icon);
+ welcome_box.append (title_label);
+ welcome_box.append (description_label);
+
local_pane = new FilePane ();
local_pane.open.connect (on_local_open);
local_pane.navigate.connect (on_local_navigate);
@@ -146,7 +160,7 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
size_group.add_widget (remote_pane);
alert_stack = new Gtk.Stack ();
- alert_stack.add_child (welcome);
+ alert_stack.add_child (welcome_box);
alert_stack.add_child (outer_box);
toast = new Granite.Toast ("");
@@ -168,15 +182,12 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
child = grid;
- saved_state = new GLib.Settings ("com.github.alecaddd.taxi.state");
-
connect_box.connect_initiated.connect (on_connect_initiated);
connect_box.ask_hostname.connect (on_ask_hostname);
connect_box.bookmarked.connect (bookmark);
file_operation.operation_added.connect (popover.add_operation);
file_operation.operation_removed.connect (popover.remove_operation);
- // file_operation.ask_overwrite.connect (on_ask_overwrite);
popover.operations_pending.connect (show_spinner);
popover.operations_finished.connect (hide_spinner);
@@ -194,8 +205,8 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
);
conn_uri = uri;
} else {
- alert_stack.visible_child = welcome;
- welcome.title = _("Could not connect to '%s'").printf (uri.to_string ());
+ alert_stack.visible_child = welcome_box;
+ title_label.label = _("Could not connect to '%s'").printf (uri.to_string ());
}
hide_spinner ();
});
@@ -239,9 +250,10 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
halign = START
}
};
- bookmark_item.add_css_class (Granite.STYLE_CLASS_FLAT);
+ bookmark_item.add_css_class (Granite.STYLE_CLASS_MENUITEM);
bookmark_item.clicked.connect (() => {
connect_box.go_to_uri (uri);
+ bookmark_popover.popdown ();
});
bookmark_list.append (bookmark_item);
@@ -388,25 +400,4 @@ class Taxi.MainWindow : Gtk.ApplicationWindow {
private GLib.Uri on_ask_hostname () {
return conn_uri;
}
-
- // private int on_ask_overwrite (File destination) {
- // var dialog = new Gtk.MessageDialog (
- // this,
- // Gtk.DialogFlags.MODAL,
- // Gtk.MessageType.QUESTION,
- // Gtk.ButtonsType.NONE,
- // _("Replace existing file?")
- // );
- // dialog.format_secondary_markup (
- // _("\"%s\" already exists. You can replace this file, replace all conflicting files or choose not to replace the file by skipping.".printf (destination.get_basename ()))
- // );
- // dialog.add_button (_("Replace All Conflicts"), 2);
- // dialog.add_button (_("Skip"), 0);
- // dialog.add_button (_("Replace"), 1);
- // dialog.get_widget_for_response (1).get_style_context ().add_class ("suggested-action");
-
- // var response = dialog.run ();
- // dialog.destroy ();
- // return response;
- // }
}
diff --git a/src/Frontend/Widgets/ConnectBox.vala b/src/Frontend/Widgets/ConnectBox.vala
index dd46bfd..4a4030a 100644
--- a/src/Frontend/Widgets/ConnectBox.vala
+++ b/src/Frontend/Widgets/ConnectBox.vala
@@ -30,7 +30,6 @@ namespace Taxi {
string[] entries = {"FTP", "SFTP", "DAV", "AFP"};
protocol_combobox = new Gtk.ComboBoxText ();
- protocol_combobox.add_css_class ("combobox-linked");
foreach (var entry in entries) {
protocol_combobox.append_text (entry);
}
diff --git a/src/Frontend/Widgets/OperationsPopover.vala b/src/Frontend/Widgets/OperationsPopover.vala
index 73f7753..a5bb049 100644
--- a/src/Frontend/Widgets/OperationsPopover.vala
+++ b/src/Frontend/Widgets/OperationsPopover.vala
@@ -45,7 +45,7 @@ namespace Taxi {
grid.attach (placeholder, 0, 0);
}
- public void add_operation (IOperationInfo operation) {
+ public async void add_operation (IOperationInfo operation) {
if (grid.get_child_at (0, 0) == placeholder) {
grid.remove (placeholder);
operations_pending ();
@@ -53,19 +53,18 @@ namespace Taxi {
var row = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
operation_map.set (operation, row);
- row.append (new Gtk.Label (operation.get_file_name ()));
+ var icon = yield operation.get_file_icon ();
+ row.append (new Gtk.Image.from_gicon (icon));
- operation.get_file_icon.begin ((obj, res) => {
- row.append (
- new Gtk.Image.from_gicon (
- operation.get_file_icon.end (res)
- )
- );
+ row.append (new Gtk.Label (operation.get_file_name ()) {
+ margin_start = 6
});
- var cancel = new Gtk.Image.from_icon_name ("process-stop-symbolic");
- var cancel_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
- cancel_container.append (cancel);
+ var cancel_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
+ hexpand = true,
+ halign = END
+ };
+ cancel_container.append (new Gtk.Image.from_icon_name ("process-stop-symbolic"));
var click_controller = new Gtk.GestureClick ();
cancel_container.add_controller (click_controller);