After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 745713 - Mount operation does not handle multiline questions
Mount operation does not handle multiline questions
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
3.15.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 526582
 
 
Reported: 2015-03-05 23:40 UTC by Ross Lagerwall
Modified: 2015-03-08 11:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mount-operation: Handle multi-line questions (1023 bytes, patch)
2015-03-05 23:41 UTC, Ross Lagerwall
none Details | Review
mount-operation: Handle multi-line questions (1.07 KB, patch)
2015-03-08 08:56 UTC, Ross Lagerwall
committed Details | Review

Description Ross Lagerwall 2015-03-05 23:40:08 UTC
The gnome-shell mount operation discards all lines except the title and first line of the question, which it shouldn't.
Comment 1 Ross Lagerwall 2015-03-05 23:41:25 UTC
Created attachment 298669 [details] [review]
mount-operation: Handle multi-line questions

Don't discard multiple lines when updating the message label.
Comment 2 Ross Lagerwall 2015-03-05 23:41:57 UTC
This can also be seen when mounting an sftp host for the first time, some lines are missing.
Comment 3 Ondrej Holy 2015-03-06 10:17:50 UTC
Review of attachment 298669 [details] [review]:

Looks good to me, see screenshots in the Bug 526582, but I'm not gnome-shell maintainer, so please somebody else to look at the patch and to set patch status appropriately...
Comment 4 Florian Müllner 2015-03-06 11:50:24 UTC
Review of attachment 298669 [details] [review]:

::: js/ui/shellMountOperation.js
@@ +50,1 @@
     let labels = message.split('\n');

Grrr, would be neat if split('\n', 2) behaved like g_strsplit() here :-(

@@ +52,3 @@
     _setLabelText(dialog.subjectLabel, labels[0]);
+    if (labels.length > 1) {
+        labels.shift();

Slightly more elegant as:

_setLabelText(dialog.subjectLabel, labels.shift())
if (labels.length > 0)
    _setlabelText(dialog.descriptionLabel, labels.join('\n'));


Not really in the scope of this bug, but looking at the GMountOperation documentation:
  "If the message contains a line break, the first line should be presented as a heading."
I wonder if the following would match expectations more closely:

  let labels = message.split('\n');

  if (labels.length > 1)  // there's a heading
      _setLabelText(dialog.subjectlabel, labels.shift());
  _setLabelText(dialog.descriptionLabel, labels.join('\n');
Comment 5 Ross Lagerwall 2015-03-08 08:56:30 UTC
Created attachment 298798 [details] [review]
mount-operation: Handle multi-line questions

Don't discard multiple lines when updating the message label.
Comment 6 Ross Lagerwall 2015-03-08 08:58:40 UTC
(In reply to Florian Müllner from comment #4)
> Review of attachment 298669 [details] [review] [review]:
> 
> ::: js/ui/shellMountOperation.js
> @@ +50,1 @@
>      let labels = message.split('\n');
> 
> Grrr, would be neat if split('\n', 2) behaved like g_strsplit() here :-(

Yeah, that's what I thought :-)

> 
> @@ +52,3 @@
>      _setLabelText(dialog.subjectLabel, labels[0]);
> +    if (labels.length > 1) {
> +        labels.shift();
> 
> Slightly more elegant as:
> 
> _setLabelText(dialog.subjectLabel, labels.shift())
> if (labels.length > 0)
>     _setlabelText(dialog.descriptionLabel, labels.join('\n'));

Done.

> 
> 
> Not really in the scope of this bug, but looking at the GMountOperation
> documentation:
>   "If the message contains a line break, the first line should be presented
> as a heading."
> I wonder if the following would match expectations more closely:
> 
>   let labels = message.split('\n');
> 
>   if (labels.length > 1)  // there's a heading
>       _setLabelText(dialog.subjectlabel, labels.shift());
>   _setLabelText(dialog.descriptionLabel, labels.join('\n');

I tried that, but it doesn't look good because the description text is rather small for a one line question like "Are you sure you want to continue?". Also, it doesn't line up with the icon then.
Comment 7 Florian Müllner 2015-03-08 09:51:23 UTC
Review of attachment 298798 [details] [review]:

(In reply to Ross Lagerwall from comment #6)
>
> >   if (labels.length > 1)  // there's a heading
> >       _setLabelText(dialog.subjectlabel, labels.shift());
> >   _setLabelText(dialog.descriptionLabel, labels.join('\n');
> 
> I tried that, but it doesn't look good because the description text is
> rather small for a one line question like "Are you sure you want to
> continue?". Also, it doesn't line up with the icon then.

Yeah, I was pretty sure our dialogs wouldn't deal with a missing title ...
Comment 8 Ross Lagerwall 2015-03-08 11:35:06 UTC
Thanks.