From efc7d0d237f13bc03d3f2bc3b137b32c1f089bbd Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 15 Oct 2012 23:30:35 +0100 Subject: [PATCH] history: implement GTK Save As dialog --- SparkleShare/Linux/SparkleEventLog.cs | 28 +++++++++++++++++++++-- SparkleShare/SparkleEventLogController.cs | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/SparkleShare/Linux/SparkleEventLog.cs b/SparkleShare/Linux/SparkleEventLog.cs index 8f28fc09..2eb722c7 100755 --- a/SparkleShare/Linux/SparkleEventLog.cs +++ b/SparkleShare/Linux/SparkleEventLog.cs @@ -131,12 +131,35 @@ namespace SparkleShare { Present (); }); }; + + Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) { + Application.Invoke (delegate { + FileChooserDialog dialog = new FileChooserDialog ("Restore from History", + this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok); + + dialog.CurrentName = file_name; + dialog.SetCurrentFolder (target_folder_path); + + if (dialog.Run () == (int) ResponseType.Ok) + Controller.SaveDialogCompleted (dialog.Filename); + else + Controller.SaveDialogCancelled (); + + dialog.Destroy (); + }); + }; Controller.UpdateChooserEvent += delegate (string [] folders) { Application.Invoke (delegate { UpdateChooser (folders); }); }; + + Controller.UpdateChooserEnablementEvent += delegate (bool enabled) { + Application.Invoke (delegate { + this.combo_box.Sensitive = enabled; + }); + }; Controller.UpdateContentEvent += delegate (string html) { Application.Invoke (delegate { @@ -168,7 +191,7 @@ namespace SparkleShare { private void WebViewNavigationRequested (object o, WebKit.NavigationRequestedArgs args) { - Controller.LinkClicked (args.Request.Uri.Substring (7)); + Controller.LinkClicked (args.Request.Uri); // Don't follow HREFs (as this would cause a page refresh) if (!args.Request.Uri.Equals ("file:")) @@ -260,7 +283,8 @@ namespace SparkleShare { html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - + html = html.Replace ("", "85%"); + html = html.Replace ("", pixmaps_path); html = html.Replace ("", diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index 53dca419..aa5a383b 100755 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -226,7 +226,7 @@ namespace SparkleShare { { url = url.Replace ("%20", " "); - if (url.StartsWith (Path.VolumeSeparatorChar.ToString ()) || + if (url.StartsWith ("file://") || url.Substring (1, 1).Equals (":")) { Program.Controller.OpenFile (url);