[geary/wip/778728-split-composer: 15/19] Give the insert inline image dialog a relevant title and button.



commit c54d1e30ad9f95a1c0909c2db476392127359c85
Author: Michael James Gratton <mike vee net>
Date:   Wed Oct 4 15:43:33 2017 -0700

    Give the insert inline image dialog a relevant title and button.
    
    * src/client/dialogs/attachment-dialog.vala (AttachmentDialog): Require a
      window title and button label to be passed in.
    
    * src/client/composer/composer-widget.vala (ComposerWidget): Use old
      default title and label for normal attachments, add custom ones for
      inserting images.

 src/client/composer/composer-widget.vala  |   18 ++++++++++++++++--
 src/client/dialogs/attachment-dialog.vala |    7 ++++---
 2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 509ab5b..ad2489d 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -2224,7 +2224,14 @@ public class ComposerWidget : Gtk.EventBox {
     }
 
     private void on_add_attachment() {
-        AttachmentDialog dialog = new AttachmentDialog(this.container.top_window, this.config);
+        AttachmentDialog dialog = new AttachmentDialog(
+            // Translators: Title of add attachment dialog
+            _("Attach a file"),
+            get_toplevel() as Gtk.Window,
+            // Translators: Default button label for insert image dialog
+            _("_Attach"),
+            this.config
+        );
         if (dialog.run() == Gtk.ResponseType.ACCEPT) {
             dialog.hide();
             foreach (File file in dialog.get_files()) {
@@ -2245,7 +2252,14 @@ public class ComposerWidget : Gtk.EventBox {
     }
 
     private void on_insert_image(SimpleAction action, Variant? param) {
-        AttachmentDialog dialog = new AttachmentDialog(this.container.top_window, this.config);
+        AttachmentDialog dialog = new AttachmentDialog(
+            // Translators: Title of insert image dialog
+            _("Insert an image"),
+            get_toplevel() as Gtk.Window,
+            // Translators: Default button label for insert image dialog
+            _("_Insert"),
+            this.config
+        );
         Gtk.FileFilter filter = new Gtk.FileFilter();
         // Translators: This is the name of the file chooser filter
         // when inserting an image in the composer.
diff --git a/src/client/dialogs/attachment-dialog.vala b/src/client/dialogs/attachment-dialog.vala
index 421ddb7..efb0b30 100644
--- a/src/client/dialogs/attachment-dialog.vala
+++ b/src/client/dialogs/attachment-dialog.vala
@@ -18,11 +18,12 @@ public class AttachmentDialog : Object {
 
     private Gtk.Image preview_image = new Gtk.Image();
 
-    public delegate bool Attacher(File attachment_file, bool alert_errors = true);
 
-    public AttachmentDialog(Gtk.Window? parent, Configuration config) {
+    public AttachmentDialog(string title, Gtk.Window? parent, string action, Configuration config) {
         this.config = config;
-        this.chooser = new Gtk.FileChooserNative(_("Choose a file"), parent, Gtk.FileChooserAction.OPEN, 
_("_Attach"), Stock._CANCEL);
+        this.chooser = new Gtk.FileChooserNative(
+            title, parent, Gtk.FileChooserAction.OPEN, action, Stock._CANCEL
+        );
 
         string? dir = config.attachments_dir;
         if (!Geary.String.is_empty(dir)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]