Merge lp:~elementary-apps/pantheon-mail/link-dialog-hig into lp:~elementary-apps/pantheon-mail/trunk

Proposed by Danielle Foré
Status: Needs review
Proposed branch: lp:~elementary-apps/pantheon-mail/link-dialog-hig
Merge into: lp:~elementary-apps/pantheon-mail/trunk
Diff against target: 69 lines (+35/-16)
1 file modified
src/client/composer/composer-widget.vala (+35/-16)
To merge this branch: bzr merge lp:~elementary-apps/pantheon-mail/link-dialog-hig
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+316302@code.launchpad.net

Commit message

composer-widget.vala:
* Add icon, primary, and secondary text to link dialog
* Code style
* Remove dialog close button
* Make dialog unresizable

To post a comment you must log in.
Revision history for this message
David Hewitt (davidmhewitt) wrote :

All looks/works great. I have one minor piece of feedback though. When you open the dialog, then go off to your web browser to copy the link, when you come back, the pre-filled "http://" in the text box is no longer selected. So you then have to either delete that or select it before pasting your link.

It would be good if that got re-selected when the dialog was brought into focus again if it's not too much work.

Unmerged revisions

2231. By Danielle Foré

make link dialog adhere to HIG

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/composer/composer-widget.vala'
2--- src/client/composer/composer-widget.vala 2016-07-07 19:36:17 +0000
3+++ src/client/composer/composer-widget.vala 2017-02-03 02:21:55 +0000
4@@ -1915,30 +1915,49 @@
5 existing_link = true;
6 dialog.add_buttons(Stock._REMOVE, Gtk.ResponseType.REJECT);
7 }
8-
9- dialog.add_buttons(Stock._CANCEL, Gtk.ResponseType.CANCEL, Stock._OK,
10- Gtk.ResponseType.OK);
11-
12- Gtk.Entry entry = new Gtk.Entry();
13+
14+ var icon = new Gtk.Image.from_icon_name ("insert-link", Gtk.IconSize.DIALOG);
15+ icon.valign = Gtk.Align.START;
16+
17+ var primary_label = new Gtk.Label (_("Where Should This Link Go?"));
18+ primary_label.get_style_context ().add_class ("primary");
19+ primary_label.xalign = 0;
20+
21+ var secondary_label = new Gtk.Label (_("First, find the page on the web that you want to link to. Then, copy the web address from your browser's address bar and paste it into the box below."));
22+ secondary_label.wrap = true;
23+ secondary_label.max_width_chars = 60;
24+ secondary_label.xalign = 0;
25+
26+ var entry = new Gtk.Entry ();
27+ entry.activates_default = true;
28+ entry.text = link;
29+ entry.move_cursor (Gtk.MovementStep.BUFFER_ENDS, 0, false);
30+
31 entry.changed.connect(() => {
32 // Only allow OK when there's text in the box.
33 dialog.set_response_sensitive(Gtk.ResponseType.OK,
34 !Geary.String.is_empty(entry.text.strip()));
35 });
36-
37- dialog.width_request = 350;
38- dialog.get_content_area().spacing = 7;
39- dialog.get_content_area().border_width = 10;
40- dialog.get_content_area().pack_start(new Gtk.Label("Link URL:"));
41- dialog.get_content_area().pack_start(entry);
42+
43+ var grid = new Gtk.Grid ();
44+ grid.column_spacing = 12;
45+ grid.row_spacing = 6;
46+ grid.margin = 10;
47+ grid.margin_top = 0;
48+ grid.attach (icon, 0, 0, 1, 2);
49+ grid.attach (primary_label, 1, 0, 1, 1);
50+ grid.attach (secondary_label, 1, 1, 1, 1);
51+ grid.attach (entry, 1, 2, 1, 1);
52+
53+ dialog.add_buttons (_("Cancel"), Gtk.ResponseType.CANCEL, _("Link"), Gtk.ResponseType.OK);
54+ dialog.get_action_area ().margin = 4;
55+ dialog.get_content_area ().add (grid);
56 dialog.get_widget_for_response(Gtk.ResponseType.OK).can_default = true;
57+ dialog.deletable = false;
58+ dialog.resizable = false;
59 dialog.set_default_response(Gtk.ResponseType.OK);
60 dialog.show_all();
61-
62- entry.set_text(link);
63- entry.activates_default = true;
64- entry.move_cursor(Gtk.MovementStep.BUFFER_ENDS, 0, false);
65-
66+
67 int response = dialog.run();
68
69 // Re-establish selection, since selecting text in the Entry will de-select all

Subscribers

People subscribed via source and target branches