[polari/wip/fmuellner/paste-confirmation: 11/16] entryArea: Use paste-confirmation area for upload notification



commit dbb3283abc55f95dab85cb731913ebe529ddc13f
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 11 22:24:17 2016 +0100

    entryArea: Use paste-confirmation area for upload notification

 data/resources/entry-area.ui |   23 ++++++++++++++++++++++-
 src/entryArea.js             |    8 ++++++++
 2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/data/resources/entry-area.ui b/data/resources/entry-area.ui
index af10152..149f4bf 100644
--- a/data/resources/entry-area.ui
+++ b/data/resources/entry-area.ui
@@ -102,8 +102,25 @@
             <property name="margin">6</property>
             <property name="margin-end">14</property>
             <child>
-              <object class="GtkLabel" id="confirmLabel">
+              <object class="GtkSpinner">
                 <property name="visible">True</property>
+                <property name="active" bind-source="uploadLabel"
+                          bind-property="visible" bind-flags="sync-create" />
+              </object>
+            </child>
+            <child>
+              <object class="GtkLabel" id="uploadLabel">
+                <property name="visible" bind-source="confirmLabel"
+                          bind-property="visible"
+                          bind-flags="sync-create|invert-boolean" />
+                <property name="halign">start</property>
+                <property name="hexpand">True</property>
+                <property name="ellipsize">end</property>
+                <property name="xalign">0</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkLabel" id="confirmLabel">
                 <property name="halign">start</property>
                 <property name="hexpand">True</property>
                 <property name="ellipsize">end</property>
@@ -116,6 +133,8 @@
                 <property name="visible">True</property>
                 <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
+                <property name="sensitive" bind-source="confirmLabel"
+                          bind-property="visible" bind-flags="sync-create" />
               </object>
             </child>
             <child>
@@ -124,6 +143,8 @@
                 <property name="visible">True</property>
                 <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
+                <property name="sensitive" bind-source="confirmLabel"
+                          bind-property="visible" bind-flags="sync-create" />
                 <style>
                   <class name="suggested-action"/>
                 </style>
diff --git a/src/entryArea.js b/src/entryArea.js
index 1b46285..5167bac 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -75,6 +75,7 @@ const EntryArea = new Lang.Class({
                        'changeButton',
                        'pasteBox',
                        'confirmLabel',
+                       'uploadLabel',
                        'cancelButton',
                        'pasteButton'],
     Properties: {
@@ -221,6 +222,7 @@ const EntryArea = new Lang.Class({
 
         if (content) {
             this._pasteButton.grab_focus();
+            this._confirmLabel.show();
             this.visible_child_name = 'paste-confirmation';
         } else {
             this._chatEntry.grab_focus_without_selecting();
@@ -233,11 +235,16 @@ const EntryArea = new Lang.Class({
             ngettext("Paste %s line of text to public paste service?",
                      "Paste %s lines of text to public paste service?",
                      nLines).format(nLines);
+        this._uploadLabel.label =
+            ngettext("Uploading %s line of text to public paste service …",
+                     "Uploading %s lines of text to public paste service …",
+                     nLines).format(nLines);
         this._setPasteContent(text);
     },
 
     _onImagePasted: function(entry, pixbuf) {
         this._confirmLabel.label = _("Upload image to public paste service?");
+        this._uploadLabel.label = _("Uploading image to public paste service …");
         this._setPasteContent(pixbuf);
     },
 
@@ -258,6 +265,7 @@ const EntryArea = new Lang.Class({
                 if (url)
                     this._chatEntry.emit('insert-at-cursor', url);
             }));
+        this._confirmLabel.hide();
     },
 
     _onCancelClicked: function() {


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